| @@ -2,9 +2,14 @@ package com.iformall.controller; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.AliBusinessCircleOrder; | |||
| import com.iformall.domain.po.WxBusinessCircleOrder; | |||
| import com.iformall.domain.po.WxThirdPartyOrders; | |||
| import com.iformall.enums.EnumThirdOrderType; | |||
| import com.iformall.enums.EnumUserType; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.AliBusinessCircleOrderService; | |||
| import com.iformall.service.WxBusinessCircleOrderService; | |||
| import com.iformall.service.WxThirdPartyOrdersService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| @@ -36,6 +41,12 @@ public class UserThirdCircleOrderController extends BaseController { | |||
| @Autowired | |||
| WxThirdPartyOrdersService thirdPartyOrdersService; | |||
| @Autowired | |||
| WxBusinessCircleOrderService wxBusinessCircleOrderService; | |||
| @Autowired | |||
| AliBusinessCircleOrderService aliBusinessCircleOrderService; | |||
| /** | |||
| * | |||
| * @param | |||
| @@ -46,6 +57,16 @@ public class UserThirdCircleOrderController extends BaseController { | |||
| public ResultData createOrder(@RequestBody Map<String,Object> map) { | |||
| logger.info("UserThirdCircleOrderController >>>>>>>>>>>> createOrder >>>>>>>>>>>>>"+map.toString()); | |||
| String sourceType = map.get("sourceType")==null?"":map.get("sourceType").toString();//来源类型,EnumUserType | |||
| Integer sourceTypeInt = EnumUserType.THIRD_CIRCLE.getCode(); | |||
| if(StringUtils.isNotBlank(sourceType)){ | |||
| try { | |||
| sourceTypeInt = Integer.parseInt(sourceType); | |||
| } catch (NumberFormatException e) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"sourceType格式不正确"); | |||
| } | |||
| } | |||
| String transactionId = map.get("transactionId")==null?"":map.get("transactionId").toString();//***订单Id | |||
| String shopNumber = map.get("shopNumber")==null?"":map.get("shopNumber").toString();//***门店唯一标识 对应双方平台门店 | |||
| String shopName = map.get("shopName")==null?"":map.get("shopName").toString();//门店名称 | |||
| @@ -91,23 +112,74 @@ public class UserThirdCircleOrderController extends BaseController { | |||
| } catch (NumberFormatException e) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"amount为正整数"); | |||
| } | |||
| try{ | |||
| if(sourceTypeInt.equals(EnumUserType.THIRD_CIRCLE.getCode())){ | |||
| WxThirdPartyOrders thirdPartyOrders = new WxThirdPartyOrders(); | |||
| thirdPartyOrders.updateTenantInfo(getTenantInfo()); | |||
| thirdPartyOrders.setSourceAppId(getAppId()); | |||
| thirdPartyOrders.setSourceAppName(getAppConfig().getName()); | |||
| WxThirdPartyOrders thirdPartyOrders = new WxThirdPartyOrders(); | |||
| thirdPartyOrders.updateTenantInfo(getTenantInfo()); | |||
| thirdPartyOrders.setSourceAppId(getAppId()); | |||
| thirdPartyOrders.setSourceAppName(getAppConfig().getName()); | |||
| thirdPartyOrders.setTransactionId(transactionId); | |||
| thirdPartyOrders.setShopNumber(shopNumber); | |||
| thirdPartyOrders.setShopName(shopName); | |||
| thirdPartyOrders.setUserNumber(userNumber); | |||
| thirdPartyOrders.setUserPhone(userPhone); | |||
| thirdPartyOrders.setTimeEnd(timeEndDate); | |||
| thirdPartyOrders.setAmount(Integer.parseInt(amount)); | |||
| thirdPartyOrders.setPayAmount(Integer.parseInt(amount)); | |||
| thirdPartyOrders.setSummary(summary); | |||
| thirdPartyOrders.setTransactionId(transactionId); | |||
| thirdPartyOrders.setShopNumber(shopNumber); | |||
| thirdPartyOrders.setShopName(shopName); | |||
| thirdPartyOrders.setUserNumber(userNumber); | |||
| thirdPartyOrders.setUserPhone(userPhone); | |||
| thirdPartyOrders.setTimeEnd(timeEndDate); | |||
| thirdPartyOrders.setAmount(Integer.parseInt(amount)); | |||
| thirdPartyOrders.setPayAmount(Integer.parseInt(amount)); | |||
| thirdPartyOrders.setSummary(summary); | |||
| try{ | |||
| return thirdPartyOrdersService.createOrder(thirdPartyOrders); | |||
| return thirdPartyOrdersService.createOrder(thirdPartyOrders); | |||
| }else if(sourceTypeInt.equals(EnumUserType.BUSINESS_CIRCLE.getCode())){//微信商圈 | |||
| WxBusinessCircleOrder wxBusinessCircleOrder = new WxBusinessCircleOrder(); | |||
| wxBusinessCircleOrder.updateTenantInfo(getTenantInfo()); | |||
| wxBusinessCircleOrder.setSummary(summary); | |||
| // wxBusinessCircleOrder.setWxMchid(result.getMchid()); | |||
| // wxBusinessCircleOrder.setWxMerchantName(result.getMerchantName()); | |||
| wxBusinessCircleOrder.setWxShopName(shopName); | |||
| wxBusinessCircleOrder.setWxShopNumber(shopNumber); | |||
| Long userId = null; | |||
| try { | |||
| userId = Long.parseLong(userNumber); | |||
| } catch (NumberFormatException e) {} | |||
| wxBusinessCircleOrder.setCUserId(userId); | |||
| // wxBusinessCircleOrder.setCUserPhone(userPhone); | |||
| // wxBusinessCircleOrder.setAppid(result.getAppid()); | |||
| // wxBusinessCircleOrder.setOpenid(result.getOpenid()); | |||
| wxBusinessCircleOrder.setTimeEnd(timeEndDate); | |||
| wxBusinessCircleOrder.setAmount(Integer.parseInt(amount)); | |||
| wxBusinessCircleOrder.setPayAmount(Integer.parseInt(amount)); | |||
| wxBusinessCircleOrder.setTransactionId(transactionId); | |||
| // wxBusinessCircleOrder.setCommitTag(result.getCommitTag()); | |||
| return wxBusinessCircleOrderService.createOrder(wxBusinessCircleOrder); | |||
| }else if(sourceTypeInt.equals(EnumUserType.ALI_CIRCLE.getCode())){//支付宝商圈 | |||
| AliBusinessCircleOrder aliBusinessCircleOrder = new AliBusinessCircleOrder(); | |||
| // aliBusinessCircleOrder.setNoticeId(notifyId); | |||
| // aliBusinessCircleOrder.setNoticeEventType(msgMethod); | |||
| aliBusinessCircleOrder.updateTenantInfo(getTenantInfo()); | |||
| aliBusinessCircleOrder.setTransactionId(transactionId); | |||
| aliBusinessCircleOrder.setAmount(Integer.parseInt(amount)); | |||
| aliBusinessCircleOrder.setPayAmount(Integer.parseInt(amount)); | |||
| aliBusinessCircleOrder.setTimeEnd(timeEndDate); | |||
| // aliBusinessCircleOrder.setMallStoreId(mallStoreId); | |||
| // aliBusinessCircleOrder.setBuyerId(buyerId); | |||
| Long userId = null; | |||
| try { | |||
| userId = Long.parseLong(userNumber); | |||
| } catch (NumberFormatException e) {} | |||
| aliBusinessCircleOrder.setCUserId(userId); | |||
| aliBusinessCircleOrder.setMallStoreId(shopNumber); | |||
| return aliBusinessCircleOrderService.createOrder(null,aliBusinessCircleOrder); | |||
| }else{ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"sourceType未匹配"); | |||
| } | |||
| }catch(MallinkException e){ | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| @@ -115,7 +187,6 @@ public class UserThirdCircleOrderController extends BaseController { | |||
| logger.error("异常:" + e); | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR); | |||
| } | |||
| } | |||
| /** | |||
| @@ -128,6 +199,16 @@ public class UserThirdCircleOrderController extends BaseController { | |||
| public ResultData orderRefund(@RequestBody Map<String,Object> map) { | |||
| logger.info("UserThirdCircleOrderController >>>>>>>>>>>> orderRefund >>>>>>>>>>>>>"+map.toString()); | |||
| String sourceType = map.get("sourceType")==null?"":map.get("sourceType").toString();//来源类型,EnumUserType | |||
| Integer sourceTypeInt = EnumUserType.THIRD_CIRCLE.getCode(); | |||
| if(StringUtils.isNotBlank(sourceType)){ | |||
| try { | |||
| sourceTypeInt = Integer.parseInt(sourceType); | |||
| } catch (NumberFormatException e) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"sourceType格式不正确"); | |||
| } | |||
| } | |||
| String transactionId = map.get("transactionId")==null?"":map.get("transactionId").toString();//***订单Id | |||
| String refundTime = map.get("refundTime")==null?"":map.get("refundTime").toString();//***退款时间(yyyy-MM-dd HH:mm:ss) | |||
| String refundSummary = map.get("refundSummary")==null?"":map.get("refundSummary").toString();//退款摘要 | |||
| @@ -164,22 +245,70 @@ public class UserThirdCircleOrderController extends BaseController { | |||
| if(StringUtils.isBlank(refundId)){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL,"refundId为空"); | |||
| } | |||
| try{ | |||
| if(sourceTypeInt.equals(EnumUserType.THIRD_CIRCLE.getCode())){ | |||
| WxThirdPartyOrders thirdPartyOrders = new WxThirdPartyOrders(); | |||
| thirdPartyOrders.updateTenantInfo(getTenantInfo()); | |||
| thirdPartyOrders.setSourceAppId(getAppId()); | |||
| thirdPartyOrders.setSourceAppName(getAppConfig().getName()); | |||
| WxThirdPartyOrders thirdPartyOrders = new WxThirdPartyOrders(); | |||
| thirdPartyOrders.updateTenantInfo(getTenantInfo()); | |||
| thirdPartyOrders.setSourceAppId(getAppId()); | |||
| thirdPartyOrders.setSourceAppName(getAppConfig().getName()); | |||
| thirdPartyOrders.setTransactionId(transactionId); | |||
| thirdPartyOrders.setTimeEnd(refundTimeDate); | |||
| thirdPartyOrders.setSummary(refundSummary); | |||
| if(refund > 0){ | |||
| thirdPartyOrders.setRefundAmount(refund); | |||
| } | |||
| thirdPartyOrders.setRefundId(refundId); | |||
| thirdPartyOrders.setTransactionId(transactionId); | |||
| thirdPartyOrders.setTimeEnd(refundTimeDate); | |||
| thirdPartyOrders.setSummary(refundSummary); | |||
| if(refund > 0){ | |||
| thirdPartyOrders.setRefundAmount(refund); | |||
| } | |||
| thirdPartyOrders.setRefundId(refundId); | |||
| return thirdPartyOrdersService.insertRefundNoticeOrder(thirdPartyOrders); | |||
| try{ | |||
| return thirdPartyOrdersService.insertRefundNoticeOrder(thirdPartyOrders); | |||
| }else if(sourceTypeInt.equals(EnumUserType.BUSINESS_CIRCLE.getCode())){//微信商圈 | |||
| WxBusinessCircleOrder wxBusinessCircleOrder = new WxBusinessCircleOrder(); | |||
| wxBusinessCircleOrder.updateTenantInfo(getTenantInfo()); | |||
| // wxBusinessCircleOrder.setNoticeId(notifyData.getId()); | |||
| // wxBusinessCircleOrder.setNoticeCreateTime(sdf.parse(notifyData.getCreateTime())); | |||
| // wxBusinessCircleOrder.setNoticeEventType(notifyData.getEventType()); | |||
| wxBusinessCircleOrder.setSummary(refundSummary); | |||
| // wxBusinessCircleOrder.setWxMchid(result.getMchid()); | |||
| // wxBusinessCircleOrder.setWxMerchantName(result.getMerchantName()); | |||
| // wxBusinessCircleOrder.setWxShopName(result.getShopName()); | |||
| // wxBusinessCircleOrder.setWxShopNumber(result.getShopNumber()); | |||
| // wxBusinessCircleOrder.setAppid(result.getAppid()); | |||
| // wxBusinessCircleOrder.setOpenid(result.getOpenid()); | |||
| wxBusinessCircleOrder.setTimeEnd(refundTimeDate); | |||
| // wxBusinessCircleOrder.setAmount(result.getPayAmount()); | |||
| // wxBusinessCircleOrder.setPayAmount(result.getPayAmount()); | |||
| wxBusinessCircleOrder.setTransactionId(transactionId); | |||
| if(refund > 0){ | |||
| wxBusinessCircleOrder.setRefundAmount(refund); | |||
| } | |||
| wxBusinessCircleOrder.setRefundId(refundId); | |||
| return wxBusinessCircleOrderService.insertRefundNoticeOrder(wxBusinessCircleOrder); | |||
| }else if(sourceTypeInt.equals(EnumUserType.ALI_CIRCLE.getCode())){//支付宝商圈 | |||
| AliBusinessCircleOrder aliBusinessCircleOrder = new AliBusinessCircleOrder(); | |||
| // aliBusinessCircleOrder.setNoticeId(notifyId); | |||
| // aliBusinessCircleOrder.setNoticeEventType(msgMethod); | |||
| aliBusinessCircleOrder.updateTenantInfo(getTenantInfo()); | |||
| aliBusinessCircleOrder.setTransactionId(transactionId); | |||
| if(refund > 0){ | |||
| aliBusinessCircleOrder.setRefundAmount(refund); | |||
| } | |||
| aliBusinessCircleOrder.setTimeEnd(refundTimeDate); | |||
| // aliBusinessCircleOrder.setMallStoreId(mallStoreId); | |||
| // aliBusinessCircleOrder.setBuyerId(buyerId); | |||
| // aliBusinessCircleOrder.setMallId(mallId); | |||
| // aliBusinessCircleOrder.setMallName(mallName); | |||
| return aliBusinessCircleOrderService.insertRefundNoticeOrder(null,aliBusinessCircleOrder); | |||
| }else{ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR,"sourceType未匹配"); | |||
| } | |||
| }catch(MallinkException e){ | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| @@ -187,6 +316,7 @@ public class UserThirdCircleOrderController extends BaseController { | |||
| logger.error("异常:" + e); | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR); | |||
| } | |||
| } | |||
| @@ -2,6 +2,7 @@ package com.iformall.utils; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.enums.EnumUserType; | |||
| import com.iformall.utils.sign.SignUtils; | |||
| import java.util.Date; | |||
| @@ -46,25 +47,29 @@ public class AppTest { | |||
| /** | |||
| * 创建交易信息 参数 | |||
| */ | |||
| // IdWorker idWorker = IdWorker.get(); | |||
| // paramMap.put("transactionId",String.valueOf(idWorker.nextId()));//***订单Id | |||
| // paramMap.put("shopNumber","1001");//***门店唯一标识 对应双方平台门店 | |||
| // paramMap.put("shopName","百丽");//门店名称 | |||
| // paramMap.put("userNumber","551612907794915328");//***会员Id | |||
| //// paramMap.put("userPhone","18872592633");//会员手机号 | |||
| // paramMap.put("timeEnd","2021-06-08 14:44:00");//***付款时间(yyyy-MM-dd HH:mm:ss) | |||
| // paramMap.put("amount","9000");//***付款金额(分) | |||
| //// paramMap.put("summary","");//付款摘要 | |||
| IdWorker idWorker = IdWorker.get(); | |||
| paramMap.put("sourceType", EnumUserType.THIRD_CIRCLE.getCode()); | |||
| paramMap.put("transactionId",String.valueOf(idWorker.nextId()));//***订单Id | |||
| paramMap.put("shopNumber","1001");//***门店唯一标识 对应双方平台门店 | |||
| paramMap.put("shopName","百丽");//门店名称 | |||
| paramMap.put("userNumber","562957699461472256");//***会员Id | |||
| // paramMap.put("userPhone","18872592633");//会员手机号 | |||
| paramMap.put("timeEnd","2021-06-11 14:44:00");//***付款时间(yyyy-MM-dd HH:mm:ss) | |||
| paramMap.put("amount","9000");//***付款金额(分) | |||
| // paramMap.put("summary","");//付款摘要 | |||
| /** | |||
| * 交易退款信息 参数 | |||
| */ | |||
| IdWorker idWorker = IdWorker.get(); | |||
| paramMap.put("transactionId","562134761668694016");//***订单Id | |||
| paramMap.put("refundTime","2021-06-08 19:46:00");//***退款时间(yyyy-MM-dd HH:mm:ss) | |||
| // paramMap.put("refundAmount","1000");//退款金额(分) | |||
| paramMap.put("refundSummary","我要退款");//付款摘要 | |||
| paramMap.put("refundId",String.valueOf(idWorker.nextId()));//退款订单号 | |||
| // IdWorker idWorker = IdWorker.get(); | |||
| // paramMap.put("sourceType", EnumUserType.THIRD_CIRCLE.getCode()); | |||
| // paramMap.put("transactionId","562134761668694016");//***订单Id | |||
| // paramMap.put("refundTime","2021-06-08 19:46:00");//***退款时间(yyyy-MM-dd HH:mm:ss) | |||
| //// paramMap.put("refundAmount","1000");//退款金额(分) | |||
| // paramMap.put("refundSummary","我要退款");//付款摘要 | |||
| // paramMap.put("refundId",String.valueOf(idWorker.nextId()));//退款订单号 | |||
| /** | |||
| * 积分抵扣 参数 | |||
| @@ -102,14 +107,14 @@ public class AppTest { | |||
| /** | |||
| * 创建交易信息 接口 | |||
| */ | |||
| // String s = HttpUtil.doPost("https://openapitest.malls.iformall.com/api/thirdCircle/order", headMap, JSON.toJSONString(paramMap)); | |||
| String s = HttpUtil.doPost("https://openapitest.malls.iformall.com/api/thirdCircle/order", headMap, JSON.toJSONString(paramMap)); | |||
| // String s = HttpUtil.doPost("http://localhost:7070/public/api/thirdCircle/order", headMap, JSON.toJSONString(paramMap)); | |||
| /** | |||
| * 交易退款 接口 | |||
| */ | |||
| String s = HttpUtil.doPost("https://openapitest.malls.iformall.com/api/thirdCircle/orderRefund", headMap, JSON.toJSONString(paramMap)); | |||
| // String s = HttpUtil.doPost("https://openapitest.malls.iformall.com/api/thirdCircle/orderRefund", headMap, JSON.toJSONString(paramMap)); | |||
| /** | |||
| * 积分抵扣 接口 | |||
| @@ -1,6 +1,7 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.AliBusinessCircleOrder; | |||
| import com.iformall.domain.po.WxMerchant; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| @@ -38,9 +39,9 @@ public interface AliBusinessCircleOrderService { | |||
| List<AliBusinessCircleOrder> getRefundOrderByTransactionId(String transactionId, String tenantId); | |||
| void createOrder(WxMerchant wxMerchant, AliBusinessCircleOrder record); | |||
| ResultData createOrder(WxMerchant wxMerchant, AliBusinessCircleOrder record); | |||
| void insertRefundNoticeOrder(WxMerchant wxMerchant, AliBusinessCircleOrder record); | |||
| ResultData insertRefundNoticeOrder(WxMerchant wxMerchant, AliBusinessCircleOrder record); | |||
| /** | |||
| * 积分 | |||
| @@ -1,6 +1,7 @@ | |||
| package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxBusinessCircleOrder; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| @@ -36,9 +37,9 @@ public interface WxBusinessCircleOrderService { | |||
| WxBusinessCircleOrder getRefundOrderByRefundId(String refundId, String tenantId); | |||
| List<WxBusinessCircleOrder> getRefundOrderByTransactionId(String transactionId, String tenantId); | |||
| void createOrder(WxBusinessCircleOrder record); | |||
| ResultData createOrder(WxBusinessCircleOrder record); | |||
| void insertRefundNoticeOrder(WxBusinessCircleOrder record); | |||
| ResultData insertRefundNoticeOrder(WxBusinessCircleOrder record); | |||
| /** | |||
| * 更新积分 | |||
| @@ -2,10 +2,13 @@ package com.iformall.service.impl; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.AliBusinessCircleOrderMapper; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.RedisLock; | |||
| @@ -45,6 +48,9 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder | |||
| @Autowired | |||
| WxCreditHistoryService creditHistoryService; | |||
| @Autowired | |||
| WxCouponSendService wxCouponSendService; | |||
| @Override | |||
| public PageInfo<AliBusinessCircleOrder> listAsPage(AliBusinessCircleOrder record, Integer pageIndex, Integer pageSize) { | |||
| @@ -100,7 +106,7 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void createOrder(WxMerchant wxMerchant, AliBusinessCircleOrder record) { | |||
| public ResultData createOrder(WxMerchant wxMerchant, AliBusinessCircleOrder record) { | |||
| String lockKey = StringUtils.join(ALI_CIRCLE_KEY,record.getTransactionId(), ":",EnumYesOrNo.NO.getCode(),":","lock"); | |||
| long time = System.currentTimeMillis() + 2000; | |||
| String timeStr = String.valueOf(time); | |||
| @@ -108,6 +114,8 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder | |||
| AliBusinessCircleOrder byTransactionId = this.getOrderByTransactionId(record.getTransactionId(),record.getTenantId()); | |||
| if(byTransactionId != null){ | |||
| logger.error("--Ali商圈付款--订单消息已存在---byTransactionId="+byTransactionId.getTransactionId()); | |||
| redisLock.unlock(lockKey, timeStr); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "订单数据已存在"); | |||
| }else{ | |||
| Date now = new Date(); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| @@ -115,40 +123,51 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder | |||
| record.setCreateTime(now); | |||
| record.setUpdateTime(now); | |||
| //TODO 第三方获取门店(标识可能发生变化) | |||
| // WxMerchant wxMerchant = wxMerchantService.getById(Long.parseLong(record.getMallStoreId())); | |||
| //必有门店 | |||
| // WxMerchant wxMerchant = wxMerchantService.getMerchantByEncode(record.getMallStoreId()); | |||
| // if(wxMerchant != null){ | |||
| // record.setMerchantId(wxMerchant.getId()); | |||
| // }else{ | |||
| // logger.error("--Ali商圈付款通知消息未找到门店--mallStoreId="+record.getMallStoreId()); | |||
| // } | |||
| record.setMerchantId(wxMerchant.getId()); | |||
| record.setMerchantName(wxMerchant.getName()); | |||
| AliPayCUser userQ = new AliPayCUser(); | |||
| userQ.updateTenantInfo(record); | |||
| userQ.setAlipayUserId(record.getBuyerId()); | |||
| AliPayCUser aliUser = aliPayCUserService.getByAliPayUserId(userQ); | |||
| if(aliUser != null){ | |||
| // WxCUserBasicInfo infoByPhone = wxCUserBasicInfoService.findInfoByPhone(aliUser, aliUser.getPhone()); | |||
| WxCUserBasicInfo infoByPhone = wxCUserBasicInfoService.registerByPhone(aliUser, aliUser.getPhone(),aliUser.getName(),null,null); | |||
| if(infoByPhone != null ){ | |||
| record.setCUserId(infoByPhone.getId()); | |||
| record.setCUserNickName(infoByPhone.getNickName()); | |||
| record.setCUserPhone(infoByPhone.getPhone()); | |||
| if(wxMerchant == null && StringUtils.isNotBlank(record.getMallStoreId())){ | |||
| wxMerchant = wxMerchantService.getMerchantByEncode(record.getMallStoreId()); | |||
| } | |||
| if(wxMerchant != null){ | |||
| record.setMerchantId(wxMerchant.getId()); | |||
| record.setMerchantName(wxMerchant.getName()); | |||
| }else{ | |||
| logger.error("--Ali商圈付款通知消息未找到门店--mallStoreId="+record.getMallStoreId()); | |||
| record.setMerchantName("未知门店"); | |||
| } | |||
| if(record.getCUserId() != null){ | |||
| WxCUserBasicInfo byId = wxCUserBasicInfoService.getById(record.getCUserId(), record.getFinalTenantId()); | |||
| if(byId != null){ | |||
| record.setCUserNickName(byId.getNickName()); | |||
| record.setCUserPhone(byId.getPhone()); | |||
| }else{ | |||
| logger.error("--Ali商圈付款通知消息未找到会员--aliUserId="+record.getBuyerId()); | |||
| record.setCUserId(null); | |||
| } | |||
| }else{ | |||
| logger.error("--Ali商圈付款通知消息未找到会员--aliUserId="+record.getBuyerId()); | |||
| AliPayCUser userQ = new AliPayCUser(); | |||
| userQ.updateTenantInfo(record); | |||
| userQ.setAlipayUserId(record.getBuyerId()); | |||
| AliPayCUser aliUser = aliPayCUserService.getByAliPayUserId(userQ); | |||
| if(aliUser != null){ | |||
| // WxCUserBasicInfo infoByPhone = wxCUserBasicInfoService.findInfoByPhone(aliUser, aliUser.getPhone()); | |||
| WxCUserBasicInfo infoByPhone = wxCUserBasicInfoService.registerByPhone(aliUser, aliUser.getPhone(),aliUser.getName(),null,null); | |||
| if(infoByPhone != null ){ | |||
| record.setCUserId(infoByPhone.getId()); | |||
| record.setCUserNickName(infoByPhone.getNickName()); | |||
| record.setCUserPhone(infoByPhone.getPhone()); | |||
| }else{ | |||
| logger.error("--Ali商圈付款通知消息未找到会员--aliUserId="+record.getBuyerId()); | |||
| } | |||
| }else{ | |||
| logger.error("--Ali商圈付款通知消息未找到会员--aliUserId="+record.getBuyerId()); | |||
| } | |||
| } | |||
| aliBusinessCircleOrderMapper.insertNoticeOrder(record); | |||
| if(record.getCUserId() == null){ | |||
| redisLock.unlock(lockKey, timeStr); | |||
| return; | |||
| return new ResultData(0); | |||
| } | |||
| Integer businessId = EnumBusiness.BUSINESS_ID6.getCode(); | |||
| if(wxMerchant != null){ | |||
| @@ -165,7 +184,7 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder | |||
| creditHistory.setMerchantId(record.getMerchantId()); | |||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | |||
| creditHistory.setSpend(record.getPayAmount()); | |||
| creditHistory.setChangePurpose("支付宝商圈消费:商户["+wxMerchant.getName()+"] ("+record.getPayAmountStr()+"元) "); | |||
| creditHistory.setChangePurpose("支付宝商圈消费:商户["+record.getMerchantName()+"] ("+record.getPayAmountStr()+"元) "); | |||
| creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||
| Integer creditNum = 0; | |||
| if (creditHistory.getCreditNum() != null) { | |||
| @@ -173,14 +192,22 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder | |||
| } | |||
| if(creditNum == 0){ | |||
| redisLock.unlock(lockKey, timeStr); | |||
| return; | |||
| return new ResultData(0); | |||
| } | |||
| record.setIncreasedPoints(creditNum); | |||
| record.setPointsUpdateTime(creditHistory.getCreateDate()); | |||
| this.updatePoints(record); | |||
| try { | |||
| wxCouponSendService.sendCouponToUser(EnumCouponSendSendType.B_MICROPAY, record,EnumPayWay.PAY_WAY_NOT_UNPAY_B_MA); | |||
| } catch (Exception e) { | |||
| logger.error("支付发券: " + e.getMessage()); | |||
| } | |||
| redisLock.unlock(lockKey, timeStr); | |||
| return new ResultData(creditNum); | |||
| } | |||
| redisLock.unlock(lockKey, timeStr); | |||
| }else{ | |||
| logger.debug("CacheAspect 读库等待中, key:{}: " + lockKey); | |||
| try { | |||
| @@ -190,16 +217,18 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder | |||
| }finally { | |||
| redisLock.unlock(lockKey, timeStr); | |||
| } | |||
| return new ResultData(ErrorCode.SYS_REPEAT_SUBMIT_EXCEPTION); | |||
| } | |||
| } | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void insertRefundNoticeOrder(WxMerchant wxMerchant, AliBusinessCircleOrder record) { | |||
| public ResultData insertRefundNoticeOrder(WxMerchant wxMerchant, AliBusinessCircleOrder record) { | |||
| AliBusinessCircleOrder order = this.getOrderByTransactionId(record.getTransactionId(),record.getTenantId()); | |||
| if(order == null){ | |||
| logger.error("--Ali商圈退款--付款消息未找到--transactionId="+record.getTransactionId()); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "付款消息未找到"); | |||
| }else{ | |||
| String lockKey = StringUtils.join(ALI_CIRCLE_KEY,record.getTransactionId(), ":",EnumYesOrNo.YES.getCode(),":","lock"); | |||
| long time = System.currentTimeMillis() + 2000; | |||
| @@ -208,6 +237,8 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder | |||
| List<AliBusinessCircleOrder> refundOrders = this.getRefundOrderByTransactionId(record.getTransactionId(),record.getTenantId()); | |||
| if(refundOrders != null && refundOrders.size() > 0){ | |||
| logger.error("--Ali商圈退款--已经退款--transactionId="+record.getTransactionId()); | |||
| redisLock.unlock(lockKey, timeStr); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "退款数据已存在"); | |||
| } | |||
| // AliBusinessCircleOrder refundOrder = this.getRefundOrderByRefundId(record.getRefundId(),record.getTenantId()); | |||
| @@ -251,6 +282,7 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder | |||
| order.setUpdateTime(now); | |||
| aliBusinessCircleOrderMapper.updateOrderStatus(order); | |||
| int creditNum = 0; | |||
| if(order.getEarnPoints().equals(EnumYesOrNo.YES.getCode())){ | |||
| WxCreditHistory creditHistory = new WxCreditHistory(); | |||
| creditHistory.setTenantId(record.getFinalTenantId()); | |||
| @@ -273,25 +305,22 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder | |||
| int points = order.getIncreasedPoints(); | |||
| creditHistory.setCreditNum(points); | |||
| creditHistory.setSpend(0-record.getRefundAmount()); | |||
| creditHistory.setChangePurpose("支付宝商圈退款:商户["+wxMerchant.getName()+"] ("+record.getRefundAmountStr()+"元) "); | |||
| creditHistory.setChangePurpose("支付宝商圈退款:商户["+record.getMerchantName()+"] ("+record.getRefundAmountStr()+"元) "); | |||
| creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||
| Integer creditNum = 0; | |||
| if (creditHistory.getCreditNum() != null) { | |||
| creditNum = creditHistory.getCreditNum(); | |||
| } | |||
| if(creditNum == 0){ | |||
| redisLock.unlock(lockKey, timeStr); | |||
| return; | |||
| if(creditNum != 0){ | |||
| record.setIncreasedPoints(creditNum); | |||
| record.setPointsUpdateTime(creditHistory.getCreateDate()); | |||
| this.updatePoints(record); | |||
| } | |||
| record.setIncreasedPoints(creditNum); | |||
| record.setPointsUpdateTime(creditHistory.getCreateDate()); | |||
| this.updatePoints(record); | |||
| } | |||
| redisLock.unlock(lockKey, timeStr); | |||
| return new ResultData(creditNum); | |||
| } | |||
| // } | |||
| redisLock.unlock(lockKey, timeStr); | |||
| }else{ | |||
| logger.debug("CacheAspect 读库等待中, key:{}: " + lockKey); | |||
| try { | |||
| @@ -301,6 +330,7 @@ public class AliBusinessCircleOrderServiceImpl implements AliBusinessCircleOrder | |||
| }finally { | |||
| redisLock.unlock(lockKey, timeStr); | |||
| } | |||
| return new ResultData(ErrorCode.SYS_REPEAT_SUBMIT_EXCEPTION); | |||
| } | |||
| } | |||
| } | |||
| @@ -2,10 +2,13 @@ package com.iformall.service.impl; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxBusinessCircleOrderMapper; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.RedisLock; | |||
| @@ -49,6 +52,9 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe | |||
| @Autowired | |||
| WxCallBackService wxCallBackService; | |||
| @Autowired | |||
| WxCouponSendService wxCouponSendService; | |||
| @Override | |||
| public PageInfo<WxBusinessCircleOrder> listAsPage(WxBusinessCircleOrder record, Integer pageIndex, Integer pageSize) { | |||
| @@ -104,7 +110,7 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void createOrder(WxBusinessCircleOrder record) { | |||
| public ResultData createOrder(WxBusinessCircleOrder record) { | |||
| String lockKey = StringUtils.join(WX_CIRCLE_KEY,record.getTransactionId(), ":",EnumYesOrNo.NO.getCode(),":", "lock"); | |||
| long time = System.currentTimeMillis() + 2000; | |||
| String timeStr = String.valueOf(time); | |||
| @@ -113,6 +119,8 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe | |||
| WxBusinessCircleOrder byTransactionId = this.getOrderByTransactionId(record.getTransactionId(),record.getTenantId()); | |||
| if(byTransactionId != null){ | |||
| logger.error("--Wx商圈付款--订单消息已存在---byTransactionId="+byTransactionId.getTransactionId()); | |||
| redisLock.unlock(lockKey, timeStr); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "订单数据已存在"); | |||
| }else { | |||
| Date now = new Date(); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| @@ -127,21 +135,35 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe | |||
| record.setMerchantId(wxMerchant.getId()); | |||
| record.setMerchantName(wxMerchant.getName()); | |||
| } else { | |||
| record.setMerchantName("未知门店"); | |||
| logger.error("--wx商圈付款通知消息未找到门店--shopName=" + record.getWxShopName() + "&shopNumber=" + record.getWxShopNumber()); | |||
| } | |||
| WxCUser userQ = new WxCUser(); | |||
| userQ.updateTenantInfo(record); | |||
| userQ.setOpenId(record.getOpenid()); | |||
| userQ.setAppId(record.getAppid()); | |||
| WxCUser user = wxCUserService.getByOpenId(userQ); | |||
| if (user != null && user.getUserId() != null) { | |||
| record.setCUserId(user.getUserId()); | |||
| record.setCUserNickName(user.getNickName()); | |||
| record.setCUserPhone(user.getPhone()); | |||
| } else { | |||
| logger.error("--Wx商圈付款通知消息未找到会员--openid=" + record.getOpenid()); | |||
| if(StringUtils.isNotBlank(record.getOpenid()) && StringUtils.isNotBlank(record.getAppid())){ | |||
| WxCUser userQ = new WxCUser(); | |||
| userQ.updateTenantInfo(record); | |||
| userQ.setOpenId(record.getOpenid()); | |||
| userQ.setAppId(record.getAppid()); | |||
| WxCUser user = wxCUserService.getByOpenId(userQ); | |||
| if (user != null && user.getUserId() != null) { | |||
| record.setCUserId(user.getUserId()); | |||
| } | |||
| } | |||
| if(record.getCUserId() == null){ | |||
| logger.error("--微信商圈付款通知消息未找到会员--1"); | |||
| }else{ | |||
| WxCUserBasicInfo byId = wxCUserBasicInfoService.getById(record.getCUserId(), record.getFinalTenantId()); | |||
| if(byId != null){ | |||
| record.setCUserNickName(byId.getNickName()); | |||
| record.setCUserPhone(byId.getPhone()); | |||
| }else{ | |||
| record.setCUserId(null); | |||
| logger.error("--微信商圈付款通知消息未找到会员--2"); | |||
| } | |||
| } | |||
| wxBusinessCircleOrderMapper.insertNoticeOrder(record); | |||
| Integer creditNum = 0; | |||
| if(record.getCUserId() != null){ | |||
| Integer businessId = EnumBusiness.BUSINESS_ID6.getCode(); | |||
| if(wxMerchant != null){ | |||
| @@ -158,26 +180,34 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe | |||
| creditHistory.setMerchantId(record.getMerchantId()); | |||
| creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode()); | |||
| creditHistory.setSpend(record.getPayAmount()); | |||
| creditHistory.setChangePurpose("微信商圈消费:商户["+record.getWxShopName()+"] ("+record.getPayAmountStr()+"元) "); | |||
| creditHistory.setChangePurpose("微信商圈消费:商户["+record.getWxMerchantName()+"] ("+record.getPayAmountStr()+"元) "); | |||
| creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||
| Integer creditNum = 0; | |||
| if (creditHistory.getCreditNum() != null) { | |||
| creditNum = creditHistory.getCreditNum(); | |||
| } | |||
| if(creditNum == 0){ | |||
| redisLock.unlock(lockKey, timeStr); | |||
| return; | |||
| return new ResultData(0); | |||
| } | |||
| record.setIncreasedPoints(creditNum); | |||
| record.setPointsUpdateTime(creditHistory.getCreateDate()); | |||
| this.updatePoints(record); | |||
| //同步积分 | |||
| wxCallBackService.notifyPoints(record); | |||
| } | |||
| try { | |||
| wxCouponSendService.sendCouponToUser(EnumCouponSendSendType.B_MICROPAY, record,EnumPayWay.PAY_WAY_NOT_UNPAY_B_MA); | |||
| } catch (Exception e) { | |||
| logger.error("支付发券: " + e.getMessage()); | |||
| } | |||
| if(StringUtils.isNotBlank(record.getNoticeId())){ | |||
| //同步积分 | |||
| wxCallBackService.notifyPoints(record); | |||
| } | |||
| } | |||
| redisLock.unlock(lockKey, timeStr); | |||
| return new ResultData(creditNum); | |||
| } | |||
| redisLock.unlock(lockKey, timeStr); | |||
| }else { | |||
| logger.debug("CacheAspect 读库等待中, key:{}: " + lockKey); | |||
| @@ -188,16 +218,18 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe | |||
| }finally { | |||
| redisLock.unlock(lockKey, timeStr); | |||
| } | |||
| return new ResultData(ErrorCode.SYS_REPEAT_SUBMIT_EXCEPTION); | |||
| } | |||
| } | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public void insertRefundNoticeOrder(WxBusinessCircleOrder record) { | |||
| public ResultData insertRefundNoticeOrder(WxBusinessCircleOrder record) { | |||
| WxBusinessCircleOrder order = this.getOrderByTransactionId(record.getTransactionId(),record.getTenantId()); | |||
| if(order == null){ | |||
| logger.error("--Wx商圈退款--付款消息未找到--transactionId="+record.getTransactionId()); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "付款消息未找到"); | |||
| }else{ | |||
| String lockKey = StringUtils.join(WX_CIRCLE_KEY,record.getRefundId(), ":",EnumYesOrNo.YES.getCode(),":", "lock"); | |||
| long time = System.currentTimeMillis() + 2000; | |||
| @@ -206,6 +238,8 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe | |||
| WxBusinessCircleOrder refundOrder = this.getRefundOrderByRefundId(record.getRefundId(),record.getTenantId()); | |||
| if(refundOrder != null){ | |||
| logger.error("--Ali商圈退款--退款消息已存在---RefundId="+record.getRefundId()); | |||
| redisLock.unlock(lockKey, timeStr); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "退款数据已存在"); | |||
| }else{ | |||
| List<WxBusinessCircleOrder> refundOrders = this.getRefundOrderByTransactionId(record.getTransactionId(),record.getTenantId()); | |||
| Integer amount = order.getPayAmount(); | |||
| @@ -219,10 +253,17 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe | |||
| refundIncreasedPoints += ro.getIncreasedPoints(); | |||
| } | |||
| } | |||
| if(record.getRefundAmount() == null){ | |||
| record.setRefundAmount(order.getPayAmount()-refundAmount); | |||
| } | |||
| if(refundAmount >= amount){ | |||
| logger.error("--Wx商圈退款--已经退款--transactionId="+record.getTransactionId()); | |||
| redisLock.unlock(lockKey, timeStr); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "已经退款"); | |||
| }else if((refundAmount + record.getRefundAmount()) > amount ){ | |||
| logger.error("--Wx商圈退款--退款金额超限--transactionId="+record.getTransactionId()); | |||
| redisLock.unlock(lockKey, timeStr); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "退款金额超限"); | |||
| }else{ | |||
| Date now = new Date(); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| @@ -244,7 +285,7 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe | |||
| } | |||
| order.setUpdateTime(now); | |||
| wxBusinessCircleOrderMapper.updateOrderStatus(order); | |||
| int creditNum = 0; | |||
| if(order.getEarnPoints().equals(EnumYesOrNo.YES.getCode())){ | |||
| WxCreditHistory creditHistory = new WxCreditHistory(); | |||
| creditHistory.setTenantId(record.getFinalTenantId()); | |||
| @@ -267,24 +308,22 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe | |||
| creditHistory.setCreditNum(points); | |||
| creditHistory.setSpend(0-record.getRefundAmount()); | |||
| creditHistory.setChangePurpose("微信商圈退款:商户["+record.getWxShopName()+"] ("+record.getRefundAmountStr()+"元) "); | |||
| creditHistory.setChangePurpose("微信商圈退款:商户["+record.getMerchantName()+"] ("+record.getRefundAmountStr()+"元) "); | |||
| creditHistory = creditHistoryService.saveOrUpdate(creditHistory,record.getTenantId()); | |||
| Integer creditNum = 0; | |||
| if (creditHistory.getCreditNum() != null) { | |||
| creditNum = creditHistory.getCreditNum(); | |||
| } | |||
| if(creditNum == 0){ | |||
| redisLock.unlock(lockKey, timeStr); | |||
| return; | |||
| if(creditNum != 0){ | |||
| record.setIncreasedPoints(creditNum); | |||
| record.setPointsUpdateTime(creditHistory.getCreateDate()); | |||
| this.updatePoints(record); | |||
| } | |||
| record.setIncreasedPoints(creditNum); | |||
| record.setPointsUpdateTime(creditHistory.getCreateDate()); | |||
| this.updatePoints(record); | |||
| } | |||
| redisLock.unlock(lockKey, timeStr); | |||
| return new ResultData(creditNum); | |||
| } | |||
| } | |||
| redisLock.unlock(lockKey, timeStr); | |||
| }else { | |||
| logger.debug("CacheAspect 读库等待中, key:{}: " + lockKey); | |||
| try { | |||
| @@ -294,6 +333,7 @@ public class WxBusinessCircleOrderServiceImpl implements WxBusinessCircleOrderSe | |||
| }finally { | |||
| redisLock.unlock(lockKey, timeStr); | |||
| } | |||
| return new ResultData(ErrorCode.SYS_REPEAT_SUBMIT_EXCEPTION); | |||
| } | |||
| } | |||
| @@ -266,14 +266,14 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||
| } catch (Exception e) { | |||
| logger.error("收银发券条件判断错误:ID=" + wxCouponSend.getId() + e.getMessage()); | |||
| } | |||
| }else if(param.getClass().equals(WxThirdPartyOrders.class)){ | |||
| WxThirdPartyOrders thirdOrder = (WxThirdPartyOrders) param; | |||
| }else if(param.getClass().equals(BusinessCircleBase.class)){ | |||
| BusinessCircleBase circleBase = (BusinessCircleBase) param; | |||
| try { | |||
| JSONObject jo = JSONObject.parseObject(wxCouponSend.getConditions()); | |||
| if (thirdOrder.getMerchantId() != null | |||
| && thirdOrder.getMerchantId().equals(jo.getLong("id"))) { | |||
| if (circleBase.getMerchantId() != null | |||
| && circleBase.getMerchantId().equals(jo.getLong("id"))) { | |||
| return true; | |||
| } | |||
| } catch (Exception e) { | |||
| @@ -325,10 +325,10 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||
| cUserId = order.getCUserId(); | |||
| tenantEntity = order; | |||
| break; | |||
| }else if(param.getClass().equals(WxThirdPartyOrders.class)){ | |||
| WxThirdPartyOrders thirdOrder = (WxThirdPartyOrders) param; | |||
| cUserId = thirdOrder.getCUserId(); | |||
| tenantEntity = thirdOrder; | |||
| }else if(param.getClass().equals(BusinessCircleBase.class)){ | |||
| BusinessCircleBase circleBase = (BusinessCircleBase) param; | |||
| cUserId = circleBase.getCUserId(); | |||
| tenantEntity = circleBase; | |||
| break; | |||
| }else{ | |||
| return false; | |||