diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml index b29eb5f..0e7c6a1 100644 --- a/yudao-dependencies/pom.xml +++ b/yudao-dependencies/pom.xml @@ -71,7 +71,7 @@ 2.17.0 1.27.1 1.12.777 - 1.0.8 + 1.16.7 1.7.8 4.6.0 diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java index 2070d69..7ba08ee 100644 --- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java +++ b/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 ErrorCode ENTERPRISE_NOT_EXISTS = new ErrorCode(1-003-000-000, "企业不存在"); + ErrorCode ENTERPRISE_QUALIFICATION_NOT_EXISTS = new ErrorCode(1-003-000-001, "企业资质不存在"); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java index 8a9a392..ae69716 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java +++ b/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.security.config.SecurityProperties; 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.convert.auth.AuthConvert; import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO; @@ -76,6 +77,13 @@ public class AuthController { return success(authService.miniAppLogin(reqVO)); } + @PermitAll + @PostMapping("/web_login") + @Operation(summary = "后台调用小程序微信扫码登录") + public CommonResult webLogin(@RequestBody @Valid SocialWxQrcodeReqDTO reqVO) { + return success(socialClientService.getWxaQrcode(reqVO)); + } + @PostMapping("/logout") @PermitAll @Operation(summary = "登出系统") diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterprisePageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterprisePageReqVO.java index dd2bb73..2257009 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterprisePageReqVO.java +++ b/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; @Schema(description = "创建人") - private String createBy; + private String create; @Schema(description = "创建时间") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) private LocalDateTime[] createTime; @Schema(description = "修改人") - private String updateBy; + private String updater; @Schema(description = "管理部门", example = "26433") private Long managerDeptId; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/EnterpriseQualificationController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/EnterpriseQualificationController.java new file mode 100644 index 0000000..cffb075 --- /dev/null +++ b/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 createEnterpriseQualification(@Valid @RequestBody EnterpriseQualificationSaveReqVO createReqVO) { + return success(enterpriseQualificationService.createEnterpriseQualification(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新企业资质") + @PreAuthorize("@ss.hasPermission('system:enterprise-qualification:update')") + public CommonResult 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 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 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> getEnterpriseQualificationPage(@Valid EnterpriseQualificationPageReqVO pageReqVO) { + PageResult 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 list = enterpriseQualificationService.getEnterpriseQualificationPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "企业资质.xls", "数据", EnterpriseQualificationRespVO.class, + BeanUtils.toBean(list, EnterpriseQualificationRespVO.class)); + } + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationPageReqVO.java new file mode 100644 index 0000000..791b051 --- /dev/null +++ b/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; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationRespVO.java new file mode 100644 index 0000000..fad3224 --- /dev/null +++ b/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; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationSaveReqVO.java new file mode 100644 index 0000000..ea3ec8e --- /dev/null +++ b/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; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprise/EnterpriseDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprise/EnterpriseDO.java index fda64b1..e68f8f2 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprise/EnterpriseDO.java +++ b/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 createBy; - /** - * 修改人 - */ - private String updateBy; + /** * 管理部门 */ diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/qualification/EnterpriseQualificationDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/qualification/EnterpriseQualificationDO.java new file mode 100644 index 0000000..0f86a44 --- /dev/null +++ b/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; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java index cb86a1f..73f464c 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java +++ b/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 { .eqIfPresent(EnterpriseDO::getIntroduction, reqVO.getIntroduction()) .betweenIfPresent(EnterpriseDO::getEstablishmentDate, reqVO.getEstablishmentDate()) .eqIfPresent(EnterpriseDO::getGpsLocation, reqVO.getGpsLocation()) - .eqIfPresent(EnterpriseDO::getCreateBy, reqVO.getCreateBy()) + .eqIfPresent(EnterpriseDO::getCreator, reqVO.getCreate()) .betweenIfPresent(EnterpriseDO::getCreateTime, reqVO.getCreateTime()) - .eqIfPresent(EnterpriseDO::getUpdateBy, reqVO.getUpdateBy()) + .eqIfPresent(EnterpriseDO::getUpdater, reqVO.getUpdater()) .eqIfPresent(EnterpriseDO::getManagerDeptId, reqVO.getManagerDeptId()) .orderByDesc(EnterpriseDO::getId)); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/qualification/EnterpriseQualificationMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/qualification/EnterpriseQualificationMapper.java new file mode 100644 index 0000000..99419f1 --- /dev/null +++ b/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 { + + default PageResult selectPage(EnterpriseQualificationPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .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)); + } + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthService.java index 8f1d25c..4d86fda 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthService.java +++ b/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); + + /** + * web登录 + * + * @param reqVO 登录信息 + * @return 登录结果 + */ + AuthLoginRespVO webAppLogin(AuthSocialLoginReqVO reqVO); + + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java index c113c84..7d74da3 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java +++ b/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( SocialTypeEnum.WECHAT_MINI_APP.getType(), - UserTypeEnum.MEMBER.getValue(), // 假设用户类型为会员 + UserTypeEnum.ADMIN.getValue(), // 假设用户类型为会员 reqVO.getCode(), reqVO.getState() ); @@ -334,6 +334,110 @@ public class AdminAuthServiceImpl implements AdminAuthService { 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 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 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 void validateCaptcha(AuthRegisterReqVO reqVO) { // 如果验证码关闭,则不进行校验 diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/qualification/EnterpriseQualificationService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/qualification/EnterpriseQualificationService.java new file mode 100644 index 0000000..9988d86 --- /dev/null +++ b/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 getEnterpriseQualificationPage(EnterpriseQualificationPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/qualification/EnterpriseQualificationServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/qualification/EnterpriseQualificationServiceImpl.java new file mode 100644 index 0000000..e760b63 --- /dev/null +++ b/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 getEnterpriseQualificationPage(EnterpriseQualificationPageReqVO pageReqVO) { + return enterpriseQualificationMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImpl.java index 8d1927e..d520824 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImpl.java +++ b/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; } + + /** + * 构建 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 diff --git a/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/qualification/EnterpriseQualificationMapper.xml b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/qualification/EnterpriseQualificationMapper.xml new file mode 100644 index 0000000..990a1d5 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/qualification/EnterpriseQualificationMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants_手动操作.java b/yudao-module-system/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants_手动操作.java new file mode 100644 index 0000000..79361f5 --- /dev/null +++ b/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 补充编号, "企业资质不存在"); \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/EnterpriseQualificationController.java b/yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/EnterpriseQualificationController.java new file mode 100644 index 0000000..e088c53 --- /dev/null +++ b/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 createEnterpriseQualification(@Valid @RequestBody EnterpriseQualificationSaveReqVO createReqVO) { + return success(enterpriseQualificationService.createEnterpriseQualification(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新企业资质") + @PreAuthorize("@ss.hasPermission('system:enterprise-qualification:update')") + public CommonResult 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 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 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> getEnterpriseQualificationPage(@Valid EnterpriseQualificationPageReqVO pageReqVO) { + PageResult 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 list = enterpriseQualificationService.getEnterpriseQualificationPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "企业资质.xls", "数据", EnterpriseQualificationRespVO.class, + BeanUtils.toBean(list, EnterpriseQualificationRespVO.class)); + } + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationPageReqVO.java b/yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationPageReqVO.java new file mode 100644 index 0000000..64cc268 --- /dev/null +++ b/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; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationRespVO.java b/yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationRespVO.java new file mode 100644 index 0000000..a972228 --- /dev/null +++ b/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; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationSaveReqVO.java b/yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationSaveReqVO.java new file mode 100644 index 0000000..59f0c18 --- /dev/null +++ b/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; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/qualification/EnterpriseQualificationDO.java b/yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/qualification/EnterpriseQualificationDO.java new file mode 100644 index 0000000..3d7cd8b --- /dev/null +++ b/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; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/qualification/EnterpriseQualificationMapper.java b/yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/qualification/EnterpriseQualificationMapper.java new file mode 100644 index 0000000..5ad0a7d --- /dev/null +++ b/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 { + + default PageResult selectPage(EnterpriseQualificationPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .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)); + } + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/qualification/EnterpriseQualificationService.java b/yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/qualification/EnterpriseQualificationService.java new file mode 100644 index 0000000..d513f6b --- /dev/null +++ b/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 getEnterpriseQualificationPage(EnterpriseQualificationPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/qualification/EnterpriseQualificationServiceImpl.java b/yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/qualification/EnterpriseQualificationServiceImpl.java new file mode 100644 index 0000000..82ee680 --- /dev/null +++ b/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 getEnterpriseQualificationPage(EnterpriseQualificationPageReqVO pageReqVO) { + return enterpriseQualificationMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/qualification/EnterpriseQualificationMapper.xml b/yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/qualification/EnterpriseQualificationMapper.xml new file mode 100644 index 0000000..990a1d5 --- /dev/null +++ b/yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/qualification/EnterpriseQualificationMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file