feat(REQ-3282): 提交资质单位类型查询
This commit is contained in:
parent
7d36020e60
commit
55c754cde9
@ -29,7 +29,7 @@ public interface OrgUnitApi {
|
|||||||
* @param req
|
* @param req
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/api/unit/create")
|
@PostMapping("/api/org/unit/create")
|
||||||
ApiResult<CreateUnitResp> create(@RequestBody @Validated CreateUnitReq req);
|
ApiResult<CreateUnitResp> create(@RequestBody @Validated CreateUnitReq req);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,7 +37,7 @@ public interface OrgUnitApi {
|
|||||||
* @param req
|
* @param req
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/api/unit/update")
|
@PostMapping("/api/org/unit/update")
|
||||||
ApiResult<UpdateUnitResp> update(@RequestBody @Validated UpdateUnitReq req);
|
ApiResult<UpdateUnitResp> update(@RequestBody @Validated UpdateUnitReq req);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -48,7 +48,7 @@ public interface OrgUnitApi {
|
|||||||
* @return
|
* @return
|
||||||
* @see ListUnitReq#getPageSize()
|
* @see ListUnitReq#getPageSize()
|
||||||
*/
|
*/
|
||||||
@PostMapping("/api/unit/list")
|
@PostMapping("/api/org/unit/list")
|
||||||
ApiResult<PageResp<OrgUnitDTO>> list(@RequestBody @Validated ListUnitReq req);
|
ApiResult<PageResp<OrgUnitDTO>> list(@RequestBody @Validated ListUnitReq req);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@ public interface OrgUnitContactApi {
|
|||||||
/**
|
/**
|
||||||
* 通过单位id获取单位联系人列表
|
* 通过单位id获取单位联系人列表
|
||||||
*/
|
*/
|
||||||
@PostMapping("/api/unit/contact/list")
|
@PostMapping("/api/org/unit/contact/list")
|
||||||
ApiResult<List<OrgUnitContactDTO>> list(List<Long> ouIds);
|
ApiResult<List<OrgUnitContactDTO>> list(List<Long> ouIds);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,26 @@
|
|||||||
|
package cn.axzo.orgmanax.api.unit.feign;
|
||||||
|
|
||||||
|
import cn.axzo.foundation.result.ApiResult;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单位资质api
|
||||||
|
*/
|
||||||
|
@FeignClient(
|
||||||
|
value = "orgmanax",
|
||||||
|
url = "${axzo.service.orgmanax:http://orgmanax:8080}")
|
||||||
|
public interface OrgUnitQualificationApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据单位id获取资质类型
|
||||||
|
*
|
||||||
|
* @return 1:施工单位(施工总承包资质) 2:建设单位(房地产开发资质)3:工程监理(工程监理资质) 4:劳务分包(施工劳务资质) 5:专业分包(专业承包资质)
|
||||||
|
*/
|
||||||
|
@PostMapping("api/org/qualification/types")
|
||||||
|
ApiResult<List<Integer>> getQualificationTypesByUnitId(@RequestParam("unitId") Long unitId);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
package cn.axzo.orgmanax.infra.dao.qualification.dao;
|
||||||
|
|
||||||
|
import cn.axzo.orgmanax.infra.dao.qualification.entity.QualificationOuType;
|
||||||
|
import cn.axzo.orgmanax.infra.dao.qualification.mapper.QualificationOuTypeMapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public class QualificationOuTypeDao extends ServiceImpl<QualificationOuTypeMapper, QualificationOuType> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,66 @@
|
|||||||
|
package cn.axzo.orgmanax.infra.dao.qualification.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.*;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资质序列/单位类型
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2022-06-05 10:59:30
|
||||||
|
*/
|
||||||
|
@TableName(value = "qualification_ou_type", autoResultMap = true)
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
public class QualificationOuType implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -92011957938725711L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(
|
||||||
|
type = IdType.AUTO
|
||||||
|
)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单位id
|
||||||
|
*/
|
||||||
|
private Long ouId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业名称(冗余查询用)
|
||||||
|
*/
|
||||||
|
private String ouName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统一社会信用代码(冗余)
|
||||||
|
*/
|
||||||
|
private String uscc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资质id
|
||||||
|
*/
|
||||||
|
private Long qualificationId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资质序列/单位类型: 1:施工单位(施工总承包资质) 2:建设单位(房地产开发资质)3:工程监理(工程监理资质) 4:劳务分包(施工劳务资质) 5:专业分包(专业承包资质) 30:其他
|
||||||
|
* 建筑业企业资质证书--施工总承包、专业承包、劳务分包
|
||||||
|
* 房地产开发企业资质证书--建设单位
|
||||||
|
* 工程监理资质证书--监理单位
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
package cn.axzo.orgmanax.infra.dao.qualification.mapper;
|
||||||
|
|
||||||
|
import cn.axzo.orgmanax.infra.dao.qualification.entity.QualificationOuType;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface QualificationOuTypeMapper extends BaseMapper<QualificationOuType> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,120 @@
|
|||||||
|
package cn.axzo.orgmanax.infra.dao.qualification.repositrory;
|
||||||
|
|
||||||
|
import cn.axzo.foundation.dao.support.wrapper.CriteriaField;
|
||||||
|
import cn.axzo.foundation.dao.support.wrapper.Operator;
|
||||||
|
import cn.axzo.foundation.page.IPageReq;
|
||||||
|
import cn.axzo.foundation.page.PageReqV2;
|
||||||
|
import cn.axzo.foundation.page.PageResp;
|
||||||
|
import cn.axzo.orgmanax.infra.dao.qualification.entity.QualificationOuType;
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public interface QualificationOuTypeQueryRepository {
|
||||||
|
|
||||||
|
PageResp<QualificationOuTypeResp> page(ListReq paramReq);
|
||||||
|
|
||||||
|
default List<QualificationOuTypeResp> list(ListReq req) {
|
||||||
|
PageReq pageReq = BeanUtil.toBean(req, PageReq.class);
|
||||||
|
pageReq.setPage(1);
|
||||||
|
pageReq.setPageSize(1000);
|
||||||
|
return page(pageReq).getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
default QualificationOuTypeResp one(OneReq req) {
|
||||||
|
return oneOpt(req).orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
default Optional<QualificationOuTypeResp> oneOpt(OneReq req) {
|
||||||
|
req.check();
|
||||||
|
PageReq page = BeanUtil.toBean(req, PageReq.class);
|
||||||
|
page.setPage(1);
|
||||||
|
page.setPageSize(1);
|
||||||
|
return page(page).getData().stream().findFirst();
|
||||||
|
}
|
||||||
|
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
class OneReq {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id集合
|
||||||
|
*/
|
||||||
|
private Set<Long> ids;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单位id
|
||||||
|
*/
|
||||||
|
private Long ouId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资质id
|
||||||
|
*/
|
||||||
|
private Long qualificationId;
|
||||||
|
|
||||||
|
public void check() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
class ListReq extends PageReqV2 {
|
||||||
|
@CriteriaField
|
||||||
|
private Long id;
|
||||||
|
@CriteriaField(field = "id", operator = Operator.IN)
|
||||||
|
private Set<Long> ids;
|
||||||
|
/**
|
||||||
|
* 用于遍历数据
|
||||||
|
*/
|
||||||
|
@CriteriaField(field = "id", operator = Operator.GT)
|
||||||
|
private Long idGt;
|
||||||
|
@CriteriaField(field = "ouId", operator = Operator.IN)
|
||||||
|
private Set<Long> ouIds;
|
||||||
|
@CriteriaField(field = "qualificationId", operator = Operator.IN)
|
||||||
|
private Set<Long> qualificationIds;
|
||||||
|
@CriteriaField(field = "type", operator = Operator.IN)
|
||||||
|
private Set<Integer> types;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
class PageReq extends ListReq implements IPageReq {
|
||||||
|
@CriteriaField(ignore = true)
|
||||||
|
Integer page;
|
||||||
|
@CriteriaField(ignore = true)
|
||||||
|
Integer pageSize;
|
||||||
|
@CriteriaField(ignore = true)
|
||||||
|
List<String> sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
class QualificationOuTypeResp extends QualificationOuType {
|
||||||
|
// 按需扩展字段,占个位。避免报错
|
||||||
|
private String todo;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
package cn.axzo.orgmanax.infra.dao.qualification.repositrory.impl;
|
||||||
|
|
||||||
|
import cn.axzo.foundation.dao.support.converter.PageConverter;
|
||||||
|
import cn.axzo.foundation.dao.support.mysql.QueryWrapperHelper;
|
||||||
|
import cn.axzo.foundation.page.PageResp;
|
||||||
|
import cn.axzo.orgmanax.infra.dao.qualification.dao.QualificationOuTypeDao;
|
||||||
|
import cn.axzo.orgmanax.infra.dao.qualification.entity.QualificationOuType;
|
||||||
|
import cn.axzo.orgmanax.infra.dao.qualification.repositrory.QualificationOuTypeQueryRepository;
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : zhanghonghao@axzo.cn
|
||||||
|
* @since : 2024/12/23
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class QualificationOuTypeQueryRepositoryImpl implements QualificationOuTypeQueryRepository {
|
||||||
|
|
||||||
|
private final QualificationOuTypeDao qualificationOuTypeDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResp<QualificationOuTypeResp> page(ListReq req) {
|
||||||
|
IPage<QualificationOuType> page = PageConverter.toMybatis(req, QualificationOuType.class);
|
||||||
|
QueryWrapper<QualificationOuType> wrapper = QueryWrapperHelper.fromBean(req, QualificationOuType.class);
|
||||||
|
IPage<QualificationOuTypeQueryRepository.QualificationOuTypeResp> results = qualificationOuTypeDao.page(page, wrapper).convert(e -> BeanUtil.toBean(e, QualificationOuTypeQueryRepository.QualificationOuTypeResp.class));
|
||||||
|
PageResp<QualificationOuTypeQueryRepository.QualificationOuTypeResp> resp = PageConverter.toResp(results);
|
||||||
|
List<QualificationOuTypeQueryRepository.QualificationOuTypeResp> records = resp.getData();
|
||||||
|
CollUtil.isEmpty(records);
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package cn.axzo.orgmanax.server.unit.controller;
|
||||||
|
|
||||||
|
import cn.axzo.foundation.result.ApiResult;
|
||||||
|
import cn.axzo.orgmanax.api.unit.feign.OrgUnitQualificationApi;
|
||||||
|
import cn.axzo.orgmanax.server.unit.service.QualificationService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : zhanghonghao@axzo.cn
|
||||||
|
* @since : 2024/12/23
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class UnitQualificationController implements OrgUnitQualificationApi {
|
||||||
|
|
||||||
|
private final QualificationService qualificationService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApiResult<List<Integer>> getQualificationTypesByUnitId(Long unitId) {
|
||||||
|
return ApiResult.success(qualificationService.getQualificationTypesByUnitId(unitId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
package cn.axzo.orgmanax.server.unit.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface QualificationService {
|
||||||
|
|
||||||
|
List<Integer> getQualificationTypesByUnitId(Long unitId);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
package cn.axzo.orgmanax.server.unit.service.impl;
|
||||||
|
|
||||||
|
import cn.axzo.orgmanax.infra.dao.qualification.repositrory.QualificationOuTypeQueryRepository;
|
||||||
|
import cn.axzo.orgmanax.server.unit.service.QualificationService;
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : zhanghonghao@axzo.cn
|
||||||
|
* @since : 2024/12/23
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class QualificationServiceImpl implements QualificationService {
|
||||||
|
|
||||||
|
private final QualificationOuTypeQueryRepository qualificationOuTypeQueryRepository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Integer> getQualificationTypesByUnitId(Long unitId) {
|
||||||
|
QualificationOuTypeQueryRepository.ListReq req = new QualificationOuTypeQueryRepository.ListReq();
|
||||||
|
req.setOuIds(Collections.singleton(unitId));
|
||||||
|
List<QualificationOuTypeQueryRepository.QualificationOuTypeResp> qualificationOuTypeRespList = qualificationOuTypeQueryRepository.list(req);
|
||||||
|
if (CollUtil.isEmpty(qualificationOuTypeRespList)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
return qualificationOuTypeRespList.stream().map(QualificationOuTypeQueryRepository.QualificationOuTypeResp::getType).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user