Merge branch 'order' into report
This commit is contained in:
commit
1858f252ca
|
|
@ -89,7 +89,8 @@ public class OrderCartController extends BaseController
|
||||||
public AjaxResult editSave(@RequestBody OrderCart orderCart)
|
public AjaxResult editSave(@RequestBody OrderCart orderCart)
|
||||||
{
|
{
|
||||||
OrderCartParamChecker.editCheck(orderCart);
|
OrderCartParamChecker.editCheck(orderCart);
|
||||||
return toAjax(iOrderCartService.updateOrderCart(orderCart));
|
iOrderCartService.updateOrderCart(orderCart);
|
||||||
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -100,9 +101,9 @@ public class OrderCartController extends BaseController
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult remove(@RequestBody OrderCartDelParam param)
|
public AjaxResult remove(@RequestBody OrderCartDelParam param)
|
||||||
{
|
{
|
||||||
if(Objects.isNull(param) || CollUtil.isEmpty(param.getShoppingCartIds())) {
|
if(Objects.isNull(param) || CollUtil.isEmpty(param.getCartIds())) {
|
||||||
throw new ServiceException("购物车餐品ID为空");
|
throw new ServiceException("购物车餐品ID为空");
|
||||||
}
|
}
|
||||||
return toAjax(iOrderCartService.deleteOrderCartByCartIds(param.getShoppingCartIds()));
|
return toAjax(iOrderCartService.deleteOrderCartByCartIds(param.getCartIds()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,7 @@ public class OrderCart extends BaseEntity
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
.append("shoppingCartId", getCartId())
|
.append("cartId", getCartId())
|
||||||
.append("userId", getUserId())
|
.append("userId", getUserId())
|
||||||
.append("menuId", getMenuId())
|
.append("menuId", getMenuId())
|
||||||
.append("canteenId", getCanteenId())
|
.append("canteenId", getCanteenId())
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,6 @@ public class DeviceOrderDetailInfoAddParam {
|
||||||
message = "计算价格不能小于0"
|
message = "计算价格不能小于0"
|
||||||
) BigDecimal finalPrice;
|
) BigDecimal finalPrice;
|
||||||
private Integer salesMode;
|
private Integer salesMode;
|
||||||
private String shoppingCartId;
|
private String cartId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,5 +7,5 @@ import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class OrderCartDelParam extends BaseEntity {
|
public class OrderCartDelParam extends BaseEntity {
|
||||||
private List<Long> shoppingCartIds;
|
private List<Long> cartIds;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,6 @@ public class OrderDetailInfoAddParam {
|
||||||
message = "计算价格不能小于0"
|
message = "计算价格不能小于0"
|
||||||
) BigDecimal finalPrice;
|
) BigDecimal finalPrice;
|
||||||
private Integer salesMode;
|
private Integer salesMode;
|
||||||
private String shoppingCartId;
|
private String cartId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ public class OrderCartVO extends BaseEntity
|
||||||
{
|
{
|
||||||
|
|
||||||
/** 主键 */
|
/** 主键 */
|
||||||
private Long shoppingCartId;
|
private Long cartId;
|
||||||
|
|
||||||
/** 人员id */
|
/** 人员id */
|
||||||
@Excel(name = "人员id")
|
@Excel(name = "人员id")
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ public interface OrderCartMapper
|
||||||
* @param cartId 订单购物车主键
|
* @param cartId 订单购物车主键
|
||||||
* @return 订单购物车
|
* @return 订单购物车
|
||||||
*/
|
*/
|
||||||
public OrderCart selectOrderCartByShoppingCartId(Long cartId);
|
public OrderCart selectOrderCartByCartId(Long cartId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询订单购物车列表
|
* 查询订单购物车列表
|
||||||
|
|
@ -51,7 +51,7 @@ public interface OrderCartMapper
|
||||||
* @param cartId 订单购物车主键
|
* @param cartId 订单购物车主键
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteOrderCartByShoppingCartId(Long cartId);
|
public int deleteOrderCartByCartId(Long cartId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除订单购物车
|
* 批量删除订单购物车
|
||||||
|
|
@ -59,5 +59,5 @@ public interface OrderCartMapper
|
||||||
* @param cartIds 需要删除的数据主键集合
|
* @param cartIds 需要删除的数据主键集合
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteOrderCartByShoppingCartIds(@Param("cartIds") List<Long> cartIds);
|
public int deleteOrderCartByCartIds(@Param("cartIds") List<Long> cartIds);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ public class OrderCartServiceImpl implements IOrderCartService
|
||||||
@Override
|
@Override
|
||||||
public OrderCart selectOrderCartByCartId(Long cartId)
|
public OrderCart selectOrderCartByCartId(Long cartId)
|
||||||
{
|
{
|
||||||
return orderCartMapper.selectOrderCartByShoppingCartId(cartId);
|
return orderCartMapper.selectOrderCartByCartId(cartId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -104,23 +104,23 @@ public class OrderCartServiceImpl implements IOrderCartService
|
||||||
return orderCartVOList;
|
return orderCartVOList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private OrderCartVO convertToOrderCartVO(OrderCart shoppingCart,
|
private OrderCartVO convertToOrderCartVO(OrderCart orderCart,
|
||||||
Map<Long, List<CookRecipeDishesVO>> cookRecipeDishMap) {
|
Map<Long, List<CookRecipeDishesVO>> cookRecipeDishMap) {
|
||||||
OrderCartVO shoppingCartVO = new OrderCartVO();
|
OrderCartVO orderCartVO = new OrderCartVO();
|
||||||
BeanUtils.copyProperties(shoppingCart, shoppingCartVO);
|
BeanUtils.copyProperties(orderCart, orderCartVO);
|
||||||
shoppingCartVO.setIsValid(0);
|
orderCartVO.setIsValid(0);
|
||||||
|
|
||||||
List<CookRecipeDishesVO> cookRecipeDishes = cookRecipeDishMap.get(shoppingCart.getMealtimeType().longValue());
|
List<CookRecipeDishesVO> cookRecipeDishes = cookRecipeDishMap.get(orderCart.getMealtimeType().longValue());
|
||||||
if (CollUtil.isNotEmpty(cookRecipeDishes)) {
|
if (CollUtil.isNotEmpty(cookRecipeDishes)) {
|
||||||
for (CookRecipeDishesVO cookRecipeDishesVO : cookRecipeDishes) {
|
for (CookRecipeDishesVO cookRecipeDishesVO : cookRecipeDishes) {
|
||||||
if (shoppingCart.getGoodsId().equals(cookRecipeDishesVO.getDishesId())) {
|
if (orderCart.getGoodsId().equals(cookRecipeDishesVO.getDishesId())) {
|
||||||
shoppingCartVO.setIsValid(1);
|
orderCartVO.setIsValid(1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return shoppingCartVO;
|
return orderCartVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -165,7 +165,7 @@ public class OrderCartServiceImpl implements IOrderCartService
|
||||||
@Override
|
@Override
|
||||||
public int deleteOrderCartByCartIds(List<Long> cartIds)
|
public int deleteOrderCartByCartIds(List<Long> cartIds)
|
||||||
{
|
{
|
||||||
return orderCartMapper.deleteOrderCartByShoppingCartIds(cartIds);
|
return orderCartMapper.deleteOrderCartByCartIds(cartIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -177,6 +177,6 @@ public class OrderCartServiceImpl implements IOrderCartService
|
||||||
@Override
|
@Override
|
||||||
public int deleteOrderCartByCartId(Long cartId)
|
public int deleteOrderCartByCartId(Long cartId)
|
||||||
{
|
{
|
||||||
return orderCartMapper.deleteOrderCartByShoppingCartId(cartId);
|
return orderCartMapper.deleteOrderCartByCartId(cartId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ public class OrderCartParamChecker {
|
||||||
|
|
||||||
public static void editCheck(OrderCart orderCart) {
|
public static void editCheck(OrderCart orderCart) {
|
||||||
checkOrderShoppingCart(orderCart);
|
checkOrderShoppingCart(orderCart);
|
||||||
checkShoppingCartId(orderCart);
|
checkCartId(orderCart);
|
||||||
checkQuantity(orderCart);
|
checkQuantity(orderCart);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -41,7 +41,7 @@ public class OrderCartParamChecker {
|
||||||
throw new ServiceException("订单购物车对象为空");
|
throw new ServiceException("订单购物车对象为空");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static void checkShoppingCartId(OrderCart orderCart) {
|
private static void checkCartId(OrderCart orderCart) {
|
||||||
if (orderCart.getCartId() == null) {
|
if (orderCart.getCartId() == null) {
|
||||||
throw new ServiceException("购物车ID为空");
|
throw new ServiceException("购物车ID为空");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectOrderCartByShoppingCartId" parameterType="Long" resultMap="OrderCartResult">
|
<select id="selectOrderCartByCartId" parameterType="Long" resultMap="OrderCartResult">
|
||||||
<include refid="selectOrderShoppingCartVo"/>
|
<include refid="selectOrderShoppingCartVo"/>
|
||||||
where cart_id = #{cartId}
|
where cart_id = #{cartId}
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -119,14 +119,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where cart_id = #{cartId}
|
where cart_id = #{cartId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="deleteOrderCartByShoppingCartId" parameterType="Long">
|
<delete id="deleteOrderCartByCartId" parameterType="Long">
|
||||||
delete from order_cart where cart_id = #{cartId}
|
delete from order_cart where cart_id = #{cartId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteOrderCartByShoppingCartIds" parameterType="String">
|
<delete id="deleteOrderCartByCartIds" parameterType="String">
|
||||||
delete from order_cart where cart_id in
|
delete from order_cart where cart_id in
|
||||||
<foreach item="shoppingCartId" collection="cartIds" open="(" separator="," close=")">
|
<foreach item="cartId" collection="cartIds" open="(" separator="," close=")">
|
||||||
#{shoppingCartId}
|
#{cartId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue