Browse Source

企业信息

master
zy 2 months ago
parent
commit
967e884bcb
  1. 2
      yudao-dependencies/pom.xml
  2. 1
      yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java
  3. 8
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java
  4. 4
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterprisePageReqVO.java
  5. 94
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/EnterpriseQualificationController.java
  6. 52
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationPageReqVO.java
  7. 57
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationRespVO.java
  8. 40
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationSaveReqVO.java
  9. 9
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprise/EnterpriseDO.java
  10. 56
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/qualification/EnterpriseQualificationDO.java
  11. 4
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java
  12. 34
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/qualification/EnterpriseQualificationMapper.java
  13. 10
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthService.java
  14. 106
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java
  15. 55
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/qualification/EnterpriseQualificationService.java
  16. 76
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/qualification/EnterpriseQualificationServiceImpl.java
  17. 35
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImpl.java
  18. 12
      yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/qualification/EnterpriseQualificationMapper.xml
  19. 3
      yudao-module-system/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants_手动操作.java
  20. 95
      yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/EnterpriseQualificationController.java
  21. 48
      yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationPageReqVO.java
  22. 55
      yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationRespVO.java
  23. 40
      yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationSaveReqVO.java
  24. 63
      yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/qualification/EnterpriseQualificationDO.java
  25. 34
      yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/qualification/EnterpriseQualificationMapper.java
  26. 55
      yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/qualification/EnterpriseQualificationService.java
  27. 74
      yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/qualification/EnterpriseQualificationServiceImpl.java
  28. 12
      yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/qualification/EnterpriseQualificationMapper.xml

2
yudao-dependencies/pom.xml

@ -71,7 +71,7 @@
<commons-io.version>2.17.0</commons-io.version> <commons-io.version>2.17.0</commons-io.version>
<commons-compress.version>1.27.1</commons-compress.version> <commons-compress.version>1.27.1</commons-compress.version>
<aws-java-sdk-s3.version>1.12.777</aws-java-sdk-s3.version> <aws-java-sdk-s3.version>1.12.777</aws-java-sdk-s3.version>
<justauth.version>1.0.8</justauth.version> <justauth.version>1.16.7</justauth.version>
<jimureport.version>1.7.8</jimureport.version> <jimureport.version>1.7.8</jimureport.version>
<weixin-java.version>4.6.0</weixin-java.version> <weixin-java.version>4.6.0</weixin-java.version>
<!-- 专属于 JDK8 安全漏洞升级 --> <!-- 专属于 JDK8 安全漏洞升级 -->

1
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java

@ -166,5 +166,6 @@ public interface ErrorCodeConstants {
//==========企业信息相关 1-002-029-000 //==========企业信息相关 1-002-029-000
ErrorCode ENTERPRISE_NOT_EXISTS = new ErrorCode(1-003-000-000, "企业不存在"); ErrorCode ENTERPRISE_NOT_EXISTS = new ErrorCode(1-003-000-000, "企业不存在");
ErrorCode ENTERPRISE_QUALIFICATION_NOT_EXISTS = new ErrorCode(1-003-000-001, "企业资质不存在");
} }

8
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java

@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.config.SecurityProperties; import cn.iocoder.yudao.framework.security.config.SecurityProperties;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.system.api.social.dto.SocialWxQrcodeReqDTO;
import cn.iocoder.yudao.module.system.controller.admin.auth.vo.*; import cn.iocoder.yudao.module.system.controller.admin.auth.vo.*;
import cn.iocoder.yudao.module.system.convert.auth.AuthConvert; import cn.iocoder.yudao.module.system.convert.auth.AuthConvert;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO; import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO;
@ -76,6 +77,13 @@ public class AuthController {
return success(authService.miniAppLogin(reqVO)); return success(authService.miniAppLogin(reqVO));
} }
@PermitAll
@PostMapping("/web_login")
@Operation(summary = "后台调用小程序微信扫码登录")
public CommonResult<byte[]> webLogin(@RequestBody @Valid SocialWxQrcodeReqDTO reqVO) {
return success(socialClientService.getWxaQrcode(reqVO));
}
@PostMapping("/logout") @PostMapping("/logout")
@PermitAll @PermitAll
@Operation(summary = "登出系统") @Operation(summary = "登出系统")

4
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterprisePageReqVO.java

@ -55,14 +55,14 @@ public class EnterprisePageReqVO extends PageParam {
private String gpsLocation; private String gpsLocation;
@Schema(description = "创建人") @Schema(description = "创建人")
private String createBy; private String create;
@Schema(description = "创建时间") @Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime; private LocalDateTime[] createTime;
@Schema(description = "修改人") @Schema(description = "修改人")
private String updateBy; private String updater;
@Schema(description = "管理部门", example = "26433") @Schema(description = "管理部门", example = "26433")
private Long managerDeptId; private Long managerDeptId;

94
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/EnterpriseQualificationController.java

@ -0,0 +1,94 @@
package cn.iocoder.yudao.module.system.controller.admin.qualification;
import org.springframework.web.bind.annotation.*;
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 java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
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.*;
import cn.iocoder.yudao.module.system.controller.admin.qualification.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.qualification.EnterpriseQualificationDO;
import cn.iocoder.yudao.module.system.service.qualification.EnterpriseQualificationService;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
@Tag(name = "管理后台 - 企业资质")
@RestController
@RequestMapping("/system/enterprise-qualification")
@Validated
public class EnterpriseQualificationController {
@Resource
private EnterpriseQualificationService enterpriseQualificationService;
@PostMapping("/create")
@Operation(summary = "创建企业资质")
@PreAuthorize("@ss.hasPermission('system:enterprise-qualification:create')")
public CommonResult<Long> createEnterpriseQualification(@Valid @RequestBody EnterpriseQualificationSaveReqVO createReqVO) {
return success(enterpriseQualificationService.createEnterpriseQualification(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新企业资质")
@PreAuthorize("@ss.hasPermission('system:enterprise-qualification:update')")
public CommonResult<Boolean> updateEnterpriseQualification(@Valid @RequestBody EnterpriseQualificationSaveReqVO updateReqVO) {
enterpriseQualificationService.updateEnterpriseQualification(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除企业资质")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('system:enterprise-qualification:delete')")
public CommonResult<Boolean> deleteEnterpriseQualification(@RequestParam("id") Long id) {
enterpriseQualificationService.deleteEnterpriseQualification(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得企业资质")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('system:enterprise-qualification:query')")
public CommonResult<EnterpriseQualificationRespVO> getEnterpriseQualification(@RequestParam("id") Long id) {
EnterpriseQualificationDO enterpriseQualification = enterpriseQualificationService.getEnterpriseQualification(id);
return success(BeanUtils.toBean(enterpriseQualification, EnterpriseQualificationRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得企业资质分页")
@PreAuthorize("@ss.hasPermission('system:enterprise-qualification:query')")
public CommonResult<PageResult<EnterpriseQualificationRespVO>> getEnterpriseQualificationPage(@Valid EnterpriseQualificationPageReqVO pageReqVO) {
PageResult<EnterpriseQualificationDO> pageResult = enterpriseQualificationService.getEnterpriseQualificationPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, EnterpriseQualificationRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出企业资质 Excel")
@PreAuthorize("@ss.hasPermission('system:enterprise-qualification:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportEnterpriseQualificationExcel(@Valid EnterpriseQualificationPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<EnterpriseQualificationDO> list = enterpriseQualificationService.getEnterpriseQualificationPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "企业资质.xls", "数据", EnterpriseQualificationRespVO.class,
BeanUtils.toBean(list, EnterpriseQualificationRespVO.class));
}
}

52
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationPageReqVO.java

@ -0,0 +1,52 @@
package cn.iocoder.yudao.module.system.controller.admin.qualification.vo;
import lombok.*;
import java.time.LocalDate;
import java.util.*;
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 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 EnterpriseQualificationPageReqVO extends PageParam {
@Schema(description = "企业ID", example = "28564")
private Long enterpriseId;
@Schema(description = "资质名称,例如:排污许可证、环保合格证", example = "张三")
private String qualificationName;
@Schema(description = "资质到期日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] expiryDate;
@Schema(description = "资质描述,详细说明资质信息", example = "随便")
private String qualificationDescription;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "修改人")
private String updater;
@Schema(description = "创建人")
private String creator;
@Schema(description = "办理日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDate[] handleDate;
@Schema(description = "资质编号")
private String enterpriseAuth;
}

57
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationRespVO.java

@ -0,0 +1,57 @@
package cn.iocoder.yudao.module.system.controller.admin.qualification.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDate;
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 EnterpriseQualificationRespVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "16561")
@ExcelProperty("主键")
private Long id;
@Schema(description = "企业ID", example = "28564")
@ExcelProperty("企业ID")
private Long enterpriseId;
@Schema(description = "资质名称,例如:排污许可证、环保合格证", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@ExcelProperty("资质名称,例如:排污许可证、环保合格证")
private Integer qualificationName;
@Schema(description = "资质到期日期")
@ExcelProperty("资质到期日期")
private LocalDate expiryDate;
@Schema(description = "资质描述,详细说明资质信息", example = "随便")
@ExcelProperty("资质描述,详细说明资质信息")
private String qualificationDescription;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "修改人")
@ExcelProperty("修改人")
private String updater;
@Schema(description = "创建人")
@ExcelProperty("创建人")
private String creator;
@Schema(description = "办理日期")
@ExcelProperty("办理日期")
private LocalDate handleDate;
@Schema(description = "资质编号")
@ExcelProperty("资质编号")
private String enterpriseAuth;
}

40
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationSaveReqVO.java

@ -0,0 +1,40 @@
package cn.iocoder.yudao.module.system.controller.admin.qualification.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDate;
import java.util.*;
@Schema(description = "管理后台 - 企业资质新增/修改 Request VO")
@Data
public class EnterpriseQualificationSaveReqVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "16561")
private Long id;
@Schema(description = "企业ID", example = "28564")
private Long enterpriseId;
@Schema(description = "资质名称,例如:排污许可证、环保合格证", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
private Integer qualificationName;
@Schema(description = "资质到期日期")
private LocalDate expiryDate;
@Schema(description = "资质描述,详细说明资质信息", example = "随便")
private String qualificationDescription;
@Schema(description = "修改人")
private String updater;
@Schema(description = "创建人")
private String creator;
@Schema(description = "办理日期")
private LocalDate handleDate;
@Schema(description = "资质编号")
private String enterpriseAuth;
}

9
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprise/EnterpriseDO.java

@ -77,14 +77,7 @@ public class EnterpriseDO extends BaseDO {
* 企业经纬度 * 企业经纬度
*/ */
private String gpsLocation; private String gpsLocation;
/**
* 创建人
*/
private String createBy;
/**
* 修改人
*/
private String updateBy;
/** /**
* 管理部门 * 管理部门
*/ */

56
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/qualification/EnterpriseQualificationDO.java

@ -0,0 +1,56 @@
package cn.iocoder.yudao.module.system.dal.dataobject.qualification;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 企业资质 DO
*
* @author 芋道源码
*/
@TableName("enterprise_qualification")
@KeySequence("enterprise_qualification_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class EnterpriseQualificationDO extends BaseDO {
/**
* 主键
*/
@TableId
private Long id;
/**
* 企业ID
*/
private Long enterpriseId;
/**
* 资质名称例如排污许可证环保合格证
*/
private Integer qualificationName;
/**
* 资质到期日期
*/
private LocalDateTime expiryDate;
/**
* 资质描述详细说明资质信息
*/
private String qualificationDescription;
/**
* 办理日期
*/
private LocalDateTime handleDate;
/**
* 资质编号
*/
private String enterpriseAuth;
}

4
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java

@ -31,9 +31,9 @@ public interface EnterpriseMapper extends BaseMapperX<EnterpriseDO> {
.eqIfPresent(EnterpriseDO::getIntroduction, reqVO.getIntroduction()) .eqIfPresent(EnterpriseDO::getIntroduction, reqVO.getIntroduction())
.betweenIfPresent(EnterpriseDO::getEstablishmentDate, reqVO.getEstablishmentDate()) .betweenIfPresent(EnterpriseDO::getEstablishmentDate, reqVO.getEstablishmentDate())
.eqIfPresent(EnterpriseDO::getGpsLocation, reqVO.getGpsLocation()) .eqIfPresent(EnterpriseDO::getGpsLocation, reqVO.getGpsLocation())
.eqIfPresent(EnterpriseDO::getCreateBy, reqVO.getCreateBy()) .eqIfPresent(EnterpriseDO::getCreator, reqVO.getCreate())
.betweenIfPresent(EnterpriseDO::getCreateTime, reqVO.getCreateTime()) .betweenIfPresent(EnterpriseDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(EnterpriseDO::getUpdateBy, reqVO.getUpdateBy()) .eqIfPresent(EnterpriseDO::getUpdater, reqVO.getUpdater())
.eqIfPresent(EnterpriseDO::getManagerDeptId, reqVO.getManagerDeptId()) .eqIfPresent(EnterpriseDO::getManagerDeptId, reqVO.getManagerDeptId())
.orderByDesc(EnterpriseDO::getId)); .orderByDesc(EnterpriseDO::getId));
} }

34
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/qualification/EnterpriseQualificationMapper.java

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.system.dal.mysql.qualification;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.qualification.EnterpriseQualificationDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.qualification.vo.*;
/**
* 企业资质 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface EnterpriseQualificationMapper extends BaseMapperX<EnterpriseQualificationDO> {
default PageResult<EnterpriseQualificationDO> selectPage(EnterpriseQualificationPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<EnterpriseQualificationDO>()
.eqIfPresent(EnterpriseQualificationDO::getEnterpriseId, reqVO.getEnterpriseId())
.likeIfPresent(EnterpriseQualificationDO::getQualificationName, reqVO.getQualificationName())
.betweenIfPresent(EnterpriseQualificationDO::getExpiryDate, reqVO.getExpiryDate())
.eqIfPresent(EnterpriseQualificationDO::getQualificationDescription, reqVO.getQualificationDescription())
.betweenIfPresent(EnterpriseQualificationDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(EnterpriseQualificationDO::getUpdater, reqVO.getUpdater())
.eqIfPresent(EnterpriseQualificationDO::getCreator, reqVO.getCreator())
.betweenIfPresent(EnterpriseQualificationDO::getHandleDate, reqVO.getHandleDate())
.eqIfPresent(EnterpriseQualificationDO::getEnterpriseAuth, reqVO.getEnterpriseAuth())
.orderByDesc(EnterpriseQualificationDO::getId));
}
}

10
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthService.java

@ -90,4 +90,14 @@ public interface AdminAuthService {
*/ */
AuthLoginRespVO miniAppLogin(AuthSocialLoginReqVO reqVO); AuthLoginRespVO miniAppLogin(AuthSocialLoginReqVO reqVO);
/**
* web登录
*
* @param reqVO 登录信息
* @return 登录结果
*/
AuthLoginRespVO webAppLogin(AuthSocialLoginReqVO reqVO);
} }

106
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java

@ -284,7 +284,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
AuthUser authUser = socialClientService.getAuthUser( AuthUser authUser = socialClientService.getAuthUser(
SocialTypeEnum.WECHAT_MINI_APP.getType(), SocialTypeEnum.WECHAT_MINI_APP.getType(),
UserTypeEnum.MEMBER.getValue(), // 假设用户类型为会员 UserTypeEnum.ADMIN.getValue(), // 假设用户类型为会员
reqVO.getCode(), reqVO.getCode(),
reqVO.getState() reqVO.getState()
); );
@ -334,6 +334,110 @@ public class AdminAuthServiceImpl implements AdminAuthService {
return createTokenAfterLoginSuccess(user.getId(), user.getUsername(), LoginLogTypeEnum.LOGIN_SOCIAL); return createTokenAfterLoginSuccess(user.getId(), user.getUsername(), LoginLogTypeEnum.LOGIN_SOCIAL);
} }
/**
* 小程序登录
*
* @param reqVO 登录信息
* @return 登录结果
*/
@Override
@Transactional
public AuthLoginRespVO webAppLogin(AuthSocialLoginReqVO reqVO) {
String APPID = "wx6a07542e99f7fc98";
String APPSECRET = "ebce621ebc5afed6d9fad388d08e11ed";
String REDIRECT_URI = "https://hb.jzce.com/";
AuthUser authUser = socialClientService.getAuthUser(
SocialTypeEnum.WECHAT_MINI_APP.getType(),
UserTypeEnum.MEMBER.getValue(), // 假设用户类型为会员
reqVO.getCode(),
reqVO.getState()
);
// String baseUrl = "https://open.weixin.qq.com/connect/qrconnect";
// Map<String, String> params = new HashMap<>();
// params.put("appid", APPID);
// params.put("redirect_uri", REDIRECT_URI);
// params.put("response_type", "code");
// params.put("scope", "snsapi_login");
// params.put("state", "STATE");
//
// StringBuilder paramStr = new StringBuilder();
// for (Map.Entry<String, String> entry : params.entrySet()) {
// if (paramStr.length() > 0) {
// paramStr.append("&");
// }
// paramStr.append(entry.getKey()).append("=").append(entry.getValue());
// }
//
// return baseUrl + "?" + paramStr + "#wechat_redirect";
// 根据授权码获取 access_token 和 openid
//
String baseUrl = "https://api.weixin.qq.com/sns/oauth2/access_token";
String urlStr = baseUrl + "?appid=" + APPID + "&secret=" + APPSECRET + "&code=" + reqVO.getCode()+ "&grant_type=authorization_code";
System.out.println("-----------urlStr:"+urlStr);
//
// SocialUserRespDTO respDTO = socialUserService.getSocialUserByCode(UserTypeEnum.ADMIN.getValue(), UserTypeEnum.MEMBER.getValue(),
// reqVO.getCode(), reqVO.getState());
//
// AdminUserDO user = null;
//
// if (respDTO == null ) {
// // 未找到社交用户,插入记录
// SocialUserDO socialUser = new SocialUserDO();
// socialUser.setType(reqVO.getType());
// socialUser.setOpenid(authUser.getUuid());
// socialUser.setCode(reqVO.getCode());
// socialUser.setAvatar(authUser.getAvatar());
// socialUser.setRawTokenInfo(authUser.getToken().getRefreshToken());
// socialUser.setNickname(authUser.getNickname());
// socialUser.setRawUserInfo(authUser.getRawUserInfo().toJSONString());
// final int insert = socialUserMapper.insert(socialUser);
// if (insert < 0) {
// throw exception(USER_NOT_EXISTS);
// }
//
// user = userService.autoRegisterUser(authUser);
//
// //添加绑定
// SocialUserBindReqDTO userBindReqDTO = new SocialUserBindReqDTO();
// userBindReqDTO.setUserId(user.getId());
// userBindReqDTO.setUserType(SocialTypeEnum.WECHAT_MINI_APP.getType());
// userBindReqDTO.setCode(reqVO.getCode());
// userBindReqDTO.setSocialType(reqVO.getType());
// userBindReqDTO.setState(reqVO.getState());
// socialUserService.bindSocialUser(userBindReqDTO);
//
// return createTokenAfterLoginSuccess(user.getId(), user.getUsername(), LoginLogTypeEnum.LOGIN_SOCIAL);
//
// } else {
// // 获得用户
// user = userService.getUser(respDTO.getUserId());
// if (user == null) {
// throw exception(USER_NOT_EXISTS);
// }
//
// }
//
// return createTokenAfterLoginSuccess(user.getId(), user.getUsername(), LoginLogTypeEnum.LOGIN_SOCIAL);
return null;
}
@VisibleForTesting @VisibleForTesting
void validateCaptcha(AuthRegisterReqVO reqVO) { void validateCaptcha(AuthRegisterReqVO reqVO) {
// 如果验证码关闭,则不进行校验 // 如果验证码关闭,则不进行校验

55
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/qualification/EnterpriseQualificationService.java

@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.system.service.qualification;
import java.util.*;
import cn.iocoder.yudao.module.system.controller.admin.qualification.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.qualification.EnterpriseQualificationDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import javax.validation.Valid;
/**
* 企业资质 Service 接口
*
* @author 芋道源码
*/
public interface EnterpriseQualificationService {
/**
* 创建企业资质
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createEnterpriseQualification(@Valid EnterpriseQualificationSaveReqVO createReqVO);
/**
* 更新企业资质
*
* @param updateReqVO 更新信息
*/
void updateEnterpriseQualification(@Valid EnterpriseQualificationSaveReqVO updateReqVO);
/**
* 删除企业资质
*
* @param id 编号
*/
void deleteEnterpriseQualification(Long id);
/**
* 获得企业资质
*
* @param id 编号
* @return 企业资质
*/
EnterpriseQualificationDO getEnterpriseQualification(Long id);
/**
* 获得企业资质分页
*
* @param pageReqVO 分页查询
* @return 企业资质分页
*/
PageResult<EnterpriseQualificationDO> getEnterpriseQualificationPage(EnterpriseQualificationPageReqVO pageReqVO);
}

76
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/qualification/EnterpriseQualificationServiceImpl.java

@ -0,0 +1,76 @@
package cn.iocoder.yudao.module.system.service.qualification;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.iocoder.yudao.module.system.controller.admin.qualification.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.qualification.EnterpriseQualificationDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.system.dal.mysql.qualification.EnterpriseQualificationMapper;
import javax.annotation.Resource;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
/**
* 企业资质 Service 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class EnterpriseQualificationServiceImpl implements EnterpriseQualificationService {
@Resource
private EnterpriseQualificationMapper enterpriseQualificationMapper;
@Override
public Long createEnterpriseQualification(EnterpriseQualificationSaveReqVO createReqVO) {
// 插入
EnterpriseQualificationDO enterpriseQualification = BeanUtils.toBean(createReqVO, EnterpriseQualificationDO.class);
enterpriseQualificationMapper.insert(enterpriseQualification);
// 返回
return enterpriseQualification.getId();
}
@Override
public void updateEnterpriseQualification(EnterpriseQualificationSaveReqVO updateReqVO) {
// 校验存在
validateEnterpriseQualificationExists(updateReqVO.getId());
// 更新
EnterpriseQualificationDO updateObj = BeanUtils.toBean(updateReqVO, EnterpriseQualificationDO.class);
enterpriseQualificationMapper.updateById(updateObj);
}
@Override
public void deleteEnterpriseQualification(Long id) {
// 校验存在
validateEnterpriseQualificationExists(id);
// 删除
enterpriseQualificationMapper.deleteById(id);
}
private void validateEnterpriseQualificationExists(Long id) {
if (enterpriseQualificationMapper.selectById(id) == null) {
throw exception(ENTERPRISE_QUALIFICATION_NOT_EXISTS);
}
}
@Override
public EnterpriseQualificationDO getEnterpriseQualification(Long id) {
return enterpriseQualificationMapper.selectById(id);
}
@Override
public PageResult<EnterpriseQualificationDO> getEnterpriseQualificationPage(EnterpriseQualificationPageReqVO pageReqVO) {
return enterpriseQualificationMapper.selectPage(pageReqVO);
}
}

35
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImpl.java

@ -199,6 +199,41 @@ public class SocialClientServiceImpl implements SocialClientService {
return request; return request;
} }
/**
* 构建 AuthRequest 对象支持多租户配置
*
* @param socialType 社交类型
* @param userType 用户类型
* @return AuthRequest 对象
*/
@VisibleForTesting
AuthRequest buildAuthRequestWxMiniApp(Integer socialType, Integer userType) {
// 1. 先查找默认的配置项,从 application-*.yaml 中读取
AuthRequest request = authRequestFactory.get(SocialTypeEnum.valueOfType(socialType).getSource());
Assert.notNull(request, String.format("社交平台(%d) 不存在", socialType));
// 2. 查询 DB 的配置项,如果存在则进行覆盖
SocialClientDO client = socialClientMapper.selectBySocialTypeAndUserType(socialType, userType);
if (client != null && Objects.equals(client.getStatus(), CommonStatusEnum.ENABLE.getStatus())) {
// 2.1 构造新的 AuthConfig 对象
AuthConfig authConfig = (AuthConfig) ReflectUtil.getFieldValue(request, "config");
AuthConfig newAuthConfig = ReflectUtil.newInstance(authConfig.getClass());
BeanUtil.copyProperties(authConfig, newAuthConfig);
// 2.2 修改对应的 clientId + clientSecret 密钥
newAuthConfig.setClientId(client.getClientId());
newAuthConfig.setClientSecret(client.getClientSecret());
if (client.getAgentId() != null) { // 如果有 agentId 则修改 agentId
newAuthConfig.setAgentId(client.getAgentId());
}
newAuthConfig.setIgnoreCheckState(true);
newAuthConfig.setIgnoreCheckRedirectUri(true);
// 2.3 设置会 request 里,进行后续使用
ReflectUtil.setFieldValue(request, "config", newAuthConfig);
}
return request;
}
// =================== 微信公众号独有 =================== // =================== 微信公众号独有 ===================
@Override @Override

12
yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/qualification/EnterpriseQualificationMapper.xml

@ -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.system.dal.mysql.qualification.EnterpriseQualificationMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

3
yudao-module-system/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants_手动操作.java

@ -0,0 +1,3 @@
// TODO 待办:请将下面的错误码复制到 yudao-module-system-api 模块的 ErrorCodeConstants 类中。注意,请给“TODO 补充编号”设置一个错误码编号!!!
// ========== 企业资质 TODO 补充编号 ==========
ErrorCode ENTERPRISE_QUALIFICATION_NOT_EXISTS = new ErrorCode(TODO 补充编号, "企业资质不存在");

95
yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/EnterpriseQualificationController.java

@ -0,0 +1,95 @@
package cn.iocoder.yudao.module.system.controller.admin.qualification;
import org.springframework.web.bind.annotation.*;
import jakarta.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 jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
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.*;
import cn.iocoder.yudao.module.system.controller.admin.qualification.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.qualification.EnterpriseQualificationDO;
import cn.iocoder.yudao.module.system.service.qualification.EnterpriseQualificationService;
@Tag(name = "管理后台 - 企业资质")
@RestController
@RequestMapping("/system/enterprise-qualification")
@Validated
public class EnterpriseQualificationController {
@Resource
private EnterpriseQualificationService enterpriseQualificationService;
@PostMapping("/create")
@Operation(summary = "创建企业资质")
@PreAuthorize("@ss.hasPermission('system:enterprise-qualification:create')")
public CommonResult<Long> createEnterpriseQualification(@Valid @RequestBody EnterpriseQualificationSaveReqVO createReqVO) {
return success(enterpriseQualificationService.createEnterpriseQualification(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新企业资质")
@PreAuthorize("@ss.hasPermission('system:enterprise-qualification:update')")
public CommonResult<Boolean> updateEnterpriseQualification(@Valid @RequestBody EnterpriseQualificationSaveReqVO updateReqVO) {
enterpriseQualificationService.updateEnterpriseQualification(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除企业资质")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('system:enterprise-qualification:delete')")
public CommonResult<Boolean> deleteEnterpriseQualification(@RequestParam("id") Long id) {
enterpriseQualificationService.deleteEnterpriseQualification(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得企业资质")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('system:enterprise-qualification:query')")
public CommonResult<EnterpriseQualificationRespVO> getEnterpriseQualification(@RequestParam("id") Long id) {
EnterpriseQualificationDO enterpriseQualification = enterpriseQualificationService.getEnterpriseQualification(id);
return success(BeanUtils.toBean(enterpriseQualification, EnterpriseQualificationRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得企业资质分页")
@PreAuthorize("@ss.hasPermission('system:enterprise-qualification:query')")
public CommonResult<PageResult<EnterpriseQualificationRespVO>> getEnterpriseQualificationPage(@Valid EnterpriseQualificationPageReqVO pageReqVO) {
PageResult<EnterpriseQualificationDO> pageResult = enterpriseQualificationService.getEnterpriseQualificationPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, EnterpriseQualificationRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出企业资质 Excel")
@PreAuthorize("@ss.hasPermission('system:enterprise-qualification:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportEnterpriseQualificationExcel(@Valid EnterpriseQualificationPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<EnterpriseQualificationDO> list = enterpriseQualificationService.getEnterpriseQualificationPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "企业资质.xls", "数据", EnterpriseQualificationRespVO.class,
BeanUtils.toBean(list, EnterpriseQualificationRespVO.class));
}
}

48
yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationPageReqVO.java

@ -0,0 +1,48 @@
package cn.iocoder.yudao.module.system.controller.admin.qualification.vo;
import lombok.*;
import java.util.*;
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 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 EnterpriseQualificationPageReqVO extends PageParam {
@Schema(description = "企业ID", example = "28564")
private Long enterpriseId;
@Schema(description = "资质名称,例如:排污许可证、环保合格证", example = "张三")
private Integer qualificationName;
@Schema(description = "资质到期日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDate[] expiryDate;
@Schema(description = "资质描述,详细说明资质信息", example = "随便")
private String qualificationDescription;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "修改人")
private String updateBy;
@Schema(description = "创建人")
private String createBy;
@Schema(description = "办理日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDate[] handleDate;
@Schema(description = "资质编号")
private String enterpriseAuth;
}

55
yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationRespVO.java

@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.system.controller.admin.qualification.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
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 EnterpriseQualificationRespVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "16561")
@ExcelProperty("主键")
private Long id;
@Schema(description = "企业ID", example = "28564")
@ExcelProperty("企业ID")
private Long enterpriseId;
@Schema(description = "资质名称,例如:排污许可证、环保合格证", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@ExcelProperty("资质名称,例如:排污许可证、环保合格证")
private Integer qualificationName;
@Schema(description = "资质到期日期")
@ExcelProperty("资质到期日期")
private LocalDate expiryDate;
@Schema(description = "资质描述,详细说明资质信息", example = "随便")
@ExcelProperty("资质描述,详细说明资质信息")
private String qualificationDescription;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "修改人")
@ExcelProperty("修改人")
private String updateBy;
@Schema(description = "创建人")
@ExcelProperty("创建人")
private String createBy;
@Schema(description = "办理日期")
@ExcelProperty("办理日期")
private LocalDate handleDate;
@Schema(description = "资质编号")
@ExcelProperty("资质编号")
private String enterpriseAuth;
}

40
yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationSaveReqVO.java

@ -0,0 +1,40 @@
package cn.iocoder.yudao.module.system.controller.admin.qualification.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
@Schema(description = "管理后台 - 企业资质新增/修改 Request VO")
@Data
public class EnterpriseQualificationSaveReqVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "16561")
private Long id;
@Schema(description = "企业ID", example = "28564")
private Long enterpriseId;
@Schema(description = "资质名称,例如:排污许可证、环保合格证", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@NotNull(message = "资质名称,例如:排污许可证、环保合格证不能为空")
private Integer qualificationName;
@Schema(description = "资质到期日期")
private LocalDate expiryDate;
@Schema(description = "资质描述,详细说明资质信息", example = "随便")
private String qualificationDescription;
@Schema(description = "修改人")
private String updateBy;
@Schema(description = "创建人")
private String createBy;
@Schema(description = "办理日期")
private LocalDate handleDate;
@Schema(description = "资质编号")
private String enterpriseAuth;
}

63
yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/qualification/EnterpriseQualificationDO.java

@ -0,0 +1,63 @@
package cn.iocoder.yudao.module.system.dal.dataobject.qualification;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 企业资质 DO
*
* @author 芋道源码
*/
@TableName("enterprise_qualification")
@KeySequence("enterprise_qualification_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class EnterpriseQualificationDO extends BaseDO {
/**
* 主键
*/
@TableId
private Long id;
/**
* 企业ID
*/
private Long enterpriseId;
/**
* 资质名称例如排污许可证环保合格证
*/
private Integer qualificationName;
/**
* 资质到期日期
*/
private LocalDate expiryDate;
/**
* 资质描述详细说明资质信息
*/
private String qualificationDescription;
/**
* 修改人
*/
private String updateBy;
/**
* 创建人
*/
private String createBy;
/**
* 办理日期
*/
private LocalDate handleDate;
/**
* 资质编号
*/
private String enterpriseAuth;
}

34
yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/qualification/EnterpriseQualificationMapper.java

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.system.dal.mysql.qualification;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.qualification.EnterpriseQualificationDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.qualification.vo.*;
/**
* 企业资质 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface EnterpriseQualificationMapper extends BaseMapperX<EnterpriseQualificationDO> {
default PageResult<EnterpriseQualificationDO> selectPage(EnterpriseQualificationPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<EnterpriseQualificationDO>()
.eqIfPresent(EnterpriseQualificationDO::getEnterpriseId, reqVO.getEnterpriseId())
.likeIfPresent(EnterpriseQualificationDO::getQualificationName, reqVO.getQualificationName())
.betweenIfPresent(EnterpriseQualificationDO::getExpiryDate, reqVO.getExpiryDate())
.eqIfPresent(EnterpriseQualificationDO::getQualificationDescription, reqVO.getQualificationDescription())
.betweenIfPresent(EnterpriseQualificationDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(EnterpriseQualificationDO::getUpdateBy, reqVO.getUpdateBy())
.eqIfPresent(EnterpriseQualificationDO::getCreateBy, reqVO.getCreateBy())
.betweenIfPresent(EnterpriseQualificationDO::getHandleDate, reqVO.getHandleDate())
.eqIfPresent(EnterpriseQualificationDO::getEnterpriseAuth, reqVO.getEnterpriseAuth())
.orderByDesc(EnterpriseQualificationDO::getId));
}
}

55
yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/qualification/EnterpriseQualificationService.java

@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.system.service.qualification;
import java.util.*;
import jakarta.validation.*;
import cn.iocoder.yudao.module.system.controller.admin.qualification.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.qualification.EnterpriseQualificationDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* 企业资质 Service 接口
*
* @author 芋道源码
*/
public interface EnterpriseQualificationService {
/**
* 创建企业资质
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createEnterpriseQualification(@Valid EnterpriseQualificationSaveReqVO createReqVO);
/**
* 更新企业资质
*
* @param updateReqVO 更新信息
*/
void updateEnterpriseQualification(@Valid EnterpriseQualificationSaveReqVO updateReqVO);
/**
* 删除企业资质
*
* @param id 编号
*/
void deleteEnterpriseQualification(Long id);
/**
* 获得企业资质
*
* @param id 编号
* @return 企业资质
*/
EnterpriseQualificationDO getEnterpriseQualification(Long id);
/**
* 获得企业资质分页
*
* @param pageReqVO 分页查询
* @return 企业资质分页
*/
PageResult<EnterpriseQualificationDO> getEnterpriseQualificationPage(EnterpriseQualificationPageReqVO pageReqVO);
}

74
yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/qualification/EnterpriseQualificationServiceImpl.java

@ -0,0 +1,74 @@
package cn.iocoder.yudao.module.system.service.qualification;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.iocoder.yudao.module.system.controller.admin.qualification.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.qualification.EnterpriseQualificationDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.system.dal.mysql.qualification.EnterpriseQualificationMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
/**
* 企业资质 Service 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class EnterpriseQualificationServiceImpl implements EnterpriseQualificationService {
@Resource
private EnterpriseQualificationMapper enterpriseQualificationMapper;
@Override
public Long createEnterpriseQualification(EnterpriseQualificationSaveReqVO createReqVO) {
// 插入
EnterpriseQualificationDO enterpriseQualification = BeanUtils.toBean(createReqVO, EnterpriseQualificationDO.class);
enterpriseQualificationMapper.insert(enterpriseQualification);
// 返回
return enterpriseQualification.getId();
}
@Override
public void updateEnterpriseQualification(EnterpriseQualificationSaveReqVO updateReqVO) {
// 校验存在
validateEnterpriseQualificationExists(updateReqVO.getId());
// 更新
EnterpriseQualificationDO updateObj = BeanUtils.toBean(updateReqVO, EnterpriseQualificationDO.class);
enterpriseQualificationMapper.updateById(updateObj);
}
@Override
public void deleteEnterpriseQualification(Long id) {
// 校验存在
validateEnterpriseQualificationExists(id);
// 删除
enterpriseQualificationMapper.deleteById(id);
}
private void validateEnterpriseQualificationExists(Long id) {
if (enterpriseQualificationMapper.selectById(id) == null) {
throw exception(ENTERPRISE_QUALIFICATION_NOT_EXISTS);
}
}
@Override
public EnterpriseQualificationDO getEnterpriseQualification(Long id) {
return enterpriseQualificationMapper.selectById(id);
}
@Override
public PageResult<EnterpriseQualificationDO> getEnterpriseQualificationPage(EnterpriseQualificationPageReqVO pageReqVO) {
return enterpriseQualificationMapper.selectPage(pageReqVO);
}
}

12
yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/qualification/EnterpriseQualificationMapper.xml

@ -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.system.dal.mysql.qualification.EnterpriseQualificationMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>
Loading…
Cancel
Save