添加预约模块

This commit is contained in:
sonjinyon 2024-08-09 14:53:01 +08:00
parent 872159a859
commit 28c65b61cb
33 changed files with 1727 additions and 1 deletions

View File

@ -23,7 +23,9 @@
<module>yudao-module-mall</module>
<module>yudao-module-crm</module>
<module>yudao-module-erp</module>
<!-- <module>yudao-module-ai</module>-->
<module>yudao-module-subscribe</module>
<!-- <module>yudao-module-ai</module>-->
</modules>
<name>${project.artifactId}</name>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>yudao</artifactId>
<groupId>cn.iocoder.boot</groupId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<modules>
<module>yudao-module-subscribe-api</module>
<module>yudao-module-subscribe-biz</module>
</modules>
<artifactId>yudao-module-subscribe</artifactId>
<packaging>pom</packaging>
</project>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>yudao-module-subscribe</artifactId>
<groupId>cn.iocoder.boot</groupId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>yudao-module-subscribe-api</artifactId>
<dependencies>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-common</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,11 @@
package cn.iocoder.yudao.module.subscribe.enums;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
public interface ErrorCodeConstants {
ErrorCode MANAGE_NOT_EXISTS = new ErrorCode(11111, "预约不存在");
ErrorCode STAFF_NOT_EXISTS = new ErrorCode(22222, "预约人员不存在");
ErrorCode ORGANIZATION_NOT_EXISTS = new ErrorCode(33333, "机构不存在");
}

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>yudao-module-subscribe</artifactId>
<groupId>cn.iocoder.boot</groupId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>yudao-module-subscribe-biz</artifactId>
<dependencies>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-subscribe-api</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-system-api</artifactId>
<version>${revision}</version>
</dependency>
<!-- 业务组件 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>
</dependency>
<!-- Web 相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-security</artifactId>
</dependency>
<!-- DB 相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-mybatis</artifactId>
</dependency>
<!-- Test 测试相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-excel</artifactId>
</dependency>
<dependency>
<groupId>cn.com.kingbase</groupId>
<artifactId>kingbase8</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,105 @@
package cn.iocoder.yudao.module.srbscribe.controller.admin.organization;
import cn.iocoder.yudao.module.srbscribe.controller.admin.organization.vo.OrganizationPageReqVO;
import cn.iocoder.yudao.module.srbscribe.controller.admin.organization.vo.OrganizationRespVO;
import cn.iocoder.yudao.module.srbscribe.controller.admin.organization.vo.OrganizationSaveReqVO;
import cn.iocoder.yudao.module.srbscribe.dal.dataobject.organization.OrganizationDO;
import cn.iocoder.yudao.module.srbscribe.dal.dataobject.organization.OrganizationOptions;
import cn.iocoder.yudao.module.srbscribe.service.organization.OrganizationService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.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.*;
@Tag(name = "管理后台 - 机构")
@RestController
@RequestMapping("/subscribe/organization")
@Validated
public class OrganizationController {
@Resource
private OrganizationService organizationService;
@PostMapping("/create")
@Operation(summary = "创建机构")
@PreAuthorize("@ss.hasPermission('subscribe:organization:create')")
public CommonResult<Integer> createOrganization(@Valid @RequestBody OrganizationSaveReqVO createReqVO) {
return success(organizationService.createOrganization(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新机构")
@PreAuthorize("@ss.hasPermission('subscribe:organization:update')")
public CommonResult<Boolean> updateOrganization(@Valid @RequestBody OrganizationSaveReqVO updateReqVO) {
organizationService.updateOrganization(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除机构")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('subscribe:organization:delete')")
public CommonResult<Boolean> deleteOrganization(@RequestParam("id") Integer id) {
organizationService.deleteOrganization(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得机构")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('subscribe:organization:query')")
public CommonResult<OrganizationRespVO> getOrganization(@RequestParam("id") Integer id) {
OrganizationDO organization = organizationService.getOrganization(id);
return success(BeanUtils.toBean(organization, OrganizationRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得机构分页")
@PreAuthorize("@ss.hasPermission('subscribe:organization:query')")
public CommonResult<PageResult<OrganizationRespVO>> getOrganizationPage(@Valid OrganizationPageReqVO pageReqVO) {
PageResult<OrganizationDO> pageResult = organizationService.getOrganizationPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, OrganizationRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出机构 Excel")
@PreAuthorize("@ss.hasPermission('subscribe:organization:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportOrganizationExcel(@Valid OrganizationPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<OrganizationDO> list = organizationService.getOrganizationPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "机构.xls", "数据", OrganizationRespVO.class,
BeanUtils.toBean(list, OrganizationRespVO.class));
}
@GetMapping("/getOrganization")
@Operation(summary = "获得机构名称数据")
public CommonResult<List<OrganizationDO>> getOrganization() {
List<OrganizationDO> organization = organizationService.getOrganization();
return success(organization);
}
}

View File

@ -0,0 +1,43 @@
package cn.iocoder.yudao.module.srbscribe.controller.admin.organization.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 OrganizationPageReqVO extends PageParam {
@Schema(description = "机构名称", example = "芋艿")
private String name;
@Schema(description = "机构电话")
private String phone;
@Schema(description = "机构邮箱")
private String email;
@Schema(description = "机构图片")
private String picture;
@Schema(description = "机构地址")
private String address;
@Schema(description = "机构简介")
private String depict;
@Schema(description = "状态", example = "1")
private Integer status;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,54 @@
package cn.iocoder.yudao.module.srbscribe.controller.admin.organization.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.*;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
@Schema(description = "管理后台 - 机构 Response VO")
@Data
@ExcelIgnoreUnannotated
public class OrganizationRespVO {
@Schema(description = "机构id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9041")
@ExcelProperty("机构id")
private Integer id;
@Schema(description = "机构名称", example = "芋艿")
@ExcelProperty("机构名称")
private String name;
@Schema(description = "机构电话")
@ExcelProperty("机构电话")
private String phone;
@Schema(description = "机构邮箱")
@ExcelProperty("机构邮箱")
private String email;
@Schema(description = "机构图片")
@ExcelProperty("机构图片")
private String picture;
@Schema(description = "机构地址")
@ExcelProperty("机构地址")
private String address;
@Schema(description = "机构简介")
@ExcelProperty("机构简介")
private String depict;
@Schema(description = "状态", example = "1")
@ExcelProperty(value = "状态", converter = DictConvert.class)
@DictFormat("organization_status") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中
private Integer status;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,36 @@
package cn.iocoder.yudao.module.srbscribe.controller.admin.organization.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 机构新增/修改 Request VO")
@Data
public class OrganizationSaveReqVO {
@Schema(description = "机构id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9041")
private Integer id;
@Schema(description = "机构名称", example = "芋艿")
private String name;
@Schema(description = "机构电话")
private String phone;
@Schema(description = "机构邮箱")
private String email;
@Schema(description = "机构图片")
private String picture;
@Schema(description = "机构地址")
private String address;
@Schema(description = "机构简介")
private String depict;
@Schema(description = "状态", example = "1")
private Integer status;
}

View File

@ -0,0 +1,103 @@
package cn.iocoder.yudao.module.srbscribe.controller.admin.staff;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.srbscribe.controller.admin.organization.vo.OrganizationRespVO;
import cn.iocoder.yudao.module.srbscribe.controller.admin.staff.vo.StaffPageReqVO;
import cn.iocoder.yudao.module.srbscribe.controller.admin.staff.vo.StaffRespVO;
import cn.iocoder.yudao.module.srbscribe.controller.admin.staff.vo.StaffSaveReqVO;
import cn.iocoder.yudao.module.srbscribe.dal.dataobject.organization.OrganizationDO;
import cn.iocoder.yudao.module.srbscribe.dal.dataobject.organization.OrganizationOptions;
import cn.iocoder.yudao.module.srbscribe.dal.dataobject.staff.StaffDO;
import cn.iocoder.yudao.module.srbscribe.service.organization.OrganizationService;
import cn.iocoder.yudao.module.srbscribe.service.staff.StaffService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.*;
import javax.servlet.http.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
@Tag(name = "管理后台 - 预约人员")
@RestController
@RequestMapping("/subscribe/staff")
@Validated
public class StaffController {
@Resource
private StaffService staffService;
@Resource
private OrganizationService organizationService;
@PostMapping("/create")
@Operation(summary = "创建预约人员")
@PreAuthorize("@ss.hasPermission('subscribe:staff:create')")
public CommonResult<Long> createStaff(@Valid @RequestBody StaffSaveReqVO createReqVO) {
return success(staffService.createStaff(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新预约人员")
@PreAuthorize("@ss.hasPermission('subscribe:staff:update')")
public CommonResult<Boolean> updateStaff(@Valid @RequestBody StaffSaveReqVO updateReqVO) {
staffService.updateStaff(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除预约人员")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('subscribe:staff:delete')")
public CommonResult<Boolean> deleteStaff(@RequestParam("id") Long id) {
staffService.deleteStaff(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得预约人员")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('subscribe:staff:query')")
public CommonResult<StaffRespVO> getStaff(@RequestParam("id") Long id) {
StaffDO staff = staffService.getStaff(id);
return success(BeanUtils.toBean(staff, StaffRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得预约人员分页")
@PreAuthorize("@ss.hasPermission('subscribe:staff:query')")
public CommonResult<PageResult<StaffRespVO>> getStaffPage(@Valid StaffPageReqVO pageReqVO) {
PageResult<StaffDO> pageResult = staffService.getStaffPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, StaffRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出预约人员 Excel")
@PreAuthorize("@ss.hasPermission('subscribe:staff:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportStaffExcel(@Valid StaffPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<StaffDO> list = staffService.getStaffPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "预约人员.xls", "数据", StaffRespVO.class,
BeanUtils.toBean(list, StaffRespVO.class));
}
}

View File

@ -0,0 +1,65 @@
package cn.iocoder.yudao.module.srbscribe.controller.admin.staff.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 StaffPageReqVO extends PageParam {
@Schema(description = "机构id", example = "26075")
private Long organizationId;
@Schema(description = "编号")
private String serialNumber;
@Schema(description = "类型", example = "1")
private Integer type;
@Schema(description = "名称", example = "张三")
private String name;
@Schema(description = "性别")
private Integer sex;
@Schema(description = "照片")
private String photo;
@Schema(description = "手机号")
private String phone;
@Schema(description = "服务时间段")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String[] serviceTime;
@Schema(description = "服务开始时间")
private String serviceStartTime;
@Schema(description = "服务结束时间")
private String serviceEndTime;
@Schema(description = "服务范围")
private String serviceScope;
@Schema(description = "约满标记")
private Integer sign;
@Schema(description = "状态", example = "2")
private Integer status;
@Schema(description = "介绍")
private String content;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,87 @@
package cn.iocoder.yudao.module.srbscribe.controller.admin.staff.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.*;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
@Schema(description = "管理后台 - 预约人员 Response VO")
@Data
@ExcelIgnoreUnannotated
public class StaffRespVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "21490")
@ExcelProperty("id")
private Long id;
@Schema(description = "机构id", example = "26075")
@ExcelProperty("机构id")
private Long organizationId;
@Schema(description = "编号")
@ExcelProperty("编号")
private String serialNumber;
@Schema(description = "类型", example = "1")
@ExcelProperty(value = "类型", converter = DictConvert.class)
@DictFormat("staff_type") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中
private Integer type;
@Schema(description = "名称", example = "张三")
@ExcelProperty("名称")
private String name;
@Schema(description = "性别")
@ExcelProperty(value = "性别", converter = DictConvert.class)
@DictFormat("stall_sex") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中
private Integer sex;
@Schema(description = "照片")
@ExcelProperty("照片")
private String photo;
@Schema(description = "手机号")
@ExcelProperty("手机号")
private String phone;
@Schema(description = "服务时间段")
@ExcelProperty("服务时间段")
private String serviceTime;
@Schema(description = "服务开始时间")
private String serviceStartTime;
@Schema(description = "服务结束时间")
private String serviceEndTime;
@Schema(description = "服务范围")
@ExcelProperty("服务范围")
private String serviceScope;
@Schema(description = "约满标记")
@ExcelProperty(value = "约满标记", converter = DictConvert.class)
@DictFormat("staff_full") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中
private Integer sign;
@Schema(description = "状态", example = "2")
@ExcelProperty(value = "状态", converter = DictConvert.class)
@DictFormat("staff_status") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中
private Integer status;
@Schema(description = "介绍")
@ExcelProperty("介绍")
private String content;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "所属机构")
@ExcelProperty("所属机构")
private String organizationName;
}

View File

@ -0,0 +1,57 @@
package cn.iocoder.yudao.module.srbscribe.controller.admin.staff.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 预约人员新增/修改 Request VO")
@Data
public class StaffSaveReqVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "21490")
private Long id;
@Schema(description = "机构id", example = "26075")
private Long organizationId;
@Schema(description = "编号")
private String serialNumber;
@Schema(description = "类型", example = "1")
private Integer type;
@Schema(description = "名称", example = "张三")
private String name;
@Schema(description = "性别")
private Integer sex;
@Schema(description = "照片")
private String photo;
@Schema(description = "手机号")
private String phone;
@Schema(description = "服务时间段")
private String serviceTime;
@Schema(description = "服务开始时间")
private String serviceStartTime;
@Schema(description = "服务结束时间")
private String serviceEndTime;
@Schema(description = "服务范围")
private String serviceScope;
@Schema(description = "约满标记")
private Integer sign;
@Schema(description = "状态", example = "2")
private Integer status;
@Schema(description = "介绍")
private String content;
}

View File

@ -0,0 +1,97 @@
package cn.iocoder.yudao.module.srbscribe.controller.admin.subscribemanage;
import cn.iocoder.yudao.module.srbscribe.controller.admin.subscribemanage.vo.SubscribeManagePageReqVO;
import cn.iocoder.yudao.module.srbscribe.controller.admin.subscribemanage.vo.SubscribeManageRespVO;
import cn.iocoder.yudao.module.srbscribe.controller.admin.subscribemanage.vo.SubscribeManageSaveReqVO;
import cn.iocoder.yudao.module.srbscribe.dal.dataobject.subscribemanage.SubscribeManageDO;
import cn.iocoder.yudao.module.srbscribe.service.subscribemanage.SubscribeManageService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.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.*;
@Tag(name = "管理后台 - 预约")
@RestController
@RequestMapping("/subscribe/manage")
@Validated
public class SubscribeManageController {
@Resource
private SubscribeManageService manageService;
@PostMapping("/create")
@Operation(summary = "创建预约")
@PreAuthorize("@ss.hasPermission('subscribe:manage:create')")
public CommonResult<Long> createManage(@Valid @RequestBody SubscribeManageSaveReqVO createReqVO) {
return success(manageService.createManage(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新预约")
@PreAuthorize("@ss.hasPermission('subscribe:manage:update')")
public CommonResult<Boolean> updateManage(@Valid @RequestBody SubscribeManageSaveReqVO updateReqVO) {
manageService.updateManage(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除预约")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('subscribe:manage:delete')")
public CommonResult<Boolean> deleteManage(@RequestParam("id") Long id) {
manageService.deleteManage(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得预约")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('subscribe:manage:query')")
public CommonResult<SubscribeManageRespVO> getManage(@RequestParam("id") Long id) {
SubscribeManageDO manage = manageService.getManage(id);
return success(BeanUtils.toBean(manage, SubscribeManageRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得预约分页")
@PreAuthorize("@ss.hasPermission('subscribe:manage:query')")
public CommonResult<PageResult<SubscribeManageRespVO>> getManagePage(@Valid SubscribeManagePageReqVO pageReqVO) {
PageResult<SubscribeManageDO> pageResult = manageService.getManagePage(pageReqVO);
return success(BeanUtils.toBean(pageResult, SubscribeManageRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出预约 Excel")
@PreAuthorize("@ss.hasPermission('subscribe:manage:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportManageExcel(@Valid SubscribeManagePageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<SubscribeManageDO> list = manageService.getManagePage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "预约.xls", "数据", SubscribeManageRespVO.class,
BeanUtils.toBean(list, SubscribeManageRespVO.class));
}
}

View File

@ -0,0 +1,43 @@
package cn.iocoder.yudao.module.srbscribe.controller.admin.subscribemanage.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 SubscribeManagePageReqVO extends PageParam {
@Schema(description = "用户id", example = "20637")
private Long userId;
@Schema(description = "预约类型", example = "2")
private Integer type;
@Schema(description = "预约人员id", example = "23520")
private Long staffId;
@Schema(description = "预约时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] subscribeTime;
@Schema(description = "预约状态", example = "1")
private String subscribeStatus;
@Schema(description = "审核状态", example = "1")
private Integer checkStatus;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
private String staffName;
}

View File

@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.srbscribe.controller.admin.subscribemanage.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.*;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
@Schema(description = "管理后台 - 预约 Response VO")
@Data
@ExcelIgnoreUnannotated
public class SubscribeManageRespVO {
@Schema(description = "表id", requiredMode = Schema.RequiredMode.REQUIRED, example = "20273")
@ExcelProperty("表id")
private Long id;
@Schema(description = "用户id", example = "20637")
@ExcelProperty("用户id")
private Long userId;
@Schema(description = "预约类型", example = "2")
@ExcelProperty(value = "预约类型", converter = DictConvert.class)
@DictFormat("subscribe_type") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中
private Integer type;
@Schema(description = "预约人员id", example = "23520")
@ExcelProperty("预约人员id")
private Long staffId;
@Schema(description = "预约时间")
@ExcelProperty("预约时间")
private LocalDateTime subscribeTime;
@Schema(description = "预约状态", example = "1")
@ExcelProperty("预约状态")
private String subscribeStatus;
@Schema(description = "审核状态", example = "1")
@ExcelProperty(value = "审核状态", converter = DictConvert.class)
@DictFormat("subscribe_check_status") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中
private Integer checkStatus;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "预约人员")
@ExcelProperty("预约人员")
private String staffName;
}

View File

@ -0,0 +1,35 @@
package cn.iocoder.yudao.module.srbscribe.controller.admin.subscribemanage.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 预约新增/修改 Request VO")
@Data
public class SubscribeManageSaveReqVO {
@Schema(description = "表id", requiredMode = Schema.RequiredMode.REQUIRED, example = "20273")
private Long id;
@Schema(description = "用户id", example = "20637")
private Long userId;
@Schema(description = "预约类型", example = "2")
private Integer type;
@Schema(description = "预约人员id", example = "23520")
private Long staffId;
@Schema(description = "预约时间")
private LocalDateTime subscribeTime;
@Schema(description = "预约状态", example = "1")
private String subscribeStatus;
@Schema(description = "审核状态", example = "1")
private Integer checkStatus;
}

View File

@ -0,0 +1,61 @@
package cn.iocoder.yudao.module.srbscribe.dal.dataobject.organization;
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("subscribe_organization")
@KeySequence("subscribe_organization_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class OrganizationDO extends BaseDO {
/**
* 机构id
*/
@TableId
private Integer id;
/**
* 机构名称
*/
private String name;
/**
* 机构电话
*/
private String phone;
/**
* 机构邮箱
*/
private String email;
/**
* 机构图片
*/
private String picture;
/**
* 机构地址
*/
private String address;
/**
* 机构简介
*/
private String depict;
/**
* 状态
*
* 枚举 {@link TODO organization_status 对应的类}
*/
private Integer status;
}

View File

@ -0,0 +1,11 @@
package cn.iocoder.yudao.module.srbscribe.dal.dataobject.organization;
import lombok.Data;
@Data
public class OrganizationOptions {
private String value;
private String label;
}

View File

@ -0,0 +1,100 @@
package cn.iocoder.yudao.module.srbscribe.dal.dataobject.staff;
import io.swagger.v3.oas.annotations.media.Schema;
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("subscribe_staff")
@KeySequence("subscribe_staff_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class StaffDO extends BaseDO {
/**
* id
*/
@TableId
private Long id;
/**
* 机构id
*/
private Long organizationId;
/**
* 编号
*/
private String serialNumber;
/**
* 类型
*
* 枚举 {@link TODO staff_type 对应的类}
*/
private Integer type;
/**
* 名称
*/
private String name;
/**
* 性别
*
* 枚举 {@link TODO stall_sex 对应的类}
*/
private Integer sex;
/**
* 照片
*/
private String photo;
/**
* 手机号
*/
private String phone;
/**
* 服务时间段
*/
private String serviceTime;
/**
* 服务开始时间
*/
private String serviceStartTime;
/**
* 服务结束时间
*/
private String serviceEndTime;
/**
* 服务范围
*/
private String serviceScope;
/**
* 约满标记
*
* 枚举 {@link TODO staff_full 对应的类}
*/
private Integer sign;
/**
* 状态
*
* 枚举 {@link TODO staff_status 对应的类}
*/
private Integer status;
/**
* 介绍
*/
private String content;
//机构名称
@TableField(exist = false)
private String organizationName;
}

View File

@ -0,0 +1,65 @@
package cn.iocoder.yudao.module.srbscribe.dal.dataobject.subscribemanage;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 预约 DO
*
* @author 管理员
*/
@TableName("subscribe_subscribe_manage")
@KeySequence("subscribe_subscribe_manage_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SubscribeManageDO extends BaseDO {
/**
* 表id
*/
@TableId
private Long id;
/**
* 用户id
*/
private Long userId;
/**
* 预约类型
*
* 枚举 {@link TODO subscribe_type 对应的类}
*/
private Integer type;
/**
* 预约人员id
*/
private Long staffId;
/**
* 预约时间
*/
private LocalDateTime subscribeTime;
/**
* 预约状态
*/
private String subscribeStatus;
/**
* 审核状态
*
* 枚举 {@link TODO subscribe_check_status 对应的类}
*/
private Integer checkStatus;
//预约人员名称
@TableField(exist=false)
private String staffName;
}

View File

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.srbscribe.dal.mysql.organization;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.srbscribe.controller.admin.organization.vo.OrganizationPageReqVO;
import cn.iocoder.yudao.module.srbscribe.dal.dataobject.organization.OrganizationDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 机构 Mapper
*
* @author 管理员
*/
@Mapper
public interface OrganizationMapper extends BaseMapperX<OrganizationDO> {
default PageResult<OrganizationDO> selectPage(OrganizationPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<OrganizationDO>()
.likeIfPresent(OrganizationDO::getName, reqVO.getName())
.eqIfPresent(OrganizationDO::getPhone, reqVO.getPhone())
.eqIfPresent(OrganizationDO::getEmail, reqVO.getEmail())
.eqIfPresent(OrganizationDO::getPicture, reqVO.getPicture())
.eqIfPresent(OrganizationDO::getAddress, reqVO.getAddress())
.eqIfPresent(OrganizationDO::getDepict, reqVO.getDepict())
.eqIfPresent(OrganizationDO::getStatus, reqVO.getStatus())
.betweenIfPresent(OrganizationDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(OrganizationDO::getId));
}
}

View File

@ -0,0 +1,36 @@
package cn.iocoder.yudao.module.srbscribe.dal.mysql.staff;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.srbscribe.controller.admin.staff.vo.StaffPageReqVO;
import cn.iocoder.yudao.module.srbscribe.dal.dataobject.staff.StaffDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 预约人员 Mapper
*
* @author 管理员
*/
@Mapper
public interface StaffMapper extends BaseMapperX<StaffDO> {
default PageResult<StaffDO> selectPage(StaffPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<StaffDO>()
.eqIfPresent(StaffDO::getOrganizationId, reqVO.getOrganizationId())
.eqIfPresent(StaffDO::getSerialNumber, reqVO.getSerialNumber())
.eqIfPresent(StaffDO::getType, reqVO.getType())
.likeIfPresent(StaffDO::getName, reqVO.getName())
.eqIfPresent(StaffDO::getSex, reqVO.getSex())
.eqIfPresent(StaffDO::getPhoto, reqVO.getPhoto())
.eqIfPresent(StaffDO::getPhone, reqVO.getPhone())
.betweenIfPresent(StaffDO::getServiceTime, reqVO.getServiceTime())
.eqIfPresent(StaffDO::getServiceScope, reqVO.getServiceScope())
.eqIfPresent(StaffDO::getSign, reqVO.getSign())
.eqIfPresent(StaffDO::getStatus, reqVO.getStatus())
.eqIfPresent(StaffDO::getContent, reqVO.getContent())
.betweenIfPresent(StaffDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(StaffDO::getId));
}
}

View File

@ -0,0 +1,31 @@
package cn.iocoder.yudao.module.srbscribe.dal.mysql.subscribemanage;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.srbscribe.controller.admin.subscribemanage.vo.SubscribeManagePageReqVO;
import cn.iocoder.yudao.module.srbscribe.dal.dataobject.subscribemanage.SubscribeManageDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 预约 Mapper
*
* @author 管理员
*/
@Mapper
public interface SubscribeManageMapper extends BaseMapperX<SubscribeManageDO> {
default PageResult<SubscribeManageDO> selectPage(SubscribeManagePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<SubscribeManageDO>()
.eqIfPresent(SubscribeManageDO::getUserId, reqVO.getUserId())
.eqIfPresent(SubscribeManageDO::getType, reqVO.getType())
.eqIfPresent(SubscribeManageDO::getStaffId, reqVO.getStaffId())
.betweenIfPresent(SubscribeManageDO::getSubscribeTime, reqVO.getSubscribeTime())
.eqIfPresent(SubscribeManageDO::getSubscribeStatus, reqVO.getSubscribeStatus())
.eqIfPresent(SubscribeManageDO::getCheckStatus, reqVO.getCheckStatus())
.betweenIfPresent(SubscribeManageDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(SubscribeManageDO::getId));
}
}

View File

@ -0,0 +1,61 @@
package cn.iocoder.yudao.module.srbscribe.service.organization;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.srbscribe.controller.admin.organization.vo.OrganizationPageReqVO;
import cn.iocoder.yudao.module.srbscribe.controller.admin.organization.vo.OrganizationSaveReqVO;
import cn.iocoder.yudao.module.srbscribe.dal.dataobject.organization.OrganizationDO;
import javax.validation.*;
import java.util.List;
/**
* 机构 Service 接口
*
* @author 管理员
*/
public interface OrganizationService {
/**
* 创建机构
*
* @param createReqVO 创建信息
* @return 编号
*/
Integer createOrganization(@Valid OrganizationSaveReqVO createReqVO);
/**
* 更新机构
*
* @param updateReqVO 更新信息
*/
void updateOrganization(@Valid OrganizationSaveReqVO updateReqVO);
/**
* 删除机构
*
* @param id 编号
*/
void deleteOrganization(Integer id);
/**
* 获得机构
*
* @param id 编号
* @return 机构
*/
OrganizationDO getOrganization(Integer id);
/**
* 获得机构分页
*
* @param pageReqVO 分页查询
* @return 机构分页
*/
PageResult<OrganizationDO> getOrganizationPage(OrganizationPageReqVO pageReqVO);
/**
* 获取机构所有数据
*/
List<OrganizationDO> getOrganization();
}

View File

@ -0,0 +1,77 @@
package cn.iocoder.yudao.module.srbscribe.service.organization;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.srbscribe.controller.admin.organization.vo.OrganizationPageReqVO;
import cn.iocoder.yudao.module.srbscribe.controller.admin.organization.vo.OrganizationSaveReqVO;
import cn.iocoder.yudao.module.srbscribe.dal.dataobject.organization.OrganizationDO;
import cn.iocoder.yudao.module.srbscribe.dal.mysql.organization.OrganizationMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.subscribe.enums.ErrorCodeConstants.*;
/**
* 机构 Service 实现类
*
* @author 管理员
*/
@Service
@Validated
public class OrganizationServiceImpl implements OrganizationService {
@Resource
private OrganizationMapper organizationMapper;
@Override
public Integer createOrganization(OrganizationSaveReqVO createReqVO) {
// 插入
OrganizationDO organization = BeanUtils.toBean(createReqVO, OrganizationDO.class);
organizationMapper.insert(organization);
// 返回
return organization.getId();
}
@Override
public void updateOrganization(OrganizationSaveReqVO updateReqVO) {
// 校验存在
validateOrganizationExists(updateReqVO.getId());
// 更新
OrganizationDO updateObj = BeanUtils.toBean(updateReqVO, OrganizationDO.class);
organizationMapper.updateById(updateObj);
}
@Override
public void deleteOrganization(Integer id) {
// 校验存在
validateOrganizationExists(id);
// 删除
organizationMapper.deleteById(id);
}
private void validateOrganizationExists(Integer id) {
if (organizationMapper.selectById(id) == null) {
throw exception(ORGANIZATION_NOT_EXISTS);
}
}
@Override
public OrganizationDO getOrganization(Integer id) {
return organizationMapper.selectById(id);
}
@Override
public PageResult<OrganizationDO> getOrganizationPage(OrganizationPageReqVO pageReqVO) {
return organizationMapper.selectPage(pageReqVO);
}
@Override
public List<OrganizationDO> getOrganization() {
return organizationMapper.selectList();
}
}

View File

@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.srbscribe.service.staff;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.srbscribe.controller.admin.staff.vo.StaffPageReqVO;
import cn.iocoder.yudao.module.srbscribe.controller.admin.staff.vo.StaffSaveReqVO;
import cn.iocoder.yudao.module.srbscribe.dal.dataobject.staff.StaffDO;
import javax.validation.*;
/**
* 预约人员 Service 接口
*
* @author 管理员
*/
public interface StaffService {
/**
* 创建预约人员
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createStaff(@Valid StaffSaveReqVO createReqVO);
/**
* 更新预约人员
*
* @param updateReqVO 更新信息
*/
void updateStaff(@Valid StaffSaveReqVO updateReqVO);
/**
* 删除预约人员
*
* @param id 编号
*/
void deleteStaff(Long id);
/**
* 获得预约人员
*
* @param id 编号
* @return 预约人员
*/
StaffDO getStaff(Long id);
/**
* 获得预约人员分页
*
* @param pageReqVO 分页查询
* @return 预约人员分页
*/
PageResult<StaffDO> getStaffPage(StaffPageReqVO pageReqVO);
}

View File

@ -0,0 +1,80 @@
package cn.iocoder.yudao.module.srbscribe.service.staff;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.srbscribe.controller.admin.staff.vo.StaffPageReqVO;
import cn.iocoder.yudao.module.srbscribe.controller.admin.staff.vo.StaffSaveReqVO;
import cn.iocoder.yudao.module.srbscribe.dal.dataobject.organization.OrganizationDO;
import cn.iocoder.yudao.module.srbscribe.dal.dataobject.staff.StaffDO;
import cn.iocoder.yudao.module.srbscribe.dal.mysql.organization.OrganizationMapper;
import cn.iocoder.yudao.module.srbscribe.dal.mysql.staff.StaffMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.subscribe.enums.ErrorCodeConstants.*;
/**
* 预约人员 Service 实现类
*
* @author 管理员
*/
@Service
@Validated
public class StaffServiceImpl implements StaffService {
@Resource
private StaffMapper staffMapper;
@Resource
private OrganizationMapper organizationMapper;
@Override
public Long createStaff(StaffSaveReqVO createReqVO) {
// 插入
StaffDO staff = BeanUtils.toBean(createReqVO, StaffDO.class);
staffMapper.insert(staff);
// 返回
return staff.getId();
}
@Override
public void updateStaff(StaffSaveReqVO updateReqVO) {
// 校验存在
validateStaffExists(updateReqVO.getId());
// 更新
StaffDO updateObj = BeanUtils.toBean(updateReqVO, StaffDO.class);
staffMapper.updateById(updateObj);
}
@Override
public void deleteStaff(Long id) {
// 校验存在
validateStaffExists(id);
// 删除
staffMapper.deleteById(id);
}
private void validateStaffExists(Long id) {
if (staffMapper.selectById(id) == null) {
throw exception(STAFF_NOT_EXISTS);
}
}
@Override
public StaffDO getStaff(Long id) {
return staffMapper.selectById(id);
}
@Override
public PageResult<StaffDO> getStaffPage(StaffPageReqVO pageReqVO) {
PageResult<StaffDO> staffDOPageResult = staffMapper.selectPage(pageReqVO);
for (int i = 0; i < staffDOPageResult.getList().size(); i++) {
StaffDO staffDO = staffDOPageResult.getList().get(i);
OrganizationDO organizationDO = organizationMapper.selectOne("id", staffDO.getOrganizationId());
staffDO.setOrganizationName(organizationDO.getName());
}
return staffDOPageResult;
}
}

View File

@ -0,0 +1,57 @@
package cn.iocoder.yudao.module.srbscribe.service.subscribemanage;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.srbscribe.controller.admin.subscribemanage.vo.SubscribeManagePageReqVO;
import cn.iocoder.yudao.module.srbscribe.controller.admin.subscribemanage.vo.SubscribeManageSaveReqVO;
import cn.iocoder.yudao.module.srbscribe.dal.dataobject.subscribemanage.SubscribeManageDO;
import java.util.*;
import javax.validation.*;
/**
* 预约 Service 接口
*
* @author 管理员
*/
public interface SubscribeManageService {
/**
* 创建预约
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createManage(@Valid SubscribeManageSaveReqVO createReqVO);
/**
* 更新预约
*
* @param updateReqVO 更新信息
*/
void updateManage(@Valid SubscribeManageSaveReqVO updateReqVO);
/**
* 删除预约
*
* @param id 编号
*/
void deleteManage(Long id);
/**
* 获得预约
*
* @param id 编号
* @return 预约
*/
SubscribeManageDO getManage(Long id);
/**
* 获得预约分页
*
* @param pageReqVO 分页查询
* @return 预约分页
*/
PageResult<SubscribeManageDO> getManagePage(SubscribeManagePageReqVO pageReqVO);
}

View File

@ -0,0 +1,87 @@
package cn.iocoder.yudao.module.srbscribe.service.subscribemanage;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.srbscribe.controller.admin.subscribemanage.vo.SubscribeManagePageReqVO;
import cn.iocoder.yudao.module.srbscribe.controller.admin.subscribemanage.vo.SubscribeManageSaveReqVO;
import cn.iocoder.yudao.module.srbscribe.dal.dataobject.staff.StaffDO;
import cn.iocoder.yudao.module.srbscribe.dal.dataobject.subscribemanage.SubscribeManageDO;
import cn.iocoder.yudao.module.srbscribe.dal.mysql.staff.StaffMapper;
import cn.iocoder.yudao.module.srbscribe.dal.mysql.subscribemanage.SubscribeManageMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.subscribe.enums.ErrorCodeConstants.*;
/**
* 预约 Service 实现类
*
* @author 管理员
*/
@Service
@Validated
public class SubscribeManageServiceImpl implements SubscribeManageService {
@Resource
private SubscribeManageMapper manageMapper;
@Resource
private StaffMapper staffMapper;
@Override
public Long createManage(SubscribeManageSaveReqVO createReqVO) {
// 插入
SubscribeManageDO manage = BeanUtils.toBean(createReqVO, SubscribeManageDO.class);
manageMapper.insert(manage);
// 返回
return manage.getId();
}
@Override
public void updateManage(SubscribeManageSaveReqVO updateReqVO) {
// 校验存在
validateManageExists(updateReqVO.getId());
// 更新
SubscribeManageDO updateObj = BeanUtils.toBean(updateReqVO, SubscribeManageDO.class);
manageMapper.updateById(updateObj);
}
@Override
public void deleteManage(Long id) {
// 校验存在
validateManageExists(id);
// 删除
manageMapper.deleteById(id);
}
private void validateManageExists(Long id) {
if (manageMapper.selectById(id) == null) {
throw exception(MANAGE_NOT_EXISTS);
}
}
@Override
public SubscribeManageDO getManage(Long id) {
return manageMapper.selectById(id);
}
@Override
public PageResult<SubscribeManageDO> getManagePage(SubscribeManagePageReqVO pageReqVO) {
if (pageReqVO.getStaffName() != null){
StaffDO staffDO = staffMapper.selectOne("name", pageReqVO.getStaffName());
pageReqVO.setStaffId(staffDO.getId());
}
PageResult<SubscribeManageDO> subscribeManageDOPageResult = manageMapper.selectPage(pageReqVO);
for (int i = 0; i < subscribeManageDOPageResult.getList().size(); i++) {
SubscribeManageDO subscribeManageDO = subscribeManageDOPageResult.getList().get(i);
StaffDO staffDO = staffMapper.selectOne("id", subscribeManageDO.getStaffId());
subscribeManageDO.setStaffName(staffDO.getName());//设置预约人员名称
}
return subscribeManageDOPageResult;
}
}

View File

@ -0,0 +1,3 @@
DELETE FROM "subscribe_subscribe_manage";
DELETE FROM "subscribe_organization";
DELETE FROM "subscribe_staff";

View File

@ -0,0 +1,57 @@
CREATE TABLE IF NOT EXISTS "subscribe_subscribe_manage" (
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"user_id" bigint,
"type" int,
"staff_id" bigint,
"subscribe_time" varchar,
"subscribe_status" varchar,
"check_status" int,
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"creator" varchar DEFAULT '',
"updater" varchar DEFAULT '',
"deleted" bit NOT NULL DEFAULT FALSE,
"tenant_id" bigint,
PRIMARY KEY ("id")
) COMMENT '预约表';
CREATE TABLE IF NOT EXISTS "subscribe_organization" (
"id" int NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"name" varchar,
"phone" varchar,
"email" varchar,
"picture" varchar,
"address" varchar,
"depict" varchar,
"status" int,
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"creator" varchar DEFAULT '',
"updater" varchar DEFAULT '',
"deleted" bit NOT NULL DEFAULT FALSE,
"tenant_id" bigint,
PRIMARY KEY ("id")
) COMMENT '机构';
CREATE TABLE IF NOT EXISTS "subscribe_staff" (
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"organization_id" bigint,
"serial_number" varchar,
"type" int,
"name" varchar,
"sex" int,
"photo" varchar,
"phone" varchar,
"service_time" varchar,
"service_scope" varchar,
"sign" int,
"status" int,
"content" varchar,
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"creator" varchar DEFAULT '',
"updater" varchar DEFAULT '',
"deleted" bit NOT NULL DEFAULT FALSE,
"tenant_id" bigint,
PRIMARY KEY ("id")
) COMMENT '预约人员';

View File

@ -65,6 +65,12 @@
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-subscribe-biz</artifactId>
<version>${revision}</version>
</dependency>
<!-- 商城相关模块。默认注释,保证编译速度-->
<dependency>
<groupId>cn.iocoder.boot</groupId>