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

Commit d5565ef9 authored by 胡佳晨's avatar 胡佳晨

退款 时间配置 不能为空

parent a9d36bdd
...@@ -59,7 +59,7 @@ public interface IKylinOrderTicketsService { ...@@ -59,7 +59,7 @@ public interface IKylinOrderTicketsService {
* @param picList 证据截图 * @param picList 证据截图
* @return 是否成功 * @return 是否成功
*/ */
ResponseDto<String> sendOrderRefund(String orderId, String orderTicketEntitiesId, String reason, String picList); String sendOrderRefund(String orderId, String orderTicketEntitiesId, String reason, String picList);
//退款撤回 //退款撤回
ResponseDto<Boolean> orderRefundWithdraw(String orderRefundsId); ResponseDto<Boolean> orderRefundWithdraw(String orderRefundsId);
......
...@@ -100,14 +100,18 @@ public class KylinOrderTicketsController { ...@@ -100,14 +100,18 @@ public class KylinOrderTicketsController {
@PostMapping("sendOrderRefunds") @PostMapping("sendOrderRefunds")
@ApiOperation("发起退款申请") @ApiOperation("发起退款申请")
@ApiResponse(code = 200, message = "接口返回对象参数") @ApiResponse(code = 200, message = "接口返回对象参数")
public ResponseDto<HashMap<String,String>> sendOrderRefund(@RequestParam(value = "orderId", required = true) @NotNull(message = "订单id不能为空") String orderId, public ResponseDto<HashMap<String, String>> sendOrderRefund(@RequestParam(value = "orderId", required = true) @NotNull(message = "订单id不能为空") String orderId,
@RequestParam(value = "orderTicketEntitiesId", required = true) @NotNull(message = "票单id不能为空") String orderTicketEntitiesId, @RequestParam(value = "orderTicketEntitiesId", required = true) @NotNull(message = "票单id不能为空") String orderTicketEntitiesId,
@RequestParam(value = "reason", required = true) @NotNull(message = "退款原因不能为空") String reason, @RequestParam(value = "reason", required = true) @NotNull(message = "退款原因不能为空") String reason,
@RequestParam(value = "picList", required = false) String picList) { @RequestParam(value = "picList", required = false) String picList) {
String orderRefundId = orderTicketsService.sendOrderRefund(orderId, orderTicketEntitiesId, reason, picList).getData(); String orderRefundId = orderTicketsService.sendOrderRefund(orderId, orderTicketEntitiesId, reason, picList);
HashMap<String,String> map = new HashMap<String,String>(); if (orderRefundId.length() > 10) {
map.put("orderRefundsId",orderRefundId); HashMap<String, String> map = new HashMap<String, String>();
map.put("orderRefundsId", orderRefundId);
return ResponseDto.success(map); return ResponseDto.success(map);
} else {
return ResponseDto.failure(orderRefundId);
}
} }
@GetMapping("orderRefundDetails") @GetMapping("orderRefundDetails")
...@@ -115,7 +119,7 @@ public class KylinOrderTicketsController { ...@@ -115,7 +119,7 @@ public class KylinOrderTicketsController {
@ApiResponse(code = 200, message = "接口返回对象参数") @ApiResponse(code = 200, message = "接口返回对象参数")
public ResponseDto<OrderRefundVo> orderRefundDetails(@RequestParam(value = "orderId", required = true) @NotNull(message = "订单id不能为空") String orderId, public ResponseDto<OrderRefundVo> orderRefundDetails(@RequestParam(value = "orderId", required = true) @NotNull(message = "订单id不能为空") String orderId,
@RequestParam(value = "orderRefundId", required = true) @NotNull(message = "退款订单id不能为空") String orderRefundId) { @RequestParam(value = "orderRefundId", required = true) @NotNull(message = "退款订单id不能为空") String orderRefundId) {
return orderTicketsService.orderRefundDetails(orderId, orderRefundId)==null?ResponseDto.failure("获取失败"):ResponseDto.success(orderTicketsService.orderRefundDetails(orderId, orderRefundId)); return orderTicketsService.orderRefundDetails(orderId, orderRefundId) == null ? ResponseDto.failure("获取失败") : ResponseDto.success(orderTicketsService.orderRefundDetails(orderId, orderRefundId));
} }
@PostMapping("orderRefundWithdraw") @PostMapping("orderRefundWithdraw")
......
...@@ -1142,7 +1142,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService { ...@@ -1142,7 +1142,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService {
} }
@Override @Override
public ResponseDto<String> sendOrderRefund(String orderId, String orderTicketEntitiesId, String reason, String picList) { public String sendOrderRefund(String orderId, String orderTicketEntitiesId, String reason, String picList) {
KylinOrderTicketEntitiesVo orderTicketEntitiesVo = null; KylinOrderTicketEntitiesVo orderTicketEntitiesVo = null;
try { try {
String uid = CurrentUtil.getCurrentUid(); String uid = CurrentUtil.getCurrentUid();
...@@ -1150,7 +1150,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService { ...@@ -1150,7 +1150,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService {
List<KylinOrderRefundsVo> kylinOrderRefundsVoBaseList = dataUtils.getOrderRefundVoByOrderId(orderTicketVo.getOrderTicketsId()); List<KylinOrderRefundsVo> kylinOrderRefundsVoBaseList = dataUtils.getOrderRefundVoByOrderId(orderTicketVo.getOrderTicketsId());
if (!orderTicketVo.getUserId().equals(uid)) { if (!orderTicketVo.getUserId().equals(uid)) {
return ResponseDto.failure(ErrorMapping.get("20003")); return "无权查看";
} }
List<KylinOrderTicketEntitiesVo> entitiesVos = orderTicketVo.getEntitiesVoList(); List<KylinOrderTicketEntitiesVo> entitiesVos = orderTicketVo.getEntitiesVoList();
...@@ -1160,25 +1160,24 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService { ...@@ -1160,25 +1160,24 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService {
} }
} }
if (null == orderTicketEntitiesVo) { if (null == orderTicketEntitiesVo) {
return ResponseDto.failure(ErrorMapping.get("20004")); return "订单不存在";
} }
BigDecimal refundSinglePrice = dataUtils.getCanRefundOrderEntitiesPrice(orderTicketVo, kylinOrderRefundsVoBaseList, orderTicketEntitiesId); BigDecimal refundSinglePrice = dataUtils.getCanRefundOrderEntitiesPrice(orderTicketVo, kylinOrderRefundsVoBaseList, orderTicketEntitiesId);
log.debug("REFUNDSINGLE : "+refundSinglePrice);
if (refundSinglePrice.compareTo(BigDecimal.ZERO)>0) { if (refundSinglePrice.compareTo(BigDecimal.ZERO)>0) {
return ResponseDto.failure(ErrorMapping.get("20022")); return "申请金额不得小于0";
} }
Map token = CurrentUtil.getTokenClaims(); Map token = CurrentUtil.getTokenClaims();
String username = StringUtils.defaultString(((String) token.get("nickname")), ""); String username = StringUtils.defaultString(((String) token.get("nickname")), "");
String result = refundsStatusService.userOrderTicketRefunding(orderTicketVo, refundSinglePrice.doubleValue(), orderTicketEntitiesId, reason, picList, uid, username, kylinOrderRefundsVoBaseList.size()); String result = refundsStatusService.userOrderTicketRefunding(orderTicketVo, refundSinglePrice.doubleValue(), orderTicketEntitiesId, reason, picList, uid, username, kylinOrderRefundsVoBaseList.size());
if (result != "") { if (result != "") {
return ResponseDto.success(result); return result;
} else { } else {
return ResponseDto.failure(ErrorMapping.get("20019")); return "申请失败";
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return ResponseDto.failure(ErrorMapping.get("20019")); return "申请失败";
} }
} }
......
...@@ -247,12 +247,14 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService { ...@@ -247,12 +247,14 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService {
int surplusGeneral = dataUtils.changeSurplusGeneral(payOrderParam.getTicketId(), -payOrderParam.getNumber()); int surplusGeneral = dataUtils.changeSurplusGeneral(payOrderParam.getTicketId(), -payOrderParam.getNumber());
currentTime = System.currentTimeMillis() - currentTime; currentTime = System.currentTimeMillis() - currentTime;
log.debug("redis 获取库存 -> time:" + (currentTime) + "毫秒"); log.debug("redis 获取库存 -> time:" + (currentTime) + "毫秒");
log.debug("TAG_REDIS 正常 剩余库存 -> count:" + surplusGeneral);
if (surplusGeneral < 0) {//库存回滚 if (surplusGeneral < 0) {//库存回滚
currentTime = System.currentTimeMillis(); currentTime = System.currentTimeMillis();
dataUtils.changeSurplusGeneral(payOrderParam.getTicketId(), payOrderParam.getNumber()); dataUtils.changeSurplusGeneral(payOrderParam.getTicketId(), payOrderParam.getNumber());
currentTime = System.currentTimeMillis() - currentTime; currentTime = System.currentTimeMillis() - currentTime;
log.debug("redis 修改库存 售罄 -> time:" + (currentTime) + "毫秒"); log.debug("redis 修改库存 售罄 -> time:" + (currentTime) + "毫秒");
log.debug("TAG_REDIS 售罄 回滚库存1 -> count:" + payOrderParam.getNumber());
// redisLockUtil.unlock(lock); // redisLockUtil.unlock(lock);
return ResponseDto.failure(ErrorMapping.get("20016"));//没抢到 return ResponseDto.failure(ErrorMapping.get("20016"));//没抢到
} else { } else {
...@@ -270,6 +272,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService { ...@@ -270,6 +272,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService {
if (age > 25) { if (age > 25) {
// redisLockUtil.unlock(lock); // redisLockUtil.unlock(lock);
dataUtils.changeSurplusGeneral(payOrderParam.getTicketId(), payOrderParam.getNumber()); dataUtils.changeSurplusGeneral(payOrderParam.getTicketId(), payOrderParam.getNumber());
log.debug("TAG_REDIS 学生票 回滚库存2 -> count:" + payOrderParam.getNumber());
return ResponseDto.failure(ErrorMapping.get("20017"));//年龄超了 return ResponseDto.failure(ErrorMapping.get("20017"));//年龄超了
} }
} }
...@@ -287,6 +290,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService { ...@@ -287,6 +290,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService {
if (!res1.equals("")) { if (!res1.equals("")) {
// redisLockUtil.unlock(lock); // redisLockUtil.unlock(lock);
dataUtils.changeSurplusGeneral(payOrderParam.getTicketId(), payOrderParam.getNumber()); dataUtils.changeSurplusGeneral(payOrderParam.getTicketId(), payOrderParam.getNumber());
log.debug("TAG_REDIS 限购 回滚库存3 -> count:" + payOrderParam.getNumber());
return ResponseDto.failure(res1);//乱七八糟异常 return ResponseDto.failure(res1);//乱七八糟异常
} }
} }
...@@ -300,6 +304,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService { ...@@ -300,6 +304,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService {
if (!res1.equals("")) { if (!res1.equals("")) {
// redisLockUtil.unlock(lock); // redisLockUtil.unlock(lock);
dataUtils.changeSurplusGeneral(payOrderParam.getTicketId(), payOrderParam.getNumber()); dataUtils.changeSurplusGeneral(payOrderParam.getTicketId(), payOrderParam.getNumber());
log.debug("TAG_REDIS 限购 回滚库存3 -> count:" + payOrderParam.getNumber());
return ResponseDto.failure(res1);//乱七八糟异常 return ResponseDto.failure(res1);//乱七八糟异常
} }
currentTime = System.currentTimeMillis() - currentTime; currentTime = System.currentTimeMillis() - currentTime;
...@@ -316,6 +321,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService { ...@@ -316,6 +321,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService {
if (isDownGeneral) { if (isDownGeneral) {
currentTime = System.currentTimeMillis(); currentTime = System.currentTimeMillis();
dataUtils.changeSurplusGeneral(payOrderParam.getTicketId(), payOrderParam.getNumber()); dataUtils.changeSurplusGeneral(payOrderParam.getTicketId(), payOrderParam.getNumber());
log.debug("TAG_REDIS 异常 回滚库存4 -> count:" + payOrderParam.getNumber());
currentTime = System.currentTimeMillis() - currentTime; currentTime = System.currentTimeMillis() - currentTime;
log.debug("redis 修改库存 异常 -> time:" + (currentTime) + "毫秒"); log.debug("redis 修改库存 异常 -> time:" + (currentTime) + "毫秒");
for (AdamEntersVo enters : entersVoList) { for (AdamEntersVo enters : entersVoList) {
...@@ -973,7 +979,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService { ...@@ -973,7 +979,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService {
} }
@Override @Override
public ResponseDto<String> sendOrderRefund(String orderId, String orderTicketEntitiesId, String reason, String picList) { public String sendOrderRefund(String orderId, String orderTicketEntitiesId, String reason, String picList) {
return null; return null;
} }
......
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