Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
9c5b5882e3
|
|
@ -1,5 +1,6 @@
|
|||
package cn.ysk.cashier.mybatis.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
|
|
@ -31,9 +32,9 @@ public class TbActivateInRecord extends Model<TbActivateInRecord> {
|
|||
//商品id
|
||||
private Integer proId;
|
||||
//满多少金额
|
||||
private Integer fullAmount;
|
||||
private BigDecimal fullAmount;
|
||||
//减多少金额
|
||||
private Integer discountAmount;
|
||||
private BigDecimal discountAmount;
|
||||
//赠送数量
|
||||
private Integer num;
|
||||
//未使用数量
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package cn.ysk.cashier.mybatis.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalTime;
|
||||
import java.util.Date;
|
||||
|
||||
|
|
@ -26,9 +27,9 @@ public class TbShopCoupon extends Model<TbShopCoupon> {
|
|||
//1-满减 2-商品
|
||||
private Integer type;
|
||||
//满多少金额
|
||||
private Integer fullAmount;
|
||||
private BigDecimal fullAmount;
|
||||
//减多少金额
|
||||
private Integer discountAmount;
|
||||
private BigDecimal discountAmount;
|
||||
//描述
|
||||
private String description;
|
||||
//发放数量
|
||||
|
|
@ -98,19 +99,19 @@ public class TbShopCoupon extends Model<TbShopCoupon> {
|
|||
this.type = type;
|
||||
}
|
||||
|
||||
public Integer getFullAmount() {
|
||||
public BigDecimal getFullAmount() {
|
||||
return fullAmount;
|
||||
}
|
||||
|
||||
public void setFullAmount(Integer fullAmount) {
|
||||
public void setFullAmount(BigDecimal fullAmount) {
|
||||
this.fullAmount = fullAmount;
|
||||
}
|
||||
|
||||
public Integer getDiscountAmount() {
|
||||
public BigDecimal getDiscountAmount() {
|
||||
return discountAmount;
|
||||
}
|
||||
|
||||
public void setDiscountAmount(Integer discountAmount) {
|
||||
public void setDiscountAmount(BigDecimal discountAmount) {
|
||||
this.discountAmount = discountAmount;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@ public class TbShopCouponServiceImpl extends ServiceImpl<TbShopCouponMapper, TbS
|
|||
@Override
|
||||
public boolean update(TbShopCouponVo param) {
|
||||
if (param.getId() == null) {
|
||||
param.setLeftNumber(param.getNumber());
|
||||
tbShopCouponmapper.insert(param);
|
||||
} else {
|
||||
tbShopCouponmapper.updateById(param);
|
||||
|
|
@ -198,7 +199,7 @@ public class TbShopCouponServiceImpl extends ServiceImpl<TbShopCouponMapper, TbS
|
|||
TbShopCoupon tbShopCoupon = getById(tbUserCouponVo.getCouponId());
|
||||
StringBuilder useRestrictions = new StringBuilder("每天 ");
|
||||
if (tbShopCoupon.getType().equals(1)) {
|
||||
if (amount.compareTo(new BigDecimal(tbShopCoupon.getFullAmount())) < 0) {
|
||||
if (amount.compareTo(tbShopCoupon.getFullAmount()) < 0) {
|
||||
isUse = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -254,7 +255,7 @@ public class TbShopCouponServiceImpl extends ServiceImpl<TbShopCouponMapper, TbS
|
|||
TbShopCoupon tbShopCoupon = tbShopCouponmapper.selectById(tbUserCouponVo.getCouponId());
|
||||
StringBuilder useRestrictions = new StringBuilder("每天 ");
|
||||
if (tbShopCoupon.getType().equals(1)) {
|
||||
if (tbOrderInfo.getOrderAmount().compareTo(new BigDecimal(tbShopCoupon.getFullAmount())) < 0) {
|
||||
if (tbOrderInfo.getOrderAmount().compareTo(tbShopCoupon.getFullAmount()) < 0) {
|
||||
isUse = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,6 +53,10 @@ public interface TbProductRepository extends JpaRepository<TbProduct, Integer>,
|
|||
@Query(value = "select b.* from tb_product_sku as a left join tb_product as b on a.product_id=b.id where a.id=:skuId", nativeQuery = true)
|
||||
TbProduct selectBySkuId(@Param("skuId") Integer skuId);
|
||||
|
||||
@Modifying
|
||||
@Query("update TbProduct set isGrounding=0 where id=:id")
|
||||
void upGrounding(@Param("id") Integer id);
|
||||
|
||||
@Modifying
|
||||
@Query("update TbProduct set lowPrice=:lowPrice where id=:id")
|
||||
void upLowPrice(@Param("id") Integer id, @Param("lowPrice") BigDecimal lowPrice);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Inte
|
|||
@Query(value = "SELECT min(sale_price) from tb_product_sku where product_id = ?1 and id != ?2", nativeQuery = true)
|
||||
BigDecimal searchMinSalePrice(@Param("productId") Integer productId, @Param("skuId") Integer skuId);
|
||||
|
||||
@Query(value = "SELECT count(1) from tb_product_sku where product_id = ?1 and is_grounding = 1 and id != ?2", nativeQuery = true)
|
||||
int countGrounding(@Param("productId") Integer productId, @Param("skuId") Integer skuId);
|
||||
|
||||
|
||||
@Modifying
|
||||
@Query("update FROM TbProductSku sku set sku.costPrice=:cost WHERE sku.productId=:productId")
|
||||
|
|
|
|||
|
|
@ -194,6 +194,12 @@ public class StockServiceImpl implements StockService {
|
|||
sqlQuery.append(" set is_grounding = ").append(updateValueVO.getValue());
|
||||
wxMsgUtils.aboardOperationMsg(("1".equals(updateValueVO.getValue()) ? "上架: " : "下架: ") + description, Integer.valueOf(product.getShopId()));
|
||||
description.append("0".equals(updateValueVO.getValue()) ? "已下架" : "已上架");
|
||||
if("0".equals(updateValueVO.getValue())){
|
||||
int i = tbProductSkuRepository.countGrounding(product.getId(), tbProductSku.getId());
|
||||
if (i == 0) {
|
||||
tbProductRepository.upGrounding(product.getId());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "salePrice"://价格
|
||||
description.append("修改价格为").append(updateValueVO.getValue());
|
||||
|
|
|
|||
|
|
@ -1751,7 +1751,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||
|
||||
// 设置优惠券信息
|
||||
orderInfo.setCouponInfoList(JSONObject.toJSONString(activateInInfoVOS));
|
||||
orderInfo.setUserCouponAmount(BigDecimal.valueOf(tbShopCoupons.stream().map(TbShopCoupon::getDiscountAmount).reduce(0, Integer::sum)));
|
||||
orderInfo.setUserCouponAmount(tbShopCoupons.stream().map(TbShopCoupon::getDiscountAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||
// record.setCouponInfo(JSONObject.toJSONString(userCouponList));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue