Преглед изворни кода

//tt product

release_toaliyun_real
xhxu пре 4 година
родитељ
комит
717387cf65
4 измењених фајлова са 91 додато и 3 уклоњено
  1. +21
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/market/TtCouponGoodsController.java
  2. +1
    -0
      mallinkService/src/main/java/com/iformall/domain/po/TtCouponChannelPoi.java
  3. +3
    -0
      mallinkService/src/main/java/com/iformall/service/TtCouponGoodsService.java
  4. +66
    -3
      mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java

+ 21
- 0
mallinkAdmin/src/main/java/com/iformall/controller/market/TtCouponGoodsController.java Прегледај датотеку

@@ -158,6 +158,27 @@ public class TtCouponGoodsController extends BaseController {
return ttCouponGoodsService.productOnlineGet(getTenantInfo(),id);
}

@ApiOperation("实时同步上下架状态")
@GetMapping("product/operate")
@SystemControllerLog(description = "实时同步上下架状态")
public ResultData productOperate(Long id) {
if (id == null) {
return new ResultData(ResultData.ERROR, "缺少id");
}
return ttCouponGoodsService.productOperate(getTenantInfo(),id);
}

@ApiOperation("实时同步库存")
@GetMapping("product/stock/sync")
@SystemControllerLog(description = "实时同步库存")
public ResultData productStockSync(Long id) {
if (id == null) {
return new ResultData(ResultData.ERROR, "缺少id");
}
return ttCouponGoodsService.productStockSync(getTenantInfo(),id);
}



}

+ 1
- 0
mallinkService/src/main/java/com/iformall/domain/po/TtCouponChannelPoi.java Прегледај датотеку

@@ -25,6 +25,7 @@ public class TtCouponChannelPoi extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value="spuId",name="spuId")
private String spuId;

//该字段状态更新不及时,不作为业务使用
@io.swagger.annotations.ApiModelProperty(value="状态:0-审核中,1-上架,2-下架,3-审核拒绝 4-审核通过",name="status")
private Integer status;



+ 3
- 0
mallinkService/src/main/java/com/iformall/service/TtCouponGoodsService.java Прегледај датотеку

@@ -22,4 +22,7 @@ public interface TtCouponGoodsService {

ResultData productOnlineGet(TenantEntity tenantEntity,Long id);

ResultData productOperate(TenantEntity tenantInfo, Long id);

ResultData productStockSync(TenantEntity tenantInfo, Long id);
}

+ 66
- 3
mallinkService/src/main/java/com/iformall/service/impl/TtCouponGoodsServiceImpl.java Прегледај датотеку

@@ -156,7 +156,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
wxCouponChannel.setShowBeginTime(new Date());
wxCouponChannel.setBeginTime(new Date());
wxCouponChannel.setEndTime(coupon.getValidEndDate());
wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_AFTER.getCode());
wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_BEFORE.getCode());
wxCouponChannel.setCouponId(coupon.getId());
wxCouponChannel.setType(coupon.getType());
wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN_LIST.getCode());
@@ -221,7 +221,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
public ResultData productDraftGet(TenantEntity tenantEntity,Long id) {
TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantEntity.getTenantId(),id);
if(ttCouponChannelPoi == null){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该商品未提交审核");
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该未提交审核");
}
try {
TtWebService ttWebService = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi);
@@ -255,7 +255,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
public ResultData productOnlineGet(TenantEntity tenantEntity,Long id) {
TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantEntity.getTenantId(),id);
if(ttCouponChannelPoi == null){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该商品未提交审核");
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该未提交审核");
}
try {
TtWebService ttWebService = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi);
@@ -285,6 +285,69 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService {
}
}

@Override
public ResultData productOperate(TenantEntity tenantInfo, Long id) {
WxCoupon wxCoupon = wxCouponMapper.selectById(id, tenantInfo.getTenantId());
if(wxCoupon == null || EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode().equals(wxCoupon.getStatus())){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未找到或已作废");
}
TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),id);
if(ttCouponChannelPoi == null || !EnumSpuSyncStatus.sync_audit_pass.getCode().equals(ttCouponChannelPoi.getLastStatus())){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过");
}
//查询上架
//op_type int64 TRUE 1-上线 2-下线
Integer op_type = 2;
WxCouponChannel wxCouponChannelQuery = new WxCouponChannel();
wxCouponChannelQuery.updateTenantInfo(wxCoupon);
wxCouponChannelQuery.setCouponId(wxCoupon.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){
op_type = 1;
}

try {
TtWebService ttWebService = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi);
boolean b = ttWebService.getGoodsService().productOperate(null,wxCoupon.getId().toString(),op_type);
if(b){
return new ResultData();
}else{
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"同步失败");
}

} catch (WxErrorException e) {
e.printStackTrace();
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getMessage());
}
}

@Override
public ResultData productStockSync(TenantEntity tenantInfo, Long id) {
WxCoupon wxCoupon = wxCouponMapper.selectById(id, tenantInfo.getTenantId());
if(wxCoupon == null || EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode().equals(wxCoupon.getStatus())){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未找到或已作废");
}
TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),id);
if(ttCouponChannelPoi == null || !EnumSpuSyncStatus.sync_audit_pass.getCode().equals(ttCouponChannelPoi.getLastStatus())){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未提交审核或审核未通过");
}
try {
TtWebService ttWebService = ttMerchantPoiService.getTtWebService(ttCouponChannelPoi);
boolean b = ttWebService.getGoodsService().stockSync(null,wxCoupon.getId().toString(),wxCoupon.getInventory());
if(b){
return new ResultData();
}else{
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"同步失败");
}

} catch (WxErrorException e) {
e.printStackTrace();
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),e.getMessage());
}
}

private void syncCouponChannelPoi(WxCoupon coupon,Long couponChannelId,String productId){
TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(coupon.getTenantId(),coupon.getId());
Date date = new Date();


Loading…
Откажи
Сачувај