护理员小程序工单代码移植
This commit is contained in:
parent
0dccd03dac
commit
51808f6aa0
@ -0,0 +1,41 @@
|
||||
package com.xinelu.applet.controller.nurseappletpersonworkorder;
|
||||
|
||||
|
||||
import com.xinelu.applet.dto.nursepersonapplogin.OrderFallbackDTO;
|
||||
import com.xinelu.applet.service.nurseappletpersonworkorder.NurseAppletPersonWorkOrderService;
|
||||
import com.xinelu.common.annotation.MobileRequestAuthorization;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import net.sf.jsqlparser.statement.update.Update;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 护理员工单Controller
|
||||
*
|
||||
* @author zh
|
||||
* @date 2023-03-30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/nurseApplet/personWorkOrder")
|
||||
public class NurseAppletPersonWorkOrderController {
|
||||
@Resource
|
||||
private NurseAppletPersonWorkOrderService nurseAppletPersonWorkOrderService;
|
||||
|
||||
|
||||
/**
|
||||
* 护理员接单共用
|
||||
*
|
||||
* @param orderFallbackDTO 订单信息
|
||||
* @return AjaxResult
|
||||
*/
|
||||
@MobileRequestAuthorization
|
||||
@PostMapping("/receiveOrders")
|
||||
public AjaxResult receiveOrders(@Validated(Update.class) @RequestBody OrderFallbackDTO orderFallbackDTO) {
|
||||
return nurseAppletPersonWorkOrderService.receiveOrders(orderFallbackDTO);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
package com.xinelu.applet.service.nurseappletpersonworkorder.Impl;
|
||||
|
||||
|
||||
import com.xinelu.applet.dto.nursepersonapplogin.OrderFallbackDTO;
|
||||
import com.xinelu.applet.service.nurseappletpersonworkorder.NurseAppletPersonWorkOrderService;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.common.enums.OrderProcessOperateTypeEnum;
|
||||
import com.xinelu.common.enums.OrderStatusEnum;
|
||||
import com.xinelu.common.exception.ServiceException;
|
||||
import com.xinelu.manage.domain.appointmentorderprocessrecord.AppointmentOrderProcessRecord;
|
||||
import com.xinelu.manage.mapper.appointmentorder.AppointmentOrderMapper;
|
||||
import com.xinelu.manage.mapper.appointmentorderdetails.AppointmentOrderDetailsMapper;
|
||||
import com.xinelu.manage.mapper.appointmentorderprocessrecord.AppointmentOrderProcessRecordMapper;
|
||||
import com.xinelu.manage.service.stationmessagepush.StationMessagePushService;
|
||||
import com.xinelu.manage.vo.appointmentorder.AppointmentReceivingOrderVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 护理员工单ServiceImpl
|
||||
*
|
||||
* @author zh
|
||||
* @date 2023-03-30
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class NurseAppletPersonWorkOrderServiceImpl implements NurseAppletPersonWorkOrderService {
|
||||
@Resource
|
||||
private AppointmentOrderMapper appointmentOrderMapper;
|
||||
@Resource
|
||||
private AppointmentOrderProcessRecordMapper appointmentOrderProcessRecordMapper;
|
||||
@Resource
|
||||
private StationMessagePushService stationMessagePushService;
|
||||
@Resource
|
||||
private AppointmentOrderDetailsMapper appointmentOrderDetailsMapper;
|
||||
|
||||
/**
|
||||
* 接单
|
||||
*
|
||||
* @param orderFallbackDTO 订单信息
|
||||
* @return AjaxResult
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public AjaxResult receiveOrders(OrderFallbackDTO orderFallbackDTO) {
|
||||
AppointmentReceivingOrderVO appointmentReceivingOrder = appointmentOrderDetailsMapper.getAppointmentReceivingOrder(orderFallbackDTO.getAppointmentOrderNo());
|
||||
if (Objects.isNull(appointmentReceivingOrder)) {
|
||||
return AjaxResult.error("当前订单不存在,无法接单!");
|
||||
}
|
||||
int update = appointmentOrderMapper.updateAppointmentOrderStatus(OrderStatusEnum.NOT_FINISH.getInfo(), orderFallbackDTO.getAppointmentOrderNo());
|
||||
if (update < 0) {
|
||||
throw new ServiceException("接单失败,请联系管理员!");
|
||||
}
|
||||
AppointmentOrderProcessRecord appointmentOrderProcessRecord = new AppointmentOrderProcessRecord();
|
||||
appointmentOrderProcessRecord.setAppointmentOrderNo(orderFallbackDTO.getAppointmentOrderNo());
|
||||
appointmentOrderProcessRecord.setCreateTime(LocalDateTime.now());
|
||||
appointmentOrderProcessRecord.setOperatePersonId(orderFallbackDTO.getStationPersonId());
|
||||
appointmentOrderProcessRecord.setOperateTime(LocalDateTime.now());
|
||||
appointmentOrderProcessRecord.setOperateType(OrderProcessOperateTypeEnum.RECEIVE_ORDER.getInfo());
|
||||
appointmentOrderProcessRecord.setAppointmentOrderId(orderFallbackDTO.getAppointmentOrderId());
|
||||
appointmentOrderProcessRecord.setOperateDetails("接单");
|
||||
int count = appointmentOrderProcessRecordMapper.insertAppointmentOrderProcessRecord(appointmentOrderProcessRecord);
|
||||
if (count <= 0) {
|
||||
throw new ServiceException("增加预约订单流程记录失败,请联系管理员!");
|
||||
}
|
||||
//异步发送消息
|
||||
stationMessagePushService.receivingOrdersOperationsPush(appointmentReceivingOrder);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.xinelu.applet.service.nurseappletpersonworkorder;
|
||||
|
||||
import com.xinelu.applet.dto.nursepersonapplogin.OrderFallbackDTO;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
|
||||
/**
|
||||
* 护理员工单Service
|
||||
*
|
||||
* @author zh
|
||||
* @date 2023-03-30
|
||||
*/
|
||||
public interface NurseAppletPersonWorkOrderService {
|
||||
/**
|
||||
* 接单
|
||||
*
|
||||
* @param orderFallbackDTO 订单信息
|
||||
* @return AjaxResult
|
||||
*/
|
||||
AjaxResult receiveOrders(OrderFallbackDTO orderFallbackDTO);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user