修改发起拼单的逻辑

This commit is contained in:
keivn 2021-12-30 23:03:38 +08:00
parent 13a333acfa
commit fdc226d751
9 changed files with 38 additions and 9 deletions

View File

@ -106,7 +106,6 @@ public class PDriverController extends BaseController
}
/**
* 修改司机信息
*/

View File

@ -102,7 +102,7 @@ public class POrderController extends BaseController
@PostMapping("/takeOrder")
public AjaxResult takeOrder(@RequestBody POrder pOrder)
{
return toAjax(pOrderService.takeOrder(pOrder));
return pOrderService.takeOrder(pOrder);
}
/**
* 修改订单信息

View File

@ -64,7 +64,7 @@ public class PDriver extends BaseEntity
/** 当前状态 */
@Excel(name = "用户当前的状态0审核中1审核通过2禁用")
private Integer state ;
private String state ;
/** 当前状态 */
@Excel(name = "微信openId")
@ -170,11 +170,11 @@ public class PDriver extends BaseEntity
return isBlacklist;
}
public Integer getState() {
public String getState() {
return state;
}
public void setState(Integer state) {
public void setState(String state) {
this.state = state;
}

View File

@ -73,4 +73,11 @@ public interface PPassengerMapper
* @return
*/
public PPassenger selectPPassengerByOpenId(String openId);
/**
* 通过openId更新身份
* @param openId
* @return
*/
public int updatePPassengerApplystate(String openId);
}

View File

@ -82,5 +82,5 @@ public interface IPOrderService
* @param pOrder 订单信息
* @return 结果
*/
public int takeOrder(POrder pOrder);
public AjaxResult takeOrder(POrder pOrder);
}

View File

@ -60,11 +60,13 @@ public class IPCommonServiceImpl implements IPCommonService {
pOrder.setMember(currnt);
/*发起者取消订单*/
if(pOrder!= null && openID.equals(pOrder.getCreaterOpenId())){
logger.info("发起拼单者取消订单");
/*更新当前人数和状态*/
pOrderMapper.updateOrderMemberNumAndSate(pOrder);
/*更新订单成员信息表*/
pCommonMapper.updateOrderMenber(commonVO);
}else {
logger.info("参与拼单者取消订单");
/*更新当前人数*/
pOrderMapper.updateOrderMemberNum(pOrder);
/*更新订单成员信息表*/

View File

@ -1,6 +1,9 @@
package com.ruoyi.carpool.service.impl;
import java.util.List;
import com.ruoyi.carpool.domain.PPassenger;
import com.ruoyi.carpool.mapper.PPassengerMapper;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
@ -22,6 +25,10 @@ public class PDriverServiceImpl implements IPDriverService
@Autowired
private PDriverMapper pDriverMapper;
@Autowired
private PPassengerMapper pPassengerMapper;
/**
* 查询司机信息
*
@ -57,7 +64,7 @@ public class PDriverServiceImpl implements IPDriverService
{
pDriver.setCreateTime(DateUtils.getNowDate());
pDriver.setDriverId("driver_"+ IdUtils.randomUUID());
pDriver.setState(0);
pDriver.setState("0");
pDriver.setIsBlacklist("0");
return pDriverMapper.insertPDriver(pDriver);
}
@ -71,7 +78,13 @@ public class PDriverServiceImpl implements IPDriverService
@Override
public int updatePDriver(PDriver pDriver)
{
if(pDriver.getOpenId() == null) return 0;
pDriver.setUpdateTime(DateUtils.getNowDate());
String state = pDriver.getState();
/*修改状态*/
if("1".equals(state)){
pPassengerMapper.updatePPassengerApplystate(pDriver.getOpenId());
}
return pDriverMapper.updatePDriver(pDriver);
}

View File

@ -181,10 +181,13 @@ public class POrderServiceImpl implements IPOrderService
* @return 结果
*/
@Override
public int takeOrder(POrder pOrder)
public AjaxResult takeOrder(POrder pOrder)
{
pOrder.setIsTake("1");
return pOrderMapper.takeOrderById(pOrder);
pOrderMapper.takeOrderById(pOrder);
return null ;
}

View File

@ -146,5 +146,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<update id="updatePPassengerApplystate" parameterType="String">
update p_passenger set apply_state = 1 where open_id = #{openId}
</update>
</mapper>