回滚代码
This commit is contained in:
-116
@@ -1,116 +0,0 @@
|
||||
package com.bms.web.controller.monitor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
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 com.bms.common.annotation.Log;
|
||||
import com.bms.common.core.controller.BaseController;
|
||||
import com.bms.common.core.domain.AjaxResult;
|
||||
import com.bms.common.core.page.TableDataInfo;
|
||||
import com.bms.common.enums.BusinessType;
|
||||
import com.bms.price.domain.PrcOrder;
|
||||
import com.bms.price.enums.BillTaskSuccessStatus;
|
||||
import com.bms.price.service.IPrcBillingTaskService;
|
||||
import com.bms.price.service.IPrcOrderService;
|
||||
|
||||
/**
|
||||
* Monitor: prc_order billing status list and manual resync (replaces task-queue view after upsert).
|
||||
* Reuses monitor:billingTask:* perms so menu/roles stay stable.
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/prcOrder")
|
||||
public class PrcOrderMonitorController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IPrcOrderService prcOrderService;
|
||||
|
||||
@Autowired
|
||||
private IPrcBillingTaskService billingTaskService;
|
||||
|
||||
/** Default list = FAILED. */
|
||||
@PreAuthorize("@ss.hasPermi('monitor:billingTask:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(PrcOrder query)
|
||||
{
|
||||
if (query.getSuccessStatus() == null || query.getSuccessStatus().isEmpty())
|
||||
{
|
||||
query.setSuccessStatus(BillTaskSuccessStatus.FAILED.getCode());
|
||||
}
|
||||
else if ("ALL".equalsIgnoreCase(query.getSuccessStatus()))
|
||||
{
|
||||
query.setSuccessStatus(null);
|
||||
}
|
||||
startPage();
|
||||
List<PrcOrder> list = prcOrderService.selectPrcOrderList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:billingTask:list')")
|
||||
@GetMapping("/{orderId}")
|
||||
public AjaxResult getInfo(@PathVariable("orderId") String orderId)
|
||||
{
|
||||
return success(prcOrderService.selectPrcOrderById(orderId));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:billingTask:retry')")
|
||||
@Log(title = "prc_order retry", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/retry/{orderId}")
|
||||
public AjaxResult retry(@PathVariable("orderId") String orderId)
|
||||
{
|
||||
return success(billingTaskService.retryByOrderId(orderId));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:billingTask:retry')")
|
||||
@Log(title = "prc_order batch retry", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/retry")
|
||||
public AjaxResult retryBatch(@RequestBody String[] orderIds)
|
||||
{
|
||||
if (orderIds == null || orderIds.length == 0)
|
||||
{
|
||||
return error("orderIds required");
|
||||
}
|
||||
int ok = 0;
|
||||
int fail = 0;
|
||||
List<Map<String, Object>> details = new ArrayList<Map<String, Object>>();
|
||||
for (String orderId : orderIds)
|
||||
{
|
||||
Map<String, Object> row = new HashMap<String, Object>();
|
||||
row.put("orderId", orderId);
|
||||
try
|
||||
{
|
||||
PrcOrder order = billingTaskService.retryByOrderId(orderId);
|
||||
row.put("successStatus", order == null ? null : order.getSuccessStatus());
|
||||
row.put("failCode", order == null ? null : order.getFailCode());
|
||||
if (order != null && BillTaskSuccessStatus.SUCCESS.getCode().equals(order.getSuccessStatus()))
|
||||
{
|
||||
ok++;
|
||||
}
|
||||
else
|
||||
{
|
||||
fail++;
|
||||
}
|
||||
}
|
||||
catch (RuntimeException e)
|
||||
{
|
||||
fail++;
|
||||
row.put("successStatus", BillTaskSuccessStatus.FAILED.getCode());
|
||||
row.put("failCode", e.getMessage());
|
||||
}
|
||||
details.add(row);
|
||||
}
|
||||
Map<String, Object> data = new HashMap<String, Object>();
|
||||
data.put("ok", Integer.valueOf(ok));
|
||||
data.put("fail", Integer.valueOf(fail));
|
||||
data.put("details", details);
|
||||
return success(data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user