Browse Source

//tt product

release_toaliyun_real
xhxu 4 years ago
parent
commit
01054613c5
6 changed files with 71 additions and 15 deletions
  1. +1
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponChannelController.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. +4
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumCouponChannelStatus.java
  5. +55
    -15
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java
  6. +2
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java

+ 1
- 0
mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponChannelController.java View File

@@ -52,6 +52,7 @@ public class WxCouponChannelController extends BaseController {
@Autowired
@Qualifier("objectCommonRedisTemplate")
RedisTemplate<String, Object> redisTemplate;

@ApiOperation("分页列表接口")
@GetMapping("list")


+ 4
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java View File

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

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

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


+ 5
- 0
mallinkService/src/main/java/com/iformall/domain/vo/WxMerchantVo.java View File

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

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

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


+ 4
- 0
mallinkService/src/main/java/com/iformall/enums/EnumCouponChannelStatus.java View File

@@ -7,8 +7,12 @@ public enum EnumCouponChannelStatus {

// 0-草稿/待生效;1-已生效/已发布/已投放;2-已下架;

STATUS_BEFORE(-1, "预上线"),//审核用

STATUS_THROW_IN(0, "已上架"),
STATUS_TAKE_OFFF(1, "已下架"),

STATUS_AFTER(2, "作废"),
;

public static EnumCouponChannelStatus getEnum(Integer code) {


+ 55
- 15
mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java View File

@@ -1250,14 +1250,59 @@ public class WxCouponServiceImpl implements WxCouponService {
|| ttattrs.getSkuAttrKeyValueMap().isEmpty()){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该券缺少必要属性");
}
//添加到审核渠道
WxCouponChannelAddVo wxCouponChannelAddVo = wxCouponChannelService.addCouponChannel(coupon.getId(), EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN_SAVE_LIST.getCode(),
coupon, null, null, null, null, null);
if(coupon.getStatus() != EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()) {
return new ResultData(ErrorCode.COUPON_ORDER_IS_INVALID);
}

//获取门店
List<WxMerchantVo> couponMerchantList = getCouponMerchantList(coupon, coupon.getId());
List<Product.PoiStruct> poiList = new ArrayList();
for (WxMerchantVo mvo:couponMerchantList){
if(StringUtils.isNotBlank(mvo.getSupplierExtId())){
Product.PoiStruct poiStruct = new Product.PoiStruct();
poiStruct.setSupplierExtId(mvo.getTtPoi());
poiList.add(poiStruct);
}
}
if(poiList.isEmpty()){
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND.getCode(),"未找到poi门店");
}

//查询是否有上架的
WxCouponChannel wxCouponChannelQuery = new WxCouponChannel();
wxCouponChannelQuery.updateTenantInfo(coupon);
wxCouponChannelQuery.setCouponId(coupon.getId());
wxCouponChannelQuery.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN_LIST.getCode());
wxCouponChannelQuery.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode());
List<WxCouponChannel> wxCouponChannels = wxCouponChannelMapper.findList(wxCouponChannelQuery);
if(wxCouponChannels.size() > 0){
return new ResultData(ErrorCode.COUPON_CHANNEL_IS_EXISTED);
}
//预审核的作废掉 重新投放
wxCouponChannelQuery.setStatus(EnumCouponChannelStatus.STATUS_BEFORE.getCode());
WxCouponChannel updCouponChannel = new WxCouponChannel();
updCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_AFTER.getCode());
updCouponChannel.setUpdateDate(new Date());
wxCouponChannelMapper.update(updCouponChannel,new QueryWrapper<>(wxCouponChannelQuery));
//投放预审核
WxCouponChannel wxCouponChannel = new WxCouponChannel();
final IdWorker idWorker = IdWorker.get();
wxCouponChannel.setId(idWorker.nextId());
wxCouponChannel.updateTenantInfo(coupon);
wxCouponChannel.setShowBeginTime(new Date());
wxCouponChannel.setBeginTime(new Date());
wxCouponChannel.setEndTime(coupon.getValidEndDate());
wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_AFTER.getCode());
wxCouponChannel.setCouponId(coupon.getId());
wxCouponChannel.setType(coupon.getType());
wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN_LIST.getCode());
wxCouponChannel.setBusiness(coupon.getBusiness());
wxCouponChannel.setSubBusiness(coupon.getSubBusiness());
wxCouponChannel.setTitle(coupon.getTitle());
wxCouponChannelMapper.insert(wxCouponChannel);

//提交审核
try {
List<WxMerchantVo> couponMerchantList = getCouponMerchantList(coupon, coupon.getId());
List<WxMerchantVo> merchantList = couponMerchantList.stream().sorted(Comparator.comparing(m -> m.getTtPoi(), Comparator.nullsLast(String::compareTo))).collect(toList());

TtWebService ttWebService = ttMerchantPoiService.getTtWebService(coupon);
Product product = new Product();
@@ -1267,16 +1312,11 @@ public class WxCouponServiceImpl implements WxCouponService {
prostruct.setCategoryId(ttattrs.getCategoryId());
prostruct.setProductType(ttattrs.getProductType());
prostruct.setBizLine(5);//默认小程序
prostruct.setAccountName(merchantList.get(0).getMerchantName());
prostruct.setAccountName(couponMerchantList.get(0).getMerchantName());
// prostruct.setSoldStartTime();
// prostruct.setSoldEndTime();
prostruct.setOutUrl(getGoodsEntrySchema(coupon,wxCouponChannelAddVo.getId()));
List<Product.PoiStruct> poiList = new ArrayList();
for (WxMerchantVo mvo:merchantList){
Product.PoiStruct poiStruct = new Product.PoiStruct();
poiStruct.setSupplierExtId(mvo.getId().toString());
poiList.add(poiStruct);
}
prostruct.setOutUrl(getGoodsEntrySchema(coupon,wxCouponChannel.getId()));

prostruct.setPoiList(poiList);
prostruct.setAttrKeyValueMap(ttattrs.getProductAttrKeyValueMap());
product.setProduct(prostruct);
@@ -1294,11 +1334,11 @@ public class WxCouponServiceImpl implements WxCouponService {
product.setSku(skuStruct);

String productId = ttWebService.getGoodsService().productSave(product);
syncCouponChannelPoi(coupon,wxCouponChannelAddVo.getId(),productId);
syncCouponChannelPoi(coupon,wxCouponChannel.getId(),productId);
return new ResultData();

} catch (WxErrorException e) {
throw new Exception(e);
throw new Exception(e.getMessage());
// logger.error(e.getMessage());
// return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage());
} catch (Exception e){


+ 2
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java View File

@@ -1331,6 +1331,7 @@ public class WxMerchantServiceImpl implements WxMerchantService {
TtMerchantPoi poi = poiMap.get(m.getId());
if(null != poi){
m.setAddr(poi.getAddress());
m.setSupplierExtId(poi.getSupplierExtId());
m.setTtPoi(poi.getPoiId());
m.setLongitude(poi.getLongitude());
m.setLatitude(poi.getLatitude());
@@ -1399,6 +1400,7 @@ public class WxMerchantServiceImpl implements WxMerchantService {
vo.setShopVoList(merchantShopVoList.get(vo.getId()));
}
vo.setAddr(m.getAddr());
vo.setSupplierExtId(m.getSupplierExtId());
vo.setTtPoi(m.getTtPoi());
vo.setLongitude(m.getLongitude());
vo.setLatitude(m.getLatitude());


Loading…
Cancel
Save