精简不必要的代码

This commit is contained in:
OPGame
2019-08-26 20:53:28 +08:00
parent dfe2d29351
commit 586feac3fe
12 changed files with 0 additions and 363 deletions

View File

@@ -128,18 +128,6 @@ public class ProdController {
return ResponseEntity.ok(productDtoList);
}
@GetMapping("/discountProds")
@ApiOperation(value = "根据活动id获取活动商品列表", notes = "根据活动id获取活动商品列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "discountId", value = "活动id", required = true, dataType = "Long"),
})
public ResponseEntity<IPage<ProductDto>> getDiscountProds(
@RequestParam(value = "discountId", required = true) Long discountId,
PageParam<ProductDto> page) {
IPage<ProductDto> productDtoList = prodService.pageByDiscountId(page, discountId);
return ResponseEntity.ok(productDtoList);
}
}

View File

@@ -221,12 +221,6 @@ public class ShopCartController {
for (ShopCartItemDiscountDto shopCartItemDiscount : shopCartItemDiscounts) {
List<ShopCartItemDto> shopCartItems = shopCartItemDiscount.getShopCartItems();
ChooseDiscountItemDto chooseDiscountItemDto = shopCartItemDiscount.getChooseDiscountItemDto();
// 如果满足优惠活动
if (chooseDiscountItemDto != null && chooseDiscountItemDto.getNeedAmount() <= chooseDiscountItemDto.getProdsPrice()) {
reduce = Arith.add(reduce, chooseDiscountItemDto.getReduceAmount());
}
for (ShopCartItemDto shopCartItem : shopCartItems) {
count = shopCartItem.getProdCount() + count;

View File

@@ -10,9 +10,6 @@
package com.yami.shop.bean.app.dto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data;
import java.io.Serializable;
@@ -23,32 +20,6 @@ import java.io.Serializable;
@Data
public class ChooseDiscountItemDto implements Serializable {
@ApiModelProperty("满减满折优惠id")
private Long discountId;
@ApiModelProperty("优惠规则(0:满钱减钱 1:满件减钱 2:满钱打折 3:满件打折)")
private Integer discountRule;
@ApiModelProperty(value = "优惠项id")
@JsonIgnore
private Long discountItemId;
@ApiModelProperty(value = "所需需要金额")
private Double needAmount;
@ApiModelProperty(value = "减免类型 0按满足最高层级减一次 1每满一次减一次")
private Integer discountType;
@ApiModelProperty(value = "参与满减满折优惠的商品数量")
private int prodCount = 0;
@ApiModelProperty(value = "参与满减满折优惠的商品金额")
private double prodsPrice = 0.00;
@ApiModelProperty(value = "优惠(元/折)")
private Double discount;
@ApiModelProperty(value = "参与满减满折优惠的金额")
private Double reduceAmount = 0.0;
}

View File

@@ -1,106 +0,0 @@
/*
* Copyright (c) 2018-2999 广州亚米信息科技有限公司 All rights reserved.
*
* https://www.gz-yami.com/
*
* 未经允许,不可做商业用途!
*
* 版权所有,侵权必究!
*/
package com.yami.shop.bean.app.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yami.shop.common.serializer.json.ImgJsonSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@Data
@ApiModel("优惠券对象")
public class CouponDto implements Serializable {
@ApiModelProperty(value = "优惠券id")
private Long couponId;
@ApiModelProperty(value = "店铺ID")
private Long shopId;
@ApiModelProperty(value = "店铺名称")
private String shopName;
@ApiModelProperty(value = "优惠券名称")
private String couponName;
@ApiModelProperty(value = "副标题")
private String subTitle;
@ApiModelProperty(value = "优惠类型 1:代金券 2:折扣券 3:兑换券")
private Integer couponType;
@ApiModelProperty(value = "使用条件")
private Double cashCondition;
@ApiModelProperty(value = "减免金额")
private Double reduceAmount;
@ApiModelProperty(value = "折扣额度")
private Double couponDiscount;
@ApiModelProperty(value = "生效时间 1:固定时间 2:领取后生效")
private Integer validTimeType;
@ApiModelProperty(value = "开始时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date startTime;
@ApiModelProperty(value = "结束时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date endTime;
@ApiModelProperty(value = "领券后X天起生效")
private Integer afterReceiveDays;
@ApiModelProperty(value = "有效天数")
private Integer validDays;
@ApiModelProperty(value = "库存")
private Integer stocks;
@ApiModelProperty(value = "适用商品类型 0全部商品参与 1指定商品参与 2指定商品不参与")
private Integer suitableProdType;
@ApiModelProperty(value = "指定商品图片")
@JsonSerialize(using = ImgJsonSerializer.class)
private String pic;
@ApiModelProperty(value = "指定商品id")
private Long prodId;
@ApiModelProperty(value = "指定商品价格")
private Double price;
@ApiModelProperty(value = "每个用户领券上限")
private Integer limitNum;
@ApiModelProperty(value = "优惠券过期状态 0:过期 1:未过期")
private Integer overdueStatus;
@ApiModelProperty(value = "优惠券投放状态 0:未投放 1:投放")
private Integer putonStatus;
@ApiModelProperty(value = "用户优惠券id")
private Long couponUserId;
@ApiModelProperty(value = "领券时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date receiveTime;
}

View File

@@ -22,67 +22,4 @@ import java.util.List;
@Data
public class CouponOrderDto implements Serializable {
@ApiModelProperty(value = "优惠券id")
private Long couponId;
@ApiModelProperty(value = "店铺ID")
private Long shopId;
@ApiModelProperty(value = "优惠券名称")
private String couponName;
@ApiModelProperty(value = "副标题")
private String subTitle;
@ApiModelProperty(value = "优惠类型 1:代金券 2:折扣券 3:兑换券")
private Integer couponType;
@ApiModelProperty(value = "使用条件")
private Double cashCondition;
@ApiModelProperty(value = "减免金额")
private Double reduceAmount;
@ApiModelProperty(value = "折扣")
private Double couponDiscount;
@ApiModelProperty(value = "开始时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date startTime;
@ApiModelProperty(value = "结束时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date endTime;
@ApiModelProperty(value = "适用商品类型 0全部商品参与 1指定商品参与 2指定商品不参与")
private Integer suitableProdType;
@ApiModelProperty(value = "指定的商品id")
private List<Long> prodIds;
@ApiModelProperty(value = "选中的商品id")
private List<Long> chooseProdIds = new ArrayList<>();
@ApiModelProperty(value = "是否选中")
private boolean isChoose;
@ApiModelProperty(value = "是否可用")
private boolean canUse;
@ApiModelProperty(value = "用户优惠券id")
private Long couponUserId;
@ApiModelProperty(value = "生效时间 1:固定时间 2:领取后生效")
private Integer validTimeType;
@ApiModelProperty(value = "领券后X天起生效")
private Integer afterReceiveDays;
@ApiModelProperty(value = "有效天数")
private Integer validDays;
@ApiModelProperty(value = "领券时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date receiveTime;
}

View File

@@ -10,43 +10,12 @@
package com.yami.shop.bean.app.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@Data
public class DiscountDto implements Serializable {
@ApiModelProperty("满减满折优惠id")
private Long discountId;
@ApiModelProperty("店铺ID")
private Long shopId;
@ApiModelProperty("活动名称")
private String discountName;
@ApiModelProperty("优惠规则(0:满钱减钱 1:满件减钱 2:满钱打折 3:满件打折)")
private Integer discountRule;
@ApiModelProperty("减免类型(0:按满足最高层级减一次 1:每满一次减一次)")
private Integer discountType;
@ApiModelProperty("适用商品类型(0:通用券 1:商品券)")
private Integer suitableProdType;
@ApiModelProperty("最多减多少")
private Double maxReduceAmount;
@ApiModelProperty("开始时间")
private Date startTime;
@ApiModelProperty("结束时间")
private Date endTime;
private List<DiscountItemDto> discountItems;
}

View File

@@ -1,32 +0,0 @@
/*
* Copyright (c) 2018-2999 广州亚米信息科技有限公司 All rights reserved.
*
* https://www.gz-yami.com/
*
* 未经允许,不可做商业用途!
*
* 版权所有,侵权必究!
*/
package com.yami.shop.bean.app.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
public class DiscountItemDto implements Serializable {
@ApiModelProperty(value = "优惠项id")
private Long discountItemId;
@ApiModelProperty(value = "优惠活动id")
private Long discountId;
@ApiModelProperty(value = "所需需要金额")
private Double needAmount;
@ApiModelProperty(value = "优惠(元/折)")
private Double discount;
}

View File

@@ -1,67 +0,0 @@
/*
* Copyright (c) 2018-2999 广州亚米信息科技有限公司 All rights reserved.
*
* https://www.gz-yami.com/
*
* 未经允许,不可做商业用途!
*
* 版权所有,侵权必究!
*/
package com.yami.shop.bean.app.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yami.shop.common.serializer.json.ImgJsonSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("商品优惠券对象")
@Data
public class ProdCouponDto {
@ApiModelProperty(value = "商品id")
private Long prodId;
@ApiModelProperty(value = "店铺id")
private Long shopId;
@ApiModelProperty(value = "商品名称")
private String prodName;
@ApiModelProperty(value = "原价")
private Double oriPrice;
@ApiModelProperty(value = "现价")
private Double price;
@ApiModelProperty(value = "商品主图")
@JsonSerialize(using = ImgJsonSerializer.class)
private String pic;
@ApiModelProperty(value = "优惠券ID")
private Long couponId;
@ApiModelProperty(value = "优惠券名称")
private String couponName;
@ApiModelProperty(value = "副标题")
private String subTitle;
@ApiModelProperty(value = " 优惠类型 1:代金券 2:折扣券 3:兑换券")
private Integer couponType;
@ApiModelProperty(value = "使用条件金额")
private Double cashCondition;
@ApiModelProperty(value = "减免金额")
private Double reduceAmount;
@ApiModelProperty(value = "折扣额度")
private Double couponDiscount;
@ApiModelProperty(value = "库存")
private Integer stocks;
}

View File

@@ -49,8 +49,6 @@ public interface ProductMapper extends BaseMapper<Product> {
List<TagProductDto> tagProdList();
IPage<ProductDto> pageByDiscountId(Page<ProductDto> page, @Param("discountId") Long discountId);
/**
* 查看店铺的所有活动商品
*/

View File

@@ -67,7 +67,5 @@ public interface ProductService extends IService<Product> {
List<TagProductDto> tagProdList();
IPage<ProductDto> pageByDiscountId(Page<ProductDto> page, Long discountId);
IPage<ProductDto> collectionProds(PageParam page, String userId);
}

View File

@@ -203,11 +203,6 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
return productMapper.tagProdList();
}
@Override
public IPage<ProductDto> pageByDiscountId(Page<ProductDto> page, Long discountId) {
return productMapper.pageByDiscountId(page, discountId);
}
@Override
public IPage<ProductDto> collectionProds(PageParam page, String userId) {
return productMapper.collectionProds(page, userId);

View File

@@ -157,14 +157,6 @@
ORDER BY pt.`seq` DESC
</select>
<select id="pageByDiscountId" resultType="com.yami.shop.bean.app.dto.ProductDto">
SELECT p.*,sd.`shop_name`
FROM tz_discount_prod dp
LEFT JOIN tz_prod p ON dp.prod_id = p.prod_id
LEFT JOIN tz_shop_detail sd ON p.shop_id = sd.shop_id
WHERE p.status= 1 AND dp.discount_id = #{discountId}
</select>
<select id="getSearchProdDtoPageByProdName" resultType="com.yami.shop.bean.dto.SearchProdDto">
select
p.prod_id,