master:进货车返回单价及总价;

pull/1121/head
liujiang 2025-05-14 22:04:11 +08:00
parent bd1abfc7ed
commit b9ac177a64
15 changed files with 123 additions and 18 deletions

View File

@ -116,5 +116,14 @@ public class AdvertRoundController extends XktBaseController {
return R.ok(advertRoundService.uploadAdvertPic(BeanUtil.toBean(uploadPicVO, AdRoundUploadPicDTO.class)));
}
/**
*
*/
@ApiOperation(value = "查看图片审核拒绝理由", httpMethod = "PUT", response = R.class)
@PutMapping("/reject-reason/{advertRoundId}")
public R<String> getRejectReason(@PathVariable Long advertRoundId) {
return R.ok(advertRoundService.getRejectReason(advertRoundId));
}
}

View File

@ -25,9 +25,12 @@ public class AdminAdRoundSysInterceptVO {
@NotNull(message = "推广轮次ID不能为空")
@ApiModelProperty(value = "推广轮次ID")
private Long advertRoundId;
@NotBlank(message = "档口ID不能为空")
@NotNull(message = "档口ID不能为空")
@ApiModelProperty(value = "档口ID")
private Long storeId;
@NotBlank(message = "档口名称不能为空")
@ApiModelProperty(value = "档口名称")
private String storeName;
@ApiModelProperty(value = "管理员上传推广图")
private AARSIFileVO file;
@ApiModelProperty(value = "档口商品ID集合")

View File

@ -24,6 +24,9 @@ public class AdRoundUploadPicVO {
@NotNull(message = "推广轮次ID不能为空!")
@ApiModelProperty(value = "推广轮次ID")
private Long advertRoundId;
@NotNull(message = "档口ID不能为空!")
@ApiModelProperty(value = "档口ID")
private Long storeId;
@NotBlank(message = "文件名称不能为空!")
@ApiModelProperty(value = "文件名称")
private String fileName;

View File

@ -2,6 +2,7 @@ package com.ruoyi.web.controller.xkt.vo.storeProd;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.ruoyi.common.xss.Xss;
import com.ruoyi.web.controller.xkt.vo.storeColor.StoreColorVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -97,6 +98,7 @@ public class StoreProdVO {
private StoreProdSvcVO svc;
@NotBlank(message = "详情内容不能为空!")
@ApiModelProperty(value = "详情内容", required = true)
@Xss
private String detail;
@ApiModelProperty(value = "档口生产工艺")
private StoreProdProcessVO process;

View File

@ -462,6 +462,13 @@ public class XktTask {
});
}
/**
* 11store_advert_file
*/
public void copyPicToStoreAdvertFile() {
}
/**
*

View File

@ -96,7 +96,7 @@ public class AdvertRound extends XktBaseEntity {
*/
private Integer picAuditStatus;
/**
* 0 1
* 1 2
*/
private Integer picSetType;
/**

View File

@ -17,6 +17,8 @@ public class AdminAdRoundPageResDTO {
@ApiModelProperty(value = "推广轮次ID")
private Long advertRoundId;
@ApiModelProperty(value = "档口ID")
private Long storeId;
@ApiModelProperty(value = "档口名称")
private String storeName;
@ApiModelProperty(value = "投放平台")

View File

@ -24,6 +24,8 @@ public class AdminAdRoundSysInterceptDTO {
private Long advertRoundId;
@ApiModelProperty(value = "档口ID")
private Long storeId;
@ApiModelProperty(value = "档口名称")
private String storeName;
@ApiModelProperty(value = "管理员上传推广图")
private AARSIFileVO file;
@ApiModelProperty(value = "档口商品ID集合")

View File

@ -6,8 +6,6 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
@ -23,6 +21,8 @@ public class AdRoundUploadPicDTO {
@ApiModelProperty(value = "推广轮次ID")
private Long advertRoundId;
@ApiModelProperty(value = "档口ID")
private Long storeId;
@ApiModelProperty(value = "文件名称")
private String fileName;
@ApiModelProperty(value = "文件路径")

View File

@ -33,6 +33,7 @@ public class ShoppingCartDTO {
@Data
@ApiModel(value = "档口优惠列表")
@Accessors(chain = true)
public static class SCDetailDTO {
@ApiModelProperty(value = "档口商品颜色ID")
private Long storeProdColorId;

View File

@ -107,4 +107,13 @@ public interface IAdvertRoundService {
* @return Integer
*/
Integer uploadAdvertPic(AdRoundUploadPicDTO picDTO);
/**
*
*
* @param advertRoundId ID
* @return String
*/
String getRejectReason(Long advertRoundId);
}

View File

@ -24,6 +24,7 @@ import com.ruoyi.xkt.mapper.SysFileMapper;
import com.ruoyi.xkt.service.IAdminAdvertRoundService;
import com.ruoyi.xkt.service.IAssetService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils;
@ -79,7 +80,7 @@ public class AdminAdvertRoundServiceImpl implements IAdminAdvertRoundService {
.setPicSetTypeName(ObjectUtils.isNotEmpty(item.getPicSetType()) ? AdPicSetType.of(item.getPicSetType()).getLabel() : "")
.setTypeName(AdType.of(item.getTypeId()).getLabel())
.setBiddingStatusName(ObjectUtils.isNotEmpty(item.getBiddingStatus()) ? AdBiddingStatus.of(item.getBiddingStatus()).getLabel() : ""));
return Page.convert(new PageInfo<>(BeanUtil.copyToList(list, AdminAdRoundPageResDTO.class)));
return Page.convert(new PageInfo<>(list));
}
/**
@ -121,10 +122,14 @@ public class AdminAdvertRoundServiceImpl implements IAdminAdvertRoundService {
.eq(AdvertRound::getId, unsubscribeDTO.getAdvertRoundId()).eq(AdvertRound::getDelFlag, Constants.UNDELETED)
.eq(AdvertRound::getStoreId, unsubscribeDTO.getStoreId())))
.orElseThrow(() -> new ServiceException("档口购买的推广位不存在!", HttpStatus.ERROR));
// 若是推广位已投放,则不可退订
if (Objects.equals(advertRound.getLaunchStatus(), AdLaunchStatus.LAUNCHING.getValue())) {
throw new ServiceException("推广位已投放,购买后不可退订!", HttpStatus.ERROR);
}
// 判断当前时间距离开播是否小于12h若是则不可取消
Date twelveHoursAfter = DateUtils.toDate(LocalDateTime.now().plusHours(12));
if (twelveHoursAfter.after(advertRound.getStartTime())) {
throw new ServiceException("距推广开播小于12小时不可退订!");
throw new ServiceException("距推广开播小于12小时不可退订!", HttpStatus.ERROR);
}
// 如果扣除了费用,则减去退回金额
BigDecimal remainPayPrice = advertRound.getPayPrice().subtract(ObjectUtils.defaultIfNull(unsubscribeDTO.getDeductionFee(), BigDecimal.ZERO));
@ -146,7 +151,8 @@ public class AdminAdvertRoundServiceImpl implements IAdminAdvertRoundService {
this.isSuperAdmin();
AdvertRound advertRound = Optional.ofNullable(this.advertRoundMapper.selectOne(new LambdaQueryWrapper<AdvertRound>()
.eq(AdvertRound::getId, picDTO.getAdvertRoundId()).eq(AdvertRound::getDelFlag, Constants.UNDELETED)))
.eq(AdvertRound::getId, picDTO.getAdvertRoundId()).eq(AdvertRound::getStoreId, picDTO.getStoreId())
.eq(AdvertRound::getDelFlag, Constants.UNDELETED)))
.orElseThrow(() -> new ServiceException("推广位不存在!", HttpStatus.ERROR));
SysFile file = BeanUtil.toBean(picDTO, SysFile.class);
int count = this.fileMapper.insert(file);
@ -186,15 +192,32 @@ public class AdminAdvertRoundServiceImpl implements IAdminAdvertRoundService {
if (Objects.equals(advertRound.getSysIntercept(), AdSysInterceptType.INTERCEPT.getValue())) {
throw new ServiceException("该推广位已被拦截,不可再次拦截!", HttpStatus.ERROR);
}
// 若是 时间范围,则判断该推广位、该轮次是否有相同档口已出价或竞价成功,若是,则不可购买。若是位置枚举,则判断该位置 是否是相同档口已出价,若是,则不可购买。
if (Objects.equals(advertRound.getShowType(), AdShowType.TIME_RANGE.getValue())) {
List<AdvertRound> timeRangeExistList = this.advertRoundMapper.selectList(new LambdaQueryWrapper<AdvertRound>()
.eq(AdvertRound::getAdvertId, advertRound.getAdvertId()).eq(AdvertRound::getRoundId, advertRound.getRoundId())
.eq(AdvertRound::getStoreId, interceptDTO.getStoreId()).eq(AdvertRound::getDelFlag, Constants.UNDELETED));
if (CollectionUtils.isNotEmpty(timeRangeExistList)) {
throw new ServiceException("档口" + interceptDTO.getStoreName() + "已出价该推广位,不可重复购买!", HttpStatus.ERROR);
}
} else {
List<AdvertRound> positionEnumExistList = this.advertRoundMapper.selectList(new LambdaQueryWrapper<AdvertRound>()
.eq(AdvertRound::getAdvertId, advertRound.getAdvertId()).eq(AdvertRound::getRoundId, advertRound.getRoundId())
.eq(AdvertRound::getPosition, advertRound.getPosition()).eq(AdvertRound::getDelFlag, Constants.UNDELETED)
.eq(AdvertRound::getStoreId, interceptDTO.getStoreId()));
}
// 若该推广位已投放
if (Objects.equals(advertRound.getLaunchStatus(), AdLaunchStatus.LAUNCHING.getValue())) {
// 若该广告位 为时间范围 且 为档口正常购买(也有可能为系统拦截),则均不可不可拦截该推广位
// 若该广告位 为时间范围 且 为档口正常购买(也有可能为系统拦截),则均不可拦截该推广位
if (Objects.equals(advertRound.getShowType(), AdShowType.TIME_RANGE.getValue()) && ObjectUtils.isNotEmpty(advertRound.getStoreId())) {
throw new ServiceException("该推广位为档口正常购买,已投放,不可拦截!", HttpStatus.ERROR);
}
// 若该广告位为位置枚举,则不可购买,因为位置枚举一般都是第二天播放
if (Objects.equals(advertRound.getShowType(), AdShowType.POSITION_ENUM.getValue())) {
throw new ServiceException("该推广位为位置枚举,不可购买,因为位置枚举一般都是第二天播放!", HttpStatus.ERROR);
throw new ServiceException("该推广位不可购买,因为正在播放!", HttpStatus.ERROR);
}
// 若为待投放推广
} else {
@ -218,7 +241,8 @@ public class AdminAdvertRoundServiceImpl implements IAdminAdvertRoundService {
if (ObjectUtils.isNotEmpty(interceptDTO.getFile())) {
SysFile file = BeanUtil.toBean(interceptDTO.getFile(), SysFile.class);
this.fileMapper.insert(file);
advertRound.setPicId(file.getId()).setPicAuditStatus(AdPicAuditStatus.AUDIT_PASS.getValue()).setPicDesignType(AdDesignType.SYS_DESIGN.getValue());
advertRound.setPicId(file.getId()).setPicAuditStatus(AdPicAuditStatus.AUDIT_PASS.getValue())
.setPicDesignType(AdDesignType.SYS_DESIGN.getValue()).setPicSetType(AdPicSetType.SET.getValue());
}
if (ObjectUtils.isNotEmpty(interceptDTO.getStoreProdIdList())) {
advertRound.setProdIdStr(StringUtils.join(interceptDTO.getStoreProdIdList(), ","));

View File

@ -385,8 +385,8 @@ public class AdvertRoundServiceImpl implements IAdvertRoundService {
.setSysIntercept(AdSysInterceptType.UN_INTERCEPT.getValue())
.setStoreId(createDTO.getStoreId()).setPayPrice(createDTO.getPayPrice()).setVoucherDate(java.sql.Date.valueOf(LocalDate.now()))
.setBiddingStatus(AdBiddingStatus.BIDDING.getValue()).setBiddingTempStatus(AdBiddingStatus.BIDDING_SUCCESS.getValue())
// 展示类型非商品才赋值 setType
.setPicSetType(!Objects.equals(minPriceAdvert.getDisplayType(), AdDisplayType.PRODUCT.getValue()) ? AdPicSetType.UN_SET.getValue() : null)
.setPicAuditStatus(!Objects.equals(minPriceAdvert.getDisplayType(), AdDisplayType.PRODUCT.getValue()) ? AdPicAuditStatus.UN_AUDIT.getValue() : null)
.setPicDesignType(!Objects.equals(minPriceAdvert.getDisplayType(), AdDisplayType.PRODUCT.getValue()) ? createDTO.getPicDesignType() : null)
.setPicAuditStatus(!Objects.equals(minPriceAdvert.getDisplayType(), AdDisplayType.PRODUCT.getValue()) ? AdPicAuditStatus.UN_AUDIT.getValue() : null)
.setProdIdStr(createDTO.getProdIdStr());
@ -575,13 +575,41 @@ public class AdvertRoundServiceImpl implements IAdvertRoundService {
// 更新推广位的图片ID
advertRound.setPicId(file.getId());
this.advertRoundMapper.updateById(advertRound);
// 将档口上传图片保存到AdvertStoreFile
// TODO 是否要保存到AdvertStoreFile 因为还没审核通过
// TODO 是否要保存到AdvertStoreFile 因为还没审核通过
// TODO 是否要保存到AdvertStoreFile 因为还没审核通过
// TODO 是否要保存到AdvertStoreFile 因为还没审核通过
/*// 将档口上传图片保存到AdvertStoreFile
AdvertStoreFile advertStoreFile = new AdvertStoreFile().setAdvertRoundId(advertRound.getId())
.setStoreId(advertRound.getStoreId()).setFileId(file.getId()).setTypeId(advertRound.getTypeId());
this.advertStoreFileMapper.insert(advertStoreFile);
this.advertStoreFileMapper.insert(advertStoreFile);*/
return count;
}
/**
*
*
* @param advertRoundId ID
* @return String
*/
@Override
@Transactional(readOnly = true)
public String getRejectReason(Long advertRoundId) {
AdvertRound advertRound = Optional.ofNullable(this.advertRoundMapper.selectOne(new LambdaQueryWrapper<AdvertRound>()
.eq(AdvertRound::getId, advertRoundId).eq(AdvertRound::getDelFlag, Constants.UNDELETED)
.eq(AdvertRound::getPicAuditStatus, AdPicAuditStatus.AUDIT_REJECTED.getValue())))
.orElseThrow(() -> new ServiceException("推广位不存在!", HttpStatus.ERROR));
return advertRound.getRejectReason();
}
/**
* redis广 12:05:00
* 5.1 - 5.3

View File

@ -23,6 +23,7 @@ import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -286,10 +287,23 @@ public class ShoppingCartServiceImpl implements IShoppingCartService {
.in(ShoppingCartDetail::getShoppingCartId, shoppingCartList.stream().map(ShoppingCart::getId).collect(Collectors.toList()))
.eq(ShoppingCartDetail::getDelFlag, Constants.UNDELETED));
Map<Long, List<ShoppingCartDetail>> detailMap = detailList.stream().collect(Collectors.groupingBy(ShoppingCartDetail::getShoppingCartId));
return shoppingCartList.stream().map(x -> BeanUtil.toBean(x, ShoppingCartDTO.class)
.setStoreName(ObjectUtils.isNotEmpty(storeMap.get(x.getStoreId())) ? storeMap.get(x.getStoreId()).getStoreName() : "")
.setDetailList(BeanUtil.copyToList(detailMap.get(x.getId()), ShoppingCartDTO.SCDetailDTO.class)))
.collect(Collectors.toList());
// 获取明细商品的价格
List<StoreProductColorPrice> priceList = this.prodColorPriceMapper.selectList(new LambdaQueryWrapper<StoreProductColorPrice>()
.in(StoreProductColorPrice::getStoreProdId, shoppingCartList.stream().map(ShoppingCart::getStoreProdId).collect(Collectors.toList()))
.in(StoreProductColorPrice::getStoreColorId, detailList.stream().map(ShoppingCartDetail::getStoreColorId).collect(Collectors.toList()))
.eq(StoreProductColorPrice::getDelFlag, Constants.UNDELETED));
// 商品价格map
Map<String, BigDecimal> priceMap = priceList.stream().collect(Collectors
.toMap(x -> x.getStoreProdId().toString() + x.getStoreColorId().toString(), x -> ObjectUtils.defaultIfNull(x.getPrice(), BigDecimal.ZERO)));
return shoppingCartList.stream().map(x -> {
ShoppingCartDTO shopCartDTO = BeanUtil.toBean(x, ShoppingCartDTO.class)
.setStoreName(ObjectUtils.isNotEmpty(storeMap.get(x.getStoreId())) ? storeMap.get(x.getStoreId()).getStoreName() : "");
List<ShoppingCartDTO.SCDetailDTO> shopCartDetailList = detailMap.get(x.getId()).stream().map(detail -> {
final BigDecimal price = ObjectUtils.defaultIfNull(priceMap.get(x.getStoreProdId().toString() + detail.getStoreColorId().toString()), BigDecimal.ZERO);
return BeanUtil.toBean(detail, ShoppingCartDTO.SCDetailDTO.class).setPrice(price).setAmount(price.multiply(BigDecimal.valueOf(detail.getQuantity())));
}).collect(Collectors.toList());
return shopCartDTO.setDetailList(shopCartDetailList);
}).collect(Collectors.toList());
}
/**

View File

@ -67,6 +67,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectAdminAdvertPage" parameterType="com.ruoyi.xkt.dto.adminAdvertRound.AdminAdRoundPageDTO" resultType="com.ruoyi.xkt.dto.adminAdvertRound.AdminAdRoundPageResDTO">
SELECT
ar.id AS advertRoundId,
s.id AS storeId,
s.store_name,
a.platform_id,
ar.type_id,
@ -95,7 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="roundId != null "> and ar.round_id = #{roundId}</if>
<if test="sysIntercept != null "> and ar.sys_intercept = #{sysIntercept}</if>
ORDER BY
ar.start_time
ar.advert_id
</select>