diff --git a/yudao-admin-vue3/src/api/subscribe/brand/index.ts b/yudao-admin-vue3/src/api/subscribe/brand/index.ts new file mode 100644 index 0000000..64937f0 --- /dev/null +++ b/yudao-admin-vue3/src/api/subscribe/brand/index.ts @@ -0,0 +1,55 @@ +import request from '@/config/axios' + +// 门店管理 VO +export interface LitemallBrandVO { + id: number // 门店id + userId: string // 门店管理员id + phone: string // 联系电话 + name: string // 门店名称 + mail: string // 门店邮箱 + picUrl: string // 门店图片 + address: string // 门店地址 + depict: string // 门店简介 + status: number // 门店状态 + weight: number // 权重 + remark: string // 备注 +} + +// 门店管理 API +export const LitemallBrandApi = { + // 查询门店管理分页 + getLitemallBrandPage: async (params: any) => { + return await request.get({ url: `/subscribe/litemall-brand/page`, params }) + }, + + // 查询门店管理详情 + getLitemallBrand: async (id: number) => { + return await request.get({ url: `/subscribe/litemall-brand/get?id=` + id }) + }, + + // 新增门店管理 + createLitemallBrand: async (data: LitemallBrandVO) => { + return await request.post({ url: `/subscribe/litemall-brand/create`, data }) + }, + + // 修改门店管理 + updateLitemallBrand: async (data: LitemallBrandVO) => { + return await request.put({ url: `/subscribe/litemall-brand/update`, data }) + }, + + // 删除门店管理 + deleteLitemallBrand: async (id: number) => { + return await request.delete({ url: `/subscribe/litemall-brand/delete?id=` + id }) + }, + + // 导出门店管理 Excel + exportLitemallBrand: async (params) => { + return await request.download({ url: `/subscribe/litemall-brand/export-excel`, params }) + }, + + // 查询机构名称数据 + getOrganizations: async () => { + return await request.get({ url: `/subscribe/litemall-brand/getOrganization`}) + }, + +} diff --git a/yudao-admin-vue3/src/api/subscribe/reservation/index.ts b/yudao-admin-vue3/src/api/subscribe/reservation/index.ts new file mode 100644 index 0000000..3a6e6e0 --- /dev/null +++ b/yudao-admin-vue3/src/api/subscribe/reservation/index.ts @@ -0,0 +1,51 @@ +import request from '@/config/axios' + +// 预约订单 VO +export interface LitemallReservationVO { + id: number // id + userId: number // 用户id + nickname: string + type: number // 预约类型 + brandId: string // 门店id + brandName: string + technicianId: string // 人员id + technicianName: string + reAddTime: Date // 预约时间 + hsstr: string // 预约时间段 + reStatus: number // 预约状态 + status: number // 审核状态 + remark: string // 备注 +} + +// 预约订单 API +export const LitemallReservationApi = { + // 查询预约订单分页 + getLitemallReservationPage: async (params: any) => { + return await request.get({ url: `/subscribe/litemall-reservation/page`, params }) + }, + + // 查询预约订单详情 + getLitemallReservation: async (id: number) => { + return await request.get({ url: `/subscribe/litemall-reservation/get?id=` + id }) + }, + + // 新增预约订单 + createLitemallReservation: async (data: LitemallReservationVO) => { + return await request.post({ url: `/subscribe/litemall-reservation/create`, data }) + }, + + // 修改预约订单 + updateLitemallReservation: async (data: LitemallReservationVO) => { + return await request.put({ url: `/subscribe/litemall-reservation/update`, data }) + }, + + // 删除预约订单 + deleteLitemallReservation: async (id: number) => { + return await request.delete({ url: `/subscribe/litemall-reservation/delete?id=` + id }) + }, + + // 导出预约订单 Excel + exportLitemallReservation: async (params) => { + return await request.download({ url: `/subscribe/litemall-reservation/export-excel`, params }) + } +} diff --git a/yudao-admin-vue3/src/api/subscribe/technician/index.ts b/yudao-admin-vue3/src/api/subscribe/technician/index.ts new file mode 100644 index 0000000..abf6634 --- /dev/null +++ b/yudao-admin-vue3/src/api/subscribe/technician/index.ts @@ -0,0 +1,59 @@ +import request from '@/config/axios' + +// 人员管理 VO +export interface LitemallTechnicianVO { + id: number // id + techSn: string // 人员编号 + type: number // 人员类型 + technicianName: string // 人员名称 + brandId: number // 门店id + brandName: string + sex: number // 性别 + photo: string // 照片 + serviceTime: string // 服务时间段 + serviceScope: string // 服务范围 + phone: string // 手机号 + ym: number // 约满标记 + status: number // 状态 + content: string // 介绍 + remark: string // 备注 + serviceTimeArray: string +} + +// 人员管理 API +export const LitemallTechnicianApi = { + // 查询人员管理分页 + getLitemallTechnicianPage: async (params: any) => { + return await request.get({ url: `/subscribe/litemall-technician/page`, params }) + }, + + // 查询人员管理详情 + getLitemallTechnician: async (id: number) => { + return await request.get({ url: `/subscribe/litemall-technician/get?id=` + id }) + }, + + // 新增人员管理 + createLitemallTechnician: async (data: LitemallTechnicianVO) => { + return await request.post({ url: `/subscribe/litemall-technician/create`, data }) + }, + + // 修改人员管理 + updateLitemallTechnician: async (data: LitemallTechnicianVO) => { + return await request.put({ url: `/subscribe/litemall-technician/update`, data }) + }, + + // 删除人员管理 + deleteLitemallTechnician: async (id: number) => { + return await request.delete({ url: `/subscribe/litemall-technician/delete?id=` + id }) + }, + + // 导出人员管理 Excel + exportLitemallTechnician: async (params) => { + return await request.download({ url: `/subscribe/litemall-technician/export-excel`, params }) + }, + + // 查询机构名称数据 + getTechnicianName: async () => { + return await request.get({ url: `/subscribe/litemall-technician/getTechnicianName`}) + }, +} diff --git a/yudao-admin-vue3/src/utils/dict.ts b/yudao-admin-vue3/src/utils/dict.ts index 2f09ca4..ca4e4ac 100644 --- a/yudao-admin-vue3/src/utils/dict.ts +++ b/yudao-admin-vue3/src/utils/dict.ts @@ -113,6 +113,17 @@ export enum DICT_TYPE { TERMINAL = 'terminal', // 终端 DATE_INTERVAL = 'date_interval', // 数据间隔 + //门店管理 + BRAND_STATUS = 'brand_status', + //预约订单 + TYPE = 'type', + RE_STATUS = 're_status', + STATUS = 'status', + //人员 + TYPES = 'types', + TECHNICIAN_STATUS = 'technician_status', + SEX = 'sex', + //预约:人员管理 STALL_SEX = 'stall_sex', diff --git a/yudao-admin-vue3/src/views/subscribe/organization/OrganizationForm.vue b/yudao-admin-vue3/src/views/subscribe/brand/LitemallBrandForm.vue similarity index 55% rename from yudao-admin-vue3/src/views/subscribe/organization/OrganizationForm.vue rename to yudao-admin-vue3/src/views/subscribe/brand/LitemallBrandForm.vue index 6c7d632..ef937da 100644 --- a/yudao-admin-vue3/src/views/subscribe/organization/OrganizationForm.vue +++ b/yudao-admin-vue3/src/views/subscribe/brand/LitemallBrandForm.vue @@ -7,35 +7,43 @@ label-width="100px" v-loading="formLoading" > - - + + + + + - - + + - - + + - - + + - - + + - - + + + + + - - + + + + + - \ No newline at end of file + diff --git a/yudao-admin-vue3/src/views/subscribe/organization/index.vue b/yudao-admin-vue3/src/views/subscribe/brand/index.vue similarity index 59% rename from yudao-admin-vue3/src/views/subscribe/organization/index.vue rename to yudao-admin-vue3/src/views/subscribe/brand/index.vue index a9678d0..f000a3f 100644 --- a/yudao-admin-vue3/src/views/subscribe/organization/index.vue +++ b/yudao-admin-vue3/src/views/subscribe/brand/index.vue @@ -8,57 +8,75 @@ :inline="true" label-width="68px" > - - - - + + + + + + + + + + - + - + + + + - + + + + + + + + + + 新增 @@ -86,7 +104,7 @@ plain @click="handleExport" :loading="exportLoading" - v-hasPermi="['subscribe:organization:export']" + v-hasPermi="['subscribe:litemall-brand:export']" > 导出 @@ -98,28 +116,35 @@ - - - - - - - - - + + + + + + + + + + + + + + - + \ No newline at end of file + diff --git a/yudao-admin-vue3/src/views/subscribe/reservation/LitemallReservationForm.vue b/yudao-admin-vue3/src/views/subscribe/reservation/LitemallReservationForm.vue new file mode 100644 index 0000000..814c2d4 --- /dev/null +++ b/yudao-admin-vue3/src/views/subscribe/reservation/LitemallReservationForm.vue @@ -0,0 +1,198 @@ + + diff --git a/yudao-admin-vue3/src/views/subscribe/subscribemanage/index.vue b/yudao-admin-vue3/src/views/subscribe/reservation/index.vue similarity index 57% rename from yudao-admin-vue3/src/views/subscribe/subscribemanage/index.vue rename to yudao-admin-vue3/src/views/subscribe/reservation/index.vue index 4a1edbc..fdee6f7 100644 --- a/yudao-admin-vue3/src/views/subscribe/subscribemanage/index.vue +++ b/yudao-admin-vue3/src/views/subscribe/reservation/index.vue @@ -6,17 +6,17 @@ :model="queryParams" ref="queryFormRef" :inline="true" - label-width="100px" + label-width="68px" > - + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + 新增 @@ -109,7 +127,7 @@ plain @click="handleExport" :loading="exportLoading" - v-hasPermi="['subscribe:manage:export']" + v-hasPermi="['subscribe:litemall-reservation:export']" > 导出 @@ -121,26 +139,33 @@ - + - + + - - + + + + + + - + \ No newline at end of file + diff --git a/yudao-admin-vue3/src/views/subscribe/subscribemanage/ManageForm.vue b/yudao-admin-vue3/src/views/subscribe/subscribemanage/ManageForm.vue deleted file mode 100644 index 743f7b3..0000000 --- a/yudao-admin-vue3/src/views/subscribe/subscribemanage/ManageForm.vue +++ /dev/null @@ -1,174 +0,0 @@ - - \ No newline at end of file diff --git a/yudao-admin-vue3/src/views/subscribe/technician/LitemallTechnicianForm.vue b/yudao-admin-vue3/src/views/subscribe/technician/LitemallTechnicianForm.vue new file mode 100644 index 0000000..3355830 --- /dev/null +++ b/yudao-admin-vue3/src/views/subscribe/technician/LitemallTechnicianForm.vue @@ -0,0 +1,244 @@ + + + diff --git a/yudao-admin-vue3/src/views/subscribe/staff/index.vue b/yudao-admin-vue3/src/views/subscribe/technician/index.vue similarity index 56% rename from yudao-admin-vue3/src/views/subscribe/staff/index.vue rename to yudao-admin-vue3/src/views/subscribe/technician/index.vue index 3685e78..5e2a2f8 100644 --- a/yudao-admin-vue3/src/views/subscribe/staff/index.vue +++ b/yudao-admin-vue3/src/views/subscribe/technician/index.vue @@ -6,71 +6,98 @@ :model="queryParams" ref="queryFormRef" :inline="true" - label-width="100px" - > - - - - - - + label-width="68px" + > + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + 搜索 重置 @@ -148,7 +150,7 @@ type="primary" plain @click="openForm('create')" - v-hasPermi="['subscribe:staff:create']" + v-hasPermi="['subscribe:litemall-technician:create']" > 新增 @@ -157,63 +159,58 @@ plain @click="handleExport" :loading="exportLoading" - v-hasPermi="['subscribe:staff:export']" + v-hasPermi="['subscribe:litemall-technician:export']" > 导出 - - - - - + + - + + - - - - - + + + + - - - + + - - + + + - + " + }) + List selectLitemallTechnicianList(LitemallReservationDO litemallReservation); + +} \ 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/reservation/LitemallReservationMapper.xml b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/dal/mysql/reservation/LitemallReservationMapper.xml new file mode 100644 index 0000000..ca45351 --- /dev/null +++ b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/dal/mysql/reservation/LitemallReservationMapper.xml @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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/technician/LitemallTechnicianMapper.java b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/dal/mysql/technician/LitemallTechnicianMapper.java new file mode 100644 index 0000000..9e6fdbe --- /dev/null +++ b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/dal/mysql/technician/LitemallTechnicianMapper.java @@ -0,0 +1,52 @@ +package cn.iocoder.yudao.module.srbscribe.dal.mysql.technician; + +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.technician.vo.LitemallTechnicianPageReqVO; +import cn.iocoder.yudao.module.srbscribe.dal.dataobject.reservation.LitemallReservationDO; +import cn.iocoder.yudao.module.srbscribe.dal.dataobject.technician.LitemallTechnicianDO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + + +/** + * 人员管理 Mapper + * + * @author 管理员 + */ +@Mapper +public interface LitemallTechnicianMapper extends BaseMapperX { + + default PageResult selectPage(LitemallTechnicianPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(LitemallTechnicianDO::getTechSn, reqVO.getTechSn()) + .eqIfPresent(LitemallTechnicianDO::getType, reqVO.getType()) + .likeIfPresent(LitemallTechnicianDO::getTechnicianName, reqVO.getTechnicianName()) + .eqIfPresent(LitemallTechnicianDO::getBrandId, reqVO.getBrandId()) + .eqIfPresent(LitemallTechnicianDO::getSex, reqVO.getSex()) + .eqIfPresent(LitemallTechnicianDO::getPhoto, reqVO.getPhoto()) + .betweenIfPresent(LitemallTechnicianDO::getServiceTime, reqVO.getServiceTime()) + .eqIfPresent(LitemallTechnicianDO::getServiceScope, reqVO.getServiceScope()) + .eqIfPresent(LitemallTechnicianDO::getPhone, reqVO.getPhone()) + .eqIfPresent(LitemallTechnicianDO::getYm, reqVO.getYm()) + .eqIfPresent(LitemallTechnicianDO::getStatus, reqVO.getStatus()) + .eqIfPresent(LitemallTechnicianDO::getContent, reqVO.getContent()) + .eqIfPresent(LitemallTechnicianDO::getRemark, reqVO.getRemark()) + .betweenIfPresent(LitemallTechnicianDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(LitemallTechnicianDO::getId)); + } + + + + /** + * 查询技师管理列表 + * + * @param litemallTechnician 技师管理 + * @return 技师管理集合 + */ + List selectLitemallTechnicianList(LitemallTechnicianDO litemallTechnician); + List selectLitemallTechnicianListmian(LitemallTechnicianDO litemallTechnician); + +} \ 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/technician/LitemallTechnicianMapper.xml b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/dal/mysql/technician/LitemallTechnicianMapper.xml new file mode 100644 index 0000000..40dbf26 --- /dev/null +++ b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/dal/mysql/technician/LitemallTechnicianMapper.xml @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/service/brand/LitemallBrandService.java b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/service/brand/LitemallBrandService.java new file mode 100644 index 0000000..c05af1e --- /dev/null +++ b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/service/brand/LitemallBrandService.java @@ -0,0 +1,63 @@ +package cn.iocoder.yudao.module.srbscribe.service.brand; + + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.srbscribe.controller.admin.brand.vo.LitemallBrandPageReqVO; +import cn.iocoder.yudao.module.srbscribe.controller.admin.brand.vo.LitemallBrandSaveReqVO; +import cn.iocoder.yudao.module.srbscribe.dal.dataobject.brand.LitemallBrandDO; + +import javax.validation.*; +import java.util.List; + + +/** + * 门店管理 Service 接口 + * + * @author 管理员 + */ +public interface LitemallBrandService { + + /** + * 创建门店管理 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Integer createLitemallBrand(@Valid LitemallBrandSaveReqVO createReqVO); + + /** + * 更新门店管理 + * + * @param updateReqVO 更新信息 + */ + void updateLitemallBrand(@Valid LitemallBrandSaveReqVO updateReqVO); + + /** + * 删除门店管理 + * + * @param id 编号 + */ + void deleteLitemallBrand(Integer id); + + /** + * 获得门店管理 + * + * @param id 编号 + * @return 门店管理 + */ + LitemallBrandDO getLitemallBrand(Integer id); + + /** + * 获得门店管理分页 + * + * @param pageReqVO 分页查询 + * @return 门店管理分页 + */ + PageResult getLitemallBrandPage(LitemallBrandPageReqVO pageReqVO); + + /** + * 获取机构所有数据 + */ + List getOrganization(); + +} \ No newline at end of file diff --git a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/service/brand/LitemallBrandServiceImpl.java b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/service/brand/LitemallBrandServiceImpl.java new file mode 100644 index 0000000..9e974d7 --- /dev/null +++ b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/service/brand/LitemallBrandServiceImpl.java @@ -0,0 +1,79 @@ +package cn.iocoder.yudao.module.srbscribe.service.brand; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.srbscribe.controller.admin.brand.vo.LitemallBrandPageReqVO; +import cn.iocoder.yudao.module.srbscribe.controller.admin.brand.vo.LitemallBrandSaveReqVO; +import cn.iocoder.yudao.module.srbscribe.dal.dataobject.brand.LitemallBrandDO; +import cn.iocoder.yudao.module.srbscribe.dal.mysql.brand.LitemallBrandMapper; +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 LitemallBrandServiceImpl implements LitemallBrandService { + + @Resource + private LitemallBrandMapper litemallBrandMapper; + + @Override + public Integer createLitemallBrand(LitemallBrandSaveReqVO createReqVO) { + // 插入 + LitemallBrandDO litemallBrand = BeanUtils.toBean(createReqVO, LitemallBrandDO.class); + litemallBrandMapper.insert(litemallBrand); + // 返回 + return litemallBrand.getId(); + } + + @Override + public void updateLitemallBrand(LitemallBrandSaveReqVO updateReqVO) { + // 校验存在 + validateLitemallBrandExists(updateReqVO.getId()); + // 更新 + LitemallBrandDO updateObj = BeanUtils.toBean(updateReqVO, LitemallBrandDO.class); + litemallBrandMapper.updateById(updateObj); + } + + @Override + public void deleteLitemallBrand(Integer id) { + // 校验存在 + validateLitemallBrandExists(id); + // 删除 + litemallBrandMapper.deleteById(id); + } + + private void validateLitemallBrandExists(Integer id) { + if (litemallBrandMapper.selectById(id) == null) { + throw exception(LITEMALL_BRAND_NOT_EXISTS); + } + } + + @Override + public LitemallBrandDO getLitemallBrand(Integer id) { + return litemallBrandMapper.selectById(id); + } + + @Override + public PageResult getLitemallBrandPage(LitemallBrandPageReqVO pageReqVO) { + return litemallBrandMapper.selectPage(pageReqVO); + } + + @Override + public List getOrganization() { + return litemallBrandMapper.selectList(); + } + +} \ No newline at end of file diff --git a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/service/reservation/LitemallReservationService.java b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/service/reservation/LitemallReservationService.java new file mode 100644 index 0000000..e695284 --- /dev/null +++ b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/service/reservation/LitemallReservationService.java @@ -0,0 +1,68 @@ +package cn.iocoder.yudao.module.srbscribe.service.reservation; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.srbscribe.controller.admin.reservation.vo.LitemallReservationPageReqVO; +import cn.iocoder.yudao.module.srbscribe.controller.admin.reservation.vo.LitemallReservationSaveReqVO; +import cn.iocoder.yudao.module.srbscribe.dal.dataobject.reservation.LitemallReservationDO; + +import javax.validation.*; +import java.util.List; + + +/** + * 预约订单 Service 接口 + * + * @author 管理员 + */ +public interface LitemallReservationService { + + + /** + * 查询预约管理列表 + * + * @param litemallReservation 预约管理 + * @return 预约管理集合 + */ + public List selectLitemallReservationList(LitemallReservationDO litemallReservation); + + /** + * 创建预约订单 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createLitemallReservation(@Valid LitemallReservationSaveReqVO createReqVO); + + /** + * 更新预约订单 + * + * @param updateReqVO 更新信息 + */ + void updateLitemallReservation(@Valid LitemallReservationSaveReqVO updateReqVO); + + /** + * 删除预约订单 + * + * @param id 编号 + */ + void deleteLitemallReservation(Long id); + + /** + * 获得预约订单 + * + * @param id 编号 + * @return 预约订单 + */ + LitemallReservationDO getLitemallReservation(Long id); + + /** + * 获得预约订单分页 + * + * @param pageReqVO 分页查询 + * @return 预约订单分页 + */ + PageResult getLitemallReservationPage(LitemallReservationPageReqVO pageReqVO); + + List getLitemallReservationList(LitemallReservationDO litemallReservationDO); + +} \ No newline at end of file diff --git a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/service/reservation/LitemallReservationServiceImpl.java b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/service/reservation/LitemallReservationServiceImpl.java new file mode 100644 index 0000000..7d4958f --- /dev/null +++ b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/service/reservation/LitemallReservationServiceImpl.java @@ -0,0 +1,127 @@ +package cn.iocoder.yudao.module.srbscribe.service.reservation; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; +import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper; +import cn.iocoder.yudao.module.srbscribe.controller.admin.reservation.vo.LitemallReservationPageReqVO; +import cn.iocoder.yudao.module.srbscribe.controller.admin.reservation.vo.LitemallReservationSaveReqVO; +import cn.iocoder.yudao.module.srbscribe.controller.admin.technician.vo.ServiceTimeVO; +import cn.iocoder.yudao.module.srbscribe.dal.dataobject.brand.LitemallBrandDO; +import cn.iocoder.yudao.module.srbscribe.dal.dataobject.reservation.LitemallReservationDO; +import cn.iocoder.yudao.module.srbscribe.dal.dataobject.technician.LitemallTechnicianDO; +import cn.iocoder.yudao.module.srbscribe.dal.mysql.brand.LitemallBrandMapper; +import cn.iocoder.yudao.module.srbscribe.dal.mysql.reservation.LitemallReservationMapper; +import cn.iocoder.yudao.module.srbscribe.dal.mysql.technician.LitemallTechnicianMapper; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +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 LitemallReservationServiceImpl implements LitemallReservationService { + + @Resource + private LitemallReservationMapper litemallReservationMapper; + + @Resource + private LitemallBrandMapper litemallBrandMapper; + + @Resource + private LitemallTechnicianMapper litemallTechnicianMapper; + + @Resource + private MemberUserMapper memberUserMapper; + + /** + * 查询预约管理列表 + * + * @param litemallReservation 预约管理 + * @return 预约管理 + */ + @Override + public List selectLitemallReservationList(LitemallReservationDO litemallReservation) + { + return litemallReservationMapper.selectLitemallTechnicianList(litemallReservation); + } + + @Override + public Long createLitemallReservation(LitemallReservationSaveReqVO createReqVO) { + // 插入 + LitemallReservationDO litemallReservation = BeanUtils.toBean(createReqVO, LitemallReservationDO.class); + litemallReservationMapper.insert(litemallReservation); + // 返回 + return litemallReservation.getId(); + } + + @Override + public void updateLitemallReservation(LitemallReservationSaveReqVO updateReqVO) { + // 校验存在 + validateLitemallReservationExists(updateReqVO.getId()); + // 更新 + LitemallReservationDO updateObj = BeanUtils.toBean(updateReqVO, LitemallReservationDO.class); + litemallReservationMapper.updateById(updateObj); + } + + @Override + public void deleteLitemallReservation(Long id) { + // 校验存在 + validateLitemallReservationExists(id); + // 删除 + litemallReservationMapper.deleteById(id); + } + + private void validateLitemallReservationExists(Long id) { + if (litemallReservationMapper.selectById(id) == null) { + throw exception(LITEMALL_RESERVATION_NOT_EXISTS); + } + } + + @Override + public LitemallReservationDO getLitemallReservation(Long id) { + return litemallReservationMapper.selectById(id); + } + + @Override + public PageResult getLitemallReservationPage(LitemallReservationPageReqVO pageReqVO) { + PageResult litemallReservationDOPageResult = litemallReservationMapper.selectPage(pageReqVO); + for (int i = 0; i < litemallReservationDOPageResult.getList().size(); i++) { + LitemallReservationDO litemallReservationDO = litemallReservationDOPageResult.getList().get(i); + + LitemallBrandDO litemallBrandDO = litemallBrandMapper.selectOne("id", litemallReservationDO.getBrandId()); + litemallReservationDO.setBrandName(litemallBrandDO.getName()); + + LitemallTechnicianDO litemallTechnicianDO = litemallTechnicianMapper.selectOne("id", litemallReservationDO.getId()); + litemallReservationDO.setTechnicianName(litemallTechnicianDO.getTechnicianName()); + + MemberUserDO memberUserDO = memberUserMapper.selectOne("id", litemallReservationDO.getUserId()); + litemallReservationDO.setNickname(memberUserDO.getName()); + } + + return litemallReservationDOPageResult; + } + + @Override + public List getLitemallReservationList(LitemallReservationDO litemallReservationDO) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("type",litemallReservationDO.getType()).eq("brand_id",litemallReservationDO.getBrandId()); + List litemallReservationDOS = litemallReservationMapper.selectList(queryWrapper); + return litemallReservationDOS; + } + +} \ No newline at end of file diff --git a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/service/technician/LitemallTechnicianService.java b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/service/technician/LitemallTechnicianService.java new file mode 100644 index 0000000..cc6f3b8 --- /dev/null +++ b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/service/technician/LitemallTechnicianService.java @@ -0,0 +1,62 @@ +package cn.iocoder.yudao.module.srbscribe.service.technician; + + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.srbscribe.controller.admin.technician.vo.LitemallTechnicianPageReqVO; +import cn.iocoder.yudao.module.srbscribe.controller.admin.technician.vo.LitemallTechnicianSaveReqVO; +import cn.iocoder.yudao.module.srbscribe.dal.dataobject.technician.LitemallTechnicianDO; + +import javax.validation.*; +import java.util.List; + +/** + * 人员管理 Service 接口 + * + * @author 管理员 + */ +public interface LitemallTechnicianService { + + public List selectLitemallTechnicianList(LitemallTechnicianDO litemallTechnician); + public List selectLitemallTechnicianListmian(LitemallTechnicianDO litemallTechnician); + + /** + * 创建人员管理 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createLitemallTechnician(@Valid LitemallTechnicianSaveReqVO createReqVO); + + /** + * 更新人员管理 + * + * @param updateReqVO 更新信息 + */ + void updateLitemallTechnician(@Valid LitemallTechnicianSaveReqVO updateReqVO); + + /** + * 删除人员管理 + * + * @param id 编号 + */ + void deleteLitemallTechnician(Long id); + + /** + * 获得人员管理 + * + * @param id 编号 + * @return 人员管理 + */ + LitemallTechnicianDO getLitemallTechnician(Long id); + + /** + * 获得人员管理分页 + * + * @param pageReqVO 分页查询 + * @return 人员管理分页 + */ + PageResult getLitemallTechnicianPage(LitemallTechnicianPageReqVO pageReqVO); + + List getTechnicianName(); + +} \ No newline at end of file diff --git a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/service/technician/LitemallTechnicianServiceImpl.java b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/service/technician/LitemallTechnicianServiceImpl.java new file mode 100644 index 0000000..042517e --- /dev/null +++ b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/service/technician/LitemallTechnicianServiceImpl.java @@ -0,0 +1,140 @@ +package cn.iocoder.yudao.module.srbscribe.service.technician; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.srbscribe.controller.admin.brand.vo.LitemallBrandPageReqVO; +import cn.iocoder.yudao.module.srbscribe.controller.admin.technician.vo.LitemallTechnicianPageReqVO; +import cn.iocoder.yudao.module.srbscribe.controller.admin.technician.vo.LitemallTechnicianSaveReqVO; +import cn.iocoder.yudao.module.srbscribe.controller.admin.technician.vo.ServiceTimeVO; +import cn.iocoder.yudao.module.srbscribe.dal.dataobject.brand.LitemallBrandDO; +import cn.iocoder.yudao.module.srbscribe.dal.dataobject.technician.LitemallTechnicianDO; +import cn.iocoder.yudao.module.srbscribe.dal.mysql.brand.LitemallBrandMapper; +import cn.iocoder.yudao.module.srbscribe.dal.mysql.technician.LitemallTechnicianMapper; +import cn.iocoder.yudao.module.srbscribe.service.brand.LitemallBrandService; +import com.alibaba.fastjson.JSON; +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.*; + +/** + * 人员管理 Service 实现类 + * + * @author 管理员 + */ +@Service +@Validated +public class LitemallTechnicianServiceImpl implements LitemallTechnicianService { + + @Resource + private LitemallTechnicianMapper litemallTechnicianMapper; + + + @Resource + private LitemallBrandMapper litemallBrandMapper; + + + /** + * 查询技师管理列表 + * + * @param litemallTechnician 技师管理 + * @return 技师管理 + */ + @Override + public List selectLitemallTechnicianList(LitemallTechnicianDO litemallTechnician) + { + return litemallTechnicianMapper.selectLitemallTechnicianList(litemallTechnician); + } + /** + * 查询技师管理列表 + * + * @param litemallTechnician 技师管理 + * @return 技师管理 + */ + @Override + public List selectLitemallTechnicianListmian(LitemallTechnicianDO litemallTechnician) + { + return litemallTechnicianMapper.selectLitemallTechnicianListmian(litemallTechnician); + } + + + @Override + public Long createLitemallTechnician(LitemallTechnicianSaveReqVO createReqVO) { + // 插入 + LitemallTechnicianDO litemallTechnician = BeanUtils.toBean(createReqVO, LitemallTechnicianDO.class); + litemallTechnicianMapper.insert(litemallTechnician); + // 返回 + return litemallTechnician.getId(); + } + + @Override + public void updateLitemallTechnician(LitemallTechnicianSaveReqVO updateReqVO) { + // 校验存在 + validateLitemallTechnicianExists(updateReqVO.getId()); + // 更新 + LitemallTechnicianDO updateObj = BeanUtils.toBean(updateReqVO, LitemallTechnicianDO.class); + litemallTechnicianMapper.updateById(updateObj); + } + + @Override + public void deleteLitemallTechnician(Long id) { + // 校验存在 + validateLitemallTechnicianExists(id); + // 删除 + litemallTechnicianMapper.deleteById(id); + } + + private void validateLitemallTechnicianExists(Long id) { + if (litemallTechnicianMapper.selectById(id) == null) { + throw exception(LITEMALL_TECHNICIAN_NOT_EXISTS); + } + } + + @Override + public LitemallTechnicianDO getLitemallTechnician(Long id) { + return litemallTechnicianMapper.selectById(id); + } + + @Override + public PageResult getLitemallTechnicianPage(LitemallTechnicianPageReqVO pageReqVO) { + + PageResult litemallTechnicianDOPageResult = litemallTechnicianMapper.selectPage(pageReqVO); + + String serviceTime = ""; + for (int i = 0; i < litemallTechnicianDOPageResult.getList().size(); i++) { + LitemallTechnicianDO litemallTechnicianDO = litemallTechnicianDOPageResult.getList().get(i); + LitemallBrandDO litemallBrandDO = litemallBrandMapper.selectOne("id", litemallTechnicianDO.getBrandId()); + litemallTechnicianDO.setBrandName(litemallBrandDO.getName()); + + if(litemallTechnicianDO.getServiceTime() != null && litemallTechnicianDO.getServiceTime() != ""){ + //把StringJSON格式serviceTime转成对象 + List serviceTimeVOS = JSON.parseObject(litemallTechnicianDO.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*$", ""); + litemallTechnicianDO.setServiceTimeArray(replaceAll); + serviceTime = ""; + } + } + + return litemallTechnicianDOPageResult; + + + + } + + @Override + public List getTechnicianName() { + return litemallTechnicianMapper.selectList(); + } + +} \ No newline at end of file diff --git a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/util/AjaxResult.java b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/util/AjaxResult.java new file mode 100644 index 0000000..f057b4e --- /dev/null +++ b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/util/AjaxResult.java @@ -0,0 +1,164 @@ +package cn.iocoder.yudao.module.srbscribe.util; + +import java.util.HashMap; + +/** + * 操作消息提醒 + * + * @author ruoyi + */ +public class AjaxResult extends HashMap +{ + private static final long serialVersionUID = 1L; + + /** 状态码 */ + public static final String CODE_TAG = "code"; + + /** 返回内容 */ + public static final String MSG_TAG = "msg"; + + /** 数据对象 */ + public static final String DATA_TAG = "data"; + + /** + * 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。 + */ + public AjaxResult() + { + } + + /** + * 初始化一个新创建的 AjaxResult 对象 + * + * @param code 状态码 + * @param msg 返回内容 + */ + public AjaxResult(int code, String msg) + { + super.put(CODE_TAG, code); + super.put(MSG_TAG, msg); + } + + /** + * 初始化一个新创建的 AjaxResult 对象 + * + * @param code 状态码 + * @param msg 返回内容 + * @param data 数据对象 + */ + public AjaxResult(int code, String msg, Object data) + { + super.put(CODE_TAG, code); + super.put(MSG_TAG, msg); + if (StringUtils.isNotNull(data)) + { + super.put(DATA_TAG, data); + } + } + + /** + * 返回成功消息 + * + * @return 成功消息 + */ + public static AjaxResult success() + { + return AjaxResult.success("操作成功"); + } + + /** + * 返回成功数据 + * + * @return 成功消息 + */ + public static AjaxResult success(Object data) + { + return AjaxResult.success("操作成功", data); + } + public static AjaxResult successData(Object data) + { + return AjaxResult.success("操作成功", data); + } + + /** + * 返回成功消息 + * + * @param msg 返回内容 + * @return 成功消息 + */ + public static AjaxResult success(String msg) + { + return AjaxResult.success(msg, null); + } + + /** + * 返回成功消息 + * + * @param msg 返回内容 + * @param data 数据对象 + * @return 成功消息 + */ + public static AjaxResult success(String msg, Object data) + { + return new AjaxResult(HttpStatus.SUCCESS, msg, data); + } + + /** + * 返回错误消息 + * + * @return + */ + public static AjaxResult error() + { + return AjaxResult.error("操作失败"); + } + + /** + * 返回错误消息 + * + * @param msg 返回内容 + * @return 警告消息 + */ + public static AjaxResult error(String msg) + { + return AjaxResult.error(msg, null); + } + + /** + * 返回错误消息 + * + * @param msg 返回内容 + * @param data 数据对象 + * @return 警告消息 + */ + public static AjaxResult error(String msg, Object data) + { + return new AjaxResult(HttpStatus.ERROR, msg, data); + } + + /** + * 返回错误消息 + * + * @param code 状态码 + * @param msg 返回内容 + * @return 警告消息 + */ + public static AjaxResult error(int code, String msg) + { + return new AjaxResult(code, msg, null); + } + + /** + * 方便链式调用 + * + * @param key 键 + * @param value 值 + * @return 数据对象 + */ + @Override + public AjaxResult put(String key, Object value) + { + super.put(key, value); + return this; + } +} diff --git a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/util/HttpStatus.java b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/util/HttpStatus.java new file mode 100644 index 0000000..d210f17 --- /dev/null +++ b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/util/HttpStatus.java @@ -0,0 +1,89 @@ +package cn.iocoder.yudao.module.srbscribe.util; + +/** + * 返回状态码 + * + * @author ruoyi + */ +public class HttpStatus +{ + /** + * 操作成功 + */ + public static final int SUCCESS = 200; + + /** + * 对象创建成功 + */ + public static final int CREATED = 201; + + /** + * 请求已经被接受 + */ + public static final int ACCEPTED = 202; + + /** + * 操作已经执行成功,但是没有返回数据 + */ + public static final int NO_CONTENT = 204; + + /** + * 资源已被移除 + */ + public static final int MOVED_PERM = 301; + + /** + * 重定向 + */ + public static final int SEE_OTHER = 303; + + /** + * 资源没有被修改 + */ + public static final int NOT_MODIFIED = 304; + + /** + * 参数列表错误(缺少,格式不匹配) + */ + public static final int BAD_REQUEST = 400; + + /** + * 未授权 + */ + public static final int UNAUTHORIZED = 401; + + /** + * 访问受限,授权过期 + */ + public static final int FORBIDDEN = 403; + + /** + * 资源,服务未找到 + */ + public static final int NOT_FOUND = 404; + + /** + * 不允许的http方法 + */ + public static final int BAD_METHOD = 405; + + /** + * 资源冲突,或者资源被锁 + */ + public static final int CONFLICT = 409; + + /** + * 不支持的数据,媒体类型 + */ + public static final int UNSUPPORTED_TYPE = 415; + + /** + * 系统内部错误 + */ + public static final int ERROR = 500; + + /** + * 接口未实现 + */ + public static final int NOT_IMPLEMENTED = 501; +} diff --git a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/util/StaffVO.java b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/util/StaffVO.java new file mode 100644 index 0000000..d11f27c --- /dev/null +++ b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/util/StaffVO.java @@ -0,0 +1,45 @@ +package cn.iocoder.yudao.module.srbscribe.util; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; +@Data +public class StaffVO { + + + /** id */ + private Long id; + + /** 用户id */ + private String userId; + private String memberphone; + private String nickname; + + /** 预约类型 */ + private Long type; + private String typeName; + + /** 医馆id */ + private Long brandId; + private String brandName; + private String brandphone; + private String brandaddress; + + /** 技师id */ + private Long technicianId; + private String technicianName; + + /** 预约时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + private Date reAddTime; + + /** 预约时间段 */ + private String hsstr; + + /** 预约状态 */ + private Long reStatus; + + /** 审核状态 */ + private Long status; +} diff --git a/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/util/StringUtils.java b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/util/StringUtils.java new file mode 100644 index 0000000..3cf5cce --- /dev/null +++ b/yudao-module-subscribe/yudao-module-subscribe-biz/src/main/java/cn/iocoder/yudao/module/srbscribe/util/StringUtils.java @@ -0,0 +1,527 @@ +package cn.iocoder.yudao.module.srbscribe.util; + +import cn.hutool.core.text.StrFormatter; + +import org.springframework.util.AntPathMatcher; + +import java.util.*; + +/** + * 字符串工具类 + * + * @author ruoyi + */ +public class StringUtils extends org.apache.commons.lang3.StringUtils +{ + /** 空字符串 */ + private static final String NULLSTR = ""; + + /** 下划线 */ + private static final char SEPARATOR = '_'; + + /** + * 获取参数不为空值 + * + * @param value defaultValue 要判断的value + * @return value 返回值 + */ + public static T nvl(T value, T defaultValue) + { + return value != null ? value : defaultValue; + } + + /** + * * 判断一个Collection是否为空, 包含List,Set,Queue + * + * @param coll 要判断的Collection + * @return true:为空 false:非空 + */ + public static boolean isEmpty(Collection coll) + { + return isNull(coll) || coll.isEmpty(); + } + + /** + * * 判断一个Collection是否非空,包含List,Set,Queue + * + * @param coll 要判断的Collection + * @return true:非空 false:空 + */ + public static boolean isNotEmpty(Collection coll) + { + return !isEmpty(coll); + } + + /** + * * 判断一个对象数组是否为空 + * + * @param objects 要判断的对象数组 + ** @return true:为空 false:非空 + */ + public static boolean isEmpty(Object[] objects) + { + return isNull(objects) || (objects.length == 0); + } + + /** + * * 判断一个对象数组是否非空 + * + * @param objects 要判断的对象数组 + * @return true:非空 false:空 + */ + public static boolean isNotEmpty(Object[] objects) + { + return !isEmpty(objects); + } + + /** + * * 判断一个Map是否为空 + * + * @param map 要判断的Map + * @return true:为空 false:非空 + */ + public static boolean isEmpty(Map map) + { + return isNull(map) || map.isEmpty(); + } + + /** + * * 判断一个Map是否为空 + * + * @param map 要判断的Map + * @return true:非空 false:空 + */ + public static boolean isNotEmpty(Map map) + { + return !isEmpty(map); + } + + /** + * * 判断一个字符串是否为空串 + * + * @param str String + * @return true:为空 false:非空 + */ + public static boolean isEmpty(String str) + { + return isNull(str) || NULLSTR.equals(str.trim()); + } + + /** + * * 判断一个字符串是否为非空串 + * + * @param str String + * @return true:非空串 false:空串 + */ + public static boolean isNotEmpty(String str) + { + return !isEmpty(str); + } + + /** + * * 判断一个对象是否为空 + * + * @param object Object + * @return true:为空 false:非空 + */ + public static boolean isNull(Object object) + { + return object == null; + } + + /** + * * 判断一个对象是否非空 + * + * @param object Object + * @return true:非空 false:空 + */ + public static boolean isNotNull(Object object) + { + return !isNull(object); + } + + /** + * * 判断一个对象是否是数组类型(Java基本型别的数组) + * + * @param object 对象 + * @return true:是数组 false:不是数组 + */ + public static boolean isArray(Object object) + { + return isNotNull(object) && object.getClass().isArray(); + } + + /** + * 去空格 + */ + public static String trim(String str) + { + return (str == null ? "" : str.trim()); + } + + /** + * 截取字符串 + * + * @param str 字符串 + * @param start 开始 + * @return 结果 + */ + public static String substring(final String str, int start) + { + if (str == null) + { + return NULLSTR; + } + + if (start < 0) + { + start = str.length() + start; + } + + if (start < 0) + { + start = 0; + } + if (start > str.length()) + { + return NULLSTR; + } + + return str.substring(start); + } + + /** + * 截取字符串 + * + * @param str 字符串 + * @param start 开始 + * @param end 结束 + * @return 结果 + */ + public static String substring(final String str, int start, int end) + { + if (str == null) + { + return NULLSTR; + } + + if (end < 0) + { + end = str.length() + end; + } + if (start < 0) + { + start = str.length() + start; + } + + if (end > str.length()) + { + end = str.length(); + } + + if (start > end) + { + return NULLSTR; + } + + if (start < 0) + { + start = 0; + } + if (end < 0) + { + end = 0; + } + + return str.substring(start, end); + } + + /** + * 格式化文本, {} 表示占位符
+ * 此方法只是简单将占位符 {} 按照顺序替换为参数
+ * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可
+ * 例:
+ * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b
+ * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a
+ * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b
+ * + * @param template 文本模板,被替换的部分用 {} 表示 + * @param params 参数值 + * @return 格式化后的文本 + */ + public static String format(String template, Object... params) + { + if (isEmpty(params) || isEmpty(template)) + { + return template; + } + return StrFormatter.format(template, params); + } + + /** + * 是否为http(s)://开头 + * + * @param link 链接 + * @return 结果 + */ + + + /** + * 字符串转set + * + * @param str 字符串 + * @param sep 分隔符 + * @return set集合 + */ + public static final Set str2Set(String str, String sep) + { + return new HashSet(str2List(str, sep, true, false)); + } + + /** + * 字符串转list + * + * @param str 字符串 + * @param sep 分隔符 + * @param filterBlank 过滤纯空白 + * @param trim 去掉首尾空白 + * @return list集合 + */ + public static final List str2List(String str, String sep, boolean filterBlank, boolean trim) + { + List list = new ArrayList(); + if (StringUtils.isEmpty(str)) + { + return list; + } + + // 过滤空白字符串 + if (filterBlank && StringUtils.isBlank(str)) + { + return list; + } + String[] split = str.split(sep); + for (String string : split) + { + if (filterBlank && StringUtils.isBlank(string)) + { + continue; + } + if (trim) + { + string = string.trim(); + } + list.add(string); + } + + return list; + } + + /** + * 查找指定字符串是否包含指定字符串列表中的任意一个字符串同时串忽略大小写 + * + * @param cs 指定字符串 + * @param searchCharSequences 需要检查的字符串数组 + * @return 是否包含任意一个字符串 + */ + public static boolean containsAnyIgnoreCase(CharSequence cs, CharSequence... searchCharSequences) + { + if (isEmpty(cs) || isEmpty(searchCharSequences)) + { + return false; + } + for (CharSequence testStr : searchCharSequences) + { + if (containsIgnoreCase(cs, testStr)) + { + return true; + } + } + return false; + } + + /** + * 驼峰转下划线命名 + */ + public static String toUnderScoreCase(String str) + { + if (str == null) + { + return null; + } + StringBuilder sb = new StringBuilder(); + // 前置字符是否大写 + boolean preCharIsUpperCase = true; + // 当前字符是否大写 + boolean curreCharIsUpperCase = true; + // 下一字符是否大写 + boolean nexteCharIsUpperCase = true; + for (int i = 0; i < str.length(); i++) + { + char c = str.charAt(i); + if (i > 0) + { + preCharIsUpperCase = Character.isUpperCase(str.charAt(i - 1)); + } + else + { + preCharIsUpperCase = false; + } + + curreCharIsUpperCase = Character.isUpperCase(c); + + if (i < (str.length() - 1)) + { + nexteCharIsUpperCase = Character.isUpperCase(str.charAt(i + 1)); + } + + if (preCharIsUpperCase && curreCharIsUpperCase && !nexteCharIsUpperCase) + { + sb.append(SEPARATOR); + } + else if ((i != 0 && !preCharIsUpperCase) && curreCharIsUpperCase) + { + sb.append(SEPARATOR); + } + sb.append(Character.toLowerCase(c)); + } + + return sb.toString(); + } + + /** + * 是否包含字符串 + * + * @param str 验证字符串 + * @param strs 字符串组 + * @return 包含返回true + */ + public static boolean inStringIgnoreCase(String str, String... strs) + { + if (str != null && strs != null) + { + for (String s : strs) + { + if (str.equalsIgnoreCase(trim(s))) + { + return true; + } + } + } + return false; + } + + /** + * 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld + * + * @param name 转换前的下划线大写方式命名的字符串 + * @return 转换后的驼峰式命名的字符串 + */ + public static String convertToCamelCase(String name) + { + StringBuilder result = new StringBuilder(); + // 快速检查 + if (name == null || name.isEmpty()) + { + // 没必要转换 + return ""; + } + else if (!name.contains("_")) + { + // 不含下划线,仅将首字母大写 + return name.substring(0, 1).toUpperCase() + name.substring(1); + } + // 用下划线将原始字符串分割 + String[] camels = name.split("_"); + for (String camel : camels) + { + // 跳过原始字符串中开头、结尾的下换线或双重下划线 + if (camel.isEmpty()) + { + continue; + } + // 首字母大写 + result.append(camel.substring(0, 1).toUpperCase()); + result.append(camel.substring(1).toLowerCase()); + } + return result.toString(); + } + + /** + * 驼峰式命名法 例如:user_name->userName + */ + public static String toCamelCase(String s) + { + if (s == null) + { + return null; + } + s = s.toLowerCase(); + StringBuilder sb = new StringBuilder(s.length()); + boolean upperCase = false; + for (int i = 0; i < s.length(); i++) + { + char c = s.charAt(i); + + if (c == SEPARATOR) + { + upperCase = true; + } + else if (upperCase) + { + sb.append(Character.toUpperCase(c)); + upperCase = false; + } + else + { + sb.append(c); + } + } + return sb.toString(); + } + + /** + * 查找指定字符串是否匹配指定字符串列表中的任意一个字符串 + * + * @param str 指定字符串 + * @param strs 需要检查的字符串数组 + * @return 是否匹配 + */ + public static boolean matches(String str, List strs) + { + if (isEmpty(str) || isEmpty(strs)) + { + return false; + } + for (String pattern : strs) + { + if (isMatch(pattern, str)) + { + return true; + } + } + return false; + } + + /** + * 判断url是否与规则配置: + * ? 表示单个字符; + * * 表示一层路径内的任意字符串,不可跨层级; + * ** 表示任意层路径; + * + * @param pattern 匹配规则 + * @param url 需要匹配的url + * @return + */ + public static boolean isMatch(String pattern, String url) + { + AntPathMatcher matcher = new AntPathMatcher(); + return matcher.match(pattern, url); + } + + @SuppressWarnings("unchecked") + public static T cast(Object obj) + { + return (T) obj; + } +} \ No newline at end of file