Browse Source

fixed 卡券适用店铺

fushengqian 1 year ago
parent
commit
625aff0056

+ 3 - 0
fuint-application/src/main/java/com/fuint/common/dto/UserCouponDto.java

@@ -67,6 +67,9 @@ public class UserCouponDto implements Serializable {
     @ApiModelProperty("有效期")
     private String effectiveDate;
 
+    @ApiModelProperty("适用店铺")
+    private String storeNames;
+
     @ApiModelProperty("提示信息")
     private String tips;
 

+ 8 - 0
fuint-application/src/main/java/com/fuint/common/service/StoreService.java

@@ -96,4 +96,12 @@ public interface StoreService extends IService<MtStore> {
      * */
     List<MtStore> queryByDistance(String merchantNo, String keyword, String latitude, String longitude) throws BusinessCheckException;
 
+    /**
+     * 获取店铺名称
+     *
+     * @param storeIds 店铺ID
+     * @return
+     * */
+    String getStoreNames(String storeIds);
+
 }

+ 24 - 0
fuint-application/src/main/java/com/fuint/common/service/impl/StoreServiceImpl.java

@@ -382,4 +382,28 @@ public class StoreServiceImpl extends ServiceImpl<MtStoreMapper, MtStore> implem
 
         return dataList;
     }
+
+    /**
+     * 获取店铺名称
+     *
+     * @param storeIds 店铺ID
+     * @return
+     * */
+    @Override
+    public String getStoreNames(String storeIds) {
+       if (StringUtil.isEmpty(storeIds)) {
+           return "";
+       }
+       String[] ids = storeIds.split(",");
+       List<String> storeNames = new ArrayList<>();
+       if (ids.length > 0) {
+           for (int i = 0; i < ids.length; i++) {
+                MtStore mtStore = mtStoreMapper.selectById(Integer.parseInt(ids[i]));
+                if (mtStore != null) {
+                    storeNames.add(mtStore.getName());
+                }
+           }
+       }
+       return String.join(",", storeNames);
+    }
 }

+ 9 - 0
fuint-application/src/main/java/com/fuint/module/clientApi/controller/ClientUserCouponController.java

@@ -73,6 +73,11 @@ public class ClientUserCouponController extends BaseController {
      */
     private MemberService memberService;
 
+    /**
+     * 店铺接口
+     */
+    private StoreService storeService;
+
     /**
      * 查询会员卡券详情
      *
@@ -172,6 +177,10 @@ public class ClientUserCouponController extends BaseController {
             result.setStatus(userCoupon.getStatus());
             result.setIsGive(couponInfo.getIsGive());
 
+            // 适用店铺
+            String storeNames = storeService.getStoreNames(couponInfo.getStoreIds());
+            result.setStoreNames(storeNames);
+
             // 如果是计次卡,获取核销列表
             if (couponInfo.getType().equals(CouponTypeEnum.TIMER.getKey())) {
                 if (userCouponId <= 0 && StringUtil.isNotEmpty(userCouponCode)) {