# Conflicts:
#	yudao-module-fta/yudao-module-fta-api/src/main/java/cn/iocoder/yudao/module/fta/enums/ErrorCodeConstants.java
This commit is contained in:
Wayne 2024-05-14 09:41:06 +08:00
commit 4223630e1d
12 changed files with 573 additions and 3 deletions

View File

@ -12,6 +12,9 @@ public interface ErrorCodeConstants {
// ========== Fta 企业信息1-040-100-000 ========== // ========== Fta 企业信息1-040-100-000 ==========
ErrorCode ENTERPRISE_INFORMATION_NOT_EXISTS = new ErrorCode(1_040_100_000, "企业信息不存在"); ErrorCode ENTERPRISE_INFORMATION_NOT_EXISTS = new ErrorCode(1_040_100_000, "企业信息不存在");
// ========== 企业证件 1-041-100-000 ==========
ErrorCode CREDENTIAL_MANAGEMENT_NOT_EXISTS = new ErrorCode(1-041-100-000, "企业证件不存在");
// ========== Fta 企业信息变更1-040-101-000 ========== // ========== Fta 企业信息变更1-040-101-000 ==========
ErrorCode ENTERPRISE_CHANGE_NOT_EXISTS = new ErrorCode(1_040_101_000, "企业信息变更不存在"); ErrorCode ENTERPRISE_CHANGE_NOT_EXISTS = new ErrorCode(1_040_101_000, "企业信息变更不存在");

View File

@ -0,0 +1,95 @@
package cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.CredentialManagementPageReqVO;
import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.CredentialManagementRespVO;
import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.CredentialManagementSaveReqVO;
import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.CredentialManagementDO;
import cn.iocoder.yudao.module.fta.service.enterpriseinformation.CredentialManagementService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.*;
import javax.servlet.http.*;
import java.io.IOException;
import java.util.List;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
@Tag(name = "管理后台 - 企业证件")
@RestController
@RequestMapping("/fta/credential-management")
@Validated
public class CredentialManagementController {
@Resource
private CredentialManagementService credentialManagementService;
@PostMapping("/create")
@Operation(summary = "创建企业证件")
@PreAuthorize("@ss.hasPermission('fta:credential-management:create')")
public CommonResult<Long> createCredentialManagement(@Valid @RequestBody CredentialManagementSaveReqVO createReqVO) {
return success(credentialManagementService.createCredentialManagement(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新企业证件")
@PreAuthorize("@ss.hasPermission('fta:credential-management:update')")
public CommonResult<Boolean> updateCredentialManagement(@Valid @RequestBody CredentialManagementSaveReqVO updateReqVO) {
credentialManagementService.updateCredentialManagement(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除企业证件")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('fta:credential-management:delete')")
public CommonResult<Boolean> deleteCredentialManagement(@RequestParam("id") Long id) {
credentialManagementService.deleteCredentialManagement(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得企业证件")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('fta:credential-management:query')")
public CommonResult<CredentialManagementRespVO> getCredentialManagement(@RequestParam("id") Long id) {
CredentialManagementDO credentialManagement = credentialManagementService.getCredentialManagement(id);
return success(BeanUtils.toBean(credentialManagement, CredentialManagementRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得企业证件分页")
@PreAuthorize("@ss.hasPermission('fta:credential-management:query')")
public CommonResult<PageResult<CredentialManagementRespVO>> getCredentialManagementPage(@Valid CredentialManagementPageReqVO pageReqVO) {
PageResult<CredentialManagementDO> pageResult = credentialManagementService.getCredentialManagementPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, CredentialManagementRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出企业证件 Excel")
@PreAuthorize("@ss.hasPermission('fta:credential-management:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportCredentialManagementExcel(@Valid CredentialManagementPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<CredentialManagementDO> list = credentialManagementService.getCredentialManagementPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "企业证件.xls", "数据", CredentialManagementRespVO.class,
BeanUtils.toBean(list, CredentialManagementRespVO.class));
}
}

View File

@ -0,0 +1,66 @@
package cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo;
import lombok.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 企业证件分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CredentialManagementPageReqVO extends PageParam {
@Schema(description = "企业id", example = "13133")
private String informationId;
@Schema(description = "经营方式")
private String businessPattern;
@Schema(description = "有效期限")
private String usefulLife;
@Schema(description = "发证机关")
private String licenceIssuingAuthority;
@Schema(description = "发证日期")
private LocalDateTime dateOfIssue;
@Schema(description = "流程状态", example = "1")
private String status;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "到期时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private Date[] expiryDate;
@Schema(description = "证件类型(0安全员证1安全负责人证2危险品证", example = "2")
private Boolean idType;
@Schema(description = "证书编号")
private String certificateNumber;
@Schema(description = "姓名", example = "王五")
private String name;
@Schema(description = "人员类型", example = "2")
private String personnelType;
@Schema(description = "性别(0男1女)")
private Boolean sex;
@Schema(description = "行业类别")
private String categoryOfEmployment;
@Schema(description = "企业名称", example = "芋艿")
private String enterpriseName;
}

View File

@ -0,0 +1,80 @@
package cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 企业证件 Response VO")
@Data
@ExcelIgnoreUnannotated
public class CredentialManagementRespVO {
@Schema(description = "企业id", requiredMode = Schema.RequiredMode.REQUIRED, example = "13133")
@ExcelProperty("企业id")
private String informationId;
@Schema(description = "经营方式")
@ExcelProperty("经营方式")
private String businessPattern;
@Schema(description = "有效期限")
@ExcelProperty("有效期限")
private String usefulLife;
@Schema(description = "发证机关")
@ExcelProperty("发证机关")
private String licenceIssuingAuthority;
@Schema(description = "发证日期")
@ExcelProperty("发证日期")
private LocalDateTime dateOfIssue;
@Schema(description = "流程状态", example = "1")
@ExcelProperty("流程状态")
private String status;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "23598")
@ExcelProperty("id")
private Long id;
@Schema(description = "到期时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("到期时间")
private Date expiryDate;
@Schema(description = "证件类型(0安全员证1安全负责人证2危险品证", example = "2")
@ExcelProperty("证件类型(0安全员证1安全负责人证2危险品证")
private Boolean idType;
@Schema(description = "证书编号")
@ExcelProperty("证书编号")
private String certificateNumber;
@Schema(description = "姓名", example = "王五")
@ExcelProperty("姓名")
private String name;
@Schema(description = "人员类型", example = "2")
@ExcelProperty("人员类型")
private String personnelType;
@Schema(description = "性别(0男1女)")
@ExcelProperty("性别(0男1女)")
private Boolean sex;
@Schema(description = "行业类别")
@ExcelProperty("行业类别")
private String categoryOfEmployment;
@Schema(description = "企业名称", example = "芋艿")
@ExcelProperty("企业名称")
private String enterpriseName;
}

View File

@ -0,0 +1,61 @@
package cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import javax.validation.constraints.*;
import java.time.LocalDateTime;
import java.util.Date;
@Schema(description = "管理后台 - 企业证件新增/修改 Request VO")
@Data
public class CredentialManagementSaveReqVO {
@Schema(description = "企业id", requiredMode = Schema.RequiredMode.REQUIRED, example = "13133")
@NotEmpty(message = "企业id不能为空")
private String informationId;
@Schema(description = "经营方式")
private String businessPattern;
@Schema(description = "有效期限")
private String usefulLife;
@Schema(description = "发证机关")
private String licenceIssuingAuthority;
@Schema(description = "发证日期")
private LocalDateTime dateOfIssue;
@Schema(description = "流程状态", example = "1")
private String status;
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "23598")
private Long id;
@Schema(description = "到期时间", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "到期时间不能为空")
private Date expiryDate;
@Schema(description = "证件类型(0安全员证1安全负责人证2危险品证", example = "2")
private Boolean idType;
@Schema(description = "证书编号")
private String certificateNumber;
@Schema(description = "姓名", example = "王五")
private String name;
@Schema(description = "人员类型", example = "2")
private String personnelType;
@Schema(description = "性别(0男1女)")
private Boolean sex;
@Schema(description = "行业类别")
private String categoryOfEmployment;
@Schema(description = "企业名称", example = "芋艿")
private String enterpriseName;
}

View File

@ -0,0 +1,89 @@
package cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 企业证件 DO
*
* @author xue
*/
@TableName("fta_credential_management")
@KeySequence("fta_credential_management_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CredentialManagementDO extends BaseDO {
/**
* 企业id
*/
private String informationId;
/**
* 经营方式
*/
private String businessPattern;
/**
* 有效期限
*/
private String usefulLife;
/**
* 发证机关
*/
private String licenceIssuingAuthority;
/**
* 发证日期
*/
private LocalDateTime dateOfIssue;
/**
* 流程状态
*/
private String status;
/**
* id
*/
@TableId
private Long id;
/**
* 到期时间
*/
private Date expiryDate;
/**
* 证件类型(0安全员证1安全负责人证2危险品证
*/
private Boolean idType;
/**
* 证书编号
*/
private String certificateNumber;
/**
* 姓名
*/
private String name;
/**
* 人员类型
*/
private String personnelType;
/**
* 性别(0男1女)
*/
private Boolean sex;
/**
* 行业类别
*/
private String categoryOfEmployment;
/**
* 企业名称
*/
private String enterpriseName;
}

View File

@ -0,0 +1,39 @@
package cn.iocoder.yudao.module.fta.dal.mysql.enterpriseinformation;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.CredentialManagementPageReqVO;
import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.CredentialManagementDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 企业证件 Mapper
*
* @author xue
*/
@Mapper
public interface CredentialManagementMapper extends BaseMapperX<CredentialManagementDO> {
default PageResult<CredentialManagementDO> selectPage(CredentialManagementPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<CredentialManagementDO>()
.eqIfPresent(CredentialManagementDO::getInformationId, reqVO.getInformationId())
.eqIfPresent(CredentialManagementDO::getBusinessPattern, reqVO.getBusinessPattern())
.eqIfPresent(CredentialManagementDO::getUsefulLife, reqVO.getUsefulLife())
.eqIfPresent(CredentialManagementDO::getLicenceIssuingAuthority, reqVO.getLicenceIssuingAuthority())
.eqIfPresent(CredentialManagementDO::getDateOfIssue, reqVO.getDateOfIssue())
.eqIfPresent(CredentialManagementDO::getStatus, reqVO.getStatus())
.betweenIfPresent(CredentialManagementDO::getCreateTime, reqVO.getCreateTime())
.betweenIfPresent(CredentialManagementDO::getExpiryDate,reqVO.getExpiryDate())
.eqIfPresent(CredentialManagementDO::getIdType, reqVO.getIdType())
.eqIfPresent(CredentialManagementDO::getCertificateNumber, reqVO.getCertificateNumber())
.likeIfPresent(CredentialManagementDO::getName, reqVO.getName())
.eqIfPresent(CredentialManagementDO::getPersonnelType, reqVO.getPersonnelType())
.eqIfPresent(CredentialManagementDO::getSex, reqVO.getSex())
.eqIfPresent(CredentialManagementDO::getCategoryOfEmployment, reqVO.getCategoryOfEmployment())
.likeIfPresent(CredentialManagementDO::getEnterpriseName, reqVO.getEnterpriseName())
.orderByDesc(CredentialManagementDO::getId));
}
}

View File

@ -1,6 +1,5 @@
package cn.iocoder.yudao.module.fta.dal.mysql.enterpriseinformation; package cn.iocoder.yudao.module.fta.dal.mysql.enterpriseinformation;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;

View File

@ -0,0 +1,57 @@
package cn.iocoder.yudao.module.fta.service.enterpriseinformation;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.CredentialManagementPageReqVO;
import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.CredentialManagementSaveReqVO;
import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.CredentialManagementDO;
import javax.validation.*;
/**
* 企业证件 Service 接口
*
* @author xue
*/
public interface CredentialManagementService {
/**
* 创建企业证件
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createCredentialManagement(@Valid CredentialManagementSaveReqVO createReqVO);
/**
* 更新企业证件
*
* @param updateReqVO 更新信息
*/
void updateCredentialManagement(@Valid CredentialManagementSaveReqVO updateReqVO);
/**
* 删除企业证件
*
* @param id 编号
*/
void deleteCredentialManagement(Long id);
/**
* 获得企业证件
*
* @param id 编号
* @return 企业证件
*/
CredentialManagementDO getCredentialManagement(Long id);
/**
* 获得企业证件分页
*
* @param pageReqVO 分页查询
* @return 企业证件分页
*/
PageResult<CredentialManagementDO> getCredentialManagementPage(CredentialManagementPageReqVO pageReqVO);
}

View File

@ -0,0 +1,71 @@
package cn.iocoder.yudao.module.fta.service.enterpriseinformation;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.CredentialManagementPageReqVO;
import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.CredentialManagementSaveReqVO;
import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.CredentialManagementDO;
import cn.iocoder.yudao.module.fta.dal.mysql.enterpriseinformation.CredentialManagementMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.fta.enums.ErrorCodeConstants.*;
/**
* 企业证件 Service 实现类
*
* @author xue
*/
@Service
@Validated
public class CredentialManagementServiceImpl implements CredentialManagementService {
@Resource
private CredentialManagementMapper credentialManagementMapper;
@Override
public Long createCredentialManagement(CredentialManagementSaveReqVO createReqVO) {
// 插入
CredentialManagementDO credentialManagement = BeanUtils.toBean(createReqVO, CredentialManagementDO.class);
credentialManagementMapper.insert(credentialManagement);
// 返回
return credentialManagement.getId();
}
@Override
public void updateCredentialManagement(CredentialManagementSaveReqVO updateReqVO) {
// 校验存在
validateCredentialManagementExists(updateReqVO.getId());
// 更新
CredentialManagementDO updateObj = BeanUtils.toBean(updateReqVO, CredentialManagementDO.class);
credentialManagementMapper.updateById(updateObj);
}
@Override
public void deleteCredentialManagement(Long id) {
// 校验存在
validateCredentialManagementExists(id);
// 删除
credentialManagementMapper.deleteById(id);
}
private void validateCredentialManagementExists(Long id) {
if (credentialManagementMapper.selectById(id) == null) {
throw exception(CREDENTIAL_MANAGEMENT_NOT_EXISTS);
}
}
@Override
public CredentialManagementDO getCredentialManagement(Long id) {
return credentialManagementMapper.selectById(id);
}
@Override
public PageResult<CredentialManagementDO> getCredentialManagementPage(CredentialManagementPageReqVO pageReqVO) {
return credentialManagementMapper.selectPage(pageReqVO);
}
}

View File

@ -1,11 +1,9 @@
package cn.iocoder.yudao.module.fta.service.enterpriseinformation; package cn.iocoder.yudao.module.fta.service.enterpriseinformation;
import java.util.*;
import javax.validation.*; import javax.validation.*;
import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.*; import cn.iocoder.yudao.module.fta.controller.admin.enterpriseinformation.vo.*;
import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.EnterpriseInformationDO; import cn.iocoder.yudao.module.fta.dal.dataobject.enterpriseinformation.EnterpriseInformationDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/** /**
* 企业信息 Service 接口 * 企业信息 Service 接口

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.fta.dal.mysql.enterpriseinformation.CredentialManagementMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>