110 changed files with 3064 additions and 352 deletions
@ -0,0 +1,26 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<parent> |
|||
<groupId>com.dimensionalnode</groupId> |
|||
<artifactId>bnyer-api</artifactId> |
|||
<version>1.0.0</version> |
|||
</parent> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
|
|||
<artifactId>bnyer-api-img</artifactId> |
|||
|
|||
<description> |
|||
bnyer-api-img图文服务接口模块 |
|||
</description> |
|||
|
|||
<dependencies> |
|||
<!-- bnyer Common Core--> |
|||
<dependency> |
|||
<groupId>com.dimensionalnode</groupId> |
|||
<artifactId>bnyer-common-core</artifactId> |
|||
</dependency> |
|||
</dependencies> |
|||
|
|||
</project> |
|||
@ -0,0 +1,29 @@ |
|||
package com.bnyer.img.api; |
|||
|
|||
import com.bnyer.common.core.constant.ServiceNameConstants; |
|||
import com.bnyer.common.core.domain.R; |
|||
import com.bnyer.img.api.dto.TiktokImgMiniDto; |
|||
import com.bnyer.img.api.factory.RemoteImgFallbackFactory; |
|||
import io.swagger.annotations.ApiParam; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
|
|||
/** |
|||
* 图文服务 |
|||
* |
|||
* @author chengkun |
|||
* @date 2022/7/8 11:03 |
|||
*/ |
|||
@FeignClient(contextId = "remoteImgService", value = ServiceNameConstants.IMG_SERVICE, fallbackFactory = RemoteImgFallbackFactory.class) |
|||
public interface RemoteImgService { |
|||
|
|||
/** |
|||
* 保存图片 |
|||
* @param dto 图片接收类 |
|||
* @return - |
|||
*/ |
|||
@PostMapping(value = "/img/mini/creator/insertTiktokImg") |
|||
public R<Integer> insertTiktokImg(@Validated @RequestBody @ApiParam("TiktokImg对象") TiktokImgMiniDto dto); |
|||
} |
|||
@ -0,0 +1,87 @@ |
|||
package com.bnyer.img.api.domain; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.*; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
@ApiModel("抖音图片小程序api端实体类") |
|||
@Getter |
|||
@Setter |
|||
@ToString |
|||
@AllArgsConstructor |
|||
@NoArgsConstructor |
|||
public class TiktokImg implements Serializable { |
|||
/** |
|||
* id |
|||
*/ |
|||
@ApiModelProperty(value="id") |
|||
private Long id; |
|||
|
|||
/** |
|||
* 图片地址 |
|||
*/ |
|||
@ApiModelProperty(value="图片地址") |
|||
private String imgUrl; |
|||
|
|||
/** |
|||
* 艺术家id |
|||
*/ |
|||
@ApiModelProperty(value="艺术家id") |
|||
private Long creatorId; |
|||
|
|||
/** |
|||
* 分类id |
|||
*/ |
|||
@ApiModelProperty(value="分类id") |
|||
private Long typeId; |
|||
|
|||
/** |
|||
* 下载量 |
|||
*/ |
|||
@ApiModelProperty(value="下载量") |
|||
private Integer downloadNum; |
|||
|
|||
/** |
|||
* 点赞量 |
|||
*/ |
|||
@ApiModelProperty(value="点赞量") |
|||
private Integer greatNum; |
|||
|
|||
/** |
|||
* 收藏量 |
|||
*/ |
|||
@ApiModelProperty(value="收藏量") |
|||
private Integer collectionNum; |
|||
|
|||
/** |
|||
* 状态(0->待审核;1->审核通过) |
|||
*/ |
|||
@ApiModelProperty(value="状态(0->待审核;1->审核通过;2->审核拒绝)") |
|||
private String status; |
|||
|
|||
/** |
|||
* 是否热门(0->冷门;1->热门) |
|||
*/ |
|||
@ApiModelProperty(value="是否热门(0->冷门;1->热门)") |
|||
private String isHot; |
|||
|
|||
@ApiModelProperty(value="是否显示 (0->隐藏;1->显示)") |
|||
private String isShow; |
|||
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@ApiModelProperty(value="创建时间") |
|||
private Date createTime; |
|||
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@ApiModelProperty(value="更新时间") |
|||
private Date updateTime; |
|||
|
|||
@ApiModelProperty(value="排序") |
|||
private Integer sort; |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
} |
|||
@ -0,0 +1,39 @@ |
|||
package com.bnyer.img.api.dto; |
|||
|
|||
import com.bnyer.common.core.utils.bean.BeanUtils; |
|||
import com.bnyer.img.api.domain.TiktokImg; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("抖音图片小程序api端接收类") |
|||
public class TiktokImgMiniDto implements Serializable { |
|||
|
|||
@ApiModelProperty(value="id") |
|||
private Long id; |
|||
|
|||
@ApiModelProperty(value="图片地址") |
|||
private String imgUrl; |
|||
|
|||
@ApiModelProperty(value="艺术家id") |
|||
private Long creatorId; |
|||
|
|||
@ApiModelProperty(value="分类id") |
|||
private Long typeId; |
|||
|
|||
@ApiModelProperty(value="状态(0->待审核;1->审核通过;2->审核拒绝)") |
|||
private String status; |
|||
|
|||
|
|||
public TiktokImg extractParam(){ |
|||
TiktokImg tiktokImg = new TiktokImg(); |
|||
BeanUtils.copyProperties(this,tiktokImg); |
|||
return tiktokImg; |
|||
} |
|||
} |
|||
@ -0,0 +1,33 @@ |
|||
package com.bnyer.img.api.factory; |
|||
|
|||
import com.bnyer.common.core.domain.R; |
|||
import com.bnyer.img.api.RemoteImgService; |
|||
import com.bnyer.img.api.dto.TiktokImgMiniDto; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.cloud.openfeign.FallbackFactory; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 图文服务降级处理 |
|||
* |
|||
* @author penny |
|||
*/ |
|||
@Component |
|||
public class RemoteImgFallbackFactory implements FallbackFactory<RemoteImgService> |
|||
{ |
|||
private static final Logger log = LoggerFactory.getLogger(RemoteImgFallbackFactory.class); |
|||
|
|||
|
|||
@Override |
|||
public RemoteImgService create(Throwable throwable) { |
|||
log.error("api图文服务调用失败:{}", throwable.getMessage()); |
|||
return new RemoteImgService() |
|||
{ |
|||
@Override |
|||
public R<Integer> insertTiktokImg(TiktokImgMiniDto dto) { |
|||
return R.fail("图片保存失败:" + throwable.getMessage()); |
|||
} |
|||
}; |
|||
} |
|||
} |
|||
@ -0,0 +1,2 @@ |
|||
org.springframework.boot.autoconfigure.EnableAutoConfiguration = com.bnyer.img.api.factory.RemoteImgFallbackFactory |
|||
|
|||
@ -0,0 +1,33 @@ |
|||
package com.bnyer.file.config; |
|||
|
|||
import org.springframework.boot.context.properties.ConfigurationProperties; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.scheduling.annotation.EnableAsync; |
|||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
|||
|
|||
import java.util.concurrent.Executor; |
|||
import java.util.concurrent.ThreadPoolExecutor; |
|||
|
|||
/** |
|||
* @Author qyh |
|||
* @Date 2022/7/10 15:31 |
|||
* @Description |
|||
*/ |
|||
@Configuration |
|||
@EnableAsync |
|||
public class ExecutorConfig { |
|||
|
|||
|
|||
@Bean |
|||
public Executor mySimpleAsync() { |
|||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); |
|||
executor.setCorePoolSize(10); |
|||
executor.setMaxPoolSize(50); |
|||
executor.setQueueCapacity(10); |
|||
executor.setThreadNamePrefix("fileUpload"); |
|||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); |
|||
executor.initialize(); |
|||
return executor; |
|||
} |
|||
} |
|||
@ -0,0 +1,104 @@ |
|||
package com.bnyer.file.constants; |
|||
|
|||
public class RedisKeyConstant { |
|||
|
|||
|
|||
/** |
|||
* 抖音小程序用户收藏图片键 |
|||
*/ |
|||
public static final String TIKTOK_USER_COLLECT_KEY = "bnyer.img.tiktok.collect:"; |
|||
|
|||
/** |
|||
* 抖音小程序图片收藏数量键 |
|||
*/ |
|||
public static final String TIKTOK_IMG_COLLECT_NUM_KEY = "bnyer.img.tiktok.collectNum"; |
|||
|
|||
/** |
|||
* 快手小程序图片收藏数量键 |
|||
*/ |
|||
public static final String FAST_HAND_IMG_COLLECT_NUM_KEY = "bnyer.img.fh.collectNum"; |
|||
|
|||
/** |
|||
* 微信小程序图片收藏数量键 |
|||
*/ |
|||
public static final String WECHAT_IMG_COLLECT_NUM_KEY = "bnyer.img.wx.collectNum"; |
|||
|
|||
/** |
|||
* 抖音小程序用户点赞图片键 |
|||
*/ |
|||
public static final String TIKTOK_USER_LIKE_KEY = "bnyer.img.tiktok.like"; |
|||
|
|||
/** |
|||
* 快手小程序用户点赞图片键 |
|||
*/ |
|||
public static final String FAST_HAND_USER_LIKE_KEY = "bnyer.img.fh.like"; |
|||
|
|||
/** |
|||
* 微信小程序用户点赞图片键 |
|||
*/ |
|||
public static final String WECHAT_USER_LIKE_KEY = "bnyer.img.wx.like"; |
|||
|
|||
/** |
|||
* 抖音小程序图片点赞数量键 |
|||
*/ |
|||
public static final String TIKTOK_IMG_LIKE_NUM_KEY = "bnyer.img.tiktok.likeNum"; |
|||
|
|||
/** |
|||
* 快手小程序图片点赞数量键 |
|||
*/ |
|||
public static final String FAST_HAND_IMG_LIKE_NUM_KEY = "bnyer.img.fh.likeNum"; |
|||
|
|||
/** |
|||
* 微信小程序图片点赞数量键 |
|||
*/ |
|||
public static final String WECHAT_IMG_LIKE_NUM_KEY = "bnyer.img.wx.likeNum"; |
|||
|
|||
/** |
|||
* 抖音小程序图片下载数量键 |
|||
*/ |
|||
public static final String TIKTOK_IMG_DOWNLOAD_NUM_KEY = "bnyer.img.creator.downloadNum:"; |
|||
|
|||
/** |
|||
* 抖音小程序图片下载总数量键 |
|||
*/ |
|||
public static final String TIKTOK_IMG_TOTAL_DOWNLOAD_NUM_KEY = "bnyer.img.date.downloadTotalNum:"; |
|||
|
|||
/** |
|||
* 抖音小程序用户登录键 |
|||
*/ |
|||
public static final String TIKTOK_USER_LOGIN_KEY = "bnyer.img.tiktok.user:"; |
|||
|
|||
/** |
|||
* 快手小程序用户登录键 |
|||
*/ |
|||
public static final String FH_USER_LOGIN_KEY = "bnyer.img.fh.user:"; |
|||
|
|||
/** |
|||
* 微信小程序用户登录键 |
|||
*/ |
|||
public static final String WECHAT_USER_LOGIN_KEY = "bnyer.img.wx.user:"; |
|||
|
|||
/** |
|||
* 微信小程序艺术家登录键 |
|||
*/ |
|||
public static final String WECHAT_CREATOR_LOGIN_KEY = "bnyer.img.wechat.creator:"; |
|||
|
|||
/** |
|||
* 微信小程序艺术家邀请键 |
|||
*/ |
|||
public static final String WECHAT_CREATOR_INVITE_KEY = "bnyer.img.invite.creator:"; |
|||
|
|||
/** |
|||
* 审核收益锁键 |
|||
*/ |
|||
public static final String VERIFY_PROFIT_LOCK_KEY = "bnyer.img.profit.lock:"; |
|||
|
|||
/** |
|||
* 平台用户下载键 |
|||
*/ |
|||
public static final String PLATFORM_USER_DOWNLOAD_KEY = "bnyer.img.user.download:"; |
|||
/** |
|||
* 艺术家上传键 |
|||
*/ |
|||
public static final String CREATOR_UPLOAD_KEY="bnyer.img.createor.upload"; |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
package com.bnyer.file.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
/** |
|||
* @Author qyh |
|||
* @Date 2022/7/10 16:37 |
|||
* @Description |
|||
*/ |
|||
@Getter |
|||
@Setter |
|||
@ApiModel("文件信息") |
|||
public class FileDto { |
|||
private byte[] bytes; |
|||
private String originalFilename; |
|||
private String name; |
|||
} |
|||
@ -0,0 +1,38 @@ |
|||
package com.bnyer.file.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import java.util.ArrayList; |
|||
|
|||
/** |
|||
* @Author qyh |
|||
* @Date 2022/7/9 18:24 |
|||
* @Description |
|||
*/ |
|||
@Getter |
|||
@Setter |
|||
@ApiModel("文件上传") |
|||
public class FileUploadDto { |
|||
|
|||
@ApiModelProperty(value="id") |
|||
private Long id; |
|||
|
|||
@ApiModelProperty(value="图片地址") |
|||
private String imgUrl; |
|||
|
|||
@ApiModelProperty(value="艺术家id") |
|||
private Long creatorId; |
|||
|
|||
@ApiModelProperty(value="分类id") |
|||
private Long typeId; |
|||
|
|||
@ApiModelProperty(value="状态(0->待审核;1->审核通过;2->审核拒绝)") |
|||
private String status; |
|||
|
|||
@ApiModelProperty(value="要上传的图片") |
|||
private ArrayList<FileDto> files; |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
package com.bnyer.file.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author chengkun |
|||
* @Date 2022/7/10 16:37 |
|||
* @Description |
|||
*/ |
|||
@Getter |
|||
@Setter |
|||
@ApiModel("文件url地址") |
|||
public class FileUrlDto implements Serializable { |
|||
|
|||
private String url; |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
package com.bnyer.file.vo; |
|||
|
|||
/** |
|||
* @Author qyh |
|||
* @Date 2022/7/9 18:22 |
|||
* @Description |
|||
*/ |
|||
public class UploadVo { |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
package com.bnyer.img.config; |
|||
|
|||
import lombok.Getter; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.boot.context.properties.ConfigurationProperties; |
|||
import org.springframework.cloud.context.config.annotation.RefreshScope; |
|||
import org.springframework.context.annotation.Configuration; |
|||
|
|||
/** |
|||
* 八字算命配置类 |
|||
* @author chengkun |
|||
* @date 2022/4/21 17:43 |
|||
*/ |
|||
@Configuration |
|||
@ConfigurationProperties(prefix = "bnyer.img.bz") |
|||
@Getter |
|||
@RefreshScope |
|||
public class BzConfig { |
|||
|
|||
@Value("${bnyer.img.bz.appCode}") |
|||
private String appCode; |
|||
|
|||
@Value("${bnyer.img.bz.url}") |
|||
private String url; |
|||
} |
|||
@ -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"; |
|||
} |
|||
@ -0,0 +1,46 @@ |
|||
package com.bnyer.img.controller; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.bnyer.common.core.domain.R; |
|||
import com.bnyer.common.core.web.controller.BaseController; |
|||
import com.bnyer.common.redis.service.RedisService; |
|||
import com.bnyer.img.dto.BzDto; |
|||
import com.bnyer.img.service.BzDataService; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import io.swagger.annotations.ApiParam; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
@Api(value = "【图文平台】八字运势接口",tags = "【图文平台】八字运势接口") |
|||
@RestController |
|||
@RequestMapping("/img/bz") |
|||
@Slf4j |
|||
public class BzDataController extends BaseController { |
|||
|
|||
@Autowired |
|||
private BzDataService bzDataService; |
|||
@Autowired |
|||
private RedisService redisService; |
|||
//@RequiresPermissions("system:config:list")
|
|||
@ApiOperation(value = "八字算命") |
|||
@PostMapping("/getYs") |
|||
public R<JSONObject> getYs(@RequestBody @ApiParam("八字运势") BzDto dto) { |
|||
JSONObject jsonObject = bzDataService.getYs(dto); |
|||
if (jsonObject!=null){ |
|||
return R.ok(jsonObject); |
|||
} |
|||
return R.fail(); |
|||
} |
|||
|
|||
@ApiOperation(value = "八字页面数据统计") |
|||
@PostMapping("/dataStatistics") |
|||
public R<JSONObject> dataStatistics(@RequestParam String source, HttpServletRequest request) { |
|||
String ip = bzDataService.getIpAddr(request); |
|||
bzDataService.dataStatistics(ip,source); |
|||
return R.ok(); |
|||
} |
|||
} |
|||
@ -1,14 +1,80 @@ |
|||
package com.bnyer.img.controller; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.bnyer.common.core.web.controller.BaseController; |
|||
import com.bnyer.common.core.web.domain.AjaxResult; |
|||
import com.bnyer.common.core.web.page.TableDataInfo; |
|||
import com.bnyer.img.domain.Sign; |
|||
import com.bnyer.img.dto.SignDto; |
|||
import com.bnyer.img.dto.SignPageDto; |
|||
import com.bnyer.img.dto.StatusDto; |
|||
import com.bnyer.img.service.SignService; |
|||
import com.github.pagehelper.PageHelper; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import io.swagger.annotations.ApiParam; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Api(value = "【图文平台】图片标签接口",tags = "【图文平台】图片标签接口") |
|||
@RestController |
|||
@RequestMapping("/img/sign") |
|||
@Slf4j |
|||
public class SignController extends BaseController { |
|||
|
|||
@Autowired |
|||
private SignService signService; |
|||
|
|||
//@RequiresPermissions("system:config:list")
|
|||
@ApiOperation(value="查询sign分页") |
|||
@PostMapping("/page") |
|||
public TableDataInfo pageSign(@RequestBody @ApiParam("分页对象") SignPageDto dto){ |
|||
PageHelper.startPage(dto.getPageNum(), dto.getPageSize()); |
|||
List<Sign> signs = signService.queryPage(dto); |
|||
return getDataTable(signs); |
|||
} |
|||
|
|||
//@RequiresPermissions("system:config:list")
|
|||
@ApiOperation(value="新增sign") |
|||
@PostMapping(value = "/insert") |
|||
public AjaxResult insertSign(@Validated @RequestBody @ApiParam("sign对象") SignDto dto){ |
|||
log.debug("【图文平台后台】新增sign参数为:{}", JSON.toJSONString(dto)); |
|||
return AjaxResult.success(signService.insert(dto.extractParam())); |
|||
} |
|||
|
|||
//@RequiresPermissions("system:config:list")
|
|||
@ApiOperation(value="修改sign") |
|||
@PostMapping(value = "/update") |
|||
public AjaxResult updateSign(@Validated @RequestBody @ApiParam("sign对象")SignDto dto){ |
|||
log.debug("【图文平台后台】修改sign参数为:{}", JSON.toJSONString(dto)); |
|||
return AjaxResult.success(signService.update(dto.extractParam())); |
|||
} |
|||
|
|||
//@RequiresPermissions("system:config:list")
|
|||
@ApiOperation(value="删除sign") |
|||
@DeleteMapping(value = "/delete/{ids}") |
|||
public AjaxResult deleteSign(@PathVariable @ApiParam("主键ids") List<Long> ids){ |
|||
log.debug("【图文平台后台】删除sign参数为:{}", JSON.toJSONString(ids)); |
|||
return AjaxResult.success(signService.delete(ids)); |
|||
} |
|||
|
|||
//@RequiresPermissions("system:config:list")
|
|||
@ApiOperation(value="查询sign详情") |
|||
@GetMapping(value = "/details/{id}") |
|||
public AjaxResult detailsSign(@PathVariable @ApiParam("主键id") Long id){ |
|||
log.debug("【图文平台后台】查询sign详情参数为:{}", id); |
|||
return AjaxResult.success(signService.queryDetails(id)); |
|||
} |
|||
|
|||
//@RequiresPermissions("system:config:list")
|
|||
@ApiOperation(value="变更type显示状态") |
|||
@PostMapping(value = "/changeStatus") |
|||
public AjaxResult changeStatus(@Validated @RequestBody @ApiParam("type状态对象") StatusDto dto){ |
|||
log.debug("【图文平台后台】变更type参数为:{}", JSON.toJSONString(dto)); |
|||
return AjaxResult.success(signService.changeStatus(dto.getId(),dto.getStatus())); |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,61 @@ |
|||
package com.bnyer.img.domain; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.*; |
|||
|
|||
@ApiModel(value="com-bnyer-img-domain-BzData") |
|||
@Getter |
|||
@Setter |
|||
@ToString |
|||
@AllArgsConstructor |
|||
@NoArgsConstructor |
|||
@TableName(value = "img_bz_data") |
|||
public class BzData { |
|||
/** |
|||
* 主键id |
|||
*/ |
|||
@TableId(value = "id", type = IdType.INPUT) |
|||
@ApiModelProperty(value="主键id") |
|||
private Long id; |
|||
|
|||
/** |
|||
* 日期 |
|||
*/ |
|||
@TableField(value = "date") |
|||
@ApiModelProperty(value="日期 年月日") |
|||
private String date; |
|||
|
|||
/** |
|||
* pv |
|||
*/ |
|||
@TableField(value = "pv") |
|||
@ApiModelProperty(value="pv") |
|||
private Long pv; |
|||
|
|||
/** |
|||
* uv |
|||
*/ |
|||
@TableField(value = "uv") |
|||
@ApiModelProperty(value="uv") |
|||
private Long uv; |
|||
|
|||
/** |
|||
* 平台(0->Hub;1->抖音;2->快手;3->微信) |
|||
*/ |
|||
@TableField(value = "source") |
|||
@ApiModelProperty(value="source") |
|||
private String source; |
|||
|
|||
/** |
|||
* 防止重复唯一标识 |
|||
*/ |
|||
@TableField(value = "mark") |
|||
@ApiModelProperty(value="mark") |
|||
private String mark; |
|||
private static final long serialVersionUID = 1L; |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
package com.bnyer.img.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* @Author qyh |
|||
* @Date 2022/7/13 21:27 |
|||
* @Description |
|||
*/ |
|||
@Getter |
|||
@Setter |
|||
@ApiModel("八字运势接收类") |
|||
public class BzDto { |
|||
@NotBlank(message = "姓不能为空!") |
|||
@ApiModelProperty(value="姓") |
|||
private String lastName; |
|||
|
|||
@NotBlank(message = "名不能为空!") |
|||
@ApiModelProperty(value="名") |
|||
private String firstName; |
|||
|
|||
@NotBlank(message = "性别不能为空!") |
|||
@ApiModelProperty(value="性别") |
|||
private String sex; |
|||
|
|||
@NotBlank(message = "出生年月不能为空!") |
|||
@ApiModelProperty(value="出生年月") |
|||
//19990209060808这样的
|
|||
private String birth; |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
package com.bnyer.img.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("邀请码接收类") |
|||
public class CheckInviteCodeDto implements Serializable { |
|||
|
|||
@NotBlank(message = "邀请码不能为空!") |
|||
@ApiModelProperty(value="邀请码") |
|||
private String inviteCode; |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
package com.bnyer.img.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("手机号接收类") |
|||
public class CheckPhoneDto implements Serializable { |
|||
|
|||
@NotBlank(message = "手机号不能为空!") |
|||
@ApiModelProperty(value="手机号") |
|||
private String phone; |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
package com.bnyer.img.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
|
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("搜索码接收类") |
|||
public class CheckScanCodeDto implements Serializable { |
|||
|
|||
@NotBlank(message = "搜索码不能为空!") |
|||
@ApiModelProperty(value="搜索码") |
|||
private String scanCode; |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
package com.bnyer.img.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("艺术家邀请记录分页接收类") |
|||
public class CreatorInviteLogPageDto extends BasePageDto { |
|||
|
|||
@NotNull(message = "艺术家id不能为空!") |
|||
@ApiModelProperty(value="艺术家id") |
|||
private Long creatorId; |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
package com.bnyer.img.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("艺术家登录入参") |
|||
public class CreatorLoginDto implements Serializable { |
|||
|
|||
@NotBlank(message = "手机号不能为空!") |
|||
@ApiModelProperty(value = "手机号") |
|||
private String phone; |
|||
|
|||
@NotBlank(message = "密码不能为空!") |
|||
@ApiModelProperty(value = "密码") |
|||
private String password; |
|||
} |
|||
@ -0,0 +1,45 @@ |
|||
package com.bnyer.img.dto; |
|||
|
|||
import com.bnyer.common.core.utils.bean.BeanUtils; |
|||
import com.bnyer.img.domain.CreatorProfit; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
|
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("艺术家新增更新邀请收益接收类") |
|||
public class CreatorProfitInviteInsertDto implements Serializable { |
|||
|
|||
@NotNull(message = "艺术家id不能为空!") |
|||
@ApiModelProperty(value="艺术家id") |
|||
private Long creatorId; |
|||
|
|||
@NotBlank(message = "收益人搜索码不能为空!") |
|||
@ApiModelProperty(value="收益人搜索码") |
|||
private String scanCode; |
|||
|
|||
@NotNull(message = "图片id不能为空!") |
|||
@ApiModelProperty(value="图片id") |
|||
private Long imgId; |
|||
|
|||
@NotBlank(message = "结算平台不能为空!") |
|||
@ApiModelProperty(value="结算平台(0->抖音;1->快手;2->微信;3->uniapp)") |
|||
private String platform; |
|||
|
|||
@NotBlank(message = "应用类型不能为空!") |
|||
@ApiModelProperty(value="应用类型(0->节点壁纸)") |
|||
private String appType; |
|||
|
|||
public CreatorProfit extractParam(){ |
|||
CreatorProfit creatorProfit = new CreatorProfit(); |
|||
BeanUtils.copyProperties(this, creatorProfit); |
|||
return creatorProfit; |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
package com.bnyer.img.dto; |
|||
|
|||
import com.bnyer.common.core.annotation.Desensitized; |
|||
import com.bnyer.common.core.enums.SensitiveTypeEnum; |
|||
import com.bnyer.common.core.utils.Sm4Util; |
|||
import com.bnyer.common.core.utils.StringUtils; |
|||
import com.bnyer.img.domain.CreatorAccount; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
|
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("艺术家上传次数接收类") |
|||
public class CreatorUploadDto implements Serializable { |
|||
|
|||
@ApiModelProperty(value="艺术家id") |
|||
@NotNull(message = "艺术家id不能为空!") |
|||
private Long creatorId; |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
package com.bnyer.img.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("艺术家提现记录分页接收类") |
|||
public class CreatorWithdrawPageDto extends BasePageDto { |
|||
|
|||
@NotNull(message = "艺术家id不能为空!") |
|||
@ApiModelProperty(value="艺术家id") |
|||
private Long creatorId; |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
package com.bnyer.img.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("imgSignRelation分页接收类") |
|||
public class ImgSignRelationPageDto extends BasePageDto { |
|||
|
|||
@ApiModelProperty(value="是否显示") |
|||
private String isShow; |
|||
|
|||
@ApiModelProperty(value="图片id") |
|||
private Long imgId; |
|||
|
|||
@ApiModelProperty(value="标签id") |
|||
private Long signId; |
|||
} |
|||
@ -0,0 +1,32 @@ |
|||
package com.bnyer.img.dto; |
|||
|
|||
import com.bnyer.common.core.utils.bean.BeanUtils; |
|||
import com.bnyer.img.domain.Sign; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("sign接收类") |
|||
public class SignDto implements Serializable { |
|||
|
|||
@ApiModelProperty(value="主键id") |
|||
private Long id; |
|||
|
|||
@ApiModelProperty(value="标签名称") |
|||
private String name; |
|||
|
|||
@ApiModelProperty(value="背景图") |
|||
private String img; |
|||
|
|||
public Sign extractParam(){ |
|||
Sign sign = new Sign(); |
|||
BeanUtils.copyProperties(this,sign); |
|||
return sign; |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
package com.bnyer.img.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("标签图片分页根据标签名称接收类") |
|||
public class SignImgNamePageDto extends BasePageDto { |
|||
|
|||
@NotBlank(message = "标签名称不能为空!") |
|||
@ApiModelProperty(value="标签名称") |
|||
private String signName; |
|||
|
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
package com.bnyer.img.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("标签图片分页接收类") |
|||
public class SignImgPageDto extends BasePageDto { |
|||
|
|||
@NotNull(message = "分类id不能为空!") |
|||
@ApiModelProperty(value="分类id") |
|||
private Long typeId; |
|||
|
|||
@NotNull(message = "标签id不能为空!") |
|||
@ApiModelProperty(value="标签id") |
|||
private Long signId; |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
package com.bnyer.img.dto; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("sign分页接收类") |
|||
public class SignPageDto extends BasePageDto { |
|||
|
|||
@ApiModelProperty(value="标签名称") |
|||
private String name; |
|||
|
|||
@ApiModelProperty(value="是否显示") |
|||
private String isShow; |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
package com.bnyer.img.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("标签分类分页接收类") |
|||
public class SignTypePageDto extends BasePageDto { |
|||
|
|||
@NotNull(message = "分类id不能为空!") |
|||
@ApiModelProperty(value="分类id") |
|||
private Long typeId; |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
package com.bnyer.img.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
|
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("检查用户下载次数接收类") |
|||
public class checkUserCanDownloadDto implements Serializable { |
|||
|
|||
@ApiModelProperty(value="用户id") |
|||
private Long userId; |
|||
|
|||
@NotNull(message = "平台不能为空!") |
|||
@ApiModelProperty(value="平台") |
|||
private String platform; |
|||
|
|||
@NotNull(message = "应用不能为空!") |
|||
@ApiModelProperty(value="应用") |
|||
private String appType; |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
package com.bnyer.img.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.bnyer.img.domain.Banner; |
|||
import com.bnyer.img.domain.BzData; |
|||
import com.bnyer.img.vo.BannerVo; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Mapper |
|||
public interface BzDataMapper extends BaseMapper<BzData> { |
|||
|
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
package com.bnyer.img.service; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|||
import com.bnyer.img.domain.Banner; |
|||
import com.bnyer.img.domain.BzData; |
|||
import com.bnyer.img.dto.BannerPageDto; |
|||
import com.bnyer.img.dto.BzDto; |
|||
import com.bnyer.img.vo.BannerVo; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import java.util.List; |
|||
|
|||
public interface BzDataService { |
|||
JSONObject getYs(BzDto dto); |
|||
|
|||
void dataStatistics(String ip,String source); |
|||
|
|||
int update(BzData bzData,UpdateWrapper<BzData> updateWrapper); |
|||
|
|||
String getIpAddr(HttpServletRequest request); |
|||
} |
|||
@ -1,4 +1,73 @@ |
|||
package com.bnyer.img.service; |
|||
|
|||
import com.bnyer.img.domain.Sign; |
|||
import com.bnyer.img.dto.SignPageDto; |
|||
import com.bnyer.img.vo.SignImgVo; |
|||
import com.bnyer.img.vo.SignVo; |
|||
import com.bnyer.img.vo.TiktokImgVo; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface SignService { |
|||
/** |
|||
* 后台新增Sign |
|||
* @param sign 标签 |
|||
* @return - |
|||
*/ |
|||
int insert(Sign sign); |
|||
|
|||
/** |
|||
* 修改sign |
|||
* @param sign - |
|||
* @return - |
|||
*/ |
|||
int update(Sign sign); |
|||
|
|||
/** |
|||
* 批量删除sign |
|||
* @param ids ids |
|||
* @return - |
|||
*/ |
|||
int delete(List<Long> ids); |
|||
|
|||
/** |
|||
* 查询sign分页 |
|||
* @param dto 分页对象 |
|||
* @return - |
|||
*/ |
|||
List<Sign> queryPage(SignPageDto dto); |
|||
|
|||
/** |
|||
* 查询sign详情 |
|||
* @param id 主键id |
|||
* @return - |
|||
*/ |
|||
Sign queryDetails(Long id); |
|||
|
|||
/** |
|||
* 查询sign是否重复 |
|||
* @param name 标签名字 |
|||
* @return - |
|||
*/ |
|||
boolean checkSign(String name); |
|||
|
|||
/** |
|||
* 变更显示状态 |
|||
* @param id 主键id |
|||
* @param status 状态 |
|||
* @return - |
|||
*/ |
|||
int changeStatus(Long id,String status); |
|||
|
|||
/** |
|||
* 查询上传页面标签列表 |
|||
* @return - |
|||
*/ |
|||
List<SignVo> querySignList(); |
|||
|
|||
/** |
|||
* 根据分类id查询小程序端标签分页 |
|||
* @return - |
|||
*/ |
|||
List<SignImgVo> queryFrontSignByTypeId(Long typeId); |
|||
} |
|||
|
|||
@ -0,0 +1,166 @@ |
|||
package com.bnyer.img.service.impl; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|||
import com.bnyer.common.core.domain.R; |
|||
import com.bnyer.common.core.utils.StringUtils; |
|||
import com.bnyer.common.redis.service.RedisService; |
|||
import com.bnyer.img.config.BzConfig; |
|||
import com.bnyer.img.domain.Banner; |
|||
import com.bnyer.img.domain.BzData; |
|||
import com.bnyer.img.dto.BannerPageDto; |
|||
import com.bnyer.img.dto.BzDto; |
|||
import com.bnyer.img.mapper.BannerMapper; |
|||
import com.bnyer.img.mapper.BzDataMapper; |
|||
import com.bnyer.img.service.BannerService; |
|||
import com.bnyer.img.service.BzDataService; |
|||
import com.bnyer.img.vo.BannerVo; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.http.HttpEntity; |
|||
import org.apache.http.HttpResponse; |
|||
import org.apache.http.client.methods.HttpGet; |
|||
import org.apache.http.impl.client.CloseableHttpClient; |
|||
import org.apache.http.impl.client.HttpClients; |
|||
import org.apache.http.util.EntityUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
import java.io.IOException; |
|||
import java.net.URLEncoder; |
|||
import java.time.LocalDate; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
@Service |
|||
@Slf4j |
|||
public class BzDataServiceImpl implements BzDataService { |
|||
|
|||
@Autowired |
|||
private RedisService redisService; |
|||
@Autowired |
|||
private BzDataMapper bzDataMapper; |
|||
@Autowired |
|||
private BzConfig bzConfig; |
|||
|
|||
@Override |
|||
public JSONObject getYs(BzDto dto) { |
|||
//API产品路径
|
|||
String requestUrl = bzConfig.getUrl(); |
|||
//阿里云APPCODE
|
|||
String appcode = bzConfig.getAppCode(); |
|||
String lastName = dto.getLastName(); |
|||
String firstName = dto.getFirstName(); |
|||
String sex = dto.getSex(); |
|||
String birth = dto.getBirth(); |
|||
CloseableHttpClient httpClient = null; |
|||
try { |
|||
httpClient = HttpClients.createDefault(); |
|||
String str = "SECOND_NAME=" + URLEncoder.encode(firstName, "UTF-8") + "&GENDER=" + URLEncoder.encode(sex, "UTF-8") + "&BIRTH=" + URLEncoder.encode(birth, "UTF-8") + "&FIRST_NAME=" + URLEncoder.encode(lastName, "UTF-8"); |
|||
System.out.println(requestUrl + str); |
|||
// 创建一个HttpGet实例
|
|||
HttpGet httpGet = new HttpGet(requestUrl + str); |
|||
httpGet.addHeader("Authorization", "APPCODE " + appcode); |
|||
|
|||
// 发送GET请求
|
|||
HttpResponse execute = httpClient.execute(httpGet); |
|||
|
|||
// 获取状态码
|
|||
int statusCode = execute.getStatusLine().getStatusCode(); |
|||
System.out.println(statusCode); |
|||
|
|||
// 获取结果
|
|||
HttpEntity entity = execute.getEntity(); |
|||
String result = EntityUtils.toString(entity, "utf-8"); |
|||
//System.out.println(result);
|
|||
return JSON.parseObject(result); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
} finally { |
|||
if (httpClient != null) { |
|||
try { |
|||
httpClient.close(); |
|||
} catch (IOException e) { |
|||
e.printStackTrace(); |
|||
} |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public void dataStatistics(String ip, String source) { |
|||
String today = LocalDate.now() + ""; |
|||
String page="bzPage_" + source; |
|||
//保存今天的key
|
|||
redisService.redisTemplate.opsForZSet().add("bzPage_key" +today, today+page, 1.0); |
|||
//pv统计
|
|||
redisService.pvStatistics(today, page); |
|||
//uv统计
|
|||
redisService.uvStatistics(today, page, ip); |
|||
//查看是否已经有了这条数据
|
|||
if (!redisService.hasKey(today + source)) { |
|||
QueryWrapper<BzData> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq("date", today); |
|||
wrapper.eq("source", source); |
|||
List<BzData> bzData = bzDataMapper.selectList(wrapper); |
|||
if (bzData.size() <= 0) { |
|||
BzData data = new BzData(); |
|||
data.setDate(today); |
|||
data.setPv(1L); |
|||
data.setUv(1L); |
|||
data.setSource(source); |
|||
data.setMark(today + source); |
|||
bzDataMapper.insert(data); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public int update(BzData bzData, UpdateWrapper<BzData> updateWrapper) { |
|||
return bzDataMapper.update(bzData,updateWrapper); |
|||
} |
|||
|
|||
@Override |
|||
public String getIpAddr(HttpServletRequest request) { |
|||
String ip = request.getHeader("x-forwarded-for"); |
|||
//System.out.println("x-forwarded-for ip: " + ip);
|
|||
if (ip != null && ip.length() != 0 && !"unknown".equalsIgnoreCase(ip)) { |
|||
// 多次反向代理后会有多个ip值,第一个ip才是真实ip
|
|||
if (ip.indexOf(",") != -1) { |
|||
ip = ip.split(",")[0]; |
|||
} |
|||
} |
|||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
|||
ip = request.getHeader("Proxy-Client-IP"); |
|||
//System.out.println("Proxy-Client-IP ip: " + ip);
|
|||
} |
|||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
|||
ip = request.getHeader("WL-Proxy-Client-IP"); |
|||
//System.out.println("WL-Proxy-Client-IP ip: " + ip);
|
|||
} |
|||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
|||
ip = request.getHeader("HTTP_CLIENT_IP"); |
|||
//System.out.println("HTTP_CLIENT_IP ip: " + ip);
|
|||
} |
|||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
|||
ip = request.getHeader("HTTP_X_FORWARDED_FOR"); |
|||
//System.out.println("HTTP_X_FORWARDED_FOR ip: " + ip);
|
|||
} |
|||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
|||
ip = request.getHeader("X-Real-IP"); |
|||
//System.out.println("X-Real-IP ip: " + ip);
|
|||
} |
|||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
|||
ip = request.getRemoteAddr(); |
|||
//System.out.println("getRemoteAddr ip: " + ip);
|
|||
} |
|||
//System.out.println("获取客户端ip: " + ip);
|
|||
return ip; |
|||
} |
|||
} |
|||
@ -1,10 +1,114 @@ |
|||
package com.bnyer.img.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|||
import com.bnyer.common.core.exception.ServiceException; |
|||
import com.bnyer.common.core.utils.StringUtils; |
|||
import com.bnyer.img.domain.ImgSignRelation; |
|||
import com.bnyer.img.domain.Sign; |
|||
import com.bnyer.img.dto.SignPageDto; |
|||
import com.bnyer.img.mapper.ImgSignRelationMapper; |
|||
import com.bnyer.img.mapper.SignMapper; |
|||
import com.bnyer.img.service.SignService; |
|||
import com.bnyer.img.vo.SignImgVo; |
|||
import com.bnyer.img.vo.SignVo; |
|||
import com.bnyer.img.vo.TiktokImgVo; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
@Service |
|||
@Slf4j |
|||
public class SignServiceImpl implements SignService { |
|||
@Autowired |
|||
private SignMapper signMapper; |
|||
|
|||
@Autowired |
|||
private ImgSignRelationMapper imgSignRelationMapper; |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public int insert(Sign sign) { |
|||
boolean b = checkSign(sign.getName()); |
|||
if(b){ |
|||
throw new ServiceException("标签名称已存在!"); |
|||
}else{ |
|||
sign.setCreateTime(new Date()); |
|||
sign.setUpdateTime(new Date()); |
|||
return signMapper.insert(sign); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public int update(Sign sign) { |
|||
sign.setUpdateTime(new Date()); |
|||
return signMapper.updateById(sign); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public int delete(List<Long> ids) { |
|||
int i = signMapper.deleteBatchIds(ids); |
|||
//删除关联relation
|
|||
LambdaQueryWrapper<ImgSignRelation> wrapper = new LambdaQueryWrapper<>(); |
|||
wrapper.in(ImgSignRelation::getSignId, ids); |
|||
imgSignRelationMapper.delete(wrapper); |
|||
//imgSignRelationMapper.batchDelete(ids);
|
|||
return i; |
|||
} |
|||
|
|||
@Override |
|||
public List<Sign> queryPage(SignPageDto dto) { |
|||
LambdaQueryWrapper<Sign> wrapper = new LambdaQueryWrapper<>(); |
|||
if (StringUtils.isNotBlank(dto.getName())){ |
|||
wrapper.like(Sign::getName,dto.getName()); |
|||
} |
|||
if (StringUtils.isNotBlank(dto.getIsShow())){ |
|||
wrapper.eq(Sign::getIsShow,dto.getIsShow()); |
|||
} |
|||
wrapper.orderByDesc(Sign::getSort); |
|||
return signMapper.selectList(wrapper); |
|||
} |
|||
|
|||
@Override |
|||
public Sign queryDetails(Long id) { |
|||
return signMapper.selectById(id); |
|||
} |
|||
|
|||
@Override |
|||
public boolean checkSign(String name) { |
|||
LambdaQueryWrapper<Sign> wrapper = new LambdaQueryWrapper<>(); |
|||
wrapper.eq(Sign::getName,name); |
|||
List<Sign> signs = signMapper.selectList(wrapper); |
|||
if(signs.size() > 0){ |
|||
return true; |
|||
}else{ |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public int changeStatus(Long id, String status) { |
|||
LambdaUpdateWrapper<Sign> wrapper = new LambdaUpdateWrapper<>(); |
|||
wrapper.eq(Sign::getId,id); |
|||
Sign sign = new Sign(); |
|||
sign.setIsShow(status); |
|||
return signMapper.update(sign,wrapper); |
|||
} |
|||
|
|||
@Override |
|||
public List<SignVo> querySignList() { |
|||
return signMapper.querySignList(); |
|||
} |
|||
|
|||
@Override |
|||
public List<SignImgVo> queryFrontSignByTypeId(Long typeId) { |
|||
return signMapper.queryFrontSign(typeId); |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,60 @@ |
|||
package com.bnyer.img.task; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|||
import com.bnyer.common.redis.service.RedisService; |
|||
import com.bnyer.img.domain.BzData; |
|||
import com.bnyer.img.service.BzDataService; |
|||
import com.xxl.job.core.biz.model.ReturnT; |
|||
import com.xxl.job.core.handler.annotation.XxlJob; |
|||
import com.xxl.job.core.log.XxlJobLogger; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.scheduling.annotation.Scheduled; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.util.Set; |
|||
|
|||
/** |
|||
* @Author qyh |
|||
* @Date 2022/7/14 16:43 |
|||
* @Description |
|||
*/ |
|||
@Component |
|||
@Slf4j |
|||
public class DateSyncTask { |
|||
@Autowired |
|||
private static RedisService redisService; |
|||
@Autowired |
|||
private static BzDataService bzDataService; |
|||
//@XxlJob("dateSyncTask")
|
|||
//@Scheduled(fixedDelay = 1000 * 60 * 60)
|
|||
public static ReturnT<String> dateSync() { |
|||
String day = LocalDate.now().plusDays(-1)+ ""; |
|||
String redisKey = "bzPage_key" + day; |
|||
System.out.println(redisService); |
|||
redisService.setCacheObject("4", 2); |
|||
Set range = redisService.redisTemplate.opsForZSet().range(redisKey, 0, -1); |
|||
for (Object key : redisService.redisTemplate.opsForZSet().range(redisKey, 0, -1)) { |
|||
Long pv = Long.parseLong(redisService.redisTemplate.opsForValue().get(key + "PV").toString()); |
|||
Long uv = Long.parseLong(redisService.redisTemplate.opsForHyperLogLog().size(key + "UV").toString()); |
|||
String[] s = key.toString().split("_"); |
|||
String source = s[1]; |
|||
redisService.deleteObject(key + "PV"); |
|||
redisService.deleteObject(key + "UV"); |
|||
UpdateWrapper<BzData> wrapper = new UpdateWrapper<>(); |
|||
wrapper.set("pv",pv); |
|||
wrapper.set("uv",uv); |
|||
wrapper.eq("date",day); |
|||
wrapper.eq("source",source); |
|||
bzDataService.update(new BzData(),wrapper); |
|||
// redisService.deleteObject(key + "PV");
|
|||
// redisService.deleteObject(key + "UV");
|
|||
} |
|||
redisService.deleteObject("bzPage_key" + day); |
|||
XxlJobLogger.log("{} 我执行了同步pv,uv任务", System.currentTimeMillis()); |
|||
return ReturnT.SUCCESS; |
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
package com.bnyer.img.task; |
|||
|
|||
import com.bnyer.img.service.CreatorProfitService; |
|||
import com.xxl.job.core.biz.model.ReturnT; |
|||
import com.xxl.job.core.handler.annotation.XxlJob; |
|||
import com.xxl.job.core.log.XxlJobLogger; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 同步删除昨日用户下载次数任务 |
|||
* @author chengkun |
|||
* @date 2022/5/12 18:13 |
|||
*/ |
|||
@Component |
|||
@Slf4j |
|||
public class UserDownloadSyncTask { |
|||
|
|||
@Autowired |
|||
private CreatorProfitService creatorProfitService; |
|||
|
|||
@XxlJob("userDownloadSyncTask") |
|||
public ReturnT<String> syncUserDownload(String param) throws Exception { |
|||
creatorProfitService.batchDeleteUserDownloadNum(); |
|||
XxlJobLogger.log("{} 我执行了批量删除昨日用户下载次数任务", System.currentTimeMillis()); |
|||
return ReturnT.SUCCESS; |
|||
} |
|||
|
|||
@XxlJob("creatorDownloadSyncTask") |
|||
public ReturnT<String> syncCreatorUpload(String param) throws Exception { |
|||
creatorProfitService.batchDeleteCreatorUploadNum(); |
|||
XxlJobLogger.log("{} 我执行了批量删除昨日用户上传次数任务", System.currentTimeMillis()); |
|||
return ReturnT.SUCCESS; |
|||
} |
|||
} |
|||
@ -0,0 +1,71 @@ |
|||
package com.bnyer.img.vo; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.util.Date; |
|||
|
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("艺术家登录响应类") |
|||
public class CreatorLoginVo implements Serializable { |
|||
|
|||
@ApiModelProperty(value="主键id") |
|||
private Long id; |
|||
|
|||
@ApiModelProperty(value="昵称") |
|||
private String name; |
|||
|
|||
@ApiModelProperty(value="搜索码") |
|||
private String scanCode; |
|||
|
|||
@ApiModelProperty(value="手机号") |
|||
private String phone; |
|||
|
|||
@ApiModelProperty(value="头像img地址") |
|||
private String img; |
|||
|
|||
@ApiModelProperty(value="简介") |
|||
private String intro; |
|||
|
|||
@ApiModelProperty(value="余额") |
|||
private BigDecimal amt; |
|||
|
|||
@ApiModelProperty(value="邀请码") |
|||
private String inviteCode; |
|||
|
|||
@ApiModelProperty(value="状态(0->待审核;1->审核通过;2->审核拒绝)") |
|||
private String status; |
|||
|
|||
@ApiModelProperty(value="第三方平台账号详情地址") |
|||
private String url; |
|||
|
|||
@ApiModelProperty(value="是否活跃(0->不活跃;1->活跃 连续10天以上更新内容)") |
|||
private String isHot; |
|||
|
|||
@ApiModelProperty(value="是否显示 (0->隐藏;1->显示)") |
|||
private String isShow; |
|||
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@ApiModelProperty(value="创建时间") |
|||
private Date createTime; |
|||
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@ApiModelProperty(value="更新时间") |
|||
private Date updateTime; |
|||
|
|||
@ApiModelProperty(value="排序") |
|||
private Integer sort; |
|||
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@ApiModelProperty(value="最后登录时间") |
|||
private Date lastLoginTime; |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
package com.bnyer.img.vo; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("艺术家分类图片数量响应体") |
|||
public class CreatorTypeImgVo implements Serializable { |
|||
|
|||
@ApiModelProperty(value="头像数量") |
|||
private Integer headNum; |
|||
|
|||
@ApiModelProperty(value="gif动图数量") |
|||
private Integer gifNum; |
|||
|
|||
@ApiModelProperty(value="手机壁纸数量") |
|||
private Integer backNum; |
|||
|
|||
@ApiModelProperty(value="朋友圈背景数量") |
|||
private Integer friendNum; |
|||
|
|||
@ApiModelProperty(value="表情包数量") |
|||
private Integer emoNum; |
|||
|
|||
@ApiModelProperty(value="iwatch数量") |
|||
private Integer watchNum; |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
} |
|||
@ -0,0 +1,48 @@ |
|||
package com.bnyer.img.vo; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("图片标签响应类") |
|||
public class ImgSignVo implements Serializable { |
|||
|
|||
@ApiModelProperty(value="id") |
|||
private Long id; |
|||
|
|||
@ApiModelProperty(value="图片地址") |
|||
private String imgUrl; |
|||
|
|||
@ApiModelProperty(value="用户id") |
|||
private Long creatorId; |
|||
|
|||
@ApiModelProperty(value="分类id") |
|||
private Long typeId; |
|||
|
|||
@ApiModelProperty(value="下载量") |
|||
private Integer downloadNum; |
|||
|
|||
@ApiModelProperty(value="点赞量") |
|||
private Integer greatNum; |
|||
|
|||
@ApiModelProperty(value="收藏量") |
|||
private Integer collectionNum; |
|||
|
|||
@ApiModelProperty(value="状态(0->待审核;1->审核通过;2->审核拒绝;3->已上架;4->已下架))") |
|||
private String status; |
|||
|
|||
@ApiModelProperty(value="是否热门(0->冷门;1->热门)") |
|||
private String isHot; |
|||
|
|||
@ApiModelProperty(value="标签列表") |
|||
private List<SignRelationVo> signList; |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
} |
|||
@ -0,0 +1,28 @@ |
|||
package com.bnyer.img.vo; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("sign图片响应体") |
|||
public class SignImgVo implements Serializable { |
|||
@ApiModelProperty(value="标签id") |
|||
private Long signId; |
|||
|
|||
@ApiModelProperty(value="标签名称") |
|||
private String signName; |
|||
|
|||
@ApiModelProperty(value="背景图") |
|||
private String img; |
|||
|
|||
@ApiModelProperty(value="分类id") |
|||
private Long typeId; |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
package com.bnyer.img.vo; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("标签关系响应体") |
|||
public class SignRelationVo implements Serializable { |
|||
@ApiModelProperty(value="标签id") |
|||
private Long signId; |
|||
|
|||
@ApiModelProperty(value="标签名称") |
|||
private String signName; |
|||
|
|||
@ApiModelProperty(value="标签图片主键id") |
|||
private Long signImgRelationId; |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue