Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
19b410aadd
|
|
@ -0,0 +1,56 @@
|
|||
package com.czg.controller.admin;
|
||||
|
||||
import com.czg.annotation.SaAdminCheckPermission;
|
||||
import com.czg.market.dto.MkBirthdayGiftDTO;
|
||||
import com.czg.market.dto.MkDrainageConfigDTO;
|
||||
import com.czg.market.entity.MkDrainageConfig;
|
||||
import com.czg.market.service.MkBirthdayGiftService;
|
||||
import com.czg.market.service.MkDrainageConfigService;
|
||||
import com.czg.market.vo.MkBirthdayGiftRecordSummaryVO;
|
||||
import com.czg.market.vo.MkBirthdayGiftRecordVO;
|
||||
import com.czg.market.vo.MkBirthdayGiftVO;
|
||||
import com.czg.market.vo.MkDrainageConfigVO;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 私域引流配置
|
||||
* @author Administrator
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/admin/drainageConfig")
|
||||
public class DrainageConfigController {
|
||||
|
||||
@Resource
|
||||
private MkDrainageConfigService service;
|
||||
|
||||
/**
|
||||
* 配置信息获取
|
||||
* 权限标识: activate:list
|
||||
*/
|
||||
@SaAdminCheckPermission(value = "drainageConfig:detail", name = "私域引流详情")
|
||||
@GetMapping
|
||||
public CzgResult<MkDrainageConfigVO> detail() {
|
||||
return CzgResult.success(service.detail(StpKit.USER.getShopId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置信息修改
|
||||
* @return 是否成功
|
||||
*/
|
||||
@SaAdminCheckPermission(value = "drainageConfig:edit", name = "私域引流修改")
|
||||
@PostMapping
|
||||
public CzgResult<Boolean> edit(@Validated @RequestBody MkDrainageConfigDTO config) {
|
||||
return CzgResult.success(service.edit(StpKit.USER.getShopId(), config));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package com.czg.controller.user;
|
||||
|
||||
import com.czg.annotation.SaAdminCheckPermission;
|
||||
import com.czg.market.dto.MkDrainageConfigDTO;
|
||||
import com.czg.market.service.MkDrainageConfigService;
|
||||
import com.czg.market.vo.MkDrainageConfigVO;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 私域引流配置
|
||||
* @author Administrator
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user/drainageConfig")
|
||||
public class UDrainageConfigController {
|
||||
|
||||
@Resource
|
||||
private MkDrainageConfigService service;
|
||||
|
||||
/**
|
||||
* 配置信息获取
|
||||
* 权限标识: activate:list
|
||||
*/
|
||||
@GetMapping
|
||||
public CzgResult<MkDrainageConfigVO> detail(@RequestParam Long shopId) {
|
||||
return CzgResult.success(service.detail(shopId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -64,7 +64,7 @@ public class FreeDineConfig implements Serializable {
|
|||
// /**
|
||||
// * 使用类型 dine-in店内 takeout 自取 post快递,takeaway外卖
|
||||
// */
|
||||
// private String useType;
|
||||
private String useType;
|
||||
|
||||
/**
|
||||
* 门店id
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class FreeDineConfigVO implements Serializable {
|
|||
// /**
|
||||
// * 使用类型 dine-in店内 takeout 自取 post快递,takeaway外卖
|
||||
// */
|
||||
// private String useType;
|
||||
private List<String> useType;
|
||||
|
||||
/**
|
||||
* 门店id
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
package com.czg.market.dto;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class MkDrainageConfigDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 堂食 dine-in 外带 take-out 外卖 take-away
|
||||
*/
|
||||
private List<String> useType;
|
||||
|
||||
/**
|
||||
* 群二维码
|
||||
*/
|
||||
private String qrCode;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
@Max(value = 50, message = "内容最大长度为50")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 提示语
|
||||
*/
|
||||
private String note;
|
||||
|
||||
/**
|
||||
* 是否开启
|
||||
*/
|
||||
private Integer isEnable;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
package com.czg.market.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 私域引流表 实体类。
|
||||
*
|
||||
* @author zs
|
||||
* @since 2025-10-14
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("mk_drainage_config")
|
||||
public class MkDrainageConfig implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 堂食 dine-in 外带 take-out 外卖 take-away
|
||||
*/
|
||||
private String useType;
|
||||
|
||||
/**
|
||||
* 群二维码
|
||||
*/
|
||||
private String qrCode;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 提示语
|
||||
*/
|
||||
private String note;
|
||||
|
||||
/**
|
||||
* 是否开启
|
||||
*/
|
||||
private Integer isEnable;
|
||||
|
||||
/**
|
||||
* 主店id
|
||||
*/
|
||||
private Long mainShopId;
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.czg.market.service;
|
||||
|
||||
import com.czg.market.dto.MkDrainageConfigDTO;
|
||||
import com.czg.market.vo.MkDrainageConfigVO;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.market.entity.MkDrainageConfig;
|
||||
|
||||
/**
|
||||
* 私域引流表 服务层。
|
||||
*
|
||||
* @author zs
|
||||
* @since 2025-10-14
|
||||
*/
|
||||
public interface MkDrainageConfigService extends IService<MkDrainageConfig> {
|
||||
|
||||
MkDrainageConfigVO detail(Long shopId);
|
||||
|
||||
Boolean edit(Long shopId, MkDrainageConfigDTO config);
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
package com.czg.market.vo;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 私域引流表 实体类。
|
||||
*
|
||||
* @author zs
|
||||
* @since 2025-10-14
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MkDrainageConfigVO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 堂食 dine-in 外带 take-out 外卖 take-away
|
||||
*/
|
||||
private List<String> useType;
|
||||
|
||||
/**
|
||||
* 群二维码
|
||||
*/
|
||||
private String qrCode;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 提示语
|
||||
*/
|
||||
private String note;
|
||||
|
||||
/**
|
||||
* 是否开启
|
||||
*/
|
||||
private Integer isEnable;
|
||||
|
||||
/**
|
||||
* 主店id
|
||||
*/
|
||||
private Long mainShopId;
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.czg.service.account.service.impl;
|
|||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.czg.account.dto.freeding.FreeDineConfigEditDTO;
|
||||
import com.czg.account.entity.FreeDineConfig;
|
||||
|
|
@ -34,6 +35,10 @@ public class FreeDineConfigServiceImpl extends ServiceImpl<FreeDineConfigMapper,
|
|||
if (StrUtil.isNotBlank(freeDineConfig.getShopIdList())) {
|
||||
dto.setShopIdList(JSONArray.parseArray(freeDineConfig.getShopIdList()).toList(Long.class));
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(freeDineConfig.getUseType())) {
|
||||
dto.setUseType(JSONArray.parseArray(freeDineConfig.getUseType()).toList(String.class));
|
||||
}
|
||||
return dto;
|
||||
}
|
||||
|
||||
|
|
@ -43,13 +48,13 @@ public class FreeDineConfigServiceImpl extends ServiceImpl<FreeDineConfigMapper,
|
|||
if (config == null) {
|
||||
throw new ApiNotPrintException("霸王餐信息未配置");
|
||||
}
|
||||
BeanUtil.copyProperties(freeDineConfigEditDTO, config);
|
||||
BeanUtil.copyProperties(freeDineConfigEditDTO, config, "useType");
|
||||
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()));
|
||||
// }
|
||||
if (freeDineConfigEditDTO.getUseType() != null) {
|
||||
config.setUseType(JSONObject.toJSONString(freeDineConfigEditDTO.getUseType()));
|
||||
}
|
||||
return updateById(config);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
package com.czg.service.market.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.market.entity.MkDrainageConfig;
|
||||
|
||||
/**
|
||||
* 私域引流表 映射层。
|
||||
*
|
||||
* @author zs
|
||||
* @since 2025-10-14
|
||||
*/
|
||||
public interface MkDrainageConfigMapper extends BaseMapper<MkDrainageConfig> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package com.czg.service.market.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.czg.account.entity.ShopInfo;
|
||||
import com.czg.account.service.ShopInfoService;
|
||||
import com.czg.market.dto.MkConsumeCashbackDTO;
|
||||
import com.czg.market.dto.MkDrainageConfigDTO;
|
||||
import com.czg.market.entity.MkConsumeCashback;
|
||||
import com.czg.market.vo.MkDrainageConfigVO;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.market.entity.MkDrainageConfig;
|
||||
import com.czg.market.service.MkDrainageConfigService;
|
||||
import com.czg.service.market.mapper.MkDrainageConfigMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 私域引流表 服务层实现。
|
||||
*
|
||||
* @author zs
|
||||
* @since 2025-10-14
|
||||
*/
|
||||
@Service
|
||||
public class MkDrainageConfigServiceImpl extends ServiceImpl<MkDrainageConfigMapper, MkDrainageConfig> implements MkDrainageConfigService{
|
||||
@Resource
|
||||
private ShopInfoService shopInfoService;
|
||||
@Override
|
||||
public MkDrainageConfigVO detail(Long shopId) {
|
||||
Long mainShopId = shopInfoService.getMainIdByShopId(shopId);
|
||||
MkDrainageConfig config = getOne(new QueryWrapper().eq(MkDrainageConfig::getMainShopId, shopId));
|
||||
if (config == null) {
|
||||
config = new MkDrainageConfig();
|
||||
config.setMainShopId(mainShopId);
|
||||
config.setShopId(shopId);
|
||||
save(config);
|
||||
config = getOne(new QueryWrapper().eq(MkConsumeCashback::getMainShopId, shopId));
|
||||
}
|
||||
MkDrainageConfigVO info = BeanUtil.copyProperties(config, MkDrainageConfigVO.class, "useType");
|
||||
if (StrUtil.isNotBlank(config.getUseType())) {
|
||||
info.setUseType(JSONArray.parseArray(config.getUseType()).toList(String.class));
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean edit(Long shopId, MkDrainageConfigDTO config) {
|
||||
MkDrainageConfig info = getOne(new QueryWrapper().eq(MkDrainageConfig::getMainShopId, shopId));
|
||||
BeanUtil.copyProperties(config, info);
|
||||
if (config.getUseType() != null) {
|
||||
info.setUseType(JSONArray.toJSONString(config.getUseType()));
|
||||
}
|
||||
return updateById(info);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?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.czg.service.market.mapper.MkDrainageConfigMapper">
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue