Commit 3cca38b8 by guojuxing

小程序和企业查询的微盟店铺信息

parent e1c9f75b
package com.gic.enterprise.dto.wm;
import java.io.Serializable;
/**
* 小程序和企业查询的微盟店铺信息
* @ClassName: WmCouponPackageDTO

* @Description: 

* @author guojuxing

* @date 2020/6/10 11:02 AM

*/
public class WmCouponPackageDTO implements Serializable{
private static final long serialVersionUID = 5877924777936796488L;
/**
* 店铺主键ID
*/
private Integer wmMallStoreId;
/**
* 微盟pid
*/
private Long pid;
/**
* 微盟主账号
*/
private String wmMainAccount;
public Integer getWmMallStoreId() {
return wmMallStoreId;
}
public WmCouponPackageDTO setWmMallStoreId(Integer wmMallStoreId) {
this.wmMallStoreId = wmMallStoreId;
return this;
}
public Long getPid() {
return pid;
}
public WmCouponPackageDTO setPid(Long pid) {
this.pid = pid;
return this;
}
public String getWmMainAccount() {
return wmMainAccount;
}
public WmCouponPackageDTO setWmMainAccount(String wmMainAccount) {
this.wmMainAccount = wmMainAccount;
return this;
}
}
......@@ -5,10 +5,7 @@ import com.gic.api.base.commons.ServiceResponse;
import com.gic.enterprise.dto.WmMemberCardConfigDTO;
import com.gic.enterprise.dto.WmOrderConfigDTO;
import com.gic.enterprise.dto.WmStoreDTO;
import com.gic.enterprise.dto.wm.WmCouponDTO;
import com.gic.enterprise.dto.wm.WmGoodsConfigDTO;
import com.gic.enterprise.dto.wm.WmStoreConfigDTO;
import com.gic.enterprise.dto.wm.WmStoreCouponConfigDTO;
import com.gic.enterprise.dto.wm.*;
import com.gic.enterprise.qo.wm.CouponConfigQO;
import java.util.List;
......@@ -99,6 +96,17 @@ public interface WmStoreApiService {
ServiceResponse<WmGoodsConfigDTO> getGoodsConfig(Integer wmMallStoreId);
/**
* 小程序和企业查询的微盟店铺信息
* @Title: getWmListByAppId

* @Description:

* @author guojuxing
* @param enterpriseId 商户ID
* @param appId
小程序ID
* @return com.gic.api.base.commons.ServiceResponse<java.util.List<com.gic.enterprise.dto.wm.WmCouponPackageDTO>>


*/
ServiceResponse<List<WmCouponPackageDTO>> getWmListByAppId(Integer enterpriseId, String appId);
/**
* 根据微盟主账号查询配置
* @Title: getWmStoreConfig

* @Description:
......
......@@ -67,7 +67,7 @@ public interface TabWmStoreMapper {
int countByStoreName(@Param("storeName") String storeName, @Param("wmMallStoreId") Integer wmMallStoreId, @Param("enterpriseId") Integer enterpriseId);
List<TabWmStore> listWmStore(Integer enterpriseId);
List<TabWmStore> listWmStore(@Param("enterpriseId") Integer enterpriseId, @Param("appId") String appId);
TabWmStore getByWmMainAccount(String wmMainAccount);
}
\ No newline at end of file
......@@ -61,4 +61,6 @@ public interface WmStoreService {
TabWmStore getByWmMainAccount(String wmMainAccount);
List<TabWmStore> listWmStore(Integer enterpriseId);
List<TabWmStore> getWmListByAppId(Integer enterpriseId, String appId);
}
......@@ -65,6 +65,11 @@ public class WmStoreServiceImpl implements WmStoreService{
@Override
public List<TabWmStore> listWmStore(Integer enterpriseId) {
return tabWmStoreMapper.listWmStore(enterpriseId);
return tabWmStoreMapper.listWmStore(enterpriseId, null);
}
@Override
public List<TabWmStore> getWmListByAppId(Integer enterpriseId, String appId) {
return tabWmStoreMapper.listWmStore(enterpriseId, appId);
}
}
package com.gic.enterprise.service.outer.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
import com.gic.enterprise.dto.wm.WmGoodsConfigDTO;
import com.gic.enterprise.dto.wm.*;
import com.gic.enterprise.entity.TabWmStoreSyncLog;
import com.gic.enterprise.service.*;
import org.apache.commons.collections.CollectionUtils;
......@@ -25,9 +22,6 @@ import com.gic.enterprise.constant.WmStoreConfigTypeEnum;
import com.gic.enterprise.dto.WmMemberCardConfigDTO;
import com.gic.enterprise.dto.WmOrderConfigDTO;
import com.gic.enterprise.dto.WmStoreDTO;
import com.gic.enterprise.dto.wm.WmCouponDTO;
import com.gic.enterprise.dto.wm.WmStoreConfigDTO;
import com.gic.enterprise.dto.wm.WmStoreCouponConfigDTO;
import com.gic.enterprise.entity.TabWmStore;
import com.gic.enterprise.entity.TabWmStoreConfig;
import com.gic.enterprise.entity.TabWmStoreCouponConfig;
......@@ -143,6 +137,31 @@ public class WmStoreApiServiceImpl implements WmStoreApiService {
return ServiceResponse.failure(result.getCode(), result.getMessage());
}
@Override
public ServiceResponse<List<WmCouponPackageDTO>> getWmListByAppId(Integer enterpriseId, String appId) {
List<TabWmStore> list = wmStoreService.getWmListByAppId(enterpriseId, appId);
if (CollectionUtils.isNotEmpty(list)) {
return ServiceResponse.success(list
.stream()
.filter(e -> {
//卡券配置是卡券包的店铺
ServiceResponse<TabWmStoreConfig> result = getWmConfig(e.getWmMallStoreId(), WmStoreConfigTypeEnum.COUPON_CONFIG);
if (result.isSuccess()) {
if ("2".equals(JSON.parseObject(result.getResult().getStoreConfigJson()).getString("couponMode"))) {
return true;
}
}
return false;
})
.map(e -> new WmCouponPackageDTO()
.setPid(Long.valueOf(e.getWmPid()))
.setWmMainAccount(e.getWmMainAccount())
.setWmMallStoreId(e.getWmMallStoreId()))
.collect(Collectors.toList()));
}
return ServiceResponse.success(Collections.emptyList());
}
private ServiceResponse<TabWmStoreConfig> getWmConfig(Integer wmMallStoreId, WmStoreConfigTypeEnum typeEnum) {
TabWmStore record = wmStoreService.getByWmMallStoreId(wmMallStoreId);
if (record == null) {
......
......@@ -236,6 +236,9 @@
from tab_wm_store
where enterprise_id = #{enterpriseId}
and status = 1
<if test="appId != null and appId != '' ">
and wm_appid = #{appId}
</if>
</select>
<select id="getByWmMainAccount" resultMap="BaseResultMap">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment