取消订单接口移植
This commit is contained in:
parent
e682722d5f
commit
d1d96b32a5
@ -1,6 +1,5 @@
|
||||
package com.xinelu.applet.controller.nurseapplogin;
|
||||
|
||||
import com.xinelu.applet.dto.appletlogin.AppletUserInfoDTO;
|
||||
import com.xinelu.applet.dto.appletlogin.StationItemInfoDTO;
|
||||
import com.xinelu.applet.service.nurseapplogin.NurseAppLoginService;
|
||||
import com.xinelu.applet.vo.nursepersonapplogin.OrderAndItemVO;
|
||||
@ -8,14 +7,14 @@ import com.xinelu.common.annotation.MobileRequestAuthorization;
|
||||
import com.xinelu.common.core.controller.BaseController;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.common.core.page.TableDataInfo;
|
||||
import com.xinelu.common.custominterface.Insert;
|
||||
import com.xinelu.common.custominterface.Query;
|
||||
import com.xinelu.common.exception.ServiceException;
|
||||
import com.xinelu.common.utils.regex.RegexUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
@ -113,4 +112,20 @@ public class NurseAppLoginController extends BaseController {
|
||||
List<OrderAndItemVO> appointmentOrderDetails = nurseAppLoginService.selectAppServiceOrderItem(patientId, orderStatus);
|
||||
return getDataTable(appointmentOrderDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序取消订单
|
||||
*
|
||||
* @param appointmentOrderId 预约订单id主键
|
||||
* @param cancelAppointmentReason 取消预约原因
|
||||
* @return 结果
|
||||
*/
|
||||
@MobileRequestAuthorization
|
||||
@PostMapping("/cancellationOrder")
|
||||
public AjaxResult updateAppointmentOrder(Long appointmentOrderId, String cancelAppointmentReason) {
|
||||
if (Objects.isNull(appointmentOrderId)) {
|
||||
return AjaxResult.error("预约订单信息不能为空!");
|
||||
}
|
||||
return nurseAppLoginService.updateAppointmentOrder(appointmentOrderId, cancelAppointmentReason);
|
||||
}
|
||||
}
|
||||
@ -3,6 +3,7 @@ package com.xinelu.applet.mapper.nurseapplogin;
|
||||
|
||||
import com.xinelu.applet.vo.nurseapplogin.PatientAndDiseaseVO;
|
||||
import com.xinelu.applet.vo.nursepersonapplogin.OrderAndItemVO;
|
||||
import com.xinelu.manage.domain.appointmentorder.AppointmentOrder;
|
||||
import com.xinelu.manage.domain.goodsOrder.GoodsOrder;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -71,4 +72,12 @@ public interface NurseAppLoginMapper {
|
||||
* @return GoodsOrder
|
||||
*/
|
||||
List<GoodsOrder> selectGoodsOrderListByPatient(Long patientId);
|
||||
|
||||
/**
|
||||
* 预约取消
|
||||
*
|
||||
* @param appointmentOrder 订单信息
|
||||
* @return 结果
|
||||
*/
|
||||
int updateAppointmentByOrderId(AppointmentOrder appointmentOrder);
|
||||
}
|
||||
|
||||
@ -54,4 +54,13 @@ public interface NurseAppLoginService {
|
||||
* @return 结果
|
||||
*/
|
||||
List<OrderAndItemVO> selectAppServiceOrderItem(Long patientId, String orderStatus);
|
||||
|
||||
/**
|
||||
* 小程序取消订单
|
||||
*
|
||||
* @param appointmentOrderId 预约订单id主键
|
||||
* @param cancelAppointmentReason 取消预约原因
|
||||
* @return 结果
|
||||
*/
|
||||
AjaxResult updateAppointmentOrder(Long appointmentOrderId, String cancelAppointmentReason);
|
||||
}
|
||||
|
||||
@ -13,8 +13,12 @@ import com.xinelu.applet.vo.nursepersonapplogin.OrderAndItemVO;
|
||||
import com.xinelu.applet.vo.specialdisease.WeekDaysVO;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.common.enums.AppointmentTimeIntervalEnum;
|
||||
import com.xinelu.common.enums.ConfirmRefundStatusEnum;
|
||||
import com.xinelu.common.enums.GooodsOrderStatusEnum;
|
||||
import com.xinelu.common.enums.OrderStatusEnum;
|
||||
import com.xinelu.common.exception.ServiceException;
|
||||
import com.xinelu.common.utils.AgeUtil;
|
||||
import com.xinelu.manage.domain.appointmentorder.AppointmentOrder;
|
||||
import com.xinelu.manage.domain.goodsOrder.GoodsOrder;
|
||||
import com.xinelu.manage.mapper.patientinfo.PatientInfoMapper;
|
||||
import com.xinelu.manage.mapper.sysarea.SysAreaMapper;
|
||||
@ -29,6 +33,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@ -227,4 +232,26 @@ public class NurseAppLoginServiceImpl implements NurseAppLoginService {
|
||||
}
|
||||
return nurseAppLoginMapper.selectAppointmentOrderDetailsByPatientId(patientId, orderStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序取消订单
|
||||
*
|
||||
* @param appointmentOrderId 预约订单编号
|
||||
* @param cancelAppointmentReason 取消预约原因
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult updateAppointmentOrder(Long appointmentOrderId, String cancelAppointmentReason) {
|
||||
AppointmentOrder appointmentOrder = new AppointmentOrder();
|
||||
appointmentOrder.setUpdateTime(LocalDateTime.now());
|
||||
appointmentOrder.setId(appointmentOrderId);
|
||||
appointmentOrder.setCancelAppointmentReason(cancelAppointmentReason);
|
||||
appointmentOrder.setConfirmRefundStatus(ConfirmRefundStatusEnum.NOT_CONFIRM.getInfo());
|
||||
appointmentOrder.setOrderStatus(OrderStatusEnum.WAIT_REFUND.getInfo());
|
||||
int update = nurseAppLoginMapper.updateAppointmentByOrderId(appointmentOrder);
|
||||
if (update <= 0) {
|
||||
throw new ServiceException("取消订单失败,请联系管理员!");
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
@ -155,4 +155,21 @@
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<update id="updateAppointmentByOrderId">
|
||||
UPDATE appointment_order a,
|
||||
appointment_order_details b
|
||||
SET a.order_status = #{orderStatus},
|
||||
a.cancel_appointment_reason = #{cancelAppointmentReason},
|
||||
a.confirm_refund_status = #{confirmRefundStatus},
|
||||
b.order_status = #{orderStatus},
|
||||
a.update_time = now(),
|
||||
b.update_time = now()
|
||||
WHERE
|
||||
a.order_no = b.order_no
|
||||
AND a.del_flag = 0
|
||||
AND a.order_status <> #{orderStatus}
|
||||
AND b.order_status <> #{orderStatus}
|
||||
AND a.id = #{id}
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user