代码修改

This commit is contained in:
keivn 2021-12-26 22:15:49 +08:00
parent d54d5cbad4
commit 812aeac52d
13 changed files with 153 additions and 12 deletions

View File

@ -28,12 +28,25 @@ public class PCommonController {
* @return
*/
@PostMapping(value = "/cancelOrder")
public AjaxResult getDriverInfo(@RequestBody CommonVO commonVO)
public AjaxResult cancelOrder(@RequestBody CommonVO commonVO)
{
return pCommonService.cancelOrder(commonVO);
}
/**
* 乘客或者司机关闭订单
* @param commonVO
* @return
*/
@PostMapping(value = "/finishOrder")
public AjaxResult finishOrder(@RequestBody CommonVO commonVO)
{
return pCommonService.cancelOrder(commonVO);
}
/**
* 乘客申请加入拼单

View File

@ -66,6 +66,10 @@ public class PDriver extends BaseEntity
@Excel(name = "用户当前的状态0审核中1审核通过2禁用")
private Integer state ;
/** 当前状态 */
@Excel(name = "微信openId")
private String openId ;
public void setId(Long id)
{
this.id = id;
@ -182,6 +186,14 @@ public class PDriver extends BaseEntity
this.numberPlate = numberPlate;
}
public String getOpenId() {
return openId;
}
public void setOpenId(String openId) {
this.openId = openId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -200,6 +212,7 @@ public class PDriver extends BaseEntity
.append("updateTime", getUpdateTime())
.append("state", getState())
.append("numberPlate", getNumberPlate())
.append("OpenId", getOpenId())
.toString();
}
}

View File

@ -98,6 +98,11 @@ public class POrder extends BaseEntity
@ApiModelProperty(value = "发起者手机号")
private String createrPhone;
@Excel(name = "参与者openID")
@ApiModelProperty(value = "参与者openID")
private String memberOpenId;
public void setId(Long id)
{
@ -247,6 +252,14 @@ public class POrder extends BaseEntity
this.createrOpenId = createrOpenId;
}
public String getMemberOpenId() {
return memberOpenId;
}
public void setMemberOpenId(String memberOpenId) {
this.memberOpenId = memberOpenId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -269,6 +282,7 @@ public class POrder extends BaseEntity
.append("createrName", getCreaterName())
.append("CreaterPhone", getCreaterPhone())
.append("createrOpenId", getCreaterOpenId())
.append("memberOpenId", getMemberOpenId())
.toString();
}
}

View File

@ -47,6 +47,15 @@ public interface PCommonMapper {
*/
public int updateOrderState(String orderNum);
/**
* 完成订单-取消拼单
* @param orderNum
* @return
*/
public int updateOrderStateFinsh(String orderNum);
/**
* 司机取消订单-取消拼单
* @param orderNum

View File

@ -75,4 +75,12 @@ public interface PDriverMapper
*/
public int agreePDriver(PDriver pDriver);
/**
* 修改司机信息
*
* @param pDriver 司机信息
* @return 结果
*/
public PDriver getDriverInfoByOpenId(String openid);
}

View File

@ -27,6 +27,14 @@ public interface POrderMapper
*/
public List<POrder> selectPOrderList(POrder pOrder);
/**
* 查询订单信息列表
*
* @param pOrder 订单信息
* @return 订单信息集合
*/
public List<POrder> selectPOrderListContentMember(POrder pOrder);
/**
* 新增订单信息
*

View File

@ -15,6 +15,13 @@ public interface IPCommonService {
public AjaxResult cancelOrder(CommonVO commonVO);
/**
* 完成订单
* @param commonVO
* @return
*/
public AjaxResult finshOrder(CommonVO commonVO);
/**
* 审查拼单
* @param commonVO

View File

@ -1,9 +1,6 @@
package com.ruoyi.carpool.service.impl;
import com.ruoyi.carpool.domain.CommonVO;
import com.ruoyi.carpool.domain.PMember;
import com.ruoyi.carpool.domain.POrder;
import com.ruoyi.carpool.domain.PPassenger;
import com.ruoyi.carpool.domain.*;
import com.ruoyi.carpool.mapper.*;
import com.ruoyi.carpool.service.IPCommonService;
import com.ruoyi.common.core.domain.AjaxResult;
@ -34,10 +31,10 @@ public class IPCommonServiceImpl implements IPCommonService {
private POrderMapper pOrderMapper;
@Autowired
private PMemberMapper pMemberMapper;
private PPassengerMapper pPassengerMapper;
@Autowired
private PPassengerMapper pPassengerMapper;
private PDriverMapper pDriverMapper ;
@Override
@ -86,6 +83,12 @@ public class IPCommonServiceImpl implements IPCommonService {
return AjaxResult.error();
}
@Override
public AjaxResult finshOrder(CommonVO commonVO) {
String orderNum = commonVO.getOrderNum();
pCommonMapper.updateOrderStateFinsh(orderNum);
return AjaxResult.success();
}
@Override
public AjaxResult joinOrderList(CommonVO commonVO) {
@ -119,7 +122,11 @@ public class IPCommonServiceImpl implements IPCommonService {
if(StringUtils.isEmpty(openId)) return AjaxResult.error("请求参数错误,请检查入参是否有误!");
PPassenger passemger = pPassengerMapper.selectPPassengerByOpenId(openId);
if(passemger != null){
/*TODO 需要判断当前用户是否申请成为看司机 */
/*如果已经申请成为看司机则返回diverID*/
if("1".equals(passemger.getApplyState())){
PDriver driverInfoByOpenId = pDriverMapper.getDriverInfoByOpenId(openId);
passemger.setCustId(driverInfoByOpenId.getDriverId());
}
return AjaxResult.success(passemger);
}else {
/*系统没有用户,初始化一个乘客信息*/

View File

@ -1,5 +1,6 @@
package com.ruoyi.carpool.service.impl;
import java.util.ArrayList;
import java.util.List;
import com.ruoyi.carpool.domain.PPassenger;
@ -49,7 +50,13 @@ public class POrderServiceImpl implements IPOrderService
@Override
public List<POrder> selectPOrderList(POrder pOrder)
{
return pOrderMapper.selectPOrderList(pOrder);
List<POrder> pOrders = new ArrayList<>();
if(StringUtils.isNotEmpty(pOrder.getMemberOpenId())){
pOrders = pOrderMapper.selectPOrderListContentMember(pOrder);
}else {
pOrderMapper.selectPOrderList(pOrder);
}
return pOrders;
}

View File

@ -28,6 +28,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
UPDATE p_order SET state = '2' WHERE order_num = #{orderNum}
</update>
<update id="updateOrderStateFinsh" parameterType="String" >
UPDATE p_order SET state = '1' WHERE order_num = #{orderNum}
</update>
<update id="updateOrderIsTake" parameterType="String" >
UPDATE p_order SET is_take = '0' , driver_id = '' WHERE order_num = #{orderNum}
</update>

View File

@ -20,10 +20,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="isBlacklist" column="is_blacklist" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="openId" column="open_id" />
</resultMap>
<sql id="selectPDriverVo">
select id, driver_id, name, sex, id_card, age, phone,number_plate,city,state, province, country, is_blacklist, create_time, update_time from p_driver
select id, driver_id, name, sex, id_card, age, phone,number_plate,city,state,open_id,province, country, is_blacklist, create_time, update_time from p_driver
</sql>
<select id="selectPDriverList" parameterType="PDriver" resultMap="PDriverResult">
@ -67,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isBlacklist != null">is_blacklist,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="openId != null and openId != '' ">open_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
@ -84,6 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isBlacklist != null">#{isBlacklist},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="openId != null and openId != '' ">#{openId},</if>
</trim>
</insert>
@ -135,6 +138,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="province != null and province != ''"> and province = #{province}</if>
<if test="country != null and country != ''"> and country = #{country}</if>
<if test="isBlacklist != null "> and is_blacklist = #{isBlacklist}</if>
<if test="openId != null and openId != '' "> and open_id = #{openId}</if>
</where>
</select>
@ -145,4 +149,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update p_driver SET state = 1 where driver_id = #{driverId}
</update>
<select id="getDriverInfoByOpenId" parameterType="String" resultMap="PDriverResult">
<include refid="selectPDriverVo"/>
where open_id = #{openId}
</select>
</mapper>

View File

@ -53,6 +53,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createrPhone != null and createrPhone != ''"> and A.creater_phone = #{createrPhone}</if>
<if test="createrName != null and createrName != ''"> and A.creater_name = #{createrName}</if>
</select>
<select id="selectPOrderListContentMember" parameterType="POrder" resultMap="POrderResult">
SELECT A.* , B.open_id memberOpenId, C.NAME AS driver_name
FROM p_order A
LEFT JOIN p_order_member B ON A.order_num = B.order_num
LEFT JOIN p_driver C ON A.driver_id = C.driver_id
where 1=1
<if test="orderNum != null and orderNum != ''"> and A.order_num = #{orderNum}</if>
<if test="departure != null and departure != ''"> and A.departure = #{departure}</if>
<if test="destination != null and destination != ''"> and A.destination = #{destination}</if>
<if test="departureTime != null "> and A.departure_time = #{departureTime}</if>
<if test="member != null "> and <![CDATA[ A.member <= #{member} ]]> </if>
<if test="state != null "> and A.state = #{state}</if>
<if test="isdelete != null "> and A.isDelete = #{isdelete}</if>
<if test="isTake != null "> and A.is_take = #{isTake}</if>
<if test="driverName != null "> and C.name = #{driverName}</if>
<if test="memberOpenId != null and memberOpenId != '' "> and B.open_id = #{memberOpenId}</if>
<if test="createUser != null and createUser != ''"> and A.create_user = #{createUser}</if>
<if test="updateUser != null and updateUser != ''"> and A.update_user = #{updateUser}</if>
<if test="driverOpenId != null and driverOpenId != ''"> and A.driver_open_id = #{driverOpenId}</if>
<if test="createrOpenId != null and createrOpenId != ''"> and A.creater_openid = #{createrOpenId}</if>
<if test="createrPhone != null and createrPhone != ''"> and A.creater_phone = #{createrPhone}</if>
<if test="createrName != null and createrName != ''"> and A.creater_name = #{createrName}</if>
</select>
SELECT A.* , B.open_id memberOpenId, C.NAME AS driver_name FROM p_order A
LEFT JOIN p_order_member B ON A.order_num = B.order_num
LEFT JOIN p_driver C ON A.driver_id = C.driver_id
<select id="selectPOrderById" parameterType="Long" resultMap="POrderResult">
<include refid="selectPOrderVo"/>
@ -132,6 +171,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=",">
<if test="isTake != null">is_take = #{isTake},</if>
<if test="driverId != null">driver_id = #{driverId},</if>
<if test="driverOpenId != null and driverOpenId != '' ">driver_open_id = #{driverOpenId},</if>
</trim>
where order_num = #{orderNum}
</update>

View File

@ -68,7 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isBlacklist != null">is_blacklist,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="applyState != null">apply_state,</if>
<if test="applyState != null and applyState != '' ">apply_state,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
@ -86,7 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isBlacklist != null">#{isBlacklist},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="applyState != null">#{applyState},</if>
<if test="applyState != null and applyState != '' ">#{applyState},</if>
</trim>
</insert>