This commit is contained in:
jiask 2025-09-22 12:19:51 +08:00
parent cbcf51b576
commit be5c5a8b86
4 changed files with 14 additions and 7 deletions

View File

@ -93,11 +93,11 @@ public class CookMaterial extends BaseEntity {
/** 销售价 */
@ApiModelProperty(value = "销售价")
private Long salePrice;
private BigDecimal salePrice;
/** 进价 */
@ApiModelProperty(value = "进价")
private Long unitPrice;
private BigDecimal unitPrice;
/** 售卖类型(1计量2散称) */
@ApiModelProperty(value = "售卖类型(1计量2散称)")

View File

@ -1,5 +1,6 @@
package com.bonus.canteen.core.cook.service.impl;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;
@ -96,8 +97,8 @@ public class CookMaterialServiceImpl implements ICookMaterialService {
String name = cookMaterial.getGoodsType() == 1 ? "原料" : "商品";
throw new ServiceException("" + name + "名称已存在");
}
cookMaterial.setSalePrice(Objects.isNull(cookMaterial.getSalePrice()) ? 0L : cookMaterial.getSalePrice() * 100);
cookMaterial.setUnitPrice(Objects.isNull(cookMaterial.getUnitPrice()) ? 0L : cookMaterial.getUnitPrice() * 100);
cookMaterial.setSalePrice(Objects.isNull(cookMaterial.getSalePrice()) ? new BigDecimal("0") : cookMaterial.getSalePrice().multiply(new BigDecimal("100")) );
cookMaterial.setUnitPrice(Objects.isNull(cookMaterial.getUnitPrice()) ? new BigDecimal("0") : cookMaterial.getUnitPrice() .multiply(new BigDecimal("100")) );
return cookMaterialMapper.insertCookMaterial(cookMaterial);
} catch (Exception e) {
throw new ServiceException(e.getMessage());
@ -137,8 +138,8 @@ public class CookMaterialServiceImpl implements ICookMaterialService {
String name = cookMaterial.getGoodsType() == 1 ? "原料" : "商品";
throw new ServiceException("" + name + "名称已存在");
}
cookMaterial.setSalePrice(Objects.isNull(cookMaterial.getSalePrice()) ? 0L : cookMaterial.getSalePrice() * 100);
cookMaterial.setUnitPrice(Objects.isNull(cookMaterial.getUnitPrice()) ? 0L : cookMaterial.getUnitPrice() * 100);
cookMaterial.setSalePrice(Objects.isNull(cookMaterial.getSalePrice()) ? new BigDecimal("0") : cookMaterial.getSalePrice().multiply(new BigDecimal("100")) );
cookMaterial.setUnitPrice(Objects.isNull(cookMaterial.getUnitPrice()) ? new BigDecimal("0") : cookMaterial.getUnitPrice() .multiply(new BigDecimal("100")) );
return cookMaterialMapper.updateCookMaterial(cookMaterial);
} catch (Exception e) {
throw new ServiceException(e.getMessage());

View File

@ -157,6 +157,7 @@ public class InquiryServiceImpl implements IInquiryService {
}
return inquiry;
} catch (Exception e) {
e.printStackTrace();
throw new ServiceException(e.getMessage());
}
}

View File

@ -111,6 +111,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="size != null and size != ''"> and cm.size = #{size}</if>
<if test="description != null and description != ''"> and cm.description = #{description}</if>
</where>
group by material_id
order by cm.create_time desc
</select>
@ -140,7 +141,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="checkIsUse" resultType="java.lang.Integer">
select count(1) from cook_dishes_material
select count(1) from (
select material_id from cook_dishes_material
union
select material_id from ims_inventory where del_flag='0'
) a
<where>
material_id in
<foreach item="materialId" collection="materialIds" open="(" separator="," close=")">