mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 15:55:18 +08:00
添加企业信息接口
This commit is contained in:
@@ -0,0 +1,60 @@
|
|||||||
|
package cn.lihongjie.coal.enterprise.controller;
|
||||||
|
|
||||||
|
import cn.lihongjie.coal.annotation.SysLog;
|
||||||
|
import cn.lihongjie.coal.base.dto.CommonQuery;
|
||||||
|
import cn.lihongjie.coal.base.dto.IdRequest;
|
||||||
|
import cn.lihongjie.coal.enterprise.dto.CreateEnterpriseDto;
|
||||||
|
import cn.lihongjie.coal.enterprise.dto.EnterpriseDto;
|
||||||
|
import cn.lihongjie.coal.enterprise.dto.UpdateEnterpriseDto;
|
||||||
|
import cn.lihongjie.coal.enterprise.service.EnterpriseService;
|
||||||
|
import java.lang.Object;
|
||||||
|
import java.lang.String;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/enterprise")
|
||||||
|
@SysLog(
|
||||||
|
module = "企业数据"
|
||||||
|
)
|
||||||
|
@Slf4j
|
||||||
|
public class EnterpriseController {
|
||||||
|
@Autowired
|
||||||
|
private EnterpriseService service;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
public EnterpriseDto create(@RequestBody CreateEnterpriseDto request) {
|
||||||
|
return this.service.create(request)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/update")
|
||||||
|
public EnterpriseDto update(@RequestBody UpdateEnterpriseDto request) {
|
||||||
|
return this.service.update(request)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/delete")
|
||||||
|
public Object delete(@RequestBody IdRequest request) {
|
||||||
|
this.service.delete(request);
|
||||||
|
return true
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/getById")
|
||||||
|
public EnterpriseDto getById(@RequestBody String request) {
|
||||||
|
return this.service.getById(request)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/list")
|
||||||
|
public Page<EnterpriseDto> list(@RequestBody CommonQuery request) {
|
||||||
|
return this.service.list(request)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package cn.lihongjie.coal.enterprise.dto;
|
||||||
|
|
||||||
|
import cn.lihongjie.coal.base.dto.CommonDto;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.hibernate.annotations.Comment;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CreateEnterpriseDto extends CommonDto {
|
||||||
|
@Comment("企业名称")
|
||||||
|
private String enterpriseName;
|
||||||
|
@Comment("登记状态")
|
||||||
|
private String registrationStatus;
|
||||||
|
@Comment("法定代表人")
|
||||||
|
private String legalRepresentative;
|
||||||
|
@Comment("注册资本")
|
||||||
|
private String registeredCapital;
|
||||||
|
@Comment("成立日期")
|
||||||
|
private String establishmentDate;
|
||||||
|
@Comment("统一社会信用代码")
|
||||||
|
private String unifiedSocialCreditCode;
|
||||||
|
@Comment("企业注册地址")
|
||||||
|
private String enterpriseRegisteredAddress;
|
||||||
|
@Comment("电话")
|
||||||
|
private String phone;
|
||||||
|
@Comment("更多电话")
|
||||||
|
private String additionalPhone;
|
||||||
|
@Comment("邮箱")
|
||||||
|
private String email;
|
||||||
|
@Comment("更多邮箱")
|
||||||
|
private String additionalEmail;
|
||||||
|
@Comment("所属城市")
|
||||||
|
private String cityOfRegistration;
|
||||||
|
@Comment("纳税人识别号")
|
||||||
|
private String taxpayerIdentificationNumber;
|
||||||
|
@Comment("注册号")
|
||||||
|
private String registrationNumber;
|
||||||
|
@Comment("组织机构代码")
|
||||||
|
private String organizationCode;
|
||||||
|
@Comment("参保人数")
|
||||||
|
private String insuredCount;
|
||||||
|
@Comment("企业(机构)类型")
|
||||||
|
private String enterpriseType;
|
||||||
|
@Comment("企业规模")
|
||||||
|
private String enterpriseSize;
|
||||||
|
@Comment("核准日期")
|
||||||
|
private String approvalDate;
|
||||||
|
@Comment("营业期限")
|
||||||
|
private String businessPeriod;
|
||||||
|
@Comment("曾用名")
|
||||||
|
private String formerName;
|
||||||
|
@Comment("英文名")
|
||||||
|
private String englishName;
|
||||||
|
@Comment("官网网址")
|
||||||
|
private String officialWebsiteUrl;
|
||||||
|
@Comment("通信地址")
|
||||||
|
private String mailingAddress;
|
||||||
|
@Comment("经营范围")
|
||||||
|
private String businessScope;
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package cn.lihongjie.coal.enterprise.dto;
|
||||||
|
|
||||||
|
import cn.lihongjie.coal.base.dto.CommonDto;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.hibernate.annotations.Comment;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class EnterpriseDto extends CommonDto {
|
||||||
|
@Comment("企业名称")
|
||||||
|
private String enterpriseName;
|
||||||
|
@Comment("登记状态")
|
||||||
|
private String registrationStatus;
|
||||||
|
@Comment("法定代表人")
|
||||||
|
private String legalRepresentative;
|
||||||
|
@Comment("注册资本")
|
||||||
|
private String registeredCapital;
|
||||||
|
@Comment("成立日期")
|
||||||
|
private String establishmentDate;
|
||||||
|
@Comment("统一社会信用代码")
|
||||||
|
private String unifiedSocialCreditCode;
|
||||||
|
@Comment("企业注册地址")
|
||||||
|
private String enterpriseRegisteredAddress;
|
||||||
|
@Comment("电话")
|
||||||
|
private String phone;
|
||||||
|
@Comment("更多电话")
|
||||||
|
private String additionalPhone;
|
||||||
|
@Comment("邮箱")
|
||||||
|
private String email;
|
||||||
|
@Comment("更多邮箱")
|
||||||
|
private String additionalEmail;
|
||||||
|
@Comment("所属城市")
|
||||||
|
private String cityOfRegistration;
|
||||||
|
@Comment("纳税人识别号")
|
||||||
|
private String taxpayerIdentificationNumber;
|
||||||
|
@Comment("注册号")
|
||||||
|
private String registrationNumber;
|
||||||
|
@Comment("组织机构代码")
|
||||||
|
private String organizationCode;
|
||||||
|
@Comment("参保人数")
|
||||||
|
private String insuredCount;
|
||||||
|
@Comment("企业(机构)类型")
|
||||||
|
private String enterpriseType;
|
||||||
|
@Comment("企业规模")
|
||||||
|
private String enterpriseSize;
|
||||||
|
@Comment("核准日期")
|
||||||
|
private String approvalDate;
|
||||||
|
@Comment("营业期限")
|
||||||
|
private String businessPeriod;
|
||||||
|
@Comment("曾用名")
|
||||||
|
private String formerName;
|
||||||
|
@Comment("英文名")
|
||||||
|
private String englishName;
|
||||||
|
@Comment("官网网址")
|
||||||
|
private String officialWebsiteUrl;
|
||||||
|
@Comment("通信地址")
|
||||||
|
private String mailingAddress;
|
||||||
|
@Comment("经营范围")
|
||||||
|
private String businessScope;
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package cn.lihongjie.coal.enterprise.dto;
|
||||||
|
|
||||||
|
import cn.lihongjie.coal.base.dto.CommonDto;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.hibernate.annotations.Comment;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UpdateEnterpriseDto extends CommonDto {
|
||||||
|
@Comment("企业名称")
|
||||||
|
private String enterpriseName;
|
||||||
|
@Comment("登记状态")
|
||||||
|
private String registrationStatus;
|
||||||
|
@Comment("法定代表人")
|
||||||
|
private String legalRepresentative;
|
||||||
|
@Comment("注册资本")
|
||||||
|
private String registeredCapital;
|
||||||
|
@Comment("成立日期")
|
||||||
|
private String establishmentDate;
|
||||||
|
@Comment("统一社会信用代码")
|
||||||
|
private String unifiedSocialCreditCode;
|
||||||
|
@Comment("企业注册地址")
|
||||||
|
private String enterpriseRegisteredAddress;
|
||||||
|
@Comment("电话")
|
||||||
|
private String phone;
|
||||||
|
@Comment("更多电话")
|
||||||
|
private String additionalPhone;
|
||||||
|
@Comment("邮箱")
|
||||||
|
private String email;
|
||||||
|
@Comment("更多邮箱")
|
||||||
|
private String additionalEmail;
|
||||||
|
@Comment("所属城市")
|
||||||
|
private String cityOfRegistration;
|
||||||
|
@Comment("纳税人识别号")
|
||||||
|
private String taxpayerIdentificationNumber;
|
||||||
|
@Comment("注册号")
|
||||||
|
private String registrationNumber;
|
||||||
|
@Comment("组织机构代码")
|
||||||
|
private String organizationCode;
|
||||||
|
@Comment("参保人数")
|
||||||
|
private String insuredCount;
|
||||||
|
@Comment("企业(机构)类型")
|
||||||
|
private String enterpriseType;
|
||||||
|
@Comment("企业规模")
|
||||||
|
private String enterpriseSize;
|
||||||
|
@Comment("核准日期")
|
||||||
|
private String approvalDate;
|
||||||
|
@Comment("营业期限")
|
||||||
|
private String businessPeriod;
|
||||||
|
@Comment("曾用名")
|
||||||
|
private String formerName;
|
||||||
|
@Comment("英文名")
|
||||||
|
private String englishName;
|
||||||
|
@Comment("官网网址")
|
||||||
|
private String officialWebsiteUrl;
|
||||||
|
@Comment("通信地址")
|
||||||
|
private String mailingAddress;
|
||||||
|
@Comment("经营范围")
|
||||||
|
private String businessScope;
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package cn.lihongjie.coal.enterprise.entity;
|
||||||
|
|
||||||
|
import cn.lihongjie.coal.base.entity.CommonEntity;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.hibernate.annotations.Comment;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Entity
|
||||||
|
@Comment("企业信息")
|
||||||
|
public class EnterpriseEntity extends CommonEntity {
|
||||||
|
|
||||||
|
@Comment("企业名称")
|
||||||
|
private String enterpriseName;
|
||||||
|
@Comment("登记状态")
|
||||||
|
private String registrationStatus;
|
||||||
|
@Comment("法定代表人")
|
||||||
|
private String legalRepresentative;
|
||||||
|
@Comment("注册资本")
|
||||||
|
private String registeredCapital;
|
||||||
|
@Comment("成立日期")
|
||||||
|
private String establishmentDate;
|
||||||
|
@Comment("统一社会信用代码")
|
||||||
|
private String unifiedSocialCreditCode;
|
||||||
|
@Comment("企业注册地址")
|
||||||
|
private String enterpriseRegisteredAddress;
|
||||||
|
@Comment("电话")
|
||||||
|
private String phone;
|
||||||
|
@Comment("更多电话")
|
||||||
|
private String additionalPhone;
|
||||||
|
@Comment("邮箱")
|
||||||
|
private String email;
|
||||||
|
@Comment("更多邮箱")
|
||||||
|
private String additionalEmail;
|
||||||
|
@Comment("所属城市")
|
||||||
|
private String cityOfRegistration;
|
||||||
|
@Comment("纳税人识别号")
|
||||||
|
private String taxpayerIdentificationNumber;
|
||||||
|
@Comment("注册号")
|
||||||
|
private String registrationNumber;
|
||||||
|
@Comment("组织机构代码")
|
||||||
|
private String organizationCode;
|
||||||
|
@Comment("参保人数")
|
||||||
|
private String insuredCount;
|
||||||
|
@Comment("企业(机构)类型")
|
||||||
|
private String enterpriseType;
|
||||||
|
@Comment("企业规模")
|
||||||
|
private String enterpriseSize;
|
||||||
|
@Comment("核准日期")
|
||||||
|
private String approvalDate;
|
||||||
|
@Comment("营业期限")
|
||||||
|
private String businessPeriod;
|
||||||
|
@Comment("曾用名")
|
||||||
|
private String formerName;
|
||||||
|
@Comment("英文名")
|
||||||
|
private String englishName;
|
||||||
|
@Comment("官网网址")
|
||||||
|
private String officialWebsiteUrl;
|
||||||
|
@Comment("通信地址")
|
||||||
|
private String mailingAddress;
|
||||||
|
@Comment("经营范围")
|
||||||
|
private String businessScope;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package cn.lihongjie.coal.enterprise.mapper;
|
||||||
|
|
||||||
|
import cn.lihongjie.coal.base.mapper.BaseMapper;
|
||||||
|
import cn.lihongjie.coal.base.mapper.CommonMapper;
|
||||||
|
import cn.lihongjie.coal.enterprise.dto.CreateEnterpriseDto;
|
||||||
|
import cn.lihongjie.coal.enterprise.dto.EnterpriseDto;
|
||||||
|
import cn.lihongjie.coal.enterprise.dto.UpdateEnterpriseDto;
|
||||||
|
import cn.lihongjie.coal.enterprise.entity.EnterpriseEntity;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.control.DeepClone;
|
||||||
|
|
||||||
|
@Mapper(
|
||||||
|
componentModel = org.mapstruct.MappingConstants.ComponentModel.SPRING,
|
||||||
|
uses = {CommonMapper.class},
|
||||||
|
mappingControl = DeepClone.class
|
||||||
|
)
|
||||||
|
public interface EnterpriseMapper extends BaseMapper<EnterpriseEntity, EnterpriseDto, CreateEnterpriseDto, UpdateEnterpriseDto> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package cn.lihongjie.coal.enterprise.repository;
|
||||||
|
|
||||||
|
import cn.lihongjie.coal.base.dao.BaseRepository;
|
||||||
|
import cn.lihongjie.coal.enterprise.entity.EnterpriseEntity;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface EnterpriseRepository extends BaseRepository<EnterpriseEntity> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package cn.lihongjie.coal.enterprise.service;
|
||||||
|
|
||||||
|
import cn.lihongjie.coal.base.dto.CommonQuery;
|
||||||
|
import cn.lihongjie.coal.base.dto.IdRequest;
|
||||||
|
import cn.lihongjie.coal.base.service.BaseService;
|
||||||
|
import cn.lihongjie.coal.enterprise.dto.CreateEnterpriseDto;
|
||||||
|
import cn.lihongjie.coal.enterprise.dto.EnterpriseDto;
|
||||||
|
import cn.lihongjie.coal.enterprise.dto.UpdateEnterpriseDto;
|
||||||
|
import cn.lihongjie.coal.enterprise.entity.EnterpriseEntity;
|
||||||
|
import cn.lihongjie.coal.enterprise.mapper.EnterpriseMapper;
|
||||||
|
import cn.lihongjie.coal.enterprise.repository.EnterpriseRepository;
|
||||||
|
import java.lang.String;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.core.convert.ConversionService;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Sort;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class EnterpriseService extends BaseService<EnterpriseEntity, EnterpriseRepository> {
|
||||||
|
@Autowired
|
||||||
|
private EnterpriseRepository repository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EnterpriseMapper mapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ConversionService conversionService;
|
||||||
|
|
||||||
|
public EnterpriseDto create(CreateEnterpriseDto request) {
|
||||||
|
EnterpriseEntity entity = mapper.toEntity(request);
|
||||||
|
|
||||||
|
|
||||||
|
this.repository.save(entity);
|
||||||
|
return getById(entity.getId())
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnterpriseDto update(UpdateEnterpriseDto request) {
|
||||||
|
EnterpriseEntity entity = this.repository.get(request.getId());
|
||||||
|
this.mapper.updateEntity(entity, request);
|
||||||
|
|
||||||
|
this.repository.save(entity);
|
||||||
|
|
||||||
|
return getById(entity.getId())
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delete(IdRequest request) {
|
||||||
|
this.repository.deleteAllById(request.getIds())
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnterpriseDto getById(String id) {
|
||||||
|
EnterpriseEntity entity = repository.get(id);
|
||||||
|
|
||||||
|
|
||||||
|
return mapper.toDto(entity)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Page<EnterpriseDto> list(CommonQuery query) {
|
||||||
|
Page<EnterpriseEntity> page = repository.findAll(query.specification(conversionService), PageRequest.of(query.getPageNo(), query.getPageSize(), Sort.by(query.getOrders())));
|
||||||
|
|
||||||
|
|
||||||
|
return page.map(this.mapper::toDto)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user