记得上下班打卡 | git大法好,push需谨慎

Commit f4cdcbc7 authored by jiangxiulong's avatar jiangxiulong

refundBatch

parent e7666c03
package com.liquidnet.service.kylin.dto.param;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
......
package com.liquidnet.service.kylin.dto.param;
import lombok.Data;
import java.io.Serializable;
/**
* <p>
* 退款申请参数
* </p>
*
* @author jiangxiulong
* @since 2021-06-02 11:19 上午
*/
@Data
public class RefundBatchApplyParam implements Serializable {
private String targetId;
private String refundBatchId;
private String reason;
private Integer status;
private Integer refundStatus;
private String reject;
private String refuse;
}
package com.liquidnet.service.kylin.dto.param;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* <p>
* 退款回掉参数
* </p>
*
* @author jiangxiulong
* @since 2021-05-31 11:19 上午
*/
@Data
public class RefundBatchSearchParam implements Serializable {
private String refundBatchId;
private String targetId;
private Integer status;
private String createdAt;
@ApiModelProperty(value = "页数", example = "0")
@NotNull(message = "不能为空")
private Integer pageSize;
@ApiModelProperty(value = "数量", example = "20")
@NotNull(message = "不能为空")
private Integer pageNum;
}
......@@ -2,20 +2,19 @@ package com.liquidnet.client.admin.web.controller.zhengzai.kylin;
import com.github.pagehelper.PageInfo;
import com.liquidnet.client.admin.common.core.controller.BaseController;
import com.liquidnet.client.admin.common.core.domain.AjaxResult;
import com.liquidnet.client.admin.common.core.page.TableDataInfo;
import com.liquidnet.client.admin.zhengzai.kylin.service.impl.KylinRefundPerformancesAdminServiceImpl;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.kylin.dao.OrderRefundBatchDao;
import com.liquidnet.service.kylin.dto.param.RefundBatchApplyParam;
import com.liquidnet.service.kylin.dto.param.RefundBatchSearchParam;
import com.liquidnet.service.kylin.dto.vo.KylinOrderRefundBatchesVo;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
/**
* <p>
* 后台按演出批量退款 服务实现类
......@@ -29,7 +28,7 @@ import java.util.HashMap;
@RequestMapping("/kylin/refundBatch")
public class KylinOrderRefundBatchAdminController extends BaseController {
private String prefix = "kylin/refundBatch";
private String prefix = "zhengzai/kylin/refundBatch";
@Autowired
private KylinRefundPerformancesAdminServiceImpl kylinRefundPerformancesAdminServiceImpl;
......@@ -41,167 +40,102 @@ public class KylinOrderRefundBatchAdminController extends BaseController {
return prefix + "/refundBatch";
}
@GetMapping("{refundBatchId}")
@ApiOperation("详情")
@ApiImplicitParam(type = "path", dataType = "String", name = "refundBatchId", value = "主键id", required = true)
public ResponseDto<KylinOrderRefundBatchesVo> detail(@PathVariable("refundBatchId") String refundBatchId) {
@RequiresPermissions("kylin:refundBatch:detail")
@GetMapping(value = "/details/{refundBatchId}")
public String detail(@PathVariable("refundBatchId") String refundBatchId, ModelMap mmap) {
KylinOrderRefundBatchesVo result = null;
result = kylinRefundPerformancesAdminServiceImpl.detail(refundBatchId);
if (null != result) {
return ResponseDto.success(result);
} else {
return ResponseDto.failure("获取详情失败");
}
mmap.put("KylinOrderRefundsBatchVo", result);
return prefix + "/details";
}
@GetMapping("list")
@ApiOperation("列表")
@ApiImplicitParams({
@ApiImplicitParam(type = "query", dataType = "Integer", name = "page", value = "页码"),
@ApiImplicitParam(type = "query", dataType = "Integer", name = "size", value = "每页数量")
})
public ResponseDto<PageInfo<OrderRefundBatchDao>> bannerList(
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size
) {
PageInfo<OrderRefundBatchDao> result = null;
result = kylinRefundPerformancesAdminServiceImpl.refundList(page, size);
if (null != result) {
return ResponseDto.success(result);
} else {
return ResponseDto.failure("获取列表失败");
}
@RequiresPermissions("kylin:refundBatch:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo refundList(RefundBatchSearchParam refundBatchSearchParam) {
PageInfo<OrderRefundBatchDao> result = kylinRefundPerformancesAdminServiceImpl.refundList(refundBatchSearchParam);
return getDataTable(result.getList());
}
@RequiresPermissions("kylin:refundBatch:apply")
@PostMapping("apply")
@ApiOperation("申请演出退款")
@ApiImplicitParams({
@ApiImplicitParam(type = "body", dataType = "String", name = "targetId", value = "ID targetType=1为演出id", required = true),
@ApiImplicitParam(type = "body", dataType = "Integer", name = "targetType", value = "类型 1演出", required = true),
@ApiImplicitParam(type = "body", dataType = "String", name = "reason", value = "申请备注", required = true),
})
public ResponseDto<Object> refundBatchApply(
@RequestBody String targetId,
@RequestBody Integer targetType,
@RequestBody String reason
) {
Integer authId = 1;
String authName = "jxl";
String token = "22adsd34tt";
HashMap<String, Object> otherParam = new HashMap();
otherParam.put("token", token);
otherParam.put("reason", reason);
@ResponseBody
public AjaxResult refundBatchApply(RefundBatchApplyParam refundBatchApplyParam) {
try {
if (1 == targetType) {
Boolean res = kylinRefundPerformancesAdminServiceImpl.refundBatchApply(targetId, targetType, authId, authName, otherParam);
Boolean res = kylinRefundPerformancesAdminServiceImpl.refundBatchApply(refundBatchApplyParam);
if (res) {
return ResponseDto.success();
} else {
return ResponseDto.failure("申请演出退款失败");
}
return success();
} else {
return ResponseDto.failure("参数错误");
return error("申请退款失败");
}
} catch (Exception e) {
return ResponseDto.failure(e.getMessage());
return error(e.getMessage());
}
}
@RequiresPermissions("kylin:refundBatch:reapply")
@PostMapping("reapply")
@ApiOperation("再次提交审核")
@ApiImplicitParams({
@ApiImplicitParam(type = "body", dataType = "String", name = "refundBatchId", value = "refundBatchId 批量id", required = true),
@ApiImplicitParam(type = "body", dataType = "String", name = "remark", value = "再次提交备注", required = true),
})
public ResponseDto<Object> refundBatchApply(
@RequestBody String refundBatchId,
@RequestBody String remark
) throws Exception {
String token = "22adsd34tt";
HashMap<String, Object> otherParam = new HashMap();
otherParam.put("token", token);
otherParam.put("type", "reapply");
Boolean res = kylinRefundPerformancesAdminServiceImpl.refundBatchReapply(refundBatchId, remark, otherParam);
@ResponseBody
public AjaxResult refundBatchReApply(RefundBatchApplyParam refundBatchApplyParam) {
try {
Boolean res = kylinRefundPerformancesAdminServiceImpl.refundBatchReapply(refundBatchApplyParam);
if (res) {
return ResponseDto.success();
return success();
} else {
return ResponseDto.failure("提交审核失败");
// 不是重新发起退款,而是重新发起退款审核
return error("再次发起退款审核失败");
}
} catch (Exception e) {
return error(e.getMessage());
}
}
@RequiresPermissions("kylin:refundBatch:cancel")
@PostMapping("cancel")
@ApiOperation("取消退款")
@ApiImplicitParams({
@ApiImplicitParam(type = "body", dataType = "String", name = "refundBatchId", value = "refundBatchId 批量id", required = true)
})
public ResponseDto<Object> refundBatchCancel(
@RequestBody String refundBatchId
) throws Exception {
String token = "22adsd34tt";
HashMap<String, Object> otherParam = new HashMap();
otherParam.put("token", token);
otherParam.put("type", "cancel");
Boolean res = kylinRefundPerformancesAdminServiceImpl.refundBatchCancel(refundBatchId, otherParam);
@ResponseBody
public AjaxResult refundBatchCancel(RefundBatchApplyParam refundBatchApplyParam) {
try {
Boolean res = kylinRefundPerformancesAdminServiceImpl.refundBatchCancel(refundBatchApplyParam);
if (res) {
return ResponseDto.success();
return success();
} else {
return ResponseDto.failure("取消退款失败");
return error("取消退款失败");
}
} catch (Exception e) {
return error(e.getMessage());
}
}
@RequiresPermissions("kylin:refundBatch:review")
@PostMapping("review")
@ApiOperation("审核/驳回")
@ApiImplicitParams({
@ApiImplicitParam(type = "body", dataType = "String", name = "refundBatchId", value = "refundBatchId 批量id", required = true),
@ApiImplicitParam(type = "body", dataType = "Integer", name = "status", value = "状态 3运营驳回审核 4运营通过审核", required = true),
@ApiImplicitParam(type = "body", dataType = "String", name = "reject", value = "备注", required = true)
})
public ResponseDto<Object> refundBatchReview(
@RequestBody String refundBatchId,
@RequestBody Integer status,
@RequestBody String reject
) throws Exception {
String token = "22adsd34tt";
HashMap<String, Object> otherParam = new HashMap();
otherParam.put("token", token);
otherParam.put("type", "review");
otherParam.put("status", status);
otherParam.put("reject", reject);
Boolean res = kylinRefundPerformancesAdminServiceImpl.refundBatchReview(refundBatchId, otherParam);
@ResponseBody
public AjaxResult refundBatchReview(RefundBatchApplyParam refundBatchApplyParam) {
try {
Boolean res = kylinRefundPerformancesAdminServiceImpl.refundBatchReview(refundBatchApplyParam);
if (res) {
return ResponseDto.success();
return success();
} else {
return ResponseDto.failure("审核失败");
return error("审核退款失败");
}
} catch (Exception e) {
return error(e.getMessage());
}
}
@RequiresPermissions("kylin:refundBatch:execute")
@PostMapping("execute")
@ApiOperation("执行退款/拒绝退款")
@ApiImplicitParams({
@ApiImplicitParam(type = "body", dataType = "String", name = "refundBatchId", value = "refundBatchId 批量id", required = true),
@ApiImplicitParam(type = "body", dataType = "Integer", name = "status", value = "状态 5财务驳回审核 6财务通过审核", required = true),
@ApiImplicitParam(type = "body", dataType = "String", name = "refuse", value = "备注", required = true)
})
public ResponseDto<Object> refundBatchExecute(
@RequestBody String refundBatchId,
@RequestBody Integer status,
@RequestBody String refuse
) throws Exception {
String token = "22adsd34tt";
HashMap<String, Object> otherParam = new HashMap();
otherParam.put("token", token);
otherParam.put("type", "execute");
otherParam.put("status", status);
otherParam.put("refuse", refuse);
Boolean res = kylinRefundPerformancesAdminServiceImpl.refundBatchExecute(refundBatchId, otherParam);
@ResponseBody
public AjaxResult refundBatchExecute(RefundBatchApplyParam refundBatchApplyParam) {
try {
Boolean res = kylinRefundPerformancesAdminServiceImpl.refundBatchExecute(refundBatchApplyParam);
if (res) {
return ResponseDto.success();
return success();
} else {
return ResponseDto.failure("审核失败");
return error("审核退款失败");
}
} catch (Exception e) {
e.printStackTrace();
return error(e.getMessage());
}
}
......
......@@ -109,7 +109,6 @@
</div>
</div>
<th:block th:include="include :: footer"/>
{include file="zhengzai/kylin/refund/reviewView.html" /}
<script th:inline="javascript">
var detailFlag = [[${@permission.hasPermi('kylin:refund:detail')}]];
var reviewFlag = [[${@permission.hasPermi('kylin:refund:review')}]];
......
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('演出退款详情')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m-t" id="signupForm">
<div class="form-group">
<label class="col-sm-2 control-label">批量退款id:</label>
<div class="form-control-static" th:text="${KylinOrderRefundsBatchVo.refundBatchId}">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">批量提交时间:</label>
<div class="form-control-static" th:text="${KylinOrderRefundsBatchVo.createdAt}">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('演出退款列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>退款Id:</label>
<input type="text" name="refundBatchId"/>
</li>
<li>
<label>演出Id:</label>
<input type="text" name="targetId"/>
</li>
<li>
<label>退款状态:</label>
<select name="status">
<option value="">全部</option>
<option value="1">申请退款</option>
<option value="2">取消退款</option>
<option value="3">运营驳回审核</option>
<option value="4">运营通过审核</option>
<option value="5">财务驳回审核</option>
<option value="6">财务通过审核</option>
</select>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="apply()" shiro:hasPermission="kylin:refundBatch:apply">
添加
</a>
</div>
<div class="col-sm-12 select-table table-bordered">
<table id="bootstrap-table"></table>
</div>
<form id="appTest">
<div class="select-list">
<ul>
<li>
<input type="text" name="targetId" th:value="67689474263547904"/>
<input type="text" name="reason" th:value="222"/>
</li>
</ul>
</div>
</form>
<div class="wrapper wrapper-content animated fadeInRight ibox-content hidden" id="form-refund-review">
<form class="form-horizontal m">
<div class="row">
<div class="col-sm-12">
<div class="form-group">
<label class="col-xs-2 control-label layui-required">备注:</label>
<div class="col-xs-10">
<textarea name="remark" maxlength="500" class="form-control layui-required"
rows="3"></textarea>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
var detailFlag = [[${@permission.hasPermi('kylin:refundBatch:detail')}]];
var reviewFlag = [[${@permission.hasPermi('kylin:refundBatch:review')}]];
var executeFlag = [[${@permission.hasPermi('kylin:refundBatch:execute')}]];
var cancelFlag = [[${@permission.hasPermi('kylin:refundBatch:cancel')}]];
var reapplyFlag = [[${@permission.hasPermi('kylin:refundBatch:reapply')}]];
var prefix = ctx + "kylin/refundBatch";
function apply() {
var data = $('#appTest').serializeArray();
$.operate.save(prefix + "/apply", data);
}
function review(id) {
data = {"refundBatchId": id};
layer.open({
type: 1,
fixed: false,
maxmin: true,
title: '一审',
area: ['500px', '220px'],
content: $("#form-refund-review").html(),
btn: ["通过", '拒绝'],
yes: function (index, layero) {
var remark = $(layero).find("[name='remark']").val();
if (!remark) {
layer.msg("请填写备注");
return false;
}
data['reject'] = remark;
data['status'] = 1;
$.operate.save(prefix + "/review", data);
layer.close(index)
},
btn2: function (index, layero) {
var remark = $(layero).find("[name='remark']").val();
if (!remark) {
layer.msg("请填写备注");
return false;
}
data['reject'] = remark;
data['status'] = 5;
$.operate.save(prefix + "/review", data);
}
});
}
function execute(id) {
data = {"refundBatchId": id};
layer.open({
type: 1,
fixed: false,
maxmin: true,
title: '二审',
area: ['500px', '220px'],
content: $("#form-refund-review").html(),
btn: ["通过", '拒绝'],
yes: function (index, layero) {
var remark = $(layero).find("[name='remark']").val();
if (!remark) {
layer.msg("请填写备注");
return false;
}
data['refuse'] = remark;
data['status'] = 7;
$.operate.save(prefix + "/execute", data);
layer.close(index)
},
btn2: function (index, layero) {
var remark = $(layero).find("[name='remark']").val();
if (!remark) {
layer.msg("请填写备注");
return false;
}
data['refuse'] = remark;
data['status'] = 8;
$.operate.save(prefix + "/execute", data);
// return false;
}
});
}
$(function () {
var options = {
url: prefix + "/list",
detailUrl: prefix + "/details/{id}",
cancelUrl: prefix + "/cancel",
reapplyUrl: prefix + "/reapply",
columns: [{
checkbox: true
},
{
field: 'refundBatchId',
title: '退款id'
},
{
field: 'status',
title: '状态'
},
{
field: 'targetId',
title: '演出id'
},
{
field: 'createdAt',
title: '申请时间'
},
{
title: '操作',
align: 'center',
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-info btn-xs' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.refundBatchId + '\')"></i>查看</a> ');
actions.push('<a class="btn btn-success btn-xs ' + reviewFlag + '" href="javascript:void(0)" onclick="review(\'' + row.refundBatchId + '\')"></i>一审</a> ');
actions.push('<a class="btn btn-primary btn-xs ' + executeFlag + '" href="javascript:void(0)" onclick="execute(\'' + row.refundBatchId + '\')"></i>二审</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + cancelFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.refundBatchId + '\', \'确定取消退款申请吗?\', table.options.cancelUrl)"></i>取消</a> ');
actions.push('<a class="btn btn-warning btn-xs ' + reapplyFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.refundBatchId + '\', \'确定重新提交退款审核吗?\', table.options.reapplyUrl)"></i>重新提交</a> ');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>
\ No newline at end of file
......@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.liquidnet.client.admin.common.utils.ShiroUtils;
import com.liquidnet.client.admin.zhengzai.kylin.utils.DataUtils;
import com.liquidnet.commons.lang.util.BeanUtil;
import com.liquidnet.service.kylin.constant.KylinTableStatusConst;
......
......@@ -3,6 +3,8 @@ package com.liquidnet.client.admin.zhengzai.kylin.service.impl;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.service.kylin.constant.KylinTableStatusConst;
import com.liquidnet.service.kylin.dto.param.RefundApplyParam;
import com.liquidnet.service.kylin.dto.param.RefundBatchApplyParam;
import com.liquidnet.service.kylin.entity.KylinOrderRefunds;
import com.liquidnet.service.kylin.entity.KylinOrderTicketEntities;
import com.liquidnet.service.kylin.entity.KylinOrderTickets;
......@@ -13,8 +15,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
......@@ -40,23 +42,30 @@ public class KylinRefundExecuteServiceImpl {
RedisUtil redisUtil;
@Autowired
private KylinRefundHttpSubmitServiceImpl kylinRefundHttpSubmitServiceImpl;
private KylinOrderRefundsServiceImpl kylinOrderRefundsServiceImpl;
@Async
public void refundBatchApply(String targetId, String refundBatchId, HashMap<String, Object> otherParam) throws Exception {
public void refundBatchApply(String targetId, String refundBatchId, String reason) throws Exception {
RefundApplyParam refundApplyParam = new RefundApplyParam();
int count;
int limitNum = 100;
int mid = 0;
do {
List<KylinOrderTickets> orderList = kylinOrderTicketsMapper.getOrderEntities(targetId, mid, limitNum);
List<KylinOrderTickets> orderList = kylinOrderTicketsMapper.getOrderList(targetId, mid, limitNum);
for (KylinOrderTickets v : orderList) {
for (KylinOrderTickets order : orderList) {
List<KylinOrderTicketEntities> entitiesList = kylinOrderTicketEntitiesMapper.selectList(
new UpdateWrapper<KylinOrderTicketEntities>().eq("order_id", v.getOrderTicketsId())
new UpdateWrapper<KylinOrderTicketEntities>().eq("order_id", order.getOrderTicketsId())
.eq("is_payment", "yes")
);
List<String> ticketEntityIds = entitiesList.stream().map(KylinOrderTicketEntities -> KylinOrderTicketEntities.getOrderTicketEntitiesId()).collect(Collectors.toList());
// 请求php接口
kylinRefundHttpSubmitServiceImpl.httpApply(v, entitiesList, otherParam, refundBatchId);
refundApplyParam.setOrderRefundBatchesId(refundBatchId);
refundApplyParam.setReason(reason);
refundApplyParam.setOrderTicketsId(order.getOrderTicketsId());
refundApplyParam.setTicketEntityIds(ticketEntityIds);
refundApplyParam.setRefundPriceExpress(order.getPriceExpress().doubleValue());
Boolean res = kylinOrderRefundsServiceImpl.refundApply(refundApplyParam);
}
count = orderList.size();
......@@ -66,11 +75,13 @@ public class KylinRefundExecuteServiceImpl {
}
@Async
public void refundBatchStatus(String refundBatchId, HashMap<String, Object> otherParam) throws Exception {
public void refundBatchStatus(RefundBatchApplyParam refundBatchApplyParam, String type) throws Exception {
String refundBatchId = refundBatchApplyParam.getRefundBatchId();
Integer status = refundBatchApplyParam.getStatus();
// 处理查询订单状态
Integer[] whereStatus = {};
Integer whereType = KylinTableStatusConst.ORDER_REFUND_TYPE_APPLY;
switch ((String) otherParam.get("type")) {
switch (type) {
case "reapply":
whereStatus = new Integer[]{KylinTableStatusConst.ORDER_REFUND_STATUS_REJECT, KylinTableStatusConst.ORDER_REFUND_STATUS_REFUSE};
break;
......@@ -78,18 +89,18 @@ public class KylinRefundExecuteServiceImpl {
whereStatus = new Integer[]{KylinTableStatusConst.ORDER_REFUND_STATUS_APPLY, KylinTableStatusConst.ORDER_REFUND_STATUS_REJECT, KylinTableStatusConst.ORDER_REFUND_STATUS_REFUSE};
break;
case "review":
if (otherParam.get("status") == KylinTableStatusConst.ORDER_REFUND_STATUS_APPROVED) { // 通过申请
if (status == KylinTableStatusConst.ORDER_REFUND_STATUS_APPROVED) { // 通过申请
whereStatus = new Integer[]{KylinTableStatusConst.ORDER_REFUND_STATUS_APPLY, KylinTableStatusConst.ORDER_REFUND_STATUS_REJECT, KylinTableStatusConst.ORDER_REFUND_STATUS_REFUSE};
}
if (otherParam.get("status") == KylinTableStatusConst.ORDER_REFUND_STATUS_REJECT) { // 驳回申请
if (status == KylinTableStatusConst.ORDER_REFUND_STATUS_REJECT) { // 驳回申请
whereStatus = new Integer[]{KylinTableStatusConst.ORDER_REFUND_STATUS_APPLY, KylinTableStatusConst.ORDER_REFUND_STATUS_APPROVED, KylinTableStatusConst.ORDER_REFUND_STATUS_REFUSE};
}
break;
case "execute":
if (otherParam.get("status") == KylinTableStatusConst.ORDER_REFUND_STATUS_UNFILLED) { // 执行退款
if (status == KylinTableStatusConst.ORDER_REFUND_STATUS_UNFILLED) { // 执行退款
whereStatus = new Integer[]{KylinTableStatusConst.ORDER_REFUND_STATUS_APPROVED, KylinTableStatusConst.ORDER_REFUND_STATUS_REFUSE, KylinTableStatusConst.ORDER_REFUND_STATUS_ERROR};
}
if (otherParam.get("status") == KylinTableStatusConst.ORDER_REFUND_STATUS_REFUSE) { // 拒绝退款
if (status == KylinTableStatusConst.ORDER_REFUND_STATUS_REFUSE) { // 拒绝退款
whereStatus = new Integer[]{KylinTableStatusConst.ORDER_REFUND_STATUS_APPROVED, KylinTableStatusConst.ORDER_REFUND_STATUS_ERROR};
}
break;
......@@ -105,12 +116,38 @@ public class KylinRefundExecuteServiceImpl {
List<String> refundIds = null;
if (!refundList.isEmpty()) {
for (KylinOrderRefunds v : refundList) {
String refundId = v.getRefundId();
refundIds.add(refundId);
refundIds = refundList.stream().map(KylinOrderRefunds -> KylinOrderRefunds.getOrderRefundsId()).collect(Collectors.toList());
RefundApplyParam refundApplyParam = new RefundApplyParam();
refundApplyParam.setIds(refundIds);
Boolean res = null;
switch (type) {
case "reapply":
res = kylinOrderRefundsServiceImpl.refundReapply(refundApplyParam);
break;
case "cancel":
res = kylinOrderRefundsServiceImpl.refundCancel(refundApplyParam);
break;
case "review":
if (status == KylinTableStatusConst.ORDER_REFUND_STATUS_APPROVED) { // 通过申请
res = kylinOrderRefundsServiceImpl.refundApproved(refundApplyParam);
}
if (status == KylinTableStatusConst.ORDER_REFUND_STATUS_REJECT) { // 驳回申请
res = kylinOrderRefundsServiceImpl.refundReject(refundApplyParam);
}
break;
case "execute":
if (status == KylinTableStatusConst.ORDER_REFUND_STATUS_UNFILLED) { // 执行退款
res = kylinOrderRefundsServiceImpl.refundUnfilled(refundApplyParam);
}
if (status == KylinTableStatusConst.ORDER_REFUND_STATUS_REFUSE) { // 拒绝退款
res = kylinOrderRefundsServiceImpl.refundRefuse(refundApplyParam);
}
break;
default:
throw new Exception("type异常,无法操作");
}
// 请求php接口
kylinRefundHttpSubmitServiceImpl.httpStatus(refundIds, otherParam);
}
count = refundList.size();
......
package com.liquidnet.client.admin.zhengzai.kylin.service.impl;
import com.fasterxml.jackson.databind.JsonNode;
import com.liquidnet.commons.lang.util.HttpUtil;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.kylin.entity.KylinOrderTicketEntities;
import com.liquidnet.service.kylin.entity.KylinOrderTickets;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* <p>
* 后台退款 服务实现类
* </p>
*
* @author jiangxiulong
* @since 2021-05-26 13:00 下午
*/
@Service
public class KylinRefundHttpSubmitServiceImpl {
@Async
public void httpApply(KylinOrderTickets orderInfo, List<KylinOrderTicketEntities> entitiesList, HashMap<String, Object> otherParam, String refundBatchId) throws Exception {
String postUrl = "apply";
// 构造退款数据
List<String> ticketEntityIds = null;
if (!entitiesList.isEmpty()) {
for (KylinOrderTicketEntities v : entitiesList) {
String orderTicketsId = v.getOrderTicketEntitiesId();
ticketEntityIds.add(orderTicketsId);
}
}
HashMap<String, Object> refundData = new HashMap();
refundData.put("ticket_entity_ids", ticketEntityIds);
refundData.put("matter_items", new ArrayList()); //搭售不处理
if (ticketEntityIds.isEmpty()) {
throw new Exception("查询详情出错");
}
// 发起退款申请
MultiValueMap<String, String> headers = new LinkedMultiValueMap();
headers.add("Authorization", otherParam.get("token").toString());
MultiValueMap<String, String> formParams = new LinkedMultiValueMap();
formParams.add("order_type", "order_ticket");
formParams.add("order_id", orderInfo.getOrderTicketsId());
formParams.add("batch_id", refundBatchId);
formParams.add("reason", otherParam.get("reason").toString());
formParams.add("refund_data", JsonUtils.toJson(refundData));
/*HashMap<String, Object> postParams = new HashMap();
postParams.put("headers", headers);
postParams.put("form_params", formParams);*/
// 请求提审接口参数
String postResult = HttpUtil.post(postUrl, formParams, headers);
JsonNode postResultNew = JsonUtils.fromJson(postResult, JsonNode.class);
// 请求提审接口结果
if (postResultNew.get("message").toString() != "OK") {
throw new Exception("申请退款出错");
}
}
@Async
public void httpStatus(List<String> refundIds, HashMap<String, Object> otherParam) throws Exception {
String postUrl = "reapply";
// 发起退款申请
MultiValueMap<String, String> headers = new LinkedMultiValueMap();
headers.add("Authorization", otherParam.get("token").toString());
MultiValueMap<String, String> formParams = new LinkedMultiValueMap();
formParams.put("ids", refundIds);
String reject = otherParam.get("reject").toString();
if (reject.isEmpty()) reject = "";
String refuse = otherParam.get("refuse").toString();
if (refuse.isEmpty()) refuse = "";
String status = (String) otherParam.get("status");
if (status.isEmpty()) status = "0";
formParams.add("reject", reject);
formParams.add("status", status);
formParams.add("refuse", refuse);
// 请求提审接口参数
String postResult = HttpUtil.post(postUrl, formParams, headers);
JsonNode postResultNew = JsonUtils.fromJson(postResult, JsonNode.class);
// 请求提审接口结果
if (postResultNew.get("message").toString() != "OK") {
throw new Exception("操作出错");
}
}
}
......@@ -8,6 +8,8 @@ import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.kylin.constant.KylinRedisConst;
import com.liquidnet.service.kylin.constant.KylinTableStatusConst;
import com.liquidnet.service.kylin.dao.OrderRefundBatchDao;
import com.liquidnet.service.kylin.dto.param.RefundBatchApplyParam;
import com.liquidnet.service.kylin.dto.param.RefundBatchSearchParam;
import com.liquidnet.service.kylin.dto.vo.KylinOrderRefundBatchesVo;
import com.liquidnet.service.kylin.dto.vo.KylinPerformanceVo;
import com.liquidnet.service.kylin.entity.KylinOrderRefundBatches;
......@@ -46,25 +48,28 @@ public class KylinRefundPerformancesAdminServiceImpl {
@Autowired
RedisUtil redisUtil;
public Boolean refundBatchApply(String targetId, Integer targetType, Integer authId, String authName, HashMap<String, Object> OtherParam) throws Exception {
public Boolean refundBatchApply(RefundBatchApplyParam refundBatchApplyParam) throws Exception {
String targetId = refundBatchApplyParam.getTargetId();
HashMap<String, Object> priceNum = kylinOrderTicketsMapper.getPriceNum(targetId);
Double totalPrice = (Double) priceNum.get("total_price");
Integer totalNum = (Integer) priceNum.get("total_num");
if (totalPrice < 0 || totalNum < 0) throw new Exception("当前演出暂无需要退款的订单,请确认后重试!");
// 汇总退款
String[] paymentTypeAlipayArray = {"APPALIPAY", "WAPALIPAY", "alipay"};
/*String[] paymentTypeAlipayArray = {"APPALIPAY", "WAPALIPAY", "alipay"};
double totalRefundAlipay = kylinOrderTicketsMapper.getTotalPrice(targetId, "price_actual", paymentTypeAlipayArray);
String[] paymentTypeWepayArray = {"APPWEPAY", "APPLETWEPAY", "WAPWEPAY", "JSWEPAY", "wepay"};
double totalRefundWepay = kylinOrderTicketsMapper.getTotalPrice(targetId, "price_actual", paymentTypeWepayArray);
double totalPriceExpressAlipay = kylinOrderTicketsMapper.getTotalPrice(targetId, "price_express", paymentTypeAlipayArray);
double totalPriceExpressWepay = kylinOrderTicketsMapper.getTotalPrice(targetId, "price_express", paymentTypeWepayArray);
double totalPriceExpressWepay = kylinOrderTicketsMapper.getTotalPrice(targetId, "price_express", paymentTypeWepayArray);*/
KylinOrderRefundBatches refundBatchesInfo = kylinOrderRefundBatchesMapper.selectOne(
new UpdateWrapper<KylinOrderRefundBatches>().eq("target_id", targetId).eq("target_type", targetType).orderByDesc("refund_batch_id")
new UpdateWrapper<KylinOrderRefundBatches>().eq("target_id", targetId).orderByDesc("refund_batch_id")
);
if (refundBatchesInfo.getRefundBatchId().isEmpty() || refundBatchesInfo.getStatus() == KylinTableStatusConst.STATUS_CANCEL || refundBatchesInfo.getStatus() == KylinTableStatusConst.STATUS_FINANCE_ADOPT) {
if (refundBatchesInfo.getRefundBatchId().isEmpty() ||
refundBatchesInfo.getStatus() == KylinTableStatusConst.STATUS_CANCEL ||
refundBatchesInfo.getStatus() == KylinTableStatusConst.STATUS_FINANCE_ADOPT
) {
// 添加演出退款记录
KylinPerformanceVo performancesInfo = (KylinPerformanceVo) redisUtil.hget(KylinRedisConst.PERFORMANCES, targetId);
String refundBatchId = IDGenerator.nextSnowId().toString();
......@@ -76,7 +81,7 @@ public class KylinRefundPerformancesAdminServiceImpl {
int resNum = kylinOrderRefundBatchesMapper.insert(createData);
if (resNum > 0) {
// 开始执行批量提交审核 分批处理退款申请
kylinRefundExecuteServiceImpl.refundBatchApply(targetId, refundBatchId, OtherParam);
kylinRefundExecuteServiceImpl.refundBatchApply(targetId, refundBatchId, refundBatchApplyParam.getReason());
return true;
} else {
return false;
......@@ -86,15 +91,15 @@ public class KylinRefundPerformancesAdminServiceImpl {
}
}
public Boolean refundBatchReapply(String refundBatchId, String remark, HashMap<String, Object> otherParam) throws Exception {
public Boolean refundBatchReapply(RefundBatchApplyParam refundBatchApplyParam) throws Exception {
String refundBatchId = refundBatchApplyParam.getRefundBatchId();
Integer[] paymentTypeAlipayArray = {KylinTableStatusConst.STATUS_OPERATE_REJECT, KylinTableStatusConst.STATUS_FINANCE_REJECT};
KylinOrderRefundBatches refundBatchesInfo = kylinOrderRefundBatchesMapper.selectOne(
new UpdateWrapper<KylinOrderRefundBatches>().eq("refund_batch_id", refundBatchId).in("status", paymentTypeAlipayArray)
);
if (!refundBatchesInfo.getRefundBatchId().isEmpty()) {
// 开始执行批量提交审核 分批处理退款申请
kylinRefundExecuteServiceImpl.refundBatchStatus(refundBatchId, otherParam);
kylinRefundExecuteServiceImpl.refundBatchStatus(refundBatchApplyParam, "reapply");
KylinOrderRefundBatches params = new KylinOrderRefundBatches();
params.setStatus(KylinTableStatusConst.STATUS_APPLY);
......@@ -106,15 +111,15 @@ public class KylinRefundPerformancesAdminServiceImpl {
}
}
public Boolean refundBatchCancel(String refundBatchId, HashMap<String, Object> otherParam) throws Exception {
public Boolean refundBatchCancel(RefundBatchApplyParam refundBatchApplyParam) throws Exception {
String refundBatchId = refundBatchApplyParam.getRefundBatchId();
Integer[] paymentTypeAlipayArray = {KylinTableStatusConst.STATUS_APPLY, KylinTableStatusConst.STATUS_OPERATE_REJECT, KylinTableStatusConst.STATUS_OPERATE_ADOPT, KylinTableStatusConst.STATUS_FINANCE_REJECT};
KylinOrderRefundBatches refundBatchesInfo = kylinOrderRefundBatchesMapper.selectOne(
new UpdateWrapper<KylinOrderRefundBatches>().eq("refund_batch_id", refundBatchId).in("status", paymentTypeAlipayArray)
);
if (!refundBatchesInfo.getRefundBatchId().isEmpty()) {
// 开始执行批量提交审核 分批处理退款申请
kylinRefundExecuteServiceImpl.refundBatchStatus(refundBatchId, otherParam);
kylinRefundExecuteServiceImpl.refundBatchStatus(refundBatchApplyParam, "cancel");
KylinOrderRefundBatches params = new KylinOrderRefundBatches();
params.setStatus(KylinTableStatusConst.STATUS_CANCEL);
......@@ -126,8 +131,9 @@ public class KylinRefundPerformancesAdminServiceImpl {
}
}
public Boolean refundBatchReview(String refundBatchId, HashMap<String, Object> otherParam) throws Exception {
Integer batchStatus = (Integer) otherParam.get("status");
public Boolean refundBatchReview(RefundBatchApplyParam refundBatchApplyParam) throws Exception {
String refundBatchId = refundBatchApplyParam.getRefundBatchId();
Integer batchStatus = refundBatchApplyParam.getStatus();
Integer updateStatus = 0;
if (KylinTableStatusConst.STATUS_OPERATE_REJECT == batchStatus) {// 驳回
updateStatus = KylinTableStatusConst.ORDER_REFUND_STATUS_REJECT;
......@@ -141,8 +147,8 @@ public class KylinRefundPerformancesAdminServiceImpl {
if (!refundBatchesInfo.getRefundBatchId().isEmpty()) {
// 开始执行批量提交审核 分批处理退款申请
otherParam.put("status", updateStatus);
kylinRefundExecuteServiceImpl.refundBatchStatus(refundBatchId, otherParam);
refundBatchApplyParam.setRefundStatus(updateStatus);
kylinRefundExecuteServiceImpl.refundBatchStatus(refundBatchApplyParam, "review");
KylinOrderRefundBatches params = new KylinOrderRefundBatches();
params.setStatus(batchStatus);
......@@ -154,8 +160,9 @@ public class KylinRefundPerformancesAdminServiceImpl {
}
}
public Boolean refundBatchExecute(String refundBatchId, HashMap<String, Object> otherParam) throws Exception {
Integer batchStatus = (Integer) otherParam.get("status");
public Boolean refundBatchExecute(RefundBatchApplyParam refundBatchApplyParam) throws Exception {
String refundBatchId = refundBatchApplyParam.getRefundBatchId();
Integer batchStatus = refundBatchApplyParam.getStatus();
Integer updateStatus = 0;
if (KylinTableStatusConst.STATUS_FINANCE_REJECT == batchStatus) {// 驳回
updateStatus = KylinTableStatusConst.ORDER_REFUND_STATUS_REFUSE;
......@@ -169,8 +176,8 @@ public class KylinRefundPerformancesAdminServiceImpl {
if (!refundBatchesInfo.getRefundBatchId().isEmpty()) {
// 开始执行批量提交审核 分批处理退款申请
otherParam.put("status", updateStatus);
kylinRefundExecuteServiceImpl.refundBatchStatus(refundBatchId, otherParam);
refundBatchApplyParam.setRefundStatus(updateStatus);
kylinRefundExecuteServiceImpl.refundBatchStatus(refundBatchApplyParam, "execute");
KylinOrderRefundBatches params = new KylinOrderRefundBatches();
params.setStatus(batchStatus);
......@@ -194,10 +201,10 @@ public class KylinRefundPerformancesAdminServiceImpl {
return kylinOrderRefundBatchesVo;
}
public PageInfo<OrderRefundBatchDao> refundList(Integer page, Integer size) {
public PageInfo<OrderRefundBatchDao> refundList(RefundBatchSearchParam refundBatchSearchParam) {
PageInfo<OrderRefundBatchDao> pageInfoTmp = null;
try {
PageHelper.startPage(page, size);
PageHelper.startPage(refundBatchSearchParam.getPageNum(), refundBatchSearchParam.getPageSize());
List<OrderRefundBatchDao> voList = kylinOrderRefundBatchesMapper.misRefundBatchList();
pageInfoTmp = new PageInfo(voList);
} catch (Exception e) {
......
package com.liquidnet.service.kylin.entity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
......
......@@ -23,5 +23,5 @@ public interface KylinOrderTicketsMapper extends BaseMapper<KylinOrderTickets> {
Double getTotalPrice(String targetId, String selectFields, String[] paymentType);
// 获取订单和购票信息
List getOrderEntities(String targetId, int mid, int limitNum);
List getOrderList(String targetId, int mid, int limitNum);
}
......@@ -30,7 +30,7 @@
</foreach>
</where>
</select>
<select id="getOrderEntities" resultType="java.util.List">
<select id="getOrderList" resultType="java.util.List">
SELECT o.mid, order_tickets_id, number, price_actual, performance_title
FROM kylin_order_tickets AS o
JOIN kylin_order_ticket_relations AS r ON r.order_id = o.order_tickets_id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment