Просмотр исходного кода

fix 优惠券商户,商铺信息

release_toaliyun_real
winter 4 лет назад
Родитель
Сommit
f5d7426daa
10 измененных файлов: 105 добавлений и 81 удалений
  1. +2
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxMerchantShop.java
  2. +0
    -1
      mallinkService/src/main/java/com/iformall/mapper/WxMerchantMapper.java
  3. +1
    -1
      mallinkService/src/main/java/com/iformall/mapper/WxMerchantShopMapper.java
  4. +2
    -5
      mallinkService/src/main/java/com/iformall/service/WxMerchantService.java
  5. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxShopService.java
  6. +14
    -5
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java
  7. +24
    -45
      mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java
  8. +46
    -4
      mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java
  9. +0
    -18
      mallinkService/src/main/resources/mapper/WxMerchantMapper.xml
  10. +15
    -1
      mallinkService/src/main/resources/mapper/WxMerchantShopMapper.xml

+ 2
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxMerchantShop.java Просмотреть файл

@@ -18,6 +18,8 @@ public class WxMerchantShop extends TenantEntity {

@io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId")
private Long merchantId;
@TableField(exist = false)
private List<Long> merchantIds;
@io.swagger.annotations.ApiModelProperty(value="商铺ID",name="shopId")
private Long shopId;
@TableField(exist = false)


+ 0
- 1
mallinkService/src/main/java/com/iformall/mapper/WxMerchantMapper.java Просмотреть файл

@@ -64,5 +64,4 @@ public interface WxMerchantMapper extends CommonMapper<WxMerchant, Long> {

List<Map<String, Object>> detailByShopId(@Param("tenantInfo")TenantEntity tenantInfo,@Param("shopId") Long shopId);

List<WxMerchantVo> newFindListCVo(@Param("tenantId")String tenantId, @Param("merchantIds")List<Long> merchantIds);
}

+ 1
- 1
mallinkService/src/main/java/com/iformall/mapper/WxMerchantShopMapper.java Просмотреть файл

@@ -13,7 +13,7 @@ public interface WxMerchantShopMapper extends CommonMapper<WxMerchantShop, Strin
List<Long> findMerchantIdList(WxMerchantShop wxMerchantShop);
List<Long> findShopIds(@Param("merchantId") Long merchantId);
List<Long> findShopIds(@Param("merchantIds") List<Long> merchantIds);

void delShops(@Param("merchantId") Long merchantId,@Param("shopList") List<Long> shopIds);


+ 2
- 5
mallinkService/src/main/java/com/iformall/service/WxMerchantService.java Просмотреть файл

@@ -155,8 +155,8 @@ public interface WxMerchantService {

PageInfo<WxMerchant> listVoAsPage(WxMerchant wxMerchant, Integer pageNum, Integer pageSize);
List<WxMerchantVo> findMerchantVoList(Long couponId,String tenantId);
Map<Long,List<WxMerchantVo>> findCouponMerchantVoList(List<Long> couponIds,String tenantId);
List<WxMerchantVo> findMerchantVoList(Long couponId,TenantEntity tenantEntity,boolean hasShop);
Map<Long,List<WxMerchantVo>> findCouponMerchantVoList(List<Long> couponIds,TenantEntity tenantEntity,boolean hasShop);

PageInfo<WxMerchant> listVoAsPage2(WxMerchant wxMerchant, Integer pageNum, Integer pageSize);

@@ -189,7 +189,4 @@ public interface WxMerchantService {

Map<String, Object> detailByShopId(TenantEntity tenantInfo, Long shopId);

List<WxMerchantVo> newFindWithShopByCouponId(TenantEntity tenantInfo, Long couponId);

List<WxMerchantVo> newFindByCouponId(TenantEntity tenantInfo, Long couponId);
}

+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxShopService.java Просмотреть файл

@@ -93,5 +93,5 @@ public interface WxShopService {
* @param merchantId
* @return
*/
List<WxShopVo> newFindByMerchantId(String tenantId, Long merchantId);
Map<Long,List<WxShopVo>> findMerchantShopVoList(TenantEntity tenantEntity, List<Long> merchantIds);
}

+ 14
- 5
mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java Просмотреть файл

@@ -622,10 +622,13 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
couponQ.updateTenantInfo(co);
couponQ.setId(co.getCouponId());
WxCoupon coupon = wxCouponMapper.findSimpleDetail(couponQ);
return getCouponOrderCDetailVo(co,coupon);
List<Long> couponIds = new ArrayList<Long>();
couponIds.add(co.getCouponId());
Map<Long, List<WxMerchantVo>> couponMerchantVoMap = wxMerchantService.findCouponMerchantVoList(couponIds, co, true);
return getCouponOrderCDetailVo(co,coupon,couponMerchantVoMap);
}
private WxCouponOrderCVo getCouponOrderCDetailVo(WxCouponOrder co,WxCoupon coupon) {
private WxCouponOrderCVo getCouponOrderCDetailVo(WxCouponOrder co,WxCoupon coupon,Map<Long, List<WxMerchantVo>> couponMerchantVoMap) {
try {
WxCouponOrderCVo cvo = new WxCouponOrderCVo();
BeanUtils.copyProperties(cvo, co);
@@ -648,7 +651,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
cvo.setPickStartDate(coupon.getPickStartDate());
cvo.setPickEndDate(coupon.getPickEndDate());
cvo.setAutoRefund(coupon.getAutoRefund());
cvo.setMerchantVoList(wxMerchantService.newFindWithShopByCouponId(cvo,coupon.getId()));
cvo.setMerchantVoList(couponMerchantVoMap.get(cvo.getCouponId()));
}
return cvo;
} catch (IllegalAccessException | InvocationTargetException e) {
@@ -657,6 +660,13 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
return null;
}
private WxCouponOrderCVo getCouponOrderCDetailVo(WxCouponOrder co,WxCoupon coupon) {
List<Long> couponIds = new ArrayList<Long>();
couponIds.add(co.getCouponId());
Map<Long, List<WxMerchantVo>> couponMerchantVoMap = wxMerchantService.findCouponMerchantVoList(null, co, true);
return getCouponOrderCDetailVo(co,coupon,couponMerchantVoMap);
}
@Override
public WxCouponOrderCVo detailCUserVo(String couponOrderId,TenantEntity tenantinfo) {
WxCouponOrder couponOrder = wxCouponOrderMapper.findDetailOfCUser(Long.valueOf(couponOrderId),tenantinfo.getTenantId());
@@ -751,7 +761,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
}
}
Map<Long, List<WxMerchantVo>> couponMerchantVoMap = wxMerchantService.findCouponMerchantVoList(couponIds, tenantEntity.getTenantId());
Map<Long, List<WxMerchantVo>> couponMerchantVoMap = wxMerchantService.findCouponMerchantVoList(couponIds, tenantEntity,false);
List<WxCouponOrderCarCVo> volist = new ArrayList<WxCouponOrderCarCVo>();
for (int i = 0 ; i < couponOrderList.size(); i++){
@@ -787,7 +797,6 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
cvo.setValidStartDate(coupon.getValidStartDate());
cvo.setValidEndDate(coupon.getValidEndDate());
cvo.setAutoRefund(coupon.getAutoRefund());
cvo.setMerchantVoList(wxMerchantService.newFindByCouponId(cvo,coupon.getId()));
}
WxCouponCar couponCar= couponCarMap.get(cvo.getCouponId());
if (null != couponCar) {


+ 24
- 45
mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java Просмотреть файл

@@ -116,11 +116,6 @@ public class WxMerchantServiceImpl implements WxMerchantService {
@Autowired
TtUserFollowMapper ttUserFollowMapper;

@Autowired
WxMallFloorService wxMallFloorService;
@Autowired
WxMallBuildingService wxMallBuildingService;

@Autowired
private QrCodeService qrCodeService;

@@ -517,7 +512,9 @@ public class WxMerchantServiceImpl implements WxMerchantService {
List<Long> shopIds = wxMerchant.getShopids();
if(null != shopIds && shopIds.size() > 0){
//如果原来店铺在商户里面有有效的合同,则不能操作
List<Long> oldShopIds = wxMerchantShopMapper.findShopIds(wxMerchant.getId());
List<Long> merchantIds = new ArrayList<Long>();
merchantIds.add(wxMerchant.getId());
List<Long> oldShopIds = wxMerchantShopMapper.findShopIds(merchantIds);
List<Long> coldShopIds = new ArrayList<Long>();
if (null != oldShopIds && oldShopIds.size() > 0) {
coldShopIds.addAll(oldShopIds);
@@ -925,11 +922,11 @@ public class WxMerchantServiceImpl implements WxMerchantService {
}
@Override
public Map<Long,List<WxMerchantVo>> findCouponMerchantVoList(List<Long> couponIds,String tenantId) {
List<Long> merchantIds = wxCouponMerchantMapper.findMerchantByProductIds(tenantId, couponIds);
public Map<Long,List<WxMerchantVo>> findCouponMerchantVoList(List<Long> couponIds,TenantEntity tenantEntity,boolean hasShop) {
List<Long> merchantIds = wxCouponMerchantMapper.findMerchantByProductIds(tenantEntity.getTenantId(), couponIds);
if(null != merchantIds && merchantIds.size() > 0 ) {
WxMerchant merchantQ = new WxMerchant();
merchantQ.setTenantId(tenantId);
merchantQ.updateTenantInfo(tenantEntity);
merchantQ.setIds(merchantIds);
List<WxMerchant> merchantList = wxMerchantMapper.findList(merchantQ);
Map<Long,WxMerchant> merchantMap = new HashMap<Long,WxMerchant>();
@@ -943,13 +940,19 @@ public class WxMerchantServiceImpl implements WxMerchantService {
}
WxCouponMerchant couponMerchantQ = new WxCouponMerchant();
couponMerchantQ.setTenantId(tenantId);
couponMerchantQ.updateTenantInfo(tenantEntity);
couponMerchantQ.setStatus(0);
couponMerchantQ.setProductIds(couponIds);
List<WxCouponMerchant> couponMerchantList = wxCouponMerchantMapper.findList(couponMerchantQ);
if (null == couponMerchantList) {
return null;
}
Map<Long,List<WxShopVo>> merchantShopVoList = null;
if (hasShop) {
merchantShopVoList = wxShopService.findMerchantShopVoList(tenantEntity,merchantIds);
}
Map<Long,List<WxMerchantVo>> retMap = new HashMap<Long,List<WxMerchantVo>>();
for (int i = 0 ; i < couponMerchantList.size() ; i ++) {
WxCouponMerchant cm = couponMerchantList.get(i);
@@ -961,7 +964,7 @@ public class WxMerchantServiceImpl implements WxMerchantService {
volist = new ArrayList<WxMerchantVo>();
}
retMap.put(couponId, volist);
WxMerchantVo vo = merchantToVo(cm,merchantMap.get(merchantId));
WxMerchantVo vo = merchantToVo(cm,merchantMap.get(merchantId),hasShop,merchantShopVoList);
if (null != vo) {
volist.add(vo);
}
@@ -972,7 +975,7 @@ public class WxMerchantServiceImpl implements WxMerchantService {
return null;
}

private WxMerchantVo merchantToVo(WxCouponMerchant cm,WxMerchant m) {
private WxMerchantVo merchantToVo(WxCouponMerchant cm,WxMerchant m,boolean hasShop,Map<Long,List<WxShopVo>> merchantShopVoList) {
if (null == cm) {
return null;
}
@@ -991,14 +994,17 @@ public class WxMerchantServiceImpl implements WxMerchantService {
vo.setSubBusinessId(m.getSubBusinessId());
vo.setParameter(cm.getParameter());
vo.setLinkLinePhone(m.getLinkLinePhone());
if (hasShop) {
vo.setShopVoList(merchantShopVoList.get(vo.getId()));
}
return vo;
}
@Override
public List<WxMerchantVo> findMerchantVoList(Long couponId,String tenantId) {
public List<WxMerchantVo> findMerchantVoList(Long couponId,TenantEntity tenantEntity,boolean hasShop) {
List<Long> couponIds = new ArrayList<Long>();
couponIds.add(couponId);
Map<Long,List<WxMerchantVo>> couponMerchantVoList = findCouponMerchantVoList(couponIds,tenantId);
Map<Long,List<WxMerchantVo>> couponMerchantVoList = findCouponMerchantVoList(couponIds,tenantEntity,hasShop);
if (null != couponMerchantVoList) {
return couponMerchantVoList.get(couponId);
}
@@ -1063,7 +1069,9 @@ public class WxMerchantServiceImpl implements WxMerchantService {

@Override
public List<Long> getMerchantShopIds(Long merchantId) {
return wxMerchantShopMapper.findShopIds(merchantId);
List<Long> merchantIds = new ArrayList<Long>();
merchantIds.add(merchantId);
return wxMerchantShopMapper.findShopIds(merchantIds);
}

@Override
@@ -1271,35 +1279,6 @@ public class WxMerchantServiceImpl implements WxMerchantService {
return null;
}

@Override
public List<WxMerchantVo> newFindWithShopByCouponId(TenantEntity tenantInfo, Long couponId) {
List<WxMerchantVo> wxMerchantVoList = this.newFindByCouponId(tenantInfo, couponId);
handleShopVo(tenantInfo,wxMerchantVoList);
return wxMerchantVoList;
}

@Override
public List<WxMerchantVo> newFindByCouponId(TenantEntity tenantInfo, Long couponId) {
List<Long> merchantIds = wxCouponMerchantMapper.findMerchantByProductId(tenantInfo.getTenantId(), couponId);
List<WxMerchantVo> wxMerchantVoList = wxMerchantMapper.newFindListCVo(tenantInfo.getTenantId(),merchantIds);
return wxMerchantVoList;
}

private void handleShopVo(TenantEntity tenantInfo,List<WxMerchantVo> wxMerchantVoList){
if(wxMerchantVoList != null && wxMerchantVoList.size() > 0){
Map<Long,String> floorMap = wxMallFloorService.getFloorMap(tenantInfo);
Map<Long,String> buildingMap = wxMallBuildingService.getBuildingMap(tenantInfo);
for (WxMerchantVo wv:wxMerchantVoList) {
List<WxShopVo> shopVoList = wxShopService.newFindByMerchantId(tenantInfo.getTenantId(),wv.getId());
if(shopVoList != null && shopVoList.size() > 0){
for (WxShopVo sv:shopVoList) {
sv.setBuildingName(buildingMap.get(sv.getBuilding()));
sv.setFloorName(floorMap.get(sv.getFloor()));
}
}
wv.setShopVoList(shopVoList);
}
}
}

}

+ 46
- 4
mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java Просмотреть файл

@@ -18,12 +18,15 @@ import com.iformall.mapper.WxMerchantShopMapper;
import com.iformall.mapper.WxRentContractMapper;
import com.iformall.mapper.WxShopMapper;
import com.iformall.service.ExcelService;
import com.iformall.service.WxMallBuildingService;
import com.iformall.service.WxMallFloorService;
import com.iformall.service.WxShopService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
@@ -46,6 +49,14 @@ public class WxShopServiceImpl implements WxShopService {

@Autowired
WxRentContractMapper wxRentContractMapper;
@Lazy
@Autowired
WxMallFloorService wxMallFloorService;
@Lazy
@Autowired
WxMallBuildingService wxMallBuildingService;

@Override
public List<WxShop> selectList(QueryWrapper<WxShop> queryWrapper) {
@@ -262,9 +273,40 @@ public class WxShopServiceImpl implements WxShopService {
}

@Override
public List<WxShopVo> newFindByMerchantId(String tenantId, Long merchantId) {
List<Long> shopIds = wxMerchantShopMapper.findShopIds(merchantId);
List<WxShopVo> shopVoList = wxShopMapper.newFindShopVoList(tenantId,shopIds);
return shopVoList;
public Map<Long,List<WxShopVo>> findMerchantShopVoList(TenantEntity tenantEntity, List<Long> merchantIds) {
Map<Long,String> floorMap = wxMallFloorService.getFloorMap(tenantEntity);
Map<Long,String> buildingMap = wxMallBuildingService.getBuildingMap(tenantEntity);
List<Long> shopIds = wxMerchantShopMapper.findShopIds(merchantIds);
List<WxShopVo> shopVoList = wxShopMapper.newFindShopVoList(tenantEntity.getTenantId(),shopIds);
Map<Long,WxShopVo> shopVoMap = new HashMap<Long,WxShopVo>();
if(shopVoList != null && shopVoList.size() > 0){
for (WxShopVo sv:shopVoList) {
sv.setBuildingName(buildingMap.get(sv.getBuilding()));
sv.setFloorName(floorMap.get(sv.getFloor()));
shopVoMap.put(sv.getId(), sv);
}
}
Map<Long,List<WxShopVo>> retMap = new HashMap<Long,List<WxShopVo>>();
WxMerchantShop merchantShopQ = new WxMerchantShop();
merchantShopQ.updateTenantInfo(tenantEntity);
merchantShopQ.setMerchantIds(merchantIds);
List<WxMerchantShop> merchantShops = wxMerchantShopMapper.findList(merchantShopQ);
if (null == merchantShops) {
return null;
}
for (int i = 0 ; i < merchantShops.size(); i ++) {
WxMerchantShop ms = merchantShops.get(i);
if (null != ms.getShopId() && null != ms.getMerchantId()) {
List<WxShopVo> mShopIds = retMap.get(ms.getMerchantId());
if (null == mShopIds) {
mShopIds = new ArrayList<WxShopVo>();
}
mShopIds.add(shopVoMap.get(ms.getShopId()));
retMap.put(ms.getMerchantId(), mShopIds);
}
}
return retMap;
}
}

+ 0
- 18
mallinkService/src/main/resources/mapper/WxMerchantMapper.xml Просмотреть файл

@@ -753,22 +753,4 @@
and s.`id` = #{shopId}
</select>


<select id="newFindListCVo" parameterType="hashmap" resultType="com.iformall.domain.vo.WxMerchantVo">
select
id,img_url merchantImgUrl,`name` merchantName,link_phone linkPhone,status,business_id businessId
FROM wx_merchant
where is_del=0
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != merchantIds ">
and id in
<foreach collection="merchantIds" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
order by top_time desc
</select>

</mapper>

+ 15
- 1
mallinkService/src/main/resources/mapper/WxMerchantShopMapper.xml Просмотреть файл

@@ -68,6 +68,13 @@
#{shopIdItem}
</foreach>
</if>
<if test=" null != merchantIds ">
and merchant_id in
<foreach collection="merchantIds" index="index" item="merchantIdItem" open="(" separator="," close=")">
#{merchantIdItem}
</foreach>
</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>
</sql>
@@ -87,7 +94,14 @@
<select id="findShopIds" parameterType="Long" resultType="Long">
select shop_id from wx_merchant_shop where `merchant_id` = #{merchantId} and is_del = 0
select shop_id from wx_merchant_shop where is_del = 0
<if test=" null != merchantIds ">
and merchant_id in
<foreach collection="merchantIds" index="index" item="merchantIdItem" open="(" separator="," close=")">
#{merchantIdItem}
</foreach>
</if>
</select>
<update id = "delShops" parameterType="java.util.Map">


Загрузка…
Отмена
Сохранить