Merge branch 'weekmenu'

This commit is contained in:
sxu 2025-02-05 19:09:35 +08:00
commit fd74445693
24 changed files with 891 additions and 323 deletions

View File

@ -0,0 +1,22 @@
//package com.bonus.oss;
//
//import lombok.Data;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//
//@ConfigurationProperties(
// prefix = "oss"
//)
//@Data
//public class OssProperties {
// private String endpoint;
// private String customDomain;
// private Boolean pathStyleAccess = true;
// private String appId;
// private String region;
// private String accessKey;
// private String secretKey;
// private String bucketName = "lnyst";
// private Boolean useHttp = false;
// private Integer expiresTime = 604800;
// private Boolean useToken = false;
//}

View File

@ -0,0 +1,42 @@
//package com.bonus.oss;
//
//import org.springframework.beans.factory.InitializingBean;
//import org.springframework.data.redis.core.convert.Bucket;
//import java.io.ByteArrayInputStream;
//import java.io.InputStream;
//import java.net.URL;
//import java.util.*;
//
//public class OssTemplate implements InitializingBean {
// private final OssProperties ossProperties;
// private AmazonS3 amazonS3;
//
// public InputStream getObject(String bucketName, String objectName) {
// try {
// return this.amazonS3.getObject(bucketName, objectName).getObjectContent();
// } catch (Throwable var4) {
// throw var4;
// }
// }
//
// public void removeObject(String bucketName, String objectName) throws Exception {
// this.amazonS3.deleteObject(bucketName, objectName);
// }
//
// public void afterPropertiesSet() throws Exception {
// ClientConfiguration clientConfiguration = new ClientConfiguration();
// AwsClientBuilder.EndpointConfiguration endpointConfiguration = new AwsClientBuilder.EndpointConfiguration(this.ossProperties.getEndpoint(), this.ossProperties.getRegion());
// AWSCredentials awsCredentials = new BasicAWSCredentials(this.ossProperties.getAccessKey(), this.ossProperties.getSecretKey());
// AWSCredentialsProvider awsCredentialsProvider = new AWSStaticCredentialsProvider(awsCredentials);
// if (this.ossProperties.getUseHttp()) {
// System.setProperty("com.amazonaws.sdk.disableCertChecking", "true");
// }
//
// this.amazonS3 = (AmazonS3)((AmazonS3ClientBuilder)((AmazonS3ClientBuilder)((AmazonS3ClientBuilder)((AmazonS3ClientBuilder)((AmazonS3ClientBuilder)AmazonS3Client.builder().withEndpointConfiguration(endpointConfiguration)).withClientConfiguration(clientConfiguration)).withCredentials(awsCredentialsProvider)).disableChunkedEncoding()).withPathStyleAccessEnabled(this.ossProperties.getPathStyleAccess())).build();
// }
//
// public OssTemplate(final OssProperties ossProperties) {
// this.ossProperties = ossProperties;
// }
//
//}

View File

@ -1,54 +0,0 @@
//package com.bonus.service;
//
//import com.bonus.common.core.constant.CacheConstants;
//import com.bonus.common.core.utils.StringUtils;
//import com.bonus.common.core.utils.VerificationCodeUtils;
//import com.bonus.common.redis.service.RedisService;
//import com.bonus.common.security.config.VerificationCodeConfig;
//import org.springframework.mail.SimpleMailMessage;
//import org.springframework.mail.javamail.JavaMailSender;
//import org.springframework.stereotype.Service;
//
//import javax.annotation.Resource;
//import java.util.concurrent.TimeUnit;
//
//import static com.bonus.common.core.utils.VerificationCodeUtils.CodeType.NUMERIC;
//
///**
// * @author bonus
// */
//@Service
//public class EmailService {
// @Resource
// private VerificationCodeConfig verificationCodeConfig;
// @Resource
// private RedisService redisService;
// @Resource
// private JavaMailSender mailSender;
//
// /**
// * 发送简单邮件
// *
// * @param to 接收者邮箱地址
// */
// public String sendSimpleEmail(String to) {
// String code = VerificationCodeUtils.generateVerificationCode(NUMERIC);
// String str = verificationCodeConfig.getContent().replace("<code>", code);
// str = str.replace("<time>", verificationCodeConfig.getTime().toString());
// SimpleMailMessage message = new SimpleMailMessage();
// // 发件人邮箱地址
// message.setFrom("2642480752@qq.com");
// // 收件人邮箱地址
// message.setTo(to);
// // 邮件主题
// message.setSubject(verificationCodeConfig.getTitle());
// // 邮件内容
// message.setText(str);
// // 发送邮件
// mailSender.send(message);
// String uuid = StringUtils.randomUUID();
// String verifyKey = CacheConstants.VERIFICATION_CODE + uuid;
// redisService.setCacheObject(verifyKey, code, verificationCodeConfig.getTime(), TimeUnit.MINUTES);
// return uuid;
// }
//}

View File

@ -1,52 +0,0 @@
//package com.bonus.service;
//
//import com.bonus.common.core.constant.CacheConstants;
//import com.bonus.common.core.exception.CaptchaException;
//import com.bonus.common.core.utils.StringUtils;
//import com.bonus.common.core.utils.VerificationCodeUtils;
//import com.bonus.common.core.utils.sms.SmsUtils;
//import com.bonus.common.redis.service.RedisService;
//import com.bonus.common.security.config.VerificationCodeConfig;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.Resource;
//import java.util.concurrent.TimeUnit;
//
//import static com.bonus.common.core.utils.VerificationCodeUtils.CodeType.NUMERIC;
//
///**
// * @author bonus
// */
//@Component
//public class SmsService {
// @Resource
// private VerificationCodeConfig verificationCodeConfig;
// @Resource
// private RedisService redisService;
//
// /**
// * 生成手机验证码
// *
// * @return AjaxResult
// * @throws CaptchaException 自定义captcha 异常
// */
// public void sendSimplePhone(String to) {
// if (StringUtils.isEmpty(to)) {
// throw new CaptchaException("手机号不能为空");
// }
// String code = VerificationCodeUtils.generateVerificationCode(NUMERIC);
// String str = verificationCodeConfig.getContent().replace("<code>", code);
// str = str.replace("<time>", verificationCodeConfig.getTime().toString());
// String s = SmsUtils.smsToken(to, str, "");
// if (StringUtils.isNotEmpty(s)) {
// if (s.contains("ok")) {
// String verifyKey = CacheConstants.VERIFICATION_CODE + StringUtils.nvl(to, "");
// redisService.setCacheObject(verifyKey, code, verificationCodeConfig.getTime(), TimeUnit.MINUTES);
// } else {
// throw new CaptchaException("获取短信失败");
// }
// } else {
// throw new CaptchaException("获取短信失败");
// }
// }
//}

View File

@ -1,217 +0,0 @@
//package net.xnzn.service;
//
//import cn.hutool.core.util.ObjectUtil;
//import com.bonus.common.core.constant.SecurityConstants;
//import com.bonus.common.core.utils.JwtUtils;
//import com.bonus.common.core.utils.ServletUtils;
//import com.bonus.common.core.utils.StringUtils;
//import com.bonus.common.core.utils.ip.IpUtils;
//import com.bonus.common.core.utils.uuid.IdUtils;
//import com.bonus.common.core.web.domain.AjaxResult;
//import com.bonus.common.redis.service.RedisService;
//import com.bonus.common.security.utils.SecurityUtils;
//import com.bonus.config.SystemConfig;
//import com.bonus.system.api.RemoteUserService;
//import com.bonus.system.api.domain.SysUser;
//import com.bonus.system.api.model.LoginUser;
//import net.xnzn.domain.CustInfoAppIdLoginVO;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//import javax.annotation.Resource;
//import javax.servlet.http.HttpServletRequest;
//import java.util.Date;
//import java.util.HashMap;
//import java.util.Map;
//import java.util.concurrent.TimeUnit;
//
///**
// * token验证处理
// *
// * @author bonus
// */
//@Component
//public class TokenService {
//
// @Resource
// private SystemConfig systemConfig;
//
// private static final Logger log = LoggerFactory.getLogger(TokenService.class);
//
// @Autowired
// private RedisService redisService;
//
// @Resource
// RemoteUserService remoteUserService;
//
// protected static final long MILLIS_SECOND = 1000;
//
// protected static final long MILLIS_MINUTE = 60 * MILLIS_SECOND;
//
// private final static long EXPIRETIME = 720L;
//
// private final static String CUST_ACCESS_TOKEN = "cust_login_tokens:";
//
// private final static String CUST_LOGIN_USER_KEY = "cust_login_users:";
//
// private final static Long MILLIS_MINUTE_TEN = 120L * MILLIS_MINUTE;
//
// private static final String DETAILS_USER_ID = "user_id";
// private static final String DETAILS_USERNAME = "username";
// private static final String USER_KEY = "user_key";
// private static final String LOGIN_USER = "login_user";
//
// /**
// * 创建令牌
// */
// public Map<String, Object> createToken(CustInfoAppIdLoginVO loginUser) {
// // 检查并删除已有的token
// delExistingToken(loginUser.getCustId());
// String token = IdUtils.fastUUID();
// Long custId = loginUser.getCustId();
// String userName = loginUser.getCustName();
// loginUser.setToken(token);
// loginUser.setCustId(custId);
// loginUser.setCustName(userName);
// loginUser.setIpaddr(IpUtils.getIpAddr());
// refreshToken(loginUser);
// // Jwt存储信息
// Map<String, Object> claimsMap = new HashMap<String, Object>(16);
// claimsMap.put(USER_KEY, token);
// claimsMap.put(DETAILS_USER_ID, custId);
// claimsMap.put(DETAILS_USERNAME, userName);
// String accessToken = JwtUtils.createToken(claimsMap);
// Map<String, Object> rspMap = new HashMap<String, Object>(16);
// rspMap.put("cust_access_token", accessToken);
// rspMap.put("expires_in", EXPIRETIME);
// rspMap.put("isLogin", isLogin(String.valueOf(custId)));
// long tokenTime = getTokenTime();
// //对token进行存储
// redisService.setCacheObject(CUST_LOGIN_USER_KEY + custId, token, tokenTime, TimeUnit.MINUTES);
// return rspMap;
// }
//
// public boolean isLogin(String userId) {
// String existingTokenKey = redisService.getCacheObject(CUST_LOGIN_USER_KEY + userId);
// return existingTokenKey != null;
// }
//
// public boolean isKey(String key) {
// return redisService.hasKey(getTokenKey(key));
// }
//
// /**
// * 删除已有的token
// */
// public void delExistingToken(Long userId) {
// String existingTokenKey = redisService.getCacheObject(CUST_LOGIN_USER_KEY + userId);
// if (existingTokenKey != null) {
// redisService.deleteObject(getTokenKey(existingTokenKey));
// redisService.deleteObject(CUST_LOGIN_USER_KEY + userId);
// }
// }
//
// /**
// * 获取用户身份信息
// *
// * @return 用户信息
// */
// public CustInfoAppIdLoginVO getLoginUser() {
// return getLoginUser(ServletUtils.getRequest());
// }
//
// /**
// * 获取用户身份信息
// *
// * @return 用户信息
// */
// public CustInfoAppIdLoginVO getLoginUser(HttpServletRequest request) {
// // 获取请求携带的令牌
// String token = SecurityUtils.getToken(request);
// return getLoginUser(token);
// }
//
// /**
// * 获取用户身份信息
// *
// * @return 用户信息
// */
// public CustInfoAppIdLoginVO getLoginUser(String token) {
// CustInfoAppIdLoginVO user = null;
// try {
// if (StringUtils.isNotEmpty(token)) {
// String userkey = JwtUtils.getUserKey(token);
// user = redisService.getCacheObject(getTokenKey(userkey));
// return user;
// }
// } catch (Exception e) {
// log.error("获取用户信息异常'{}'", e.getMessage());
// }
// return user;
// }
//
// /**
// * 设置用户身份信息
// */
// public void setLoginUser(CustInfoAppIdLoginVO loginUser) {
// if (StringUtils.isNotNull(loginUser) && StringUtils.isNotEmpty(loginUser.getToken())) {
// refreshToken(loginUser);
// }
// }
//
// /**
// * 删除用户缓存信息
// */
// public void delLoginUser(String token) {
// if (StringUtils.isNotEmpty(token)) {
// String userkey = JwtUtils.getUserKey(token);
// redisService.deleteObject(getTokenKey(userkey));
// }
// }
//
// /**
// * 验证令牌有效期相差不足120分钟自动刷新缓存
// *
// * @param loginUser
// */
// public void verifyToken(CustInfoAppIdLoginVO loginUser) {
// long expireTime = loginUser.getExpireTime();
// long currentTime = System.currentTimeMillis();
// if (expireTime - currentTime <= MILLIS_MINUTE_TEN) {
// refreshToken(loginUser);
// }
// }
//
// /**
// * 刷新令牌有效期
// *
// * @param loginUser 登录信息
// */
// public void refreshToken(CustInfoAppIdLoginVO loginUser) {
// long tokenTime = getTokenTime();
// loginUser.setLoginTime(System.currentTimeMillis());
// loginUser.setExpireTime(loginUser.getLoginTime() + tokenTime * MILLIS_MINUTE);
// // 根据uuid将loginUser缓存
// String userKey = getTokenKey(loginUser.getToken());
// redisService.setCacheObject(userKey, loginUser, tokenTime, TimeUnit.MINUTES);
// }
//
// private String getTokenKey(String token) {
// return CUST_ACCESS_TOKEN + token;
// }
//
// private Long getTokenTime(){
// long tokenTime = 20L;
// String redisResult = redisService.getCacheObject("sys_config:"+ "sys.visit.tokentime");
// if(!redisResult.isEmpty()) {
// tokenTime = Long.parseLong(redisResult);
// }else {
// Long result = systemConfig.getTokenTime();
// if (!ObjectUtil.isEmpty(result)){
// tokenTime = result;
// }
// }
// return tokenTime;
// }
//}

View File

@ -0,0 +1,51 @@
package com.bonus.utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@Service
@Lazy(false)
public class SpringContextHolder implements ApplicationContextAware, DisposableBean {
private static final Logger log = LoggerFactory.getLogger(SpringContextHolder.class);
private static ApplicationContext applicationContext = null;
public static ApplicationContext getApplicationContext() {
return applicationContext;
}
public void setApplicationContext(ApplicationContext applicationContext) {
SpringContextHolder.applicationContext = applicationContext;
}
public static <T> T getBean(String name) {
return (T) applicationContext.getBean(name);
}
public static <T> T getBean(Class<T> requiredType) {
return applicationContext.getBean(requiredType);
}
public static void clearHolder() {
if (log.isDebugEnabled()) {
log.debug("清除SpringContextHolder中的ApplicationContext:" + String.valueOf(applicationContext));
}
applicationContext = null;
}
public static void publishEvent(ApplicationEvent event) {
if (applicationContext != null) {
applicationContext.publishEvent(event);
}
}
public void destroy() {
clearHolder();
}
}

View File

@ -0,0 +1,42 @@
package com.bonus.core.account.constants;
import cn.hutool.core.collection.ListUtil;
import java.util.Arrays;
import java.util.List;
public enum AccStatusEnum {
NORMAL(1, "正常"),
DEACTIVATE(2, "停用"),
CANCEL(3, "注销"),
OVERDUE(4, "过期");
private final Integer key;
private final String desc;
private AccStatusEnum(Integer key, String desc) {
this.key = key;
this.desc = desc;
}
public static List<Integer> sendMqStatus() {
return Arrays.asList(DEACTIVATE.getKey(), OVERDUE.getKey());
}
public static List<Integer> accStatusForAppWork() {
return ListUtil.toList(new Integer[]{NORMAL.getKey(), DEACTIVATE.getKey(), OVERDUE.getKey()});
}
public static boolean ifNotAllowRechargeRepeal(Integer key) {
return ListUtil.toList(new Integer[]{CANCEL.getKey()}).contains(key);
}
public Integer getKey() {
return this.key;
}
public String getDesc() {
return this.desc;
}
}

View File

@ -0,0 +1,27 @@
package com.bonus.core.marketing.constants;
/** @deprecated */
@Deprecated
public enum MktEffTypeEnum {
USER_SORT(1, "人员类"),
CANTEEN_SORT(2, "食堂类"),
PRODUCT_SORT(3, "商品类"),
WAREHOUSE_SORT(4, "仓库类");
private final Integer key;
private final String value;
MktEffTypeEnum(Integer key, String value) {
this.key = key;
this.value = value;
}
public Integer key() {
return this.key;
}
public String value() {
return this.value;
}
}

View File

@ -0,0 +1,24 @@
package com.bonus.core.marketing.constants;
/** @deprecated */
@Deprecated
public enum MktUserTypeEnum {
INTERSECTION(1, "交集"),
UNION_SET(2, "并集");
private final Integer key;
private final String value;
MktUserTypeEnum(Integer key, String value) {
this.key = key;
this.value = value;
}
public Integer key() {
return this.key;
}
public String value() {
return this.value;
}
}

View File

@ -0,0 +1,16 @@
package com.bonus.core.marketing.vo;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/** @deprecated */
@Deprecated
@Data
public class MktEffectiveUserVO implements Serializable {
private Long effId;
private Integer userType;
private List<Long> orgIdList;
private List<Integer> psnTypeList;
}

View File

@ -0,0 +1,31 @@
package com.bonus.core.menu.controller;
import com.bonus.core.menu.dto.AppletWeekCanteenDTO;
import com.bonus.core.menu.service.MenuRecipeService;
import com.bonus.core.menu.vo.AppletWeekCanteenVO;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/api/v2/applet/menurecipe")
public class AppletRecipeV2Controller {
private static final Logger log = LoggerFactory.getLogger(AppletRecipeV2Controller.class);
@Lazy
@Autowired
private MenuRecipeService menuRecipeService;
@PostMapping({"/list/week/canteen"})
@ApiOperation("获取一周菜谱食堂列表")
public List<AppletWeekCanteenVO> getWeekMealList(@RequestBody AppletWeekCanteenDTO appletWeekCanteenDTO) {
return this.menuRecipeService.getWeekMealList(appletWeekCanteenDTO);
}
}

View File

@ -0,0 +1,11 @@
package com.bonus.core.menu.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class AppletWeekCanteenDTO {
@ApiModelProperty("人员id")
private Long custId;
}

View File

@ -0,0 +1,13 @@
package com.bonus.core.menu.mapper;
import com.bonus.core.menu.vo.AppletWeekCanteenVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Set;
@Mapper
public interface MenuAppRecipeMapper {
List<AppletWeekCanteenVO> selectWeekCanteenList(@Param("effIdSet") Set<Long> effIdSet);
}

View File

@ -0,0 +1,15 @@
package com.bonus.core.menu.mapper;
import com.bonus.core.marketing.vo.MktEffectiveUserVO;
import com.bonus.domain.CustInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface MenuRecipeMapper {
CustInfo selectOrgAndPsnByCustLimitId(CustInfo custInfo);
List<MktEffectiveUserVO> selectAllUserEff(@Param("effType") Integer effType, @Param("delFlag") Integer delFlag);
}

View File

@ -0,0 +1,10 @@
package com.bonus.core.menu.service;
import com.bonus.core.menu.dto.AppletWeekCanteenDTO;
import com.bonus.core.menu.vo.AppletWeekCanteenVO;
import java.util.List;
public interface MenuRecipeService {
List<AppletWeekCanteenVO> getWeekMealList(AppletWeekCanteenDTO content);
}

View File

@ -0,0 +1,77 @@
package com.bonus.core.menu.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.constant.DelFlagEnum;
import com.bonus.core.marketing.constants.MktEffTypeEnum;
import com.bonus.core.marketing.constants.MktUserTypeEnum;
import com.bonus.core.marketing.vo.MktEffectiveUserVO;
import com.bonus.core.menu.dto.AppletWeekCanteenDTO;
import com.bonus.core.menu.mapper.MenuRecipeMapper;
import com.bonus.core.menu.service.MenuRecipeService;
import com.bonus.core.menu.mapper.MenuAppRecipeMapper;
import com.bonus.core.menu.vo.AppletWeekCanteenVO;
import com.bonus.domain.CustInfo;
import com.google.common.collect.Sets;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class MenuRecipeServiceImpl implements MenuRecipeService {
private static final Logger log = LoggerFactory.getLogger(MenuRecipeServiceImpl.class);
@Autowired
private MenuAppRecipeMapper menuAppRecipeMapper;
@Autowired
private MenuRecipeMapper menuRecipeMapper;
public List<AppletWeekCanteenVO> getWeekMealList(AppletWeekCanteenDTO content) {
Set<Long> effIdSet = this.getShopstallIdListByCustId(content.getCustId(), false);
if (ObjectUtil.isEmpty(effIdSet)) {
effIdSet = Sets.newTreeSet();
((Set)effIdSet).add(-1L);
}
return this.menuAppRecipeMapper.selectWeekCanteenList((Set)effIdSet);
}
public Set<Long> getShopstallIdListByCustId(Long custId, boolean checkCustInfo) {
Set<Long> effIdSet = Sets.newTreeSet();
CustInfo custInfoQuery = new CustInfo();
custInfoQuery.setCustId(custId);
custInfoQuery.setCustState(1);
CustInfo custInfo = menuRecipeMapper.selectOrgAndPsnByCustLimitId(custInfoQuery);
if (ObjectUtil.isNull(custInfo)) {
if (checkCustInfo) {
throw new ServiceException("菜单绑定错误");
} else {
log.info("***[获取全档口菜谱信息]_未查询到人员信息,直接返回********************");
return (Set)effIdSet;
}
} else {
List<MktEffectiveUserVO> effectiveUserVOList = menuRecipeMapper.selectAllUserEff(MktEffTypeEnum.USER_SORT.key(), DelFlagEnum.DEL_FALSE.key());
Long orgId = custInfo.getOrgId();
Integer psnType = custInfo.getPsnType();
if (ObjectUtil.isNotEmpty(effectiveUserVOList)) {
List<MktEffectiveUserVO> collect = (List)effectiveUserVOList.stream().filter((u) -> {
boolean containsOrg = ObjectUtil.isNotEmpty(u.getOrgIdList()) && u.getOrgIdList().contains(orgId);
boolean containsPsn = ObjectUtil.isNotEmpty(u.getPsnTypeList()) && u.getPsnTypeList().contains(psnType);
return MktUserTypeEnum.INTERSECTION.key().equals(u.getUserType()) && containsOrg && containsPsn || MktUserTypeEnum.UNION_SET.key().equals(u.getUserType()) && (containsOrg || containsPsn);
}).collect(Collectors.toList());
if (ObjectUtil.isNotEmpty(collect)) {
effIdSet = (Set)collect.stream().map(MktEffectiveUserVO::getEffId).collect(Collectors.toSet());
((Set)effIdSet).add(-1L);
}
}
log.info("***[获取指定人员折扣比例]_指定人员的生效范围effIdSet: {}", effIdSet);
return (Set)effIdSet;
}
}
}

View File

@ -0,0 +1,32 @@
package com.bonus.core.menu.vo;
import cn.hutool.core.collection.CollUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalTime;
import java.util.List;
@ApiModel("获取当餐点餐食堂档口列表(食堂嵌套档口版)")
@Data
public class AppletCurrentCanteenVO {
@ApiModelProperty("食堂id")
private Long canteenId;
@ApiModelProperty("食堂名称")
private String canteenName;
@ApiModelProperty("月销量")
private Integer monthlySales;
@ApiModelProperty("营业开始时间")
private LocalTime startBusinessTime;
@ApiModelProperty("营业结束时间")
private LocalTime endBusinessTime;
@ApiModelProperty("食堂营业状态")
private Integer businessState;
@ApiModelProperty("档口菜谱")
private List<AppletCurrentStallVO> stallList;
public Integer getMonthlySales() {
return CollUtil.isNotEmpty(this.stallList) ? this.stallList.stream().mapToInt(AppletCurrentStallVO::getMonthlySales).sum() : 0;
}
}

View File

@ -0,0 +1,34 @@
package com.bonus.core.menu.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalTime;
import java.util.List;
import java.util.Optional;
@ApiModel("档口菜谱")
@Data
public class AppletCurrentStallVO {
@ApiModelProperty("档口id")
private Long stallId;
@ApiModelProperty("档口名称")
private String stallName;
@ApiModelProperty("档口营业状态")
private Integer stallState;
@ApiModelProperty("档口图片")
private String stallImgUrl;
@ApiModelProperty("菜谱id")
private Long recipeId;
@ApiModelProperty("推荐菜品")
private List<AppletRecommendDishesVO> recommendList;
@ApiModelProperty("月销量")
private Integer monthlySales;
@ApiModelProperty("营业开始时间")
private LocalTime startBusinessTime;
@ApiModelProperty("营业结束时间")
private LocalTime endBusinessTime;
@ApiModelProperty("食堂营业状态")
private Integer businessState;
}

View File

@ -0,0 +1,18 @@
package com.bonus.core.menu.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("推荐菜品")
@Data
public class AppletRecommendDishesVO {
@ApiModelProperty("菜品id")
private Long dishesId;
@ApiModelProperty("菜品名称")
private String dishesName;
@ApiModelProperty("菜品价格")
private Integer dishesPrice;
@ApiModelProperty("菜品图片")
private String dishesImgUrl;
}

View File

@ -0,0 +1,37 @@
package com.bonus.core.menu.vo;
import cn.hutool.core.collection.CollUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalTime;
import java.util.List;
@ApiModel("获取预定餐食堂列表(食堂嵌套档口版)")
public class AppletReserveCanteenVO {
@ApiModelProperty("食堂id")
private Long canteenId;
@ApiModelProperty("食堂名称")
private String canteenName;
@ApiModelProperty("食堂营业状态")
private Integer canteenState;
@ApiModelProperty("食堂图片")
private String canteenImgUrl;
@ApiModelProperty("月销量")
private Integer monthlySales;
@ApiModelProperty("营业开始时间")
private LocalTime startBusinessTime;
@ApiModelProperty("营业结束时间")
private LocalTime endBusinessTime;
@ApiModelProperty("食堂营业状态")
private Integer businessState;
@ApiModelProperty("档口菜谱")
private List<AppletReserveStallVO> stallList;
// public String getCanteenImgUrl() {
// return SysUtil.getCutFileUrl(this.canteenImgUrl);
// }
//
// public Integer getMonthlySales() {
// return CollUtil.isNotEmpty(this.stallList) ? this.stallList.stream().mapToInt(AppletReserveStallVO::getMonthlySales).sum() : 0;
// }
}

View File

@ -0,0 +1,36 @@
package com.bonus.core.menu.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalTime;
import java.util.List;
import java.util.Optional;
@ApiModel("档口菜谱")
public class AppletReserveStallVO {
@ApiModelProperty("档口id")
private Long stallId;
@ApiModelProperty("档口名称")
private String stallName;
@ApiModelProperty("档口营业状态")
private Integer stallState;
@ApiModelProperty("档口图片")
private String stallImgUrl;
@ApiModelProperty("营业开始时间")
private LocalTime stallStartTime;
@ApiModelProperty("营业结束时间")
private LocalTime stallEndTime;
@ApiModelProperty("菜谱id")
private Long recipeId;
@ApiModelProperty("月销量")
private Integer monthlySales;
@ApiModelProperty("营业开始时间")
private LocalTime startBusinessTime;
@ApiModelProperty("营业结束时间")
private LocalTime endBusinessTime;
@ApiModelProperty("食堂营业状态")
private Integer businessState;
@ApiModelProperty("推荐菜品")
private List<AppletRecommendDishesVO> recommendList;
}

View File

@ -0,0 +1,23 @@
package com.bonus.core.menu.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@ApiModel("获取一周菜谱食堂列表")
@Data
public class AppletWeekCanteenVO {
@ApiModelProperty("菜谱id")
private Long recipeId;
@ApiModelProperty("档口名称")
private String stallName;
@ApiModelProperty("食堂名称")
private String canteenName;
@ApiModelProperty("食堂图片")
private String canteenImgUrl;
@ApiModelProperty("档口图片")
private String stallImgUrl;
@ApiModelProperty("档口标签")
private List<String> labelList;
}

View File

@ -0,0 +1,293 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.core.menu.mapper.MenuAppRecipeMapper">
<resultMap id="appletCurrentCanteenVO" type="com.bonus.core.menu.vo.AppletCurrentCanteenVO">
<result property="canteenId" column="canteen_id"/>
<result property="canteenName" column="canteen_name"/>
<result property="startBusinessTime" column="start_business_time_ac"/>
<result property="endBusinessTime" column="end_business_time_ac"/>
<result property="businessState" column="business_state_ac"/>
<collection property="stallList" ofType="com.bonus.core.menu.vo.AppletCurrentStallVO">
<result property="stallId" column="stall_id"/>
<result property="stallName" column="stall_name"/>
<result property="stallImgUrl" column="stall_img_url"/>
<result property="recipeId" column="recipe_id"/>
<result property="startBusinessTime" column="start_business_time"/>
<result property="endBusinessTime" column="end_business_time"/>
<result property="businessState" column="business_state"/>
</collection>
</resultMap>
<!-- 获取当餐点餐食堂列表(无餐次版) -->
<select id="selectCurrentShopstallList" resultMap="appletCurrentCanteenVO">
select distinct
ac.canteen_id,
ac.canteen_name,
ass.stall_id,
ass.stall_name,
ass.img_url as stall_img_url,
mr.recipe_id,
ac.start_business_time as start_business_time_ac,
ac.end_business_time as end_business_time_ac,
ac.business_state as business_state_ac,
ass.start_business_time,
ass.end_business_time,
ass.business_state
from
menu_app_recipe mar
left join menu_recipe mr on mar.recipe_id = mr.recipe_id
left join alloc_canteen ac on mr.canteen_id = ac.canteen_id
left join alloc_stall ass on mr.stall_id = ass.stall_id
left join menu_recipe_detail mrd on mr.recipe_id = mrd.recipe_id
and mrd.apply_date = curdate()
left join menu_recipe_dishes m on mrd.detail_id = m.detail_id
left join menu_dishes md on m.dishes_id = md.dishes_id
left join alloc_kind ak on mr.stall_id = ak.stall_id
where
bind_type = 1
<if test="kindName != null and kindName != ''">
and ak.kind_name = #{kindName}
</if>
<if test="keyword != null and keyword != ''">
and md.dishes_name like #{keyword}
</if>
and mr.eff_id in
<foreach collection="effIdSet" item="effId" separator="," open="(" close=")">
#{effId}
</foreach>
</select>
<resultMap id="appletWeekCanteenVO" type="com.bonus.core.menu.vo.AppletWeekCanteenVO">
<result property="recipeId" column="recipe_id"/>
<result property="stallName" column="stall_name"/>
<result property="canteenName" column="canteen_name"/>
<result property="canteenImgUrl" column="canteen_img_url"/>
<result property="stallImgUrl" column="stall_img_url"/>
<collection property="labelList" ofType="string">
<result property="labelName" column="label_name"/>
</collection>
</resultMap>
<!-- 获取一周菜谱食堂列表 -->
<select id="selectWeekCanteenList" resultMap="appletWeekCanteenVO">
select
mr.recipe_id,
ass.stall_name,
ac.canteen_name,
ac.img_url as canteen_img_url,
ass.img_url as stall_img_url,
al.label_name
from
menu_app_recipe mar
left join menu_recipe mr on mar.recipe_id = mr.recipe_id
left join alloc_canteen ac on mr.canteen_id = ac.canteen_id
left join alloc_stall ass on mr.stall_id = ass.stall_id
left join alloc_label al on ass.stall_id = al.stall_id
where
bind_type = 3
and mr.eff_id in
<foreach collection="effIdSet" item="effId" separator="," open="(" close=")">
#{effId}
</foreach>
</select>
<!-- 获取菜谱id -->
<select id="selectWeekRecipeId" resultType="java.lang.Long">
select
mar.recipe_id
from
menu_app_recipe mar
left join menu_recipe mr on mar.recipe_id = mr.recipe_id
where
bind_type = 3
and mr.eff_id in
<foreach collection="effIdSet" item="effId" separator="," open="(" close=")">
#{effId}
</foreach>
<if test="recipeId != null">
and mar.recipe_id = #{recipeId}
</if>
</select>
<!-- <resultMap id="appletReserveCanteenVO" type="com.bonus.core.menu.vo.AppletReserveCanteenVO">-->
<!-- <result property="canteenId" column="canteen_id"/>-->
<!-- <result property="canteenName" column="canteen_name"/>-->
<!-- <result property="canteenImgUrl" column="canteen_img_url"/>-->
<!-- <result property="startBusinessTime" column="start_business_time_ac"/>-->
<!-- <result property="endBusinessTime" column="end_business_time_ac"/>-->
<!-- <result property="businessState" column="business_state_ac"/>-->
<!-- <collection property="stallList" ofType="com.bonus.core.menu.vo.AppletReserveStallVO">-->
<!-- <result property="stallId" column="stall_id"/>-->
<!-- <result property="stallName" column="stall_name"/>-->
<!-- <result property="stallImgUrl" column="stall_img_url"/>-->
<!-- <result property="recipeId" column="recipe_id"/>-->
<!-- <result property="startBusinessTime" column="start_business_time"/>-->
<!-- <result property="endBusinessTime" column="end_business_time"/>-->
<!-- <result property="businessState" column="business_state"/>-->
<!-- </collection>-->
<!-- </resultMap>-->
<!-- <select id="selectReserveMealCanteenList" resultMap="appletReserveCanteenVO">-->
<!-- select-->
<!-- ac.canteen_id,-->
<!-- ac.canteen_name,-->
<!-- ac.img_url as canteen_img_url,-->
<!-- ass.stall_id,-->
<!-- ass.stall_name,-->
<!-- ass.img_url as stall_img_url,-->
<!-- mr.recipe_id,-->
<!-- ac.start_business_time as start_business_time_ac,-->
<!-- ac.end_business_time as end_business_time_ac,-->
<!-- ac.business_state as business_state_ac,-->
<!-- ass.start_business_time,-->
<!-- ass.end_business_time,-->
<!-- ass.business_state-->
<!-- from-->
<!-- menu_app_recipe mar-->
<!-- left join menu_recipe mr on mar.recipe_id = mr.recipe_id-->
<!-- left join alloc_canteen ac on mr.canteen_id = ac.canteen_id-->
<!-- left join alloc_stall ass on mr.stall_id = ass.stall_id-->
<!-- where-->
<!-- bind_type = 2-->
<!-- and mr.eff_id in-->
<!-- <foreach collection="effIdSet" item="effId" separator="," open="(" close=")">-->
<!-- #{effId}-->
<!-- </foreach>-->
<!-- </select>-->
<select id="selectCurrentShopstallListByPlaceId" resultMap="appletCurrentCanteenVO">
select distinct
ac.canteen_id,
ac.canteen_name,
ass.stall_id,
ass.stall_name,
ass.img_url as stall_img_url,
mr.recipe_id,
ac.start_business_time as start_business_time_ac,
ac.end_business_time as end_business_time_ac,
ac.business_state as business_state_ac,
ass.start_business_time,
ass.end_business_time,
ass.business_state
from
alloc_table_recipe atr
left join menu_app_recipe mar on mar.recipe_id = atr.recipe_id
left join menu_recipe mr on atr.recipe_id = mr.recipe_id
left join alloc_canteen ac on mr.canteen_id = ac.canteen_id
left join alloc_stall ass on mr.stall_id = ass.stall_id
left join menu_recipe_detail mrd on mr.recipe_id = mrd.recipe_id
and mrd.apply_date = curdate()
left join menu_recipe_dishes m on mrd.detail_id = m.detail_id
left join menu_dishes md on m.dishes_id = md.dishes_id
left join alloc_kind ak on mr.stall_id = ak.stall_id
where
mar.bind_type = 1 and atr.table_id = #{placeId}
<if test="kindName != null and kindName != ''">
and ak.kind_name = #{kindName}
</if>
<if test="keyword != null and keyword != ''">
and md.dishes_name like concat('%', #{keyword}, '%')
</if>
and mr.eff_id in
<foreach collection="effIdSet" item="effId" separator="," open="(" close=")">
#{effId}
</foreach>
</select>
<!-- <select id="selectRecipeByStallIdsAndBindType" resultType="com.bonus.core.menu.dto.StallAndRecipeBindDto">-->
<!-- select-->
<!-- mar.recipe_id,-->
<!-- mr.stall_id,-->
<!-- mar.bind_type-->
<!-- from menu_app_recipe mar-->
<!-- left join menu_recipe mr on mar.recipe_id = mr.recipe_id-->
<!-- where bind_type = #{bindType}-->
<!-- <if test="stallIds !=null and stallIds.size() > 0 ">-->
<!-- and mr.stall_id IN-->
<!-- <foreach collection="stallIds" item="stallId" separator="," open="(" close=")">-->
<!-- #{stallId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- </select>-->
<select id="selectRecipeInSameShop" resultType="java.lang.Long">
select mar.recipe_id
from menu_app_recipe mar
inner join menu_recipe mr on mar.recipe_id = mr.recipe_id
where mar.bind_type = #{bindType}
and mr.stall_id = #{stallId}
<if test="effId !=null">
and mr.eff_id = #{effId}
</if>
<if test="mealLineId !=null">
and mar.meal_line_id= #{mealLineId}
</if>
</select>
<!-- <select id="getBindByTypeAndStalls" resultType="com.bonus.core.device.manage.dto.DeviceRecipeDTO">-->
<!-- SELECT-->
<!-- t2.stall_id,-->
<!-- t2.canteen_id,-->
<!-- t1.recipe_id,-->
<!-- t1.meal_line_id-->
<!-- FROM-->
<!-- menu_app_recipe t1-->
<!-- LEFT JOIN menu_recipe t2 ON t1.recipe_id = t2.recipe_id-->
<!-- WHERE t1.bind_type = #{bindType} AND-->
<!-- <foreach collection="deviceBinds" separator="OR" open="(" close=")" item="item">-->
<!-- ( t2.stall_id = #{item.stallId}-->
<!-- AND t2.canteen_id = #{item.canteenId}-->
<!-- <if test="item.mealLineId !=null ">-->
<!-- AND t1.meal_line_id = #{item.mealLineId}-->
<!-- </if>-->
<!-- )-->
<!-- </foreach>-->
<!-- </select>-->
<!-- <resultMap id="AppletWeekCanteenStallVO" type="com.bonus.core.menu.vo.AppletWeekCanteenStallVO">-->
<!-- <result property="canteenId" column="canteen_id"/>-->
<!-- <result property="canteenName" column="canteen_name"/>-->
<!-- <result property="canteenImgUrl" column="canteen_img_url"/>-->
<!-- <result property="startBusinessTime" column="start_business_time_ac"/>-->
<!-- <result property="endBusinessTime" column="end_business_time_ac"/>-->
<!-- <result property="businessState" column="business_state_ac"/>-->
<!-- <collection property="stallList" ofType="com.bonus.core.menu.vo.AppletWeekStallVO">-->
<!-- <result property="stallId" column="stall_id"/>-->
<!-- <result property="stallName" column="stall_name"/>-->
<!-- <result property="stallImgUrl" column="stall_img_url"/>-->
<!-- <result property="recipeId" column="recipe_id"/>-->
<!-- <result property="startBusinessTime" column="start_business_time"/>-->
<!-- <result property="endBusinessTime" column="end_business_time"/>-->
<!-- <result property="businessState" column="business_state"/>-->
<!-- </collection>-->
<!-- </resultMap>-->
<!-- <select id="getWeekMealCanteenList" resultMap="AppletWeekCanteenStallVO">-->
<!-- select-->
<!-- ac.canteen_id,-->
<!-- ac.canteen_name,-->
<!-- ac.img_url as canteen_img_url,-->
<!-- ass.stall_id,-->
<!-- ass.stall_name,-->
<!-- ass.img_url as stall_img_url,-->
<!-- mr.recipe_id,-->
<!-- ac.start_business_time as start_business_time_ac,-->
<!-- ac.end_business_time as end_business_time_ac,-->
<!-- ac.business_state as business_state_ac,-->
<!-- ass.start_business_time,-->
<!-- ass.end_business_time,-->
<!-- ass.business_state-->
<!-- from-->
<!-- menu_app_recipe mar-->
<!-- left join menu_recipe mr on mar.recipe_id = mr.recipe_id-->
<!-- left join alloc_canteen ac on mr.canteen_id = ac.canteen_id-->
<!-- left join alloc_stall ass on mr.stall_id = ass.stall_id-->
<!-- where-->
<!-- bind_type = 3-->
<!-- and mr.eff_id in-->
<!-- <foreach collection="effIdSet" item="effId" separator="," open="(" close=")">-->
<!-- #{effId}-->
<!-- </foreach>-->
<!-- </select>-->
</mapper>

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.core.menu.mapper.MenuRecipeMapper">
<resultMap type="com.bonus.core.marketing.vo.MktEffectiveUserVO" id="mktEffectiveUserVO">
<result property="effId" column="eff_id"/>
<result property="userType" column="user_type"/>
<!-- <result property="orgId" column="org_id"/>-->
<!-- <result property="psnType" column="psn_type"/>-->
<collection property="orgIdList" ofType="Long">
<result property="orgId" column="org_id"/>
</collection>
<collection property="psnTypeList" ofType="Integer">
<result property="psnType" column="psn_type"/>
</collection>
</resultMap>
<select id="selectOrgAndPsnByCustLimitId" parameterType="com.bonus.domain.CustInfo" resultType="com.bonus.domain.CustInfo">
select org_id, psn_type
from cust_info
where cust_id = #{custId} and cust_state = 1
</select>
<!-- 获取指定类型的生效范围详情 -->
<select id="selectAllUserEff" resultMap="mktEffectiveUserVO">
select me.eff_id,
me.user_type,
med.org_id,
med.psn_type
from mkt_effective me
left join mkt_effective_detail med on me.eff_id = med.eff_id
where me.eff_type = #{effType}
and me.del_flag = #{delFlag}
</select>
</mapper>