|
@@ -5,6 +5,8 @@ import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hutool.core.convert.Convert;
|
|
import cn.hutool.core.convert.Convert;
|
|
|
import cn.hutool.core.map.MapUtil;
|
|
import cn.hutool.core.map.MapUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
|
|
+import com.qnfhq.annotation.RepeatSubmit;
|
|
|
import com.qnfhq.common.ApiBaseController;
|
|
import com.qnfhq.common.ApiBaseController;
|
|
|
import com.qnfhq.common.constant.Constant;
|
|
import com.qnfhq.common.constant.Constant;
|
|
|
import com.qnfhq.common.exception.ErrorCode;
|
|
import com.qnfhq.common.exception.ErrorCode;
|
|
@@ -23,11 +25,14 @@ import com.qnfhq.modules.c2c.enums.DirectionEnum;
|
|
|
import com.qnfhq.modules.c2c.service.*;
|
|
import com.qnfhq.modules.c2c.service.*;
|
|
|
import com.qnfhq.modules.user.entity.AppAssetEntity;
|
|
import com.qnfhq.modules.user.entity.AppAssetEntity;
|
|
|
import com.qnfhq.modules.user.entity.AppUserDetailEntity;
|
|
import com.qnfhq.modules.user.entity.AppUserDetailEntity;
|
|
|
|
|
+import com.qnfhq.modules.user.entity.AppUserEntity;
|
|
|
import com.qnfhq.modules.user.enums.AssetEnum;
|
|
import com.qnfhq.modules.user.enums.AssetEnum;
|
|
|
import com.qnfhq.modules.user.enums.AuditStatusEnum;
|
|
import com.qnfhq.modules.user.enums.AuditStatusEnum;
|
|
|
import com.qnfhq.modules.user.service.AppAssetService;
|
|
import com.qnfhq.modules.user.service.AppAssetService;
|
|
|
import com.qnfhq.modules.user.service.AppUserDetailService;
|
|
import com.qnfhq.modules.user.service.AppUserDetailService;
|
|
|
|
|
+import com.qnfhq.modules.user.service.AppUserService;
|
|
|
import com.qnfhq.utils.DistributedRedisLock;
|
|
import com.qnfhq.utils.DistributedRedisLock;
|
|
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
import jakarta.annotation.Resource;
|
|
import jakarta.annotation.Resource;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -45,9 +50,12 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
*/
|
|
*/
|
|
|
@Slf4j
|
|
@Slf4j
|
|
|
@RestController
|
|
@RestController
|
|
|
-@RequestMapping("user/c2corder")
|
|
|
|
|
|
|
+@RequestMapping("/c2corder")
|
|
|
@Tag(name="c2c订单")
|
|
@Tag(name="c2c订单")
|
|
|
public class C2cOrderController extends ApiBaseController {
|
|
public class C2cOrderController extends ApiBaseController {
|
|
|
|
|
+ private final static String LOCK_C2C_ORDER = "lock_c2c_order";
|
|
|
|
|
+ private final static String LOCK_C2C_AD = "lock_c2c_ad:";
|
|
|
|
|
+
|
|
|
@Resource
|
|
@Resource
|
|
|
private C2cOrderService c2cOrderService;
|
|
private C2cOrderService c2cOrderService;
|
|
|
|
|
|
|
@@ -63,14 +71,13 @@ public class C2cOrderController extends ApiBaseController {
|
|
|
@Resource
|
|
@Resource
|
|
|
private C2cPaymentVoucherService c2cPaymentVoucherService;
|
|
private C2cPaymentVoucherService c2cPaymentVoucherService;
|
|
|
|
|
|
|
|
- private final static String LOCK_C2C_ORDER = "lock_c2c_order";
|
|
|
|
|
- private final static String LOCK_C2C_AD = "lock_c2c_ad:";
|
|
|
|
|
@Resource
|
|
@Resource
|
|
|
private RedisUtils redisUtils;
|
|
private RedisUtils redisUtils;
|
|
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
|
private DistributedRedisLock distributedRedisLock;
|
|
private DistributedRedisLock distributedRedisLock;
|
|
|
- @Autowired
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @Resource
|
|
|
private C2cUserReceiptService c2cUserReceiptService;
|
|
private C2cUserReceiptService c2cUserReceiptService;
|
|
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
@@ -78,8 +85,8 @@ public class C2cOrderController extends ApiBaseController {
|
|
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
|
private C2cOrderComplainVoucherService orderComplainVoucherService;
|
|
private C2cOrderComplainVoucherService orderComplainVoucherService;
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private AppUserService appUserService;
|
|
|
|
|
|
|
|
private String getC2cAdLockKey(String adId) {
|
|
private String getC2cAdLockKey(String adId) {
|
|
|
return new StringBuilder(LOCK_C2C_AD).append(adId).toString();
|
|
return new StringBuilder(LOCK_C2C_AD).append(adId).toString();
|
|
@@ -89,17 +96,9 @@ public class C2cOrderController extends ApiBaseController {
|
|
|
return new StringBuilder(LOCK_C2C_ORDER).append(oId).toString();
|
|
return new StringBuilder(LOCK_C2C_ORDER).append(oId).toString();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 下单,
|
|
|
|
|
- * 1 判断用户是有进行中的订单, 缓存时间24小时, 完成订单才能继续下单
|
|
|
|
|
- * 2 校验入参
|
|
|
|
|
- * 3 校验广告可用
|
|
|
|
|
- * 4 实名认证
|
|
|
|
|
- * @param c2cOrder
|
|
|
|
|
- * @return
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ @Operation(summary = "c2c下单")
|
|
|
@PostMapping("/create")
|
|
@PostMapping("/create")
|
|
|
-// @RepeatSubmit(interval = 3000, message = "请求过于频繁")
|
|
|
|
|
|
|
+ @RepeatSubmit(interval = 3000, message = "请求过于频繁")
|
|
|
public Result create(@RequestBody C2cOrderCreateDTO c2cOrder) {
|
|
public Result create(@RequestBody C2cOrderCreateDTO c2cOrder) {
|
|
|
Result result = new Result();
|
|
Result result = new Result();
|
|
|
ValidatorUtils.validateEntity(c2cOrder);
|
|
ValidatorUtils.validateEntity(c2cOrder);
|
|
@@ -129,7 +128,7 @@ public class C2cOrderController extends ApiBaseController {
|
|
|
//实名认证
|
|
//实名认证
|
|
|
long loginUserId = StpUtil.getLoginIdAsLong();
|
|
long loginUserId = StpUtil.getLoginIdAsLong();
|
|
|
AppUserDetailEntity appUserDetail = appUserDetailService.selectAppUserDetailByUserId(loginUserId);
|
|
AppUserDetailEntity appUserDetail = appUserDetailService.selectAppUserDetailByUserId(loginUserId);
|
|
|
- if(appUserDetail==null || appUserDetail.getAuditStatus().intValue() == AuditStatusEnum.EXAMINATION_PASSED.getCode().intValue()) {
|
|
|
|
|
|
|
+ if(appUserDetail==null || appUserDetail.getAuditStatus().intValue() != AuditStatusEnum.EXAMINATION_PASSED.getCode().intValue()) {
|
|
|
return result.error(ErrorCode.SHIMING_VERIFY,MessageUtils.message("user.authentication.not.certified"));//请先进行实名认证
|
|
return result.error(ErrorCode.SHIMING_VERIFY,MessageUtils.message("user.authentication.not.certified"));//请先进行实名认证
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -140,6 +139,11 @@ public class C2cOrderController extends ApiBaseController {
|
|
|
tAppAsset.setSymbol(c2cOrder.getSymbol());
|
|
tAppAsset.setSymbol(c2cOrder.getSymbol());
|
|
|
tAppAsset.setType(AssetEnum.PLATFORM_ASSETS.getCode());
|
|
tAppAsset.setType(AssetEnum.PLATFORM_ASSETS.getCode());
|
|
|
List<AppAssetEntity> assetList = appAssetService.selectList(tAppAsset);
|
|
List<AppAssetEntity> assetList = appAssetService.selectList(tAppAsset);
|
|
|
|
|
+ if(assetList==null || assetList.size()==0) {
|
|
|
|
|
+ AppUserEntity user = appUserService.getUserByUserId(loginUserId);
|
|
|
|
|
+ appUserService.initAppUserAsset(user);
|
|
|
|
|
+ return error(MessageUtils.message("c2c.order.availableAmount.buzu"));//您的可用资产不足
|
|
|
|
|
+ }
|
|
|
AppAssetEntity sellerAsset = assetList.get(0);
|
|
AppAssetEntity sellerAsset = assetList.get(0);
|
|
|
if(sellerAsset.getAvailable().compareTo(c2cOrder.getTranAmount())==-1) {
|
|
if(sellerAsset.getAvailable().compareTo(c2cOrder.getTranAmount())==-1) {
|
|
|
return error(MessageUtils.message("c2c.order.availableAmount.insufficient"));//您的可用资产必须大于卖出数量
|
|
return error(MessageUtils.message("c2c.order.availableAmount.insufficient"));//您的可用资产必须大于卖出数量
|
|
@@ -223,9 +227,7 @@ public class C2cOrderController extends ApiBaseController {
|
|
|
return error(MessageUtils.message("operation.fail.please.refresh"));//操作失败,请刷新后重试
|
|
return error(MessageUtils.message("operation.fail.please.refresh"));//操作失败,请刷新后重试
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 买家查询我的订单信息 (进行中的)
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ @Operation(summary = "查询进行中的订单")
|
|
|
@PostMapping("/myOrder")
|
|
@PostMapping("/myOrder")
|
|
|
public Result myOrder()
|
|
public Result myOrder()
|
|
|
{
|
|
{
|
|
@@ -251,14 +253,9 @@ public class C2cOrderController extends ApiBaseController {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 用户取消订单:
|
|
|
|
|
- * 已结束订单,申诉订单不能取消
|
|
|
|
|
- * 用户买入: 用户未付款,已付款都可以取消
|
|
|
|
|
- * 用户卖出: 商家已付款,用户不能取消
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ @Operation(summary = "用户取消订单")
|
|
|
@PostMapping("/cancelOrder")
|
|
@PostMapping("/cancelOrder")
|
|
|
-// @RepeatSubmit(interval = 3000, message = "请求过于频繁")
|
|
|
|
|
|
|
+ @RepeatSubmit(interval = 3000, message = "请求过于频繁")
|
|
|
public Result cancelOrder(@RequestBody C2cOrderIdDTO dto)
|
|
public Result cancelOrder(@RequestBody C2cOrderIdDTO dto)
|
|
|
{
|
|
{
|
|
|
ValidatorUtils.validateEntity(dto);
|
|
ValidatorUtils.validateEntity(dto);
|
|
@@ -301,23 +298,10 @@ public class C2cOrderController extends ApiBaseController {
|
|
|
return error(MessageUtils.message("operation.fail.please.refresh"));//操作失败,请刷新后重试
|
|
return error(MessageUtils.message("operation.fail.please.refresh"));//操作失败,请刷新后重试
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 统计某个用户当天订单取消次数
|
|
|
|
|
- */
|
|
|
|
|
-// private void setUserCancelCount() {
|
|
|
|
|
-// String keyCache = StringUtils.format("c2c-o-cancel-count:{}:{}", StpUtil.getLoginIdAsString(),DateUtils.getDate());
|
|
|
|
|
-// if(StringUtils.isNotNull(redisCache.getCacheObject(keyCache))) {
|
|
|
|
|
-// redisCache.increment(keyCache,1L);
|
|
|
|
|
-// } else {
|
|
|
|
|
-// redisCache.setCacheObject(keyCache, 1, 24, TimeUnit.HOURS);
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 点击我已完成付款通知卖家 sendMessage
|
|
|
|
|
- */
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @Operation(summary = "我已完成付款按钮")
|
|
|
@PostMapping("/confirmPay")
|
|
@PostMapping("/confirmPay")
|
|
|
-// @RepeatSubmit(interval = 3000, message = "请求过于频繁")
|
|
|
|
|
|
|
+ @RepeatSubmit(interval = 3000, message = "请求过于频繁")
|
|
|
public Result confirmPay(@RequestBody C2cOrderIdDTO dto)
|
|
public Result confirmPay(@RequestBody C2cOrderIdDTO dto)
|
|
|
{
|
|
{
|
|
|
ValidatorUtils.validateEntity(dto);
|
|
ValidatorUtils.validateEntity(dto);
|
|
@@ -362,11 +346,10 @@ public class C2cOrderController extends ApiBaseController {
|
|
|
return error(MessageUtils.message("operation.fail.please.refresh"));//操作失败,请刷新后重试
|
|
return error(MessageUtils.message("operation.fail.please.refresh"));//操作失败,请刷新后重试
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 卖家确认收款并放币 sendMessage
|
|
|
|
|
- */
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @Operation(summary = "卖家确认收款按钮")
|
|
|
@PostMapping("/verifyReceipt")
|
|
@PostMapping("/verifyReceipt")
|
|
|
-// @RepeatSubmit(interval = 3000, message = "请求过于频繁")
|
|
|
|
|
|
|
+ @RepeatSubmit(interval = 3000, message = "请求过于频繁")
|
|
|
public Result verifyReceipt(@RequestBody C2cOrderIdDTO dto)
|
|
public Result verifyReceipt(@RequestBody C2cOrderIdDTO dto)
|
|
|
{
|
|
{
|
|
|
ValidatorUtils.validateEntity(dto);
|
|
ValidatorUtils.validateEntity(dto);
|
|
@@ -393,11 +376,8 @@ public class C2cOrderController extends ApiBaseController {
|
|
|
return error(MessageUtils.message("operation.fail.please.refresh"));//操作失败,请刷新后重试
|
|
return error(MessageUtils.message("operation.fail.please.refresh"));//操作失败,请刷新后重试
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 查付款凭证
|
|
|
|
|
- * @param c2cPaymentVoucher
|
|
|
|
|
- * @return
|
|
|
|
|
- */
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @Operation(summary = "查订单付款凭证")
|
|
|
@PostMapping("/queryPayment")
|
|
@PostMapping("/queryPayment")
|
|
|
public Result queryPayment(@RequestBody C2cPaymentVoucherQryDTO c2cPaymentVoucher)
|
|
public Result queryPayment(@RequestBody C2cPaymentVoucherQryDTO c2cPaymentVoucher)
|
|
|
{
|
|
{
|
|
@@ -417,13 +397,10 @@ public class C2cOrderController extends ApiBaseController {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 上传付款凭证
|
|
|
|
|
- * @param c2cPaymentVoucher
|
|
|
|
|
- * @return
|
|
|
|
|
- */
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @Operation(summary = "上传付款凭证")
|
|
|
@PostMapping("/uploadPayment")
|
|
@PostMapping("/uploadPayment")
|
|
|
-// @RepeatSubmit(interval = 3000, message = "请求过于频繁")
|
|
|
|
|
|
|
+ @RepeatSubmit(interval = 3000, message = "请求过于频繁")
|
|
|
public Result uploadPayment(@RequestBody C2cPaymentVoucherDTO c2cPaymentVoucher) {
|
|
public Result uploadPayment(@RequestBody C2cPaymentVoucherDTO c2cPaymentVoucher) {
|
|
|
ValidatorUtils.validateEntity(c2cPaymentVoucher);
|
|
ValidatorUtils.validateEntity(c2cPaymentVoucher);
|
|
|
|
|
|
|
@@ -431,6 +408,9 @@ public class C2cOrderController extends ApiBaseController {
|
|
|
String img = c2cPaymentVoucher.getImg();
|
|
String img = c2cPaymentVoucher.getImg();
|
|
|
|
|
|
|
|
C2cOrderEntity order = c2cOrderService.selectOrder(orderId);
|
|
C2cOrderEntity order = c2cOrderService.selectOrder(orderId);
|
|
|
|
|
+ if(order == null) {
|
|
|
|
|
+ return error(MessageUtils.message("c2c.order.not.exist"));//订单编号无效
|
|
|
|
|
+ }
|
|
|
if(order!=null && order.getFlow().intValue()==C2cOrderFlowEnum.END.getCode()) {
|
|
if(order!=null && order.getFlow().intValue()==C2cOrderFlowEnum.END.getCode()) {
|
|
|
return error(MessageUtils.message("c2c.order.is.end"));//订单已结束
|
|
return error(MessageUtils.message("c2c.order.is.end"));//订单已结束
|
|
|
}
|
|
}
|
|
@@ -483,13 +463,10 @@ public class C2cOrderController extends ApiBaseController {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 删除付款凭证
|
|
|
|
|
- * @param c2cPaymentVoucher
|
|
|
|
|
- * @return
|
|
|
|
|
- */
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @Operation(summary = "删除付款凭证")
|
|
|
@PostMapping("/deletePayment")
|
|
@PostMapping("/deletePayment")
|
|
|
-// @RepeatSubmit(interval = 3000, message = "请求过于频繁")
|
|
|
|
|
|
|
+ @RepeatSubmit(interval = 3000, message = "请求过于频繁")
|
|
|
public Result deletePayment(@RequestBody C2cPaymentVoucherIdDTO c2cPaymentVoucher) {
|
|
public Result deletePayment(@RequestBody C2cPaymentVoucherIdDTO c2cPaymentVoucher) {
|
|
|
ValidatorUtils.validateEntity(c2cPaymentVoucher);
|
|
ValidatorUtils.validateEntity(c2cPaymentVoucher);
|
|
|
|
|
|
|
@@ -515,21 +492,14 @@ public class C2cOrderController extends ApiBaseController {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 用户或商家查询订单历史
|
|
|
|
|
- * flow= 0 进行中 1 已结束
|
|
|
|
|
- * status= 0 未付款 1 已付款(确认付款后)2 申诉 | 3 已完成 4 已取消
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ @Operation(summary = "用户或商家查询订单历史")
|
|
|
@PostMapping("/mylist")
|
|
@PostMapping("/mylist")
|
|
|
public Result mylist(@RequestBody C2cOrderListDTO orderVo)
|
|
public Result mylist(@RequestBody C2cOrderListDTO orderVo)
|
|
|
{
|
|
{
|
|
|
ValidatorUtils.validateEntity(orderVo);
|
|
ValidatorUtils.validateEntity(orderVo);
|
|
|
//分页
|
|
//分页
|
|
|
- Integer pageNum = Convert.toInt(orderVo.getPageNum(),1);
|
|
|
|
|
- Integer pageSize = Convert.toInt(orderVo.getPageSize(),10);
|
|
|
|
|
|
|
+ String pageNum = Convert.toStr(orderVo.getPageNum(),"1");
|
|
|
|
|
+ String pageSize = Convert.toStr(orderVo.getPageSize(),"10");
|
|
|
|
|
|
|
|
Map<String,Object> params = new HashMap<>();
|
|
Map<String,Object> params = new HashMap<>();
|
|
|
params.put(Constant.PAGE,pageNum);
|
|
params.put(Constant.PAGE,pageNum);
|
|
@@ -551,9 +521,7 @@ public class C2cOrderController extends ApiBaseController {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 获取c2c订单详细信息
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ @Operation(summary = "c2c订单详细信息")
|
|
|
@GetMapping(value = "/{id}")
|
|
@GetMapping(value = "/{id}")
|
|
|
public Result getInfo(@PathVariable("id") Long id)
|
|
public Result getInfo(@PathVariable("id") Long id)
|
|
|
{
|
|
{
|
|
@@ -591,10 +559,8 @@ public class C2cOrderController extends ApiBaseController {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 商户统计:待处理的消息数=待支付 + 待放币
|
|
|
|
|
- * @return
|
|
|
|
|
- */
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @Operation(summary = "商户统计待处理数")
|
|
|
@PostMapping("/undoCounts")
|
|
@PostMapping("/undoCounts")
|
|
|
public Result undoCounts() {
|
|
public Result undoCounts() {
|
|
|
//待支付的订单数量
|
|
//待支付的订单数量
|
|
@@ -602,87 +568,40 @@ public class C2cOrderController extends ApiBaseController {
|
|
|
|
|
|
|
|
//待放币的订单数量
|
|
//待放币的订单数量
|
|
|
String releaseCountsKey = CacheConstants.getC2cMertUnReleaseKey(StpUtil.getLoginIdAsString());
|
|
String releaseCountsKey = CacheConstants.getC2cMertUnReleaseKey(StpUtil.getLoginIdAsString());
|
|
|
|
|
+log.info("商户待处理Key:"+unpayCountsKey+":"+releaseCountsKey);
|
|
|
|
|
|
|
|
Integer unpayCounts = 0;
|
|
Integer unpayCounts = 0;
|
|
|
Integer releaseCounts = 0;
|
|
Integer releaseCounts = 0;
|
|
|
if(!redisUtils.hasKey(unpayCountsKey)) {
|
|
if(!redisUtils.hasKey(unpayCountsKey)) {
|
|
|
- unpayCounts = setMtUnPayCount(unpayCountsKey);
|
|
|
|
|
|
|
+ unpayCounts = c2cOrderService.setMtUnPayCount(unpayCountsKey);
|
|
|
} else {
|
|
} else {
|
|
|
unpayCounts = Convert.toInt(redisUtils.get(unpayCountsKey),0);
|
|
unpayCounts = Convert.toInt(redisUtils.get(unpayCountsKey),0);
|
|
|
}
|
|
}
|
|
|
if(!redisUtils.hasKey(releaseCountsKey)) {
|
|
if(!redisUtils.hasKey(releaseCountsKey)) {
|
|
|
- releaseCounts = setMtUnReleaseCount(releaseCountsKey);
|
|
|
|
|
|
|
+ releaseCounts = c2cOrderService.setMtUnReleaseCount(releaseCountsKey);
|
|
|
} else {
|
|
} else {
|
|
|
releaseCounts = Convert.toInt(redisUtils.get(releaseCountsKey),0);
|
|
releaseCounts = Convert.toInt(redisUtils.get(releaseCountsKey),0);
|
|
|
}
|
|
}
|
|
|
|
|
+log.info("商户待处理数Count:"+unpayCounts+":"+releaseCounts);
|
|
|
|
|
+
|
|
|
if(unpayCounts<0 || releaseCounts<0) {
|
|
if(unpayCounts<0 || releaseCounts<0) {
|
|
|
- unpayCounts = setMtUnPayCount(unpayCountsKey);
|
|
|
|
|
- releaseCounts = setMtUnReleaseCount(releaseCountsKey);
|
|
|
|
|
|
|
+ unpayCounts = c2cOrderService.setMtUnPayCount(unpayCountsKey);
|
|
|
|
|
+ releaseCounts = c2cOrderService.setMtUnReleaseCount(releaseCountsKey);
|
|
|
}
|
|
}
|
|
|
Map<String,Integer> data = MapUtil.of("unpayCounts",unpayCounts);
|
|
Map<String,Integer> data = MapUtil.of("unpayCounts",unpayCounts);
|
|
|
data.put("releaseCounts",releaseCounts);
|
|
data.put("releaseCounts",releaseCounts);
|
|
|
return success(data);
|
|
return success(data);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 设置商家待支付订单数
|
|
|
|
|
- * @param unpayCountsKey
|
|
|
|
|
- * @return
|
|
|
|
|
- */
|
|
|
|
|
- private Integer setMtUnPayCount(String unpayCountsKey) {
|
|
|
|
|
- List<Map> mtUpPayList = c2cOrderService.selectMtUnPayCount(StpUtil.getLoginIdAsLong());
|
|
|
|
|
- Map<String, Object> upPayMap = mtUpPayList.get(0);
|
|
|
|
|
- Integer unpayCounts = Convert.toInt(upPayMap.get("NUM"), 0);
|
|
|
|
|
- Random random = new Random();
|
|
|
|
|
- int randomSecond = random.nextInt(12*3600)+ 12*3600; // 生成12到24之间的随机数
|
|
|
|
|
- redisUtils.set(unpayCountsKey, unpayCounts, randomSecond);
|
|
|
|
|
- return unpayCounts;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 设置商家待放币数
|
|
|
|
|
- * @param releaseCountsKey
|
|
|
|
|
- * @return
|
|
|
|
|
- */
|
|
|
|
|
- private Integer setMtUnReleaseCount(String releaseCountsKey) {
|
|
|
|
|
- List<Map> mtReleaseList = c2cOrderService.selectMtUnReleaseCount(StpUtil.getLoginIdAsLong());
|
|
|
|
|
- Map<String,Object> releaseMap = mtReleaseList.get(0);
|
|
|
|
|
- Integer releaseCounts = Convert.toInt(releaseMap.get("NUM"),0);
|
|
|
|
|
- Random random = new Random();
|
|
|
|
|
- int randomSecond = random.nextInt(12*3600)+12*3600; // 生成12到24之间的随机数
|
|
|
|
|
- redisUtils.set(releaseCountsKey,releaseCounts,randomSecond);
|
|
|
|
|
- return releaseCounts;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 用户统计:待处理的消息数=待支付 + 待放币
|
|
|
|
|
- * @return
|
|
|
|
|
- */
|
|
|
|
|
-// @PostMapping("/userUndoCounts")
|
|
|
|
|
-// public AjaxResult userUndoCounts() {
|
|
|
|
|
-// //待支付的订单数量
|
|
|
|
|
-// String unpayCountsKey = StringUtils.format(CacheConstants.C2C_UNPAY_COUNTS, StpUtil.getLoginIdAsString());
|
|
|
|
|
-// Integer unpayCounts = Convert.toInt(redisCache.getCacheObject(unpayCountsKey),0);
|
|
|
|
|
-// //待放币的订单数量
|
|
|
|
|
-// String releaseCountsKey = StringUtils.format(CacheConstants.C2C_RELEASE_COUNTS, StpUtil.getLoginIdAsString());
|
|
|
|
|
-// Integer releaseCounts = Convert.toInt(redisCache.getCacheObject(releaseCountsKey),0);
|
|
|
|
|
-// Map<String,Integer> data = MapUtil.of("unpayCounts",unpayCounts);
|
|
|
|
|
-// data.put("releaseCounts",releaseCounts);
|
|
|
|
|
-// return success(data);
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 用户/商家发起申诉
|
|
|
|
|
- * @param c2cOrderComplain
|
|
|
|
|
- * @return
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ @Operation(summary = "用户/商家发起申诉")
|
|
|
@PostMapping("/complain")
|
|
@PostMapping("/complain")
|
|
|
-// @RepeatSubmit(interval = 3000, message = "请求过于频繁")
|
|
|
|
|
|
|
+ @RepeatSubmit(interval = 3000, message = "请求过于频繁")
|
|
|
public Result complain(@RequestBody C2cOrderComplainDTO c2cOrderComplain)
|
|
public Result complain(@RequestBody C2cOrderComplainDTO c2cOrderComplain)
|
|
|
{
|
|
{
|
|
|
ValidatorUtils.validateEntity(c2cOrderComplain);
|
|
ValidatorUtils.validateEntity(c2cOrderComplain);
|
|
|
|
|
|
|
|
C2cOrderEntity order = c2cOrderService.selectOrder(c2cOrderComplain.getOrderId());
|
|
C2cOrderEntity order = c2cOrderService.selectOrder(c2cOrderComplain.getOrderId());
|
|
|
|
|
+ log.info("订单信息:"+ JSON.toJSONString(order));
|
|
|
if(order == null) {
|
|
if(order == null) {
|
|
|
return error(MessageUtils.message("c2c.order.not.exist"));//订单编号无效
|
|
return error(MessageUtils.message("c2c.order.not.exist"));//订单编号无效
|
|
|
}
|
|
}
|
|
@@ -713,13 +632,10 @@ public class C2cOrderController extends ApiBaseController {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 用户或商家提交申诉凭证
|
|
|
|
|
- * @param
|
|
|
|
|
- * @return
|
|
|
|
|
- */
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @Operation(summary = "用户或商家提交申诉凭证")
|
|
|
@PostMapping("/complainVoucher")
|
|
@PostMapping("/complainVoucher")
|
|
|
-// @RepeatSubmit(interval = 3000, message = "请求过于频繁")
|
|
|
|
|
|
|
+ @RepeatSubmit(interval = 3000, message = "请求过于频繁")
|
|
|
public Result complainVoucher(@RequestBody C2cOrderComplainVoucherDTO dto)
|
|
public Result complainVoucher(@RequestBody C2cOrderComplainVoucherDTO dto)
|
|
|
{
|
|
{
|
|
|
ValidatorUtils.validateEntity(dto);
|
|
ValidatorUtils.validateEntity(dto);
|
|
@@ -795,9 +711,7 @@ public class C2cOrderController extends ApiBaseController {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 用户或商家查询申诉历史
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ @Operation(summary = "用户或商家查询申诉历史")
|
|
|
@PostMapping("/complainHis")
|
|
@PostMapping("/complainHis")
|
|
|
public Result complainHis(@RequestBody C2cOrderComplainOidDTO orderComplain)
|
|
public Result complainHis(@RequestBody C2cOrderComplainOidDTO orderComplain)
|
|
|
{
|
|
{
|
|
@@ -805,49 +719,36 @@ public class C2cOrderController extends ApiBaseController {
|
|
|
|
|
|
|
|
List<C2cOrderComplainEntity> complainList = new ArrayList<>();
|
|
List<C2cOrderComplainEntity> complainList = new ArrayList<>();
|
|
|
C2cOrderEntity order = c2cOrderService.selectOrder(orderComplain.getOrderId());
|
|
C2cOrderEntity order = c2cOrderService.selectOrder(orderComplain.getOrderId());
|
|
|
|
|
+ if(order == null) {
|
|
|
|
|
+ return error(MessageUtils.message("c2c.order.not.exist"));//订单编号无效
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if( StpUtil.getLoginIdAsLong() != order.getUserId().longValue()
|
|
if( StpUtil.getLoginIdAsLong() != order.getUserId().longValue()
|
|
|
&& StpUtil.getLoginIdAsLong() != order.getTranUserId().longValue()) {
|
|
&& StpUtil.getLoginIdAsLong() != order.getTranUserId().longValue()) {
|
|
|
return error(MessageUtils.message("c2c.order.no.permission.view"));//您无权查看
|
|
return error(MessageUtils.message("c2c.order.no.permission.view"));//您无权查看
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if(checkOrderTranUser(order)) {
|
|
|
|
|
|
|
+ if(c2cOrderService.checkOrderTranUser(order)) {
|
|
|
complainList = orderComplainService.selectC2cOrderComplainList(orderComplain.getOrderId());
|
|
complainList = orderComplainService.selectC2cOrderComplainList(orderComplain.getOrderId());
|
|
|
}
|
|
}
|
|
|
return success(complainList);
|
|
return success(complainList);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 检查登陆用户是否是买家或卖家
|
|
|
|
|
- * @param order
|
|
|
|
|
- * @return true 是
|
|
|
|
|
- */
|
|
|
|
|
- private boolean checkOrderTranUser(C2cOrderEntity order)
|
|
|
|
|
- {
|
|
|
|
|
- if(order.getUserId().longValue()==StpUtil.getLoginIdAsLong() ||
|
|
|
|
|
- order.getTranUserId().longValue()==StpUtil.getLoginIdAsLong() ) {
|
|
|
|
|
- return true;
|
|
|
|
|
- } else {
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 用户或商家查询申诉详情
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ @Operation(summary = "用户或商家申诉详情")
|
|
|
@PostMapping("/complainDetail")
|
|
@PostMapping("/complainDetail")
|
|
|
public Result complainDetail(@RequestBody C2cOrderComplainDetailDTO dto)
|
|
public Result complainDetail(@RequestBody C2cOrderComplainDetailDTO dto)
|
|
|
{
|
|
{
|
|
|
ValidatorUtils.validateEntity(dto);
|
|
ValidatorUtils.validateEntity(dto);
|
|
|
|
|
+ if(dto.getOrderId() == null && dto.getComplainId() == null) {
|
|
|
|
|
+ return error(MessageUtils.message("c2c.order.complainId.orderId.all.empty"));//申诉编号、订单编号不能都为空
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
C2cOrderComplainEntity orderComplain = null;
|
|
C2cOrderComplainEntity orderComplain = null;
|
|
|
- if (dto.getOrderId() != null) {
|
|
|
|
|
- List<C2cOrderComplainEntity> orderComplainList = orderComplainService.selectC2cOrderComplainList(dto.getOrderId());
|
|
|
|
|
- orderComplain = orderComplainList.get(0);
|
|
|
|
|
- }
|
|
|
|
|
if (dto.getComplainId() != null) {
|
|
if (dto.getComplainId() != null) {
|
|
|
orderComplain = orderComplainService.selectById(dto.getComplainId());
|
|
orderComplain = orderComplainService.selectById(dto.getComplainId());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ List<C2cOrderComplainEntity> orderComplainList = orderComplainService.selectC2cOrderComplainList(dto.getOrderId());
|
|
|
|
|
+ orderComplain = orderComplainList.get(0);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if(orderComplain==null) {
|
|
if(orderComplain==null) {
|
|
@@ -862,7 +763,7 @@ public class C2cOrderController extends ApiBaseController {
|
|
|
List<C2cOrderComplainVoucherEntity> complainList = new ArrayList<>();
|
|
List<C2cOrderComplainVoucherEntity> complainList = new ArrayList<>();
|
|
|
C2cOrderEntity order = c2cOrderService.selectOrder(orderComplain.getOrderId());
|
|
C2cOrderEntity order = c2cOrderService.selectOrder(orderComplain.getOrderId());
|
|
|
|
|
|
|
|
- if(checkOrderTranUser(order)) {
|
|
|
|
|
|
|
+ if(c2cOrderService.checkOrderTranUser(order)) {
|
|
|
complainList = orderComplainVoucherService.selectList(orderComplain.getId());
|
|
complainList = orderComplainVoucherService.selectList(orderComplain.getId());
|
|
|
}
|
|
}
|
|
|
Map data = MapUtil.of("complainInfo", orderComplain);
|
|
Map data = MapUtil.of("complainInfo", orderComplain);
|