Browse Source

feature1.0.0-img:图片新增上下架状态

feature-1.0-img-prototype
chengkun 4 years ago
parent
commit
ed1a804ff2
  1. 33
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/constants/StatusImgConstant.java
  2. 10
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/controller/CreatorMiniController.java
  3. 8
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/service/TiktokImgService.java
  4. 6
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/service/impl/CreatorServiceImpl.java
  5. 21
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/service/impl/TiktokImgServiceImpl.java
  6. 2
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/vo/TiktokImgVo.java
  7. 2
      bnyer-services/bnyer-img/src/main/resources/com/bnyer/img/mapper/TiktokCollectionMapper.xml
  8. 12
      bnyer-services/bnyer-img/src/main/resources/com/bnyer/img/mapper/TiktokImgMapper.xml

33
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/constants/StatusImgConstant.java

@ -0,0 +1,33 @@
package com.bnyer.img.constants;
/**
* 平台常量
* @author chengkun
* @date 2022/4/21 18:12
*/
public class StatusImgConstant {
/**
* 待审核
*/
public static final String UNCHECK = "0";
/**
* 审核通过
*/
public static final String PASS = "1";
/**
* 审核拒绝
*/
public static final String UNPASS = "2";
/**
* 已上架
*/
public static final String ONLINE = "3";
/**
* 已下架
*/
public static final String OFFLINE = "4";
}

10
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/controller/CreatorMiniController.java

@ -316,4 +316,14 @@ public class CreatorMiniController extends BaseController {
public AjaxResult queryCreatorTypeImgNum(@PathVariable @ApiParam("艺术家id") Long creatorId){
return AjaxResult.success(tiktokImgService.queryCreatorTypeImgNum(creatorId));
}
//@TokenCheck
@PostMapping("/onlineOrOfflineImg")
@ApiOperation("小程序艺术家上下架图片")
public AjaxResult onlineOrOfflineImg(@Validated @ApiParam("艺术家图片数据") @RequestBody StatusDto param)
{
log.info("小程序艺术家上下架图片参数为:{}", JSON.toJSON(param));
return AjaxResult.success(tiktokImgService.onlineOrOfflineImg(param));
}
}

8
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/service/TiktokImgService.java

@ -1,6 +1,7 @@
package com.bnyer.img.service;
import com.bnyer.img.domain.TiktokImg;
import com.bnyer.img.dto.StatusDto;
import com.bnyer.img.dto.TiktokImgPageDto;
import com.bnyer.img.vo.CreatorTypeImgVo;
import com.bnyer.img.vo.TiktokImgVo;
@ -123,4 +124,11 @@ public interface TiktokImgService {
* @return -
*/
CreatorTypeImgVo queryCreatorTypeImgNum(Long creatorId);
/**
* 艺术家上下架图片
* @param param 图片参数
* @return -
*/
int onlineOrOfflineImg(StatusDto param);
}

6
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/service/impl/CreatorServiceImpl.java

@ -10,15 +10,13 @@ import com.bnyer.common.core.utils.uuid.IdUtils;
import com.bnyer.common.redis.service.RedisService;
import com.bnyer.img.config.WxConfig;
import com.bnyer.img.constants.RedisKeyConstant;
import com.bnyer.img.constants.StatusImgConstant;
import com.bnyer.img.constants.TiktokConstant;
import com.bnyer.img.domain.Creator;
import com.bnyer.img.domain.InviteLog;
import com.bnyer.img.domain.TiktokImg;
import com.bnyer.img.domain.VerifyLog;
import com.bnyer.img.dto.CreatorDto;
import com.bnyer.img.dto.CreatorLoginDto;
import com.bnyer.img.dto.CreatorPageDto;
import com.bnyer.img.dto.VerifyCreatorDto;
import com.bnyer.img.dto.*;
import com.bnyer.img.mapper.CreatorMapper;
import com.bnyer.img.mapper.InviteLogMapper;
import com.bnyer.img.mapper.TiktokImgMapper;

21
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/service/impl/TiktokImgServiceImpl.java

@ -5,9 +5,11 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.bnyer.common.core.utils.StringUtils;
import com.bnyer.common.redis.service.RedisService;
import com.bnyer.img.constants.RedisKeyConstant;
import com.bnyer.img.constants.StatusImgConstant;
import com.bnyer.img.domain.TiktokCollection;
import com.bnyer.img.domain.TiktokImg;
import com.bnyer.img.domain.TiktokLike;
import com.bnyer.img.dto.StatusDto;
import com.bnyer.img.dto.TiktokImgPageDto;
import com.bnyer.img.mapper.TiktokCollectionMapper;
import com.bnyer.img.mapper.TiktokImgMapper;
@ -208,4 +210,23 @@ public class TiktokImgServiceImpl implements TiktokImgService {
result.setWatchNum(watchNum);
return result;
}
@Override
@Transactional(rollbackFor = Exception.class)
public int onlineOrOfflineImg(StatusDto param) {
TiktokImg img = new TiktokImg();
LambdaUpdateWrapper<TiktokImg> wrapper = new LambdaUpdateWrapper<>();
if(param.getStatus().equals(StatusImgConstant.ONLINE)){
img.setStatus(StatusImgConstant.ONLINE);
wrapper.eq(TiktokImg::getId, param.getId());
return tiktokImgMapper.update(img, wrapper);
}else if(param.getStatus().equals(StatusImgConstant.OFFLINE)){
img.setStatus(StatusImgConstant.OFFLINE);
wrapper.eq(TiktokImg::getId, param.getId());
return tiktokImgMapper.update(img, wrapper);
}else{
return 0;
}
}
}

2
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/vo/TiktokImgVo.java

@ -34,7 +34,7 @@ public class TiktokImgVo implements Serializable {
@ApiModelProperty(value="收藏量")
private Integer collectionNum;
@ApiModelProperty(value="状态(0->待审核;1->审核通过;2->审核拒绝)")
@ApiModelProperty(value="状态(0->待审核;1->审核通过;2->审核拒绝;3->已上架;4->已下架))")
private String status;
@ApiModelProperty(value="是否热门(0->冷门;1->热门)")

2
bnyer-services/bnyer-img/src/main/resources/com/bnyer/img/mapper/TiktokCollectionMapper.xml

@ -27,7 +27,7 @@
from img_collection itc
join img_tiktok_img iti on itc.img_id = iti.id
join img_type it on iti.type_id = it.id
where iti.is_show = '1' and it.is_show = '1' and iti.status = '1' and itc.is_show = '1'
where iti.is_show = '1' and it.is_show = '1' and iti.status = '3' and itc.is_show = '1'
and itc.user_id = #{userId} and itc.platform = #{platform}
order by itc.sort desc
</select>

12
bnyer-services/bnyer-img/src/main/resources/com/bnyer/img/mapper/TiktokImgMapper.xml

@ -43,7 +43,7 @@
<!-- id,img_url,creator_id,type_id,download_num, great_num, collection_num,status,is_hot-->
<!-- from img_tiktok_img-->
<!-- <where>-->
<!-- is_show = '1' and status = '1'-->
<!-- is_show = '1' and status = '3'-->
<!-- <if test="creatorId != null and creatorId != ''">-->
<!-- and creator_id = #{creatorId}-->
<!-- </if>-->
@ -57,7 +57,7 @@
select
id,img_url,creator_id,type_id,download_num, great_num, collection_num,status,is_hot
from img_tiktok_img
where creator_id = #{creatorId} and is_show = '1' and status = '1'
where creator_id = #{creatorId} and is_show = '1' and status = '3'
order by create_time desc
limit 3
</select>
@ -66,7 +66,7 @@
select
id,img_url,creator_id,type_id,download_num, great_num, collection_num,status,is_hot
from img_tiktok_img
where creator_id = #{creatorId} and is_show = '1' and status = '1'
where creator_id = #{creatorId} and is_show = '1' and status = '3'
order by create_time desc
</select>
@ -74,13 +74,13 @@
select
id,img_url,creator_id,type_id,download_num, great_num, collection_num,status,is_hot
from img_tiktok_img
where is_show = '1' and status = '1' and id = #{imgId}
where is_show = '1' and status = '3' and id = #{imgId}
</select>
<select id="queryFrontPage" resultType="com.bnyer.img.vo.TiktokImgVo">
select
id,img_url,creator_id,type_id,download_num, great_num, collection_num,status,is_hot
from img_tiktok_img
where is_show = '1' and status = '1'
where is_show = '1' and status = '3'
</select>
<select id="queryImgsByScanCodeAndTypeId" resultType="com.bnyer.img.vo.TiktokImgVo">
@ -90,7 +90,7 @@
iti.status as status,iti.is_hot as isHot
from img_tiktok_img iti
join img_creator ic on iti.creator_id = ic.id
where iti.is_show = '1' and iti.status = '1'
where iti.is_show = '1' and iti.status = '3'
and ic.scan_code = #{scanCode} and iti.type_id = #{typeId}
</select>

Loading…
Cancel
Save