Przeglądaj źródła

/、.test

release_toaliyun_real
xhxu 4 lat temu
rodzic
commit
81f0a8c9e7
3 zmienionych plików z 95 dodań i 4 usunięć
  1. +89
    -0
      mallinkCApi/src/main/java/com/iformall/controller/WxCouponOrderController.java
  2. +4
    -4
      mallinkCApi/src/main/java/com/iformall/interceptor/TestControllerReturnAspect.java
  3. +2
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java

+ 89
- 0
mallinkCApi/src/main/java/com/iformall/controller/WxCouponOrderController.java Wyświetl plik

@@ -432,4 +432,93 @@ public class WxCouponOrderController extends BaseController {
memCouponFromDspService.couponOrderFromDsp(tenantEntity, member.getPhone());
return new ResultData();
}


@ApiOperation(value = "核销接口", notes = "{\"couponOrderId\":\"string\"}")
@PostMapping("verify")
public ResultData verify(@RequestBody Map<String, String> paramMap) {
logger.info("couponOrderController.verify:" + paramMap.toString());
String couponOrderIdStr = paramMap.get("couponOrderId");
if (StringUtils.isBlank(couponOrderIdStr)) {
logger.error("couponOrderId不能为空: " + paramMap.toString());
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}
Long couponOrderId = 0L;
try {
couponOrderId = Long.valueOf(couponOrderIdStr);
} catch (NumberFormatException e) {
couponOrderId = 0L;
logger.error("couponOrderId参数不正确: " + paramMap.toString());
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}

WxCouponOrderCVo wxCouponOrderCVo = wxCouponOrderService.detailCUserVo(couponOrderIdStr,getTenantInfo());

if (wxCouponOrderCVo == null)
return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL);

WxCUserBasicInfo member;
try {
member = getCacheMember();
} catch (Exception e) {
return new ResultData(Result.ERROR,e.getMessage());
}

Date now = new Date();
if (wxCouponOrderCVo.getValidType().equals(EnumCouponValidType.BETWEEN_TWO_TIME.getCode())){
// && !wxCouponOrderCVo.getType().equals(EnumCouponType.COUPON_PREORDER.getCode())) {
if(wxCouponOrderCVo.getType().equals(EnumCouponType.COUPON_PREORDER.getCode())){
if (wxCouponOrderCVo.getPickStartDate().after(now)) {
logger.error("此券有效期未开始:" + couponOrderIdStr);
return new ResultData(ErrorCode.COUPON_ORDER_IS_EARLIER_THAN_VALIDDATE);
}
if (wxCouponOrderCVo.getPickEndDate().before(now)) {
logger.error("此券有效期已结束:" + couponOrderIdStr);
return new ResultData(ErrorCode.COUPON_ORDER_IS_LATER_THAN_VALIDDATE);
}
}else{
if (wxCouponOrderCVo.getValidStartDate().after(now)) {
logger.error("此券有效期未开始:" + couponOrderIdStr);
return new ResultData(ErrorCode.COUPON_ORDER_IS_EARLIER_THAN_VALIDDATE);
}
if (wxCouponOrderCVo.getValidEndDate().before(now)) {
logger.error("此券有效期已结束:" + couponOrderIdStr);
return new ResultData(ErrorCode.COUPON_ORDER_IS_LATER_THAN_VALIDDATE);
}
}

} else {
if (wxCouponOrderCVo.getExpiredTime().before(now)) {
logger.error("此券已过期:" + couponOrderIdStr);
return new ResultData(ErrorCode.COUPON_IS_EXPIRED);
}
}

WxCouponOrder wxCouponOrder = wxCouponOrderService.getById(couponOrderId,getTenantInfo().getTenantId());
if (wxCouponOrder == null) {
logger.error("券ID不存在:" + couponOrderId);
return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL);
}
if(!member.getId().equals(wxCouponOrder.getCUserId())){
logger.error("此券不属于此人:" + member.getId());
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR);
}
WxCouponOrder couponOrder = null;
try {
couponOrder = wxCouponOrderService.verify(wxCouponOrder,null,EnumCouponVerifyType.VERIFY_C);
} catch (MallinkException e) {
logger.error("核销异常: " + e.getMessage());
return new ResultData(e.getErrorCode(), e.getMessage());
} catch (Exception e) {
logger.error("核销异常: " + e.getMessage());
return new ResultData(ErrorCode.VERIFY_ERROR, e.getMessage());
}

if (couponOrder != null && couponOrder.getMerchantId() != null) {
wxCouponOrderService.sendInsideCouponVerifyMsg(couponOrder, couponOrderId, couponOrder.getMerchantId());
}

return new ResultData(couponOrder);
}

}

+ 4
- 4
mallinkCApi/src/main/java/com/iformall/interceptor/TestControllerReturnAspect.java Wyświetl plik

@@ -24,17 +24,17 @@ import lombok.extern.slf4j.Slf4j;
* @author alascor
*
*/
@Aspect
@Configuration
//@Aspect
//@Configuration
@Slf4j
public class TestControllerReturnAspect {

@Pointcut("execution(* com.iformall.controller.*Controller.*(..))")
// @Pointcut("execution(* com.iformall.controller.*Controller.*(..))")
public void excudeService() {
}
@Around("excudeService()")
// @Around("excudeService()")
public Object doAround(ProceedingJoinPoint pjp) throws Throwable {
RequestAttributes ra = RequestContextHolder.getRequestAttributes();
ServletRequestAttributes sra = (ServletRequestAttributes) ra;


+ 2
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java Wyświetl plik

@@ -322,6 +322,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {

private PageInfo<WxCouponOrderBVo> findListOfVerifiedByDateForBUser(TenantEntity tenantEntity,Long merchantId,Date startDate,Date endDate,Integer pageIndex,Integer pageSize) {
Map dateMap = new HashMap();
dateMap.put("tenantId",tenantEntity.getTenantId());
dateMap.put("startDate", startDate);
dateMap.put("endDate", endDate);
@@ -342,6 +343,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
private PageInfo<WxCouponOrderBVo> findListOfOrderedByDateForBUser(TenantEntity tenantEntity,Long merchantId,Date startDate,Date endDate,Integer pageIndex,Integer pageSize) {
Map dateMap = new HashMap();
dateMap.put("tenantId",tenantEntity.getTenantId());
dateMap.put("startDateTimes", startDate.getTime());
dateMap.put("endDateTimes", endDate.getTime());
List<Long> merchantIdList = new ArrayList<Long>();


Ładowanie…
Anuluj
Zapisz