|
@@ -1,16 +1,10 @@
|
|
|
package com.abi.qms.platform.service.impl;
|
|
|
|
|
|
-import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.abi.qms.platform.dao.entity.*;
|
|
|
import com.abi.qms.platform.dao.enums.ActiveAuditStatusEnum;
|
|
|
-import com.abi.qms.platform.dao.enums.ActiveModifyTypeEnum;
|
|
|
-import com.abi.qms.platform.dao.enums.QrPackageApplyStatusEnum;
|
|
|
import com.abi.qms.platform.dao.enums.ValidEnum;
|
|
|
import com.abi.qms.platform.dao.mapper.*;
|
|
|
-import com.abi.qms.platform.dao.vo.result.ActiveModifyApplyPackageVO;
|
|
|
-import com.abi.qms.platform.dao.vo.result.ActivePackageVO;
|
|
|
import com.abi.qms.platform.dao.vo.result.ListActiveVO;
|
|
|
-import com.abi.qms.platform.dao.vo.result.PackageActiveSearchVO;
|
|
|
import com.abi.qms.platform.dto.req.*;
|
|
|
import com.abi.qms.platform.dto.res.*;
|
|
|
import com.abi.qms.platform.infrastructure.util.AssertUtil;
|
|
@@ -28,7 +22,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -148,30 +141,25 @@ public class ActiveServiceImpl implements ActiveService {
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void resubmitActive(ResubmitActiveReq req) {
|
|
|
- //1-查询活动
|
|
|
- BaseActive active = baseActiveMapper.selectById(req.getActiveId());
|
|
|
+ //0-查询活动
|
|
|
+ BaseActive active = baseActiveMapper.selectById(req.getId());
|
|
|
AssertUtil.isNull(active,"活动不存在");
|
|
|
|
|
|
if(!ActiveAuditStatusEnum.REVIEW_PASS.is(active.getAuditStatus())){
|
|
|
throw new BusinessException("该数据没有审核通过,请调用编辑码活动的接口。");
|
|
|
}
|
|
|
|
|
|
- //删除原有申请单数据
|
|
|
- UpdateWrapper<BaseActiveModifyApply> basmaUpdate = new UpdateWrapper<>();
|
|
|
- basmaUpdate.set("is_delete", 1)
|
|
|
- .eq("active_id", req.getActiveId());
|
|
|
- baseActiveModifyApplyMapper.update(null, basmaUpdate);
|
|
|
-
|
|
|
- // 6.03已废弃
|
|
|
-// UpdateWrapper<BaseActiveModifyApplyQrPackageMapping> basmamUpdate = new UpdateWrapper<>();
|
|
|
-// basmamUpdate.set("is_delete", 1)
|
|
|
-// .eq("active_id", req.getActiveId());
|
|
|
-// baseActiveModifyApplyQrPackageMappingMapper.update(null, basmamUpdate);
|
|
|
+ //1-删除原有申请单数据
|
|
|
+ UpdateWrapper<BaseActiveModifyApply> activeModifyUw = new UpdateWrapper<>();
|
|
|
+ activeModifyUw.set("is_delete", 1)
|
|
|
+ .eq("active_id", req.getId());
|
|
|
+ baseActiveModifyApplyMapper.update(null, activeModifyUw);
|
|
|
|
|
|
- //新增活动申请单
|
|
|
+ //2-新增活动申请单
|
|
|
Long userId = userUtil.getUser().getId();
|
|
|
BaseActiveModifyApply baseActiveModifyApply = new BaseActiveModifyApply();
|
|
|
- baseActiveModifyApply.setActiveId(req.getActiveId());
|
|
|
+ baseActiveModifyApply.setActiveId(req.getId());
|
|
|
+ baseActiveModifyApply.setActiveCode(active.getActiveCode());
|
|
|
baseActiveModifyApply.setActiveName(req.getActiveName());
|
|
|
baseActiveModifyApply.setActiveType(req.getActiveType());
|
|
|
baseActiveModifyApply.setAuditStatus(ActiveAuditStatusEnum.WAIT_REVIEW.getCode());
|
|
@@ -180,23 +168,16 @@ public class ActiveServiceImpl implements ActiveService {
|
|
|
baseActiveModifyApply.setApplyUserName(userUtil.getUser().getUserName());
|
|
|
baseActiveModifyApply.setBeginTime(req.getBeginTime());
|
|
|
baseActiveModifyApply.setEndTime(req.getEndTime());
|
|
|
- // 6.03已废弃
|
|
|
-// baseActiveModifyApply.setBrandCode(CollectionUtil.isNotEmpty(req.getBrandCodeList()) ? String.join(",", req.getBrandCodeList()) : null);
|
|
|
baseActiveModifyApply.setUrlTab(req.getUrlTab());
|
|
|
baseActiveModifyApply.setActiveUrl(req.getActiveUrl());
|
|
|
- baseActiveModifyApply.setUpdateBy(userId);
|
|
|
- baseActiveModifyApply.setCreateBy(userId);
|
|
|
baseActiveModifyApplyMapper.insert(baseActiveModifyApply);
|
|
|
|
|
|
//修改码活动是否有申请单
|
|
|
UpdateWrapper<BaseActive> activeUpdateWrapper = new UpdateWrapper<>();
|
|
|
activeUpdateWrapper.set("is_modify_apply", 1)
|
|
|
- .eq("id", req.getActiveId());
|
|
|
+ .eq("id", req.getId());
|
|
|
baseActiveMapper.update(null, activeUpdateWrapper);
|
|
|
|
|
|
- // 6.03已废弃
|
|
|
-// //批量插入 活动编辑申请码包关联子表
|
|
|
-// batchInsertActiveModifyApplyPackageMappiing(baseActiveModifyApply.getId(), req.getActiveId(), req.getQrPackageIdAddList(), req.getQrPackageIdDeleteList());
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -233,20 +214,6 @@ public class ActiveServiceImpl implements ActiveService {
|
|
|
//转化出参
|
|
|
GetActiveRes res = PojoConverterUtils.copy(active, GetActiveRes.class);
|
|
|
|
|
|
- // 6.03已废弃
|
|
|
-// //处理品牌code,品牌名称
|
|
|
-// if(Objects.nonNull(active.getBrandCode())){
|
|
|
-// String[] brandSplit = active.getBrandCode().trim().split(",");
|
|
|
-// res.setBrandCodeList(Arrays.asList(brandSplit));
|
|
|
-// QueryWrapper<BaseBrand> baseBrandQW = new QueryWrapper<>();
|
|
|
-// baseBrandQW.in("brand_code", brandSplit);
|
|
|
-// List<BaseBrand> baseBrands = baseBrandMapper.selectList(baseBrandQW);
|
|
|
-// List<String> baseBrandNameList = baseBrands.stream().map(BaseBrand::getBrandName).collect(Collectors.toList());
|
|
|
-// res.setBrandNameList(baseBrandNameList);
|
|
|
-// }
|
|
|
-//
|
|
|
-// //查询码活动关联的码包列表
|
|
|
-// res.setListActivePackageRes(listActivePackage(req));
|
|
|
return res;
|
|
|
|
|
|
}
|
|
@@ -263,41 +230,15 @@ public class ActiveServiceImpl implements ActiveService {
|
|
|
activeModifyApplyQW.eq("active_id", req.getId());
|
|
|
activeModifyApplyQW.eq("is_delete", 0);
|
|
|
BaseActiveModifyApply activeModifyApply = baseActiveModifyApplyMapper.selectOne(activeModifyApplyQW);
|
|
|
- AssertUtil.isNull(activeModifyApply,"码活动申请单不存在");
|
|
|
-
|
|
|
- GetActiveModifyApplyRes res = new GetActiveModifyApplyRes();
|
|
|
|
|
|
- //转化出参
|
|
|
- // 6.03已废弃
|
|
|
-// GetActiveModifyApplyRes.Active resActive = PojoConverterUtils.copy(active, GetActiveModifyApplyRes.Active.class);
|
|
|
- GetActiveModifyApplyRes resActiveModifyApply = PojoConverterUtils.copy(activeModifyApply, GetActiveModifyApplyRes.class);
|
|
|
+ //转化出参(这里逻辑有点特殊,如果存在申请单,则返回申请单、否则返回活动本身)
|
|
|
+ GetActiveModifyApplyRes res = null;
|
|
|
+ if(activeModifyApply!=null){
|
|
|
+ res = PojoConverterUtils.copy(activeModifyApply, GetActiveModifyApplyRes.class);
|
|
|
+ }else{
|
|
|
+ res = PojoConverterUtils.copy(active, GetActiveModifyApplyRes.class);
|
|
|
+ }
|
|
|
|
|
|
- // 6.03已废弃
|
|
|
- // //处理品牌code,品牌名称
|
|
|
-// if(Objects.nonNull(active.getBrandCode())){
|
|
|
-// String[] brandSplit = active.getBrandCode().trim().split(",");
|
|
|
-// resActive.setBrandCodeList(Arrays.asList(brandSplit));
|
|
|
-// QueryWrapper<BaseBrand> baseBrandQW = new QueryWrapper<>();
|
|
|
-// baseBrandQW.in("brand_code", brandSplit);
|
|
|
-// List<BaseBrand> baseBrands = baseBrandMapper.selectList(baseBrandQW);
|
|
|
-// List<String> baseBrandNameList = baseBrands.stream().map(BaseBrand::getBrandName).collect(Collectors.toList());
|
|
|
-// resActive.setBrandNameList(baseBrandNameList);
|
|
|
-// }
|
|
|
-//
|
|
|
-// if(Objects.nonNull(activeModifyApply.getBrandCode())){
|
|
|
-// String[] brandSplit = activeModifyApply.getBrandCode().trim().split(",");
|
|
|
-// resActiveModifyApply.setBrandCodeList(Arrays.asList(brandSplit));
|
|
|
-// QueryWrapper<BaseBrand> baseBrandQW = new QueryWrapper<>();
|
|
|
-// baseBrandQW.in("brand_code", brandSplit);
|
|
|
-// List<BaseBrand> baseBrands = baseBrandMapper.selectList(baseBrandQW);
|
|
|
-// List<String> baseBrandNameList = baseBrands.stream().map(BaseBrand::getBrandName).collect(Collectors.toList());
|
|
|
-// resActiveModifyApply.setBrandNameList(baseBrandNameList);
|
|
|
-// }
|
|
|
-// res.setActive(resActive);
|
|
|
-// res.setActiveModifyApply(resActiveModifyApply);
|
|
|
- // 6.03已废弃
|
|
|
-// //查询码活动关联的码包列表
|
|
|
-// res.setListActiveModifyApplyPackageRes(listActiveModifyApplyPackage(req));
|
|
|
return res;
|
|
|
}
|
|
|
|
|
@@ -388,34 +329,34 @@ public class ActiveServiceImpl implements ActiveService {
|
|
|
public void passActiveModifyApply(PassActiveModifyApplyReq req) {
|
|
|
|
|
|
//1-查询活动
|
|
|
- BaseActive active = baseActiveMapper.selectById(req.getActiveId());
|
|
|
+ BaseActive active = baseActiveMapper.selectById(req.getId());
|
|
|
AssertUtil.isNull(active,"活动不存在");
|
|
|
-
|
|
|
if(!ActiveAuditStatusEnum.REVIEW_PASS.is(active.getAuditStatus())){
|
|
|
throw new BusinessException("该数据没有审核通过,请调用审核码活动的接口。");
|
|
|
}
|
|
|
//查询码活动申请单
|
|
|
- BaseActiveModifyApply activeModifyApply = baseActiveModifyApplyMapper.selectById(req.getApplyId());
|
|
|
+ QueryWrapper<BaseActiveModifyApply> activeModifyApplyQW = new QueryWrapper<>();
|
|
|
+ activeModifyApplyQW.eq("active_id", req.getId());
|
|
|
+ activeModifyApplyQW.eq("is_delete", 0);
|
|
|
+ BaseActiveModifyApply activeModifyApply = baseActiveModifyApplyMapper.selectOne(activeModifyApplyQW);
|
|
|
AssertUtil.isNull(activeModifyApply,"码活动申请单不存在");
|
|
|
- if(ActiveAuditStatusEnum.WAIT_REVIEW.is(activeModifyApply.getAuditStatus())){
|
|
|
+ if(!ActiveAuditStatusEnum.WAIT_REVIEW.is(activeModifyApply.getAuditStatus())){
|
|
|
throw new BusinessException("该码活动申请单不能审核");
|
|
|
}
|
|
|
|
|
|
- //审核通过码活动申请单
|
|
|
+ //2-审核通过码活动申请单(同时删除申请单,这样子下次修改打开的就是当前活动不是申请单了)
|
|
|
Long userId = userUtil.getUser().getId();
|
|
|
activeModifyApply.setAuditStatus(ActiveAuditStatusEnum.REVIEW_PASS.getCode());
|
|
|
activeModifyApply.setAuditUserId(userId);
|
|
|
activeModifyApply.setAuditUserName(userUtil.getUser().getUserName());
|
|
|
- activeModifyApply.setUpdateBy(userId);
|
|
|
+ activeModifyApply.setIsDelete(1);
|
|
|
baseActiveModifyApplyMapper.updateById(activeModifyApply);
|
|
|
|
|
|
- //修改码活动
|
|
|
+ //3-修改码活动
|
|
|
active.setActiveName(activeModifyApply.getActiveName());
|
|
|
active.setActiveType(activeModifyApply.getActiveType());
|
|
|
active.setBeginTime(activeModifyApply.getBeginTime());
|
|
|
active.setEndTime(activeModifyApply.getEndTime());
|
|
|
- // 6.03已废弃
|
|
|
-// active.setBrandCode(activeModifyApply.getBrandCode());
|
|
|
active.setUrlTab(activeModifyApply.getUrlTab());
|
|
|
active.setActiveUrl(activeModifyApply.getActiveUrl());
|
|
|
active.setAuditUserId(userId);
|
|
@@ -424,59 +365,27 @@ public class ActiveServiceImpl implements ActiveService {
|
|
|
active.setIsModifyApply(0);
|
|
|
baseActiveMapper.updateById(active);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- // 6.03已废弃
|
|
|
-// //分别查出新增的码包和删除的码包
|
|
|
-// //批量新增
|
|
|
-// QueryWrapper<BaseActiveModifyApplyQrPackageMapping> activeModifyApplyQrPackageMappingQWAdd = new QueryWrapper<>();
|
|
|
-// activeModifyApplyQrPackageMappingQWAdd.eq("apply_id", req.getApplyId());
|
|
|
-// activeModifyApplyQrPackageMappingQWAdd.eq("is_delete", 0);
|
|
|
-// activeModifyApplyQrPackageMappingQWAdd.eq("modify_type", ActiveModifyTypeEnum.ADD.getCode());
|
|
|
-// List<BaseActiveModifyApplyQrPackageMapping> baseActiveModifyApplyQrPackageMappingAdds = baseActiveModifyApplyQrPackageMappingMapper.selectList(activeModifyApplyQrPackageMappingQWAdd);
|
|
|
-// if(CollectionUtil.isNotEmpty(baseActiveModifyApplyQrPackageMappingAdds)){
|
|
|
-// //聚合新增的码包
|
|
|
-// List<Long> packageIdAddList = baseActiveModifyApplyQrPackageMappingAdds.stream().map(BaseActiveModifyApplyQrPackageMapping::getQrPackageId).collect(Collectors.toList());
|
|
|
-// baseActiveQrPackageMappingMapper.batchInsert(req.getActiveId(), packageIdAddList, baseActiveModifyApplyQrPackageMappingAdds.get(0).getCreateBy());
|
|
|
-// }
|
|
|
-//
|
|
|
-// //批量删除
|
|
|
-// QueryWrapper<BaseActiveModifyApplyQrPackageMapping> activeModifyApplyQrPackageMappingQWDelete = new QueryWrapper<>();
|
|
|
-// activeModifyApplyQrPackageMappingQWDelete.eq("apply_id", req.getApplyId());
|
|
|
-// activeModifyApplyQrPackageMappingQWDelete.eq("is_delete", 0);
|
|
|
-// activeModifyApplyQrPackageMappingQWDelete.eq("modify_type", ActiveModifyTypeEnum.DELETE.getCode());
|
|
|
-// List<BaseActiveModifyApplyQrPackageMapping> baseActiveModifyApplyQrPackageMappingDeletes = baseActiveModifyApplyQrPackageMappingMapper.selectList(activeModifyApplyQrPackageMappingQWAdd);
|
|
|
-// if(CollectionUtil.isNotEmpty(baseActiveModifyApplyQrPackageMappingDeletes)){
|
|
|
-// //聚合删除的码包
|
|
|
-// List<Long> packageIdDeleteList = baseActiveModifyApplyQrPackageMappingDeletes.stream().map(BaseActiveModifyApplyQrPackageMapping::getQrPackageId).collect(Collectors.toList());
|
|
|
-// UpdateWrapper<BaseActiveQrPackageMapping> aqpmQW = new UpdateWrapper<>();
|
|
|
-// aqpmQW.set("is_delete", 1)
|
|
|
-// .set("update_by", userId)
|
|
|
-// .eq("active_id", req.getActiveId())
|
|
|
-// .in("qr_package_id", packageIdDeleteList);
|
|
|
-// baseActiveQrPackageMappingMapper.update(null, aqpmQW);
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void refuseActiveModifyApply(RefuseActiveModifyApplyReq req) {
|
|
|
//1-查询活动
|
|
|
- BaseActive active = baseActiveMapper.selectById(req.getActiveId());
|
|
|
+ BaseActive active = baseActiveMapper.selectById(req.getId());
|
|
|
AssertUtil.isNull(active,"活动不存在");
|
|
|
-
|
|
|
if(!ActiveAuditStatusEnum.REVIEW_PASS.is(active.getAuditStatus())){
|
|
|
throw new BusinessException("该数据没有审核通过,请调用审核码活动的接口。");
|
|
|
}
|
|
|
//查询码活动申请单
|
|
|
- BaseActiveModifyApply activeModifyApply = baseActiveModifyApplyMapper.selectById(req.getApplyId());
|
|
|
+ QueryWrapper<BaseActiveModifyApply> activeModifyApplyQW = new QueryWrapper<>();
|
|
|
+ activeModifyApplyQW.eq("active_id", req.getId());
|
|
|
+ activeModifyApplyQW.eq("is_delete", 0);
|
|
|
+ BaseActiveModifyApply activeModifyApply = baseActiveModifyApplyMapper.selectOne(activeModifyApplyQW);
|
|
|
AssertUtil.isNull(activeModifyApply,"码活动申请单不存在");
|
|
|
- if(ActiveAuditStatusEnum.WAIT_REVIEW.is(activeModifyApply.getAuditStatus())){
|
|
|
+ if(!ActiveAuditStatusEnum.WAIT_REVIEW.is(activeModifyApply.getAuditStatus())){
|
|
|
throw new BusinessException("该码活动申请单不能审核");
|
|
|
}
|
|
|
|
|
|
- //审核拒绝码活动申请单
|
|
|
+ //2-审核拒绝码活动申请单
|
|
|
Long userId = userUtil.getUser().getId();
|
|
|
activeModifyApply.setAuditStatus(ActiveAuditStatusEnum.REVIEW_REFUSE.getCode());
|
|
|
activeModifyApply.setAuditUserId(userId);
|