霸王餐相关
This commit is contained in:
parent
0adc5ad23c
commit
2547a2b0d1
|
|
@ -1,8 +1,8 @@
|
|||
package com.czg.controller.admin;
|
||||
|
||||
import com.czg.account.dto.freeding.FreeDineConfigEditDTO;
|
||||
import com.czg.account.entity.FreeDineConfig;
|
||||
import com.czg.account.service.FreeDineConfigService;
|
||||
import com.czg.account.vo.FreeDineConfigVO;
|
||||
import com.czg.annotation.SaAdminCheckPermission;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
|
|
@ -25,7 +25,7 @@ public class FreeDingController {
|
|||
*/
|
||||
@SaAdminCheckPermission(value = "freeDing:detail", name = "获取霸王餐配置信息")
|
||||
@GetMapping
|
||||
public CzgResult<FreeDineConfig> getConfig() {
|
||||
public CzgResult<FreeDineConfigVO> getConfig() {
|
||||
return CzgResult.success(freeDineConfigService.getConfig(StpKit.USER.getShopId()));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,4 +48,7 @@ public class FreeDineConfigEditDTO {
|
|||
*/
|
||||
private List<String> useType;
|
||||
|
||||
private String useShopType;
|
||||
private List<Long> shopIdList;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.czg.account.entity.FreeDineConfig;
|
|||
import com.czg.account.entity.ShopExtend;
|
||||
import com.czg.account.entity.ShopInfo;
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import com.czg.account.vo.FreeDineConfigVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
|
@ -50,6 +51,6 @@ public class ShopUserDetailDTO extends ShopUser {
|
|||
/**
|
||||
* 霸王餐信息
|
||||
*/
|
||||
private FreeDineConfig freeDineConfig;
|
||||
private FreeDineConfigVO freeDineConfig;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,8 @@ public class FreeDineConfig implements Serializable {
|
|||
/**
|
||||
* 可用的子门店id
|
||||
*/
|
||||
private String childShopIdList;
|
||||
private String shopIdList;
|
||||
private String useShopType;
|
||||
|
||||
public Integer getMultiple() {
|
||||
return rechargeTimes == null ? 2 : rechargeTimes;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.czg.account.service;
|
||||
|
||||
import com.czg.account.dto.freeding.FreeDineConfigEditDTO;
|
||||
import com.czg.account.vo.FreeDineConfigVO;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.account.entity.FreeDineConfig;
|
||||
|
||||
|
|
@ -12,7 +13,7 @@ import com.czg.account.entity.FreeDineConfig;
|
|||
*/
|
||||
public interface FreeDineConfigService extends IService<FreeDineConfig> {
|
||||
|
||||
FreeDineConfig getConfig(long shopId);
|
||||
FreeDineConfigVO getConfig(long shopId);
|
||||
|
||||
Boolean edit(long shopId, FreeDineConfigEditDTO freeDineConfigEditDTO);
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,80 @@
|
|||
package com.czg.account.vo;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class FreeDineConfigVO implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private Boolean enable;
|
||||
|
||||
/**
|
||||
* 充值多少倍免单
|
||||
*/
|
||||
private Integer rechargeTimes;
|
||||
|
||||
/**
|
||||
* 订单满多少元可以使用
|
||||
*/
|
||||
private BigDecimal rechargeThreshold;
|
||||
|
||||
/**
|
||||
* 是否与优惠券共享
|
||||
*/
|
||||
private Boolean withCoupon;
|
||||
|
||||
/**
|
||||
* 是否与积分同享
|
||||
*/
|
||||
private Boolean withPoints;
|
||||
|
||||
/**
|
||||
* 充值说明
|
||||
*/
|
||||
private String rechargeDesc;
|
||||
|
||||
// /**
|
||||
// * 使用类型 dine-in店内 takeout 自取 post快递,takeaway外卖
|
||||
// */
|
||||
// private String useType;
|
||||
|
||||
/**
|
||||
* 门店id
|
||||
*/
|
||||
@Id
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 可用的子门店id
|
||||
*/
|
||||
private List<Long> shopIdList;
|
||||
private String useShopType;
|
||||
|
||||
public Integer getMultiple() {
|
||||
return rechargeTimes == null ? 2 : rechargeTimes;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,12 @@
|
|||
package com.czg.service.account.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.czg.account.dto.freeding.FreeDineConfigEditDTO;
|
||||
import com.czg.account.entity.FreeDineConfig;
|
||||
import com.czg.account.service.FreeDineConfigService;
|
||||
import com.czg.account.vo.FreeDineConfigVO;
|
||||
import com.czg.exception.ApiNotPrintException;
|
||||
import com.czg.service.account.mapper.FreeDineConfigMapper;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
|
|
@ -19,7 +22,7 @@ import org.apache.dubbo.config.annotation.DubboService;
|
|||
@DubboService
|
||||
public class FreeDineConfigServiceImpl extends ServiceImpl<FreeDineConfigMapper, FreeDineConfig> implements FreeDineConfigService{
|
||||
@Override
|
||||
public FreeDineConfig getConfig(long shopId) {
|
||||
public FreeDineConfigVO getConfig(long shopId) {
|
||||
FreeDineConfig freeDineConfig = getOne(new QueryWrapper().eq(FreeDineConfig::getShopId, shopId));
|
||||
if (freeDineConfig == null) {
|
||||
freeDineConfig = new FreeDineConfig();
|
||||
|
|
@ -27,17 +30,23 @@ public class FreeDineConfigServiceImpl extends ServiceImpl<FreeDineConfigMapper,
|
|||
save(freeDineConfig);
|
||||
freeDineConfig = getOne(new QueryWrapper().eq(FreeDineConfig::getShopId, shopId));
|
||||
}
|
||||
|
||||
return freeDineConfig;
|
||||
FreeDineConfigVO dto = BeanUtil.copyProperties(freeDineConfig, FreeDineConfigVO.class, "shopIdList");
|
||||
if (StrUtil.isNotBlank(freeDineConfig.getShopIdList())) {
|
||||
dto.setShopIdList(JSONArray.parseArray(freeDineConfig.getShopIdList()).toList(Long.class));
|
||||
}
|
||||
return dto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean edit(long shopId, FreeDineConfigEditDTO freeDineConfigEditDTO) {
|
||||
FreeDineConfig config = getConfig(shopId);
|
||||
FreeDineConfig config = getOne(new QueryWrapper().eq(FreeDineConfig::getShopId, shopId));
|
||||
if (config == null) {
|
||||
throw new ApiNotPrintException("霸王餐信息未配置");
|
||||
}
|
||||
BeanUtil.copyProperties(freeDineConfigEditDTO, config);
|
||||
if ("part".equals(freeDineConfigEditDTO.getUseShopType()) && freeDineConfigEditDTO.getShopIdList() != null) {
|
||||
config.setShopIdList(JSONArray.toJSONString(freeDineConfigEditDTO.getShopIdList()));
|
||||
}
|
||||
// if (freeDineConfigEditDTO.getUseType() != null && !freeDineConfigEditDTO.getUseType().isEmpty()) {
|
||||
// config.setUseType(JSONObject.toJSONString(freeDineConfigEditDTO.getUseType()));
|
||||
// }
|
||||
|
|
|
|||
Loading…
Reference in New Issue