|
@@ -3,25 +3,14 @@ package com.abi.qms.platform.service.impl;
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
import com.abi.base.foundation.util.RedisClient;
|
|
import com.abi.base.foundation.util.RedisClient;
|
|
import com.abi.qms.platform.constant.RedisKeysConstant;
|
|
import com.abi.qms.platform.constant.RedisKeysConstant;
|
|
-import com.abi.qms.platform.dao.entity.BaseFactory;
|
|
|
|
-import com.abi.qms.platform.dao.entity.QrPackage;
|
|
|
|
-import com.abi.qms.platform.dao.entity.QrPackageBatch;
|
|
|
|
-import com.abi.qms.platform.dao.entity.QrPackageDownloadRecord;
|
|
|
|
-import com.abi.qms.platform.dao.entity.QrRepertoryColumn;
|
|
|
|
-import com.abi.qms.platform.dao.entity.UserInfo;
|
|
|
|
|
|
+import com.abi.qms.platform.dao.entity.*;
|
|
import com.abi.qms.platform.dao.enums.FactoryLevelEnum;
|
|
import com.abi.qms.platform.dao.enums.FactoryLevelEnum;
|
|
import com.abi.qms.platform.dao.enums.FactoryTypeEnum;
|
|
import com.abi.qms.platform.dao.enums.FactoryTypeEnum;
|
|
import com.abi.qms.platform.dao.enums.InvalidEnum;
|
|
import com.abi.qms.platform.dao.enums.InvalidEnum;
|
|
import com.abi.qms.platform.dao.enums.QrPackageApplyStatusEnum;
|
|
import com.abi.qms.platform.dao.enums.QrPackageApplyStatusEnum;
|
|
import com.abi.qms.platform.dao.enums.QrPackageGenerateStatusEnum;
|
|
import com.abi.qms.platform.dao.enums.QrPackageGenerateStatusEnum;
|
|
import com.abi.qms.platform.dao.enums.QrRepertoryTypeEnum;
|
|
import com.abi.qms.platform.dao.enums.QrRepertoryTypeEnum;
|
|
-import com.abi.qms.platform.dao.mapper.BaseActiveMapper;
|
|
|
|
-import com.abi.qms.platform.dao.mapper.BaseFactoryMapper;
|
|
|
|
-import com.abi.qms.platform.dao.mapper.QrBoxMappingMapper;
|
|
|
|
-import com.abi.qms.platform.dao.mapper.QrPackageBatchMapper;
|
|
|
|
-import com.abi.qms.platform.dao.mapper.QrPackageDownloadRecordMapper;
|
|
|
|
-import com.abi.qms.platform.dao.mapper.QrPackageMapper;
|
|
|
|
-import com.abi.qms.platform.dao.mapper.QrRepertoryColumnMapper;
|
|
|
|
|
|
+import com.abi.qms.platform.dao.mapper.*;
|
|
import com.abi.qms.platform.dao.tablestore.entity.QrCode;
|
|
import com.abi.qms.platform.dao.tablestore.entity.QrCode;
|
|
import com.abi.qms.platform.dao.vo.result.PackageActiveVO;
|
|
import com.abi.qms.platform.dao.vo.result.PackageActiveVO;
|
|
import com.abi.qms.platform.dao.vo.result.QrBoxMappingVO;
|
|
import com.abi.qms.platform.dao.vo.result.QrBoxMappingVO;
|
|
@@ -64,6 +53,7 @@ import com.abi.task.common.utils.PojoConverterUtils;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
import freemarker.template.Template;
|
|
import freemarker.template.Template;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
@@ -137,6 +127,9 @@ public class QrPackageServiceImpl implements QrPackageService {
|
|
@Autowired
|
|
@Autowired
|
|
private TableStoreUtils tableStoreUtils;
|
|
private TableStoreUtils tableStoreUtils;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private BaseBrandMapper baseBrandMapper;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 保存码包
|
|
* 保存码包
|
|
*/
|
|
*/
|
|
@@ -430,7 +423,53 @@ public class QrPackageServiceImpl implements QrPackageService {
|
|
QrPackageVO qrPackage = qrPackageMapper.selectQrPackageDetailById(req.getId());
|
|
QrPackageVO qrPackage = qrPackageMapper.selectQrPackageDetailById(req.getId());
|
|
AssertUtil.isNull(qrPackage, "码包不存在");
|
|
AssertUtil.isNull(qrPackage, "码包不存在");
|
|
|
|
|
|
- return PojoConverterUtils.copy(qrPackage, GetQrPackageDetailRes.class);
|
|
|
|
|
|
+ //转化出参
|
|
|
|
+ GetQrPackageDetailRes res = PojoConverterUtils.copy(qrPackage, GetQrPackageDetailRes.class);
|
|
|
|
+
|
|
|
|
+ //查询码包对应活动单条数据
|
|
|
|
+ PackageActiveVO packageActive = baseActiveMapper.getPackageActive(qrPackage.getId());
|
|
|
|
+
|
|
|
|
+ //存在活动数据
|
|
|
|
+ if (ObjectUtils.isNotEmpty(packageActive)) {
|
|
|
|
+ getBrandCodeName(res,packageActive);
|
|
|
|
+ }
|
|
|
|
+ return res;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 活动详情封装出参,显示品牌名称
|
|
|
|
+ * @param res
|
|
|
|
+ * @param packageActive
|
|
|
|
+ */
|
|
|
|
+ private void getBrandCodeName(GetQrPackageDetailRes res,PackageActiveVO packageActive){
|
|
|
|
+
|
|
|
|
+ res.setActiveCode(packageActive.getActiveCode());
|
|
|
|
+ res.setActiveName(packageActive.getActiveName());
|
|
|
|
+ res.setActiveUrl(packageActive.getActiveUrl());
|
|
|
|
+ res.setActiveType(packageActive.getActiveType());
|
|
|
|
+ res.setBeginTime(packageActive.getBeginTime());
|
|
|
|
+ res.setEndTime(packageActive.getEndTime());
|
|
|
|
+ //多品牌名称
|
|
|
|
+ StringBuffer brandNames = new StringBuffer();
|
|
|
|
+ //查询品牌一级列表
|
|
|
|
+ QueryWrapper<BaseBrand> baseBrandQW = new QueryWrapper<>();
|
|
|
|
+ baseBrandQW.eq("brand_level",1);
|
|
|
|
+ List<BaseBrand> baseBrands = baseBrandMapper.selectList(baseBrandQW);
|
|
|
|
+ Map<String, String> brandCodeMap = baseBrands.stream().collect(Collectors.toMap(BaseBrand::getBrandCode, BaseBrand::getBrandName));
|
|
|
|
+
|
|
|
|
+ //品牌名称获取
|
|
|
|
+ String[] brandCodeArray = packageActive.getBrandCode().split(",");
|
|
|
|
+ for (String brandCode : brandCodeArray) {
|
|
|
|
+ String codeName = brandCodeMap.get(brandCode);
|
|
|
|
+ if (StringUtils.isNotBlank(codeName)) {
|
|
|
|
+ brandNames.append(codeName).append(",");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (brandNames.length()>0){
|
|
|
|
+ brandNames.deleteCharAt(brandNames.length()-1);
|
|
|
|
+ res.setBrandNames(brandNames.toString());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|