diff --git a/Cpop-Api/pom.xml b/Cpop-Api/pom.xml new file mode 100644 index 0000000..e901ef2 --- /dev/null +++ b/Cpop-Api/pom.xml @@ -0,0 +1,28 @@ + + + 4.0.0 + + com.cpop + Cpop-Union + 1.0.0 + ../pom.xml + + Cpop-Api + Cpop-Api + Cpop-Api + + + + + com.cpop + Cpop-Core + + + + com.squareup.okhttp3 + okhttp + + + + diff --git a/Cpop-Api/src/main/java/com/cpop/api/CpopApiApplication.java b/Cpop-Api/src/main/java/com/cpop/api/CpopApiApplication.java new file mode 100644 index 0000000..7240159 --- /dev/null +++ b/Cpop-Api/src/main/java/com/cpop/api/CpopApiApplication.java @@ -0,0 +1,13 @@ +package com.cpop.api; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class CpopApiApplication { + + public static void main(String[] args) { + SpringApplication.run(CpopApiApplication.class, args); + } + +} diff --git a/Cpop-Api/src/main/java/com/cpop/api/tencent/wxWork/core/base/WxWorkApiWebHookSendBase.java b/Cpop-Api/src/main/java/com/cpop/api/tencent/wxWork/core/base/WxWorkApiWebHookSendBase.java new file mode 100644 index 0000000..0215a0a --- /dev/null +++ b/Cpop-Api/src/main/java/com/cpop/api/tencent/wxWork/core/base/WxWorkApiWebHookSendBase.java @@ -0,0 +1,19 @@ +package com.cpop.api.tencent.wxWork.core.base; + +import com.alibaba.fastjson.annotation.JSONField; +import lombok.Data; + +/** + * @author DB + * @createTime 2023/09/15 16:30 + * @description 群机器人 + */ +@Data +public class WxWorkApiWebHookSendBase { + + /** + * 消息类型[文本(text)、markdown(markdown)、图片(image)、图文(news)、文件(file)、语音(voice)、模板卡片(template_card)] + */ + @JSONField(name = "msgtype") + private String msgType; +} diff --git a/Cpop-Api/src/main/java/com/cpop/api/tencent/wxWork/core/config/WxWorkApiConfig.java b/Cpop-Api/src/main/java/com/cpop/api/tencent/wxWork/core/config/WxWorkApiConfig.java new file mode 100644 index 0000000..16769aa --- /dev/null +++ b/Cpop-Api/src/main/java/com/cpop/api/tencent/wxWork/core/config/WxWorkApiConfig.java @@ -0,0 +1,21 @@ +package com.cpop.api.tencent.wxWork.core.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +/** + * @author DB + * @createTime 2023/09/15 16:19 + * @description 企业微信API配置类 + */ +@Data +@Configuration +@ConfigurationProperties(prefix = "pupu.api.tencent.wx-work") +public class WxWorkApiConfig { + + /** + * 群机器人 + */ + private String webhook = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key="; +} diff --git a/Cpop-Api/src/main/java/com/cpop/api/tencent/wxWork/handler/WebHookSendHandler.java b/Cpop-Api/src/main/java/com/cpop/api/tencent/wxWork/handler/WebHookSendHandler.java new file mode 100644 index 0000000..b8b40db --- /dev/null +++ b/Cpop-Api/src/main/java/com/cpop/api/tencent/wxWork/handler/WebHookSendHandler.java @@ -0,0 +1,65 @@ +package com.cpop.api.tencent.wxWork.handler; + +import com.alibaba.fastjson.JSONObject; +import com.cpop.api.tencent.wxWork.core.config.WxWorkApiConfig; +import com.cpop.api.tencent.wxWork.webHook.WebHookSendTextRequest; +import okhttp3.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.util.List; + +/** + * @author DB + * @createTime 2023/09/15 16:24 + * @description + */ +@Component +public class WebHookSendHandler { + + @Autowired + private WxWorkApiConfig config; + + /** + * @descriptions 机器人发送文本 + * @author DB + * @date 2023/09/15 17:56 + * @param key 机器人键 + * @param phoneList 通知人手机号 + * @param content 内容 + * @return java.lang.String + */ + public String webHookSendText(String key, List phoneList, String content, Boolean isAll) throws IOException { + if (isAll) { + phoneList.add("@all"); + } + WebHookSendTextRequest request = new WebHookSendTextRequest(); + WebHookSendTextRequest.Text text = request.new Text(); + text.setContent(content); + text.setMentionedMobileList(phoneList); + request.setText(text); + Response response = sendPost(config.getWebhook() + key, JSONObject.toJSONString(request)); + return response.toString(); + } + + /** + * @descriptions 发送post请求 + * @author DB + * @date 2023/09/15 17:28 + * @param url 地址 + * @param jsonBody 请求体 + * @return okhttp3.Response + */ + private Response sendPost(String url,String jsonBody) throws IOException { + OkHttpClient client = new OkHttpClient().newBuilder().build(); + MediaType mediaType = MediaType.parse("application/json"); + RequestBody body = RequestBody.create(mediaType, jsonBody); + Request request = new Request.Builder() + .url(url) + .method("POST", body) + .addHeader("Content-Type", "application/json") + .build(); + return client.newCall(request).execute(); + } +} diff --git a/Cpop-Api/src/main/java/com/cpop/api/tencent/wxWork/webHook/WebHookSendTextRequest.java b/Cpop-Api/src/main/java/com/cpop/api/tencent/wxWork/webHook/WebHookSendTextRequest.java new file mode 100644 index 0000000..2144200 --- /dev/null +++ b/Cpop-Api/src/main/java/com/cpop/api/tencent/wxWork/webHook/WebHookSendTextRequest.java @@ -0,0 +1,53 @@ +package com.cpop.api.tencent.wxWork.webHook; + +import com.alibaba.fastjson.annotation.JSONField; +import com.cpop.api.tencent.wxWork.core.base.WxWorkApiWebHookSendBase; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + * @author DB + * @createTime 2023/09/15 16:31 + * @description + */ +@Data +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +public class WebHookSendTextRequest extends WxWorkApiWebHookSendBase { + + public WebHookSendTextRequest() { + setMsgType("text"); + } + + /** + * 文本格式 + */ + private Text text; + + /** + * 文本格式 + */ + @Data + public class Text { + + /** + * 文本内容,最长不超过2048个字节,必须是utf8编码 + */ + private String content; + + /** + * userid的列表,提醒群中的指定成员(@某个成员),@all表示提醒所有人,如果开发者获取不到userid,可以使用mentioned_mobile_list + */ + @JSONField(name = "mentioned_list") + private List mentionedList; + + /** + * 手机号列表,提醒手机号对应的群成员(@某个成员),@all表示提醒所有人 + */ + @JSONField(name = "mentioned_mobile_list") + private List mentionedMobileList; + } +} diff --git a/Cpop-Api/src/main/resources/application.properties b/Cpop-Api/src/main/resources/application.properties new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Cpop-Api/src/main/resources/application.properties @@ -0,0 +1 @@ + diff --git a/Cpop-Jambox/pom.xml b/Cpop-Jambox/pom.xml new file mode 100644 index 0000000..baea947 --- /dev/null +++ b/Cpop-Jambox/pom.xml @@ -0,0 +1,23 @@ + + + 4.0.0 + + com.cpop + Cpop-Union + 1.0.0 + ../pom.xml + + Cpop-Jambox + Cpop-Jambox + 果酱 + + + + + com.cpop + Cpop-Core + + + + diff --git a/Cpop-Jambox/sql/Jambox.sql b/Cpop-Jambox/sql/Jambox.sql new file mode 100644 index 0000000..fbbac2b --- /dev/null +++ b/Cpop-Jambox/sql/Jambox.sql @@ -0,0 +1,93 @@ +/* + Navicat Premium Data Transfer + + Source Server : Localhost + Source Server Type : MySQL + Source Server Version : 80032 + Source Host : localhost:3306 + Source Schema : cpop-union + + Target Server Type : MySQL + Target Server Version : 80032 + File Encoding : 65001 + + Date: 15/09/2023 15:04:20 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for pp_j_brand +-- ---------------------------- +DROP TABLE IF EXISTS `cp_j_brand`; +CREATE TABLE `cp_j_brand` ( + `id` varchar(48) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键', + `brand_cloud_id` varchar(48) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '云函数id', + `name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '品牌名', + `background_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '背景地址', + `consultant_name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '顾问名', + `open_id` varchar(48) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'openId', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `create_user_id` varchar(48) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人id', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `update_user_id` varchar(48) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人id', + `is_delete` tinyint(1) NULL DEFAULT 0 COMMENT '是否删除(0否1是)', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '品牌表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for pp_j_brand_staff +-- ---------------------------- +DROP TABLE IF EXISTS `cp_j_brand_staff`; +CREATE TABLE `cp_j_brand_staff` ( + `id` varchar(48) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键', + `brand_staff_cloud_id` varchar(48) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '云id', + `name` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '姓名', + `phone_number` varchar(48) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '手机号', + `position` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '身份(定位)', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `create_user_id` varchar(48) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人id', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `update_user_id` varchar(48) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人id', + `is_delete` tinyint(1) NULL DEFAULT 0 COMMENT '是否删除(0否1是)', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '品牌管理员表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for pp_j_brand_staff_mid_campus +-- ---------------------------- +DROP TABLE IF EXISTS `cp_j_brand_staff_mid_campus`; +CREATE TABLE `cp_j_brand_staff_mid_campus` ( + `brand_staff_id` varchar(48) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '品牌管理员id', + `brand_id` varchar(48) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '品牌id', + `campus_id` varchar(48) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '校区id', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `create_user_id` varchar(48) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人id', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `update_user_id` varchar(48) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人id' +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '管理员-品牌-校区表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for pp_j_campus +-- ---------------------------- +DROP TABLE IF EXISTS `cp_j_campus`; +CREATE TABLE `cp_j_campus` ( + `id` varchar(48) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键', + `campus_cloud_id` varchar(48) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '云校区id', + `brand_id` varchar(48) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '品牌id', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '校区名', + `responsible_person` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '负责人', + `responsible_person_phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '负责人手机号', + `address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地址', + `open_id` varchar(48) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'openId', + `expire` datetime(0) NULL DEFAULT NULL COMMENT '到期时间', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `create_user_id` varchar(48) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人id', + `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `update_user_id` varchar(48) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人id', + `is_delete` tinyint(1) NULL DEFAULT 0 COMMENT '是否删除(0否1是)', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '校区表' ROW_FORMAT = Dynamic; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/BrandBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/BrandBo.java new file mode 100644 index 0000000..34dd05d --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/BrandBo.java @@ -0,0 +1,43 @@ +package com.cpop.jambox.business.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 品牌表Bo + * + * @author DB.lost + * @since 2023-06-01 + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "Brand对象", description = "品牌表") +public class BrandBo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @ApiModelProperty("主键") + private String id; + + /** + * 品牌名 + */ + @NotBlank(message = "品牌名不能为空") + @ApiModelProperty(value = "品牌名",required = true) + private String name; + + /** + * 背景地址 + */ + @ApiModelProperty("背景地址") + private String backgroundUrl; + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/BrandPageBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/BrandPageBo.java new file mode 100644 index 0000000..96bc299 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/BrandPageBo.java @@ -0,0 +1,28 @@ +package com.cpop.jambox.business.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * Description: + * date: 2023/6/1 18:07 + * @Author DB + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "Brand分页对象", description = "Brand分页对象") +public class BrandPageBo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 品牌名 + */ + @ApiModelProperty("品牌名") + private String name; + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/BrandStaffBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/BrandStaffBo.java new file mode 100644 index 0000000..489f981 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/BrandStaffBo.java @@ -0,0 +1,63 @@ +package com.cpop.jambox.business.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * 品牌管理员表Bo + * + * @author DB.lost + * @since 2023-06-02 + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "BrandStaff对象", description = "品牌管理员新增信息") +public class BrandStaffBo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @ApiModelProperty("主键") + private String id; + + /** + * 姓名 + */ + @NotBlank(message = "不能为空") + @ApiModelProperty("姓名") + private String name; + + /** + * 身份(定位) + */ + @ApiModelProperty("身份(定位)") + private String position = "管理员"; + + /** + * 手机号 + */ + @NotBlank(message = "不能为空") + @ApiModelProperty("手机号") + private String phoneNumber; + + /** + * 品牌id + */ + @ApiModelProperty("品牌id") + private List brandIds; + + /** + * 校区id + */ + @ApiModelProperty("校区id") + private List campusIds; + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/BrandStaffPageBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/BrandStaffPageBo.java new file mode 100644 index 0000000..125ced2 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/BrandStaffPageBo.java @@ -0,0 +1,41 @@ +package com.cpop.jambox.business.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * Description: + * date: 2023/6/2 11:59 + * + * @Author ST + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "BrandManagementStaff分页对象", description = "品牌管理员表") +public class BrandStaffPageBo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 姓名 + */ + @ApiModelProperty("姓名") + private String name; + + /** + * 手机号 + */ + @ApiModelProperty("手机号") + private String phoneNumber; + + /** + * 品牌名 + */ + @ApiModelProperty("品牌名") + private String brandName; + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CampusBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CampusBo.java new file mode 100644 index 0000000..dd85b6d --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CampusBo.java @@ -0,0 +1,57 @@ +package com.cpop.jambox.business.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 校区表Bo + * + * @author DB.lost + * @since 2023-06-07 + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "Campus对象", description = "校区表") +public class CampusBo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @ApiModelProperty("主键") + private String id; + + /** + * 品牌id + */ + @ApiModelProperty(value = "品牌id") + private String brandId; + + /** + * 校区名 + */ + @NotBlank(message = "校区名不能为空") + @ApiModelProperty(value = "校区名",required = true) + private String name; + + /** + * 负责人 + */ + @NotBlank(message = "负责人不能为空") + @ApiModelProperty(value = "负责人",required = true) + private String responsiblePerson; + + /** + * 负责人手机号 + */ + @NotBlank(message = "负责人手机号不能为空") + @ApiModelProperty(value = "负责人手机号",required = true) + private String responsiblePersonPhone; + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CampusListByBrandBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CampusListByBrandBo.java new file mode 100644 index 0000000..c0da08c --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CampusListByBrandBo.java @@ -0,0 +1,29 @@ +package com.cpop.jambox.business.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.List; + +/** + * @author: DB + * @Date: 2023/07/04/18:06 + * @Description: + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "CampusListByBrandBo对象") +public class CampusListByBrandBo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 品牌id集合 + */ + @ApiModelProperty("品牌id集合") + private List brandIds; + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CampusPageBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CampusPageBo.java new file mode 100644 index 0000000..d27a68f --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CampusPageBo.java @@ -0,0 +1,26 @@ +package com.cpop.jambox.business.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * @author: Administrator + * @Date: 2023/06/07/10:16 + * @Description: + */@Data +@Accessors(chain = true) +@ApiModel(value = "Campus分页list对象", description = "校区表") +public class CampusPageBo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 校区名 + */ + @ApiModelProperty("校区名") + private String name; +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CardTemplateListBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CardTemplateListBo.java new file mode 100644 index 0000000..6b436ee --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CardTemplateListBo.java @@ -0,0 +1,29 @@ +package com.cpop.jambox.business.bo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * @author DB + * @createTime 2023/09/27 17:00 + * @description + */ +@Data +@Accessors(chain = true) +public class CardTemplateListBo implements Serializable { + + /** + * 云品牌id + */ + @ApiModelProperty(value = "云品牌id") + private String cloudBrandId; + + /** + * 云校区id + */ + @ApiModelProperty(value = "云校区id") + private String cloudCampusId; +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CardTemplateUnionBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CardTemplateUnionBo.java new file mode 100644 index 0000000..b15a9d2 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/CardTemplateUnionBo.java @@ -0,0 +1,123 @@ +package com.cpop.jambox.business.bo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.cpop.core.annontation.StringArrayConvert; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.math.BigDecimal; +import java.sql.Date; + +/** + * @author: DB + * @Date: 2023/08/31/11:18 + * @Description: + */ +@Data +@ApiModel(value = "课卡模板整合bo") +public class CardTemplateUnionBo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @ApiModelProperty("主键") + private String id; + + /** + * 课卡模板名 + */ + @NotBlank(message = "课卡模板名不能为空") + @ApiModelProperty(value = "课卡模板名",required = true) + private String name; + + /** + * 云校区id + */ + @ApiModelProperty("云校区id") + private String cloudCampusId; + + /** + * 云品牌id + */ + @ApiModelProperty("云品牌id") + private String cloudBrandId; + + /** + * 使用范围 + */ + @NotBlank(message = "使用范围不能为空") + @ApiModelProperty(value = "使用范围(少儿,成人...)", required = true) + private String scopeUse; + + /** + * 模板类型(0:课时卡,1:时限卡,2:储值卡) + */ + @NotBlank(message = "模板类型不能为空") + @ApiModelProperty(value = "模板类型(0:课时卡,1:时限卡,2:储值卡)",required = true) + private String templateType; + + /** + * 有效日期数 + */ + @ApiModelProperty(value = "有效日期数") + private Integer validDay; + + /** + * 结束时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") + @ApiModelProperty(value = "结束日期") + private Date endDate; + + /** + * 价格 + */ + @NotNull(message = "价格不能为空") + @ApiModelProperty(value = "价格",required = true) + private BigDecimal price; + + /** + * 周预约次数 + */ + @ApiModelProperty(value = "周预约次数") + private Integer weekAppointment; + + /** + * 日预约次数 + */ + @ApiModelProperty(value = "日预约次数") + private Integer dayAppointment; + + /** + * 缓冲天数 + */ + @ApiModelProperty(value = "缓冲天数") + private Integer bufferDay; + + /** + * 支付类型(0:微信支付;1:微信先学后付;2:放心学合约支付;3:数字人民币支付) + */ + @StringArrayConvert + @NotBlank(message = "支付类型不能为空") + @ApiModelProperty(value = "支付类型(0:微信支付;1:微信先学后付;2:放心学合约支付;3:数字人民币支付;4:线下支付)",required = true) + private String payType; + + /** + * 课时(课时卡必穿) + */ + @ApiModelProperty("课时(课时卡必穿)") + private Integer classNumber; + + /** + * 是否是会员(0否1是) + */ + @ApiModelProperty("是否是会员(0否1是)") + private Boolean isMember; + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/BrandController.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/BrandController.java new file mode 100644 index 0000000..89824ae --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/BrandController.java @@ -0,0 +1,75 @@ +package com.cpop.jambox.business.controller; + +import com.mybatisflex.core.paginate.Page; +import com.cpop.core.base.R; +import com.cpop.jambox.business.bo.BrandBo; +import com.cpop.jambox.business.bo.BrandPageBo; +import com.cpop.jambox.business.service.BrandService; +import com.cpop.jambox.business.vo.BrandPageVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +/** + * 品牌表 控制层。 + * + * @author DB + * @since 2023-09-13 + */ +@RestController +@Api(tags = "果酱-品牌接口") +@RequestMapping("/brand") +public class BrandController { + + @Autowired + private BrandService brandService; + + /** + * @descriptions 查询品牌分页列表 + * @author DB + * @date 2023/09/13 17:55 + * @param bo 请求参数 + * @return com.cpop.core.base.R> + */ + @PreAuthorize("@aps.hasPermission('brandAndCampus:brand:list')") + @ApiOperation("查询品牌分页列表") + @GetMapping("/getBrandPage") + public R> getBrandPageList(BrandPageBo bo) { + Page pageVo = brandService.getBrandPage(bo); + return R.ok(pageVo); + } + + /** + * @descriptions 修改品牌表 + * @author DB + * @date 2023/09/14 11:40 + * @param bo 请求参数 + * @return com.cpop.core.base.R + */ + @PreAuthorize("@aps.hasPermission('brandAndCampus:brand:update')") + @ApiOperation("修改品牌") + @PutMapping("/updateBrand") + public R updateBrand(@RequestBody @Validated BrandBo bo) { + brandService.updateBrand(bo); + return R.ok(); + } + + /** + * @Description: 删除品牌 + * @param id 主键 + * @return: R + * @Author: DB + * @Date: 2023/6/5 10:03 + **/ + @PreAuthorize("@aps.hasPermission('brandAndCampus:brand:remove')") + @ApiOperation("删除品牌") + @DeleteMapping("/removeBrandById/{id}") + public R removeBrandById(@PathVariable String id) { + brandService.removeById(id); + return R.ok(); + } + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/BrandStaffController.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/BrandStaffController.java new file mode 100644 index 0000000..1908727 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/BrandStaffController.java @@ -0,0 +1,119 @@ +package com.cpop.jambox.business.controller; + +import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.query.QueryWrapper; +import com.cpop.core.base.R; +import com.cpop.jambox.business.bo.BrandStaffBo; +import com.cpop.jambox.business.bo.BrandStaffPageBo; +import com.cpop.jambox.business.bo.CampusListByBrandBo; +import com.cpop.jambox.business.service.BrandService; +import com.cpop.jambox.business.service.BrandStaffService; +import com.cpop.jambox.business.service.CampusService; +import com.cpop.jambox.business.vo.BrandListVo; +import com.cpop.jambox.business.vo.BrandStaffPageVo; +import com.cpop.jambox.business.vo.CampusListByBrandVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +import static com.cpop.jambox.business.entity.table.CampusTableDef.CAMPUS; + +/** + * 品牌管理员表 控制层。 + * + * @author DB + * @since 2023-09-13 + */ +@RestController +@Api(tags = "品牌管理员表接口") +@RequestMapping("/brandStaff") +public class BrandStaffController { + + @Autowired + private BrandStaffService brandStaffService; + + @Autowired + private BrandService brandService; + + @Autowired + private CampusService campusService; + + /** + * @Description: 查询品牌管理员分页列表 + * @param bo 请求参数 + * @return: R> + * @Author: DB + * @Date: 2023/6/2 14:01 + **/ + @ApiOperation("查询品牌管理员分页列表") + @GetMapping("/getBrandStaffPage") + public R> getBrandStaffPage(BrandStaffPageBo bo) { + Page pageVo = brandStaffService.getBrandStaffPage(bo); + return R.ok(pageVo); + } + + /** + * @descriptions 查询品牌列表 + * @author DB + * @date 2023/09/13 17:55 + * @return com.cpop.core.base.R> + */ + @ApiOperation("查询品牌列表") + @GetMapping("/getBrandList") + public R> getBrandList() { + List pageVo = brandService.listAs(QueryWrapper.create(), BrandListVo.class); + return R.ok(pageVo); + } + + /** + * @Description: 根据品牌查询校区列表 + * @return: R> + * @Author: DB + * @Date: 2023/6/2 17:37 + **/ + @ApiOperation("根据品牌查询校区列表") + @PostMapping("/getCampusListByBrand") + public R> getCampusListByBrand(@RequestBody CampusListByBrandBo bo) { + List list = campusService.listAs(QueryWrapper.create() + .select(CAMPUS.ID,CAMPUS.NAME,CAMPUS.BRAND_ID) + .and(CAMPUS.BRAND_ID.in(bo.getBrandIds())), + CampusListByBrandVo.class); + return R.ok(list); + } + + /** + * @descriptions 新增品牌管理员 + * @author DB + * @date 2023/09/14 16:54 + * @param bo 请求参数 + * @return com.cpop.core.base.R + */ + @PreAuthorize("@aps.hasPermission('brandAndCampus:brandStaff:insert')") + @ApiOperation("新增品牌管理员") + @PostMapping("/insertBrandStaff") + public R insertBrandStaff(@RequestBody BrandStaffBo bo) { + brandStaffService.insertBrandStaff(bo); + return R.ok(); + } + + /** + * @Description: 删除品牌管理员 + * @param id 主键 + * @return: R + * @Author: DB + * @Date: 2023/6/5 10:03 + **/ + @PreAuthorize("@aps.hasPermission('brandAndCampus:brandStaff:remove')") + @ApiOperation("删除品牌管理员") + @DeleteMapping("/removeBrandStaffById/{id}") + public R removeBrandStaffById(@PathVariable String id) { + brandStaffService.removeBrandStaffById(id); + //TODO:通知到云库 + return R.ok(); + } + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/CampusController.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/CampusController.java new file mode 100644 index 0000000..9799fde --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/CampusController.java @@ -0,0 +1,97 @@ +package com.cpop.jambox.business.controller; + +import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.query.QueryWrapper; +import com.cpop.core.base.R; +import com.cpop.jambox.business.bo.CampusBo; +import com.cpop.jambox.business.bo.CampusPageBo; +import com.cpop.jambox.business.service.BrandService; +import com.cpop.jambox.business.service.CampusService; +import com.cpop.jambox.business.vo.BrandListVo; +import com.cpop.jambox.business.vo.CampusPageVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 校区表 控制层。 + * + * @author DB + * @since 2023-09-13 + */ +@RestController +@Api(tags = "果酱-校区接口") +@RequestMapping("/campus") +public class CampusController { + + @Autowired + private CampusService campusService; + + @Autowired + private BrandService brandService; + + /** + * @Description: 查询校区分页列表 + * @param bo 请求参数 + * @return R> + * @Author Administrator + * @Date: 2023/6/7 0007 10:18 + */ + @PreAuthorize("@aps.hasPermission('brandAndCampus:campus:list')") + @ApiOperation("查询校区分页列表") + @GetMapping("/getCampusPage") + public R> getCampusPage(CampusPageBo bo) { + Page pageVo = campusService.getCampusPage(bo); + return R.ok(pageVo); + } + + /** + * @descriptions 查询品牌列表 + * @author DB + * @date 2023/09/13 17:55 + * @return com.cpop.core.base.R> + */ + @ApiOperation("查询品牌列表") + @GetMapping("/getBrandList") + public R> getBrandList() { + List pageVo = brandService.listAs(QueryWrapper.create(), BrandListVo.class); + return R.ok(pageVo); + } + + /** + * @descriptions 修改校区 + * @author DB + * @date 2023/09/14 11:40 + * @param bo 请求参数 + * @return com.cpop.core.base.R + */ + @PreAuthorize("@aps.hasPermission('brandAndCampus:campus:update')") + @ApiOperation("修改校区") + @PutMapping("/updateCampus") + public R updateCampus(@RequestBody @Validated CampusBo bo) { + campusService.updateCampus(bo); + return R.ok(); + } + + /** + * @Description: 删除校区 + * @param id 主键 + * @return: R + * @Author: DB + * @Date: 2023/6/5 10:03 + **/ + @PreAuthorize("@aps.hasPermission('brandAndCampus:campus:remove')") + @ApiOperation("删除校区") + @DeleteMapping("/removeCampusById/{id}") + public R removeCampusById(@PathVariable String id) { + brandService.removeById(id); + //TODO:通知到云库 + return R.ok(); + } + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/CardTemplateController.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/CardTemplateController.java new file mode 100644 index 0000000..f7eb892 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/CardTemplateController.java @@ -0,0 +1,109 @@ +package com.cpop.jambox.business.controller; + +import com.mybatisflex.core.paginate.Page; +import com.cpop.core.base.R; +import com.cpop.jambox.business.bo.CardTemplateListBo; +import com.cpop.jambox.business.bo.CardTemplateUnionBo; +import com.cpop.jambox.business.entity.CardTemplate; +import com.cpop.jambox.business.service.CardTemplateService; +import com.cpop.jambox.business.vo.CardTemplateListVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.io.Serializable; +import java.util.List; + +/** + * 果酱-课卡模板 控制层。 + * + * @author DB + * @since 2023-09-27 + */ +@RestController +@Api(tags = "果酱-课卡模板接口") +@RequestMapping("/cardTemplate") +public class CardTemplateController { + + @Autowired + private CardTemplateService cardTemplateService; + + /** + * @descriptions 根据品牌或校区获取模板 + * @author DB + * @date 2023/09/27 17:03 + * @param bo 请求参数 + * @return com.cpop.core.base.R> + */ + @GetMapping("/getListByBrandOrCampus") + @ApiOperation("根据品牌或校区获取模板") + public R> getListByBrandOrCampus(CardTemplateListBo bo) { + List list = cardTemplateService.getListByBrandOrCampus(bo); + return R.ok(list); + } + + /** + * @descriptions 保存课卡模板 + * @author DB + * @date 2023/09/27 17:37 + * @param bo 请求参数 + * @return com.cpop.core.base.R + */ + @PostMapping("saveUnionCardTemplate") + @ApiOperation("保存课卡模板") + public R saveUnionCardTemplate(@RequestBody @ApiParam("果酱-课卡模板整合bo") CardTemplateUnionBo bo) { + cardTemplateService.saveUnionCardTemplate(bo); + return R.ok(); + } + + /** + * 根据主键删除果酱-课卡模板。 + * + * @param id 主键 + * @return {@code true} 删除成功,{@code false} 删除失败 + */ + @DeleteMapping("remove/{id}") + @ApiOperation("根据主键果酱-课卡模板") + public boolean remove(@PathVariable @ApiParam("果酱-课卡模板主键") Serializable id) { + return cardTemplateService.removeById(id); + } + + /** + * 根据主键更新果酱-课卡模板。 + * + * @param cardTemplate 果酱-课卡模板 + * @return {@code true} 更新成功,{@code false} 更新失败 + */ + @PutMapping("update") + @ApiOperation("根据主键更新果酱-课卡模板") + public boolean update(@RequestBody @ApiParam("果酱-课卡模板主键") CardTemplate cardTemplate) { + return cardTemplateService.updateById(cardTemplate); + } + + /** + * 根据果酱-课卡模板主键获取详细信息。 + * + * @param id 果酱-课卡模板主键 + * @return 果酱-课卡模板详情 + */ + @GetMapping("getInfo/{id}") + @ApiOperation("根据主键获取果酱-课卡模板") + public CardTemplate getInfo(@PathVariable @ApiParam("果酱-课卡模板主键") Serializable id) { + return cardTemplateService.getById(id); + } + + /** + * 分页查询果酱-课卡模板。 + * + * @param page 分页对象 + * @return 分页对象 + */ + @GetMapping("page") + @ApiOperation("分页查询果酱-课卡模板") + public Page page(@ApiParam("分页信息") Page page) { + return cardTemplateService.page(page); + } + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/Brand.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/Brand.java new file mode 100644 index 0000000..ee3dff1 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/Brand.java @@ -0,0 +1,66 @@ +package com.cpop.jambox.business.entity; + +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.Table; +import com.cpop.core.base.entity.BaseEntity; +import com.cpop.core.base.entity.BaseInsertListener; +import com.cpop.core.base.entity.BaseUpdateListener; +import lombok.*; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * 品牌表 实体类。 + * + * @author DB + * @since 2023-09-13 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@Table(value = "cp_j_brand", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) +public class Brand extends BaseEntity implements Serializable { + + /** + * 主键 + */ + @Id + private String id; + + /** + * 云函数id + */ + private String brandCloudId; + + /** + * 品牌名 + */ + private String name; + + /** + * 背景地址 + */ + private String backgroundUrl; + + /** + * 顾问名 + */ + private String consultantName; + + /** + * openId + */ + private String openId; + + /** + * 是否删除(0否1是) + */ + @Column(isLogicDelete = true) + private Boolean isDelete; + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/BrandStaff.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/BrandStaff.java new file mode 100644 index 0000000..d70f0cc --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/BrandStaff.java @@ -0,0 +1,65 @@ +package com.cpop.jambox.business.entity; + +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.Table; +import com.cpop.core.base.entity.BaseEntity; +import com.cpop.core.base.entity.BaseInsertListener; +import com.cpop.core.base.entity.BaseUpdateListener; +import lombok.*; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * 品牌管理员表 实体类。 + * + * @author DB + * @since 2023-09-13 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@Table(value = "cp_j_brand_staff", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) +public class BrandStaff extends BaseEntity implements Serializable { + + /** + * 主键 + */ + @Id + private String id; + + /** + * 云id + */ + private String brandStaffCloudId; + + /** + * 姓名 + */ + private String name; + + /** + * 手机号 + */ + private String phoneNumber; + + /** + * 身份(定位) + */ + private String position; + + + + + + /** + * 是否删除(0否1是) + */ + @Column(isLogicDelete = true) + private Boolean isDelete; + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/BrandStaffMidCampus.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/BrandStaffMidCampus.java new file mode 100644 index 0000000..0563919 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/BrandStaffMidCampus.java @@ -0,0 +1,46 @@ +package com.cpop.jambox.business.entity; + +import com.mybatisflex.annotation.Table; +import com.cpop.core.base.entity.BaseEntity; +import com.cpop.core.base.entity.BaseInsertListener; +import com.cpop.core.base.entity.BaseUpdateListener; +import lombok.*; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * 管理员-品牌-校区表 实体类。 + * + * @author DB + * @since 2023-09-13 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@Table(value = "cp_j_brand_staff_mid_campus", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) +public class BrandStaffMidCampus extends BaseEntity implements Serializable { + + /** + * 品牌管理员id + */ + private String brandStaffId; + + /** + * 品牌id + */ + private String brandId; + + /** + * 校区id + */ + private String campusId; + + + + + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/Campus.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/Campus.java new file mode 100644 index 0000000..e40a26f --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/Campus.java @@ -0,0 +1,86 @@ +package com.cpop.jambox.business.entity; + +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.Table; +import com.cpop.core.base.entity.BaseEntity; +import com.cpop.core.base.entity.BaseInsertListener; +import com.cpop.core.base.entity.BaseUpdateListener; +import lombok.*; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 校区表 实体类。 + * + * @author DB + * @since 2023-09-13 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@Table(value = "cp_j_campus", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) +public class Campus extends BaseEntity implements Serializable { + + /** + * 主键 + */ + @Id + private String id; + + /** + * 云校区id + */ + private String campusCloudId; + + /** + * 品牌id + */ + private String brandId; + + /** + * 校区名 + */ + private String name; + + /** + * 负责人 + */ + private String responsiblePerson; + + /** + * 负责人手机号 + */ + private String responsiblePersonPhone; + + /** + * 地址 + */ + private String address; + + /** + * openId + */ + private String openId; + + /** + * 到期时间 + */ + private LocalDateTime expire; + + + + + + /** + * 是否删除(0否1是) + */ + @Column(isLogicDelete = true) + private Boolean isDelete; + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/CardTemplate.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/CardTemplate.java new file mode 100644 index 0000000..83163f7 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/CardTemplate.java @@ -0,0 +1,128 @@ +package com.cpop.jambox.business.entity; + +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.Table; +import com.cpop.core.base.entity.BaseEntity; +import com.cpop.core.base.entity.BaseInsertListener; +import com.cpop.core.base.entity.BaseUpdateListener; +import lombok.*; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.sql.Date; + +/** + * 果酱-课卡模板 实体类。 + * + * @author DB + * @since 2023-09-27 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@Table(value = "cp_j_card_template", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) +public class CardTemplate extends BaseEntity implements Serializable { + + /** + * 主键 + */ + @Id + private String id; + + /** + * 云品牌id + */ + private String cloudBrandId; + + /** + * 云校区id + */ + private String cloudCampusId; + + /** + * 是否使用(0否1是) + */ + private Boolean status; + + /** + * 模板名 + */ + private String name; + + /** + * 有效日期数 + */ + private Integer validDay; + + /** + * 开始日期 + */ + private Date startDate; + + /** + * 结束日期 + */ + private Date endDate; + + /** + * 价格 + */ + private BigDecimal price; + + /** + * 课时 + */ + private Integer classNumber; + + /** + * 周预约数 + */ + private Integer weekAppointment; + + /** + * 日预约数 + */ + private Integer dayAppointment; + + /** + * 缓冲天数 + */ + private Integer bufferDay; + + /** + * 模板类型(0:课时卡,1:时限卡,2:储值卡) + */ + private Integer templateType; + + /** + * 使用范围 + */ + private String scopeUse; + + /** + * 支付类型(0:微信支付;1:微信先学后付;2:放心学合约支付;3:数字人民币支付;4:线下支付) + */ + private String payType; + + /** + * 太阳码 + */ + private String qrCode; + + /** + * 是否是会员(0否1是) + */ + private Boolean isMember; + + /** + * 逻辑删除(0否1是) + */ + @Column(isLogicDelete = true) + private Boolean isDelete; + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/BrandMapper.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/BrandMapper.java new file mode 100644 index 0000000..0edef92 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/BrandMapper.java @@ -0,0 +1,14 @@ +package com.cpop.jambox.business.mapper; + +import com.mybatisflex.core.BaseMapper; +import com.cpop.jambox.business.entity.Brand; + +/** + * 品牌表 映射层。 + * + * @author DB + * @since 2023-09-13 + */ +public interface BrandMapper extends BaseMapper { + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/BrandStaffMapper.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/BrandStaffMapper.java new file mode 100644 index 0000000..8683b64 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/BrandStaffMapper.java @@ -0,0 +1,14 @@ +package com.cpop.jambox.business.mapper; + +import com.mybatisflex.core.BaseMapper; +import com.cpop.jambox.business.entity.BrandStaff; + +/** + * 品牌管理员表 映射层。 + * + * @author DB + * @since 2023-09-13 + */ +public interface BrandStaffMapper extends BaseMapper { + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/BrandStaffMidCampusMapper.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/BrandStaffMidCampusMapper.java new file mode 100644 index 0000000..8f1c35f --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/BrandStaffMidCampusMapper.java @@ -0,0 +1,14 @@ +package com.cpop.jambox.business.mapper; + +import com.mybatisflex.core.BaseMapper; +import com.cpop.jambox.business.entity.BrandStaffMidCampus; + +/** + * 管理员-品牌-校区表 映射层。 + * + * @author DB + * @since 2023-09-13 + */ +public interface BrandStaffMidCampusMapper extends BaseMapper { + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/CampusMapper.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/CampusMapper.java new file mode 100644 index 0000000..970e1f3 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/CampusMapper.java @@ -0,0 +1,14 @@ +package com.cpop.jambox.business.mapper; + +import com.mybatisflex.core.BaseMapper; +import com.cpop.jambox.business.entity.Campus; + +/** + * 校区表 映射层。 + * + * @author DB + * @since 2023-09-13 + */ +public interface CampusMapper extends BaseMapper { + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/CardTemplateMapper.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/CardTemplateMapper.java new file mode 100644 index 0000000..64268f8 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/mapper/CardTemplateMapper.java @@ -0,0 +1,14 @@ +package com.cpop.jambox.business.mapper; + +import com.mybatisflex.core.BaseMapper; +import com.cpop.jambox.business.entity.CardTemplate; + +/** + * 果酱-课卡模板 映射层。 + * + * @author DB + * @since 2023-09-27 + */ +public interface CardTemplateMapper extends BaseMapper { + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/BrandService.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/BrandService.java new file mode 100644 index 0000000..8da9dd2 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/BrandService.java @@ -0,0 +1,34 @@ +package com.cpop.jambox.business.service; + +import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.service.IService; +import com.cpop.jambox.business.bo.BrandBo; +import com.cpop.jambox.business.bo.BrandPageBo; +import com.cpop.jambox.business.entity.Brand; +import com.cpop.jambox.business.vo.BrandPageVo; + +/** + * 品牌表 服务层。 + * + * @author DB + * @since 2023-09-13 + */ +public interface BrandService extends IService { + + /** + * @descriptions 查询品牌分页列表 + * @author DB + * @date 2023/09/13 17:55 + * @param bo 请求参数 + * @return com.cpop.core.base.R> + */ + Page getBrandPage(BrandPageBo bo); + + /** + * @descriptions 修改品牌表 + * @author DB + * @date 2023/09/14 11:40 + * @param bo 请求参数 + */ + void updateBrand(BrandBo bo); +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/BrandStaffMidCampusService.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/BrandStaffMidCampusService.java new file mode 100644 index 0000000..4d8d44c --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/BrandStaffMidCampusService.java @@ -0,0 +1,14 @@ +package com.cpop.jambox.business.service; + +import com.mybatisflex.core.service.IService; +import com.cpop.jambox.business.entity.BrandStaffMidCampus; + +/** + * 管理员-品牌-校区表 服务层。 + * + * @author DB + * @since 2023-09-13 + */ +public interface BrandStaffMidCampusService extends IService { + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/BrandStaffService.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/BrandStaffService.java new file mode 100644 index 0000000..bae2d43 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/BrandStaffService.java @@ -0,0 +1,43 @@ +package com.cpop.jambox.business.service; + +import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.service.IService; +import com.cpop.jambox.business.bo.BrandStaffBo; +import com.cpop.jambox.business.bo.BrandStaffPageBo; +import com.cpop.jambox.business.entity.BrandStaff; +import com.cpop.jambox.business.vo.BrandStaffPageVo; + +/** + * 品牌管理员表 服务层。 + * + * @author DB + * @since 2023-09-13 + */ +public interface BrandStaffService extends IService { + + /** + * @Description: 查询品牌管理员分页列表 + * @param bo 请求参数 + * @return: R> + * @Author: DB + * @Date: 2023/6/2 14:01 + **/ + Page getBrandStaffPage(BrandStaffPageBo bo); + + /** + * @descriptions 新增品牌管理员 + * @author DB + * @date 2023/09/14 16:54 + * @param bo 请求参数 + */ + void insertBrandStaff(BrandStaffBo bo); + + /** + * @Description: 删除品牌管理员 + * @param id 主键 + * @return: R + * @Author: DB + * @Date: 2023/6/5 10:03 + **/ + void removeBrandStaffById(String id); +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/CampusService.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/CampusService.java new file mode 100644 index 0000000..4582a70 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/CampusService.java @@ -0,0 +1,34 @@ +package com.cpop.jambox.business.service; + +import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.service.IService; +import com.cpop.jambox.business.bo.CampusBo; +import com.cpop.jambox.business.bo.CampusPageBo; +import com.cpop.jambox.business.entity.Campus; +import com.cpop.jambox.business.vo.CampusPageVo; + +/** + * 校区表 服务层。 + * + * @author DB + * @since 2023-09-13 + */ +public interface CampusService extends IService { + + /** + * @Description: 查询校区分页列表 + * @param bo 请求参数 + * @return R> + * @Author Administrator + * @Date: 2023/6/7 0007 10:18 + */ + Page getCampusPage(CampusPageBo bo); + + /** + * @descriptions 修改校区 + * @author DB + * @date 2023/09/14 11:40 + * @param bo 请求参数 + */ + void updateCampus(CampusBo bo); +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/CardTemplateService.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/CardTemplateService.java new file mode 100644 index 0000000..3d5c76b --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/CardTemplateService.java @@ -0,0 +1,36 @@ +package com.cpop.jambox.business.service; + +import com.mybatisflex.core.service.IService; +import com.cpop.jambox.business.bo.CardTemplateListBo; +import com.cpop.jambox.business.bo.CardTemplateUnionBo; +import com.cpop.jambox.business.entity.CardTemplate; +import com.cpop.jambox.business.vo.CardTemplateListVo; + +import java.util.List; + +/** + * 果酱-课卡模板 服务层。 + * + * @author DB + * @since 2023-09-27 + */ +public interface CardTemplateService extends IService { + + /** + * @descriptions 根据品牌或校区获取模板 + * @author DB + * @date 2023/09/27 17:02 + * @param bo 请求参数 + * @return java.util.List + */ + List getListByBrandOrCampus(CardTemplateListBo bo); + + /** + * @descriptions 保存课卡模板 + * @author DB + * @date 2023/09/27 18:00 + * @param bo 请求参数 + * @return: void + */ + void saveUnionCardTemplate(CardTemplateUnionBo bo); +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/BrandServiceImpl.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/BrandServiceImpl.java new file mode 100644 index 0000000..6964e5b --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/BrandServiceImpl.java @@ -0,0 +1,67 @@ +package com.cpop.jambox.business.service.impl; + +import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.query.QueryWrapper; +import com.mybatisflex.spring.service.impl.ServiceImpl; +import com.cpop.common.utils.bean.BeanUtils; +import com.cpop.core.base.entity.PageDomain; +import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.jambox.business.bo.BrandBo; +import com.cpop.jambox.business.bo.BrandPageBo; +import com.cpop.jambox.business.entity.Brand; +import com.cpop.jambox.business.mapper.BrandMapper; +import com.cpop.jambox.business.service.BrandService; +import com.cpop.jambox.business.vo.BrandPageVo; +import org.springframework.stereotype.Service; + +import static com.mybatisflex.core.query.QueryMethods.groupConcat; +import static com.cpop.jambox.business.entity.table.BrandStaffMidCampusTableDef.BRAND_STAFF_MID_CAMPUS; +import static com.cpop.jambox.business.entity.table.BrandStaffTableDef.BRAND_STAFF; +import static com.cpop.jambox.business.entity.table.BrandTableDef.BRAND; + +/** + * 品牌表 服务层实现。 + * + * @author DB + * @since 2023-09-13 + */ +@Service("brandService") +public class BrandServiceImpl extends ServiceImpl implements BrandService { + + /** + * @descriptions 查询品牌分页列表 + * @author DB + * @date 2023/09/13 17:55 + * @param bo 请求参数 + * @return com.cpop.core.base.R> + */ + @Override + public Page getBrandPage(BrandPageBo bo) { + PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); + return this.mapper.paginateAs(pageDomain.getPageNum(),pageDomain.getPageSize(), + QueryWrapper.create() + .select(BRAND.ID,BRAND.BRAND_CLOUD_ID,BRAND.NAME,BRAND.CREATE_TIME,BRAND.BACKGROUND_URL,BRAND.CONSULTANT_NAME) + .select(groupConcat(BRAND_STAFF_MID_CAMPUS.BRAND_STAFF_ID).as(BrandPageVo::getBrandStaffId)) + .select(groupConcat(BRAND_STAFF.NAME).as(BrandPageVo::getBrandStaffName)) + //管理员-品牌-校区表 + .leftJoin(BRAND_STAFF_MID_CAMPUS).on(BRAND_STAFF_MID_CAMPUS.BRAND_ID.eq(BRAND.ID)) + //管理员 + .leftJoin(BRAND_STAFF).on(BRAND_STAFF.ID.eq(BRAND_STAFF_MID_CAMPUS.BRAND_STAFF_ID)) + .and(BRAND.NAME.like(bo.getName())) + .groupBy(BRAND.ID), + BrandPageVo.class); + } + + /** + * @descriptions 修改品牌表 + * @author DB + * @date 2023/09/14 11:40 + * @param bo 请求参数 + */ + @Override + public void updateBrand(BrandBo bo) { + Brand entity = BeanUtils.mapToClass(bo, Brand.class); + this.updateById(entity); + //TODO:可能需要通知到云库 + } +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/BrandStaffMidCampusServiceImpl.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/BrandStaffMidCampusServiceImpl.java new file mode 100644 index 0000000..76ae8c0 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/BrandStaffMidCampusServiceImpl.java @@ -0,0 +1,18 @@ +package com.cpop.jambox.business.service.impl; + +import com.mybatisflex.spring.service.impl.ServiceImpl; +import com.cpop.jambox.business.entity.BrandStaffMidCampus; +import com.cpop.jambox.business.mapper.BrandStaffMidCampusMapper; +import com.cpop.jambox.business.service.BrandStaffMidCampusService; +import org.springframework.stereotype.Service; + +/** + * 管理员-品牌-校区表 服务层实现。 + * + * @author DB + * @since 2023-09-13 + */ +@Service("brandStaffMidCampusService") +public class BrandStaffMidCampusServiceImpl extends ServiceImpl implements BrandStaffMidCampusService { + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/BrandStaffServiceImpl.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/BrandStaffServiceImpl.java new file mode 100644 index 0000000..17820d9 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/BrandStaffServiceImpl.java @@ -0,0 +1,146 @@ +package com.cpop.jambox.business.service.impl; + +import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.query.QueryWrapper; +import com.mybatisflex.spring.service.impl.ServiceImpl; +import com.cpop.common.utils.bean.BeanUtils; +import com.cpop.core.base.entity.PageDomain; +import com.cpop.core.base.exception.ServiceException; +import com.cpop.core.utils.SpringUtils; +import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.jambox.business.bo.BrandStaffBo; +import com.cpop.jambox.business.bo.BrandStaffPageBo; +import com.cpop.jambox.business.entity.BrandStaff; +import com.cpop.jambox.business.entity.BrandStaffMidCampus; +import com.cpop.jambox.business.entity.Campus; +import com.cpop.jambox.business.mapper.BrandStaffMapper; +import com.cpop.jambox.business.service.BrandStaffMidCampusService; +import com.cpop.jambox.business.service.BrandStaffService; +import com.cpop.jambox.business.service.CampusService; +import com.cpop.jambox.business.vo.BrandStaffPageVo; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +import static com.mybatisflex.core.query.QueryMethods.groupConcat; +import static com.cpop.jambox.business.entity.table.BrandStaffMidCampusTableDef.BRAND_STAFF_MID_CAMPUS; +import static com.cpop.jambox.business.entity.table.BrandStaffTableDef.BRAND_STAFF; +import static com.cpop.jambox.business.entity.table.BrandTableDef.BRAND; +import static com.cpop.jambox.business.entity.table.CampusTableDef.CAMPUS; + +/** + * 品牌管理员表 服务层实现。 + * + * @author DB + * @since 2023-09-13 + */ +@Service("brandStaffService") +public class BrandStaffServiceImpl extends ServiceImpl implements BrandStaffService { + + /** + * @Description: 查询品牌管理员分页列表 + * @param bo 请求参数 + * @return: R> + * @Author: DB + * @Date: 2023/6/2 14:01 + **/ + @Override + public Page getBrandStaffPage(BrandStaffPageBo bo) { + PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); + return this.mapper.paginateAs(pageDomain.getPageNum(),pageDomain.getPageSize(), + QueryWrapper.create() + .select(BRAND_STAFF.ID,BRAND_STAFF.NAME,BRAND_STAFF.PHONE_NUMBER,BRAND_STAFF.CREATE_TIME) + .select(groupConcat(distinct(BRAND_STAFF_MID_CAMPUS.BRAND_ID)).as(BrandStaffPageVo::getBrandId), groupConcat(distinct(BRAND_STAFF_MID_CAMPUS.CAMPUS_ID)).as(BrandStaffPageVo::getCampusId)) + .select(groupConcat(distinct(BRAND.NAME)).as(BrandStaffPageVo::getBrandName)) + .select(groupConcat(distinct(CAMPUS.NAME)).as(BrandStaffPageVo::getCampusName)) + //管理员表 + .from(BRAND_STAFF) + //中间表 + .leftJoin(BRAND_STAFF_MID_CAMPUS).on(BRAND_STAFF_MID_CAMPUS.BRAND_STAFF_ID.eq(BRAND_STAFF.ID)) + //品牌表 + .leftJoin(BRAND).on(BRAND.ID.eq(BRAND_STAFF_MID_CAMPUS.BRAND_ID)) + //校区表 + .leftJoin(CAMPUS).on(CAMPUS.ID.eq(BRAND_STAFF_MID_CAMPUS.CAMPUS_ID)) + .and(BRAND_STAFF.NAME.like(bo.getName())) + .and(BRAND_STAFF.PHONE_NUMBER.eq(bo.getPhoneNumber())) + .and(BRAND.NAME.like(bo.getBrandName())) + .groupBy(BRAND_STAFF.ID), + BrandStaffPageVo.class); + } + + /** + * @descriptions 新增品牌管理员 + * @author DB + * @date 2023/09/14 16:54 + * @param bo 请求参数 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void insertBrandStaff(BrandStaffBo bo) { + BrandStaff brandStaff = BeanUtils.mapToClass(bo, BrandStaff.class); + List list = new ArrayList<>(); + //是否有校区ids + if (bo.getCampusIds().isEmpty()){ + //只有品牌 + if (bo.getBrandIds().isEmpty()) { + throw new ServiceException("品牌与校区都不存在,添加失败"); + } else { + //TODO:向云库添加管理员数据 + this.save(brandStaff); + bo.getBrandIds().forEach(item -> { + //中间表只有品牌信息 + BrandStaffMidCampus brandStaffMidCampus = new BrandStaffMidCampus(); + brandStaffMidCampus.setBrandStaffId(brandStaff.getId()); + brandStaffMidCampus.setBrandId(item); + list.add(brandStaffMidCampus); + }); + } + } else { + //先查询校区关联的品牌是否全包含在传入的品牌中 + List campusList = SpringUtils.getBean(CampusService.class).list(QueryWrapper.create().where(CAMPUS.ID.in(bo.getCampusIds()))); + Set campusBrandIds = campusList + .stream().map(Campus::getBrandId).collect(Collectors.toSet()); + Set filterBrandIds = bo.getBrandIds().stream().filter(s -> !campusBrandIds.contains(s)).collect(Collectors.toSet()); + //存在只有品牌没有校区的数据 + if (!filterBrandIds.isEmpty()) { + filterBrandIds.forEach(item -> { + BrandStaffMidCampus brandStaffMidCampus = new BrandStaffMidCampus(); + brandStaffMidCampus.setBrandStaffId(brandStaff.getId()); + brandStaffMidCampus.setBrandId(item); + list.add(brandStaffMidCampus); + }); + } + campusList.forEach(item -> { + //中间表只有品牌信息 + BrandStaffMidCampus brandStaffMidCampus = new BrandStaffMidCampus(); + brandStaffMidCampus.setBrandStaffId(brandStaff.getId()); + brandStaffMidCampus.setBrandId(item.getBrandId()); + brandStaffMidCampus.setCampusId(item.getId()); + list.add(brandStaffMidCampus); + }); + } + //添加到中间表 + SpringUtils.getBean(BrandStaffMidCampusService.class).saveBatch(list); + } + + /** + * @Description: 删除品牌管理员 + * @param id 主键 + * @return: R + * @Author: DB + * @Date: 2023/6/5 10:03 + **/ + @Override + @Transactional(rollbackFor = Exception.class) + public void removeBrandStaffById(String id) { + //删除中间表 + SpringUtils.getBean(BrandStaffMidCampusService.class).remove(QueryWrapper.create().where(BRAND_STAFF_MID_CAMPUS.BRAND_STAFF_ID.eq(id))); + //删除数据 + this.removeById(id); + //TODO:通知到云库 + } +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CampusServiceImpl.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CampusServiceImpl.java new file mode 100644 index 0000000..42ee031 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CampusServiceImpl.java @@ -0,0 +1,59 @@ +package com.cpop.jambox.business.service.impl; + +import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.query.QueryWrapper; +import com.mybatisflex.spring.service.impl.ServiceImpl; +import com.cpop.common.utils.bean.BeanUtils; +import com.cpop.core.base.entity.PageDomain; +import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.jambox.business.bo.CampusBo; +import com.cpop.jambox.business.bo.CampusPageBo; +import com.cpop.jambox.business.entity.Campus; +import com.cpop.jambox.business.mapper.CampusMapper; +import com.cpop.jambox.business.service.CampusService; +import com.cpop.jambox.business.vo.CampusPageVo; +import org.springframework.stereotype.Service; + +import static com.cpop.jambox.business.entity.table.BrandTableDef.BRAND; +import static com.cpop.jambox.business.entity.table.CampusTableDef.CAMPUS; + +/** + * 校区表 服务层实现。 + * + * @author DB + * @since 2023-09-13 + */ +@Service("campusService") +public class CampusServiceImpl extends ServiceImpl implements CampusService { + + /** + * @Description: 查询校区分页列表 + * @param bo 请求参数 + * @return R> + * @Author Administrator + * @Date: 2023/6/7 0007 10:18 + */ + @Override + public Page getCampusPage(CampusPageBo bo) { + PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); + return this.mapper.paginateAs(pageDomain.getPageNum(),pageDomain.getPageSize(), + QueryWrapper.create() + .select(CAMPUS.ALL_COLUMNS) + .select(BRAND.NAME.as(CampusPageVo::getBrandName)) + .leftJoin(BRAND).on(BRAND.ID.eq(CAMPUS.BRAND_ID)) + .and(CAMPUS.NAME.like(bo.getName())), + CampusPageVo.class); + } + + /** + * @descriptions 修改校区 + * @author DB + * @date 2023/09/14 11:40 + * @param bo 请求参数 + */ + @Override + public void updateCampus(CampusBo bo) { + this.updateById(BeanUtils.mapToClass(bo, Campus.class)); + //TODO:通知到云库 + } +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CardTemplateServiceImpl.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CardTemplateServiceImpl.java new file mode 100644 index 0000000..e129fc1 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CardTemplateServiceImpl.java @@ -0,0 +1,98 @@ +package com.cpop.jambox.business.service.impl; + +import cn.binarywang.wx.miniapp.api.WxMaService; +import com.mybatisflex.core.query.QueryWrapper; +import com.mybatisflex.spring.service.impl.ServiceImpl; +import com.cpop.common.utils.bean.BeanUtils; +import com.cpop.core.base.exception.ServiceException; +import com.cpop.core.utils.SpringUtils; +import com.cpop.jambox.business.bo.CardTemplateListBo; +import com.cpop.jambox.business.bo.CardTemplateUnionBo; +import com.cpop.jambox.business.entity.CardTemplate; +import com.cpop.jambox.business.mapper.CardTemplateMapper; +import com.cpop.jambox.business.service.CardTemplateService; +import com.cpop.jambox.business.vo.CardTemplateListVo; +import com.cpop.sdk.framework.handler.QCloudCosHandler; +import me.chanjar.weixin.common.error.WxErrorException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.util.List; + +import static com.cpop.jambox.business.entity.table.CardTemplateTableDef.CARD_TEMPLATE; + +/** + * 果酱-课卡模板 服务层实现。 + * + * @author DB + * @since 2023-09-27 + */ +@Service("cardTemplateService") +public class CardTemplateServiceImpl extends ServiceImpl implements CardTemplateService { + + @Autowired + private WxMaService wxMaService; + + @Autowired + private QCloudCosHandler qCloudCosHandler; + + /** + * 小程序模板调整路径 + */ + private final String TEMPLATE_URL = "pages/pay/pay"; + + /** + * @descriptions 根据品牌或校区获取模板 + * @author DB + * @date 2023/09/27 17:02 + * @param bo 请求参数 + * @return java.util.List + */ + @Override + public List getListByBrandOrCampus(CardTemplateListBo bo) { + return this.listAs(QueryWrapper.create() + .and(CARD_TEMPLATE.CLOUD_BRAND_ID.eq(bo.getCloudBrandId())) + .and(CARD_TEMPLATE.CLOUD_CAMPUS_ID.eq(bo.getCloudCampusId())) + .orderBy(CARD_TEMPLATE.CREATE_TIME.asc()), + CardTemplateListVo.class); + } + + /** + * @descriptions 保存课卡模板 + * @author DB + * @date 2023/09/27 18:00 + * @param bo 请求参数 + * @return: void + */ + @Override + public void saveUnionCardTemplate(CardTemplateUnionBo bo) { + CardTemplate cardTemplate = BeanUtils.mapToClass(bo, CardTemplate.class); + this.save(cardTemplate); + //生成太阳码 + try { + File file = wxMaService.getQrcodeService().createWxaCodeUnlimit(cardTemplate.getId(), + TEMPLATE_URL, true, SpringUtils.getActiveProfile(), 300, true, null, true); + String cdnUrl = qCloudCosHandler.upload(file); + this.updateChain().set(CARD_TEMPLATE.QR_CODE, cdnUrl).where(CARD_TEMPLATE.ID.eq(cardTemplate.getId())).update(); + } catch (WxErrorException e) { + throw new ServiceException(e.getMessage()); + } + } + + /** + * 获取小程序环境 + * @param env 当前环境 + * @return 小程序码环境 + */ + private String getQrCodeEnv(String env) { + switch (env) { + case "prod": + return "release"; + case "dev": + case "test": + default: + return "trial"; + } + } +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/BrandListVo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/BrandListVo.java new file mode 100644 index 0000000..c411fbd --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/BrandListVo.java @@ -0,0 +1,40 @@ +package com.cpop.jambox.business.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * Description: + * date: 2023/6/2 17:39 + * + * @Author ST + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "Brand对象", description = "品牌表") +public class BrandListVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @ApiModelProperty("主键") + private String id; + + /** + * 云函数id + */ + @ApiModelProperty("云函数id") + private String brandCloudId; + + /** + * 品牌名 + */ + @ApiModelProperty("品牌名") + private String name; +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/BrandPageVo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/BrandPageVo.java new file mode 100644 index 0000000..f2055c9 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/BrandPageVo.java @@ -0,0 +1,75 @@ +package com.cpop.jambox.business.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.cpop.core.annontation.StringArrayConvert; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * Description: + * date: 2023/6/1 18:08 + * + * @Author ST + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "Brand分页返回对象", description = "Brand分页返回对象") +public class BrandPageVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @ApiModelProperty("主键") + private String id; + + /** + * 云函数id + */ + @ApiModelProperty("云函数id") + private String brandCloudId; + + /** + * 品牌名 + */ + @ApiModelProperty("品牌名") + private String name; + + /** + * 背景地址 + */ + @StringArrayConvert + @ApiModelProperty("背景地址") + private String backgroundUrl; + + /** + * 顾问名 + */ + @ApiModelProperty("顾问名") + private String consultantName; + + /** + * 品牌管理员工id + */ + @ApiModelProperty("品牌管理员工id") + private String brandStaffId; + + /** + * 品牌管理员工 + */ + @ApiModelProperty("品牌管理员工") + private String brandStaffName; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8") + @ApiModelProperty("创建时间") + private LocalDateTime createTime; +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/BrandStaffPageVo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/BrandStaffPageVo.java new file mode 100644 index 0000000..fb866ec --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/BrandStaffPageVo.java @@ -0,0 +1,73 @@ +package com.cpop.jambox.business.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * Description: + * date: 2023/6/2 13:38 + * + * @Author ST + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "BrandManagementStaff对象", description = "品牌管理员表") +public class BrandStaffPageVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @ApiModelProperty("主键") + private String id; + + /** + * 姓名 + */ + @ApiModelProperty("姓名") + private String name; + + /** + * 手机号 + */ + @ApiModelProperty("手机号") + private String phoneNumber; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8") + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + + /** + * 品牌名 + */ + @ApiModelProperty("品牌名") + private String brandName; + + /** + * 品牌id + */ + @ApiModelProperty("品牌id") + private String brandId; + + /** + * 校区名 + */ + @ApiModelProperty("校区名") + private String campusName; + + /** + * 校区id + */ + @ApiModelProperty("校区id") + private String campusId; +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/CampusListByBrandVo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/CampusListByBrandVo.java new file mode 100644 index 0000000..e574cad --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/CampusListByBrandVo.java @@ -0,0 +1,39 @@ +package com.cpop.jambox.business.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * @author: DB + * @Date: 2023/07/04/18:10 + * @Description: + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "Campus分页对象", description = "校区表") +public class CampusListByBrandVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @ApiModelProperty("主键") + private String id; + + /** + * 品牌id + */ + @ApiModelProperty("品牌id") + private String brandId; + + /** + * 校区名 + */ + @ApiModelProperty("校区名") + private String name; +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/CampusPageVo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/CampusPageVo.java new file mode 100644 index 0000000..193a37e --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/CampusPageVo.java @@ -0,0 +1,96 @@ +package com.cpop.jambox.business.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * @author: Administrator + * @Date: 2023/06/07/10:17 + * @Description: + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "Campus分页对象", description = "校区表") +public class CampusPageVo implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @ApiModelProperty("主键") + private String id; + + /** + * 云校区id + */ + @ApiModelProperty("云校区id") + private String campusCloudId; + + /** + * 品牌id + */ + @ApiModelProperty("品牌id") + private String brandId; + + /** + * 品牌 + */ + @ApiModelProperty("品牌") + private String brandName; + + /** + * 校区名 + */ + @ApiModelProperty("校区名") + private String name; + + /** + * 负责人 + */ + @ApiModelProperty("负责人") + private String responsiblePerson; + + /** + * 负责人手机号 + */ + @ApiModelProperty("负责人手机号") + private String responsiblePersonPhone; + + /** + * 地址 + */ + @ApiModelProperty("地址") + private String address; + + /** + * openId + */ + @ApiModelProperty("openId") + private String openId; + + /** + * 到期时间 + */ + @ApiModelProperty("到期时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8") + private LocalDateTime expire; + + /** + * 是否签合同(0否1是) + */ + @ApiModelProperty("是否签合同(0否1是)") + private Boolean isSignContract; + + /** + * 顾问名 + */ + @ApiModelProperty("顾问名") + private String consultantName; +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/CardTemplateListVo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/CardTemplateListVo.java new file mode 100644 index 0000000..7ca0bb6 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/vo/CardTemplateListVo.java @@ -0,0 +1,93 @@ +package com.cpop.jambox.business.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.sql.Date; + +/** + * @author DB + * @createTime 2023/09/27 16:57 + * @description + */ +@Data +@Accessors(chain = true) +public class CardTemplateListVo implements Serializable { + + /** + * 主键 + */ + @ApiModelProperty(value = "主键") + private String id; + + /** + * 云品牌id + */ + @ApiModelProperty(value = "云品牌id") + private String cloudBrandId; + + /** + * 云校区id + */ + @ApiModelProperty(value = "云校区id") + private String cloudCampusId; + + /** + * 模板名 + */ + @ApiModelProperty(value = "模板名") + private String name; + + /** + * 价格 + */ + @ApiModelProperty(value = "价格") + private BigDecimal price; + + /** + * 有效日期 + */ + @ApiModelProperty(value = "有效日期") + private Integer validDay; + + /** + * 课时 + */ + @ApiModelProperty(value = "课时") + private Integer classNumber; + + /** + * 模板类型(0:课时卡,1:时限卡,2:储值卡) + */ + @ApiModelProperty(value = "模板类型(0:课时卡,1:时限卡,2:储值卡)") + private Integer templateType; + + /** + * 使用范围 + */ + @ApiModelProperty(value = "使用范围") + private String scopeUse; + + /** + * 是否是会员(0否1是) + */ + @ApiModelProperty(value = "是否是会员(0否1是)") + private Boolean isMember; + + /** + * 结束日期 + */ + @ApiModelProperty(value = "结束日期") + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") + private Date endDate; + + /** + * 太阳码 + */ + @ApiModelProperty(value = "太阳码") + private String qrCode; +} diff --git a/Cpop-Jambox/src/main/resources/application-jambox.yml b/Cpop-Jambox/src/main/resources/application-jambox.yml new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Cpop-Jambox/src/main/resources/application-jambox.yml @@ -0,0 +1 @@ + diff --git a/Cpop-Jambox/src/main/resources/mapper/BrandMapper.xml b/Cpop-Jambox/src/main/resources/mapper/BrandMapper.xml new file mode 100644 index 0000000..8d42453 --- /dev/null +++ b/Cpop-Jambox/src/main/resources/mapper/BrandMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/Cpop-Jambox/src/main/resources/mapper/BrandStaffMapper.xml b/Cpop-Jambox/src/main/resources/mapper/BrandStaffMapper.xml new file mode 100644 index 0000000..2b68c95 --- /dev/null +++ b/Cpop-Jambox/src/main/resources/mapper/BrandStaffMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/Cpop-Jambox/src/main/resources/mapper/BrandStaffMidCampusMapper.xml b/Cpop-Jambox/src/main/resources/mapper/BrandStaffMidCampusMapper.xml new file mode 100644 index 0000000..26cbb7a --- /dev/null +++ b/Cpop-Jambox/src/main/resources/mapper/BrandStaffMidCampusMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/Cpop-Jambox/src/main/resources/mapper/CampusMapper.xml b/Cpop-Jambox/src/main/resources/mapper/CampusMapper.xml new file mode 100644 index 0000000..79896f4 --- /dev/null +++ b/Cpop-Jambox/src/main/resources/mapper/CampusMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/Cpop-Jambox/src/main/resources/mapper/CardTemplateMapper.xml b/Cpop-Jambox/src/main/resources/mapper/CardTemplateMapper.xml new file mode 100644 index 0000000..5a3b5cc --- /dev/null +++ b/Cpop-Jambox/src/main/resources/mapper/CardTemplateMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/Cpop-Oam/pom.xml b/Cpop-Oam/pom.xml index 4fc52ea..dd5f932 100644 --- a/Cpop-Oam/pom.xml +++ b/Cpop-Oam/pom.xml @@ -19,6 +19,10 @@ com.cpop Cpop-Core + + com.cpop + Cpop-Api + diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskDemandServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskDemandServiceImpl.java index 769d362..8e38cdb 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskDemandServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskDemandServiceImpl.java @@ -1,8 +1,5 @@ package com.cpop.oam.business.service.impl; -import com.mybatisflex.core.paginate.Page; -import com.mybatisflex.core.query.QueryWrapper; -import com.mybatisflex.spring.service.impl.ServiceImpl; import com.cpop.api.tencent.wxWork.handler.WebHookSendHandler; import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; @@ -27,6 +24,9 @@ import com.cpop.oam.business.service.TaskService; import com.cpop.oam.business.vo.TaskDemandPageVo; import com.cpop.oam.framework.constant.WebHookKeyConstant; import com.cpop.oam.framework.enums.OamConfigEnum; +import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.query.QueryWrapper; +import com.mybatisflex.spring.service.impl.ServiceImpl; import org.springframework.stereotype.Service; import java.io.IOException; diff --git a/pom.xml b/pom.xml index 6b3dee0..dba3fb7 100644 --- a/pom.xml +++ b/pom.xml @@ -21,6 +21,7 @@ Cpop-Generator Cpop-Oam Cpop-Oam/Cpop-Oam-Web + Cpop-Jambox @@ -83,12 +84,21 @@ Cpop-Core ${cpop.version} - + + com.cpop + Cpop-Api + ${cpop.version} + com.cpop Cpop-Oam ${cpop.version} + + com.cpop + Cpop-Jambox + ${cpop.version} + com.zaxxer