菜谱单价小数不能上传问题修复
This commit is contained in:
parent
0fcd6e8ae6
commit
93fc09371a
|
|
@ -6,9 +6,11 @@ import lombok.Data;
|
|||
import lombok.ToString;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 菜品计划菜品关联对象 cook_recipe_dishes
|
||||
*
|
||||
*
|
||||
* @author xsheng
|
||||
* @date 2025-05-25
|
||||
*/
|
||||
|
|
@ -35,12 +37,12 @@ public class CookRecipeDishes extends BaseEntity {
|
|||
/** 菜品单价 */
|
||||
@Excel(name = "菜品单价")
|
||||
@ApiModelProperty(value = "菜品单价")
|
||||
private Long price;
|
||||
private BigDecimal price;
|
||||
|
||||
/** 菜品售价(优惠价) */
|
||||
@Excel(name = "菜品售价(优惠价)")
|
||||
@ApiModelProperty(value = "菜品售价(优惠价)")
|
||||
private Long salePrice;
|
||||
private BigDecimal salePrice;
|
||||
|
||||
/** 规格类型(1-标准,2-大份,3-小份,4-50g,5-100g) */
|
||||
@Excel(name = "规格类型(1-标准,2-大份,3-小份,4-50g,5-100g)")
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import lombok.Data;
|
|||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 菜品计划菜品关联对象 cook_recipe_dishes
|
||||
|
|
@ -38,13 +39,13 @@ public class CookRecipeDishesDTO extends BaseEntity {
|
|||
@Excel(name = "菜品单价")
|
||||
@ApiModelProperty(value = "菜品单价")
|
||||
@Max(value = 99999L, message = "菜品单价超过限制")
|
||||
private Long price;
|
||||
private BigDecimal price;
|
||||
|
||||
/** 菜品售价(优惠价) */
|
||||
@Excel(name = "菜品售价(优惠价)")
|
||||
@ApiModelProperty(value = "菜品售价(优惠价)")
|
||||
@Max(value = 9999L, message = "菜品售价超过限制")
|
||||
private Long salePrice;
|
||||
private BigDecimal salePrice;
|
||||
|
||||
/** 规格类型(1-标准,2-大份,3-小份,4-50g,5-100g) */
|
||||
@Excel(name = "规格类型(1-标准,2-大份,3-小份,4-50g,5-100g)")
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.bonus.canteen.core.cook.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
|
@ -349,8 +351,8 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
|
|||
long supplyNum = Objects.isNull(cookRecipeDishes.getSupplyNum()) ? 9999 : cookRecipeDishes.getSupplyNum();
|
||||
long limitNum = Objects.isNull(cookRecipeDishes.getLimitNum()) ? 9999 : cookRecipeDishes.getLimitNum();
|
||||
long saleNum = Objects.isNull(cookRecipeDishes.getSaleNum()) ? 0 : cookRecipeDishes.getSaleNum();
|
||||
cookRecipeDishes.setPrice(Objects.isNull(cookRecipeDishes.getPrice()) ? 0 : cookRecipeDishes.getPrice() * 100); //元转分
|
||||
cookRecipeDishes.setSalePrice(Objects.isNull(cookRecipeDishes.getSalePrice()) ? 0 :cookRecipeDishes.getSalePrice() * 100); //元转分
|
||||
cookRecipeDishes.setPrice(Objects.isNull(cookRecipeDishes.getPrice()) ? new BigDecimal(BigInteger.ZERO) : cookRecipeDishes.getPrice().multiply(new BigDecimal(100))); //元转分
|
||||
cookRecipeDishes.setSalePrice(Objects.isNull(cookRecipeDishes.getSalePrice()) ? new BigDecimal(BigInteger.ZERO) :cookRecipeDishes.getSalePrice().multiply(new BigDecimal(100))); //元转分
|
||||
cookRecipeDishes.setSupplyNum(supplyNum);
|
||||
cookRecipeDishes.setLimitNum(limitNum);
|
||||
cookRecipeDishes.setSaleNum(saleNum);
|
||||
|
|
|
|||
Loading…
Reference in New Issue