| | |
| | | { |
| | | return toAjax(tbCallbackLogService.deleteTbCallbackLogByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | | * 重试回调 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:callbacklog:retry')") |
| | | @Log(title = "回调记录", businessType = BusinessType.UPDATE) |
| | | @PostMapping("/retry/{ids}") |
| | | public AjaxResult retry(@PathVariable Long[] ids) |
| | | { |
| | | return toAjax(tbCallbackLogService.retryTbCallbackLogByIds(ids)); |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | * @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); |
| | | |
| | | SysClientApp scApp = clientAppService.selectSysClientAppByAppId(1L); |
| | | |
| | | SysClientApp scApp = clientAppService.selectSysClientAppByAppKey(tbOrders.getAppId()); |
| | | |
| | | |
| | | |
| | | ServiceOrderAppVo model = new ServiceOrderAppVo(); |
| | |
| | | public class RyTask |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(RyTask.class); |
| | | |
| | | // 添加状态映射字典 |
| | | private static final Map<String, String> ORDER_STATUS_MAP = new HashMap<String, String>() {{ |
| | | put("-1", "无效取消"); |
| | | put("1", "未报价"); |
| | | put("2", "已报价"); |
| | | put("3", "1 - 完全未确认"); |
| | | put("4", "2 - 部分已确认"); |
| | | put("5", "未出车"); |
| | | put("6", "3 - 已出车(去接患者途中)"); |
| | | put("7", "已出车(等待患者)"); |
| | | put("8", "4 - 已出车(服务中)"); |
| | | put("9", "5 - 已送达(回程中)"); |
| | | put("10", "已返回"); |
| | | put("11", "跑空单,已返回"); |
| | | put("12", "取消"); |
| | | put("13", "0 - 新调度单(未下发)"); |
| | | put("14", "已提交,等待审核"); |
| | | put("15", "审核完成"); |
| | | put("16", "审核不通过"); |
| | | put("17", "已站点"); |
| | | }}; |
| | | |
| | | @Autowired |
| | | private IAOrderStatusService orderStatusService; |
| | | |
| | |
| | | { |
| | | System.out.println("执行无参方法"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 回调推送状态 |
| | |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("orderID", tbOrders.getOrderID().toString()); |
| | | map.put("thirdOrderNo", orderStatus.getServiceOrdID()); |
| | | map.put("orderStatus","1"); |
| | | map.put("orderStatus", ORDER_STATUS_MAP.entrySet() |
| | | .stream() |
| | | .filter(entry -> entry.getValue().equals(orderStatus.getMsg())) |
| | | .map(Map.Entry::getKey) |
| | | .findFirst() |
| | | .orElse("0")); |
| | | map.put("orderRemark", orderStatus.getMsg()); |
| | | map.put("plateNo",carLicense); |
| | | map.put("driverMobile",driverMobiles.toString()); |
| | |
| | | package com.ruoyi.system.domain; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| | | import com.fasterxml.jackson.annotation.JsonProperty; |
| | | import lombok.Data; |
| | | |
| | | |
| | | @JsonIgnoreProperties(ignoreUnknown = true) |
| | | @Data |
| | | public class OrderStatusCallBackVo { |
| | | /** |
| | |
| | | * @return 结果 |
| | | */ |
| | | public int deleteTbCallbackLogById(Long id); |
| | | |
| | | /** |
| | | * 重试回调 |
| | | * |
| | | * @param ids 需要重试的回调记录主键集合 |
| | | * @return 结果 |
| | | */ |
| | | public int retryTbCallbackLogByIds(Long[] ids); |
| | | } |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.ruoyi.system.mapper.TbCallbackLogMapper; |
| | | import com.ruoyi.system.domain.TbCallbackLog; |
| | | import com.ruoyi.system.service.ITbCallbackLogService; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.TypeReference; |
| | | import com.ruoyi.common.utils.HttpUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | /** |
| | | * 回调记录Service业务层处理 |
| | |
| | | @Service |
| | | public class TbCallbackLogServiceImpl implements ITbCallbackLogService |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(TbCallbackLogServiceImpl.class); |
| | | |
| | | @Autowired |
| | | private TbCallbackLogMapper tbCallbackLogMapper; |
| | | |
| | |
| | | { |
| | | return tbCallbackLogMapper.deleteTbCallbackLogById(id); |
| | | } |
| | | |
| | | /** |
| | | * 重试回调 |
| | | */ |
| | | @Override |
| | | public int retryTbCallbackLogByIds(Long[] ids) { |
| | | int successCount = 0; |
| | | for (Long id : ids) { |
| | | TbCallbackLog callbackLog = tbCallbackLogMapper.selectTbCallbackLogById(id); |
| | | if (callbackLog != null) { |
| | | try { |
| | | // 解析原始请求参数 |
| | | Map<String, String> params = JSON.parseObject(callbackLog.getRequestParams(), |
| | | new TypeReference<Map<String, String>>() {}); |
| | | |
| | | // 转换key的首字母为大写 |
| | | Map<String, String> capitalizedParams = new HashMap<>(); |
| | | params.forEach((key, value) -> { |
| | | String capitalizedKey = key.substring(0, 1).toUpperCase() + key.substring(1); |
| | | capitalizedParams.put(capitalizedKey, value); |
| | | }); |
| | | |
| | | // 重新发送回调 |
| | | String response = HttpUtil.post(callbackLog.getCallbackUrl(), capitalizedParams); |
| | | if (response != null) { |
| | | callbackLog.setRetryCount(callbackLog.getRetryCount()+1); |
| | | callbackLog.setResponseResult(response); |
| | | callbackLog.setStatus("1"); // 更新状态为成功 |
| | | successCount++; |
| | | tbCallbackLogMapper.updateTbCallbackLog(callbackLog); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("重试回调失败,ID: " + id + ", 错误: " + e.getMessage()); |
| | | callbackLog.setErrorMsg(e.getMessage()); |
| | | callbackLog.setStatus("0"); // 更新状态为失败 |
| | | tbCallbackLogMapper.updateTbCallbackLog(callbackLog); |
| | | } |
| | | } |
| | | } |
| | | return successCount; |
| | | } |
| | | |
| | | } |
| | |
| | | AND date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d') |
| | | </if> |
| | | </where> |
| | | order by create_time,id desc |
| | | order by id desc |
| | | </select> |
| | | |
| | | <select id="selectTbCallbackLogById" parameterType="Long" resultMap="TbCallbackLogResult"> |
| | |
| | | method: 'delete' |
| | | }) |
| | | } |
| | | |
| | | // 重试回调 |
| | | export function retryCallbacklog(ids) { |
| | | return request({ |
| | | url: '/system/callbacklog/retry/' + ids, |
| | | method: 'post' |
| | | }) |
| | | } |
| | |
| | | </el-form> |
| | | |
| | | <el-row :gutter="10" class="mb8"> |
| | | <!-- <el-col :span="1.5"> |
| | | <el-button |
| | | <el-col :span="1.5"> |
| | | <!-- <el-button |
| | | type="primary" |
| | | plain |
| | | icon="el-icon-plus" |
| | |
| | | :disabled="multiple" |
| | | @click="handleDelete" |
| | | v-hasPermi="['system:callbacklog:remove']" |
| | | >删除</el-button> |
| | | </el-col> --> |
| | | >删除</el-button> --> |
| | | |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="warning" |
| | |
| | | @click="handleExport" |
| | | v-hasPermi="['system:callbacklog:export']" |
| | | >导出</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="primary" |
| | | plain |
| | | icon="el-icon-s-promotion" |
| | | size="mini" |
| | | :disabled="multiple" |
| | | @click="handleBatchRetry" |
| | | >批量重试</el-button> |
| | | </el-col> |
| | | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | |
| | | <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
| | | <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-edit" |
| | | @click="handleUpdate(scope.row)" |
| | | v-hasPermi="['system:callbacklog:edit']" |
| | | >修改</el-button> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-delete" |
| | | @click="handleDelete(scope.row)" |
| | | v-hasPermi="['system:callbacklog:remove']" |
| | | >删除</el-button> |
| | | icon="el-icon-s-promotion" |
| | | @click="handleRetry(scope.row)" |
| | | v-hasPermi="['system:callbacklog:retry']" |
| | | >重试回调</el-button> |
| | | </template> |
| | | </el-table-column> --> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <pagination |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { listCallbacklog, getCallbacklog, delCallbacklog, addCallbacklog, updateCallbacklog } from "@/api/system/callbacklog"; |
| | | import { listCallbacklog, getCallbacklog, delCallbacklog, addCallbacklog, updateCallbacklog, retryCallbacklog } from "@/api/system/callbacklog"; |
| | | |
| | | export default { |
| | | name: "Callbacklog", |
| | |
| | | this.download('system/callbacklog/export', { |
| | | ...this.queryParams |
| | | }, `callbacklog_${new Date().getTime()}.xlsx`) |
| | | }, |
| | | /** 触发单个回调重试 */ |
| | | handleRetry(row) { |
| | | const id = row.id; |
| | | this.$modal.confirm('是否确认重试该回调记录?').then(function() { |
| | | return retryCallbacklog(id); |
| | | }).then(() => { |
| | | this.getList(); |
| | | this.$modal.msgSuccess("触发重试成功"); |
| | | }).catch(() => {}); |
| | | }, |
| | | /** 批量触发回调重试 */ |
| | | handleBatchRetry() { |
| | | if (this.ids.length === 0) { |
| | | this.$modal.msgError("请选择需要重试的记录"); |
| | | return; |
| | | } |
| | | this.$modal.confirm('是否确认重试选中的' + this.ids.length + '条回调记录?').then(() => { |
| | | return retryCallbacklog(this.ids.join(',')); |
| | | }).then(() => { |
| | | this.getList(); |
| | | this.$modal.msgSuccess("批量重试成功"); |
| | | }).catch(() => {}); |
| | | } |
| | | } |
| | | }; |