winter 4 лет назад
Родитель
Сommit
aad6b4df6e
10 измененных файлов: 98 добавлений и 13 удалений
  1. +33
    -1
      mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java
  2. +4
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java
  3. +5
    -0
      mallinkService/src/main/java/com/iformall/domain/vo/WxMerchantVo.java
  4. +7
    -2
      mallinkService/src/main/java/com/iformall/douyin/web/api/impl/TtWebProductServiceImpl.java
  5. +3
    -0
      mallinkService/src/main/java/com/iformall/service/WxCouponService.java
  6. +3
    -3
      mallinkService/src/main/java/com/iformall/service/impl/TtMerchantPoiServiceImpl.java
  7. +22
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java
  8. +10
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java
  9. +8
    -4
      mallinkService/src/main/java/com/iformall/service/pay/service/pay/douyin/miniApp/TtMiniAppPayAdapterService.java
  10. +3
    -0
      mallinkService/src/main/java/com/iformall/utils/Constant.java

+ 33
- 1
mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java Просмотреть файл

@@ -9,9 +9,11 @@ import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;


import com.iformall.domain.po.WxMerchant;
import com.iformall.domain.po.WxMiniappThemeValue;
import com.iformall.enums.EnumCouponType; import com.iformall.enums.EnumCouponType;
import com.iformall.enums.EnumMerchantStatus; import com.iformall.enums.EnumMerchantStatus;
import com.iformall.utils.RedisCacheUtils;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -227,6 +229,10 @@ public class WxCouponController extends BaseController {
} }


@Autowired
@Qualifier("objectCommonRedisTemplate")
RedisTemplate<String, Object> objectCommonRedisTemplate;

@ApiOperation("根据id(couponChannel)查询接口") @ApiOperation("根据id(couponChannel)查询接口")
@GetMapping("/detail") @GetMapping("/detail")
@ApiImplicitParams({ @ApiImplicitParams({
@@ -372,6 +378,32 @@ public class WxCouponController extends BaseController {


return new ResultData(wxCouponCVo); return new ResultData(wxCouponCVo);
} }

// @ApiOperation("根据id(couponId)查询接口")
// @GetMapping("/getMerchantList")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "couponId", value = "couponId", dataType = "String", paramType = "query", required = true)
// })
// public ResultData getMerchantList(Long couponId) {
//
// if (couponId == null) {
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
// }
//
// String key = Constant.coupon_merchants_key+getTenantInfo().getTenantId()+":"+couponId;
//
// List<WxMerchantVo> valueList = RedisCacheUtils.getCacheListObject(objectCommonRedisTemplate, key, WxMerchantVo.class);
// if(valueList != null && valueList.size() > 0){
// return new ResultData(valueList);
// }
// valueList = couponService.getCouponMerchantList(getTenantInfo(),couponId);
// if(valueList == null || valueList.size() == 0){
// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR);
// }
//
// RedisCacheUtils.cache(objectCommonRedisTemplate,key,valueList,3600l);
// return new ResultData(valueList);
// }
private WxCouponCVo generateWxCouponCVo(Long couponChannelIdL,String tenantId) { private WxCouponCVo generateWxCouponCVo(Long couponChannelIdL,String tenantId) {
WxCouponChannel cc = wxCouponChannelService.getById(couponChannelIdL,tenantId); WxCouponChannel cc = wxCouponChannelService.getById(couponChannelIdL,tenantId);


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

@@ -346,6 +346,10 @@ public class WxMerchant extends TenantEntity {
@TableField(exist = false) @TableField(exist = false)
private String addr; private String addr;


@io.swagger.annotations.ApiModelProperty(value="ttPoi",name="ttPoi")
@TableField(exist = false)
private String ttPoi;

@io.swagger.annotations.ApiModelProperty(value="经度",name="longitude") @io.swagger.annotations.ApiModelProperty(value="经度",name="longitude")
@TableField(exist = false) @TableField(exist = false)
private BigDecimal longitude; private BigDecimal longitude;


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

@@ -101,6 +101,10 @@ public class WxMerchantVo extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value = "置顶时间", name = "topTime") @io.swagger.annotations.ApiModelProperty(value = "置顶时间", name = "topTime")
private Date topTime; private Date topTime;


@io.swagger.annotations.ApiModelProperty(value="ttPoi",name="ttPoi")
@TableField(exist = false)
private String ttPoi;

@io.swagger.annotations.ApiModelProperty(value="经度",name="longitude") @io.swagger.annotations.ApiModelProperty(value="经度",name="longitude")
@TableField(exist = false) @TableField(exist = false)
private BigDecimal longitude; private BigDecimal longitude;
@@ -128,6 +132,7 @@ public class WxMerchantVo extends TenantEntity {
this.linkLinePhone = m.getLinkLinePhone(); this.linkLinePhone = m.getLinkLinePhone();
this.topTime = m.getTopTime(); this.topTime = m.getTopTime();
this.addr = m.getAddr(); this.addr = m.getAddr();
this.ttPoi = m.getTtPoi();
this.longitude = m.getLongitude(); this.longitude = m.getLongitude();
this.latitude = m.getLatitude(); this.latitude = m.getLatitude();
} }


+ 7
- 2
mallinkService/src/main/java/com/iformall/douyin/web/api/impl/TtWebProductServiceImpl.java Просмотреть файл

@@ -76,10 +76,15 @@ public class TtWebProductServiceImpl implements TtWebProductService {
String apiUrl = this.service.getTtWebConfig().getApiBegin().getPrefix() + this.POST_SPU_STOCK_UPDATE; String apiUrl = this.service.getTtWebConfig().getApiBegin().getPrefix() + this.POST_SPU_STOCK_UPDATE;
String result = this.service.execute(executor, apiUrl, spuStockSync.toJson()); String result = this.service.execute(executor, apiUrl, spuStockSync.toJson());
JSONObject jsonObject = JSONObject.parseObject(result); JSONObject jsonObject = JSONObject.parseObject(result);
String spuExtId = jsonObject.getString("spu_ext_id");
if(spuStockSync.getSpuExtId().equals(spuExtId)){
Integer error_code = jsonObject.getInteger("error_code");
if(error_code.intValue() == 0){
return true; return true;
} }

// String spuExtId = jsonObject.getString("spu_ext_id");
// if(spuStockSync.getSpuExtId().equals(spuExtId)){
// return true;
// }
return false; return false;
} }
} }

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

@@ -11,6 +11,7 @@ import com.iformall.domain.po.WxCoupon;
import com.iformall.domain.po.base.TenantEntity; import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.vo.WxCouponCVo; import com.iformall.domain.vo.WxCouponCVo;
import com.iformall.domain.vo.WxCouponStatisVo; import com.iformall.domain.vo.WxCouponStatisVo;
import com.iformall.domain.vo.WxMerchantVo;


public interface WxCouponService { public interface WxCouponService {


@@ -265,4 +266,6 @@ public interface WxCouponService {
Map<Long,String> getCouponMerchantMap(List<Long> couponIds,TenantEntity tenantEntity,boolean onlyOneMerchantCoupons); Map<Long,String> getCouponMerchantMap(List<Long> couponIds,TenantEntity tenantEntity,boolean onlyOneMerchantCoupons);


Map<Long, WxCoupon> getCouponMap(List<Long> couponIds, TenantEntity tenantEntity); Map<Long, WxCoupon> getCouponMap(List<Long> couponIds, TenantEntity tenantEntity);

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

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

@@ -593,11 +593,11 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService {
poi.setSyncStatus(EnumSupplierSyncStatus.sync_success.getCode()); poi.setSyncStatus(EnumSupplierSyncStatus.sync_success.getCode());
List<TtMerchantPoi> poiList = ttMerchantPoiMapper.findList(poi); List<TtMerchantPoi> poiList = ttMerchantPoiMapper.findList(poi);
if(poiList == null || poiList.isEmpty()){ if(poiList == null || poiList.isEmpty()){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未查询到可用poi");
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未查询到匹配的poi");
} }
List<Long> collect = poiList.stream().map(p -> p.getId()).collect(Collectors.toList());
// List<Long> collect = poiList.stream().map(p -> p.getId()).collect(Collectors.toList());


String spuId = spuSync(coupon,couponChannel,collect);
String spuId = spuSync(coupon,couponChannel,couponMerchantIds);
if(StringUtils.isBlank(spuId)){ if(StringUtils.isBlank(spuId)){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"同步失败"); return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"同步失败");
} }


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

@@ -48,6 +48,8 @@ import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;


import static java.util.stream.Collectors.toList;



@Service @Service
public class WxCouponServiceImpl implements WxCouponService { public class WxCouponServiceImpl implements WxCouponService {
@@ -154,7 +156,7 @@ public class WxCouponServiceImpl implements WxCouponService {
return new ResultData(page); return new ResultData(page);
} }


List<Long> ids = wxCouponList.stream().map(p -> p.getId()).collect(Collectors.toList());
List<Long> ids = wxCouponList.stream().map(p -> p.getId()).collect(toList());
WxCouponChannel wxCouponChannel = new WxCouponChannel(); WxCouponChannel wxCouponChannel = new WxCouponChannel();
wxCouponChannel.updateTenantInfo(wxCoupon); wxCouponChannel.updateTenantInfo(wxCoupon);
wxCouponChannel.setCouponIds(ids); wxCouponChannel.setCouponIds(ids);
@@ -259,7 +261,7 @@ public class WxCouponServiceImpl implements WxCouponService {
if (merchantList != null) { if (merchantList != null) {
merchantList = merchantList.stream().filter( merchantList = merchantList.stream().filter(
m->m.getMerchantStatus().equals(EnumMerchantStatus.VALID.getCode())) m->m.getMerchantStatus().equals(EnumMerchantStatus.VALID.getCode()))
.collect(Collectors.toList());
.collect(toList());
} }
wxCouponCVo.setMerchantVoList(merchantList); wxCouponCVo.setMerchantVoList(merchantList);
if(EnumCouponType.COUPON_GIFT.getCode().equals(wxCouponCVo.getType())){ if(EnumCouponType.COUPON_GIFT.getCode().equals(wxCouponCVo.getType())){
@@ -1111,5 +1113,23 @@ public class WxCouponServiceImpl implements WxCouponService {
return couponMap; return couponMap;
} }


@Override
public List<WxMerchantVo> getCouponMerchantList(TenantEntity tenantInfo, Long couponId) {
List<Long> couponIdList = new ArrayList<Long>();
couponIdList.add(couponId);
Map<Long, List<WxMerchantVo>> couponMerchantVoMap = wxMerchantService.findCouponMerchantVoList(couponIdList, tenantInfo,true);

List<WxMerchantVo> merchantList = couponMerchantVoMap.get(couponId);
if (merchantList != null) {

merchantList = merchantList.stream().sorted(Comparator.comparing(m -> m.getTtPoi(), Comparator.nullsLast(String::compareTo))).collect(toList());

merchantList = merchantList.stream().filter(
m->m.getMerchantStatus().equals(EnumMerchantStatus.VALID.getCode()))
.collect(toList());
}
return merchantList;
}



} }

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

@@ -1011,7 +1011,11 @@ public class WxMerchantServiceImpl implements WxMerchantService {
Long floor = record.getFloor(); Long floor = record.getFloor();
List<Long> floorMerchantIds = getFloorBuildMerchantIds(record, floorRule, building, floor, 0, 0); List<Long> floorMerchantIds = getFloorBuildMerchantIds(record, floorRule, building, floor, 0, 0);
if (null != floorMerchantIds) { if (null != floorMerchantIds) {
merchantIds.retainAll(floorMerchantIds);
if(merchantIds.size() > 0){
merchantIds.retainAll(floorMerchantIds);
}else{
merchantIds.addAll(floorMerchantIds);
}
} }
if (merchantIds.size() > 0 ) { if (merchantIds.size() > 0 ) {
record.setIds(merchantIds); record.setIds(merchantIds);
@@ -1065,6 +1069,7 @@ public class WxMerchantServiceImpl implements WxMerchantService {
floorMerchantIds.add(-999L); floorMerchantIds.add(-999L);
return floorMerchantIds; return floorMerchantIds;
} }
return floorMerchantIds;
} }
return null; return null;
} }
@@ -1251,6 +1256,7 @@ public class WxMerchantServiceImpl implements WxMerchantService {
TtMerchantPoi poi = poiMap.get(m.getId()); TtMerchantPoi poi = poiMap.get(m.getId());
if(null != poi){ if(null != poi){
m.setAddr(poi.getAddress()); m.setAddr(poi.getAddress());
m.setTtPoi(poi.getPoiId());
m.setLongitude(poi.getLongitude()); m.setLongitude(poi.getLongitude());
m.setLatitude(poi.getLatitude()); m.setLatitude(poi.getLatitude());
} }
@@ -1318,6 +1324,7 @@ public class WxMerchantServiceImpl implements WxMerchantService {
vo.setShopVoList(merchantShopVoList.get(vo.getId())); vo.setShopVoList(merchantShopVoList.get(vo.getId()));
} }
vo.setAddr(m.getAddr()); vo.setAddr(m.getAddr());
vo.setTtPoi(m.getTtPoi());
vo.setLongitude(m.getLongitude()); vo.setLongitude(m.getLongitude());
vo.setLatitude(m.getLatitude()); vo.setLatitude(m.getLatitude());
return vo; return vo;
@@ -1630,6 +1637,7 @@ public class WxMerchantServiceImpl implements WxMerchantService {
TtMerchantPoi poi = poiMap.get(m.getId()); TtMerchantPoi poi = poiMap.get(m.getId());
if(null != poi){ if(null != poi){
m.setAddr(poi.getAddress()); m.setAddr(poi.getAddress());
m.setTtPoi(poi.getPoiId());
m.setLongitude(poi.getLongitude()); m.setLongitude(poi.getLongitude());
m.setLatitude(poi.getLatitude()); m.setLatitude(poi.getLatitude());
} }
@@ -1654,6 +1662,7 @@ public class WxMerchantServiceImpl implements WxMerchantService {


vo.setId(m.getId()); vo.setId(m.getId());
vo.setAddr(m.getAddr()); vo.setAddr(m.getAddr());
vo.setTtPoi(m.getTtPoi());
vo.setLongitude(m.getLongitude()); vo.setLongitude(m.getLongitude());
vo.setLatitude(m.getLatitude()); vo.setLatitude(m.getLatitude());
vo.setMerchantImgUrl(m.getImgUrl()); vo.setMerchantImgUrl(m.getImgUrl());


+ 8
- 4
mallinkService/src/main/java/com/iformall/service/pay/service/pay/douyin/miniApp/TtMiniAppPayAdapterService.java Просмотреть файл

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.iformall.domain.po.*; import com.iformall.domain.po.*;
import com.iformall.domain.vo.WxMerchantVo;
import com.iformall.domain.vo.WxOrderCouponVo; import com.iformall.domain.vo.WxOrderCouponVo;
import com.iformall.douyin.miniapp.api.TtMaService; import com.iformall.douyin.miniapp.api.TtMaService;
import com.iformall.douyin.pay.DouYinPayHelper; import com.iformall.douyin.pay.DouYinPayHelper;
@@ -29,6 +30,8 @@ import org.springframework.stereotype.Service;
import java.io.File; import java.io.File;
import java.util.*; import java.util.*;


import static java.util.stream.Collectors.toList;

@Slf4j @Slf4j
@Service @Service
public class TtMiniAppPayAdapterService extends BaseTtPayAdapterService implements CDrivingPayService{ public class TtMiniAppPayAdapterService extends BaseTtPayAdapterService implements CDrivingPayService{
@@ -117,6 +120,7 @@ public class TtMiniAppPayAdapterService extends BaseTtPayAdapterService implemen
} }
//目前订单都是一笔一笔同步,暂不支持购物车 //目前订单都是一笔一笔同步,暂不支持购物车
WxOrderCouponVo wxOrderCouponVo = batchOrder.getOrders().get(0); WxOrderCouponVo wxOrderCouponVo = batchOrder.getOrders().get(0);
List<WxMerchantVo> merchantList = wxOrderCouponVo.getMerchantVoList().stream().sorted(Comparator.comparing(m -> m.getTtPoi(), Comparator.nullsLast(String::compareTo))).collect(toList());


TtMaService ttappService = maUtil.getTtMaService(appInfo); TtMaService ttappService = maUtil.getTtMaService(appInfo);
// map.put("access_token",appInfo.getAccessToken());//后面会自动加上 // map.put("access_token",appInfo.getAccessToken());//后面会自动加上
@@ -126,7 +130,7 @@ public class TtMiniAppPayAdapterService extends BaseTtPayAdapterService implemen
map.put("payment_order_no", payOrder.getTransactionId()); map.put("payment_order_no", payOrder.getTransactionId());
if(isPoiOrder){ if(isPoiOrder){
map.put("client_key",clientKey);//第三方在开放平台申请的 ClientKey(生活服务订单必传) map.put("client_key",clientKey);//第三方在开放平台申请的 ClientKey(生活服务订单必传)
map.put("ext_shop_id",wxOrderCouponVo.getMerchantVoList().get(0).getId());//生活服务外部商户 id,购买店铺 id (生活服务订单必传)
map.put("ext_shop_id",merchantList.get(0).getId().toString());//生活服务外部商户 id,购买店铺 id (生活服务订单必传)
map.put("order_type",9101); map.put("order_type",9101);
}else{ }else{
map.put("order_type",0); map.put("order_type",0);
@@ -142,7 +146,7 @@ public class TtMiniAppPayAdapterService extends BaseTtPayAdapterService implemen
if(isPoiOrder){ if(isPoiOrder){
orderDetail.put("ext_order_id",payOrder.getPayOrderNo()); orderDetail.put("ext_order_id",payOrder.getPayOrderNo());
orderDetail.put("status", getTtPoiOrderStatus(wxOrderCouponVo.getOrderStatus(),wxOrderCouponVo.getCouponOrderStatus()).getCode()); orderDetail.put("status", getTtPoiOrderStatus(wxOrderCouponVo.getOrderStatus(),wxOrderCouponVo.getCouponOrderStatus()).getCode());
orderDetail.put("shop_name",wxOrderCouponVo.getMerchantVoList().get(0).getMerchantName());
orderDetail.put("shop_name",merchantList.get(0).getMerchantName());
orderDetail.put("entry_type",2); orderDetail.put("entry_type",2);
orderDetail.put("entry_schema",getOrderEntrySchema(appInfo.getAppId(),batchOrder.getId())); orderDetail.put("entry_schema",getOrderEntrySchema(appInfo.getAppId(),batchOrder.getId()));
orderDetail.put("create_order_time",batchOrder.getCreateDate().getTime()); orderDetail.put("create_order_time",batchOrder.getCreateDate().getTime());
@@ -153,13 +157,13 @@ public class TtMiniAppPayAdapterService extends BaseTtPayAdapterService implemen
} }
if(EnumCouponOrderStatus.COUPON_ORDER_USED.getCode().equals(wxOrderCouponVo.getCouponOrderStatus()) if(EnumCouponOrderStatus.COUPON_ORDER_USED.getCode().equals(wxOrderCouponVo.getCouponOrderStatus())
&& wxOrderCouponVo.getBMerchantId() != null){ && wxOrderCouponVo.getBMerchantId() != null){
orderDetail.put("ext_valid_shop_id",wxOrderCouponVo.getBMerchantId());
orderDetail.put("ext_valid_shop_id",wxOrderCouponVo.getBMerchantId().toString());
TtMerchantPoi merchantPoi = ttMerchantPoiMapper.selectById(wxOrderCouponVo.getBMerchantId()); TtMerchantPoi merchantPoi = ttMerchantPoiMapper.selectById(wxOrderCouponVo.getBMerchantId());
if(merchantPoi != null){ if(merchantPoi != null){
orderDetail.put("valid_poi_id_str",merchantPoi.getPoiId()); orderDetail.put("valid_poi_id_str",merchantPoi.getPoiId());
} }
} }
orderDetail.put("ext_goods_id",wxOrderCouponVo.getCouponChannelId());
orderDetail.put("ext_goods_id",wxOrderCouponVo.getCouponChannelId().toString());
orderDetail.put("goods_name",wxOrderCouponVo.getTitle()); orderDetail.put("goods_name",wxOrderCouponVo.getTitle());
// orderDetail.put("goods_info","");//商品描述信息。向用户介绍商品,最多120字。 // orderDetail.put("goods_info","");//商品描述信息。向用户介绍商品,最多120字。
orderDetail.put("goods_cover_image",wxOrderCouponVo.getCoverImg()); orderDetail.put("goods_cover_image",wxOrderCouponVo.getCoverImg());


+ 3
- 0
mallinkService/src/main/java/com/iformall/utils/Constant.java Просмотреть файл

@@ -85,6 +85,9 @@ public class Constant {
public static final String importMemPrev = "importmem:"; public static final String importMemPrev = "importmem:";
public static final String importInvestCustomerPrev = "importinvestcustomer:"; public static final String importInvestCustomerPrev = "importinvestcustomer:";


//商品门店
public static final String coupon_merchants_key = "coupon:merchants:";

//限制接口访问次数 //限制接口访问次数
public static final String INTERFACE_VISIT_LIMIT_KEY = "INTERFACE:LIMIT:"; public static final String INTERFACE_VISIT_LIMIT_KEY = "INTERFACE:LIMIT:";




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