| @@ -54,6 +54,8 @@ public class WxMerchantVo extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="楼层号",name="floor") | @io.swagger.annotations.ApiModelProperty(value="楼层号",name="floor") | ||||
| private Integer floor; | private Integer floor; | ||||
| @io.swagger.annotations.ApiModelProperty(value="是否为商管商户 1是 0否",name="status") | |||||
| private Integer isAdmin; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "是否显示在C端", name = "show") | @io.swagger.annotations.ApiModelProperty(value = "是否显示在C端", name = "show") | ||||
| private Integer isPublic; | private Integer isPublic; | ||||
| @@ -125,6 +127,7 @@ public class WxMerchantVo extends TenantEntity { | |||||
| this.merchantLinkPhone = m.getLinkPhone(); | this.merchantLinkPhone = m.getLinkPhone(); | ||||
| this.merchantStatus = m.getStatus(); | this.merchantStatus = m.getStatus(); | ||||
| this.businessId = m.getBusinessId(); | this.businessId = m.getBusinessId(); | ||||
| this.isAdmin = m.getIsAdmin(); | |||||
| this.isPublic = m.getIsPublic(); | this.isPublic = m.getIsPublic(); | ||||
| this.email = m.getEmail(); | this.email = m.getEmail(); | ||||
| this.title = m.getTitle(); | this.title = m.getTitle(); | ||||
| @@ -33,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional; | |||||
| import java.util.*; | import java.util.*; | ||||
| import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
| import java.util.stream.Stream; | |||||
| import static java.util.stream.Collectors.toList; | import static java.util.stream.Collectors.toList; | ||||
| @@ -148,6 +149,14 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||||
| //获取门店 | //获取门店 | ||||
| List<WxMerchantVo> couponMerchantList = wxCouponService.getCouponMerchantList(coupon, coupon.getId()); | List<WxMerchantVo> couponMerchantList = wxCouponService.getCouponMerchantList(coupon, coupon.getId()); | ||||
| if(couponMerchantList.size() > 0){ | |||||
| List<WxMerchantVo> isAdminList = couponMerchantList.stream().filter(m -> EnumYesOrNo.YES.getCode().equals(m.getIsAdmin())).collect(Collectors.toList()); | |||||
| if(isAdminList != null && isAdminList.size() == 1){ | |||||
| couponMerchantList = isAdminList; | |||||
| }else if(isAdminList != null && isAdminList.size() > 1){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"数据异常,存在多个商管商户"); | |||||
| } | |||||
| } | |||||
| List<Product.PoiStruct> poiList = new ArrayList(); | List<Product.PoiStruct> poiList = new ArrayList(); | ||||
| for (WxMerchantVo mvo:couponMerchantList){ | for (WxMerchantVo mvo:couponMerchantList){ | ||||
| if(StringUtils.isNotBlank(mvo.getSupplierExtId())){ | if(StringUtils.isNotBlank(mvo.getSupplierExtId())){ | ||||
| @@ -832,7 +832,21 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| public String getCouponOneMerchantUid(EnumPayWay payWay,Long couponChannelId, String tenantId) { | public String getCouponOneMerchantUid(EnumPayWay payWay,Long couponChannelId, String tenantId) { | ||||
| WxCouponChannel couponChannel = wxCouponChannelMapper.selectById(couponChannelId, tenantId); | WxCouponChannel couponChannel = wxCouponChannelMapper.selectById(couponChannelId, tenantId); | ||||
| List<Long> merchantIds = wxCouponMerchantMapper.findMerchantIdListByProduct(couponChannel.getCouponId(), tenantId); | List<Long> merchantIds = wxCouponMerchantMapper.findMerchantIdListByProduct(couponChannel.getCouponId(), tenantId); | ||||
| Long merchantId = null; | |||||
| if(merchantIds != null && merchantIds.size() == 1){ | if(merchantIds != null && merchantIds.size() == 1){ | ||||
| merchantId = merchantIds.get(0); | |||||
| }else if(merchantIds != null && merchantIds.size() > 1){ | |||||
| WxMerchant merchantQ = new WxMerchant(); | |||||
| merchantQ.setTenantId(tenantId); | |||||
| merchantQ.setIds(merchantIds); | |||||
| merchantQ.setIsAdmin(EnumYesOrNo.YES.getCode()); | |||||
| merchantQ.setStatus(EnumMerchantStatus.VALID.getCode()); | |||||
| List<Long> list = wxMerchantMapper.findIdList(merchantQ); | |||||
| if(list != null && list.size() == 1){ | |||||
| merchantId = list.get(0); | |||||
| } | |||||
| } | |||||
| if(merchantId != null){ | |||||
| WxProfitSharingReceiver psReceiverQ = new WxProfitSharingReceiver(); | WxProfitSharingReceiver psReceiverQ = new WxProfitSharingReceiver(); | ||||
| psReceiverQ.setTenantId(tenantId); | psReceiverQ.setTenantId(tenantId); | ||||
| psReceiverQ.setMerchantId(merchantIds.get(0)); | psReceiverQ.setMerchantId(merchantIds.get(0)); | ||||
| @@ -665,10 +665,27 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| } | } | ||||
| if (EnumPayMchType.DIRECT.equals(payMchType)) { | if (EnumPayMchType.DIRECT.equals(payMchType)) { | ||||
| Long merchantId = null; | |||||
| if (merchantParamList.size() > 1) { | if (merchantParamList.size() > 1) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "直连模式只能选择一个对应门店"); | |||||
| List<Long> merchantIds = new ArrayList<>(); | |||||
| for (JSONObject o:merchantParamList) { | |||||
| merchantIds.add(o.getLong("id")); | |||||
| } | |||||
| WxMerchant merchantQ = new WxMerchant(); | |||||
| merchantQ.updateTenantInfo(record); | |||||
| merchantQ.setIds(merchantIds); | |||||
| merchantQ.setIsAdmin(EnumYesOrNo.YES.getCode()); | |||||
| merchantQ.setStatus(EnumMerchantStatus.VALID.getCode()); | |||||
| List<Long> list = wxMerchantMapper.findIdList(merchantQ); | |||||
| if(list == null || list.isEmpty()){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "直连模式多门店券需包含一个商管商户"); | |||||
| }else if(list.size() > 1){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "直连模式多门店券只能包含一个商管商户"); | |||||
| } | |||||
| merchantId = list.get(0); | |||||
| }else{ | |||||
| merchantId = merchantParamList.get(0).getLong("id"); | |||||
| } | } | ||||
| Long merchantId = merchantParamList.get(0).getLong("id"); | |||||
| WxProfitSharingReceiver psReceiverQ = new WxProfitSharingReceiver(); | WxProfitSharingReceiver psReceiverQ = new WxProfitSharingReceiver(); | ||||
| psReceiverQ.updateTenantInfo(record); | psReceiverQ.updateTenantInfo(record); | ||||
| psReceiverQ.setMerchantId(merchantId); | psReceiverQ.setMerchantId(merchantId); | ||||
| @@ -1472,6 +1472,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||||
| vo.setId(m.getId()); | vo.setId(m.getId()); | ||||
| vo.setTenantId(m.getTenantId()); | vo.setTenantId(m.getTenantId()); | ||||
| vo.setParentTenantId(m.getParentTenantId()); | vo.setParentTenantId(m.getParentTenantId()); | ||||
| vo.setIsAdmin(m.getIsAdmin()); | |||||
| vo.setMerchantImgUrl(m.getImgUrl()); | vo.setMerchantImgUrl(m.getImgUrl()); | ||||
| vo.setMerchantName(m.getName()); | vo.setMerchantName(m.getName()); | ||||
| vo.setMerchantLinkPhone(m.getLinkPhone()); | vo.setMerchantLinkPhone(m.getLinkPhone()); | ||||