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

Commit aa1a62a7 authored by 张国柄's avatar 张国柄

Merge remote-tracking branch 'origin/dev' into dev

parents f6f0e133 f16af52b
......@@ -157,7 +157,6 @@ public class KylinOrderRefundAdminController extends BaseController {
return error("审核退款失败");
}
} catch (Exception e) {
e.printStackTrace();
return error(e.getMessage());
}
}
......
......@@ -77,6 +77,8 @@ public class KylinOrderRefundBatchAdminController extends BaseController {
@PostMapping("reapply")
@ResponseBody
public AjaxResult refundBatchReApply(RefundBatchApplyParam refundBatchApplyParam) {
String ids = refundBatchApplyParam.getIds();
refundBatchApplyParam.setRefundBatchId(ids);
try {
Boolean res = kylinRefundPerformancesAdminServiceImpl.refundBatchReapply(refundBatchApplyParam);
if (res) {
......
......@@ -215,6 +215,7 @@
detailUrl: prefix + "/details/{id}",
cancelUrl: prefix + "/cancel",
reapplyUrl: prefix + "/reapply",
modalName: "-订单退款",
columns: [{
checkbox: true
},
......
......@@ -113,7 +113,7 @@
return false;
}
data['reject'] = remark;
data['status'] = 1;
data['status'] = 4;
$.operate.save(prefix + "/review", data);
layer.close(index)
},
......@@ -124,7 +124,7 @@
return false;
}
data['reject'] = remark;
data['status'] = 5;
data['status'] = 3;
$.operate.save(prefix + "/review", data);
}
});
......@@ -147,7 +147,7 @@
return false;
}
data['refuse'] = remark;
data['status'] = 7;
data['status'] = 6;
$.operate.save(prefix + "/execute", data);
layer.close(index)
},
......@@ -158,7 +158,7 @@
return false;
}
data['refuse'] = remark;
data['status'] = 8;
data['status'] = 5;
$.operate.save(prefix + "/execute", data);
// return false;
}
......@@ -171,6 +171,7 @@
detailUrl: prefix + "/details/{id}",
cancelUrl: prefix + "/cancel",
reapplyUrl: prefix + "/reapply",
modalName: "-演出退款",
columns: [{
checkbox: true
},
......
......@@ -60,9 +60,6 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
@Autowired
MongoTemplate mongoTemplate;
@Autowired
private DataUtils dataUtils;
public Boolean refundApply(RefundApplyParam refundApplyParam) throws Exception {
/*int count = 0;
count = kylinOrderTicketsMapper.selectCount(
......@@ -189,6 +186,9 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
public Boolean refundApproved(RefundApplyParam refundApplyParam) throws Exception {
List<String> orderRefundsIdList = refundApplyParam.getIds();
if (orderRefundsIdList.size() <= 0) {
throw new Exception("无退款订单");
}
String reject = refundApplyParam.getReject();
Integer[] orderRefundStatus = {KylinTableStatusConst.ORDER_REFUND_STATUS_APPLY, KylinTableStatusConst.ORDER_REFUND_STATUS_REJECT, KylinTableStatusConst.ORDER_REFUND_STATUS_REFUSE};
List<KylinOrderRefunds> refundList = kylinOrderRefundsMapper.selectList(
......
......@@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.List;
import java.util.stream.Collectors;
......@@ -44,7 +45,6 @@ public class KylinRefundExecuteServiceImpl {
@Autowired
private KylinOrderRefundsServiceImpl kylinOrderRefundsServiceImpl;
@Async
public void refundBatchApply(String targetId, String refundBatchId, String reason) throws Exception {
RefundApplyParam refundApplyParam = new RefundApplyParam();
int count;
......@@ -56,15 +56,17 @@ public class KylinRefundExecuteServiceImpl {
for (KylinOrderTickets order : orderList) {
List<KylinOrderTicketEntities> entitiesList = kylinOrderTicketEntitiesMapper.selectList(
new UpdateWrapper<KylinOrderTicketEntities>().eq("order_id", order.getOrderTicketsId())
.eq("is_payment", "yes")
.eq("is_payment", 1)
);
List<String> ticketEntityIds = entitiesList.stream().map(KylinOrderTicketEntities -> KylinOrderTicketEntities.getOrderTicketEntitiesId()).collect(Collectors.toList());
// 请求php接口
refundApplyParam.setOrderRefundBatchesId(refundBatchId);
refundApplyParam.setReason(reason);
refundApplyParam.setOrderTicketsId(order.getOrderTicketsId());
refundApplyParam.setTicketEntityIds(ticketEntityIds);
refundApplyParam.setRefundPriceExpress(order.getPriceExpress().doubleValue());
if (order.getPriceExpress() != null) {
refundApplyParam.setRefundPriceExpress(order.getPriceExpress().doubleValue());
}
Boolean res = kylinOrderRefundsServiceImpl.refundApply(refundApplyParam);
}
......@@ -74,10 +76,9 @@ public class KylinRefundExecuteServiceImpl {
} while (count >= limitNum);
}
@Async
public void refundBatchStatus(RefundBatchApplyParam refundBatchApplyParam, String type) throws Exception {
String refundBatchId = refundBatchApplyParam.getRefundBatchId();
Integer status = refundBatchApplyParam.getStatus();
Integer status = refundBatchApplyParam.getRefundStatus();
// 处理查询订单状态
Integer[] whereStatus = {};
Integer whereType = KylinTableStatusConst.ORDER_REFUND_TYPE_APPLY;
......@@ -108,14 +109,14 @@ public class KylinRefundExecuteServiceImpl {
throw new Exception("type异常,无法操作");
}
int count;
int count = 0;
int limitNum = 1;
int mid = 0;
do {
List<KylinOrderRefunds> refundList = kylinOrderRefundsMapper.getRefundList(whereType, refundBatchId, whereStatus, mid, limitNum);
List<String> refundIds = null;
if (!refundList.isEmpty()) {
if (refundList != null && refundList.size()>0) {
refundIds = refundList.stream().map(KylinOrderRefunds -> KylinOrderRefunds.getOrderRefundsId()).collect(Collectors.toList());
RefundApplyParam refundApplyParam = new RefundApplyParam();
......@@ -151,8 +152,12 @@ public class KylinRefundExecuteServiceImpl {
}
count = refundList.size();
KylinOrderRefunds lastInfo = refundList.get(count - 1);
mid = lastInfo.getMid();
if (count > 0){
KylinOrderRefunds lastInfo = refundList.get(count - 1);
if (lastInfo != null) {
mid = lastInfo.getMid();
}
}
} while (count >= limitNum);
}
......
package com.liquidnet.client.admin.zhengzai.kylin.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.liquidnet.client.admin.zhengzai.kylin.utils.DataUtils;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.kylin.constant.KylinRedisConst;
......@@ -51,10 +53,10 @@ public class KylinRefundPerformancesAdminServiceImpl {
public Boolean refundBatchApply(RefundBatchApplyParam refundBatchApplyParam) throws Exception {
String targetId = refundBatchApplyParam.getTargetId();
HashMap<String, Object> priceNum = kylinOrderTicketsMapper.getPriceNum(targetId);
if (priceNum != null) {
Double totalPrice = (Double) priceNum.get("total_price");
Integer totalNum = (Integer) priceNum.get("total_num");
if (totalPrice < 0 || totalNum < 0) throw new Exception("当前演出暂无需要退款的订单,请确认后重试!");
if (null != priceNum) {
double totalPrice = Double.parseDouble(priceNum.get("total_price").toString());
Integer totalNum = Integer.parseInt(priceNum.get("total_num").toString());
if (totalPrice <= 0 || totalNum <= 0) throw new Exception("当前演出暂无需要退款的订单,请确认后重试!");
} else {
throw new Exception("当前演出暂无需要退款的订单,请确认后重试!");
}
......@@ -69,18 +71,19 @@ public class KylinRefundPerformancesAdminServiceImpl {
double totalPriceExpressWepay = kylinOrderTicketsMapper.getTotalPrice(targetId, "price_express", paymentTypeWepayArray);*/
KylinOrderRefundBatches refundBatchesInfo = kylinOrderRefundBatchesMapper.selectOne(
new UpdateWrapper<KylinOrderRefundBatches>().eq("target_id", targetId).orderByDesc("refund_batch_id")
new QueryWrapper<KylinOrderRefundBatches>().eq("target_id", targetId).orderByDesc("refund_batch_id")
);
if (refundBatchesInfo.getRefundBatchId().isEmpty() ||
if (refundBatchesInfo == null ||
refundBatchesInfo.getStatus() == KylinTableStatusConst.STATUS_CANCEL ||
refundBatchesInfo.getStatus() == KylinTableStatusConst.STATUS_FINANCE_ADOPT
) {
// 添加演出退款记录
KylinPerformanceVo performancesInfo = (KylinPerformanceVo) redisUtil.hget(KylinRedisConst.PERFORMANCES, targetId);
String refundBatchId = IDGenerator.nextSnowId().toString();
KylinOrderRefundBatches createData = new KylinOrderRefundBatches();
createData.setRefundBatchId(refundBatchId);
createData.setTargetId(targetId);
createData.setCreatedAt(LocalDateTime.now());
createData.setStatus(KylinTableStatusConst.STATUS_APPLY);
int resNum = kylinOrderRefundBatchesMapper.insert(createData);
......@@ -102,7 +105,7 @@ public class KylinRefundPerformancesAdminServiceImpl {
KylinOrderRefundBatches refundBatchesInfo = kylinOrderRefundBatchesMapper.selectOne(
new UpdateWrapper<KylinOrderRefundBatches>().eq("refund_batch_id", refundBatchId).in("status", paymentTypeAlipayArray)
);
if (!refundBatchesInfo.getRefundBatchId().isEmpty()) {
if (null != refundBatchesInfo) {
// 开始执行批量提交审核 分批处理退款申请
kylinRefundExecuteServiceImpl.refundBatchStatus(refundBatchApplyParam, "reapply");
......@@ -118,11 +121,11 @@ public class KylinRefundPerformancesAdminServiceImpl {
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};
Integer[] paymentTypeAlipayArray = {KylinTableStatusConst.STATUS_APPLY, 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()) {
if (null != refundBatchesInfo) {
// 开始执行批量提交审核 分批处理退款申请
kylinRefundExecuteServiceImpl.refundBatchStatus(refundBatchApplyParam, "cancel");
......@@ -149,15 +152,17 @@ public class KylinRefundPerformancesAdminServiceImpl {
KylinOrderRefundBatches refundBatchesInfo = kylinOrderRefundBatchesMapper.selectOne(
new UpdateWrapper<KylinOrderRefundBatches>().eq("refund_batch_id", refundBatchId).in("status", paymentTypeAlipayArray)
);
if (!refundBatchesInfo.getRefundBatchId().isEmpty()) {
if (null != refundBatchesInfo) {
// 开始执行批量提交审核 分批处理退款申请
refundBatchApplyParam.setRefundStatus(updateStatus);
kylinRefundExecuteServiceImpl.refundBatchStatus(refundBatchApplyParam, "review");
KylinOrderRefundBatches params = new KylinOrderRefundBatches();
params.setStatus(batchStatus);
kylinOrderRefundBatchesMapper.update(params, new UpdateWrapper<KylinOrderRefundBatches>().eq("refund_batch_id", refundBatchId));
kylinOrderRefundBatchesMapper.update(
params,
new UpdateWrapper<KylinOrderRefundBatches>().eq("refund_batch_id", refundBatchId)
);
return true;
} else {
......@@ -174,12 +179,11 @@ public class KylinRefundPerformancesAdminServiceImpl {
} else if (KylinTableStatusConst.STATUS_FINANCE_ADOPT == batchStatus) {// 通过
updateStatus = KylinTableStatusConst.ORDER_REFUND_STATUS_UNFILLED;
}
Integer[] paymentTypeAlipayArray = {KylinTableStatusConst.STATUS_APPLY};
Integer[] paymentTypeAlipayArray = {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()) {
if (null != refundBatchesInfo) {
// 开始执行批量提交审核 分批处理退款申请
refundBatchApplyParam.setRefundStatus(updateStatus);
kylinRefundExecuteServiceImpl.refundBatchStatus(refundBatchApplyParam, "execute");
......
......@@ -26,6 +26,8 @@ import com.liquidnet.service.kylin.mapper.KylinOrderTicketsMapper;
import com.mongodb.BasicDBObject;
import com.mongodb.client.model.FindOneAndUpdateOptions;
import com.mongodb.client.model.ReturnDocument;
import com.sun.media.jfxmedia.logging.Logger;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpException;
import org.bson.Document;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -49,6 +51,7 @@ import java.util.stream.Collectors;
* @author jiaangxiulong
* @since 2021-05-26
*/
@Slf4j
@Service
public class KylinRefundsStatusServiceImpl {
......@@ -341,7 +344,8 @@ public class KylinRefundsStatusServiceImpl {
// start
// TODO: 2021/5/31 待整理
String postResult = HttpUtil.post(postUrl, params);
String postResult = null;
postResult = HttpUtil.post(postUrl, params);
JsonNode postResultNew = JsonUtils.fromJson(postResult, JsonNode.class);
// 请求提审接口结果
if (postResultNew.get("message").toString() != "OK") {
......
......@@ -22,7 +22,10 @@ liquidnet:
knife4j:
disable: false
redis:
host: r-2zefzyjbij5vbez65y.redis.rds.aliyuncs.com
# host: r-2zefzyjbij5vbez65y.redis.rds.aliyuncs.com
# port: 6380
# password: PO@B!Iud32
host: r-2ze7002ckw5u75fguk.redis.rds.aliyuncs.com
port: 6380
password: PO@B!Iud32
mongodb:
......
......@@ -28,6 +28,7 @@ public class OrderRefundDao implements Serializable {
private BigDecimal price;
private Integer status;
private String statusName;
private Integer type;
......
......@@ -3,6 +3,7 @@ package com.liquidnet.service.kylin.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.liquidnet.service.kylin.dao.OrderRefundDao;
import com.liquidnet.service.kylin.entity.KylinOrderRefunds;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
......@@ -16,9 +17,16 @@ import java.util.Map;
* @since 2021-05-26
*/
public interface KylinOrderRefundsMapper extends BaseMapper<KylinOrderRefunds> {
List<KylinOrderRefunds> getRefundList(Integer whereType, String refundBatchId, Integer[] whereStatus, int mid, int limitNum);
List<KylinOrderRefunds> getRefundList(
@Param("whereType") Integer whereType,
@Param("refundBatchId") String refundBatchId,
@Param("whereStatus") Integer[] whereStatus,
@Param("mid") int mid,
@Param("limitNum") int limitNum
);
double refundedTotalPrice(String orderTicketsId);
List<OrderRefundDao> misRefundList(Map<String,Object> map);
}
......@@ -2,6 +2,7 @@ package com.liquidnet.service.kylin.mapper;
import com.liquidnet.service.kylin.entity.KylinOrderTickets;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.HashMap;
import java.util.List;
......@@ -23,5 +24,5 @@ public interface KylinOrderTicketsMapper extends BaseMapper<KylinOrderTickets> {
Double getTotalPrice(String targetId, String selectFields, String[] paymentType);
// 获取订单和购票信息
List getOrderList(String targetId, int mid, int limitNum);
List<KylinOrderTickets> getOrderList(@Param("targetId") String targetId, @Param("mid") int mid, @Param("limitNum") int limitNum);
}
......@@ -2,10 +2,21 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.liquidnet.service.kylin.mapper.KylinOrderRefundsMapper">
<select id="getRefundList" parameterType="java.lang.String" resultType="com.liquidnet.service.kylin.entity.KylinOrderRefunds">
SELECT order_refunds_id
<select id="getRefundList" resultType="com.liquidnet.service.kylin.entity.KylinOrderRefunds">
SELECT order_refunds_id, mid
FROM kylin_order_refunds
<where>
order_refund_batches_id=${refundBatchId}
AND type=${whereType}
AND mid>${mid}
AND status IN
<foreach collection="whereStatus" item="where_status" index="index" open="(" close=")" separator=",">
${where_status}
</foreach>
</where>
LIMIT ${limitNum}
</select>
<select id="refundedTotalPrice" resultType="java.lang.Double">
SELECT SUM('price')
FROM kylin_order_refunds
......
......@@ -3,7 +3,7 @@
<mapper namespace="com.liquidnet.service.kylin.mapper.KylinOrderTicketsMapper">
<select id="getPriceNum" resultType="java.util.HashMap">
SELECT SUM('o.price_actual') as total_price, SUM('o.number') as total_num
SELECT SUM(o.price_actual) as total_price, SUM(o.number) as total_num
FROM kylin_order_tickets AS o
JOIN kylin_order_ticket_relations AS r ON r.order_id = o.order_tickets_id
JOIN kylin_order_ticket_status AS s ON s.order_id = o.order_tickets_id
......@@ -13,6 +13,7 @@
AND s.pay_status=1
AND o.coupon_type='no'
</where>
LIMIT 1
</select>
<select id="getTotalPrice" resultType="java.lang.Double">
SELECT SUM(${selectFields})
......@@ -30,18 +31,18 @@
</foreach>
</where>
</select>
<select id="getOrderList" resultType="java.util.List">
<select id="getOrderList" parameterType="java.lang.String" resultType="com.liquidnet.service.kylin.entity.KylinOrderTickets">
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
JOIN kylin_order_ticket_status AS s ON s.order_id = o.order_tickets_id
<where>
r.performance_id=#{targetId}
r.performance_id=${targetId}
AND s.status=1
AND s.pay_status=1
AND o.coupon_type='no'
AND o.mid>#{mid}
AND o.mid>${mid}
</where>
LIMIT #{limitNum}
LIMIT ${limitNum}
</select>
</mapper>
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