| @@ -6,9 +6,12 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.TtCouponChannelPoi; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.enums.EnumCouponVersion; | |||
| import com.iformall.service.MailService; | |||
| import com.iformall.service.TtCouponGoodsService; | |||
| import com.iformall.service.WxAppinfoService; | |||
| import com.iformall.service.WxCouponService; | |||
| import com.iformall.utils.DateUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -42,6 +45,9 @@ public class TtGoodsController extends BaseController { | |||
| @Autowired | |||
| private TtCouponGoodsService ttCouponGoodsService; | |||
| @Autowired | |||
| private WxCouponService wxCouponService; | |||
| @Autowired | |||
| @Qualifier("openRedisTemplate") | |||
| RedisTemplate<String, String> openRedisTemplate; | |||
| @@ -70,7 +76,7 @@ public class TtGoodsController extends BaseController { | |||
| Map resultMap = new HashMap<>(); | |||
| if(!product_audit_notify.equals(identifyName)){ | |||
| resultMap.put("err_code",1000); | |||
| resultMap.put("err_tips","error"); | |||
| resultMap.put("err_tips","error1"); | |||
| return resultMap; | |||
| } | |||
| try{ | |||
| @@ -78,20 +84,26 @@ public class TtGoodsController extends BaseController { | |||
| String status = (String) parameterMap.get("status"); | |||
| TtCouponChannelPoi couponChannelPoi = ttCouponGoodsService.getCouponChannelBySpuId(product_id.toString()); | |||
| ResultData resultData = ttCouponGoodsService.productDraftGet(couponChannelPoi, couponChannelPoi.getId(), false); | |||
| if(resultData.code == 200){ | |||
| resultMap.put("err_code",0); | |||
| resultMap.put("err_tips","success"); | |||
| }else{ | |||
| resultMap.put("err_code",resultData.code); | |||
| resultMap.put("err_tips",resultData.message); | |||
| if(couponChannelPoi != null){ | |||
| WxCoupon coupon = wxCouponService.getById(couponChannelPoi.getId(), couponChannelPoi.getTenantId()); | |||
| ResultData resultData = ttCouponGoodsService.productDraftGet(coupon, coupon.getCouponId(), true); | |||
| if(resultData.code == 200){ | |||
| resultMap.put("err_code",0); | |||
| resultMap.put("err_tips","success"); | |||
| }else{ | |||
| resultMap.put("err_code",resultData.code); | |||
| resultMap.put("err_tips",resultData.message); | |||
| } | |||
| return resultMap; | |||
| } | |||
| resultMap.put("err_code",1000); | |||
| resultMap.put("err_tips","error2"); | |||
| return resultMap; | |||
| }catch(Exception e){ | |||
| resultMap.put("err_code",1000); | |||
| resultMap.put("err_tips","error"); | |||
| resultMap.put("err_tips","error3"); | |||
| return resultMap; | |||
| } | |||
| @@ -6,6 +6,7 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.TtCouponChannelPoi; | |||
| import com.iformall.domain.po.WxAppinfo; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.enums.EnumSpuSyncStatus; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.DateUtils; | |||
| @@ -47,6 +48,9 @@ public class TtWebController extends BaseController { | |||
| @Qualifier("openRedisTemplate") | |||
| RedisTemplate<String, String> openRedisTemplate; | |||
| @Autowired | |||
| private WxCouponService wxCouponService; | |||
| /** | |||
| * { | |||
| * "event": "verify_webhook", | |||
| @@ -130,16 +134,21 @@ public class TtWebController extends BaseController { | |||
| // } | |||
| // ttCouponGoodsService.handlerTtGoodsAudit(couponChannelPoi); | |||
| ResultData resultData = ttCouponGoodsService.productDraftGet(couponChannelPoi, couponChannelPoi.getId(), false); | |||
| if(resultData.code == 200){ | |||
| resultMap.put("err_code",0); | |||
| resultMap.put("err_tips","success"); | |||
| openRedisTemplate.opsForValue().set(key,"1",16*60, TimeUnit.SECONDS); | |||
| }else{ | |||
| resultMap.put("err_code",resultData.code); | |||
| resultMap.put("err_tips",resultData.message); | |||
| if(couponChannelPoi != null){ | |||
| WxCoupon coupon = wxCouponService.getById(couponChannelPoi.getId(), couponChannelPoi.getTenantId()); | |||
| ResultData resultData = ttCouponGoodsService.productDraftGet(coupon, coupon.getCouponId(), false); | |||
| if(resultData.code == 200){ | |||
| resultMap.put("err_code",0); | |||
| resultMap.put("err_tips","success"); | |||
| }else{ | |||
| resultMap.put("err_code",resultData.code); | |||
| resultMap.put("err_tips",resultData.message); | |||
| } | |||
| return resultMap; | |||
| } | |||
| resultMap.put("err_code",1000); | |||
| resultMap.put("err_tips","error2"); | |||
| return resultMap; | |||
| } | |||
| @@ -18,6 +18,6 @@ public interface TtCouponChannelPoiMapper extends CommonMapper<TtCouponChannelPo | |||
| TtCouponChannelPoi selectById(@Param("tenantId")String tenantId,@Param("id")Long id); | |||
| TtCouponChannelPoi selectBySpuId(@Param("spuId")String spuId); | |||
| TtCouponChannelPoi selectAuditingBySpuId(@Param("spuId")String spuId); | |||
| } | |||
| @@ -440,7 +440,7 @@ public class TtCouponGoodsServiceImpl implements TtCouponGoodsService { | |||
| @Override | |||
| public TtCouponChannelPoi getCouponChannelBySpuId(String spuId) { | |||
| return ttCouponChannelPoiMapper.selectBySpuId(spuId); | |||
| return ttCouponChannelPoiMapper.selectAuditingBySpuId(spuId); | |||
| } | |||
| @Override | |||
| @@ -110,11 +110,12 @@ | |||
| </select> | |||
| <select id="selectBySpuId" resultMap="BaseResultMap"> | |||
| <select id="selectAuditingBySpuId" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from tt_coupon_channel_poi | |||
| where `spu_id` = #{spuId} | |||
| and `status` = 0 | |||
| </select> | |||
| <update id="updateBySpuId" parameterType="com.iformall.domain.po.TtCouponChannelPoi"> | |||