From 289a8835cfe4a21de683555e09bf447b006dddff Mon Sep 17 00:00:00 2001 From: sonjinyon <2476687577@qq.com> Date: Mon, 9 Sep 2024 13:22:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A2=84=E7=BA=A6=E6=A8=A1?= =?UTF-8?q?=E5=9D=97bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/subscribe/staff/index.ts | 3 +- yudao-admin-vue3/src/utils/dict.ts | 16 + .../organization/OrganizationForm.vue | 9 +- .../views/subscribe/organization/index.vue | 2 +- .../src/views/subscribe/staff/StaffForm.vue | 499 ++++++++++-------- .../src/views/subscribe/staff/index.vue | 16 +- .../subscribe/subscribemanage/ManageForm.vue | 40 +- .../views/subscribe/subscribemanage/index.vue | 19 +- .../admin/staff/vo/ServiceTimeVO.java | 9 + .../admin/staff/vo/StaffPageReqVO.java | 11 +- .../admin/staff/vo/StaffRespVO.java | 9 +- .../admin/staff/vo/StaffSaveReqVO.java | 6 - .../vo/SubscribeManageRespVO.java | 13 +- .../dal/dataobject/staff/StaffDO.java | 12 +- .../organization/OrganizationMapper.java | 4 +- .../dal/mysql/staff/StaffMapper.java | 2 +- .../service/staff/StaffServiceImpl.java | 21 + 17 files changed, 408 insertions(+), 283 deletions(-) create mode 100644 yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/controller/admin/staff/vo/ServiceTimeVO.java diff --git a/yudao-admin-vue3/src/api/subscribe/staff/index.ts b/yudao-admin-vue3/src/api/subscribe/staff/index.ts index edb03b0..832681e 100644 --- a/yudao-admin-vue3/src/api/subscribe/staff/index.ts +++ b/yudao-admin-vue3/src/api/subscribe/staff/index.ts @@ -12,12 +12,11 @@ export interface StaffVO { photo: string // 照片 phone: string // 手机号 serviceTime: string // 服务时间段 - serviceStartTime: string - serviceEndTime: string serviceScope: string // 服务范围 sign: number // 约满标记 status: number // 状态 content: string // 介绍 + serviceTimeArray: string } // 预约人员 API diff --git a/yudao-admin-vue3/src/utils/dict.ts b/yudao-admin-vue3/src/utils/dict.ts index 100c1d1..7d71430 100644 --- a/yudao-admin-vue3/src/utils/dict.ts +++ b/yudao-admin-vue3/src/utils/dict.ts @@ -108,10 +108,26 @@ export const getDictLabel = (dictType: string, value: any): string => { } export enum DICT_TYPE { + USER_TYPE = 'user_type', COMMON_STATUS = 'common_status', TERMINAL = 'terminal', // 终端 DATE_INTERVAL = 'date_interval', // 数据间隔 + + //预约:人员管理 + STALL_SEX = 'stall_sex', + STAFF_STATUS = 'staff_status', + STAFF_FULL = 'staff_full', + STAFF_TYPE = 'staff_type', + + //预约:预约管理 + SUBSCRIBE_TYPE = 'subscribe_type', + SUBSCRIBE_CHECK_STATUS = 'subscribe_check_status', + SUBSCRIBE_STATUS = 'subscribe_status', + + //预约:机构管理 + ORGANIZATION_STATUS = 'organization_status', + // ========== SYSTEM 模块 ========== SYSTEM_USER_SEX = 'system_user_sex', diff --git a/yudao-admin-vue3/src/views/subscribe/organization/OrganizationForm.vue b/yudao-admin-vue3/src/views/subscribe/organization/OrganizationForm.vue index b37de29..6c7d632 100644 --- a/yudao-admin-vue3/src/views/subscribe/organization/OrganizationForm.vue +++ b/yudao-admin-vue3/src/views/subscribe/organization/OrganizationForm.vue @@ -1,5 +1,5 @@ + + \ No newline at end of file diff --git a/yudao-admin-vue3/src/views/subscribe/staff/index.vue b/yudao-admin-vue3/src/views/subscribe/staff/index.vue index 8df95db..3685e78 100644 --- a/yudao-admin-vue3/src/views/subscribe/staff/index.vue +++ b/yudao-admin-vue3/src/views/subscribe/staff/index.vue @@ -80,7 +80,7 @@ class="!w-240px" /> - + - - + + - + + + + + + + + @@ -31,11 +37,21 @@ placeholder="选择预约时间" /> - + + + + + + import { getIntDictOptions, DICT_TYPE } from '@/utils/dict' import { ManageApi, ManageVO } from '@/api/subscribe/subscribemanage' +import { OrganizationApi, OrganizationVO } from '@/api/subscribe/organization' /** 预约 表单 */ defineOptions({ name: 'ManageForm' }) @@ -65,6 +82,7 @@ const message = useMessage() // 消息弹窗 const dialogVisible = ref(false) // 弹窗的是否展示 const dialogTitle = ref('') // 弹窗的标题 +const option = ref([]); const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 const formType = ref('') // 表单的类型:create - 新增;update - 修改 const formData = ref({ @@ -77,9 +95,23 @@ const formData = ref({ checkStatus: undefined, }) const formRules = reactive({ + userId: [{ required: true, message: '用户不能为空', trigger: 'blur' }], + type: [{ required: true, message: '预约类型不能为空', trigger: 'blur' }], + staffId: [{ required: true, message: '预约人员不能为空', trigger: 'blur' }], + subscribeTime: [{ required: true, message: '预约时间不能为空', trigger: 'blur' }], + subscribeStatus: [{ required: true, message: '预约状态不能为空', trigger: 'blur' }], }) const formRef = ref() // 表单 Ref +//初始化机构名称下拉框 + const getOrganizations = async () => { + try { + option.value = await OrganizationApi.getOrganizations() + } finally { + + } + } + /** 打开弹窗 */ const open = async (type: string, id?: number) => { dialogVisible.value = true @@ -122,6 +154,10 @@ const submitForm = async () => { } } +/** 初始化 **/ + onMounted(() => { + getOrganizations() + }) /** 重置表单 */ const resetForm = () => { formData.value = { diff --git a/yudao-admin-vue3/src/views/subscribe/subscribemanage/index.vue b/yudao-admin-vue3/src/views/subscribe/subscribemanage/index.vue index cdb6ce8..4a1edbc 100644 --- a/yudao-admin-vue3/src/views/subscribe/subscribemanage/index.vue +++ b/yudao-admin-vue3/src/views/subscribe/subscribemanage/index.vue @@ -8,7 +8,7 @@ :inline="true" label-width="100px" > - + - + + - + diff --git a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/controller/admin/staff/vo/ServiceTimeVO.java b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/controller/admin/staff/vo/ServiceTimeVO.java new file mode 100644 index 0000000..a8ab595 --- /dev/null +++ b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/controller/admin/staff/vo/ServiceTimeVO.java @@ -0,0 +1,9 @@ +package cn.iocoder.yudao.module.srbscribe.controller.admin.staff.vo; + +import lombok.Data; + +@Data +public class ServiceTimeVO { + private String start; + private String end; +} diff --git a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/controller/admin/staff/vo/StaffPageReqVO.java b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/controller/admin/staff/vo/StaffPageReqVO.java index fa6834a..8e6ecdb 100644 --- a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/controller/admin/staff/vo/StaffPageReqVO.java +++ b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/controller/admin/staff/vo/StaffPageReqVO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.srbscribe.controller.admin.staff.vo; +import com.baomidou.mybatisplus.annotation.TableField; import lombok.*; import java.util.*; import io.swagger.v3.oas.annotations.media.Schema; @@ -37,14 +38,12 @@ public class StaffPageReqVO extends PageParam { private String phone; @Schema(description = "服务时间段") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private String[] serviceTime; + private String serviceTime; + +// @Schema(description = "服务开始时间") +// private String serviceStartTime; - @Schema(description = "服务开始时间") - private String serviceStartTime; - @Schema(description = "服务结束时间") - private String serviceEndTime; @Schema(description = "服务范围") private String serviceScope; diff --git a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/controller/admin/staff/vo/StaffRespVO.java b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/controller/admin/staff/vo/StaffRespVO.java index 392830f..20d207e 100644 --- a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/controller/admin/staff/vo/StaffRespVO.java +++ b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/controller/admin/staff/vo/StaffRespVO.java @@ -52,11 +52,10 @@ public class StaffRespVO { @ExcelProperty("服务时间段") private String serviceTime; - @Schema(description = "服务开始时间") - private String serviceStartTime; - - @Schema(description = "服务结束时间") - private String serviceEndTime; +// @Schema(description = "服务开始时间") +// private String serviceStartTime; +// + private String serviceTimeArray; @Schema(description = "服务范围") @ExcelProperty("服务范围") diff --git a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/controller/admin/staff/vo/StaffSaveReqVO.java b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/controller/admin/staff/vo/StaffSaveReqVO.java index 4aa2824..d065bcd 100644 --- a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/controller/admin/staff/vo/StaffSaveReqVO.java +++ b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/controller/admin/staff/vo/StaffSaveReqVO.java @@ -36,12 +36,6 @@ public class StaffSaveReqVO { @Schema(description = "服务时间段") private String serviceTime; - @Schema(description = "服务开始时间") - private String serviceStartTime; - - @Schema(description = "服务结束时间") - private String serviceEndTime; - @Schema(description = "服务范围") private String serviceScope; diff --git a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/controller/admin/subscribemanage/vo/SubscribeManageRespVO.java b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/controller/admin/subscribemanage/vo/SubscribeManageRespVO.java index b8d9600..1a17b79 100644 --- a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/controller/admin/subscribemanage/vo/SubscribeManageRespVO.java +++ b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/controller/admin/subscribemanage/vo/SubscribeManageRespVO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.srbscribe.controller.admin.subscribemanage.vo; +import com.baomidou.mybatisplus.annotation.TableField; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import java.util.*; @@ -22,6 +23,10 @@ public class SubscribeManageRespVO { @ExcelProperty("用户id") private Long userId; + @Schema(description = "用户姓名") + @ExcelProperty("用户姓名") + private String userName; + @Schema(description = "预约类型", example = "2") @ExcelProperty(value = "预约类型", converter = DictConvert.class) @DictFormat("subscribe_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 @@ -31,6 +36,10 @@ public class SubscribeManageRespVO { @ExcelProperty("预约人员id") private Long staffId; + @Schema(description = "预约人员") + @ExcelProperty("预约人员") + private String staffName; + @Schema(description = "预约时间") @ExcelProperty("预约时间") private LocalDateTime subscribeTime; @@ -48,8 +57,6 @@ public class SubscribeManageRespVO { @ExcelProperty("创建时间") private LocalDateTime createTime; - @Schema(description = "预约人员") - @ExcelProperty("预约人员") - private String staffName; + } \ No newline at end of file diff --git a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/dal/dataobject/staff/StaffDO.java b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/dal/dataobject/staff/StaffDO.java index 7491802..49d9a19 100644 --- a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/dal/dataobject/staff/StaffDO.java +++ b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/dal/dataobject/staff/StaffDO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.srbscribe.dal.dataobject.staff; +import cn.iocoder.yudao.module.srbscribe.controller.admin.staff.vo.ServiceTimeVO; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import java.util.*; @@ -64,14 +65,6 @@ public class StaffDO extends BaseDO { * 服务时间段 */ private String serviceTime; - /** - * 服务开始时间 - */ - private String serviceStartTime; - /** - * 服务结束时间 - */ - private String serviceEndTime; /** * 服务范围 */ @@ -97,4 +90,7 @@ public class StaffDO extends BaseDO { @TableField(exist = false) private String organizationName; + @TableField(exist = false) + private String serviceTimeArray ; + } \ No newline at end of file diff --git a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/dal/mysql/organization/OrganizationMapper.java b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/dal/mysql/organization/OrganizationMapper.java index 33fd1cd..ed350b0 100644 --- a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/dal/mysql/organization/OrganizationMapper.java +++ b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/dal/mysql/organization/OrganizationMapper.java @@ -23,9 +23,7 @@ public interface OrganizationMapper extends BaseMapperX { .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()) + .likeIfPresent(OrganizationDO::getAddress, reqVO.getAddress()) .eqIfPresent(OrganizationDO::getStatus, reqVO.getStatus()) .betweenIfPresent(OrganizationDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(OrganizationDO::getId)); diff --git a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/dal/mysql/staff/StaffMapper.java b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/dal/mysql/staff/StaffMapper.java index 4015ea9..5409ebd 100644 --- a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/dal/mysql/staff/StaffMapper.java +++ b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/dal/mysql/staff/StaffMapper.java @@ -24,7 +24,7 @@ public interface StaffMapper extends BaseMapperX { .eqIfPresent(StaffDO::getSex, reqVO.getSex()) .eqIfPresent(StaffDO::getPhoto, reqVO.getPhoto()) .eqIfPresent(StaffDO::getPhone, reqVO.getPhone()) - .betweenIfPresent(StaffDO::getServiceTime, reqVO.getServiceTime()) +// .betweenIfPresent(StaffDO::getServiceTime, reqVO.getServiceTime()) .eqIfPresent(StaffDO::getServiceScope, reqVO.getServiceScope()) .eqIfPresent(StaffDO::getSign, reqVO.getSign()) .eqIfPresent(StaffDO::getStatus, reqVO.getStatus()) diff --git a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/service/staff/StaffServiceImpl.java b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/service/staff/StaffServiceImpl.java index 4498da7..bbfb91c 100644 --- a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/service/staff/StaffServiceImpl.java +++ b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/service/staff/StaffServiceImpl.java @@ -1,16 +1,23 @@ 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.ServiceTimeVO; 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 com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; 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.*; @@ -40,6 +47,7 @@ public class StaffServiceImpl implements StaffService { @Override public void updateStaff(StaffSaveReqVO updateReqVO) { + JSON.toJSONString(updateReqVO.getServiceTime()); // 校验存在 validateStaffExists(updateReqVO.getId()); // 更新 @@ -69,11 +77,24 @@ public class StaffServiceImpl implements StaffService { @Override public PageResult getStaffPage(StaffPageReqVO pageReqVO) { PageResult staffDOPageResult = staffMapper.selectPage(pageReqVO); + + String serviceTime = ""; 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()); + + //把StringJSON格式serviceTime转成对象 + List serviceTimeVOS = JSON.parseObject(staffDO.getServiceTime(), new TypeReference>() {}); + for (int j = 0; j < serviceTimeVOS.size(); j++) { + ServiceTimeVO serviceTimeVO = serviceTimeVOS.get(j); + serviceTime = serviceTime + serviceTimeVO.getStart() + " - " + serviceTimeVO.getEnd() + " , "; + } + String replaceAll = serviceTime.replaceAll(",\\s*$", ""); + staffDO.setServiceTimeArray(replaceAll); + serviceTime = ""; } + return staffDOPageResult; }