zhuyifan

农信点餐小程序

Showing 37 changed files with 2799 additions and 31 deletions
...@@ -6,13 +6,12 @@ ...@@ -6,13 +6,12 @@
6 */ 6 */
7 7
8 plugins { 8 plugins {
9 - // Apply the application plugin to add support for building a CLI application in Java.
10 id 'java' 9 id 'java'
11 id 'idea' 10 id 'idea'
12 id 'application' 11 id 'application'
13 - id 'org.springframework.boot' version '2.3.3.RELEASE' 12 + id 'org.springframework.boot' version '2.5.12'
14 - id 'io.spring.dependency-management' version '1.0.10.RELEASE' 13 + id 'io.spring.dependency-management' version '1.1.6'
15 - id 'com.google.protobuf' version '0.9.3' 14 + id 'com.google.protobuf' version '0.9.4'
16 } 15 }
17 16
18 repositories { 17 repositories {
...@@ -29,8 +28,8 @@ application { ...@@ -29,8 +28,8 @@ application {
29 } 28 }
30 29
31 ext { 30 ext {
32 - grpcVersion = '1.39.0' 31 + grpcVersion = '1.62.2'
33 - protobufVersion = '3.17.2' 32 + protobufVersion = '3.25.3'
34 } 33 }
35 34
36 dependencies { 35 dependencies {
...@@ -55,20 +54,13 @@ dependencies { ...@@ -55,20 +54,13 @@ dependencies {
55 testImplementation "io.grpc:grpc-testing:${grpcVersion}" 54 testImplementation "io.grpc:grpc-testing:${grpcVersion}"
56 } 55 }
57 56
58 -static def isAppleSilicon() {
59 - // 检测 macOS 并且使用的是 Apple Silicon 架构
60 - return System.getProperty('os.name').toLowerCase().contains('mac') && System.getProperty('os.arch').equals('aarch64')
61 -}
62 -
63 -def protocPlatform = isAppleSilicon() ? ':osx-x86_64' : '';
64 -
65 protobuf { 57 protobuf {
66 protoc { 58 protoc {
67 - artifact = "com.google.protobuf:protoc:${protobufVersion}${protocPlatform}" 59 + artifact = "com.google.protobuf:protoc:${protobufVersion}"
68 } 60 }
69 plugins { 61 plugins {
70 grpc { 62 grpc {
71 - artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}${protocPlatform}" 63 + artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
72 } 64 }
73 } 65 }
74 generateProtoTasks { 66 generateProtoTasks {
...@@ -87,6 +79,13 @@ tasks.withType(JavaCompile).configureEach { ...@@ -87,6 +79,13 @@ tasks.withType(JavaCompile).configureEach {
87 it.options.fork = true 79 it.options.fork = true
88 } 80 }
89 81
82 +tasks {
83 + compileJava {
84 + dependsOn generateProto
85 + source fileTree('build/generated/source/proto/main/java')
86 + }
87 +}
88 +
90 sourceSets { 89 sourceSets {
91 main { 90 main {
92 java { 91 java {
......
1 org.gradle.daemon=true 1 org.gradle.daemon=true
2 org.gradle.parallel=true 2 org.gradle.parallel=true
3 org.gradle.caching=true 3 org.gradle.caching=true
4 -org.gradle.jvmargs=-Xmx4096m -XX:MetaspaceSize=512m -XX:MaxMetaspaceSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 4 +org.gradle.jvmargs=-Xmx8g -XX:MaxMetaspaceSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
5 +org.gradle.incremental=true
5 org.gradle.configureondemand=true 6 org.gradle.configureondemand=true
6 -org.gradle.java.home=/usr/lib/jvm/java-11-openjdk-amd64
...\ No newline at end of file ...\ No newline at end of file
7 +org.gradle.configuration-cache=true
...\ No newline at end of file ...\ No newline at end of file
......
1 distributionBase=GRADLE_USER_HOME 1 distributionBase=GRADLE_USER_HOME
2 distributionPath=wrapper/dists 2 distributionPath=wrapper/dists
3 -distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-6.9-bin.zip 3 +distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-8.11-bin.zip
4 networkTimeout=10000 4 networkTimeout=10000
5 zipStoreBase=GRADLE_USER_HOME 5 zipStoreBase=GRADLE_USER_HOME
6 zipStorePath=wrapper/dists 6 zipStorePath=wrapper/dists
7 +#org.gradle.java.home=/usr/lib/jvm/java-17-openjdk-amd64
...\ No newline at end of file ...\ No newline at end of file
......
1 +package com.tianting.infoloop.mapper;
2 +
3 +import com.tianting.infoloop.inject.MyBaseMapper;
4 +import com.tianting.infoloop.model.db.Diner;
5 +
6 +/**
7 +* @author zhuyf
8 +* @description 针对表【diners(就餐人表)】的数据库操作Mapper
9 +* @createDate 2025-04-10 13:22:20
10 +* @Entity com.tianting.infoloop.model.db.Diner
11 +*/
12 +public interface DinerMapper extends MyBaseMapper<Diner> {
13 +
14 +}
15 +
16 +
17 +
18 +
1 +package com.tianting.infoloop.mapper;
2 +
3 +import com.tianting.infoloop.inject.MyBaseMapper;
4 +import com.tianting.infoloop.model.db.GradeClass;
5 +
6 +/**
7 +* @author zhuyf
8 +* @description 针对表【grade_classes(年级班级表)】的数据库操作Mapper
9 +* @createDate 2025-04-10 13:22:20
10 +* @Entity com.tianting.infoloop.model.db.GradeClass
11 +*/
12 +public interface GradeClassMapper extends MyBaseMapper<GradeClass> {
13 +
14 +}
15 +
16 +
17 +
18 +
1 +package com.tianting.infoloop.mapper;
2 +
3 +import com.tianting.infoloop.inject.MyBaseMapper;
4 +import com.tianting.infoloop.model.db.MealMenuRecord;
5 +
6 +/**
7 +* @author zhuyf
8 +* @description 针对表【meal_menu_records(餐单记录表)】的数据库操作Mapper
9 +* @createDate 2025-04-10 13:22:20
10 +* @Entity com.tianting.infoloop.model.db.MealMenuRecord
11 +*/
12 +public interface MealMenuRecordMapper extends MyBaseMapper<MealMenuRecord> {
13 +
14 +}
15 +
16 +
17 +
18 +
1 +package com.tianting.infoloop.mapper;
2 +
3 +import com.tianting.infoloop.inject.MyBaseMapper;
4 +import com.tianting.infoloop.model.db.MealOrder;
5 +
6 +/**
7 +* @author zhuyf
8 +* @description 针对表【meal_orders(订餐记录表)】的数据库操作Mapper
9 +* @createDate 2025-04-10 13:22:20
10 +* @Entity com.tianting.infoloop.model.db.MealOrder
11 +*/
12 +public interface MealOrderMapper extends MyBaseMapper<MealOrder> {
13 +
14 +}
15 +
16 +
17 +
18 +
1 +package com.tianting.infoloop.mapper;
2 +
3 +import com.tianting.infoloop.inject.MyBaseMapper;
4 +import com.tianting.infoloop.model.db.MpAccountDinerRef;
5 +
6 +/**
7 +* @author zhuyf
8 +* @description 针对表【mp_account_diner_refs(小程序账号和就餐人关联表)】的数据库操作Mapper
9 +* @createDate 2025-04-10 13:22:20
10 +* @Entity com.tianting.infoloop.model.db.MpAccountDinerRef
11 +*/
12 +public interface MpAccountDinerRefMapper extends MyBaseMapper<MpAccountDinerRef> {
13 +
14 +}
15 +
16 +
17 +
18 +
1 +package com.tianting.infoloop.mapper;
2 +
3 +import com.tianting.infoloop.inject.MyBaseMapper;
4 +import com.tianting.infoloop.model.db.MpAccount;
5 +
6 +/**
7 +* @author zhuyf
8 +* @description 针对表【mp_accounts(小程序账号表)】的数据库操作Mapper
9 +* @createDate 2025-04-10 13:22:20
10 +* @Entity com.tianting.infoloop.model.db.MpAccount
11 +*/
12 +public interface MpAccountMapper extends MyBaseMapper<MpAccount> {
13 +
14 +}
15 +
16 +
17 +
18 +
1 +package com.tianting.infoloop.model.db;
2 +
3 +import com.baomidou.mybatisplus.annotation.FieldFill;
4 +import com.baomidou.mybatisplus.annotation.IdType;
5 +import com.baomidou.mybatisplus.annotation.TableField;
6 +import com.baomidou.mybatisplus.annotation.TableId;
7 +import com.baomidou.mybatisplus.annotation.TableLogic;
8 +import com.baomidou.mybatisplus.annotation.TableName;
9 +import com.baomidou.mybatisplus.extension.activerecord.Model;
10 +import lombok.Data;
11 +import lombok.EqualsAndHashCode;
12 +import lombok.experimental.Accessors;
13 +
14 +import java.io.Serializable;
15 +import java.time.LocalDateTime;
16 +
17 +/**
18 + * @TableName diners
19 + */
20 +@Data
21 +@Accessors(chain = true)
22 +@EqualsAndHashCode(callSuper = true)
23 +@TableName(value ="diners")
24 +public class Diner extends Model<Diner> implements Serializable {
25 +
26 + @TableId(type = IdType.AUTO)
27 + private Integer id;
28 +
29 + private Integer enterpriseId;
30 +
31 + private Integer clientId;
32 +
33 + private Integer classId;
34 +
35 + private String studentNo;
36 +
37 + private String name;
38 +
39 + private Integer createdBy;
40 +
41 + @TableField(fill = FieldFill.INSERT)
42 + private LocalDateTime createdAt;
43 +
44 + private Integer creationSource;
45 +
46 + private Integer updatedBy;
47 +
48 + @TableField(fill = FieldFill.INSERT_UPDATE)
49 + private LocalDateTime updatedAt;
50 +
51 + private Integer updateSource;
52 +
53 + @TableLogic
54 + private Boolean isDeleted;
55 +}
...\ No newline at end of file ...\ No newline at end of file
1 +package com.tianting.infoloop.model.db;
2 +
3 +import com.baomidou.mybatisplus.annotation.FieldFill;
4 +import com.baomidou.mybatisplus.annotation.IdType;
5 +import com.baomidou.mybatisplus.annotation.TableField;
6 +import com.baomidou.mybatisplus.annotation.TableId;
7 +import com.baomidou.mybatisplus.annotation.TableName;
8 +import com.baomidou.mybatisplus.extension.activerecord.Model;
9 +import lombok.Data;
10 +import lombok.EqualsAndHashCode;
11 +import lombok.experimental.Accessors;
12 +
13 +import java.io.Serializable;
14 +import java.time.LocalDateTime;
15 +
16 +/**
17 + * @TableName grade_classes
18 + */
19 +@Data
20 +@Accessors(chain = true)
21 +@EqualsAndHashCode(callSuper = true)
22 +@TableName(value ="grade_classes")
23 +public class GradeClass extends Model<GradeClass> implements Serializable {
24 +
25 + @TableId(type = IdType.AUTO)
26 + private Integer id;
27 +
28 + private Integer enterpriseId;
29 +
30 + private Integer clientId;
31 +
32 + private String gradeName;
33 +
34 + private String className;
35 +
36 + private String fullName;
37 +
38 + private Integer createdBy;
39 +
40 + @TableField(fill = FieldFill.INSERT)
41 + private LocalDateTime createdAt;
42 +
43 + private Integer creationSource;
44 +
45 + private Integer updatedBy;
46 +
47 + @TableField(fill = FieldFill.INSERT_UPDATE)
48 + private LocalDateTime updatedAt;
49 +
50 + private Integer updateSource;
51 +
52 + private Boolean isDeleted;
53 +}
...\ No newline at end of file ...\ No newline at end of file
1 +package com.tianting.infoloop.model.db;
2 +
3 +import com.baomidou.mybatisplus.annotation.FieldFill;
4 +import com.baomidou.mybatisplus.annotation.IdType;
5 +import com.baomidou.mybatisplus.annotation.TableField;
6 +import com.baomidou.mybatisplus.annotation.TableId;
7 +import com.baomidou.mybatisplus.annotation.TableName;
8 +import com.baomidou.mybatisplus.extension.activerecord.Model;
9 +import lombok.Data;
10 +import lombok.EqualsAndHashCode;
11 +import lombok.experimental.Accessors;
12 +
13 +import java.io.Serializable;
14 +import java.time.LocalDateTime;
15 +
16 +/**
17 + * @TableName meal_menu_records
18 + */
19 +@Data
20 +@Accessors(chain = true)
21 +@EqualsAndHashCode(callSuper = true)
22 +@TableName(value ="meal_menu_records")
23 +public class MealMenuRecord extends Model<MealMenuRecord> implements Serializable {
24 +
25 + @TableId(type = IdType.AUTO)
26 + private Integer id;
27 +
28 + private Integer enterpriseId;
29 +
30 + private Integer clientId;
31 +
32 + private String name;
33 +
34 + private String imageUrl;
35 +
36 + private Integer createdBy;
37 +
38 + @TableField(fill = FieldFill.INSERT)
39 + private LocalDateTime createdAt;
40 +
41 + private Integer creationSource;
42 +
43 + private Integer updatedBy;
44 +
45 + @TableField(fill = FieldFill.INSERT_UPDATE)
46 + private LocalDateTime updatedAt;
47 +
48 + private Integer updateSource;
49 +
50 + private Boolean isDeleted;
51 +}
...\ No newline at end of file ...\ No newline at end of file
1 +package com.tianting.infoloop.model.db;
2 +
3 +import com.baomidou.mybatisplus.annotation.FieldFill;
4 +import com.baomidou.mybatisplus.annotation.IdType;
5 +import com.baomidou.mybatisplus.annotation.TableField;
6 +import com.baomidou.mybatisplus.annotation.TableId;
7 +import com.baomidou.mybatisplus.annotation.TableName;
8 +import com.baomidou.mybatisplus.extension.activerecord.Model;
9 +import lombok.Data;
10 +import lombok.EqualsAndHashCode;
11 +import lombok.experimental.Accessors;
12 +
13 +import java.io.Serializable;
14 +import java.time.LocalDateTime;
15 +
16 +/**
17 + * @TableName meal_orders
18 + */
19 +@Data
20 +@Accessors(chain = true)
21 +@EqualsAndHashCode(callSuper = true)
22 +@TableName(value ="meal_orders")
23 +public class MealOrder extends Model<MealOrder> implements Serializable {
24 +
25 + @TableId(type = IdType.AUTO)
26 + private Integer id;
27 +
28 + private Integer enterpriseId;
29 +
30 + private Integer clientId;
31 +
32 + private Integer menuId;
33 +
34 + private Integer accountId;
35 +
36 + private Integer orderMethod;
37 +
38 + private Integer dinerId;
39 +
40 + private String dinerName;
41 +
42 + private String clientName;
43 +
44 + private String gradeName;
45 +
46 + private String className;
47 +
48 + private String studentNo;
49 +
50 + private LocalDateTime reserveDate;
51 +
52 + private String meals;
53 +
54 + private Integer createdBy;
55 +
56 + @TableField(fill = FieldFill.INSERT)
57 + private LocalDateTime createdAt;
58 +
59 + private Integer creationSource;
60 +
61 + private Integer updatedBy;
62 +
63 + @TableField(fill = FieldFill.INSERT_UPDATE)
64 + private LocalDateTime updatedAt;
65 +
66 + private Integer updateSource;
67 +
68 + private Boolean isDeleted;
69 +}
...\ No newline at end of file ...\ No newline at end of file
1 +package com.tianting.infoloop.model.db;
2 +
3 +import com.baomidou.mybatisplus.annotation.FieldFill;
4 +import com.baomidou.mybatisplus.annotation.IdType;
5 +import com.baomidou.mybatisplus.annotation.TableField;
6 +import com.baomidou.mybatisplus.annotation.TableId;
7 +import com.baomidou.mybatisplus.annotation.TableName;
8 +import com.baomidou.mybatisplus.extension.activerecord.Model;
9 +import lombok.Data;
10 +import lombok.EqualsAndHashCode;
11 +import lombok.experimental.Accessors;
12 +
13 +import java.io.Serializable;
14 +import java.time.LocalDateTime;
15 +
16 +/**
17 + * @TableName mp_accounts
18 + */
19 +@Data
20 +@Accessors(chain = true)
21 +@EqualsAndHashCode(callSuper = true)
22 +@TableName(value ="mp_accounts")
23 +public class MpAccount extends Model<MpAccount> implements Serializable {
24 +
25 + @TableId(type = IdType.AUTO)
26 + private Integer id;
27 +
28 + private Integer enterpriseId;
29 +
30 + private String openId;
31 +
32 + private String unionId;
33 +
34 + private String nickname;
35 +
36 + private String avatarUrl;
37 +
38 + private Integer gender;
39 +
40 + private String phoneNumber;
41 +
42 + private Integer status;
43 +
44 + private Integer createdBy;
45 +
46 + @TableField(fill = FieldFill.INSERT)
47 + private LocalDateTime createdAt;
48 +
49 + private Integer creationSource;
50 +
51 + private Integer updatedBy;
52 +
53 + @TableField(fill = FieldFill.INSERT_UPDATE)
54 + private LocalDateTime updatedAt;
55 +
56 + private Integer updateSource;
57 +
58 + private Boolean isDeleted;
59 +}
...\ No newline at end of file ...\ No newline at end of file
1 +package com.tianting.infoloop.model.db;
2 +
3 +import com.baomidou.mybatisplus.annotation.FieldFill;
4 +import com.baomidou.mybatisplus.annotation.IdType;
5 +import com.baomidou.mybatisplus.annotation.TableField;
6 +import com.baomidou.mybatisplus.annotation.TableId;
7 +import com.baomidou.mybatisplus.annotation.TableName;
8 +import com.baomidou.mybatisplus.extension.activerecord.Model;
9 +import lombok.Data;
10 +import lombok.EqualsAndHashCode;
11 +import lombok.experimental.Accessors;
12 +
13 +import java.io.Serializable;
14 +import java.time.LocalDateTime;
15 +
16 +/**
17 + * @TableName mp_account_diner_refs
18 + */
19 +@Data
20 +@Accessors(chain = true)
21 +@EqualsAndHashCode(callSuper = true)
22 +@TableName(value ="mp_account_diner_refs")
23 +public class MpAccountDinerRef extends Model<MpAccountDinerRef> implements Serializable {
24 +
25 + @TableId(type = IdType.AUTO)
26 + private Integer id;
27 +
28 + private Integer enterpriseId;
29 +
30 + private Integer accountId;
31 +
32 + private Integer dinerId;
33 +
34 + private Integer createdBy;
35 +
36 + @TableField(fill = FieldFill.INSERT)
37 + private LocalDateTime createdAt;
38 +
39 + private Integer creationSource;
40 +}
...\ No newline at end of file ...\ No newline at end of file
1 +package com.tianting.infoloop.service;
2 +
3 +import com.baomidou.mybatisplus.extension.service.IService;
4 +import com.tianting.infoloop.model.db.Diner;
5 +
6 +/**
7 +* @author zhuyf
8 +* @description 针对表【diners(就餐人表)】的数据库操作Service
9 +* @createDate 2025-04-10 13:22:20
10 +*/
11 +public interface DinerService extends IService<Diner> {
12 +
13 +}
1 +package com.tianting.infoloop.service;
2 +
3 +import com.baomidou.mybatisplus.extension.service.IService;
4 +import com.tianting.infoloop.model.db.GradeClass;
5 +
6 +/**
7 +* @author zhuyf
8 +* @description 针对表【grade_classes(年级班级表)】的数据库操作Service
9 +* @createDate 2025-04-10 13:22:20
10 +*/
11 +public interface GradeClassService extends IService<GradeClass> {
12 +
13 +}
1 +package com.tianting.infoloop.service;
2 +
3 +import com.baomidou.mybatisplus.extension.service.IService;
4 +import com.tianting.infoloop.model.db.MealMenuRecord;
5 +
6 +/**
7 +* @author zhuyf
8 +* @description 针对表【meal_menu_records(餐单记录表)】的数据库操作Service
9 +* @createDate 2025-04-10 13:22:20
10 +*/
11 +public interface MealMenuRecordService extends IService<MealMenuRecord> {
12 +
13 +}
1 +package com.tianting.infoloop.service;
2 +
3 +import com.baomidou.mybatisplus.extension.service.IService;
4 +import com.tianting.infoloop.model.db.MealOrder;
5 +
6 +/**
7 +* @author zhuyf
8 +* @description 针对表【meal_orders(订餐记录表)】的数据库操作Service
9 +* @createDate 2025-04-10 13:22:20
10 +*/
11 +public interface MealOrderService extends IService<MealOrder> {
12 +
13 +}
1 +package com.tianting.infoloop.service;
2 +
3 +import com.baomidou.mybatisplus.extension.service.IService;
4 +import com.tianting.infoloop.model.db.MpAccountDinerRef;
5 +
6 +/**
7 +* @author zhuyf
8 +* @description 针对表【mp_account_diner_refs(小程序账号和就餐人关联表)】的数据库操作Service
9 +* @createDate 2025-04-10 13:22:20
10 +*/
11 +public interface MpAccountDinerRefService extends IService<MpAccountDinerRef> {
12 +
13 +}
1 +package com.tianting.infoloop.service;
2 +
3 +import com.baomidou.mybatisplus.extension.service.IService;
4 +import com.tianting.infoloop.model.db.MpAccount;
5 +
6 +/**
7 +* @author zhuyf
8 +* @description 针对表【mp_accounts(小程序账号表)】的数据库操作Service
9 +* @createDate 2025-04-10 13:22:20
10 +*/
11 +public interface MpAccountService extends IService<MpAccount> {
12 +
13 +}
1 +package com.tianting.infoloop.service.grpc;
2 +
3 +import cn.hutool.core.date.LocalDateTimeUtil;
4 +import com.baomidou.dynamic.datasource.annotation.DS;
5 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
6 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
7 +import com.infoloop.tianting.mealorderservice.BatchCreateGradeClassesRpcRequest;
8 +import com.infoloop.tianting.mealorderservice.BatchCreateGradeClassesRpcResponse;
9 +import com.infoloop.tianting.mealorderservice.BatchCreateMealOrdersRpcRequest;
10 +import com.infoloop.tianting.mealorderservice.BatchCreateMealOrdersRpcResponse;
11 +import com.infoloop.tianting.mealorderservice.BatchSaveOrUpdateDinersRpcRequest;
12 +import com.infoloop.tianting.mealorderservice.BatchSaveOrUpdateDinersRpcResponse;
13 +import com.infoloop.tianting.mealorderservice.BatchSaveOrUpdateGradeClassesRpcRequest;
14 +import com.infoloop.tianting.mealorderservice.BatchSaveOrUpdateGradeClassesRpcResponse;
15 +import com.infoloop.tianting.mealorderservice.CreateDinerRpcRequest;
16 +import com.infoloop.tianting.mealorderservice.CreateDinerRpcResponse;
17 +import com.infoloop.tianting.mealorderservice.CreateGradeClassRpcRequest;
18 +import com.infoloop.tianting.mealorderservice.CreateGradeClassRpcResponse;
19 +import com.infoloop.tianting.mealorderservice.CreateMealMenuRecordRpcRequest;
20 +import com.infoloop.tianting.mealorderservice.CreateMealMenuRecordRpcResponse;
21 +import com.infoloop.tianting.mealorderservice.CreateMealOrderRpcRequest;
22 +import com.infoloop.tianting.mealorderservice.CreateMealOrderRpcResponse;
23 +import com.infoloop.tianting.mealorderservice.CreateMpAccountDinerRefRpcRequest;
24 +import com.infoloop.tianting.mealorderservice.CreateMpAccountDinerRefRpcResponse;
25 +import com.infoloop.tianting.mealorderservice.CreateMpAccountRpcRequest;
26 +import com.infoloop.tianting.mealorderservice.CreateMpAccountRpcResponse;
27 +import com.infoloop.tianting.mealorderservice.DeleteDinersByIdsRpcRequest;
28 +import com.infoloop.tianting.mealorderservice.DeleteDinersRpcResponse;
29 +import com.infoloop.tianting.mealorderservice.DeleteGradeClassesAndDinersByClientIdsRpcRequest;
30 +import com.infoloop.tianting.mealorderservice.DeleteGradeClassesAndDinersByClientIdsRpcResponse;
31 +import com.infoloop.tianting.mealorderservice.DeleteGradeClassesByIdsRpcRequest;
32 +import com.infoloop.tianting.mealorderservice.DeleteGradeClassesRpcResponse;
33 +import com.infoloop.tianting.mealorderservice.DeleteMealOrdersByIdsRpcRequest;
34 +import com.infoloop.tianting.mealorderservice.DeleteMealOrdersRpcResponse;
35 +import com.infoloop.tianting.mealorderservice.DeleteMpAccountDinerRefsByIdsRpcRequest;
36 +import com.infoloop.tianting.mealorderservice.DeleteMpAccountDinerRefsRpcResponse;
37 +import com.infoloop.tianting.mealorderservice.DeleteMpAccountsByIdsRpcRequest;
38 +import com.infoloop.tianting.mealorderservice.DeleteMpAccountsRpcResponse;
39 +import com.infoloop.tianting.mealorderservice.DinerModification;
40 +import com.infoloop.tianting.mealorderservice.GetDinerByIdRpcRequest;
41 +import com.infoloop.tianting.mealorderservice.GetDinerByIdRpcResponse;
42 +import com.infoloop.tianting.mealorderservice.GetDinersByIdsRpcRequest;
43 +import com.infoloop.tianting.mealorderservice.GetDinersByIdsRpcResponse;
44 +import com.infoloop.tianting.mealorderservice.GetGradeClassByIdRpcRequest;
45 +import com.infoloop.tianting.mealorderservice.GetGradeClassByIdRpcResponse;
46 +import com.infoloop.tianting.mealorderservice.GetGradeClassesByIdsRpcRequest;
47 +import com.infoloop.tianting.mealorderservice.GetGradeClassesByIdsRpcResponse;
48 +import com.infoloop.tianting.mealorderservice.GetMealMenuRecordByIdRpcRequest;
49 +import com.infoloop.tianting.mealorderservice.GetMealMenuRecordByIdRpcResponse;
50 +import com.infoloop.tianting.mealorderservice.GetMealMenuRecordsByIdsRpcRequest;
51 +import com.infoloop.tianting.mealorderservice.GetMealMenuRecordsByIdsRpcResponse;
52 +import com.infoloop.tianting.mealorderservice.GetMealOrderByIdRpcRequest;
53 +import com.infoloop.tianting.mealorderservice.GetMealOrderByIdRpcResponse;
54 +import com.infoloop.tianting.mealorderservice.GetMealOrdersByIdsRpcRequest;
55 +import com.infoloop.tianting.mealorderservice.GetMealOrdersByIdsRpcResponse;
56 +import com.infoloop.tianting.mealorderservice.GetMpAccountByIdRpcRequest;
57 +import com.infoloop.tianting.mealorderservice.GetMpAccountByIdRpcResponse;
58 +import com.infoloop.tianting.mealorderservice.GetMpAccountByOpenIdRpcRequest;
59 +import com.infoloop.tianting.mealorderservice.GetMpAccountByOpenIdRpcResponse;
60 +import com.infoloop.tianting.mealorderservice.GetMpAccountDinerRefsByIdsRpcRequest;
61 +import com.infoloop.tianting.mealorderservice.GetMpAccountDinerRefsByIdsRpcResponse;
62 +import com.infoloop.tianting.mealorderservice.GetMpAccountsByIdsRpcRequest;
63 +import com.infoloop.tianting.mealorderservice.GetMpAccountsByIdsRpcResponse;
64 +import com.infoloop.tianting.mealorderservice.MealOrderServiceRpcGrpc;
65 +import com.infoloop.tianting.mealorderservice.QueryDinersByConditionRpcRequest;
66 +import com.infoloop.tianting.mealorderservice.QueryDinersByConditionRpcResponse;
67 +import com.infoloop.tianting.mealorderservice.QueryGradeClassesByConditionRpcRequest;
68 +import com.infoloop.tianting.mealorderservice.QueryGradeClassesByConditionRpcResponse;
69 +import com.infoloop.tianting.mealorderservice.QueryLatestMealMenuRecordsByClientIdsRpcRequest;
70 +import com.infoloop.tianting.mealorderservice.QueryLatestMealMenuRecordsByClientIdsRpcResponse;
71 +import com.infoloop.tianting.mealorderservice.QueryMealMenuRecordsByConditionRpcRequest;
72 +import com.infoloop.tianting.mealorderservice.QueryMealMenuRecordsByConditionRpcResponse;
73 +import com.infoloop.tianting.mealorderservice.QueryMealOrdersByConditionRpcRequest;
74 +import com.infoloop.tianting.mealorderservice.QueryMealOrdersByConditionRpcResponse;
75 +import com.infoloop.tianting.mealorderservice.QueryMpAccountDinerRefsByConditionRpcRequest;
76 +import com.infoloop.tianting.mealorderservice.QueryMpAccountDinerRefsByConditionRpcResponse;
77 +import com.infoloop.tianting.mealorderservice.QueryMpAccountsByConditionRpcRequest;
78 +import com.infoloop.tianting.mealorderservice.QueryMpAccountsByConditionRpcResponse;
79 +import com.infoloop.tianting.mealorderservice.QueryReserveMealOrdersByDinerIdsRpcRequest;
80 +import com.infoloop.tianting.mealorderservice.QueryReserveMealOrdersByDinerIdsRpcResponse;
81 +import com.infoloop.tianting.mealorderservice.SingleDinerRpcResponse;
82 +import com.infoloop.tianting.mealorderservice.SingleGradeClassRpcResponse;
83 +import com.infoloop.tianting.mealorderservice.SingleMealMenuRecordRpcResponse;
84 +import com.infoloop.tianting.mealorderservice.SingleMealOrderRpcResponse;
85 +import com.infoloop.tianting.mealorderservice.SingleMpAccountDinerRefRpcResponse;
86 +import com.infoloop.tianting.mealorderservice.SingleMpAccountRpcResponse;
87 +import com.infoloop.tianting.mealorderservice.UpdateDinerRpcRequest;
88 +import com.infoloop.tianting.mealorderservice.UpdateDinerRpcResponse;
89 +import com.infoloop.tianting.mealorderservice.UpdateGradeClassRpcRequest;
90 +import com.infoloop.tianting.mealorderservice.UpdateGradeClassRpcResponse;
91 +import com.infoloop.tianting.mealorderservice.UpdateMpAccountRpcRequest;
92 +import com.infoloop.tianting.mealorderservice.UpdateMpAccountRpcResponse;
93 +import com.tianting.infoloop.model.db.Diner;
94 +import com.tianting.infoloop.model.db.GradeClass;
95 +import com.tianting.infoloop.model.db.MealMenuRecord;
96 +import com.tianting.infoloop.model.db.MealOrder;
97 +import com.tianting.infoloop.model.db.MpAccount;
98 +import com.tianting.infoloop.model.db.MpAccountDinerRef;
99 +import com.tianting.infoloop.service.DinerService;
100 +import com.tianting.infoloop.service.GradeClassService;
101 +import com.tianting.infoloop.service.MealMenuRecordService;
102 +import com.tianting.infoloop.service.MealOrderService;
103 +import com.tianting.infoloop.service.MpAccountDinerRefService;
104 +import com.tianting.infoloop.service.MpAccountService;
105 +import com.tianting.infoloop.utils.ProtoBeanUtil;
106 +import io.grpc.Status;
107 +import io.grpc.stub.StreamObserver;
108 +import lombok.RequiredArgsConstructor;
109 +import lombok.extern.slf4j.Slf4j;
110 +import org.springframework.beans.factory.annotation.Autowired;
111 +import org.springframework.stereotype.Service;
112 +import org.springframework.transaction.annotation.Transactional;
113 +
114 +import java.time.DayOfWeek;
115 +import java.time.LocalDate;
116 +import java.time.LocalDateTime;
117 +import java.time.LocalTime;
118 +import java.time.temporal.TemporalAdjusters;
119 +import java.util.ArrayList;
120 +import java.util.List;
121 +import java.util.function.Function;
122 +import java.util.stream.Collectors;
123 +
124 +import static com.tianting.infoloop.constants.ConfigConstants.DATA_SOURCE_MASTER;
125 +import static com.tianting.infoloop.constants.ConfigConstants.DATA_SOURCE_SLAVE;
126 +
127 +@Slf4j
128 +@Service
129 +@RequiredArgsConstructor(onConstructor_ = @Autowired)
130 +public class MealOrderGrpcService extends MealOrderServiceRpcGrpc.MealOrderServiceRpcImplBase {
131 +
132 + private final DinerService dinerService;
133 +
134 + private final GradeClassService gradeClassService;
135 +
136 + private final MealMenuRecordService mealMenuRecordService;
137 +
138 + private final MealOrderService mealOrderService;
139 +
140 + private final MpAccountDinerRefService mpAccountDinerRefService;
141 +
142 + private final MpAccountService mpAccountService;
143 +
144 + @Override
145 + @DS(DATA_SOURCE_SLAVE)
146 + public void getMealOrderById(final GetMealOrderByIdRpcRequest request,
147 + final StreamObserver<GetMealOrderByIdRpcResponse> responseObserver) {
148 + final var builder = GetMealOrderByIdRpcResponse.newBuilder();
149 + try {
150 + final var mealOrder = mealOrderService.getById(request.getId());
151 + if (mealOrder != null) {
152 + builder.setResponse(ProtoBeanUtil.beanToProto(mealOrder, SingleMealOrderRpcResponse.class));
153 + }
154 + } catch (final Exception e) {
155 + log.error("getMealOrderById error;", e);
156 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
157 + }
158 + responseObserver.onNext(builder.build());
159 + responseObserver.onCompleted();
160 + }
161 +
162 + @Override
163 + @DS(DATA_SOURCE_SLAVE)
164 + public void getMealOrdersByIds(final GetMealOrdersByIdsRpcRequest request,
165 + final StreamObserver<GetMealOrdersByIdsRpcResponse> responseObserver) {
166 + final var builder = GetMealOrdersByIdsRpcResponse.newBuilder();
167 + try {
168 + final var mealOrders = mealOrderService.listByIds(request.getIdsList());
169 + if (!mealOrders.isEmpty()) {
170 + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(mealOrders, SingleMealOrderRpcResponse.class));
171 + }
172 + } catch (final Exception e) {
173 + log.error("getMealOrdersByIds error;", e);
174 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
175 + }
176 + responseObserver.onNext(builder.build());
177 + responseObserver.onCompleted();
178 + }
179 +
180 + @Override
181 + @DS(DATA_SOURCE_SLAVE)
182 + public void queryMealOrdersByCondition(final QueryMealOrdersByConditionRpcRequest request,
183 + final StreamObserver<QueryMealOrdersByConditionRpcResponse> responseObserver) {
184 + final var builder = QueryMealOrdersByConditionRpcResponse.newBuilder();
185 + try {
186 + LambdaQueryWrapper<MealOrder> queryWrapper = new LambdaQueryWrapper<>();
187 + queryWrapper.eq(MealOrder::getEnterpriseId, request.getEnterpriseId());
188 + if (request.getShouldFilterClientIds()) {
189 + queryWrapper.in(!request.getClientIdsList().isEmpty(), MealOrder::getClientId, request.getClientIdsList());
190 + }
191 + if (request.getShouldFilterMenuIds()) {
192 + queryWrapper.in(!request.getMenuIdsList().isEmpty(), MealOrder::getMenuId, request.getMenuIdsList());
193 + }
194 + if (request.getShouldFilterAccountIds()) {
195 + queryWrapper.in(!request.getAccountIdsList().isEmpty(), MealOrder::getAccountId, request.getAccountIdsList());
196 + }
197 + if (request.getShouldFilterOrderMethod()) {
198 + queryWrapper.eq(MealOrder::getOrderMethod, request.getOrderMethodValue());
199 + }
200 + if (request.getShouldFilterDinerIds()) {
201 + queryWrapper.in(!request.getDinerIdsList().isEmpty(), MealOrder::getDinerId, request.getDinerIdsList());
202 + }
203 + if (request.getShouldFilterReserveDateStart()) {
204 + queryWrapper.ge(MealOrder::getReserveDate, LocalDateTimeUtil.of(request.getReserveDateStart()));
205 + }
206 + if (request.getShouldFilterReserveDateEnd()) {
207 + queryWrapper.lt(MealOrder::getReserveDate, LocalDateTimeUtil.of(request.getReserveDateEnd()));
208 + }
209 + final var mealOrders = mealOrderService.list(queryWrapper);
210 + if (!mealOrders.isEmpty()) {
211 + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(mealOrders, SingleMealOrderRpcResponse.class));
212 + }
213 + } catch (final Exception e) {
214 + log.error("queryMealOrdersByCondition error;", e);
215 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
216 + }
217 + responseObserver.onNext(builder.build());
218 + responseObserver.onCompleted();
219 + }
220 +
221 + @Override
222 + @DS(DATA_SOURCE_SLAVE)
223 + public void queryReserveMealOrdersByDinerIds(final QueryReserveMealOrdersByDinerIdsRpcRequest request,
224 + final StreamObserver<QueryReserveMealOrdersByDinerIdsRpcResponse> responseObserver) {
225 + final var builder = QueryReserveMealOrdersByDinerIdsRpcResponse.newBuilder();
226 + try {
227 + LambdaQueryWrapper<MealOrder> queryWrapper = new LambdaQueryWrapper<>();
228 + queryWrapper.eq(MealOrder::getEnterpriseId, request.getEnterpriseId());
229 + queryWrapper.in(!request.getDinerIdsList().isEmpty(), MealOrder::getDinerId, request.getDinerIdsList());
230 + LocalDate today = LocalDate.now();
231 + LocalDate nextMonday = today.with(TemporalAdjusters.next(DayOfWeek.MONDAY));
232 + LocalDateTime nextMondayStart = LocalDateTime.of(nextMonday, LocalTime.MIN);
233 + LocalDate nextSunday = nextMonday.with(TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY));
234 + LocalDateTime nextSundayEnd = LocalDateTime.of(nextSunday, LocalTime.MAX);
235 + queryWrapper.ge(MealOrder::getReserveDate, nextMondayStart);
236 + queryWrapper.lt(MealOrder::getReserveDate, nextSundayEnd);
237 + final var mealOrders = mealOrderService.list(queryWrapper);
238 + if (!mealOrders.isEmpty()) {
239 + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(mealOrders, SingleMealOrderRpcResponse.class));
240 + }
241 + } catch (final Exception e) {
242 + log.error("queryReserveMealOrdersByDinerIds error;", e);
243 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
244 + }
245 + responseObserver.onNext(builder.build());
246 + responseObserver.onCompleted();
247 + }
248 +
249 + @Override
250 + @DS(DATA_SOURCE_MASTER)
251 + public void createMealOrder(final CreateMealOrderRpcRequest request,
252 + final StreamObserver<CreateMealOrderRpcResponse> responseObserver) {
253 + final var builder = CreateMealOrderRpcResponse.newBuilder();
254 + try {
255 + MealOrder mealOrder = new MealOrder();
256 + mealOrder.setEnterpriseId(request.getEnterpriseId());
257 + mealOrder.setCreatedBy(request.getCreatedBy());
258 + mealOrder.setCreationSource(request.getCreationSource());
259 + mealOrder.setClientId(request.getCreation().getClientId());
260 + mealOrder.setMenuId(request.getCreation().getMenuId());
261 + mealOrder.setAccountId(request.getCreation().getAccountId());
262 + mealOrder.setOrderMethod(request.getCreation().getOrderMethodValue());
263 + mealOrder.setDinerId(request.getCreation().getDinerId());
264 + mealOrder.setDinerName(request.getCreation().getDinerName());
265 + mealOrder.setClientName(request.getCreation().getClientName());
266 + mealOrder.setGradeName(request.getCreation().getGradeName());
267 + mealOrder.setClassName(request.getCreation().getClassName());
268 + mealOrder.setStudentNo(request.getCreation().getStudentNo());
269 + mealOrder.setReserveDate(LocalDateTimeUtil.of(request.getCreation().getReserveDate()));
270 + mealOrder.setMeals(ProtoBeanUtil.protoListToJson(request.getCreation().getMealsList()));
271 + builder.setIsCreated(mealOrderService.save(mealOrder)).setId(mealOrder.getId());
272 + } catch (final Exception e) {
273 + log.error("createMealOrder error;", e);
274 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
275 + }
276 + responseObserver.onNext(builder.build());
277 + responseObserver.onCompleted();
278 + }
279 +
280 + @Override
281 + @DS(DATA_SOURCE_MASTER)
282 + public void batchCreateMealOrders(final BatchCreateMealOrdersRpcRequest request,
283 + final StreamObserver<BatchCreateMealOrdersRpcResponse> responseObserver) {
284 + final var builder = BatchCreateMealOrdersRpcResponse.newBuilder();
285 + try {
286 + final var mealOrders = new ArrayList<MealOrder>();
287 + for (final var creation : request.getCreationsList()) {
288 + MealOrder mealOrder = new MealOrder();
289 + mealOrder.setEnterpriseId(request.getEnterpriseId());
290 + mealOrder.setCreatedBy(request.getCreatedBy());
291 + mealOrder.setCreationSource(request.getCreationSource());
292 + mealOrder.setClientId(creation.getClientId());
293 + mealOrder.setMenuId(creation.getMenuId());
294 + mealOrder.setAccountId(creation.getAccountId());
295 + mealOrder.setOrderMethod(creation.getOrderMethodValue());
296 + mealOrder.setDinerId(creation.getDinerId());
297 + mealOrder.setDinerName(creation.getDinerName());
298 + mealOrder.setClientName(creation.getClientName());
299 + mealOrder.setGradeName(creation.getGradeName());
300 + mealOrder.setClassName(creation.getClassName());
301 + mealOrder.setStudentNo(creation.getStudentNo());
302 + mealOrder.setReserveDate(LocalDateTimeUtil.of(creation.getReserveDate()));
303 + mealOrder.setMeals(ProtoBeanUtil.protoListToJson(creation.getMealsList()));
304 + mealOrders.add(mealOrder);
305 + }
306 + builder.setIsCreated(mealOrderService.saveBatch(mealOrders)).addAllIds(mealOrders.stream().map(MealOrder::getId).toList());
307 + } catch (final Exception e) {
308 + log.error("batchCreateMealOrders error;", e);
309 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
310 + }
311 + responseObserver.onNext(builder.build());
312 + responseObserver.onCompleted();
313 + }
314 +
315 + @Override
316 + @DS(DATA_SOURCE_MASTER)
317 + public void deleteMealOrdersByIds(final DeleteMealOrdersByIdsRpcRequest request,
318 + final StreamObserver<DeleteMealOrdersRpcResponse> responseObserver) {
319 + final var builder = DeleteMealOrdersRpcResponse.newBuilder();
320 + try {
321 + builder.setIsDeleted(mealOrderService.removeBatchByIds(request.getIdsList()));
322 + } catch (final Exception e) {
323 + log.error("deleteMealOrdersByIds error;", e);
324 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
325 + }
326 + responseObserver.onNext(builder.build());
327 + responseObserver.onCompleted();
328 + }
329 +
330 + @Override
331 + @DS(DATA_SOURCE_SLAVE)
332 + public void getMpAccountById(final GetMpAccountByIdRpcRequest request,
333 + final StreamObserver<GetMpAccountByIdRpcResponse> responseObserver) {
334 + final var builder = GetMpAccountByIdRpcResponse.newBuilder();
335 + try {
336 + final var mealOrder = mpAccountService.getById(request.getId());
337 + if (mealOrder != null) {
338 + builder.setResponse(ProtoBeanUtil.beanToProto(mealOrder, SingleMpAccountRpcResponse.class));
339 + }
340 + } catch (final Exception e) {
341 + log.error("getMpAccountById error;", e);
342 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
343 + }
344 + responseObserver.onNext(builder.build());
345 + responseObserver.onCompleted();
346 + }
347 +
348 + @Override
349 + @DS(DATA_SOURCE_SLAVE)
350 + public void getMpAccountByOpenId(final GetMpAccountByOpenIdRpcRequest request,
351 + final StreamObserver<GetMpAccountByOpenIdRpcResponse> responseObserver) {
352 + final var builder = GetMpAccountByOpenIdRpcResponse.newBuilder();
353 + try {
354 + LambdaQueryWrapper<MpAccount> queryWrapper = Wrappers.lambdaQuery();
355 + queryWrapper.eq(MpAccount::getOpenId, request.getOpenId());
356 + final var mpAccount = mpAccountService.getOne(queryWrapper);
357 + if (mpAccount != null) {
358 + builder.setResponse(ProtoBeanUtil.beanToProto(mpAccount, SingleMpAccountRpcResponse.class));
359 + }
360 + } catch (final Exception e) {
361 + log.error("getMpAccountByOpenId error;", e);
362 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
363 + }
364 + responseObserver.onNext(builder.build());
365 + responseObserver.onCompleted();
366 + }
367 +
368 + @Override
369 + @DS(DATA_SOURCE_SLAVE)
370 + public void getMpAccountsByIds(final GetMpAccountsByIdsRpcRequest request,
371 + final StreamObserver<GetMpAccountsByIdsRpcResponse> responseObserver) {
372 + final var builder = GetMpAccountsByIdsRpcResponse.newBuilder();
373 + try {
374 + final var mealOrders = mpAccountService.listByIds(request.getIdsList());
375 + if (!mealOrders.isEmpty()) {
376 + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(mealOrders, SingleMpAccountRpcResponse.class));
377 + }
378 + } catch (final Exception e) {
379 + log.error("getMpAccountsByIds error;", e);
380 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
381 + }
382 + responseObserver.onNext(builder.build());
383 + responseObserver.onCompleted();
384 + }
385 +
386 + @Override
387 + @DS(DATA_SOURCE_SLAVE)
388 + public void queryMpAccountsByCondition(final QueryMpAccountsByConditionRpcRequest request,
389 + final StreamObserver<QueryMpAccountsByConditionRpcResponse> responseObserver) {
390 + final var builder = QueryMpAccountsByConditionRpcResponse.newBuilder();
391 + try {
392 + LambdaQueryWrapper<MpAccount> queryWrapper = new LambdaQueryWrapper<>();
393 + queryWrapper.eq(MpAccount::getEnterpriseId, request.getEnterpriseId());
394 + if (request.getShouldFilterOpenId()) {
395 + queryWrapper.eq(MpAccount::getOpenId, request.getOpenId());
396 + }
397 + if (request.getShouldFilterUnionId()) {
398 + queryWrapper.eq(MpAccount::getUnionId, request.getUnionId());
399 + }
400 + if (request.getShouldFilterPhoneNumber()) {
401 + queryWrapper.eq(MpAccount::getPhoneNumber, request.getPhoneNumber());
402 + }
403 + if (request.getShouldFilterStatus()) {
404 + queryWrapper.eq(MpAccount::getStatus, request.getStatusValue());
405 + }
406 + final var mealOrders = mpAccountService.list(queryWrapper);
407 + if (!mealOrders.isEmpty()) {
408 + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(mealOrders, SingleMpAccountRpcResponse.class));
409 + }
410 + } catch (final Exception e) {
411 + log.error("queryMpAccountsByCondition error;", e);
412 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
413 + }
414 + responseObserver.onNext(builder.build());
415 + responseObserver.onCompleted();
416 + }
417 +
418 + @Override
419 + @DS(DATA_SOURCE_MASTER)
420 + public void createMpAccount(final CreateMpAccountRpcRequest request,
421 + final StreamObserver<CreateMpAccountRpcResponse> responseObserver) {
422 + final var builder = CreateMpAccountRpcResponse.newBuilder();
423 + try {
424 + MpAccount mpAccount = new MpAccount();
425 + mpAccount.setEnterpriseId(request.getEnterpriseId());
426 + mpAccount.setCreatedBy(request.getCreatedBy());
427 + mpAccount.setCreationSource(request.getCreationSource());
428 + mpAccount.setOpenId(request.getCreation().getOpenId());
429 + if (request.getCreation().getShouldCreateUnionId()) {
430 + mpAccount.setUnionId(request.getCreation().getUnionId());
431 + }
432 + if (request.getCreation().getShouldCreateNickname()) {
433 + mpAccount.setNickname(request.getCreation().getNickname());
434 + }
435 + if (request.getCreation().getShouldCreateAvatarUrl()) {
436 + mpAccount.setAvatarUrl(request.getCreation().getAvatarUrl());
437 + }
438 + mpAccount.setGender(request.getCreation().getGenderValue());
439 + mpAccount.setPhoneNumber(request.getCreation().getPhoneNumber());
440 + mpAccount.setStatus(request.getCreation().getStatusValue());
441 + builder.setIsCreated(mpAccountService.save(mpAccount)).setId(mpAccount.getId());
442 + } catch (final Exception e) {
443 + log.error("createMpAccount error;", e);
444 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
445 + }
446 + responseObserver.onNext(builder.build());
447 + responseObserver.onCompleted();
448 + }
449 +
450 + @Override
451 + @DS(DATA_SOURCE_MASTER)
452 + public void updateMpAccount(final UpdateMpAccountRpcRequest request,
453 + final StreamObserver<UpdateMpAccountRpcResponse> responseObserver) {
454 + final var builder = UpdateMpAccountRpcResponse.newBuilder();
455 + try {
456 + MpAccount mpAccount = new MpAccount();
457 + mpAccount.setId(request.getModification().getId());
458 + mpAccount.setEnterpriseId(request.getEnterpriseId());
459 + mpAccount.setUpdatedBy(request.getUpdatedBy());
460 + mpAccount.setUpdateSource(request.getUpdateSource());
461 + if (request.getModification().getShouldUpdateNickname()) {
462 + mpAccount.setNickname(request.getModification().getNickname());
463 + }
464 + if (request.getModification().getShouldUpdateAvatarUrl()) {
465 + mpAccount.setAvatarUrl(request.getModification().getAvatarUrl());
466 + }
467 + if (request.getModification().getShouldUpdateGender()) {
468 + mpAccount.setGender(request.getModification().getGenderValue());
469 + }
470 + if (request.getModification().getShouldUpdatePhoneNumber()) {
471 + mpAccount.setPhoneNumber(request.getModification().getPhoneNumber());
472 + }
473 + if (request.getModification().getShouldUpdateStatus()) {
474 + mpAccount.setStatus(request.getModification().getStatusValue());
475 + }
476 + builder.setIsUpdated(mpAccountService.updateById(mpAccount));
477 + } catch (final Exception e) {
478 + log.error("updateMpAccount error;", e);
479 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
480 + }
481 + responseObserver.onNext(builder.build());
482 + responseObserver.onCompleted();
483 + }
484 +
485 + @Override
486 + @DS(DATA_SOURCE_MASTER)
487 + public void deleteMpAccountsByIds(final DeleteMpAccountsByIdsRpcRequest request,
488 + final StreamObserver<DeleteMpAccountsRpcResponse> responseObserver) {
489 + final var builder = DeleteMpAccountsRpcResponse.newBuilder();
490 + try {
491 + builder.setIsDeleted(mpAccountService.removeBatchByIds(request.getIdsList()));
492 + } catch (final Exception e) {
493 + log.error("deleteMpAccountsByIds error;", e);
494 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
495 + }
496 + responseObserver.onNext(builder.build());
497 + responseObserver.onCompleted();
498 + }
499 +
500 + @Override
501 + @DS(DATA_SOURCE_SLAVE)
502 + public void getDinerById(final GetDinerByIdRpcRequest request,
503 + final StreamObserver<GetDinerByIdRpcResponse> responseObserver) {
504 + final var builder = GetDinerByIdRpcResponse.newBuilder();
505 + try {
506 + final var mealOrder = dinerService.getById(request.getId());
507 + if (mealOrder != null) {
508 + builder.setResponse(ProtoBeanUtil.beanToProto(mealOrder, SingleDinerRpcResponse.class));
509 + }
510 + } catch (final Exception e) {
511 + log.error("getDinerById error;", e);
512 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
513 + }
514 + responseObserver.onNext(builder.build());
515 + responseObserver.onCompleted();
516 + }
517 +
518 + @Override
519 + @DS(DATA_SOURCE_SLAVE)
520 + public void getDinersByIds(final GetDinersByIdsRpcRequest request,
521 + final StreamObserver<GetDinersByIdsRpcResponse> responseObserver) {
522 + final var builder = GetDinersByIdsRpcResponse.newBuilder();
523 + try {
524 + final var mealOrders = dinerService.listByIds(request.getIdsList());
525 + if (!mealOrders.isEmpty()) {
526 + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(mealOrders, SingleDinerRpcResponse.class));
527 + }
528 + } catch (final Exception e) {
529 + log.error("getDinersByIds error;", e);
530 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
531 + }
532 + responseObserver.onNext(builder.build());
533 + responseObserver.onCompleted();
534 + }
535 +
536 + @Override
537 + @DS(DATA_SOURCE_SLAVE)
538 + public void queryDinersByCondition(final QueryDinersByConditionRpcRequest request,
539 + final StreamObserver<QueryDinersByConditionRpcResponse> responseObserver) {
540 + final var builder = QueryDinersByConditionRpcResponse.newBuilder();
541 + try {
542 + LambdaQueryWrapper<Diner> queryWrapper = new LambdaQueryWrapper<>();
543 + queryWrapper.eq(Diner::getEnterpriseId, request.getEnterpriseId());
544 + if (request.getShouldFilterClientIds()) {
545 + queryWrapper.in(!request.getClientIdsList().isEmpty(), Diner::getClientId, request.getClientIdsList());
546 + }
547 + if (request.getShouldFilterClassIds()) {
548 + queryWrapper.in(!request.getClassIdsList().isEmpty(), Diner::getClassId, request.getClassIdsList());
549 + }
550 + if (request.getShouldFilterStudentNo()) {
551 + queryWrapper.eq(Diner::getStudentNo, request.getStudentNo());
552 + }
553 + if (request.getShouldFilterName()) {
554 + queryWrapper.eq(Diner::getName, request.getName());
555 + }
556 + final var diners = dinerService.list(queryWrapper);
557 + if (!diners.isEmpty()) {
558 + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(diners, SingleDinerRpcResponse.class));
559 + }
560 + } catch (final Exception e) {
561 + log.error("queryDinersByCondition error;", e);
562 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
563 + }
564 + responseObserver.onNext(builder.build());
565 + responseObserver.onCompleted();
566 + }
567 +
568 + @Override
569 + @DS(DATA_SOURCE_MASTER)
570 + public void createDiner(final CreateDinerRpcRequest request,
571 + final StreamObserver<CreateDinerRpcResponse> responseObserver) {
572 + final var builder = CreateDinerRpcResponse.newBuilder();
573 + try {
574 + Diner diner = new Diner();
575 + diner.setEnterpriseId(request.getEnterpriseId());
576 + diner.setCreatedBy(request.getCreatedBy());
577 + diner.setCreationSource(request.getCreationSource());
578 + diner.setClientId(request.getCreation().getClientId());
579 + diner.setClassId(request.getCreation().getClassId());
580 + diner.setStudentNo(request.getCreation().getStudentNo());
581 + diner.setName(request.getCreation().getName());
582 + builder.setIsCreated(dinerService.save(diner)).setId(diner.getId());
583 + } catch (final Exception e) {
584 + log.error("createDiner error;", e);
585 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
586 + }
587 + responseObserver.onNext(builder.build());
588 + responseObserver.onCompleted();
589 + }
590 +
591 + @Override
592 + @DS(DATA_SOURCE_MASTER)
593 + public void updateDiner(final UpdateDinerRpcRequest request,
594 + final StreamObserver<UpdateDinerRpcResponse> responseObserver) {
595 + final var builder = UpdateDinerRpcResponse.newBuilder();
596 + try {
597 + Diner diner = new Diner();
598 + diner.setId(request.getModification().getId());
599 + diner.setEnterpriseId(request.getEnterpriseId());
600 + diner.setUpdatedBy(request.getUpdatedBy());
601 + diner.setUpdateSource(request.getUpdateSource());
602 + if (request.getModification().getShouldUpdateClientId()) {
603 + diner.setClientId(request.getModification().getClientId());
604 + }
605 + if (request.getModification().getShouldUpdateClassId()) {
606 + diner.setClassId(request.getModification().getClassId());
607 + }
608 + if (request.getModification().getShouldUpdateStudentNo()) {
609 + diner.setStudentNo(request.getModification().getStudentNo());
610 + }
611 + if (request.getModification().getShouldUpdateName()) {
612 + diner.setName(request.getModification().getName());
613 + }
614 + builder.setIsUpdated(dinerService.updateById(diner));
615 + } catch (final Exception e) {
616 + log.error("updateDiner error;", e);
617 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
618 + }
619 + responseObserver.onNext(builder.build());
620 + responseObserver.onCompleted();
621 + }
622 +
623 + @Override
624 + @DS(DATA_SOURCE_MASTER)
625 + public void batchSaveOrUpdateDiners(final BatchSaveOrUpdateDinersRpcRequest request,
626 + final StreamObserver<BatchSaveOrUpdateDinersRpcResponse> responseObserver) {
627 + final var builder = BatchSaveOrUpdateDinersRpcResponse.newBuilder();
628 + try {
629 + final var diners = new ArrayList<Diner>();
630 + for (DinerModification modification : request.getModificationsList()) {
631 + Diner diner = new Diner();
632 + diner.setId(modification.getId() == 0 ? null : modification.getId());
633 + diner.setEnterpriseId(request.getEnterpriseId());
634 + if (modification.getId() == 0) {
635 + diner.setCreatedBy(request.getUpdatedBy());
636 + diner.setCreationSource(request.getUpdateSource());
637 + }
638 + diner.setUpdatedBy(request.getUpdatedBy());
639 + diner.setUpdateSource(request.getUpdateSource());
640 + if (modification.getShouldUpdateClientId()) {
641 + diner.setClientId(modification.getClientId());
642 + }
643 + if (modification.getShouldUpdateClassId()) {
644 + diner.setClassId(modification.getClassId());
645 + }
646 + if (modification.getShouldUpdateStudentNo()) {
647 + diner.setStudentNo(modification.getStudentNo());
648 + }
649 + if (modification.getShouldUpdateName()) {
650 + diner.setName(modification.getName());
651 + }
652 + diners.add(diner);
653 + }
654 + builder.setIsUpdated(dinerService.saveOrUpdateBatch(diners));
655 + } catch (final Exception e) {
656 + log.error("batchSaveOrUpdateDiners error;", e);
657 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
658 + }
659 + responseObserver.onNext(builder.build());
660 + responseObserver.onCompleted();
661 + }
662 +
663 + @Override
664 + @DS(DATA_SOURCE_MASTER)
665 + public void deleteDinersByIds(final DeleteDinersByIdsRpcRequest request,
666 + final StreamObserver<DeleteDinersRpcResponse> responseObserver) {
667 + final var builder = DeleteDinersRpcResponse.newBuilder();
668 + try {
669 + builder.setIsDeleted(dinerService.removeBatchByIds(request.getIdsList()));
670 + } catch (final Exception e) {
671 + log.error("deleteDinersByIds error;", e);
672 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
673 + }
674 + responseObserver.onNext(builder.build());
675 + responseObserver.onCompleted();
676 + }
677 +
678 + @Override
679 + @DS(DATA_SOURCE_SLAVE)
680 + public void getMpAccountDinerRefsByIds(final GetMpAccountDinerRefsByIdsRpcRequest request,
681 + final StreamObserver<GetMpAccountDinerRefsByIdsRpcResponse> responseObserver) {
682 + final var builder = GetMpAccountDinerRefsByIdsRpcResponse.newBuilder();
683 + try {
684 + final var mpAccountDinerRefs = mpAccountDinerRefService.listByIds(request.getIdsList());
685 + if (!mpAccountDinerRefs.isEmpty()) {
686 + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(mpAccountDinerRefs, SingleMpAccountDinerRefRpcResponse.class));
687 + }
688 + } catch (final Exception e) {
689 + log.error("getMpAccountDinerRefsByIds error;", e);
690 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
691 + }
692 + responseObserver.onNext(builder.build());
693 + responseObserver.onCompleted();
694 + }
695 +
696 + @Override
697 + @DS(DATA_SOURCE_SLAVE)
698 + public void queryMpAccountDinerRefsByCondition(final QueryMpAccountDinerRefsByConditionRpcRequest request,
699 + final StreamObserver<QueryMpAccountDinerRefsByConditionRpcResponse> responseObserver) {
700 + final var builder = QueryMpAccountDinerRefsByConditionRpcResponse.newBuilder();
701 + try {
702 + LambdaQueryWrapper<MpAccountDinerRef> queryWrapper = new LambdaQueryWrapper<>();
703 + queryWrapper.eq(MpAccountDinerRef::getEnterpriseId, request.getEnterpriseId());
704 + if (request.getShouldFilterAccountIds()) {
705 + queryWrapper.in(!request.getAccountIdsList().isEmpty(), MpAccountDinerRef::getAccountId, request.getAccountIdsList());
706 + }
707 + if (request.getShouldFilterDinerIds()) {
708 + queryWrapper.in(!request.getDinerIdsList().isEmpty(), MpAccountDinerRef::getDinerId, request.getDinerIdsList());
709 + }
710 + final var diners = mpAccountDinerRefService.list(queryWrapper);
711 + if (!diners.isEmpty()) {
712 + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(diners, SingleMpAccountDinerRefRpcResponse.class));
713 + }
714 + } catch (final Exception e) {
715 + log.error("queryMpAccountDinerRefsByCondition error;", e);
716 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
717 + }
718 + responseObserver.onNext(builder.build());
719 + responseObserver.onCompleted();
720 + }
721 +
722 + @Override
723 + @DS(DATA_SOURCE_MASTER)
724 + public void createMpAccountDinerRef(final CreateMpAccountDinerRefRpcRequest request,
725 + final StreamObserver<CreateMpAccountDinerRefRpcResponse> responseObserver) {
726 + final var builder = CreateMpAccountDinerRefRpcResponse.newBuilder();
727 + try {
728 + MpAccountDinerRef mpAccountDinerRef = new MpAccountDinerRef();
729 + mpAccountDinerRef.setEnterpriseId(request.getEnterpriseId());
730 + mpAccountDinerRef.setCreatedBy(request.getCreatedBy());
731 + mpAccountDinerRef.setCreationSource(request.getCreationSource());
732 + mpAccountDinerRef.setAccountId(request.getCreation().getAccountId());
733 + mpAccountDinerRef.setDinerId(request.getCreation().getDinerId());
734 + builder.setIsCreated(mpAccountDinerRefService.save(mpAccountDinerRef)).setId(mpAccountDinerRef.getId());
735 + } catch (final Exception e) {
736 + log.error("createMpAccountDinerRef error;", e);
737 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
738 + }
739 + responseObserver.onNext(builder.build());
740 + responseObserver.onCompleted();
741 + }
742 +
743 + @Override
744 + @DS(DATA_SOURCE_MASTER)
745 + public void deleteMpAccountDinerRefsByIds(final DeleteMpAccountDinerRefsByIdsRpcRequest request,
746 + final StreamObserver<DeleteMpAccountDinerRefsRpcResponse> responseObserver) {
747 + final var builder = DeleteMpAccountDinerRefsRpcResponse.newBuilder();
748 + try {
749 + builder.setIsDeleted(mpAccountDinerRefService.removeBatchByIds(request.getIdsList()));
750 + } catch (final Exception e) {
751 + log.error("deleteMpAccountDinerRefsByIds error;", e);
752 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
753 + }
754 + responseObserver.onNext(builder.build());
755 + responseObserver.onCompleted();
756 + }
757 +
758 + @Override
759 + @DS(DATA_SOURCE_SLAVE)
760 + public void getGradeClassById(final GetGradeClassByIdRpcRequest request,
761 + final StreamObserver<GetGradeClassByIdRpcResponse> responseObserver) {
762 + final var builder = GetGradeClassByIdRpcResponse.newBuilder();
763 + try {
764 + final var gradeClass = gradeClassService.getById(request.getId());
765 + if (gradeClass != null) {
766 + builder.setResponse(ProtoBeanUtil.beanToProto(gradeClass, SingleGradeClassRpcResponse.class));
767 + }
768 + } catch (final Exception e) {
769 + log.error("getGradeClassById error;", e);
770 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
771 + }
772 + responseObserver.onNext(builder.build());
773 + responseObserver.onCompleted();
774 + }
775 +
776 + @Override
777 + @DS(DATA_SOURCE_SLAVE)
778 + public void getGradeClassesByIds(final GetGradeClassesByIdsRpcRequest request,
779 + final StreamObserver<GetGradeClassesByIdsRpcResponse> responseObserver) {
780 + final var builder = GetGradeClassesByIdsRpcResponse.newBuilder();
781 + try {
782 + final var gradeClasses = gradeClassService.listByIds(request.getIdsList());
783 + if (!gradeClasses.isEmpty()) {
784 + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(gradeClasses, SingleGradeClassRpcResponse.class));
785 + }
786 + } catch (final Exception e) {
787 + log.error("getGradeClassesByIds error;", e);
788 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
789 + }
790 + responseObserver.onNext(builder.build());
791 + responseObserver.onCompleted();
792 + }
793 +
794 + @Override
795 + @DS(DATA_SOURCE_SLAVE)
796 + public void queryGradeClassesByCondition(final QueryGradeClassesByConditionRpcRequest request,
797 + final StreamObserver<QueryGradeClassesByConditionRpcResponse> responseObserver) {
798 + final var builder = QueryGradeClassesByConditionRpcResponse.newBuilder();
799 + try {
800 + LambdaQueryWrapper<GradeClass> queryWrapper = new LambdaQueryWrapper<>();
801 + queryWrapper.eq(GradeClass::getEnterpriseId, request.getEnterpriseId());
802 + if (request.getShouldFilterClientIds()) {
803 + queryWrapper.in(!request.getClientIdsList().isEmpty(), GradeClass::getClientId, request.getClientIdsList());
804 + }
805 + if (request.getShouldFilterGradeName()) {
806 + queryWrapper.eq(GradeClass::getGradeName, request.getGradeName());
807 + }
808 + final var gradeClasses = gradeClassService.list(queryWrapper);
809 + if (!gradeClasses.isEmpty()) {
810 + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(gradeClasses, SingleGradeClassRpcResponse.class));
811 + }
812 + } catch (final Exception e) {
813 + log.error("queryGradeClassesByCondition error;", e);
814 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
815 + }
816 + responseObserver.onNext(builder.build());
817 + responseObserver.onCompleted();
818 + }
819 +
820 + @Override
821 + @DS(DATA_SOURCE_MASTER)
822 + public void createGradeClass(final CreateGradeClassRpcRequest request,
823 + final StreamObserver<CreateGradeClassRpcResponse> responseObserver) {
824 + final var builder = CreateGradeClassRpcResponse.newBuilder();
825 + try {
826 + GradeClass gradeClass = new GradeClass();
827 + gradeClass.setEnterpriseId(request.getEnterpriseId());
828 + gradeClass.setCreatedBy(request.getCreatedBy());
829 + gradeClass.setCreationSource(request.getCreationSource());
830 + gradeClass.setClientId(request.getCreation().getClientId());
831 + gradeClass.setGradeName(request.getCreation().getGradeName());
832 + gradeClass.setClassName(request.getCreation().getClassName());
833 + builder.setIsCreated(gradeClassService.save(gradeClass)).setId(gradeClass.getId());
834 + } catch (final Exception e) {
835 + log.error("createGradeClass error;", e);
836 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
837 + }
838 + responseObserver.onNext(builder.build());
839 + responseObserver.onCompleted();
840 + }
841 +
842 + @Override
843 + @DS(DATA_SOURCE_MASTER)
844 + public void batchCreateGradeClasses(final BatchCreateGradeClassesRpcRequest request,
845 + final StreamObserver<BatchCreateGradeClassesRpcResponse> responseObserver) {
846 + final var builder = BatchCreateGradeClassesRpcResponse.newBuilder();
847 + try {
848 + final var gradeClasses = new ArrayList<GradeClass>();
849 + for (final var creation : request.getCreationsList()) {
850 + final var gradeClass = new GradeClass();
851 + gradeClass.setEnterpriseId(request.getEnterpriseId());
852 + gradeClass.setCreatedBy(request.getCreatedBy());
853 + gradeClass.setCreationSource(request.getCreationSource());
854 + gradeClass.setClientId(creation.getClientId());
855 + gradeClass.setGradeName(creation.getGradeName());
856 + gradeClass.setClassName(creation.getClassName());
857 + gradeClasses.add(gradeClass);
858 + }
859 + builder.setIsCreated(gradeClassService.saveBatch(gradeClasses)).addAllIds(gradeClasses.stream().map(GradeClass::getId).collect(Collectors.toList()));
860 + } catch (final Exception e) {
861 + log.error("batchCreateGradeClasses error;", e);
862 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
863 + }
864 + responseObserver.onNext(builder.build());
865 + responseObserver.onCompleted();
866 + }
867 +
868 + @Override
869 + @DS(DATA_SOURCE_MASTER)
870 + public void updateGradeClass(final UpdateGradeClassRpcRequest request,
871 + final StreamObserver<UpdateGradeClassRpcResponse> responseObserver) {
872 + final var builder = UpdateGradeClassRpcResponse.newBuilder();
873 + try {
874 + GradeClass gradeClass = new GradeClass();
875 + gradeClass.setId(request.getModification().getId());
876 + gradeClass.setEnterpriseId(request.getEnterpriseId());
877 + gradeClass.setUpdatedBy(request.getUpdatedBy());
878 + gradeClass.setUpdateSource(request.getUpdateSource());
879 + if (request.getModification().getShouldUpdateClientId()) {
880 + gradeClass.setClientId(request.getModification().getClientId());
881 + }
882 + if (request.getModification().getShouldUpdateClassName()) {
883 + gradeClass.setClassName(request.getModification().getClassName());
884 + }
885 + if (request.getModification().getShouldUpdateGradeName()) {
886 + gradeClass.setGradeName(request.getModification().getGradeName());
887 + }
888 + builder.setIsUpdated(gradeClassService.updateById(gradeClass));
889 + } catch (final Exception e) {
890 + log.error("updateGradeClass error;", e);
891 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
892 + }
893 + responseObserver.onNext(builder.build());
894 + responseObserver.onCompleted();
895 + }
896 +
897 + @Override
898 + @DS(DATA_SOURCE_MASTER)
899 + public void batchSaveOrUpdateGradeClasses(final BatchSaveOrUpdateGradeClassesRpcRequest request,
900 + final StreamObserver<BatchSaveOrUpdateGradeClassesRpcResponse> responseObserver) {
901 + final var builder = BatchSaveOrUpdateGradeClassesRpcResponse.newBuilder();
902 + try {
903 + List<GradeClass> gradeClasses = new ArrayList<>();
904 + for (final var modification : request.getModificationsList()) {
905 + GradeClass gradeClass = new GradeClass();
906 + gradeClass.setId(modification.getId() == 0 ? null : modification.getId());
907 + gradeClass.setEnterpriseId(request.getEnterpriseId());
908 + if (modification.getId() == 0) {
909 + gradeClass.setCreatedBy(request.getUpdatedBy());
910 + gradeClass.setCreationSource(request.getUpdateSource());
911 + }
912 + gradeClass.setUpdatedBy(request.getUpdatedBy());
913 + gradeClass.setUpdateSource(request.getUpdateSource());
914 + if (modification.getShouldUpdateClientId()) {
915 + gradeClass.setClientId(modification.getClientId());
916 + }
917 + if (modification.getShouldUpdateClassName()) {
918 + gradeClass.setClassName(modification.getClassName());
919 + }
920 + if (modification.getShouldUpdateGradeName()) {
921 + gradeClass.setGradeName(modification.getGradeName());
922 + }
923 + gradeClasses.add(gradeClass);
924 + }
925 + builder.setIsUpdated(gradeClassService.saveOrUpdateBatch(gradeClasses));
926 + } catch (final Exception e) {
927 + log.error("updateGradeClass error;", e);
928 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
929 + }
930 + responseObserver.onNext(builder.build());
931 + responseObserver.onCompleted();
932 + }
933 +
934 + @Override
935 + @DS(DATA_SOURCE_MASTER)
936 + public void deleteGradeClassesByIds(final DeleteGradeClassesByIdsRpcRequest request,
937 + final StreamObserver<DeleteGradeClassesRpcResponse> responseObserver) {
938 + final var builder = DeleteGradeClassesRpcResponse.newBuilder();
939 + try {
940 + builder.setIsDeleted(gradeClassService.removeBatchByIds(request.getIdsList()));
941 + } catch (final Exception e) {
942 + log.error("deleteGradeClassesByIds error;", e);
943 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
944 + }
945 + responseObserver.onNext(builder.build());
946 + responseObserver.onCompleted();
947 + }
948 +
949 + @Override
950 + @DS(DATA_SOURCE_MASTER)
951 + @Transactional(rollbackFor = Exception.class)
952 + public void deleteGradeClassesAndDinersByClientIds(final DeleteGradeClassesAndDinersByClientIdsRpcRequest request,
953 + final StreamObserver<DeleteGradeClassesAndDinersByClientIdsRpcResponse> responseObserver) {
954 + final var builder = DeleteGradeClassesAndDinersByClientIdsRpcResponse.newBuilder();
955 + try {
956 + LambdaQueryWrapper<GradeClass> queryWrapper = Wrappers.lambdaQuery();
957 + queryWrapper.in(GradeClass::getEnterpriseId, request.getEnterpriseId());
958 + queryWrapper.in(GradeClass::getClientId, request.getClientIdsList());
959 + final boolean remove = gradeClassService.remove(queryWrapper);
960 + LambdaQueryWrapper<Diner> dinerLambdaQueryWrapper = Wrappers.lambdaQuery();
961 + dinerLambdaQueryWrapper.in(Diner::getEnterpriseId, request.getEnterpriseId());
962 + dinerLambdaQueryWrapper.in(Diner::getClientId, request.getClientIdsList());
963 + final var diners = dinerService.list(dinerLambdaQueryWrapper);
964 + final var remove1 = dinerService.remove(dinerLambdaQueryWrapper);
965 + boolean remove2 = false;
966 + if (!diners.isEmpty()) {
967 + LambdaQueryWrapper<MpAccountDinerRef> mpAccountDinerRefLambdaQueryWrapper = Wrappers.lambdaQuery();
968 + mpAccountDinerRefLambdaQueryWrapper.in(MpAccountDinerRef::getEnterpriseId, request.getEnterpriseId());
969 + mpAccountDinerRefLambdaQueryWrapper.in(MpAccountDinerRef::getDinerId, diners.stream().map(Diner::getId).collect(Collectors.toList()));
970 + remove2 = mpAccountDinerRefService.remove(mpAccountDinerRefLambdaQueryWrapper);
971 + }
972 + builder.setIsDeleted(remove && remove1 && remove2);
973 + } catch (final Exception e) {
974 + log.error("deleteGradeClassesAndDinersByClientIds error;", e);
975 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
976 + }
977 + responseObserver.onNext(builder.build());
978 + responseObserver.onCompleted();
979 + }
980 +
981 + @Override
982 + @DS(DATA_SOURCE_SLAVE)
983 + public void getMealMenuRecordById(final GetMealMenuRecordByIdRpcRequest request,
984 + final StreamObserver<GetMealMenuRecordByIdRpcResponse> responseObserver) {
985 + final var builder = GetMealMenuRecordByIdRpcResponse.newBuilder();
986 + try {
987 + final var mealMenuRecord = mealMenuRecordService.getById(request.getId());
988 + if (mealMenuRecord != null) {
989 + builder.setResponse(ProtoBeanUtil.beanToProto(mealMenuRecord, SingleMealMenuRecordRpcResponse.class));
990 + }
991 + } catch (final Exception e) {
992 + log.error("getMealMenuRecordById error;", e);
993 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
994 + }
995 + responseObserver.onNext(builder.build());
996 + responseObserver.onCompleted();
997 + }
998 +
999 + @Override
1000 + @DS(DATA_SOURCE_SLAVE)
1001 + public void getMealMenuRecordsByIds(final GetMealMenuRecordsByIdsRpcRequest request,
1002 + final StreamObserver<GetMealMenuRecordsByIdsRpcResponse> responseObserver) {
1003 + final var builder = GetMealMenuRecordsByIdsRpcResponse.newBuilder();
1004 + try {
1005 + final var mealMenuRecords = mealMenuRecordService.listByIds(request.getIdsList());
1006 + if (!mealMenuRecords.isEmpty()) {
1007 + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(mealMenuRecords, SingleMealMenuRecordRpcResponse.class));
1008 + }
1009 + } catch (final Exception e) {
1010 + log.error("getMealMenuRecordsByIds error;", e);
1011 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
1012 + }
1013 + responseObserver.onNext(builder.build());
1014 + responseObserver.onCompleted();
1015 + }
1016 +
1017 + @Override
1018 + @DS(DATA_SOURCE_SLAVE)
1019 + public void queryMealMenuRecordsByCondition(final QueryMealMenuRecordsByConditionRpcRequest request,
1020 + final StreamObserver<QueryMealMenuRecordsByConditionRpcResponse> responseObserver) {
1021 + final var builder = QueryMealMenuRecordsByConditionRpcResponse.newBuilder();
1022 + try {
1023 + LambdaQueryWrapper<MealMenuRecord> queryWrapper = new LambdaQueryWrapper<>();
1024 + queryWrapper.eq(MealMenuRecord::getEnterpriseId, request.getEnterpriseId());
1025 + if (request.getShouldFilterClientIds()) {
1026 + queryWrapper.in(!request.getClientIdsList().isEmpty(), MealMenuRecord::getClientId, request.getClientIdsList());
1027 + }
1028 + if (request.getShouldFilterName()) {
1029 + queryWrapper.eq(MealMenuRecord::getName, request.getName());
1030 + }
1031 + final var diners = mealMenuRecordService.list(queryWrapper);
1032 + if (!diners.isEmpty()) {
1033 + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(diners, SingleMealMenuRecordRpcResponse.class));
1034 + }
1035 + } catch (final Exception e) {
1036 + log.error("queryMealMenuRecordsByCondition error;", e);
1037 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
1038 + }
1039 + responseObserver.onNext(builder.build());
1040 + responseObserver.onCompleted();
1041 + }
1042 +
1043 + @Override
1044 + @DS(DATA_SOURCE_SLAVE)
1045 + public void queryLatestMealMenuRecordsByClientIds(final QueryLatestMealMenuRecordsByClientIdsRpcRequest request,
1046 + final StreamObserver<QueryLatestMealMenuRecordsByClientIdsRpcResponse> responseObserver) {
1047 + final var builder = QueryLatestMealMenuRecordsByClientIdsRpcResponse.newBuilder();
1048 + try {
1049 + final var queryWrapper = new LambdaQueryWrapper<MealMenuRecord>();
1050 + queryWrapper.eq(MealMenuRecord::getEnterpriseId, request.getEnterpriseId());
1051 + queryWrapper.in(MealMenuRecord::getClientId, request.getClientIdList());
1052 + queryWrapper.orderByDesc(MealMenuRecord::getCreatedAt);
1053 + final var allRecords = mealMenuRecordService.list(queryWrapper);
1054 + final var latestRecordsMap = allRecords.stream().collect(Collectors.toMap(MealMenuRecord::getClientId, Function.identity(), (existing, replacement) -> existing));
1055 + if (!latestRecordsMap.isEmpty()) {
1056 + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(new ArrayList<>(latestRecordsMap.values()), SingleMealMenuRecordRpcResponse.class));
1057 + }
1058 + } catch (final Exception e) {
1059 + log.error("queryLatestMealMenuRecordsByClientIds error;", e);
1060 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
1061 + }
1062 + responseObserver.onNext(builder.build());
1063 + responseObserver.onCompleted();
1064 + }
1065 +
1066 + @Override
1067 + @DS(DATA_SOURCE_MASTER)
1068 + public void createMealMenuRecord(final CreateMealMenuRecordRpcRequest request,
1069 + final StreamObserver<CreateMealMenuRecordRpcResponse> responseObserver) {
1070 + final var builder = CreateMealMenuRecordRpcResponse.newBuilder();
1071 + try {
1072 + MealMenuRecord mealMenuRecord = new MealMenuRecord();
1073 + mealMenuRecord.setEnterpriseId(request.getEnterpriseId());
1074 + mealMenuRecord.setCreatedBy(request.getCreatedBy());
1075 + mealMenuRecord.setCreationSource(request.getCreationSource());
1076 + mealMenuRecord.setClientId(request.getCreation().getClientId());
1077 + mealMenuRecord.setName(request.getCreation().getName());
1078 + mealMenuRecord.setImageUrl(request.getCreation().getImageUrl());
1079 + builder.setIsCreated(mealMenuRecordService.save(mealMenuRecord)).setId(mealMenuRecord.getId());
1080 + } catch (final Exception e) {
1081 + log.error("createMealMenuRecord error;", e);
1082 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
1083 + }
1084 + responseObserver.onNext(builder.build());
1085 + responseObserver.onCompleted();
1086 + }
1087 +}
1 +package com.tianting.infoloop.service.impl;
2 +
3 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4 +import com.tianting.infoloop.mapper.DinerMapper;
5 +import com.tianting.infoloop.model.db.Diner;
6 +import com.tianting.infoloop.service.DinerService;
7 +import org.springframework.stereotype.Service;
8 +
9 +/**
10 +* @author zhuyf
11 +* @description 针对表【diners(就餐人表)】的数据库操作Service实现
12 +* @createDate 2025-04-10 13:22:20
13 +*/
14 +@Service
15 +public class DinerServiceImpl extends ServiceImpl<DinerMapper, Diner>
16 + implements DinerService{
17 +
18 +}
19 +
20 +
21 +
22 +
1 +package com.tianting.infoloop.service.impl;
2 +
3 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4 +import com.tianting.infoloop.mapper.GradeClassMapper;
5 +import com.tianting.infoloop.model.db.GradeClass;
6 +import com.tianting.infoloop.service.GradeClassService;
7 +import org.springframework.stereotype.Service;
8 +
9 +/**
10 +* @author zhuyf
11 +* @description 针对表【grade_classes(年级班级表)】的数据库操作Service实现
12 +* @createDate 2025-04-10 13:22:20
13 +*/
14 +@Service
15 +public class GradeClassServiceImpl extends ServiceImpl<GradeClassMapper, GradeClass>
16 + implements GradeClassService{
17 +
18 +}
19 +
20 +
21 +
22 +
1 +package com.tianting.infoloop.service.impl;
2 +
3 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4 +import com.tianting.infoloop.mapper.MealMenuRecordMapper;
5 +import com.tianting.infoloop.model.db.MealMenuRecord;
6 +import com.tianting.infoloop.service.MealMenuRecordService;
7 +import org.springframework.stereotype.Service;
8 +
9 +/**
10 +* @author zhuyf
11 +* @description 针对表【meal_menu_records(餐单记录表)】的数据库操作Service实现
12 +* @createDate 2025-04-10 13:22:20
13 +*/
14 +@Service
15 +public class MealMenuRecordServiceImpl extends ServiceImpl<MealMenuRecordMapper, MealMenuRecord>
16 + implements MealMenuRecordService{
17 +
18 +}
19 +
20 +
21 +
22 +
1 +package com.tianting.infoloop.service.impl;
2 +
3 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4 +import com.tianting.infoloop.mapper.MealOrderMapper;
5 +import com.tianting.infoloop.model.db.MealOrder;
6 +import com.tianting.infoloop.service.MealOrderService;
7 +import org.springframework.stereotype.Service;
8 +
9 +/**
10 +* @author zhuyf
11 +* @description 针对表【meal_orders(订餐记录表)】的数据库操作Service实现
12 +* @createDate 2025-04-10 13:22:20
13 +*/
14 +@Service
15 +public class MealOrderServiceImpl extends ServiceImpl<MealOrderMapper, MealOrder>
16 + implements MealOrderService{
17 +
18 +}
19 +
20 +
21 +
22 +
1 +package com.tianting.infoloop.service.impl;
2 +
3 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4 +import com.tianting.infoloop.mapper.MpAccountDinerRefMapper;
5 +import com.tianting.infoloop.model.db.MpAccountDinerRef;
6 +import com.tianting.infoloop.service.MpAccountDinerRefService;
7 +import org.springframework.stereotype.Service;
8 +
9 +/**
10 +* @author zhuyf
11 +* @description 针对表【mp_account_diner_refs(小程序账号和就餐人关联表)】的数据库操作Service实现
12 +* @createDate 2025-04-10 13:22:20
13 +*/
14 +@Service
15 +public class MpAccountDinerRefServiceImpl extends ServiceImpl<MpAccountDinerRefMapper, MpAccountDinerRef>
16 + implements MpAccountDinerRefService{
17 +
18 +}
19 +
20 +
21 +
22 +
1 +package com.tianting.infoloop.service.impl;
2 +
3 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4 +import com.tianting.infoloop.mapper.MpAccountMapper;
5 +import com.tianting.infoloop.model.db.MpAccount;
6 +import com.tianting.infoloop.service.MpAccountService;
7 +import org.springframework.stereotype.Service;
8 +
9 +/**
10 +* @author zhuyf
11 +* @description 针对表【mp_accounts(小程序账号表)】的数据库操作Service实现
12 +* @createDate 2025-04-10 13:22:20
13 +*/
14 +@Service
15 +public class MpAccountServiceImpl extends ServiceImpl<MpAccountMapper, MpAccount>
16 + implements MpAccountService{
17 +
18 +}
19 +
20 +
21 +
22 +
...@@ -3,6 +3,9 @@ package com.tianting.infoloop.utils; ...@@ -3,6 +3,9 @@ package com.tianting.infoloop.utils;
3 import cn.hutool.core.date.LocalDateTimeUtil; 3 import cn.hutool.core.date.LocalDateTimeUtil;
4 import com.google.gson.Gson; 4 import com.google.gson.Gson;
5 import com.google.gson.GsonBuilder; 5 import com.google.gson.GsonBuilder;
6 +import com.google.gson.JsonArray;
7 +import com.google.gson.JsonElement;
8 +import com.google.gson.JsonParser;
6 import com.google.gson.TypeAdapter; 9 import com.google.gson.TypeAdapter;
7 import com.google.gson.stream.JsonReader; 10 import com.google.gson.stream.JsonReader;
8 import com.google.gson.stream.JsonWriter; 11 import com.google.gson.stream.JsonWriter;
...@@ -23,6 +26,8 @@ import java.util.List; ...@@ -23,6 +26,8 @@ import java.util.List;
23 26
24 public class ProtoBeanUtil { 27 public class ProtoBeanUtil {
25 28
29 + private static Gson gson = getGson();
30 +
26 /** 31 /**
27 * protoBean -> string 32 * protoBean -> string
28 * 33 *
...@@ -31,13 +36,68 @@ public class ProtoBeanUtil { ...@@ -31,13 +36,68 @@ public class ProtoBeanUtil {
31 */ 36 */
32 public static String protoToJson(MessageOrBuilder sourceMessage) { 37 public static String protoToJson(MessageOrBuilder sourceMessage) {
33 try { 38 try {
34 - return JsonFormat.printer().print(sourceMessage); 39 + return JsonFormat.printer().includingDefaultValueFields().print(sourceMessage);
35 } catch (Exception e) { 40 } catch (Exception e) {
36 throw new IllegalArgumentException("ProtoBeanUtil->toJson->errorMessage:proto序列化string异常", e); 41 throw new IllegalArgumentException("ProtoBeanUtil->toJson->errorMessage:proto序列化string异常", e);
37 } 42 }
38 } 43 }
39 44
40 - private static Gson gson = getGson(); 45 + @SuppressWarnings("unchecked")
46 + public static <T extends Message> T jsonToProto(String json, Class<T> protoBean) {
47 + try {
48 + Constructor<T> declaredConstructor = protoBean.getDeclaredConstructor((Class<?>[]) null);
49 + declaredConstructor.setAccessible(Boolean.TRUE);
50 + T instance = declaredConstructor.newInstance();
51 + final var builder = instance.toBuilder();
52 + if (json == null || json.isEmpty() || json.trim().equals("{}")) {
53 + return (T) builder.build();
54 + }
55 + JsonFormat.parser().ignoringUnknownFields().merge(json, builder);
56 + return (T) builder.build();
57 + } catch (Exception e) {
58 + throw new IllegalArgumentException("json to proto error", e);
59 + }
60 + }
61 +
62 + @SuppressWarnings("unchecked")
63 + public static <T extends Message> List<T> jsonToProtoList(String jsonArray, Class<T> protoBean) {
64 + try {
65 + if (jsonArray == null || jsonArray.isEmpty() || jsonArray.trim().equals("[]")) {
66 + return new ArrayList<>();
67 + }
68 + Constructor<T> declaredConstructor = protoBean.getDeclaredConstructor();
69 + declaredConstructor.setAccessible(true);
70 + List<T> protoList = new ArrayList<>();
71 + JsonArray jsonElements = JsonParser.parseString(jsonArray).getAsJsonArray();
72 + for (JsonElement jsonElement : jsonElements) {
73 + T instance = declaredConstructor.newInstance();
74 + Message.Builder builder = instance.toBuilder();
75 + JsonFormat.parser().ignoringUnknownFields().merge(jsonElement.toString(), builder);
76 + protoList.add((T) builder.build());
77 + }
78 + return protoList;
79 + } catch (Exception e) {
80 + throw new IllegalArgumentException("jsonArray to protoList error", e);
81 + }
82 + }
83 +
84 + public static String protoListToJson(List<? extends Message> sourceList) {
85 + try {
86 + StringBuilder jsonArrayBuilder = new StringBuilder();
87 + jsonArrayBuilder.append("[");
88 + for (int i = 0; i < sourceList.size(); i++) {
89 + String json = protoToJson(sourceList.get(i));
90 + jsonArrayBuilder.append(json);
91 + if (i < sourceList.size() - 1) {
92 + jsonArrayBuilder.append(",");
93 + }
94 + }
95 + jsonArrayBuilder.append("]");
96 + return jsonArrayBuilder.toString();
97 + } catch (Exception e) {
98 + throw new IllegalArgumentException("ProtoList to jsonArray error", e);
99 + }
100 + }
41 101
42 /** 102 /**
43 * @desc: String 转 Builder对象 103 * @desc: String 转 Builder对象
......
1 +syntax = "proto3";
2 +
3 +option java_multiple_files = true;
4 +option java_package = "com.infoloop.tianting.mealorderservice";
5 +option java_outer_classname = "MealOrderServiceProto";
6 +option objc_class_prefix = "OP";
7 +
8 +package com.infoloop.tianting.mealorderservice;
9 +
10 +service MealOrderServiceRpc {
11 + rpc GetMealOrderById (GetMealOrderByIdRpcRequest) returns (GetMealOrderByIdRpcResponse) {}
12 + rpc GetMealOrdersByIds (GetMealOrdersByIdsRpcRequest) returns (GetMealOrdersByIdsRpcResponse) {}
13 + rpc QueryMealOrdersByCondition (QueryMealOrdersByConditionRpcRequest) returns (QueryMealOrdersByConditionRpcResponse) {}
14 + rpc QueryReserveMealOrdersByDinerIds (QueryReserveMealOrdersByDinerIdsRpcRequest) returns (QueryReserveMealOrdersByDinerIdsRpcResponse) {}
15 + rpc CreateMealOrder (CreateMealOrderRpcRequest) returns (CreateMealOrderRpcResponse) {}
16 + rpc BatchCreateMealOrders (BatchCreateMealOrdersRpcRequest) returns (BatchCreateMealOrdersRpcResponse) {}
17 + rpc DeleteMealOrdersByIds (DeleteMealOrdersByIdsRpcRequest) returns (DeleteMealOrdersRpcResponse) {}
18 +
19 + rpc GetMpAccountById (GetMpAccountByIdRpcRequest) returns (GetMpAccountByIdRpcResponse) {}
20 + rpc GetMpAccountByOpenId (GetMpAccountByOpenIdRpcRequest) returns (GetMpAccountByOpenIdRpcResponse) {}
21 + rpc GetMpAccountsByIds (GetMpAccountsByIdsRpcRequest) returns (GetMpAccountsByIdsRpcResponse) {}
22 + rpc QueryMpAccountsByCondition (QueryMpAccountsByConditionRpcRequest) returns (QueryMpAccountsByConditionRpcResponse) {}
23 + rpc CreateMpAccount (CreateMpAccountRpcRequest) returns (CreateMpAccountRpcResponse) {}
24 + rpc UpdateMpAccount (UpdateMpAccountRpcRequest) returns (UpdateMpAccountRpcResponse) {}
25 + rpc DeleteMpAccountsByIds (DeleteMpAccountsByIdsRpcRequest) returns (DeleteMpAccountsRpcResponse) {}
26 +
27 + rpc GetDinerById (GetDinerByIdRpcRequest) returns (GetDinerByIdRpcResponse) {}
28 + rpc GetDinersByIds (GetDinersByIdsRpcRequest) returns (GetDinersByIdsRpcResponse) {}
29 + rpc QueryDinersByCondition (QueryDinersByConditionRpcRequest) returns (QueryDinersByConditionRpcResponse) {}
30 + rpc CreateDiner (CreateDinerRpcRequest) returns (CreateDinerRpcResponse) {}
31 + rpc UpdateDiner (UpdateDinerRpcRequest) returns (UpdateDinerRpcResponse) {}
32 + rpc BatchSaveOrUpdateDiners (BatchSaveOrUpdateDinersRpcRequest) returns (BatchSaveOrUpdateDinersRpcResponse) {}
33 + rpc DeleteDinersByIds (DeleteDinersByIdsRpcRequest) returns (DeleteDinersRpcResponse) {}
34 +
35 + rpc GetMpAccountDinerRefsByIds (GetMpAccountDinerRefsByIdsRpcRequest) returns (GetMpAccountDinerRefsByIdsRpcResponse) {}
36 + rpc QueryMpAccountDinerRefsByCondition (QueryMpAccountDinerRefsByConditionRpcRequest) returns (QueryMpAccountDinerRefsByConditionRpcResponse) {}
37 + rpc CreateMpAccountDinerRef (CreateMpAccountDinerRefRpcRequest) returns (CreateMpAccountDinerRefRpcResponse) {}
38 + rpc DeleteMpAccountDinerRefsByIds (DeleteMpAccountDinerRefsByIdsRpcRequest) returns (DeleteMpAccountDinerRefsRpcResponse) {}
39 +
40 + rpc GetGradeClassById (GetGradeClassByIdRpcRequest) returns (GetGradeClassByIdRpcResponse) {}
41 + rpc GetGradeClassesByIds (GetGradeClassesByIdsRpcRequest) returns (GetGradeClassesByIdsRpcResponse) {}
42 + rpc QueryGradeClassesByCondition (QueryGradeClassesByConditionRpcRequest) returns (QueryGradeClassesByConditionRpcResponse) {}
43 + rpc CreateGradeClass (CreateGradeClassRpcRequest) returns (CreateGradeClassRpcResponse) {}
44 + rpc BatchCreateGradeClasses (BatchCreateGradeClassesRpcRequest) returns (BatchCreateGradeClassesRpcResponse) {}
45 + rpc UpdateGradeClass (UpdateGradeClassRpcRequest) returns (UpdateGradeClassRpcResponse) {}
46 + rpc BatchSaveOrUpdateGradeClasses (BatchSaveOrUpdateGradeClassesRpcRequest) returns (BatchSaveOrUpdateGradeClassesRpcResponse) {}
47 + rpc DeleteGradeClassesByIds (DeleteGradeClassesByIdsRpcRequest) returns (DeleteGradeClassesRpcResponse) {}
48 + rpc DeleteGradeClassesAndDinersByClientIds (DeleteGradeClassesAndDinersByClientIdsRpcRequest) returns (DeleteGradeClassesAndDinersByClientIdsRpcResponse) {}
49 +
50 + rpc GetMealMenuRecordById (GetMealMenuRecordByIdRpcRequest) returns (GetMealMenuRecordByIdRpcResponse) {}
51 + rpc GetMealMenuRecordsByIds (GetMealMenuRecordsByIdsRpcRequest) returns (GetMealMenuRecordsByIdsRpcResponse) {}
52 + rpc QueryMealMenuRecordsByCondition (QueryMealMenuRecordsByConditionRpcRequest) returns (QueryMealMenuRecordsByConditionRpcResponse) {}
53 + rpc CreateMealMenuRecord (CreateMealMenuRecordRpcRequest) returns (CreateMealMenuRecordRpcResponse) {}
54 + rpc QueryLatestMealMenuRecordsByClientIds (QueryLatestMealMenuRecordsByClientIdsRpcRequest) returns (QueryLatestMealMenuRecordsByClientIdsRpcResponse) {}
55 +}
56 +
57 +enum MealOrderOrderMethodEnum {
58 + MEAL_ORDER_METHOD_SYSTEM = 0;
59 + MEAL_ORDER_METHOD_MICRO = 1;
60 +}
61 +
62 +message SingleMealOrderRpcResponse {
63 + int32 id = 1;
64 + int32 enterpriseId = 2;
65 + int32 clientId = 3;
66 + int32 menuId = 4;
67 + int32 accountId = 5;
68 + MealOrderOrderMethodEnum orderMethod = 6;
69 + int32 dinerId = 7;
70 + string dinerName = 8;
71 + string clientName = 9;
72 + string gradeName = 10;
73 + string className = 11;
74 + string studentNo = 12;
75 + int64 reserveDate = 13;
76 + repeated MenuSchedule meals = 14;
77 + int32 createdBy = 15;
78 + int64 createdAt = 16;
79 + int32 creationSource = 17;
80 + int32 updatedBy = 18;
81 + int64 updatedAt = 19;
82 + int32 updateSource = 20;
83 + bool isDeleted = 21;
84 +}
85 +
86 +message GetMealOrderByIdRpcRequest {
87 + int32 id = 1;
88 + int32 enterpriseId = 2;
89 + bool includeDeleted = 3;
90 +}
91 +
92 +message GetMealOrderByIdRpcResponse {
93 + SingleMealOrderRpcResponse response = 1;
94 +}
95 +
96 +message GetMealOrdersByIdsRpcRequest {
97 + repeated int32 ids = 1;
98 + int32 enterpriseId = 2;
99 + bool includeDeleted = 3;
100 +}
101 +
102 +message GetMealOrdersByIdsRpcResponse {
103 + repeated SingleMealOrderRpcResponse responses = 1;
104 +}
105 +
106 +message QueryMealOrdersByConditionRpcRequest {
107 + int32 enterpriseId = 1;
108 + bool shouldFilterClientIds = 2;
109 + repeated int32 clientIds = 3;
110 + bool shouldFilterMenuIds = 4;
111 + repeated int32 menuIds = 5;
112 + bool shouldFilterAccountIds = 6;
113 + repeated int32 accountIds = 7;
114 + bool shouldFilterOrderMethod = 8;
115 + MealOrderOrderMethodEnum orderMethod = 9;
116 + bool shouldFilterDinerIds = 10;
117 + repeated int32 dinerIds = 11;
118 + bool shouldFilterReserveDateStart = 12;
119 + int64 reserveDateStart = 13;
120 + bool shouldFilterReserveDateEnd = 14;
121 + int64 reserveDateEnd = 15;
122 + bool includeDeleted = 16;
123 +}
124 +
125 +message QueryMealOrdersByConditionRpcResponse {
126 + repeated SingleMealOrderRpcResponse responses = 1;
127 +}
128 +
129 +message QueryReserveMealOrdersByDinerIdsRpcRequest {
130 + int32 enterpriseId = 1;
131 + repeated int32 dinerIds = 2;
132 +}
133 +
134 +message QueryReserveMealOrdersByDinerIdsRpcResponse {
135 + repeated SingleMealOrderRpcResponse responses = 1;
136 +}
137 +
138 +message MealOrderCreation{
139 + int32 clientId = 1;
140 + int32 menuId = 2;
141 + int32 accountId = 3;
142 + MealOrderOrderMethodEnum orderMethod = 4;
143 + int32 dinerId = 5;
144 + string dinerName = 6;
145 + string clientName = 7;
146 + string gradeName = 8;
147 + string className = 9;
148 + string studentNo = 10;
149 + int64 reserveDate = 11;
150 + repeated MenuSchedule meals = 12;
151 +}
152 +
153 +message MenuSchedule {
154 + string date = 1; // 日期字段,类型是 string
155 + string menu = 2; // 菜单字段,类型是 string
156 +}
157 +
158 +message CreateMealOrderRpcRequest {
159 + MealOrderCreation creation = 1;
160 + int32 enterpriseId = 2;
161 + int32 createdBy = 3;
162 + int32 creationSource = 4;
163 +}
164 +
165 +message CreateMealOrderRpcResponse {
166 + int32 id = 1;
167 + bool isCreated = 2;
168 +}
169 +
170 +message BatchCreateMealOrdersRpcRequest {
171 + repeated MealOrderCreation creations = 1;
172 + int32 enterpriseId = 2;
173 + int32 createdBy = 3;
174 + int32 creationSource = 4;
175 +}
176 +
177 +message BatchCreateMealOrdersRpcResponse {
178 + repeated int32 ids = 1;
179 + bool isCreated = 2;
180 +}
181 +
182 +message MealOrderModification {
183 + int32 id = 1;
184 + bool shouldUpdateClientId = 2;
185 + int32 clientId = 3;
186 + bool shouldUpdateMenuId = 4;
187 + int32 menuId = 5;
188 + bool shouldUpdateAccountId = 6;
189 + int32 accountId = 7;
190 + bool shouldUpdateOrderMethod = 8;
191 + MealOrderOrderMethodEnum orderMethod = 9;
192 + bool shouldUpdateDinerId = 10;
193 + int32 dinerId = 11;
194 + bool shouldUpdateDinerName = 12;
195 + string dinerName = 13;
196 + bool shouldUpdateClientName = 14;
197 + string clientName = 15;
198 + bool shouldUpdateGradeName = 16;
199 + string gradeName = 17;
200 + bool shouldUpdateClassName = 18;
201 + string className = 19;
202 + bool shouldUpdateStudentNo = 20;
203 + string studentNo = 21;
204 + bool shouldUpdateReserveDate = 22;
205 + int64 reserveDate = 23;
206 + bool shouldUpdateMeals = 24;
207 + repeated MenuSchedule meals = 25;
208 +}
209 +
210 +message UpdateMealOrderRpcRequest {
211 + MealOrderModification modification = 1;
212 + int32 enterpriseId = 2;
213 + int32 updatedBy = 3;
214 + int32 updateSource = 4;
215 +}
216 +
217 +message UpdateMealOrderRpcResponse {
218 + bool isUpdated = 1;
219 +}
220 +
221 +message BatchUpdateMealOrdersRpcRequest {
222 + repeated MealOrderModification modifications = 1;
223 + int32 enterpriseId = 2;
224 + int32 updatedBy = 3;
225 + int32 updateSource = 4;
226 +}
227 +
228 +message BatchUpdateMealOrdersRpcResponse {
229 + bool isUpdated = 1;
230 +}
231 +
232 +message DeleteMealOrdersByIdsRpcRequest {
233 + repeated int32 ids = 1;
234 + int32 enterpriseId = 2;
235 + int32 updatedBy = 3;
236 + int32 updateSource = 4;
237 +}
238 +
239 +message DeleteMealOrdersRpcResponse {
240 + bool isDeleted = 1;
241 +}
242 +
243 +message SingleDinerRpcResponse {
244 + int32 id = 1;
245 + int32 enterpriseId = 2;
246 + int32 clientId = 3;
247 + int32 classId = 4;
248 + string studentNo = 5;
249 + string name = 6;
250 + int32 createdBy = 7;
251 + int64 createdAt = 8;
252 + int32 creationSource = 9;
253 + int32 updatedBy = 10;
254 + int64 updatedAt = 11;
255 + int32 updateSource = 12;
256 + bool isDeleted = 13;
257 +}
258 +
259 +message GetDinerByIdRpcRequest {
260 + int32 id = 1;
261 + int32 enterpriseId = 2;
262 + bool includeDeleted = 3;
263 +}
264 +
265 +message GetDinerByIdRpcResponse {
266 + SingleDinerRpcResponse response = 1;
267 +}
268 +
269 +message GetDinersByIdsRpcRequest {
270 + repeated int32 ids = 1;
271 + int32 enterpriseId = 2;
272 + bool includeDeleted = 3;
273 +}
274 +
275 +message GetDinersByIdsRpcResponse {
276 + repeated SingleDinerRpcResponse responses = 1;
277 +}
278 +
279 +message QueryDinersByConditionRpcRequest {
280 + int32 enterpriseId = 1;
281 + bool shouldFilterClientIds = 2;
282 + repeated int32 clientIds = 3;
283 + bool shouldFilterClassIds = 4;
284 + repeated int32 classIds = 5;
285 + bool shouldFilterStudentNo = 6;
286 + string studentNo = 7;
287 + bool shouldFilterName = 8;
288 + string name = 9;
289 + bool includeDeleted = 10;
290 +}
291 +
292 +message QueryDinersByConditionRpcResponse {
293 + repeated SingleDinerRpcResponse responses = 1;
294 +}
295 +
296 +message DinerCreation{
297 + int32 clientId = 1;
298 + int32 classId = 2;
299 + string studentNo = 3;
300 + string name = 4;
301 +}
302 +
303 +message CreateDinerRpcRequest {
304 + DinerCreation creation = 1;
305 + int32 enterpriseId = 2;
306 + int32 createdBy = 3;
307 + int32 creationSource = 4;
308 +}
309 +
310 +message CreateDinerRpcResponse {
311 + int32 id = 1;
312 + bool isCreated = 2;
313 +}
314 +
315 +message DinerModification {
316 + int32 id = 1;
317 + bool shouldUpdateClientId = 2;
318 + int32 clientId = 3;
319 + bool shouldUpdateClassId = 4;
320 + int32 classId = 5;
321 + bool shouldUpdateStudentNo = 6;
322 + string studentNo = 7;
323 + bool shouldUpdateName = 8;
324 + string name = 9;
325 +}
326 +
327 +message UpdateDinerRpcRequest {
328 + DinerModification modification = 1;
329 + int32 enterpriseId = 2;
330 + int32 updatedBy = 3;
331 + int32 updateSource = 4;
332 +}
333 +
334 +message UpdateDinerRpcResponse {
335 + bool isUpdated = 1;
336 +}
337 +
338 +message BatchSaveOrUpdateDinersRpcRequest {
339 + repeated DinerModification modifications = 1;
340 + int32 enterpriseId = 2;
341 + int32 updatedBy = 3;
342 + int32 updateSource = 4;
343 +}
344 +
345 +message BatchSaveOrUpdateDinersRpcResponse {
346 + bool isUpdated = 1;
347 +}
348 +
349 +message DeleteDinersByIdsRpcRequest {
350 + repeated int32 ids = 1;
351 + int32 enterpriseId = 2;
352 + int32 updatedBy = 3;
353 + int32 updateSource = 4;
354 +}
355 +
356 +message DeleteDinersRpcResponse {
357 + bool isDeleted = 1;
358 +}
359 +
360 +enum MpAccountGenderEnum {
361 + MP_ACCOUNT_GENDER_MAN = 0;
362 + MP_ACCOUNT_GENDER_WOMAN = 1;
363 +}
364 +enum MpAccountStatusEnum {
365 + MP_ACCOUNT_STATUS_ENABLE = 0;
366 + MP_ACCOUNT_STATUS_DISABLE = 1;
367 +}
368 +
369 +message SingleMpAccountRpcResponse {
370 + int32 id = 1;
371 + int32 enterpriseId = 2;
372 + string openId = 3;
373 + string unionId = 4;
374 + string nickname = 5;
375 + string avatarUrl = 6;
376 + MpAccountGenderEnum gender = 7;
377 + string phoneNumber = 8;
378 + MpAccountStatusEnum status = 9;
379 + int32 createdBy = 10;
380 + int64 createdAt = 11;
381 + int32 creationSource = 12;
382 + int32 updatedBy = 13;
383 + int64 updatedAt = 14;
384 + int32 updateSource = 15;
385 + bool isDeleted = 16;
386 +}
387 +
388 +message GetMpAccountByIdRpcRequest {
389 + int32 id = 1;
390 + int32 enterpriseId = 2;
391 + bool includeDeleted = 3;
392 +}
393 +
394 +message GetMpAccountByIdRpcResponse {
395 + SingleMpAccountRpcResponse response = 1;
396 +}
397 +
398 +message GetMpAccountByOpenIdRpcRequest {
399 + string openId = 1;
400 +}
401 +
402 +message GetMpAccountByOpenIdRpcResponse {
403 + SingleMpAccountRpcResponse response = 1;
404 +}
405 +
406 +message GetMpAccountsByIdsRpcRequest {
407 + repeated int32 ids = 1;
408 + int32 enterpriseId = 2;
409 + bool includeDeleted = 3;
410 +}
411 +
412 +message GetMpAccountsByIdsRpcResponse {
413 + repeated SingleMpAccountRpcResponse responses = 1;
414 +}
415 +
416 +message QueryMpAccountsByConditionRpcRequest {
417 + int32 enterpriseId = 1;
418 + bool shouldFilterOpenId = 2;
419 + string openId = 3;
420 + bool shouldFilterUnionId = 4;
421 + string unionId = 5;
422 + bool shouldFilterPhoneNumber = 6;
423 + string phoneNumber = 7;
424 + bool shouldFilterStatus = 8;
425 + MpAccountStatusEnum status = 9;
426 + bool includeDeleted = 10;
427 +}
428 +
429 +message QueryMpAccountsByConditionRpcResponse {
430 + repeated SingleMpAccountRpcResponse responses = 1;
431 +}
432 +
433 +message MpAccountCreation{
434 + string openId = 1;
435 + bool shouldCreateUnionId = 2;
436 + string unionId = 3;
437 + bool shouldCreateNickname = 4;
438 + string nickname = 5;
439 + bool shouldCreateAvatarUrl = 6;
440 + string avatarUrl = 7;
441 + MpAccountGenderEnum gender = 8;
442 + string phoneNumber = 9;
443 + MpAccountStatusEnum status = 10;
444 +}
445 +
446 +message CreateMpAccountRpcRequest {
447 + MpAccountCreation creation = 1;
448 + int32 enterpriseId = 2;
449 + int32 createdBy = 3;
450 + int32 creationSource = 4;
451 +}
452 +
453 +message CreateMpAccountRpcResponse {
454 + int32 id = 1;
455 + bool isCreated = 2;
456 +}
457 +
458 +message MpAccountModification {
459 + int32 id = 1;
460 + bool shouldUpdateOpenId = 2;
461 + string openId = 3;
462 + bool shouldUpdateUnionId = 4;
463 + string unionId = 5;
464 + bool shouldUpdateNickname = 6;
465 + string nickname = 7;
466 + bool shouldUpdateAvatarUrl = 8;
467 + string avatarUrl = 9;
468 + bool shouldUpdateGender = 10;
469 + MpAccountGenderEnum gender = 11;
470 + bool shouldUpdatePhoneNumber = 12;
471 + string phoneNumber = 13;
472 + bool shouldUpdateStatus = 14;
473 + MpAccountStatusEnum status = 15;
474 +}
475 +
476 +message UpdateMpAccountRpcRequest {
477 + MpAccountModification modification = 1;
478 + int32 enterpriseId = 2;
479 + int32 updatedBy = 3;
480 + int32 updateSource = 4;
481 +}
482 +
483 +message UpdateMpAccountRpcResponse {
484 + bool isUpdated = 1;
485 +}
486 +
487 +message DeleteMpAccountsByIdsRpcRequest {
488 + repeated int32 ids = 1;
489 + int32 enterpriseId = 2;
490 + int32 updatedBy = 3;
491 + int32 updateSource = 4;
492 +}
493 +
494 +message DeleteMpAccountsRpcResponse {
495 + bool isDeleted = 1;
496 +}
497 +
498 +message SingleMpAccountDinerRefRpcResponse {
499 + int32 id = 1;
500 + int32 enterpriseId = 2;
501 + int32 accountId = 3;
502 + int32 dinerId = 4;
503 + int32 createdBy = 5;
504 + int64 createdAt = 6;
505 + int32 creationSource = 7;
506 +}
507 +
508 +message GetMpAccountDinerRefsByIdsRpcRequest {
509 + repeated int32 ids = 1;
510 + int32 enterpriseId = 2;
511 +}
512 +
513 +message GetMpAccountDinerRefsByIdsRpcResponse {
514 + repeated SingleMpAccountDinerRefRpcResponse responses = 1;
515 +}
516 +
517 +message QueryMpAccountDinerRefsByConditionRpcRequest {
518 + int32 enterpriseId = 1;
519 + bool shouldFilterAccountIds = 2;
520 + repeated int32 accountIds = 3;
521 + bool shouldFilterDinerIds = 4;
522 + repeated int32 dinerIds = 5;
523 +}
524 +
525 +message QueryMpAccountDinerRefsByConditionRpcResponse {
526 + repeated SingleMpAccountDinerRefRpcResponse responses = 1;
527 +}
528 +
529 +message MpAccountDinerRefCreation{
530 + int32 accountId = 1;
531 + int32 dinerId = 2;
532 +}
533 +
534 +message CreateMpAccountDinerRefRpcRequest {
535 + MpAccountDinerRefCreation creation = 1;
536 + int32 enterpriseId = 2;
537 + int32 createdBy = 3;
538 + int32 creationSource = 4;
539 +}
540 +
541 +message CreateMpAccountDinerRefRpcResponse {
542 + int32 id = 1;
543 + bool isCreated = 2;
544 +}
545 +
546 +message BatchCreateMpAccountDinerRefsRpcRequest {
547 + repeated MpAccountDinerRefCreation creations = 1;
548 + int32 enterpriseId = 2;
549 + int32 createdBy = 3;
550 + int32 creationSource = 4;
551 +}
552 +
553 +message BatchCreateMpAccountDinerRefsRpcResponse {
554 + repeated int32 ids = 1;
555 + bool isCreated = 2;
556 +}
557 +
558 +message DeleteMpAccountDinerRefsByIdsRpcRequest {
559 + repeated int32 ids = 1;
560 + int32 enterpriseId = 2;
561 +}
562 +
563 +message DeleteMpAccountDinerRefsRpcResponse {
564 + bool isDeleted = 1;
565 +}
566 +
567 +message SingleGradeClassRpcResponse {
568 + int32 id = 1;
569 + int32 enterpriseId = 2;
570 + int32 clientId = 3;
571 + string gradeName = 4;
572 + string className = 5;
573 + string fullName = 6;
574 + int32 createdBy = 7;
575 + int64 createdAt = 8;
576 + int32 creationSource = 9;
577 + int32 updatedBy = 10;
578 + int64 updatedAt = 11;
579 + int32 updateSource = 12;
580 + bool isDeleted = 13;
581 +}
582 +
583 +message GetGradeClassByIdRpcRequest {
584 + int32 id = 1;
585 + int32 enterpriseId = 2;
586 + bool includeDeleted = 3;
587 +}
588 +
589 +message GetGradeClassByIdRpcResponse {
590 + SingleGradeClassRpcResponse response = 1;
591 +}
592 +
593 +message GetGradeClassesByIdsRpcRequest {
594 + repeated int32 ids = 1;
595 + int32 enterpriseId = 2;
596 + bool includeDeleted = 3;
597 +}
598 +
599 +message GetGradeClassesByIdsRpcResponse {
600 + repeated SingleGradeClassRpcResponse responses = 1;
601 +}
602 +
603 +message GetAllGradeClassesRpcRequest {
604 + int32 enterpriseId = 1;
605 + bool includeDeleted = 2;
606 +}
607 +
608 +message GetAllGradeClassesRpcResponse {
609 + repeated SingleGradeClassRpcResponse responses = 1;
610 +}
611 +
612 +message QueryGradeClassesByConditionRpcRequest {
613 + int32 enterpriseId = 1;
614 + bool shouldFilterClientIds = 2;
615 + repeated int32 clientIds = 3;
616 + bool shouldFilterGradeName = 4;
617 + string gradeName = 5;
618 + bool includeDeleted = 6;
619 +}
620 +
621 +message QueryGradeClassesByConditionRpcResponse {
622 + repeated SingleGradeClassRpcResponse responses = 1;
623 +}
624 +
625 +message GradeClassCreation{
626 + int32 clientId = 1;
627 + string gradeName = 2;
628 + string className = 3;
629 + bool shouldCreateFullName = 4;
630 + string fullName = 5;
631 +}
632 +
633 +message CreateGradeClassRpcRequest {
634 + GradeClassCreation creation = 1;
635 + int32 enterpriseId = 2;
636 + int32 createdBy = 3;
637 + int32 creationSource = 4;
638 +}
639 +
640 +message CreateGradeClassRpcResponse {
641 + int32 id = 1;
642 + bool isCreated = 2;
643 +}
644 +
645 +message BatchCreateGradeClassesRpcRequest {
646 + repeated GradeClassCreation creations = 1;
647 + int32 enterpriseId = 2;
648 + int32 createdBy = 3;
649 + int32 creationSource = 4;
650 +}
651 +
652 +message BatchCreateGradeClassesRpcResponse {
653 + repeated int32 ids = 1;
654 + bool isCreated = 2;
655 +}
656 +
657 +message GradeClassModification {
658 + int32 id = 1;
659 + bool shouldUpdateClientId = 2;
660 + int32 clientId = 3;
661 + bool shouldUpdateGradeName = 4;
662 + string gradeName = 5;
663 + bool shouldUpdateClassName = 6;
664 + string className = 7;
665 + bool shouldUpdateFullName = 8;
666 + string fullName = 9;
667 +}
668 +
669 +message UpdateGradeClassRpcRequest {
670 + GradeClassModification modification = 1;
671 + int32 enterpriseId = 2;
672 + int32 updatedBy = 3;
673 + int32 updateSource = 4;
674 +}
675 +
676 +message UpdateGradeClassRpcResponse {
677 + bool isUpdated = 1;
678 +}
679 +
680 +message BatchSaveOrUpdateGradeClassesRpcRequest {
681 + repeated GradeClassModification modifications = 1;
682 + int32 enterpriseId = 2;
683 + int32 updatedBy = 3;
684 + int32 updateSource = 4;
685 +}
686 +
687 +message BatchSaveOrUpdateGradeClassesRpcResponse {
688 + bool isUpdated = 1;
689 +}
690 +
691 +message BatchUpdateGradeClassesRpcRequest {
692 + repeated GradeClassModification modifications = 1;
693 + int32 enterpriseId = 2;
694 + int32 updatedBy = 3;
695 + int32 updateSource = 4;
696 +}
697 +
698 +message BatchUpdateGradeClassesRpcResponse {
699 + bool isUpdated = 1;
700 +}
701 +
702 +message DeleteGradeClassesByIdsRpcRequest {
703 + repeated int32 ids = 1;
704 + int32 enterpriseId = 2;
705 + int32 updatedBy = 3;
706 + int32 updateSource = 4;
707 +}
708 +
709 +message DeleteGradeClassesRpcResponse {
710 + bool isDeleted = 1;
711 +}
712 +
713 +message DeleteGradeClassesAndDinersByClientIdsRpcRequest {
714 + repeated int32 clientIds = 1;
715 + int32 enterpriseId = 2;
716 + int32 updatedBy = 3;
717 + int32 updateSource = 4;
718 +}
719 +
720 +message DeleteGradeClassesAndDinersByClientIdsRpcResponse {
721 + bool isDeleted = 1;
722 +}
723 +
724 +message SingleMealMenuRecordRpcResponse {
725 + int32 id = 1;
726 + int32 enterpriseId = 2;
727 + int32 clientId = 3;
728 + string name = 4;
729 + string imageUrl = 5;
730 + int32 createdBy = 6;
731 + int64 createdAt = 7;
732 + int32 creationSource = 8;
733 + int32 updatedBy = 9;
734 + int64 updatedAt = 10;
735 + int32 updateSource = 11;
736 + bool isDeleted = 12;
737 +}
738 +
739 +message GetMealMenuRecordByIdRpcRequest {
740 + int32 id = 1;
741 + int32 enterpriseId = 2;
742 + bool includeDeleted = 3;
743 +}
744 +
745 +message GetMealMenuRecordByIdRpcResponse {
746 + SingleMealMenuRecordRpcResponse response = 1;
747 +}
748 +
749 +message GetMealMenuRecordsByIdsRpcRequest {
750 + repeated int32 ids = 1;
751 + int32 enterpriseId = 2;
752 + bool includeDeleted = 3;
753 +}
754 +
755 +message GetMealMenuRecordsByIdsRpcResponse {
756 + repeated SingleMealMenuRecordRpcResponse responses = 1;
757 +}
758 +
759 +message QueryMealMenuRecordsByConditionRpcRequest {
760 + int32 enterpriseId = 1;
761 + bool shouldFilterClientIds = 2;
762 + repeated int32 clientIds = 3;
763 + bool shouldFilterName = 4;
764 + string name = 5;
765 + bool includeDeleted = 6;
766 +}
767 +
768 +message QueryMealMenuRecordsByConditionRpcResponse {
769 + repeated SingleMealMenuRecordRpcResponse responses = 1;
770 +}
771 +
772 +message MealMenuRecordCreation{
773 + int32 clientId = 1;
774 + string name = 2;
775 + bool shouldCreateImageUrl = 3;
776 + string imageUrl = 4;
777 +}
778 +
779 +message CreateMealMenuRecordRpcRequest {
780 + MealMenuRecordCreation creation = 1;
781 + int32 enterpriseId = 2;
782 + int32 createdBy = 3;
783 + int32 creationSource = 4;
784 +}
785 +
786 +message CreateMealMenuRecordRpcResponse {
787 + int32 id = 1;
788 + bool isCreated = 2;
789 +}
790 +
791 +message QueryLatestMealMenuRecordsByClientIdsRpcRequest {
792 + int32 enterpriseId = 1;
793 + repeated int32 clientId = 2;
794 +}
795 +
796 +message QueryLatestMealMenuRecordsByClientIdsRpcResponse {
797 + repeated SingleMealMenuRecordRpcResponse responses = 1;
798 +}
...@@ -7,20 +7,13 @@ spring.main.web-application-type=none ...@@ -7,20 +7,13 @@ spring.main.web-application-type=none
7 spring.application.name=order-service 7 spring.application.name=order-service
8 spring.datasource.driver-class-name=com.mysql.jdbc.Driver 8 spring.datasource.driver-class-name=com.mysql.jdbc.Driver
9 9
10 -spring.datasource.dynamic.datasource.master.url=jdbc:mysql://localhost:3306/cater?autoReconnect=true&tcpKeepAlive=true&rewriteBatchedStatements=true&statementInterceptors=com.tianting.infoloop.tracing.MysqlZipkinInterceptor&useSSL=false 10 +spring.datasource.dynamic.datasource.master.url=jdbc:mysql://localhost:3306/test?autoReconnect=true&tcpKeepAlive=true&rewriteBatchedStatements=true&statementInterceptors=com.tianting.infoloop.tracing.MysqlZipkinInterceptor&useSSL=false
11 spring.datasource.dynamic.datasource.master.username=root 11 spring.datasource.dynamic.datasource.master.username=root
12 -spring.datasource.dynamic.datasource.master.password=QAZwsx098 12 +spring.datasource.dynamic.datasource.master.password=123456
13 -spring.datasource.dynamic.datasource.slave.url=jdbc:mysql://localhost:3306/cater_slave?autoReconnect=true&tcpKeepAlive=true&statementInterceptors=com.tianting.infoloop.tracing.MysqlZipkinInterceptor&useSSL=false 13 +spring.datasource.dynamic.datasource.slave.url=jdbc:mysql://localhost:3306/test?autoReconnect=true&tcpKeepAlive=true&statementInterceptors=com.tianting.infoloop.tracing.MysqlZipkinInterceptor&useSSL=false
14 spring.datasource.dynamic.datasource.slave.username=root 14 spring.datasource.dynamic.datasource.slave.username=root
15 -spring.datasource.dynamic.datasource.slave.password=QAZwsx098 15 +spring.datasource.dynamic.datasource.slave.password=123456
16 spring.datasource.dynamic.primary=master 16 spring.datasource.dynamic.primary=master
17 -#spring.datasource.dynamic.datasource.master.url=jdbc:mysql://rm-uf63gfjzejp163e3g4o.mysql.rds.aliyuncs.com:3306/qingniu?autoReconnect=true&tcpKeepAlive=true&rewriteBatchedStatements=true&statementInterceptors=com.tianting.infoloop.tracing.MysqlZipkinInterceptor&useSSL=false
18 -#spring.datasource.dynamic.datasource.master.username=jj_infoloop_stage
19 -#spring.datasource.dynamic.datasource.master.password=H8kjNeChi1wimXw
20 -#spring.datasource.dynamic.datasource.slave.url=jdbc:mysql://rm-uf63gfjzejp163e3g4o.mysql.rds.aliyuncs.com:3306/qingniu?autoReconnect=true&tcpKeepAlive=true&statementInterceptors=com.tianting.infoloop.tracing.MysqlZipkinInterceptor&useSSL=false
21 -#spring.datasource.dynamic.datasource.slave.username=jj_infoloop_stage
22 -#spring.datasource.dynamic.datasource.slave.password=H8kjNeChi1wimXw
23 -#spring.datasource.dynamic.primary=master
24 17
25 logging.config=classpath:logback-spring.xml 18 logging.config=classpath:logback-spring.xml
26 19
......
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!DOCTYPE mapper
3 + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 + "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 +<mapper namespace="com.tianting.infoloop.mapper.DinerMapper">
6 +
7 + <resultMap id="BaseResultMap" type="com.tianting.infoloop.model.db.Diner">
8 + <id property="id" column="id" jdbcType="INTEGER"/>
9 + <result property="enterpriseId" column="enterpriseId" jdbcType="INTEGER"/>
10 + <result property="clientId" column="clientId" jdbcType="INTEGER"/>
11 + <result property="classId" column="classId" jdbcType="INTEGER"/>
12 + <result property="studentNo" column="studentNo" jdbcType="VARCHAR"/>
13 + <result property="name" column="name" jdbcType="VARCHAR"/>
14 + <result property="createdBy" column="createdBy" jdbcType="INTEGER"/>
15 + <result property="createdAt" column="createdAt" jdbcType="TIMESTAMP"/>
16 + <result property="creationSource" column="creationSource" jdbcType="INTEGER"/>
17 + <result property="updatedBy" column="updatedBy" jdbcType="INTEGER"/>
18 + <result property="updatedAt" column="updatedAt" jdbcType="TIMESTAMP"/>
19 + <result property="updateSource" column="updateSource" jdbcType="INTEGER"/>
20 + <result property="isDeleted" column="isDeleted" jdbcType="TINYINT"/>
21 + </resultMap>
22 +
23 + <sql id="Base_Column_List">
24 + id,enterpriseId,clientId,
25 + classId,studentNo,name,
26 + createdBy,createdAt,creationSource,
27 + updatedBy,updatedAt,updateSource,
28 + isDeleted
29 + </sql>
30 +</mapper>
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!DOCTYPE mapper
3 + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 + "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 +<mapper namespace="com.tianting.infoloop.mapper.GradeClassMapper">
6 +
7 + <resultMap id="BaseResultMap" type="com.tianting.infoloop.model.db.GradeClass">
8 + <id property="id" column="id" jdbcType="INTEGER"/>
9 + <result property="enterpriseId" column="enterpriseId" jdbcType="INTEGER"/>
10 + <result property="clientId" column="clientId" jdbcType="INTEGER"/>
11 + <result property="gradeName" column="gradeName" jdbcType="VARCHAR"/>
12 + <result property="className" column="className" jdbcType="VARCHAR"/>
13 + <result property="fullName" column="fullName" jdbcType="VARCHAR"/>
14 + <result property="createdBy" column="createdBy" jdbcType="INTEGER"/>
15 + <result property="createdAt" column="createdAt" jdbcType="TIMESTAMP"/>
16 + <result property="creationSource" column="creationSource" jdbcType="INTEGER"/>
17 + <result property="updatedBy" column="updatedBy" jdbcType="INTEGER"/>
18 + <result property="updatedAt" column="updatedAt" jdbcType="TIMESTAMP"/>
19 + <result property="updateSource" column="updateSource" jdbcType="INTEGER"/>
20 + <result property="isDeleted" column="isDeleted" jdbcType="TINYINT"/>
21 + </resultMap>
22 +
23 + <sql id="Base_Column_List">
24 + id,enterpriseId,clientId,
25 + gradeName,className,fullName,
26 + createdBy,createdAt,creationSource,
27 + updatedBy,updatedAt,updateSource,
28 + isDeleted
29 + </sql>
30 +</mapper>
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!DOCTYPE mapper
3 + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 + "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 +<mapper namespace="com.tianting.infoloop.mapper.MealMenuRecordMapper">
6 +
7 + <resultMap id="BaseResultMap" type="com.tianting.infoloop.model.db.MealMenuRecord">
8 + <id property="id" column="id" jdbcType="INTEGER"/>
9 + <result property="enterpriseId" column="enterpriseId" jdbcType="INTEGER"/>
10 + <result property="clientId" column="clientId" jdbcType="INTEGER"/>
11 + <result property="name" column="name" jdbcType="VARCHAR"/>
12 + <result property="imageUrl" column="imageUrl" jdbcType="VARCHAR"/>
13 + <result property="createdBy" column="createdBy" jdbcType="INTEGER"/>
14 + <result property="createdAt" column="createdAt" jdbcType="TIMESTAMP"/>
15 + <result property="creationSource" column="creationSource" jdbcType="INTEGER"/>
16 + <result property="updatedBy" column="updatedBy" jdbcType="INTEGER"/>
17 + <result property="updatedAt" column="updatedAt" jdbcType="TIMESTAMP"/>
18 + <result property="updateSource" column="updateSource" jdbcType="INTEGER"/>
19 + <result property="isDeleted" column="isDeleted" jdbcType="TINYINT"/>
20 + </resultMap>
21 +
22 + <sql id="Base_Column_List">
23 + id,enterpriseId,clientId,
24 + name,imageUrl,createdBy,
25 + createdAt,creationSource,updatedBy,
26 + updatedAt,updateSource,isDeleted
27 + </sql>
28 +</mapper>
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!DOCTYPE mapper
3 + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 + "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 +<mapper namespace="com.tianting.infoloop.mapper.MealOrderMapper">
6 +
7 + <resultMap id="BaseResultMap" type="com.tianting.infoloop.model.db.MealOrder">
8 + <id property="id" column="id" jdbcType="INTEGER"/>
9 + <result property="enterpriseId" column="enterpriseId" jdbcType="INTEGER"/>
10 + <result property="clientId" column="clientId" jdbcType="INTEGER"/>
11 + <result property="menuId" column="menuId" jdbcType="INTEGER"/>
12 + <result property="accountId" column="accountId" jdbcType="INTEGER"/>
13 + <result property="orderMethod" column="orderMethod" jdbcType="TINYINT"/>
14 + <result property="dinerId" column="dinerId" jdbcType="INTEGER"/>
15 + <result property="dinerName" column="dinerName" jdbcType="VARCHAR"/>
16 + <result property="clientName" column="clientName" jdbcType="VARCHAR"/>
17 + <result property="gradeName" column="gradeName" jdbcType="VARCHAR"/>
18 + <result property="className" column="className" jdbcType="VARCHAR"/>
19 + <result property="studentNo" column="studentNo" jdbcType="VARCHAR"/>
20 + <result property="reserveDate" column="reserveDate" jdbcType="TIMESTAMP"/>
21 + <result property="meals" column="meals" jdbcType="OTHER"/>
22 + <result property="createdBy" column="createdBy" jdbcType="INTEGER"/>
23 + <result property="createdAt" column="createdAt" jdbcType="TIMESTAMP"/>
24 + <result property="creationSource" column="creationSource" jdbcType="INTEGER"/>
25 + <result property="updatedBy" column="updatedBy" jdbcType="INTEGER"/>
26 + <result property="updatedAt" column="updatedAt" jdbcType="TIMESTAMP"/>
27 + <result property="updateSource" column="updateSource" jdbcType="INTEGER"/>
28 + <result property="isDeleted" column="isDeleted" jdbcType="TINYINT"/>
29 + </resultMap>
30 +
31 + <sql id="Base_Column_List">
32 + id,enterpriseId,clientId,
33 + menuId,accountId,orderMethod,
34 + dinerId,dinerName,clientName,
35 + gradeName,className,studentNo,
36 + reserveDate,meals,createdBy,
37 + createdAt,creationSource,updatedBy,
38 + updatedAt,updateSource,isDeleted
39 + </sql>
40 +</mapper>
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!DOCTYPE mapper
3 + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 + "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 +<mapper namespace="com.tianting.infoloop.mapper.MpAccountDinerRefMapper">
6 +
7 + <resultMap id="BaseResultMap" type="com.tianting.infoloop.model.db.MpAccountDinerRef">
8 + <id property="id" column="id" jdbcType="INTEGER"/>
9 + <result property="enterpriseId" column="enterpriseId" jdbcType="INTEGER"/>
10 + <result property="accountId" column="accountId" jdbcType="INTEGER"/>
11 + <result property="dinerId" column="dinerId" jdbcType="INTEGER"/>
12 + <result property="createdBy" column="createdBy" jdbcType="INTEGER"/>
13 + <result property="createdAt" column="createdAt" jdbcType="TIMESTAMP"/>
14 + <result property="creationSource" column="creationSource" jdbcType="INTEGER"/>
15 + </resultMap>
16 +
17 + <sql id="Base_Column_List">
18 + id,enterpriseId,accountId,
19 + dinerId,createdBy,createdAt,
20 + creationSource
21 + </sql>
22 +</mapper>
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!DOCTYPE mapper
3 + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 + "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 +<mapper namespace="com.tianting.infoloop.mapper.MpAccountMapper">
6 +
7 + <resultMap id="BaseResultMap" type="com.tianting.infoloop.model.db.MpAccount">
8 + <id property="id" column="id" jdbcType="INTEGER"/>
9 + <result property="enterpriseId" column="enterpriseId" jdbcType="INTEGER"/>
10 + <result property="openId" column="openId" jdbcType="VARCHAR"/>
11 + <result property="unionId" column="unionId" jdbcType="VARCHAR"/>
12 + <result property="nickname" column="nickname" jdbcType="VARCHAR"/>
13 + <result property="avatarUrl" column="avatarUrl" jdbcType="VARCHAR"/>
14 + <result property="gender" column="gender" jdbcType="TINYINT"/>
15 + <result property="phoneNumber" column="phoneNumber" jdbcType="VARCHAR"/>
16 + <result property="status" column="status" jdbcType="TINYINT"/>
17 + <result property="createdBy" column="createdBy" jdbcType="INTEGER"/>
18 + <result property="createdAt" column="createdAt" jdbcType="TIMESTAMP"/>
19 + <result property="creationSource" column="creationSource" jdbcType="INTEGER"/>
20 + <result property="updatedBy" column="updatedBy" jdbcType="INTEGER"/>
21 + <result property="updatedAt" column="updatedAt" jdbcType="TIMESTAMP"/>
22 + <result property="updateSource" column="updateSource" jdbcType="INTEGER"/>
23 + <result property="isDeleted" column="isDeleted" jdbcType="TINYINT"/>
24 + </resultMap>
25 +
26 + <sql id="Base_Column_List">
27 + id,enterpriseId,openId,
28 + unionId,nickname,avatarUrl,
29 + gender,phoneNumber,status,
30 + createdBy,createdAt,creationSource,
31 + updatedBy,updatedAt,updateSource,
32 + isDeleted
33 + </sql>
34 +</mapper>