feat: 监管端
parent
4408f4edff
commit
49ea218562
|
|
@ -1,6 +1,7 @@
|
|||
package org.qinan.safetyeval.adapter.web;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.qinan.safetyeval.client.dto.PageResponse;
|
||||
import org.qinan.safetyeval.client.dto.SingleResponse;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
|
@ -13,6 +14,8 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 机构资质证书适配层(Controller)
|
||||
|
|
@ -56,4 +59,10 @@ public class OrgQualificationController {
|
|||
public PageResponse<OrgQualificationCO> page(@Validated OrgQualificationPageQuery query) {
|
||||
return orgQualificationApi.page(query);
|
||||
}
|
||||
|
||||
@ApiOperation("分类查询机构资质证书")
|
||||
@GetMapping("/classGet")
|
||||
public SingleResponse<Map<String, List<OrgQualificationCO>>> classGet(@ApiParam (value = "机构信息id") @RequestParam Long id) {
|
||||
return orgQualificationApi.classGet(id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,4 +41,16 @@
|
|||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>11</source>
|
||||
<target>11</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
@ -172,6 +172,13 @@ public class OrgInfoExecutor implements OrgInfoApi {
|
|||
domainQuery.setAuthStatusCode(query.getAuthStatusCode());
|
||||
// 管理员可跨租户查询机构信息,此处保留前端传入的tenantId
|
||||
domainQuery.setTenantId(query.getTenantId());
|
||||
domainQuery.setDistrictName(query.getDistrictName());
|
||||
domainQuery.setState(query.getState());
|
||||
domainQuery.setCreateTimeStart(query.getCreateTimeStart());
|
||||
domainQuery.setCreateTimeEnd(query.getCreateTimeEnd());
|
||||
domainQuery.setRegisterAddress(query.getRegisterAddress());
|
||||
domainQuery.setFilingTypeCode(query.getFilingTypeCode());
|
||||
domainQuery.setFilingRecordStatusCode(query.getFilingRecordStatusCode());
|
||||
|
||||
PageResult<OrgInfoEntity> pageResult = orgInfoDomainService.page(domainQuery);
|
||||
|
||||
|
|
@ -238,6 +245,7 @@ public class OrgInfoExecutor implements OrgInfoApi {
|
|||
co.setAttachmentUrls(entity.getAttachmentUrls());
|
||||
co.setState(entity.getState());
|
||||
co.setTenantId(entity.getTenantId());
|
||||
co.setCreateTime(entity.getCreateTime());
|
||||
return co;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 机构资质证书执行器(App层)
|
||||
*
|
||||
|
|
@ -99,6 +103,25 @@ public class OrgQualificationExecutor implements OrgQualificationApi {
|
|||
pageResult.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SingleResponse<Map<String, List<OrgQualificationCO>>> classGet(Long id) {
|
||||
List<OrgQualificationEntity> list = orgQualificationDomainService.classGet(id);
|
||||
return SingleResponse.success(list.stream()
|
||||
.map(this::toCO)
|
||||
.collect(Collectors.groupingBy(this::resolveLicenseGroupKey, Collectors.toList())));
|
||||
}
|
||||
|
||||
/** licenseTypeCode 可能为空(如营业执照),分组键回退到 licenseTypeName */
|
||||
private String resolveLicenseGroupKey(OrgQualificationCO co) {
|
||||
if (co.getLicenseTypeCode() != null && !co.getLicenseTypeCode().isBlank()) {
|
||||
return co.getLicenseTypeCode();
|
||||
}
|
||||
if (co.getLicenseTypeName() != null && !co.getLicenseTypeName().isBlank()) {
|
||||
return co.getLicenseTypeName();
|
||||
}
|
||||
return "default";
|
||||
}
|
||||
|
||||
private OrgQualificationCO toCO(OrgQualificationEntity entity) {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@ import org.qinan.safetyeval.client.dto.OrgQualificationAddCmd;
|
|||
import org.qinan.safetyeval.client.dto.OrgQualificationModifyCmd;
|
||||
import org.qinan.safetyeval.client.dto.OrgQualificationPageQuery;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 机构资质证书接口定义(Client层)
|
||||
*
|
||||
|
|
@ -23,4 +26,6 @@ public interface OrgQualificationApi {
|
|||
SingleResponse<Void> delete(Long id);
|
||||
|
||||
PageResponse<OrgQualificationCO> page(OrgQualificationPageQuery query);
|
||||
|
||||
SingleResponse<Map<String, List<OrgQualificationCO>>> classGet(Long id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.qinan.safetyeval.client.co;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
|
|
@ -149,4 +150,7 @@ public class OrgInfoCO {
|
|||
|
||||
/** 单位ID */
|
||||
private Long orgId;
|
||||
|
||||
/** 创建时间(开户时间) */
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package org.qinan.safetyeval.client.dto;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* 机构信息分页查询参数
|
||||
|
|
@ -23,4 +25,27 @@ public class OrgInfoPageQuery extends BasePageQuery {
|
|||
|
||||
/** 租户ID */
|
||||
private Long tenantId;
|
||||
|
||||
/** 属地名称 */
|
||||
private String districtName;
|
||||
|
||||
/** 状态(0启用1禁用) */
|
||||
private Integer state;
|
||||
|
||||
/** 开户时间(创建时间)起 */
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate createTimeStart;
|
||||
|
||||
/** 开户时间(创建时间)止 */
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate createTimeEnd;
|
||||
|
||||
/** 注册地址(模糊) */
|
||||
private String registerAddress;
|
||||
|
||||
/** 备案类型编码(1审核备案2确认备案) */
|
||||
private String filingTypeCode;
|
||||
|
||||
/** 备案状态编码(1已备案2未备案) */
|
||||
private Integer filingRecordStatusCode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import lombok.Data;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 机构信息领域实体
|
||||
|
|
@ -152,4 +153,7 @@ public class OrgInfoEntity {
|
|||
private Long orgId;
|
||||
/** 创建人 */
|
||||
private Long createId;
|
||||
|
||||
/** 创建时间(开户时间) */
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import org.qinan.safetyeval.domain.entity.OrgQualificationEntity;
|
|||
import org.qinan.safetyeval.domain.query.OrgQualificationQuery;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 机构资质证书Gateway接口(Domain层定义)
|
||||
*
|
||||
|
|
@ -22,4 +24,6 @@ public interface OrgQualificationGateway {
|
|||
void delete(Long id);
|
||||
|
||||
PageResult<OrgQualificationEntity> page(OrgQualificationQuery query);
|
||||
|
||||
List<OrgQualificationEntity> classGet(Long id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package org.qinan.safetyeval.domain.query;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
|
|
@ -27,4 +28,25 @@ public class OrgInfoQuery {
|
|||
|
||||
/** 租户ID */
|
||||
private Long tenantId;
|
||||
|
||||
/** 属地名称 */
|
||||
private String districtName;
|
||||
|
||||
/** 状态(0启用1禁用) */
|
||||
private Integer state;
|
||||
|
||||
/** 创建时间起 */
|
||||
private LocalDate createTimeStart;
|
||||
|
||||
/** 创建时间止 */
|
||||
private LocalDate createTimeEnd;
|
||||
|
||||
/** 注册地址(模糊) */
|
||||
private String registerAddress;
|
||||
|
||||
/** 备案类型编码(1审核备案2确认备案) */
|
||||
private String filingTypeCode;
|
||||
|
||||
/** 备案状态编码(1已备案2未备案) */
|
||||
private Integer filingRecordStatusCode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ import org.qinan.safetyeval.domain.query.PageResult;
|
|||
import javax.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 机构资质证书领域服务
|
||||
*
|
||||
|
|
@ -48,4 +50,8 @@ public class OrgQualificationDomainService {
|
|||
public PageResult<OrgQualificationEntity> page(OrgQualificationQuery query) {
|
||||
return orgQualificationGateway.page(query);
|
||||
}
|
||||
|
||||
public List<OrgQualificationEntity> classGet(Long id) {
|
||||
return orgQualificationGateway.classGet(id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,6 +170,27 @@ public class OrgInfoGatewayImpl implements OrgInfoGateway {
|
|||
if (query.getTenantId() != null) {
|
||||
wrapper.eq(OrgInfoDO::getTenantId, query.getTenantId());
|
||||
}
|
||||
if (StringUtils.hasText(query.getDistrictName())) {
|
||||
wrapper.eq(OrgInfoDO::getDistrictName, query.getDistrictName());
|
||||
}
|
||||
if (query.getState() != null) {
|
||||
wrapper.eq(OrgInfoDO::getState, query.getState());
|
||||
}
|
||||
if (query.getCreateTimeStart() != null) {
|
||||
wrapper.ge(OrgInfoDO::getCreateTime, query.getCreateTimeStart().atStartOfDay());
|
||||
}
|
||||
if (query.getCreateTimeEnd() != null) {
|
||||
wrapper.lt(OrgInfoDO::getCreateTime, query.getCreateTimeEnd().plusDays(1).atStartOfDay());
|
||||
}
|
||||
if (StringUtils.hasText(query.getRegisterAddress())) {
|
||||
wrapper.like(OrgInfoDO::getRegisterAddress, query.getRegisterAddress());
|
||||
}
|
||||
if (StringUtils.hasText(query.getFilingTypeCode())) {
|
||||
wrapper.eq(OrgInfoDO::getFilingTypeCode, query.getFilingTypeCode());
|
||||
}
|
||||
if (query.getFilingRecordStatusCode() != null) {
|
||||
wrapper.eq(OrgInfoDO::getFilingRecordStatusCode, query.getFilingRecordStatusCode());
|
||||
}
|
||||
|
||||
Page<OrgInfoDO> page = new Page<>(query.getPageNum(), query.getPageSize());
|
||||
IPage<OrgInfoDO> result = orgInfoMapper.selectPage(page, wrapper);
|
||||
|
|
@ -323,6 +344,7 @@ public class OrgInfoGatewayImpl implements OrgInfoGateway {
|
|||
entity.setAttachmentUrls(dataObject.getAttachmentUrls());
|
||||
entity.setState(dataObject.getState());
|
||||
entity.setTenantId(dataObject.getTenantId());
|
||||
entity.setCreateTime(dataObject.getCreateTime());
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,6 +96,15 @@ public class OrgQualificationGatewayImpl implements OrgQualificationGateway {
|
|||
return PageResult.of(entities, result.getTotal(), result.getCurrent(), result.getSize());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrgQualificationEntity> classGet(Long id) {
|
||||
return orgQualificationMapper.selectList(new LambdaQueryWrapper<OrgQualificationDO>()
|
||||
.eq(OrgQualificationDO::getOrgId, id)
|
||||
.eq(OrgQualificationDO::getDeleteEnum, "false")).stream()
|
||||
.map(this::toEntity)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private OrgQualificationDO toDO(OrgQualificationEntity entity) {
|
||||
OrgQualificationDO dataObject = new OrgQualificationDO();
|
||||
dataObject.setOrgId(orgContextResolver.resolveOrgId(entity.getOrgId()));
|
||||
|
|
|
|||
Loading…
Reference in New Issue