diff --git a/bonus-common-biz/pom.xml b/bonus-common-biz/pom.xml
index 02219f0d..fd773b73 100644
--- a/bonus-common-biz/pom.xml
+++ b/bonus-common-biz/pom.xml
@@ -221,6 +221,12 @@
33.0.0-jre
compile
+
+ com.amazonaws
+ aws-java-sdk-s3
+ 1.12.780
+
+
diff --git a/bonus-common-biz/src/main/java/com/bonus/framework/config/deserializer/DateTimeDeserializer.java b/bonus-common-biz/src/main/java/com/bonus/framework/config/deserializer/DateTimeDeserializer.java
new file mode 100644
index 00000000..d7092f64
--- /dev/null
+++ b/bonus-common-biz/src/main/java/com/bonus/framework/config/deserializer/DateTimeDeserializer.java
@@ -0,0 +1,101 @@
+package com.bonus.framework.config.deserializer;
+
+
+import com.beust.jcommander.internal.Maps;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.IOException;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class DateTimeDeserializer extends JsonDeserializer {
+ public static final String YYYY_MM_DD_HH_MM_SS = "yyyy$1MM$2dd$3HH$4mm$5ss$6";
+ public static final String YYYY_MM_DD_HH_MM = "yyyy$1MM$2dd$3HH$4mm$5";
+ public static final String YYYY_MM_DD_HH = "yyyy$1MM$2dd$3HH$4";
+ public static final String YYYY_MM_DD = "yyyy$1MM$2dd$3";
+ public static final String YYYY_MM = "yyyy$1MM$2";
+ public static final String HH_MM_SS = "HH$1mm$2ss$3";
+ public static final String HH_MM = "HH$1mm$2";
+ private static final Map patternMap = Maps.newLinkedHashMap();
+
+ public static void main(String[] args) {
+ System.out.println(getPattern("2014/10/10 11:11:11"));
+ System.out.println(getPattern("2014-10-10"));
+ System.out.println(getPattern("2014-10-10 11:11"));
+ System.out.println(getPattern("2014-10"));
+ System.out.println(getPattern("2014年10月10日 11点11分11秒"));
+ System.out.println(getPattern("11:11:11"));
+ System.out.println(getPattern("11点11分"));
+ }
+
+ public static String getPattern(String dateString) {
+ Iterator var1 = patternMap.entrySet().iterator();
+
+ while(var1.hasNext()) {
+ Map.Entry entry = (Map.Entry)var1.next();
+ Matcher matcher = ((Pattern)entry.getValue()).matcher(dateString);
+ if (matcher.find()) {
+ if ("yyyy$1MM$2dd$3HH$4mm$5ss$6".equals(entry.getKey())) {
+ return "yyyy$1MM$2dd$3HH$4mm$5ss$6".replace("$1", matcher.group(1)).replace("$2", matcher.group(2)).replace("$3", matcher.group(3)).replace("$4", matcher.group(4)).replace("$5", matcher.group(5)).replace("$6", matcher.group(6));
+ }
+
+ if ("yyyy$1MM$2dd$3HH$4mm$5".equals(entry.getKey())) {
+ return "yyyy$1MM$2dd$3HH$4mm$5".replace("$1", matcher.group(1)).replace("$2", matcher.group(2)).replace("$3", matcher.group(3)).replace("$4", matcher.group(4)).replace("$5", matcher.group(5));
+ }
+
+ if ("yyyy$1MM$2dd$3HH$4".equals(entry.getKey())) {
+ return "yyyy$1MM$2dd$3HH$4".replace("$1", matcher.group(1)).replace("$2", matcher.group(2)).replace("$3", matcher.group(3)).replace("$4", matcher.group(4));
+ }
+
+ if ("yyyy$1MM$2dd$3".equals(entry.getKey())) {
+ return "yyyy$1MM$2dd$3".replace("$1", matcher.group(1)).replace("$2", matcher.group(2)).replace("$3", matcher.group(3));
+ }
+
+ if ("yyyy$1MM$2".equals(entry.getKey())) {
+ return "yyyy$1MM$2".replace("$1", matcher.group(1)).replace("$2", matcher.group(2));
+ }
+
+ if ("HH$1mm$2ss$3".equals(entry.getKey())) {
+ return "HH$1mm$2ss$3".replace("$1", matcher.group(1)).replace("$2", matcher.group(2)).replace("$3", matcher.group(3));
+ }
+
+ if ("HH$1mm$2".equals(entry.getKey())) {
+ return "HH$1mm$2".replace("$1", matcher.group(1)).replace("$2", matcher.group(2));
+ }
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ public LocalDateTime deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
+ if (StringUtils.isBlank(p.getText())) {
+ return null;
+ } else {
+ String pattern = getPattern(p.getText());
+ if (pattern == null) {
+ throw new RuntimeException("不支持的日期格式:" + p.getText());
+ } else {
+ return LocalDateTime.parse(p.getText(), DateTimeFormatter.ofPattern(pattern));
+ }
+ }
+ }
+
+ static {
+ patternMap.put("yyyy$1MM$2dd$3HH$4mm$5ss$6", Pattern.compile("^\\d{4}(\\D+)\\d{1,2}(\\D+)\\d{1,2}(\\D+)\\d{1,2}(\\D+)\\d{1,2}(\\D+)\\d{1,2}(\\D?)$"));
+ patternMap.put("yyyy$1MM$2dd$3HH$4mm$5", Pattern.compile("^\\d{4}(\\D+)\\d{1,2}(\\D+)\\d{1,2}(\\D+)\\d{1,2}(\\D+)\\d{1,2}(\\D?)$"));
+ patternMap.put("yyyy$1MM$2dd$3HH$4", Pattern.compile("^\\d{4}(\\D+)\\d{1,2}(\\D+)\\d{1,2}(\\D+)\\d{1,2}(\\D?)$"));
+ patternMap.put("yyyy$1MM$2dd$3", Pattern.compile("^\\d{4}(\\D+)\\d{1,2}(\\D+)\\d{1,2}(\\D?)$"));
+ patternMap.put("yyyy$1MM$2", Pattern.compile("^\\d{4}(\\D+)\\d{1,2}(\\D?)$"));
+ patternMap.put("HH$1mm$2ss$3", Pattern.compile("^\\d{1,2}(\\D+)\\d{1,2}(\\D+)\\d{1,2}(\\D?)$"));
+ patternMap.put("HH$1mm$2", Pattern.compile("^\\d{1,2}(\\D+)\\d{1,2}(\\D?)$"));
+ }
+}
diff --git a/bonus-common-biz/src/main/java/com/bonus/framework/config/serializer/DateTimeSerializer.java b/bonus-common-biz/src/main/java/com/bonus/framework/config/serializer/DateTimeSerializer.java
new file mode 100644
index 00000000..b0ce4de4
--- /dev/null
+++ b/bonus-common-biz/src/main/java/com/bonus/framework/config/serializer/DateTimeSerializer.java
@@ -0,0 +1,64 @@
+package com.bonus.framework.config.serializer;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.SerializerProvider;
+
+import java.io.IOException;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+
+public class DateTimeSerializer extends JsonSerializer {
+ private final String pattern;
+
+ public DateTimeSerializer(String pattern) {
+ this.pattern = pattern;
+ }
+
+ @Override
+ public void serialize(LocalDateTime value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
+ gen.writeString(value.format(DateTimeFormatter.ofPattern(this.pattern)));
+ }
+
+ public static class HH_MM extends DateTimeSerializer {
+ public HH_MM() {
+ super("HH:mm");
+ }
+ }
+
+ public static class HH_MM_SS extends DateTimeSerializer {
+ public HH_MM_SS() {
+ super("HH:mm:ss");
+ }
+ }
+
+ public static class YYYY_MM extends DateTimeSerializer {
+ public YYYY_MM() {
+ super("yyyy-MM");
+ }
+ }
+
+ public static class YYYY_MM_DD extends DateTimeSerializer {
+ public YYYY_MM_DD() {
+ super("yyyy-MM-dd");
+ }
+ }
+
+ public static class YYYY_MM_DD_HH extends DateTimeSerializer {
+ public YYYY_MM_DD_HH() {
+ super("yyyy-MM-dd HH");
+ }
+ }
+
+ public static class YYYY_MM_DD_HH_MM extends DateTimeSerializer {
+ public YYYY_MM_DD_HH_MM() {
+ super("yyyy-MM-dd HH:mm");
+ }
+ }
+
+ public static class YYYY_MM_DD_HH_MM_SS extends DateTimeSerializer {
+ public YYYY_MM_DD_HH_MM_SS() {
+ super("yyyy-MM-dd HH:mm:ss");
+ }
+ }
+}
diff --git a/bonus-cust-auth/pom.xml b/bonus-cust-auth/pom.xml
index 3e15998a..2950f958 100644
--- a/bonus-cust-auth/pom.xml
+++ b/bonus-cust-auth/pom.xml
@@ -135,12 +135,16 @@
alipay-sdk-java
4.34.0.ALL
-
-
-
-
-
-
+
+ com.baomidou
+ mybatis-plus-extension
+ 3.5.6
+
+
+ com.baomidou
+ mybatis-plus-boot-starter
+ 3.5.10.1
+
diff --git a/bonus-modules/bonus-smart-canteen/pom.xml b/bonus-modules/bonus-smart-canteen/pom.xml
index 9e973958..08e50d4e 100644
--- a/bonus-modules/bonus-smart-canteen/pom.xml
+++ b/bonus-modules/bonus-smart-canteen/pom.xml
@@ -16,7 +16,11 @@
-
+
+ com.baomidou
+ mybatis-plus-boot-starter
+ 3.5.10.1
+
com.github.ulisesbocchio
diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/account/v3/metadata/controller/AccMetadataController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/account/v3/metadata/controller/AccMetadataController.java
new file mode 100644
index 00000000..309c2140
--- /dev/null
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/account/v3/metadata/controller/AccMetadataController.java
@@ -0,0 +1,32 @@
+package com.bonus.core.account.v3.metadata.controller;
+
+import com.bonus.core.account.v3.metadata.model.AccMetadataModel;
+import com.bonus.core.account.v3.metadata.service.AccMetadataService;
+import com.sun.org.slf4j.internal.Logger;
+import com.sun.org.slf4j.internal.LoggerFactory;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+@RestController
+@RequestMapping({"/api/v2/acc/metadata"})
+@Api(
+ tags = {"账户配置控制器"}
+)
+public class AccMetadataController {
+ private static final Logger log = LoggerFactory.getLogger(AccMetadataController.class);
+ @Resource
+ @Lazy
+ private AccMetadataService accMetadataService;
+
+ @ApiOperation("查询配置")
+ @PostMapping({"/query"})
+ public AccMetadataModel queryMetadata() {
+ return this.accMetadataService.queryMetadata();
+ }
+}
diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/account/v3/metadata/enums/AccWalletIdEnum.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/account/v3/metadata/enums/AccWalletIdEnum.java
new file mode 100644
index 00000000..d6c6332d
--- /dev/null
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/account/v3/metadata/enums/AccWalletIdEnum.java
@@ -0,0 +1,117 @@
+package com.bonus.core.account.v3.metadata.enums;
+
+import cn.hutool.core.collection.ListUtil;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+public enum AccWalletIdEnum {
+ WALLET(1, "个人钱包"),
+ SUBSIDY(2, "补贴钱包"),
+ LUCK_MONEY(4, "红包");
+
+ private final Integer key;
+ private final String desc;
+
+ private AccWalletIdEnum(Integer key, String desc) {
+ this.key = key;
+ this.desc = desc;
+ }
+
+ public static String getDesc(Integer key) {
+ AccWalletIdEnum[] var1 = values();
+ int var2 = var1.length;
+
+ for(int var3 = 0; var3 < var2; ++var3) {
+ AccWalletIdEnum temp = var1[var3];
+ if (temp.getKey().equals(key)) {
+ return temp.getDesc();
+ }
+ }
+
+ return "";
+ }
+
+ public static AccWalletIdEnum getEnum(Integer key) {
+ AccWalletIdEnum[] var1 = values();
+ int var2 = var1.length;
+
+ for(int var3 = 0; var3 < var2; ++var3) {
+ AccWalletIdEnum temp = var1[var3];
+ if (temp.getKey().equals(key)) {
+ return temp;
+ }
+ }
+
+ return null;
+ }
+
+ public static Map getEnumMap() {
+ return (Map)Arrays.stream(values()).collect(Collectors.toMap(AccWalletIdEnum::getKey, Function.identity()));
+ }
+
+ public static List checkAccCancelWallet() {
+ return Arrays.asList(WALLET.getKey(), SUBSIDY.getKey());
+ }
+
+ public static String getAllWalletId() {
+ List list = new ArrayList();
+ AccWalletIdEnum[] var1 = values();
+ int var2 = var1.length;
+
+ for(int var3 = 0; var3 < var2; ++var3) {
+ AccWalletIdEnum temp = var1[var3];
+ list.add(temp.getKey());
+ }
+
+ return StringUtils.join(list, ",");
+ }
+
+ public static List getAllWalletIdList() {
+ List list = new ArrayList();
+ AccWalletIdEnum[] var1 = values();
+ int var2 = var1.length;
+
+ for(int var3 = 0; var3 < var2; ++var3) {
+ AccWalletIdEnum temp = var1[var3];
+ list.add(temp.getKey());
+ }
+
+ return list;
+ }
+
+ public static boolean ifSupportOpenRecharge(Integer walletId) {
+ return ListUtil.toList(new Integer[]{WALLET.getKey(), SUBSIDY.getKey()}).contains(walletId);
+ }
+
+ public static boolean iFCorrectWalletId(Integer key) {
+ List list = new ArrayList();
+ AccWalletIdEnum[] var2 = values();
+ int var3 = var2.length;
+
+ for(int var4 = 0; var4 < var3; ++var4) {
+ AccWalletIdEnum temp = var2[var4];
+ list.add(temp.getKey());
+ }
+
+ return list.contains(key);
+ }
+
+ public Integer getKey() {
+ return this.key;
+ }
+
+ public String getDesc() {
+ return this.desc;
+ }
+
+ // $FF: synthetic method
+ private static AccWalletIdEnum[] $values() {
+ return new AccWalletIdEnum[]{WALLET, SUBSIDY, LUCK_MONEY};
+ }
+}
diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/account/v3/metadata/model/AccMetadataModel.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/account/v3/metadata/model/AccMetadataModel.java
new file mode 100644
index 00000000..4343c8a1
--- /dev/null
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/account/v3/metadata/model/AccMetadataModel.java
@@ -0,0 +1,101 @@
+package com.bonus.core.account.v3.metadata.model;
+
+import cn.hutool.core.text.CharSequenceUtil;
+import cn.hutool.core.util.StrUtil;
+import com.bonus.core.account.v3.metadata.enums.AccWalletIdEnum;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@ApiModel("账户配置模型")
+public class AccMetadataModel {
+ @ApiModelProperty("账户支付顺序(1,2,4)")
+ private String accPayOrder;
+ @ApiModelProperty("是否启用第三方充值 默认否")
+ private String ifUseThirdRecharge;
+ @ApiModelProperty("是否查询第三方余额 默认否")
+ private String ifUseThirdAccBal;
+ @ApiModelProperty("账户个人钱包-最低余额限制 默认0")
+ private String minBalanceLimit;
+ @ApiModelProperty("账户补贴钱包-最低余额限制 默认0")
+ private String minSubBalanceLimit;
+ @ApiModelProperty("账户红包钱包-最低余额限制 默认0")
+ private String minRedBalanceLimit;
+ @ApiModelProperty("移动端取款是否审批 默认否 1是 2否")
+ private String ifApproveMobileWithdraw;
+ @ApiModelProperty("移动端是否支持取款 默认否")
+ private String ifSupportMobileWithdraw;
+ @ApiModelProperty("离线支付默认使用钱包(个人钱包)")
+ private String offlineWalletPay;
+
+ public String getAccPayOrder() {
+ return StrUtil.isBlank(this.accPayOrder) ? AccWalletIdEnum.getAllWalletId() : this.accPayOrder;
+ }
+
+ public String getOfflineWalletPay() {
+ return CharSequenceUtil.isBlank(this.offlineWalletPay) ? String.valueOf(AccWalletIdEnum.WALLET.getKey()) : this.offlineWalletPay;
+ }
+
+ public String getIfUseThirdRecharge() {
+ return this.ifUseThirdRecharge;
+ }
+
+ public String getIfUseThirdAccBal() {
+ return this.ifUseThirdAccBal;
+ }
+
+ public String getMinBalanceLimit() {
+ return this.minBalanceLimit;
+ }
+
+ public String getMinSubBalanceLimit() {
+ return this.minSubBalanceLimit;
+ }
+
+ public String getMinRedBalanceLimit() {
+ return this.minRedBalanceLimit;
+ }
+
+ public String getIfApproveMobileWithdraw() {
+ return this.ifApproveMobileWithdraw;
+ }
+
+ public String getIfSupportMobileWithdraw() {
+ return this.ifSupportMobileWithdraw;
+ }
+
+ public void setAccPayOrder(final String accPayOrder) {
+ this.accPayOrder = accPayOrder;
+ }
+
+ public void setIfUseThirdRecharge(final String ifUseThirdRecharge) {
+ this.ifUseThirdRecharge = ifUseThirdRecharge;
+ }
+
+ public void setIfUseThirdAccBal(final String ifUseThirdAccBal) {
+ this.ifUseThirdAccBal = ifUseThirdAccBal;
+ }
+
+ public void setMinBalanceLimit(final String minBalanceLimit) {
+ this.minBalanceLimit = minBalanceLimit;
+ }
+
+ public void setMinSubBalanceLimit(final String minSubBalanceLimit) {
+ this.minSubBalanceLimit = minSubBalanceLimit;
+ }
+
+ public void setMinRedBalanceLimit(final String minRedBalanceLimit) {
+ this.minRedBalanceLimit = minRedBalanceLimit;
+ }
+
+ public void setIfApproveMobileWithdraw(final String ifApproveMobileWithdraw) {
+ this.ifApproveMobileWithdraw = ifApproveMobileWithdraw;
+ }
+
+ public void setIfSupportMobileWithdraw(final String ifSupportMobileWithdraw) {
+ this.ifSupportMobileWithdraw = ifSupportMobileWithdraw;
+ }
+
+ public void setOfflineWalletPay(final String offlineWalletPay) {
+ this.offlineWalletPay = offlineWalletPay;
+ }
+}
diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/account/v3/metadata/service/AccMetadataService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/account/v3/metadata/service/AccMetadataService.java
new file mode 100644
index 00000000..31f587a9
--- /dev/null
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/account/v3/metadata/service/AccMetadataService.java
@@ -0,0 +1,21 @@
+package com.bonus.core.account.v3.metadata.service;
+
+import com.bonus.core.account.v3.metadata.model.AccMetadataModel;
+import com.bonus.core.allocation.api.AllocMetadataApi;
+import com.bonus.core.common.enums.MetadataModelTypeEnum;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+
+@Component
+public class AccMetadataService {
+ @Resource
+ @Lazy
+ private AllocMetadataApi allocMetadataApi;
+
+ public AccMetadataModel queryMetadata() {
+ return (AccMetadataModel)this.allocMetadataApi.queryMetadataModel(MetadataModelTypeEnum.ACC, new AccMetadataModel());
+ }
+}
diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/alloc/mapper/AllocPayMetadataMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/alloc/mapper/AllocPayMetadataMapper.java
new file mode 100644
index 00000000..96b7eba0
--- /dev/null
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/alloc/mapper/AllocPayMetadataMapper.java
@@ -0,0 +1,9 @@
+package com.bonus.core.allocation.alloc.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.bonus.core.allocation.alloc.model.AllocMetadata;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface AllocPayMetadataMapper extends BaseMapper {
+}
diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/alloc/mapper/AllocPayMetadataMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/alloc/mapper/AllocPayMetadataMapper.xml
new file mode 100644
index 00000000..034d3ec2
--- /dev/null
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/alloc/mapper/AllocPayMetadataMapper.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/alloc/model/AllocMetadata.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/alloc/model/AllocMetadata.java
new file mode 100644
index 00000000..71a990dd
--- /dev/null
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/alloc/model/AllocMetadata.java
@@ -0,0 +1,51 @@
+package com.bonus.core.allocation.alloc.model;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.collection.ListUtil;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.bonus.core.common.enums.MetadataModelTypeEnum;
+import com.bonus.framework.config.deserializer.DateTimeDeserializer;
+import com.bonus.framework.config.serializer.DateTimeSerializer;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+
+@TableName("alloc_metadata")
+@ApiModel("元数据配置表")
+@Data
+public class AllocMetadata {
+ @TableId
+ @ApiModelProperty("元数据id")
+ private Long metadataId;
+ @ApiModelProperty("区域id")
+ private Long areaId;
+ @ApiModelProperty("食堂id")
+ private Long canteenId;
+ @ApiModelProperty("档口id")
+ private Long stallId;
+ @ApiModelProperty("是否有效 1是2否")
+ private Integer ifActive;
+ @ApiModelProperty("模型类型")
+ private String modelType;
+ @ApiModelProperty("模型key")
+ private String modelKey;
+ @ApiModelProperty("模型值")
+ private String modelValue;
+ @ApiModelProperty("模型key备注")
+ private String modelKeyRemark;
+ @ApiModelProperty("创建人")
+ private String crby;
+ @ApiModelProperty("创建时间")
+ private LocalDateTime crtime;
+ @ApiModelProperty("更新人")
+ private String upby;
+ @ApiModelProperty("更新时间")
+ private LocalDateTime uptime;
+
+}
diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/alloc/model/MetadataModel.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/alloc/model/MetadataModel.java
new file mode 100644
index 00000000..5929dcbb
--- /dev/null
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/alloc/model/MetadataModel.java
@@ -0,0 +1,38 @@
+package com.bonus.core.allocation.alloc.model;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@ApiModel("元数据model")
+public class MetadataModel {
+ @ApiModelProperty("模型key")
+ private String modelKey;
+ @ApiModelProperty("模型值")
+ private String modelValue;
+ @ApiModelProperty("模型key备注")
+ private String modelKeyRemark;
+
+ public String getModelKey() {
+ return this.modelKey;
+ }
+
+ public String getModelValue() {
+ return this.modelValue;
+ }
+
+ public String getModelKeyRemark() {
+ return this.modelKeyRemark;
+ }
+
+ public void setModelKey(final String modelKey) {
+ this.modelKey = modelKey;
+ }
+
+ public void setModelValue(final String modelValue) {
+ this.modelValue = modelValue;
+ }
+
+ public void setModelKeyRemark(final String modelKeyRemark) {
+ this.modelKeyRemark = modelKeyRemark;
+ }
+}
diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/alloc/service/AllocMetadataService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/alloc/service/AllocMetadataService.java
new file mode 100644
index 00000000..88eb0fcf
--- /dev/null
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/alloc/service/AllocMetadataService.java
@@ -0,0 +1,12 @@
+package com.bonus.core.allocation.alloc.service;
+
+
+import com.bonus.core.allocation.alloc.model.AllocMetadata;
+import com.bonus.core.common.enums.MetadataModelTypeEnum;
+
+import java.util.List;
+
+public interface AllocMetadataService {
+
+ List listPayMetadataByType(MetadataModelTypeEnum modelType, Long canteenId, Long stallId);
+}
diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/alloc/service/impl/AllocMetadataServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/alloc/service/impl/AllocMetadataServiceImpl.java
new file mode 100644
index 00000000..5061c83b
--- /dev/null
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/alloc/service/impl/AllocMetadataServiceImpl.java
@@ -0,0 +1,75 @@
+package com.bonus.core.allocation.alloc.service.impl;
+
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.bonus.core.allocation.alloc.mapper.AllocPayMetadataMapper;
+import com.bonus.core.allocation.alloc.model.AllocMetadata;
+import com.bonus.core.allocation.alloc.service.AllocMetadataService;
+import com.bonus.core.allocation.api.AllocStallApi;
+import com.bonus.core.allocation.canteen.model.AllocStall;
+import com.bonus.core.common.enums.MetadataModelTypeEnum;
+import com.bonus.core.common.redis.RedisUtil;
+import com.bonus.core.common.utils.TenantContextHolder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+@Service
+public class AllocMetadataServiceImpl extends ServiceImpl implements AllocMetadataService {
+ private static final Logger log = LoggerFactory.getLogger(AllocMetadataServiceImpl.class);
+ private static final String CACHE_PREFIX = "yst:";
+ private static final String CACHE_KEY = "pay-mata-data";
+ private static final long CACHE_SECONDS = 3600L;
+ @Resource
+ private AllocStallApi allocStallApi;
+
+ public List listPayMetadataCacheable(MetadataModelTypeEnum modelTypeEnum) {
+ return this.listPayMetadataCacheable(modelTypeEnum.getKey());
+ }
+ private List listPayMetadataCacheable(String modelType) {
+ String var10000 = this.getCacheKeyPrefix();
+ String cacheKey = var10000 + modelType;
+ Object cacheObj = RedisUtil.getObj(cacheKey);
+ if (cacheObj instanceof List) {
+ return (List)cacheObj;
+ } else {
+ List selectList = this.baseMapper.selectList(Wrappers.lambdaQuery(AllocMetadata.class).eq(AllocMetadata::getModelType, modelType));
+ RedisUtil.setObj(cacheKey, selectList, 3600L);
+ return selectList;
+ }
+ }
+ public String getCacheKeyPrefix() {
+ return "yst:" + TenantContextHolder.getTenantId() + ":pay-mata-data:";
+ }
+ @Override
+ public List listPayMetadataByType(MetadataModelTypeEnum modelType, Long canteenId, Long stallId) {
+ if (ObjectUtil.isNotNull(stallId) && ObjectUtil.isNull(canteenId)) {
+ AllocStall stall = this.allocStallApi.getAllocStall(stallId);
+ if (!ObjectUtil.isNull(stall) && !ObjectUtil.isNull(stall.getCanteenId())) {
+ canteenId = stall.getCanteenId();
+ } else {
+ log.warn("【配置项】未查到档口关联食堂:{},{},{}", new Object[]{modelType, canteenId, stallId});
+ }
+ }
+
+ Long finalCanteenId = canteenId;
+ return (List)this.listPayMetadataCacheable(modelType).stream().filter((s) -> {
+ return ObjectUtil.equal(s.getCanteenId(), finalCanteenId) && ObjectUtil.equal(s.getStallId(), stallId);
+ }).collect(Collectors.toList());
+ }
+
+
+ public String getPayMetadataValue(MetadataModelTypeEnum modelTypeEnum, String modelKey, Long canteenId, Long stallId) {
+ return (String)this.listPayMetadataByType(modelTypeEnum, canteenId, stallId).stream().filter((s) -> {
+ return StrUtil.equals(s.getModelKey(), modelKey);
+ }).map(AllocMetadata::getModelValue).filter(Objects::nonNull).findFirst().orElse("");
+ }
+
+}
diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/api/AllocMetadataApi.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/api/AllocMetadataApi.java
new file mode 100644
index 00000000..322eb5b7
--- /dev/null
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/api/AllocMetadataApi.java
@@ -0,0 +1,30 @@
+package com.bonus.core.allocation.api;
+
+import com.bonus.core.common.enums.MetadataModelTypeEnum;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+
+/**
+ * @ClassName: AllocMetadataApi
+ * @author: tqzhang
+ * @Date: 2025/1/24 23:51
+ * @version: 1.0
+ * @description:
+ */
+@Component
+public class AllocMetadataApi {
+ private static final Logger log = LoggerFactory.getLogger(AllocMetadataApi.class);
+ @Resource
+ @Lazy
+ private GlobalMetadataApi globalMetadataApi;
+
+ public T queryMetadataModel(MetadataModelTypeEnum modelTypeEnum, T t) {
+ return this.globalMetadataApi.getModel(modelTypeEnum, t, (Long)null, (Long)null);
+ }
+
+}
diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/api/AllocStallApi.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/api/AllocStallApi.java
new file mode 100644
index 00000000..e9cd5d0e
--- /dev/null
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/api/AllocStallApi.java
@@ -0,0 +1,21 @@
+package com.bonus.core.allocation.api;
+
+import com.bonus.core.allocation.canteen.model.AllocStall;
+import com.bonus.core.allocation.canteen.service.AllocStallService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+@Component
+public class AllocStallApi {
+ private static final Logger log = LoggerFactory.getLogger(AllocStallApi.class);
+ @Resource
+ @Lazy
+ private AllocStallService allocStallService;
+
+ public AllocStall getAllocStall(Long stallId) {
+ return this.allocStallService.getAllocStallCache(stallId);
+ }
+}
diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/api/GlobalMetadataApi.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/api/GlobalMetadataApi.java
new file mode 100644
index 00000000..d603ab09
--- /dev/null
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/api/GlobalMetadataApi.java
@@ -0,0 +1,33 @@
+package com.bonus.core.allocation.api;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.bonus.core.allocation.alloc.model.AllocMetadata;
+import com.bonus.core.allocation.alloc.service.AllocMetadataService;
+import com.bonus.core.allocation.util.MetadataUtil;
+import com.bonus.core.common.enums.MetadataModelTypeEnum;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Component
+public class GlobalMetadataApi {
+ private static final Logger log = LoggerFactory.getLogger(GlobalMetadataApi.class);
+ @Resource
+ @Lazy
+ private AllocMetadataService allocMetadataService;
+
+ public T getModel(MetadataModelTypeEnum modelTypeEnum, T t, Long canteenId, Long stallId) {
+ List metadataList = this.getList(modelTypeEnum, canteenId, stallId);
+ return MetadataUtil.transferToPayModel(metadataList, t);
+ }
+
+ public List getList(MetadataModelTypeEnum modelTypeEnum, Long canteenId, Long stallId) {
+ Long finalCanteenId = ObjectUtil.equal(canteenId, -1) ? null : canteenId;
+ Long finalStallId = ObjectUtil.equal(stallId, -1) ? null : stallId;
+ return this.allocMetadataService.listPayMetadataByType(modelTypeEnum, finalCanteenId, finalStallId);
+ }
+}
diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/canteen/mapper/AllocStallMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/canteen/mapper/AllocStallMapper.java
new file mode 100644
index 00000000..17913787
--- /dev/null
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/canteen/mapper/AllocStallMapper.java
@@ -0,0 +1,9 @@
+package com.bonus.core.allocation.canteen.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.bonus.core.allocation.canteen.model.AllocStall;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface AllocStallMapper extends BaseMapper {
+}
diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/canteen/mapper/AllocStallMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/canteen/mapper/AllocStallMapper.xml
new file mode 100644
index 00000000..a052cafb
--- /dev/null
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/canteen/mapper/AllocStallMapper.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/canteen/model/AllocStall.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/canteen/model/AllocStall.java
new file mode 100644
index 00000000..d7b6b9cc
--- /dev/null
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/canteen/model/AllocStall.java
@@ -0,0 +1,370 @@
+package com.bonus.core.allocation.canteen.model;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.bonus.core.common.utils.SysUtil;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
+import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
+import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
+import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+
+@TableName("alloc_stall")
+@ApiModel("档口信息表")
+public class AllocStall {
+ @TableId
+ @ApiModelProperty("主键id")
+ private Long id;
+ @ApiModelProperty("档口id")
+ private Long stallId;
+ @ApiModelProperty("档口编号")
+ private String stallNum;
+ @ApiModelProperty("档口名称")
+ private String stallName;
+ @ApiModelProperty("食堂id")
+ private Long canteenId;
+ @ApiModelProperty("区域id")
+ private Long areaId;
+ @ApiModelProperty("档口业务类型")
+ private Integer stallType;
+ @ApiModelProperty("第三方档口id")
+ private String thirdStallId;
+ @ApiModelProperty("人员id")
+ private Long custId;
+ @ApiModelProperty("联系电话")
+ private String contactTel;
+ @ApiModelProperty("主营项目")
+ private String mainProject;
+ @ApiModelProperty("档口营业状态")
+ private Integer businessState;
+ @ApiModelProperty("营业时间")
+ @JsonDeserialize(
+ using = LocalTimeDeserializer.class
+ )
+ @JsonSerialize(
+ using = LocalTimeSerializer.class
+ )
+ private LocalTime startBusinessTime;
+ @JsonDeserialize(
+ using = LocalTimeDeserializer.class
+ )
+ @JsonSerialize(
+ using = LocalTimeSerializer.class
+ )
+ private LocalTime endBusinessTime;
+ @ApiModelProperty("是否启用叫号")
+ private Integer ifUseCallNum;
+ @ApiModelProperty("线上流水号前缀")
+ private String onLineMealCodePrefix;
+ @ApiModelProperty("线下流水号前缀")
+ private String offLineMealCodePrefix;
+ @ApiModelProperty("是否启用配送配置")
+ private Integer ifEnableDelivery;
+ @ApiModelProperty("配送方式(多个数据之间 使用,分隔)")
+ private String deliveries;
+ @ApiModelProperty("是否启用点餐配置")
+ private Integer ifEnableOrder;
+ @ApiModelProperty("档口图片链接")
+ private String imgUrl;
+ @ApiModelProperty("是否支持报餐")
+ private Integer ifBook;
+ @ApiModelProperty("是否支持预定餐")
+ private Integer ifReserve;
+ @ApiModelProperty("是否启用收款码")
+ private Integer ifEnablePayCode;
+ @ApiModelProperty("档口收款码链接")
+ private String payCodeUrl;
+ @ApiModelProperty("是否删除")
+ private Integer ifDel;
+ @ApiModelProperty("创建人")
+ private String crby;
+ @ApiModelProperty("创建时间")
+ @JsonDeserialize(
+ using = LocalDateTimeDeserializer.class
+ )
+ @JsonSerialize(
+ using = LocalDateTimeSerializer.class
+ )
+ private LocalDateTime crtime;
+ @ApiModelProperty("更新人")
+ private String upby;
+ @ApiModelProperty("更新时间")
+ @JsonDeserialize(
+ using = LocalDateTimeDeserializer.class
+ )
+ @JsonSerialize(
+ using = LocalDateTimeSerializer.class
+ )
+ private LocalDateTime uptime;
+
+ public AllocStall(Long stallId) {
+ this.stallId = stallId;
+ }
+
+ public AllocStall(Long stallId, Long canteenId, String stallName, Integer stallType, String thirdStallId) {
+ this.stallId = stallId;
+ this.canteenId = canteenId;
+ this.stallName = stallName;
+ this.stallType = stallType;
+ this.thirdStallId = thirdStallId;
+ }
+
+ public String getImgUrl() {
+ return SysUtil.getCutPath(this.imgUrl);
+ }
+
+ public String getPayCodeUrl() {
+ return SysUtil.getCutPath(this.payCodeUrl);
+ }
+
+ public Long getId() {
+ return this.id;
+ }
+
+ public Long getStallId() {
+ return this.stallId;
+ }
+
+ public String getStallNum() {
+ return this.stallNum;
+ }
+
+ public String getStallName() {
+ return this.stallName;
+ }
+
+ public Long getCanteenId() {
+ return this.canteenId;
+ }
+
+ public Long getAreaId() {
+ return this.areaId;
+ }
+
+ public Integer getStallType() {
+ return this.stallType;
+ }
+
+ public String getThirdStallId() {
+ return this.thirdStallId;
+ }
+
+ public Long getCustId() {
+ return this.custId;
+ }
+
+ public String getContactTel() {
+ return this.contactTel;
+ }
+
+ public String getMainProject() {
+ return this.mainProject;
+ }
+
+ public Integer getBusinessState() {
+ return this.businessState;
+ }
+
+ public LocalTime getStartBusinessTime() {
+ return this.startBusinessTime;
+ }
+
+ public LocalTime getEndBusinessTime() {
+ return this.endBusinessTime;
+ }
+
+ public Integer getIfUseCallNum() {
+ return this.ifUseCallNum;
+ }
+
+ public String getOnLineMealCodePrefix() {
+ return this.onLineMealCodePrefix;
+ }
+
+ public String getOffLineMealCodePrefix() {
+ return this.offLineMealCodePrefix;
+ }
+
+ public Integer getIfEnableDelivery() {
+ return this.ifEnableDelivery;
+ }
+
+ public String getDeliveries() {
+ return this.deliveries;
+ }
+
+ public Integer getIfEnableOrder() {
+ return this.ifEnableOrder;
+ }
+
+ public Integer getIfBook() {
+ return this.ifBook;
+ }
+
+ public Integer getIfReserve() {
+ return this.ifReserve;
+ }
+
+ public Integer getIfEnablePayCode() {
+ return this.ifEnablePayCode;
+ }
+
+ public Integer getIfDel() {
+ return this.ifDel;
+ }
+
+ public String getCrby() {
+ return this.crby;
+ }
+
+ public LocalDateTime getCrtime() {
+ return this.crtime;
+ }
+
+ public String getUpby() {
+ return this.upby;
+ }
+
+ public LocalDateTime getUptime() {
+ return this.uptime;
+ }
+
+ public void setId(final Long id) {
+ this.id = id;
+ }
+
+ public void setStallId(final Long stallId) {
+ this.stallId = stallId;
+ }
+
+ public void setStallNum(final String stallNum) {
+ this.stallNum = stallNum;
+ }
+
+ public void setStallName(final String stallName) {
+ this.stallName = stallName;
+ }
+
+ public void setCanteenId(final Long canteenId) {
+ this.canteenId = canteenId;
+ }
+
+ public void setAreaId(final Long areaId) {
+ this.areaId = areaId;
+ }
+
+ public void setStallType(final Integer stallType) {
+ this.stallType = stallType;
+ }
+
+ public void setThirdStallId(final String thirdStallId) {
+ this.thirdStallId = thirdStallId;
+ }
+
+ public void setCustId(final Long custId) {
+ this.custId = custId;
+ }
+
+ public void setContactTel(final String contactTel) {
+ this.contactTel = contactTel;
+ }
+
+ public void setMainProject(final String mainProject) {
+ this.mainProject = mainProject;
+ }
+
+ public void setBusinessState(final Integer businessState) {
+ this.businessState = businessState;
+ }
+
+ @JsonDeserialize(
+ using = LocalTimeDeserializer.class
+ )
+ public void setStartBusinessTime(final LocalTime startBusinessTime) {
+ this.startBusinessTime = startBusinessTime;
+ }
+
+ @JsonDeserialize(
+ using = LocalTimeDeserializer.class
+ )
+ public void setEndBusinessTime(final LocalTime endBusinessTime) {
+ this.endBusinessTime = endBusinessTime;
+ }
+
+ public void setIfUseCallNum(final Integer ifUseCallNum) {
+ this.ifUseCallNum = ifUseCallNum;
+ }
+
+ public void setOnLineMealCodePrefix(final String onLineMealCodePrefix) {
+ this.onLineMealCodePrefix = onLineMealCodePrefix;
+ }
+
+ public void setOffLineMealCodePrefix(final String offLineMealCodePrefix) {
+ this.offLineMealCodePrefix = offLineMealCodePrefix;
+ }
+
+ public void setIfEnableDelivery(final Integer ifEnableDelivery) {
+ this.ifEnableDelivery = ifEnableDelivery;
+ }
+
+ public void setDeliveries(final String deliveries) {
+ this.deliveries = deliveries;
+ }
+
+ public void setIfEnableOrder(final Integer ifEnableOrder) {
+ this.ifEnableOrder = ifEnableOrder;
+ }
+
+ public void setImgUrl(final String imgUrl) {
+ this.imgUrl = imgUrl;
+ }
+
+ public void setIfBook(final Integer ifBook) {
+ this.ifBook = ifBook;
+ }
+
+ public void setIfReserve(final Integer ifReserve) {
+ this.ifReserve = ifReserve;
+ }
+
+ public void setIfEnablePayCode(final Integer ifEnablePayCode) {
+ this.ifEnablePayCode = ifEnablePayCode;
+ }
+
+ public void setPayCodeUrl(final String payCodeUrl) {
+ this.payCodeUrl = payCodeUrl;
+ }
+
+ public void setIfDel(final Integer ifDel) {
+ this.ifDel = ifDel;
+ }
+
+ public void setCrby(final String crby) {
+ this.crby = crby;
+ }
+
+ @JsonDeserialize(
+ using = LocalDateTimeDeserializer.class
+ )
+ public void setCrtime(final LocalDateTime crtime) {
+ this.crtime = crtime;
+ }
+
+ public void setUpby(final String upby) {
+ this.upby = upby;
+ }
+
+ @JsonDeserialize(
+ using = LocalDateTimeDeserializer.class
+ )
+ public void setUptime(final LocalDateTime uptime) {
+ this.uptime = uptime;
+ }
+
+}
diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/canteen/service/AllocStallService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/canteen/service/AllocStallService.java
new file mode 100644
index 00000000..41b051d5
--- /dev/null
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/canteen/service/AllocStallService.java
@@ -0,0 +1,10 @@
+package com.bonus.core.allocation.canteen.service;
+
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.bonus.core.allocation.canteen.model.AllocStall;
+
+public interface AllocStallService extends IService {
+
+ AllocStall getAllocStallCache(Long stallId);
+}
diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/canteen/service/impl/AllocStallServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/canteen/service/impl/AllocStallServiceImpl.java
new file mode 100644
index 00000000..a3c38151
--- /dev/null
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/canteen/service/impl/AllocStallServiceImpl.java
@@ -0,0 +1,48 @@
+package com.bonus.core.allocation.canteen.service.impl;
+
+import cn.hutool.core.text.CharSequenceUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.json.JSONUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.bonus.core.allocation.canteen.mapper.AllocStallMapper;
+import com.bonus.core.allocation.canteen.model.AllocStall;
+import com.bonus.core.allocation.canteen.service.AllocStallService;
+import com.bonus.core.common.redis.RedisUtil;
+import com.bonus.core.common.utils.TenantContextHolder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+@Service
+public class AllocStallServiceImpl extends ServiceImpl implements AllocStallService{
+ private static final Logger log = LoggerFactory.getLogger(AllocStallServiceImpl.class);
+ private static final String CACHE_PREFIX = "yst:";
+ private static final String CACHE_KEY = "alloc-stall";
+ private static final long CACHE_SECONDS = 3600L;
+
+ @Override
+ public AllocStall getAllocStallCache(Long stallId) {
+ if (ObjectUtil.isNull(stallId)) {
+ return null;
+ } else {
+ String cacheKey = this.getCacheKey(stallId);
+ String allocStallStr = RedisUtil.getString(cacheKey);
+ if (CharSequenceUtil.isNotBlank(allocStallStr)) {
+ return (AllocStall)JSONUtil.toBean(allocStallStr, AllocStall.class);
+ } else {
+ AllocStall allocStall = this.getOne(new LambdaQueryWrapper().eq(AllocStall::getStallId, stallId));
+ allocStallStr = JSONUtil.toJsonStr(allocStall);
+ RedisUtil.setString(cacheKey, allocStallStr, 3600L);
+ return allocStall;
+ }
+ }
+ }
+
+ private String getCacheKey(Long stallId) {
+ Long var10000 = TenantContextHolder.getTenantId();
+ return "yst:" + var10000 + ":alloc-stall:" + stallId;
+ }
+
+}
diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/util/MetadataUtil.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/util/MetadataUtil.java
new file mode 100644
index 00000000..9245263d
--- /dev/null
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/allocation/util/MetadataUtil.java
@@ -0,0 +1,103 @@
+package com.bonus.core.allocation.util;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.text.CharSequenceUtil;
+import cn.hutool.json.JSONUtil;
+import com.bonus.core.allocation.alloc.model.AllocMetadata;
+import com.bonus.core.allocation.alloc.model.MetadataModel;
+import com.sun.org.slf4j.internal.Logger;
+import com.sun.org.slf4j.internal.LoggerFactory;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.*;
+import java.util.stream.Collectors;
+
+public class MetadataUtil {
+ private static final Logger log = LoggerFactory.getLogger(MetadataUtil.class);
+ private static final String URL = "url";
+ private static final String PATH = "path";
+ private static final String CERT = "cert";
+
+ private MetadataUtil() {
+ }
+
+ public static T transferToPayModel(List payMetadataList, T t) {
+ T t1 = (T) JSONUtil.toBean(JSONUtil.toJsonStr(t), t.getClass());
+ if (CollUtil.isEmpty(payMetadataList)) {
+ return t1;
+ } else {
+ Map metadataMap = (Map)payMetadataList.stream().collect(Collectors.toMap((s) -> {
+ return CharSequenceUtil.nullToEmpty(s.getModelKey());
+ }, (s) -> {
+ return CharSequenceUtil.nullToEmpty(s.getModelValue());
+ }));
+ BeanUtil.fillBeanWithMapIgnoreCase(metadataMap, t1, true);
+ return t1;
+ }
+ }
+
+ public static Map getStringMetadataMap(T t) {
+ Map methodMap = new HashMap();
+ Method[] methods = t.getClass().getMethods();
+ Method[] var3 = methods;
+ int var4 = methods.length;
+
+ for(int var5 = 0; var5 < var4; ++var5) {
+ Method method = var3[var5];
+ String methodName = method.getName();
+ if (methodName.startsWith("get") && !methodName.contains("Class") && !methodName.contains("AreaId")) {
+ String modelKey = CharSequenceUtil.lowerFirst(methodName.substring(3));
+ String modelValue = null;
+
+ try {
+ modelValue = String.valueOf(method.invoke(t, (Object[])null));
+ } catch (InvocationTargetException | IllegalAccessException var13) {
+ System.out.println(modelKey + ",数据转换时,未获取到对应方法");
+ }
+
+ if (CharSequenceUtil.isNotBlank(modelValue) && !modelValue.contains("null")) {
+ methodMap.put(modelKey, modelValue);
+ } else {
+ methodMap.put(modelKey, "");
+ }
+ }
+ }
+
+ Map fieldMap = new HashMap();
+ Field[] declaredFields = t.getClass().getDeclaredFields();
+ Field[] declaredSuperFields = t.getClass().getSuperclass().getDeclaredFields();
+ List fieldList = new ArrayList(Arrays.asList(declaredFields));
+ fieldList.addAll(Arrays.asList(declaredSuperFields));
+ Iterator var18 = fieldList.iterator();
+
+ while(var18.hasNext()) {
+ Field field = (Field)var18.next();
+ if (field.getAnnotation(ApiModelProperty.class) != null) {
+ fieldMap.put(field.getName().toLowerCase(), ((ApiModelProperty)field.getAnnotation(ApiModelProperty.class)).value());
+ }
+ }
+
+ Map metadataMap = new HashMap();
+ Iterator var21 = methodMap.entrySet().iterator();
+
+ while(var21.hasNext()) {
+ Map.Entry entry = (Map.Entry)var21.next();
+ String filed = (String)entry.getKey();
+ String lowerCaseField = filed.toLowerCase();
+ if (fieldMap.containsKey(lowerCaseField)) {
+ MetadataModel metadata = new MetadataModel();
+ metadata.setModelKey(filed);
+ metadata.setModelValue((String)entry.getValue());
+ metadata.setModelKeyRemark(lowerCaseField);
+ metadataMap.put(filed, metadata);
+ }
+ }
+
+ return metadataMap;
+ }
+
+}
diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/common/enums/MetadataModelTypeEnum.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/common/enums/MetadataModelTypeEnum.java
new file mode 100644
index 00000000..bb833e22
--- /dev/null
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/common/enums/MetadataModelTypeEnum.java
@@ -0,0 +1,85 @@
+package com.bonus.core.common.enums;
+
+import cn.hutool.core.collection.CollUtil;
+
+import java.util.List;
+
+public enum MetadataModelTypeEnum {
+ ACC("acc", "账户配置"),
+ ATTENDANCE("Attendance", "考勤配置"),
+ CUSTOMER("customer", "人员配置"),
+ CUSTOMER_FACE("customer", "人员-人脸特征值配置"),
+ DELIVERY("delivery", "配送配置"),
+ DEVICE("device", "设备配置"),
+ DEVICE_CABINET("device", "设备-取餐柜配置"),
+ DEVICE_WEIGHT("device", "设备-计量主机配置"),
+ DEVICE_CONSUME("device", "设备-消费机配置"),
+ ENTERPRISE_CODE("enterpriseCode", "支付宝企业码"),
+ MARKETING("supermarket", "商超配置"),
+ MEALTIME("mealtime", "餐次配置"),
+ MENU("menu", "菜品菜谱配置"),
+ MERCHANT("merchant", "商家配置"),
+ MOBILE("mobile", "移动端配置"),
+ MOBILE_COMMON("mobile", "移动端通用配置"),
+ NOTICE("notice", "通知配置"),
+ NOTICE_PRINT("notice", "通知-打印配置"),
+ NUTRITION("nutrition", "营养模块配置"),
+ ORDER("order", "订单配置"),
+ ORDER_CHARGEBACK("order", "订单-退单配置"),
+ ORDER_RESERVE("order", "订单-订餐配置"),
+ ORDER_DELIVERY("order", "订单-配送配置"),
+ PAY("pay", "支付配置"),
+ PAY_ALIPAY("pay", "支付-支付宝配置"),
+ PAY_WECHATPAY("pay", "支付-微信配置"),
+ PAY_WECHATPAY_SCORE("pay", "支付-微信支付分配置"),
+ PAY_SHOUQIANBA("pay", "支付-收钱吧配置"),
+ PAY_UNIONPAY_QUICK("pay", "支付-银联云闪付配置"),
+ PAY_ABC("pay", "支付-农业银行配置"),
+ PAY_ICBC("pay", "支付-工商银行配置"),
+ PAY_OTHER("pay", "支付-其他支付配置"),
+ REPORT("report", "报表配置"),
+ REPORT_DATA_SCREEN("report", "数据大屏"),
+ DRP_SUPPLIER_SCORE("drp", "出入库-供应商评分"),
+ DRP("drp", "出入库");
+
+ private final String key;
+ private final String desc;
+
+ public boolean supportSeparated() {
+ return CollUtil.contains(supportSeparatedTypes(), this.key);
+ }
+
+ public static List supportSeparatedTypes() {
+ return CollUtil.toList(new String[]{MEALTIME.getKey(), DELIVERY.getKey(), ORDER.getKey(), PAY.getKey()});
+ }
+
+ public static String modelKeyOfSeparatedType(String key) {
+ if (DELIVERY.getKey().equals(key)) {
+ return "ifEnableDelivery";
+ } else if (ORDER.getKey().equals(key)) {
+ return "ifEnableOrder";
+ } else if (PAY.getKey().equals(key)) {
+ return "ifEnablePay";
+ } else {
+ return MEALTIME.getKey().equals(key) ? "ifEnableMealtime" : "";
+ }
+ }
+
+ private MetadataModelTypeEnum(String key, String desc) {
+ this.key = key;
+ this.desc = desc;
+ }
+
+ public String getKey() {
+ return this.key;
+ }
+
+ public String getDesc() {
+ return this.desc;
+ }
+
+ // $FF: synthetic method
+ private static MetadataModelTypeEnum[] $values() {
+ return new MetadataModelTypeEnum[]{ACC, ATTENDANCE, CUSTOMER, CUSTOMER_FACE, DELIVERY, DEVICE, DEVICE_CABINET, DEVICE_WEIGHT, DEVICE_CONSUME, ENTERPRISE_CODE, MARKETING, MEALTIME, MENU, MERCHANT, MOBILE, MOBILE_COMMON, NOTICE, NOTICE_PRINT, NUTRITION, ORDER, ORDER_CHARGEBACK, ORDER_RESERVE, ORDER_DELIVERY, PAY, PAY_ALIPAY, PAY_WECHATPAY, PAY_WECHATPAY_SCORE, PAY_SHOUQIANBA, PAY_UNIONPAY_QUICK, PAY_ABC, PAY_ICBC, PAY_OTHER, REPORT, REPORT_DATA_SCREEN, DRP_SUPPLIER_SCORE, DRP};
+ }
+}
diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/common/redis/RedisUtil.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/common/redis/RedisUtil.java
new file mode 100644
index 00000000..954ccfb2
--- /dev/null
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/core/common/redis/RedisUtil.java
@@ -0,0 +1,125 @@
+package com.bonus.core.common.redis;
+
+import cn.hutool.core.collection.CollUtil;
+import com.bonus.core.common.utils.SpringContextHolder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.core.env.Environment;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.data.redis.core.ZSetOperations;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+public class RedisUtil {
+ private static final Logger log = LoggerFactory.getLogger(RedisUtil.class);
+
+ public static void setString(String key, String value) {
+ setString(key, value, (Long)null);
+ }
+
+ public static void setString(String key, String value, Long timeOut) {
+ timeOut = timeoutFilter(timeOut);
+ if (value != null) {
+ if (timeOut != null) {
+ stringRedisTemplate().opsForValue().set(key, value, timeOut, TimeUnit.SECONDS);
+ } else {
+ stringRedisTemplate().opsForValue().set(key, value);
+ }
+ }
+
+ }
+
+ public static Boolean setIfPresentString(String key, String value, Long timeOut) {
+ timeOut = timeoutFilter(timeOut);
+ if (value != null) {
+ return timeOut != null ? stringRedisTemplate().opsForValue().setIfPresent(key, value, timeOut, TimeUnit.SECONDS) : stringRedisTemplate().opsForValue().setIfPresent(key, value);
+ } else {
+ return false;
+ }
+ }
+
+ public static String getString(String key) {
+ return (String)stringRedisTemplate().opsForValue().get(key);
+ }
+
+ public static void setObj(String key, Object value) {
+ setObj(key, value, (Long)null);
+ }
+
+ public static void setObj(String key, Object value, Long timeOut) {
+ timeOut = timeoutFilter(timeOut);
+ if (value != null) {
+ if (timeOut != null) {
+ redisTemplate().opsForValue().set(key, value, timeOut, TimeUnit.SECONDS);
+ } else {
+ redisTemplate().opsForValue().set(key, value);
+ }
+ }
+
+ }
+
+ public static Object getObj(String key) {
+ return redisTemplate().opsForValue().get(key);
+ }
+
+ public static void delete(String key) {
+ redisTemplate().delete(key);
+ }
+
+ public static void deleteByPattern(String keyPattern) {
+ Set
+
+
+ com.baomidou
+ mybatis-plus-boot-starter
+ ${mybatis-plus.version}
+ pom
+ import
+
+