parent
8acd087a34
commit
71d194f82a
|
|
@ -46,9 +46,9 @@ public class UserCertificateController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("所有数据")
|
@ApiOperation("所有数据")
|
||||||
@GetMapping("/listAll")
|
@PostMapping("/listAll")
|
||||||
public MultiResponse<UserCertificateCO> listAll() {
|
public MultiResponse<UserCertificateCO> listAll(@RequestBody UserCertificatePageQry qry) {
|
||||||
return MultiResponse.of(new ArrayList<UserCertificateCO>());
|
return MultiResponse.of(userCertificateService.listAll(qry));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("详情")
|
@ApiOperation("详情")
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.zcloud.certificate.command.query;
|
package com.zcloud.certificate.command.query;
|
||||||
|
|
||||||
import com.alibaba.cola.dto.MultiResponse;
|
import com.alibaba.cola.dto.MultiResponse;
|
||||||
|
import com.jjb.saas.framework.auth.model.SSOUser;
|
||||||
|
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||||
import com.zcloud.certificate.command.convertor.CorpCertificateCoConvertor;
|
import com.zcloud.certificate.command.convertor.CorpCertificateCoConvertor;
|
||||||
import com.zcloud.certificate.command.convertor.CorpCertificateStatCoConvertor;
|
import com.zcloud.certificate.command.convertor.CorpCertificateStatCoConvertor;
|
||||||
import com.zcloud.certificate.dto.CorpCertificatePageQry;
|
import com.zcloud.certificate.dto.CorpCertificatePageQry;
|
||||||
|
|
@ -41,8 +43,11 @@ public class CorpCertificateQueryExe {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public PageResponse<CorpCertificateCO> execute(CorpCertificatePageQry qry) {
|
public PageResponse<CorpCertificateCO> execute(CorpCertificatePageQry qry) {
|
||||||
|
if (qry.getEqCorpinfoId() == null) {
|
||||||
|
SSOUser ssoUser = AuthContext.getCurrentUser();
|
||||||
|
qry.setEqCorpinfoId(ssoUser != null ? ssoUser.getTenantId(): null);
|
||||||
|
}
|
||||||
Map<String, Object> params = PageQueryHelper.toHashMap(qry);
|
Map<String, Object> params = PageQueryHelper.toHashMap(qry);
|
||||||
|
|
||||||
PageResponse<CorpCertificateDO> pageResponse = corpCertificateRepository.listPage(params);
|
PageResponse<CorpCertificateDO> pageResponse = corpCertificateRepository.listPage(params);
|
||||||
List<CorpCertificateCO> examCenterCOS = corpCertificateCoConvertor.converDOsToCOs(pageResponse.getData());
|
List<CorpCertificateCO> examCenterCOS = corpCertificateCoConvertor.converDOsToCOs(pageResponse.getData());
|
||||||
return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
return PageResponse.of(examCenterCOS, pageResponse.getTotalCount(), pageResponse.getPageSize(), pageResponse.getPageIndex());
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.zcloud.certificate.command.query;
|
||||||
import com.jjb.saas.framework.auth.model.SSOUser;
|
import com.jjb.saas.framework.auth.model.SSOUser;
|
||||||
import com.jjb.saas.framework.auth.utils.AuthContext;
|
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||||
import com.zcloud.certificate.command.convertor.UserCertificateCoConvertor;
|
import com.zcloud.certificate.command.convertor.UserCertificateCoConvertor;
|
||||||
|
import com.zcloud.certificate.domain.model.UserBasicInfo;
|
||||||
import com.zcloud.certificate.domain.model.UserCertificateE;
|
import com.zcloud.certificate.domain.model.UserCertificateE;
|
||||||
import com.zcloud.certificate.dto.CorpCertificateStatPageQry;
|
import com.zcloud.certificate.dto.CorpCertificateStatPageQry;
|
||||||
import com.zcloud.certificate.dto.UserCertificatePageQry;
|
import com.zcloud.certificate.dto.UserCertificatePageQry;
|
||||||
|
|
@ -57,10 +58,13 @@ public class UserCertificateQueryExe {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public PageResponse<UserCertificateCO> execute(UserCertificatePageQry qry) {
|
public PageResponse<UserCertificateCO> execute(UserCertificatePageQry qry) {
|
||||||
|
SSOUser ssoUser = AuthContext.getCurrentUser();
|
||||||
if (qry.getIsAppQuery() != null) {
|
if (qry.getIsAppQuery() != null) {
|
||||||
SSOUser ssoUser = AuthContext.getCurrentUser();
|
qry.setEqUserId(ssoUser != null ? ssoUser.getUserId() : null);
|
||||||
qry.setEqUserId(ssoUser.getUserId());
|
}else if (qry.getEqCorpinfoId() == null) {
|
||||||
|
qry.setEqCorpinfoId(ssoUser != null ? ssoUser.getTenantId(): null);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Object> params = PageQueryHelper.toHashMap(qry);
|
Map<String, Object> params = PageQueryHelper.toHashMap(qry);
|
||||||
|
|
||||||
PageResponse<UserCertificateDO> iPage = userCertificateRepository.listPageWithUser(params);
|
PageResponse<UserCertificateDO> iPage = userCertificateRepository.listPageWithUser(params);
|
||||||
|
|
@ -70,15 +74,7 @@ public class UserCertificateQueryExe {
|
||||||
if (CollectionUtils.isEmpty(userIds)) {
|
if (CollectionUtils.isEmpty(userIds)) {
|
||||||
return PageResponse.of(Collections.emptyList(), iPage.getTotalCount(), iPage.getPageSize(), iPage.getPageIndex());
|
return PageResponse.of(Collections.emptyList(), iPage.getTotalCount(), iPage.getPageSize(), iPage.getPageIndex());
|
||||||
}
|
}
|
||||||
List<com.zcloud.certificate.domain.model.UserBasicInfo> userBasicInfos = userCertificateRepository.getUserNamesByUserIds(userIds);
|
getUserInfo(userCertificateES, userIds);
|
||||||
|
|
||||||
Map<Long, com.zcloud.certificate.domain.model.UserBasicInfo> userInfoMap = userBasicInfos.stream()
|
|
||||||
.collect(Collectors.toMap(com.zcloud.certificate.domain.model.UserBasicInfo::getUserId, info -> info, (k1, k2) -> k1));
|
|
||||||
|
|
||||||
userCertificateES.forEach(e -> {
|
|
||||||
com.zcloud.certificate.domain.model.UserBasicInfo userBasicInfo = userInfoMap.get(e.getUserId());
|
|
||||||
e.attach(userBasicInfo);
|
|
||||||
});
|
|
||||||
|
|
||||||
List<UserCertificateCO> cos = userCertificateCoConvertor.converEsToCOs(userCertificateES);
|
List<UserCertificateCO> cos = userCertificateCoConvertor.converEsToCOs(userCertificateES);
|
||||||
|
|
||||||
|
|
@ -95,6 +91,36 @@ public class UserCertificateQueryExe {
|
||||||
return PageResponse.of(cos, result.getTotalCount(), result.getPageSize(), result.getPageIndex());
|
return PageResponse.of(cos, result.getTotalCount(), result.getPageSize(), result.getPageIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有人员证照
|
||||||
|
*/
|
||||||
|
public List<UserCertificateCO> listAll(UserCertificatePageQry qry) {
|
||||||
|
Map<String, Object> params = PageQueryHelper.toHashMap(qry);
|
||||||
|
List<UserCertificateDO> list = userCertificateRepository.listAll(params);
|
||||||
|
if (CollectionUtils.isEmpty(list)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
List<UserCertificateE> userCertificateES = userCertificateCoConvertor.converDOsToEs(list);
|
||||||
|
List<Long> userIds = userCertificateES.stream().map(UserCertificateE::getUserId).distinct().collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(userIds)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
getUserInfo(userCertificateES, userIds);
|
||||||
|
|
||||||
|
return userCertificateCoConvertor.converEsToCOs(userCertificateES);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getUserInfo(List<UserCertificateE> userCertificateES, List<Long> userIds) {
|
||||||
|
List<com.zcloud.certificate.domain.model.UserBasicInfo> userBasicInfos = userCertificateRepository.getUserNamesByUserIds(userIds);
|
||||||
|
|
||||||
|
Map<Long, UserBasicInfo> userInfoMap = userBasicInfos.stream()
|
||||||
|
.collect(Collectors.toMap(UserBasicInfo::getUserId, info -> info, (k1, k2) -> k1));
|
||||||
|
|
||||||
|
userCertificateES.forEach(e -> {
|
||||||
|
UserBasicInfo userBasicInfo = userInfoMap.get(e.getUserId());
|
||||||
|
e.attach(userBasicInfo);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,9 @@ import com.zcloud.certificate.dto.clientobject.UserCertificateStatCO;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* web-app
|
* web-app
|
||||||
* @Author makejava
|
* @Author makejava
|
||||||
|
|
@ -67,5 +70,10 @@ public class UserCertificateServiceImpl implements UserCertificateServiceI {
|
||||||
public PageResponse<UserCertificateStatCO> corpCertificateStatPage(CorpCertificateStatPageQry qry) {
|
public PageResponse<UserCertificateStatCO> corpCertificateStatPage(CorpCertificateStatPageQry qry) {
|
||||||
return userCertificateQueryExe.execute(qry);
|
return userCertificateQueryExe.execute(qry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserCertificateCO> listAll(UserCertificatePageQry qry) {
|
||||||
|
return userCertificateQueryExe.listAll(qry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@ import com.alibaba.cola.dto.PageResponse;
|
||||||
import com.alibaba.cola.dto.SingleResponse;
|
import com.alibaba.cola.dto.SingleResponse;
|
||||||
import com.zcloud.certificate.dto.clientobject.UserCertificateStatCO;
|
import com.zcloud.certificate.dto.clientobject.UserCertificateStatCO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* web-client
|
* web-client
|
||||||
* @Author makejava
|
* @Author makejava
|
||||||
|
|
@ -32,5 +34,10 @@ public interface UserCertificateServiceI {
|
||||||
* 根据企业/相关方类型查询各企业/相关方各类人员证书数量
|
* 根据企业/相关方类型查询各企业/相关方各类人员证书数量
|
||||||
*/
|
*/
|
||||||
PageResponse<UserCertificateStatCO> corpCertificateStatPage(CorpCertificateStatPageQry qry);
|
PageResponse<UserCertificateStatCO> corpCertificateStatPage(CorpCertificateStatPageQry qry);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有人员证照
|
||||||
|
*/
|
||||||
|
List<UserCertificateCO> listAll(UserCertificatePageQry qry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import com.alibaba.cola.dto.PageQuery;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -68,5 +69,11 @@ public class UserCertificatePageQry extends PageQuery {
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "app 端查询表示", name = "isAppQuery")
|
@ApiModelProperty(value = "app 端查询表示", name = "isAppQuery")
|
||||||
private Integer isAppQuery;
|
private Integer isAppQuery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ids
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "用户ids", name = "inUserIds")
|
||||||
|
private List<Long> inUserId;;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,5 +31,10 @@ public interface UserCertificateRepository extends BaseRepository<UserCertificat
|
||||||
* 根据企业/相关方类型查询各企业/相关方各类人员证书数量
|
* 根据企业/相关方类型查询各企业/相关方各类人员证书数量
|
||||||
*/
|
*/
|
||||||
PageResponse<UserCertificateStatDO> selectCorpCertificateStatPage(@Param("params") Map<String, Object> params);
|
PageResponse<UserCertificateStatDO> selectCorpCertificateStatPage(@Param("params") Map<String, Object> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有人员证照
|
||||||
|
*/
|
||||||
|
List<UserCertificateDO> listAll(Map<String, Object> params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -55,5 +56,14 @@ public class UserCertificateRepositoryImpl extends BaseRepositoryImpl<UserCertif
|
||||||
IPage<UserCertificateStatDO> iPage = userCertificateMapper.selectCorpCertificateStatPage(page, params);
|
IPage<UserCertificateStatDO> iPage = userCertificateMapper.selectCorpCertificateStatPage(page, params);
|
||||||
return PageHelper.pageToResponse(iPage, iPage.getRecords());
|
return PageHelper.pageToResponse(iPage, iPage.getRecords());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserCertificateDO> listAll(Map<String, Object> params) {
|
||||||
|
QueryWrapper<UserCertificateDO> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params);
|
||||||
|
queryWrapper.orderByDesc("create_time");
|
||||||
|
List<UserCertificateDO> result = userCertificateMapper.selectList(queryWrapper);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue