| | |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.ruoyi.common.annotation.Anonymous; |
| | | import com.ruoyi.common.core.domain.entity.ServiceOrderAppResultVo; |
| | | import com.ruoyi.common.core.domain.entity.ServiceOrderAppVo; |
| | | import com.ruoyi.common.core.domain.entity.ServiceOrderDelVo; |
| | | import com.ruoyi.common.core.domain.entity.*; |
| | | import com.ruoyi.common.utils.civilAviation.ServiceOrderUtil; |
| | | import com.ruoyi.system.domain.SysClientApp; |
| | | import com.ruoyi.system.service.ISysClientAppService; |
| | |
| | | import com.ruoyi.system.service.ITbOrdersService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.core.domain.entity.OrderCancelVo; |
| | | |
| | | /** |
| | | * ordersController |
| | |
| | | * @param tbOrders |
| | | * @return |
| | | */ |
| | | // @Anonymous(needSign = true) |
| | | @Anonymous |
| | | @Anonymous(needSign = true) |
| | | // @Anonymous |
| | | // @Log(title = "orders", businessType = BusinessType.INSERT) |
| | | @ApiOperation("新增订单") |
| | | @ApiImplicitParams({ |
| | |
| | | @ApiImplicitParam(name = "bookingPrice", value = "报价", dataType = "BigDecimal") |
| | | }) |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@RequestBody TbOrders tbOrders) { |
| | | public AjaxResult add(@RequestBody TbOrders tbOrders,String appId) { |
| | | try { |
| | | if (tbOrders == null || tbOrders.getOrderID() == null) { |
| | | return AjaxResult.error("传输数据为空!"); |
| | | } |
| | | |
| | | if(appId ==null|| Objects.equals(appId, "")) |
| | | { |
| | | return AjaxResult.error("appid不能为空!"); |
| | | } |
| | | |
| | | tbOrders.setAppId(appId); |
| | | tbOrders.setCreateTime(new Date()); |
| | | |
| | | tbOrdersService.insertTbOrders(tbOrders); |
| | | try |
| | | { |
| | | tbOrdersService.insertTbOrders(tbOrders); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return AjaxResult.error("订单号不能重复"); |
| | | } |
| | | |
| | | SysClientApp scApp = clientAppService.selectSysClientAppByAppId(1L); |
| | | |
| | | SysClientApp scApp = clientAppService.selectSysClientAppByAppKey(tbOrders.getAppId()); |
| | | |
| | | |
| | | |
| | | ServiceOrderAppVo model = new ServiceOrderAppVo(); |
| | |
| | | // model.setCoTies("家属"); // 随机设置客户联系人与患者关系 |
| | | // 设置预约时间为一天后 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd%20HH:mm"); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | model.setApptDate(sdf.format(tbOrders.getBookingDate())); // 格式化预约运送时间 |
| | | |
| | | model.setPtName(tbOrders.getPatientName()); // 患者姓名 |
| | |
| | | return AjaxResult.error("订单状态已取消"); |
| | | } |
| | | |
| | | SysClientApp scApp = clientAppService.selectSysClientAppByAppKey("appId1"); |
| | | SysClientApp scApp = clientAppService.selectSysClientAppByAppKey(tbOrders.getAppId()); |
| | | |
| | | |
| | | ServiceOrderAppVo model = new ServiceOrderAppVo(); |
| | | model.setMethod("ServiceOrder_APP"); // 设置接口名称 |
| | | model.setAppId(scApp.getMinAppId()); // 设置商户 APPID |
| | | model.setAppId(tbOrders.getAppId()); // 设置商户 APPID |
| | | model.setOrdType(tbOrders.getTypeCode().intValue()); |
| | | model.setCoPhone(tbOrders.getLinkTel()); // 客户联系电话 |
| | | model.setCoName(tbOrders.getLinkPerson()); // 客户姓名 |
| | | // model.setCoTies("家属"); // 随机设置客户联系人与患者关系 |
| | | // 设置预约时间为一天后 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd%20HH:mm"); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | model.setApptDate(sdf.format(tbOrders.getBookingDate())); // 格式化预约运送时间 |
| | | |
| | | model.setPtName(tbOrders.getPatientName()); // 患者姓名 |
| | |
| | | @ApiImplicitParam(name = "thirdOrderNo", value = "第三方订单号", required = true, dataType = "String"), |
| | | @ApiImplicitParam(name = "reason", value = "取消原因", required = true, dataType = "String") |
| | | }) |
| | | @Anonymous |
| | | @Anonymous(needSign = true) |
| | | @PostMapping("/cancelOrder") |
| | | public AjaxResult cancelOrder(@RequestBody OrderCancelVo cancelVo) |
| | | public AjaxResult cancelOrder(@RequestBody OrderCancelVo cancelVo,String appId) |
| | | { |
| | | try { |
| | | if (cancelVo == null || cancelVo.getOrderID() == null || |
| | |
| | | return AjaxResult.error("必要参数不能为空!"); |
| | | } |
| | | |
| | | SysClientApp scApp = clientAppService.selectSysClientAppByAppId(1L); |
| | | SysClientApp scApp = clientAppService.selectSysClientAppByAppKey(appId); |
| | | |
| | | ServiceOrderDelVo model = new ServiceOrderDelVo(); |
| | | model.setMethod("ServiceOrder_DEL"); // 设置接口名称 |
| | |
| | | model.setServiceOrdID(cancelVo.getThirdOrderNo()); // 设置第三方订单号 |
| | | model.setDELRemarks(cancelVo.getReason()); // 设置取消原因 |
| | | |
| | | ServiceOrderAppResultVo result = ServiceOrderUtil.CancelServiceOrder(model,scApp.getMinAppSecret()); |
| | | ServiceOrderDelResultVo result = ServiceOrderUtil.CancelServiceOrder(model,scApp.getMinAppSecret()); |
| | | |
| | | if (result.getResult() == 1) { |
| | | // 更新本地订单状态 |
| | |
| | | tbOrdersService.updateTbOrders(tbOrders); |
| | | return AjaxResult.success(result); |
| | | } else { |
| | | return AjaxResult.error("取消订单失败"); |
| | | return AjaxResult.error("取消订单失败",result); |
| | | } |
| | | } catch (Exception e) { |
| | | return AjaxResult.error("取消订单失败:" + e.getMessage()); |