订单-下单退单

This commit is contained in:
gaowdong 2025-04-17 16:46:14 +08:00
parent eb1e8a6b39
commit dd8d7f5bd4
8 changed files with 30 additions and 20 deletions

View File

@ -298,7 +298,6 @@ public class AccWalletInfoServiceImpl implements IAccWalletInfoService {
accTradeWalletDetail.setTradeTime(DateUtils.getNowDate());
accTradeWalletDetail.setCreateBy(SecurityUtils.getUsername());
this.accTradeWalletDetailService.insertAccTradeWalletDetail(accTradeWalletDetail);
MqUtil.sendDataChange(sysUser.getUserId(), LeMqConstant.DataChangeType.UPDATE, LeMqConstant.Topic.DEVICE_SYNC_ACCOUNT_BALANCE_V4);
}catch (Exception ex) {
log.error("修改钱包失败", ex);
throw new ServiceException("修改钱包失败");

View File

@ -75,5 +75,8 @@ public class MenuRecipeDishes extends Model<MenuRecipeDishes> {
)
@ApiModelProperty("更新时间")
private LocalDateTime updateTime;
private LocalDateTime saleStart;
private LocalDateTime saleEnd;
private Long chefId;
}

View File

@ -47,7 +47,7 @@ public class OrderBusiness {
public void reduceMenuDishSupplyNum(List<OrderDetail> orderDetailList) {
for(OrderDetail orderDetail : orderDetailList) {
MenuRecipeDishes menuRecipeDishes = new MenuRecipeDishes();
menuRecipeDishes.setDetailId(orderDetail.getDetailId());
menuRecipeDishes.setDetailId(orderDetail.getMenuDetailId());
menuRecipeDishes.setDishesId(orderDetail.getGoodsId());
menuRecipeDishesService.reduceMenuRecipeDishesSupplyNum(menuRecipeDishes, orderDetail.getQuantity());
}

View File

@ -20,6 +20,7 @@ import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
/**
@ -51,7 +52,7 @@ public class OrderInfoController extends BaseController
@PostMapping("/device/list")
@ResponseBody
public TableDataInfo deviceList(OrderQueryParam orderQueryParam)
public TableDataInfo deviceList(@RequestBody @Valid OrderQueryParam orderQueryParam)
{
startPage();
OrderInfo orderInfo = new OrderInfo();
@ -104,7 +105,7 @@ public class OrderInfoController extends BaseController
@SysLog(title = "下单", module = "订单", businessType = OperaType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(OrderAddParam orderAddParam)
public AjaxResult addSave(@RequestBody @Valid OrderAddParam orderAddParam)
{
return toAjax(orderInfoService.insertCanteenOrderInfo(orderAddParam));
}
@ -112,7 +113,7 @@ public class OrderInfoController extends BaseController
@SysLog(title = "下单", module = "订单", businessType = OperaType.INSERT)
@PostMapping("/device/add")
@ResponseBody
public AjaxResult deviceAddSave(DeviceOrderAddParam orderAddParam)
public AjaxResult deviceAddSave(@RequestBody @Valid DeviceOrderAddParam orderAddParam)
{
return toAjax(orderInfoService.insertDeviceOrderInfo(orderAddParam));
}
@ -120,7 +121,7 @@ public class OrderInfoController extends BaseController
@SysLog(title = "下单", module = "订单", businessType = OperaType.INSERT)
@PostMapping("/shop/add")
@ResponseBody
public AjaxResult shopAddSave(ShopOrderAddParam orderAddParam)
public AjaxResult shopAddSave(@RequestBody @Valid ShopOrderAddParam orderAddParam)
{
return toAjax(orderInfoService.insertShopOrderInfo(orderAddParam));
}

View File

@ -226,9 +226,11 @@ public class OrderInfo extends BaseEntity
orderInfo.setPayableAmount(orderInfo.getPayableAmount().add(saleTotalAmount));
orderInfo.setDiscountsAmount(orderInfo.getDiscountsAmount().add(discountTotalAmount));
orderInfo.setRealAmount(orderInfo.getRealAmount().add(orderDetail.getTotalAmount()));
orderInfo.setAccountPayAmount(orderInfo.getRealAmount().add(orderDetail.getTotalAmount()));
orderInfo.setAccountPayAmount(orderInfo.getRealAmount());
}
orderInfo.setOrderDetailList(orderDetailList);
}
orderInfoList.add(orderInfo);
}
}
return orderInfoList;
@ -320,9 +322,11 @@ public class OrderInfo extends BaseEntity
orderInfo.setPayableAmount(orderInfo.getPayableAmount().add(saleTotalAmount));
orderInfo.setDiscountsAmount(orderInfo.getDiscountsAmount().add(discountTotalAmount));
orderInfo.setRealAmount(orderInfo.getRealAmount().add(orderDetail.getTotalAmount()));
orderInfo.setAccountPayAmount(orderInfo.getRealAmount().add(orderDetail.getTotalAmount()));
orderInfo.setAccountPayAmount(orderInfo.getRealAmount());
}
orderInfo.setOrderDetailList(orderDetailList);
}
orderInfoList.add(orderInfo);
}
}
return orderInfoList;

View File

@ -33,6 +33,7 @@ import com.bonus.canteen.core.pay.constants.PayTypeEnum;
import com.bonus.canteen.core.user.domain.DeviceMqPersonalUpdateMessageDTO;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.houqin.constant.SourceTypeEnum;
import com.bonus.common.houqin.mq.constant.LeMqConstant;
import com.bonus.common.houqin.utils.JacksonUtil;
import com.bonus.common.security.utils.SecurityUtils;
@ -204,10 +205,12 @@ public class OrderInfoServiceImpl implements IOrderInfoService
orderPayResultDTO.setUpdateBy(SecurityUtils.getUsername());
orderInfoMapper.updateOrderPayResult(orderPayResultDTO);
try {
DeviceMqPersonalUpdateMessageDTO bean = new DeviceMqPersonalUpdateMessageDTO().setUpdatePerson(Math.toIntExact(orderInfoList.get(0).getUserId()),"update");
String jsonString = JacksonUtil.writeValueAsString(bean);
log.info("账户变动发送mq内容{}", jsonString);
MqUtil.pushToTenantAllDevice(bean, LeMqConstant.Topic.DEVICE_UPDATE_PERSONAL_CONFIG_V4);
if(orderInfoList.get(0).getSourceType().equals(SourceTypeEnum.HT_H5_MOBILE.getKey())) {
DeviceMqPersonalUpdateMessageDTO bean = new DeviceMqPersonalUpdateMessageDTO().setUpdatePerson(Math.toIntExact(orderInfoList.get(0).getUserId()),"update");
String jsonString = JacksonUtil.writeValueAsString(bean);
log.info("账户变动发送mq内容{}", jsonString);
MqUtil.pushToTenantAllDevice(bean, LeMqConstant.Topic.DEVICE_UPDATE_PERSONAL_CONFIG_V4);
}
} catch (Exception e) {
log.error("发送MQ消息失败", e);
}

View File

@ -14,9 +14,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="surplusNum" column="surplus_num" />
<result property="restrictNum" column="restrict_num" />
<result property="salePrice" column="sale_price" />
<!-- <result property="saleStart" column="sale_start" />-->
<!-- <result property="saleEnd" column="sale_end" />-->
<!-- <result property="chefId" column="chef_id" />-->
<result property="saleStart" column="sale_start" />
<result property="saleEnd" column="sale_end" />
<result property="chefId" column="chef_id" />
<result property="recommendFlag" column="recommend_flag" />
<result property="sortNum" column="sort_num" />
<result property="revision" column="revision" />

View File

@ -181,7 +181,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
</insert>
<insert id="batchInsertOrderInfo" parameterType="com.bonus.canteen.core.order.domain.OrderInfo">
<insert id="batchInsertOrderInfo">
insert into order_info (
order_id,
device_order_id,
@ -308,11 +308,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<update id="updateOrderPayResult">
update order_info
update order_info set
pay_time = now(),
<if test="payAmount != null">account_pay_amount = #{param.payAmount},</if>
<if test="payState != null">pay_state = #{param.payState},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{param.updateBy},</if>
<if test="param.payAmount != null">account_pay_amount = #{param.payAmount},</if>
<if test="param.payState != null">pay_state = #{param.payState},</if>
<if test="param.updateBy != null and param.updateBy != ''">update_by = #{param.updateBy},</if>
update_time = now()
where order_id in
<foreach item="orderId" collection="param.orderIdList" open="(" separator="," close=")">