Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user