Browse Source

//plan

release_toaliyun_real
xhxu 3 years ago
parent
commit
a4d3c8f47f
2 changed files with 55 additions and 19 deletions
  1. +2
    -0
      mallinkService/src/main/java/com/iformall/domain/po/base/BaseEntity.java
  2. +53
    -19
      mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java

+ 2
- 0
mallinkService/src/main/java/com/iformall/domain/po/base/BaseEntity.java View File

@@ -224,6 +224,8 @@ public class BaseEntity implements Serializable {
ActivityStartTime_ASC("`activity_start_time` ASC"),
ActivityStartTime_DESC("`activity_start_time` DESC"),

MerchantAdmin("`is_admin` desc"),//商场服务台排在首位

;
private String value;


+ 53
- 19
mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java View File

@@ -49,12 +49,21 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
@Autowired
WxCouponService wxCouponService;

@Autowired
WxCouponMerchantMapper wxCouponMerchantMapper;

@Autowired
WxCouponChannelMapper wxCouponChannelMapper;

@Autowired
WxCouponChannelService wxCouponChannelService;

@Autowired
WxMerchantMapper wxMerchantMapper;

@Autowired
TtMerchantPoiMapper ttMerchantPoiMapper;

@Autowired
private TtMerchantPoiService ttMerchantPoiService;

@@ -153,28 +162,53 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
return new ResultData(ErrorCode.COUPON_ORDER_IS_INVALID);
}

//获取门店
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(),"数据异常,存在多个商管商户");
}
//获取门店,确保所有门店匹配poi
// 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();
// for (WxMerchantVo mvo:couponMerchantList){
// if(StringUtils.isNotBlank(mvo.getSupplierExtId())){
// Product.PoiStruct poiStruct = new Product.PoiStruct();
// poiStruct.setSupplierExtId(mvo.getSupplierExtId());
// poiList.add(poiStruct);
// }
// }
// if(poiList.isEmpty()){
// return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND.getCode(),"未找到poi门店");
// }


List<Long> merchantIds = wxCouponMerchantMapper.findMerchantIdListByProduct(coupon.getId(), coupon.getTenantId());
TtMerchantPoi poiQ = new TtMerchantPoi();
poiQ.updateTenantInfo(coupon);
poiQ.setIds(merchantIds);
List<TtMerchantPoi> pois = ttMerchantPoiMapper.findList(poiQ);
if(pois == null || pois.isEmpty()){
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND.getCode(),"未找到poi门店");
}
List<Product.PoiStruct> poiList = new ArrayList();
for (WxMerchantVo mvo:couponMerchantList){
if(StringUtils.isNotBlank(mvo.getSupplierExtId())){
Product.PoiStruct poiStruct = new Product.PoiStruct();
poiStruct.setSupplierExtId(mvo.getSupplierExtId());
poiList.add(poiStruct);
}
if(pois.size() != merchantIds.size()){
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND.getCode(),"存在未匹配poi的门店");
}
if(poiList.isEmpty()){
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND.getCode(),"未找到poi门店");
List<Product.PoiStruct> poiList = new ArrayList();
for (TtMerchantPoi poi: pois) {
Product.PoiStruct poiStruct = new Product.PoiStruct();
poiStruct.setSupplierExtId(poi.getSupplierExtId());
poiList.add(poiStruct);
}

WxMerchant merchantQ = new WxMerchant();
merchantQ.updateTenantInfo(coupon);
merchantQ.setIds(merchantIds);
merchantQ.setSortColumns(BaseEntity.SortField.MerchantAdmin);
WxMerchant merchant = wxMerchantMapper.findIdNameList(merchantQ).get(0);

//查询是否有上架的
WxCouponChannel wxCouponChannelQuery = new WxCouponChannel();
wxCouponChannelQuery.updateTenantInfo(coupon);
@@ -220,7 +254,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
prostruct.setCategoryId(ttattrs.getCategoryId());
prostruct.setProductType(ttattrs.getProductType());
prostruct.setBizLine(5);//默认小程序
prostruct.setAccountName(couponMerchantList.get(0).getMerchantName());
prostruct.setAccountName(merchant.getName());

prostruct.setSoldStartTime((long) DateUtils.getSecondTimestamp(wxCouponChannel.getBeginTime()));
prostruct.setSoldEndTime((long) DateUtils.getSecondTimestamp(wxCouponChannel.getEndTime()));


Loading…
Cancel
Save