| @@ -13,6 +13,7 @@ import com.iformall.domain.po.WxCouponChannel; | |||
| import com.iformall.domain.po.WxCouponPassword; | |||
| import com.iformall.domain.po.WxPayAccount; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.TtCouponVo; | |||
| import com.iformall.domain.vo.WxCouponStatisVo; | |||
| import com.iformall.douyin.web.bean.GoodsTemplateGet; | |||
| import com.iformall.enums.*; | |||
| @@ -69,6 +70,25 @@ public class WxCouponController extends BaseController { | |||
| @Qualifier("objectCommonRedisTemplate") | |||
| RedisTemplate<String, Object> redisTemplate; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("ttgoodslist") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| @SystemControllerLog(description = "-列表") | |||
| public ResultData ttgoodslist(@ModelAttribute TtCouponVo ttCouponVo, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponController::ttgoodslist"); | |||
| if (ttCouponVo == null) ttCouponVo = new TtCouponVo(); | |||
| ttCouponVo.updateTenantInfo(getTenantInfo()); | |||
| ttCouponVo.setType(EnumCouponType.COUPON_DOUYIN.getCode()); | |||
| if(StringUtils.isNotBlank(ttCouponVo.getSortColumn())){ | |||
| String coryColumn = "c."+ttCouponVo.getSortColumns(); | |||
| ttCouponVo.setSortColumns(coryColumn); | |||
| ttCouponVo.setSortColumn(null); | |||
| } | |||
| return wxCouponService.ttgoodslist(ttCouponVo, pageNum, pageSize); | |||
| } | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @@ -597,7 +617,7 @@ public class WxCouponController extends BaseController { | |||
| if(couponId == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| WxCoupon coupon = wxCouponService.getById(couponId, getTenantInfo().getTenantId()); | |||
| WxCoupon coupon = wxCouponService.getAttrsById(couponId, getTenantInfo().getTenantId()); | |||
| if(coupon == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| @@ -0,0 +1,34 @@ | |||
| package com.iformall.domain.vo; | |||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.ToString; | |||
| import java.io.Serializable; | |||
| @Data | |||
| @ToString(callSuper = true) | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class TtCouponVo extends WxCoupon implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @io.swagger.annotations.ApiModelProperty(value="couponChannelId",name="couponChannelId") | |||
| private Long couponChannelId; | |||
| @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; | |||
| @io.swagger.annotations.ApiModelProperty(value="描述",name="statusDesc") | |||
| private String statusDesc; | |||
| @io.swagger.annotations.ApiModelProperty(value="状态:0-审核中,1-上架,2-下架,3-审核拒绝 4-审核通过",name="lastStatus") | |||
| private Integer lastStatus; | |||
| @io.swagger.annotations.ApiModelProperty(value="描述",name="lastStatusDesc") | |||
| private String lastStatusDesc; | |||
| } | |||
| @@ -30,6 +30,8 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||
| List<Long> findSendCouponIds(@Param("expired")Integer expired,@Param("tenantId")String tenantId); | |||
| WxCoupon selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| WxCoupon getAttrsById(@Param("id")Long id, @Param("tenantId")String tenantId); | |||
| WxCoupon getPriceAndStock(@Param("id")Long id,@Param("tenantId")String tenantId); | |||
| List<WxCoupon> batchGetPriceAndStock(@Param("ids")List<Long> ids,@Param("tenantId")String tenantId); | |||
| @@ -118,4 +120,5 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||
| List<WxCoupon> newfindCList(WxCoupon couponQ); | |||
| List<Long> findIdsListHasConditons(WxCoupon couponQ); | |||
| } | |||
| @@ -9,12 +9,14 @@ import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.TtCouponVo; | |||
| import com.iformall.domain.vo.WxCouponCVo; | |||
| import com.iformall.domain.vo.WxCouponStatisVo; | |||
| import com.iformall.domain.vo.WxMerchantVo; | |||
| public interface WxCouponService { | |||
| ResultData ttgoodslist(TtCouponVo ttCouponVo, Integer pageNum, Integer pageSize); | |||
| ResultData list(TenantEntity tenantEntity,WxCoupon wxCoupon, Integer pageNum, Integer pageSize); | |||
| @@ -79,6 +81,8 @@ public interface WxCouponService { | |||
| WxCouponCVo getVoById(Long id,String tenantId); | |||
| WxCouponCVo getVoStatusById(Long id,String tenantId); | |||
| WxCoupon getAttrsById(Long couponId, String tenantId); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| @@ -274,4 +278,6 @@ public interface WxCouponService { | |||
| ResultData productSave(WxCoupon coupon); | |||
| } | |||
| @@ -125,7 +125,6 @@ public class TtGoodsCategoryServiceImpl implements TtGoodsCategoryService { | |||
| @Override | |||
| public void handTemplate(GoodsTemplateGet temp, WxCoupon coupon) { | |||
| if(!coupon.getProductAttrKeyValueMap().isEmpty()){ | |||
| List<GoodsTemplateGet.ProductAttrs> productAttrs = new ArrayList<>(); | |||
| for (GoodsTemplateGet.ProductAttrs attr: temp.getProductAttrs()) { | |||
| String value = coupon.getProductAttrKeyValueMap().get(attr.getKey()); | |||
| if(StringUtils.isNotBlank(value)){ | |||
| @@ -57,7 +57,7 @@ import static java.util.stream.Collectors.toList; | |||
| @Service | |||
| public class WxCouponServiceImpl<main> implements WxCouponService { | |||
| public class WxCouponServiceImpl implements WxCouponService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| @@ -140,6 +140,11 @@ public class WxCouponServiceImpl<main> implements WxCouponService { | |||
| @Autowired | |||
| private MqBaseProducer mqBaseProducer; | |||
| @Override | |||
| public ResultData ttgoodslist(TtCouponVo ttCouponVo, Integer pageNum, Integer pageSize) { | |||
| return null; | |||
| } | |||
| @Override | |||
| public ResultData list(TenantEntity tenantEntity,WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { | |||
| if (null == wxCoupon) wxCoupon = new WxCoupon(); | |||
| @@ -302,6 +307,11 @@ public class WxCouponServiceImpl<main> implements WxCouponService { | |||
| return wxCouponCVo; | |||
| } | |||
| @Override | |||
| public WxCoupon getAttrsById(Long id, String tenantId) { | |||
| return wxCouponMapper.getAttrsById(id,tenantId); | |||
| } | |||
| private Long parseMerchantId(JSONObject merchantParam){ | |||
| return Long.valueOf(merchantParam.getString("id")); | |||
| @@ -326,6 +326,19 @@ | |||
| <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns"/> ,c.html from wx_coupon c where id = #{id} and tenant_id = #{tenantId} | |||
| </select> | |||
| <resultMap id="AttrsResultMap" type="com.iformall.domain.po.WxCoupon"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="product_type" jdbcType="INTEGER" property="productType"/> | |||
| <result column="category_id" jdbcType="INTEGER" property="categoryId"/> | |||
| <result column="product_attrs" jdbcType="VARCHAR" property="productAttrs"/> | |||
| <result column="sku_attrs" jdbcType="VARCHAR" property="skuAttrs"/> | |||
| </resultMap> | |||
| <select id="getAttrsById" parameterType="java.util.HashMap" resultMap="AttrsResultMap"> | |||
| select id,product_type,category_id,product_attrs,sku_attrs | |||
| from wx_coupon where id = #{id} and tenant_id = #{tenantId} | |||
| </select> | |||
| <select id="getPriceAndStock" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||
| select c.id,c.sale_price,c.price,c.remain_inventory,c.inventory,c.credit_price from wx_coupon c where id = #{id} and tenant_id = #{tenantId} | |||