Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package cn.ysk.cashier.mybatis.entity;
|
package cn.ysk.cashier.mybatis.entity;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
@@ -31,9 +32,9 @@ public class TbActivateInRecord extends Model<TbActivateInRecord> {
|
|||||||
//商品id
|
//商品id
|
||||||
private Integer proId;
|
private Integer proId;
|
||||||
//满多少金额
|
//满多少金额
|
||||||
private Integer fullAmount;
|
private BigDecimal fullAmount;
|
||||||
//减多少金额
|
//减多少金额
|
||||||
private Integer discountAmount;
|
private BigDecimal discountAmount;
|
||||||
//赠送数量
|
//赠送数量
|
||||||
private Integer num;
|
private Integer num;
|
||||||
//未使用数量
|
//未使用数量
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package cn.ysk.cashier.mybatis.entity;
|
package cn.ysk.cashier.mybatis.entity;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@@ -26,9 +27,9 @@ public class TbShopCoupon extends Model<TbShopCoupon> {
|
|||||||
//1-满减 2-商品
|
//1-满减 2-商品
|
||||||
private Integer type;
|
private Integer type;
|
||||||
//满多少金额
|
//满多少金额
|
||||||
private Integer fullAmount;
|
private BigDecimal fullAmount;
|
||||||
//减多少金额
|
//减多少金额
|
||||||
private Integer discountAmount;
|
private BigDecimal discountAmount;
|
||||||
//描述
|
//描述
|
||||||
private String description;
|
private String description;
|
||||||
//发放数量
|
//发放数量
|
||||||
@@ -98,19 +99,19 @@ public class TbShopCoupon extends Model<TbShopCoupon> {
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getFullAmount() {
|
public BigDecimal getFullAmount() {
|
||||||
return fullAmount;
|
return fullAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFullAmount(Integer fullAmount) {
|
public void setFullAmount(BigDecimal fullAmount) {
|
||||||
this.fullAmount = fullAmount;
|
this.fullAmount = fullAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getDiscountAmount() {
|
public BigDecimal getDiscountAmount() {
|
||||||
return discountAmount;
|
return discountAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDiscountAmount(Integer discountAmount) {
|
public void setDiscountAmount(BigDecimal discountAmount) {
|
||||||
this.discountAmount = discountAmount;
|
this.discountAmount = discountAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ public class TbShopCouponServiceImpl extends ServiceImpl<TbShopCouponMapper, TbS
|
|||||||
@Override
|
@Override
|
||||||
public boolean update(TbShopCouponVo param) {
|
public boolean update(TbShopCouponVo param) {
|
||||||
if (param.getId() == null) {
|
if (param.getId() == null) {
|
||||||
|
param.setLeftNumber(param.getNumber());
|
||||||
tbShopCouponmapper.insert(param);
|
tbShopCouponmapper.insert(param);
|
||||||
} else {
|
} else {
|
||||||
tbShopCouponmapper.updateById(param);
|
tbShopCouponmapper.updateById(param);
|
||||||
@@ -198,7 +199,7 @@ public class TbShopCouponServiceImpl extends ServiceImpl<TbShopCouponMapper, TbS
|
|||||||
TbShopCoupon tbShopCoupon = getById(tbUserCouponVo.getCouponId());
|
TbShopCoupon tbShopCoupon = getById(tbUserCouponVo.getCouponId());
|
||||||
StringBuilder useRestrictions = new StringBuilder("每天 ");
|
StringBuilder useRestrictions = new StringBuilder("每天 ");
|
||||||
if (tbShopCoupon.getType().equals(1)) {
|
if (tbShopCoupon.getType().equals(1)) {
|
||||||
if (amount.compareTo(new BigDecimal(tbShopCoupon.getFullAmount())) < 0) {
|
if (amount.compareTo(tbShopCoupon.getFullAmount()) < 0) {
|
||||||
isUse = false;
|
isUse = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -254,7 +255,7 @@ public class TbShopCouponServiceImpl extends ServiceImpl<TbShopCouponMapper, TbS
|
|||||||
TbShopCoupon tbShopCoupon = tbShopCouponmapper.selectById(tbUserCouponVo.getCouponId());
|
TbShopCoupon tbShopCoupon = tbShopCouponmapper.selectById(tbUserCouponVo.getCouponId());
|
||||||
StringBuilder useRestrictions = new StringBuilder("每天 ");
|
StringBuilder useRestrictions = new StringBuilder("每天 ");
|
||||||
if (tbShopCoupon.getType().equals(1)) {
|
if (tbShopCoupon.getType().equals(1)) {
|
||||||
if (tbOrderInfo.getOrderAmount().compareTo(new BigDecimal(tbShopCoupon.getFullAmount())) < 0) {
|
if (tbOrderInfo.getOrderAmount().compareTo(tbShopCoupon.getFullAmount()) < 0) {
|
||||||
isUse = false;
|
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)
|
@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);
|
TbProduct selectBySkuId(@Param("skuId") Integer skuId);
|
||||||
|
|
||||||
|
@Modifying
|
||||||
|
@Query("update TbProduct set isGrounding=0 where id=:id")
|
||||||
|
void upGrounding(@Param("id") Integer id);
|
||||||
|
|
||||||
@Modifying
|
@Modifying
|
||||||
@Query("update TbProduct set lowPrice=:lowPrice where id=:id")
|
@Query("update TbProduct set lowPrice=:lowPrice where id=:id")
|
||||||
void upLowPrice(@Param("id") Integer id, @Param("lowPrice") BigDecimal lowPrice);
|
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)
|
@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);
|
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
|
@Modifying
|
||||||
@Query("update FROM TbProductSku sku set sku.costPrice=:cost WHERE sku.productId=:productId")
|
@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());
|
sqlQuery.append(" set is_grounding = ").append(updateValueVO.getValue());
|
||||||
wxMsgUtils.aboardOperationMsg(("1".equals(updateValueVO.getValue()) ? "上架: " : "下架: ") + description, Integer.valueOf(product.getShopId()));
|
wxMsgUtils.aboardOperationMsg(("1".equals(updateValueVO.getValue()) ? "上架: " : "下架: ") + description, Integer.valueOf(product.getShopId()));
|
||||||
description.append("0".equals(updateValueVO.getValue()) ? "已下架" : "已上架");
|
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;
|
break;
|
||||||
case "salePrice"://价格
|
case "salePrice"://价格
|
||||||
description.append("修改价格为").append(updateValueVO.getValue());
|
description.append("修改价格为").append(updateValueVO.getValue());
|
||||||
|
|||||||
@@ -1751,7 +1751,7 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
|||||||
|
|
||||||
// 设置优惠券信息
|
// 设置优惠券信息
|
||||||
orderInfo.setCouponInfoList(JSONObject.toJSONString(activateInInfoVOS));
|
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));
|
// record.setCouponInfo(JSONObject.toJSONString(userCouponList));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user