修改发起拼单的逻辑

This commit is contained in:
keivn 2021-12-30 22:29:34 +08:00
parent 4120705ad8
commit 13a333acfa
3 changed files with 32 additions and 6 deletions

View File

@ -93,6 +93,13 @@ public interface POrderMapper
public POrder selectPOrderByOrderNum(String orderNum);
/**
* 更新订单当前的人数和状态
* @param pOrder
* @return
*/
public int updateOrderMemberNumAndSate(POrder pOrder);
/**
* 更新订单当前的人数
* @param pOrder
@ -100,6 +107,8 @@ public interface POrderMapper
*/
public int updateOrderMemberNum(POrder pOrder);
/**
* 通过openID查询订单信息
* @param openId

View File

@ -39,6 +39,7 @@ public class IPCommonServiceImpl implements IPCommonService {
public AjaxResult cancelOrder(CommonVO commonVO) {
String orderNum = commonVO.getOrderNum();
String userId = commonVO.getUserID();
String openID = commonVO.getOpenId();
if (StringUtils.isEmpty(orderNum) && StringUtils.isEmpty(userId) ){
return AjaxResult.error("请求参数错误!");
}
@ -57,10 +58,18 @@ public class IPCommonServiceImpl implements IPCommonService {
POrder pOrder = pOrderMapper.selectPOrderByOrderNum(orderNum);
Integer currnt = pOrder.getMember()-info.get("num");
pOrder.setMember(currnt);
/*更新当前人数表*/
pOrderMapper.updateOrderMemberNum(pOrder);
/*更新订单成员信息表*/
pCommonMapper.updateOrderMenber(commonVO);
/*发起者取消订单*/
if(pOrder!= null && openID.equals(pOrder.getCreaterOpenId())){
/*更新当前人数和状态*/
pOrderMapper.updateOrderMemberNumAndSate(pOrder);
/*更新订单成员信息表*/
pCommonMapper.updateOrderMenber(commonVO);
}else {
/*更新当前人数*/
pOrderMapper.updateOrderMemberNum(pOrder);
/*更新订单成员信息表*/
pCommonMapper.updateOrderMenber(commonVO);
}
return AjaxResult.success();
}
return AjaxResult.error(999 , "请求参数有误");

View File

@ -181,10 +181,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<update id="updateOrderMemberNum" parameterType="POrder" >
update p_order set member = #{member} where order_num = #{orderNum}
<update id="updateOrderMemberNumAndSate" parameterType="POrder" >
update p_order set member = #{member} , state = 2 where order_num = #{orderNum}
</update>
<update id="updateOrderMemberNum" parameterType="POrder" >
update p_order set member = #{member} where order_num = #{orderNum}
</update>
<select id="queryOrderInfoByOpenId" parameterType="String" resultMap="POrderResult" >
<include refid="selectPOrderVo"/>
where