Commit f868a2b5 authored by 33's avatar 33

优化代码,修复隐藏BUG

parent 03010f71
...@@ -11,11 +11,12 @@ import com.github.pagehelper.PageHelper; ...@@ -11,11 +11,12 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
...@@ -27,13 +28,10 @@ import java.util.List; ...@@ -27,13 +28,10 @@ import java.util.List;
@RestController @RestController
@RequestMapping("/banner") @RequestMapping("/banner")
@Api(tags = "banner页管理") @Api(tags = "banner页管理")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class BannerController { public class BannerController {
private final BannerService bannerService;
@Resource private final ObsUtil obsUtil;
private BannerService bannerService;
@Resource
private ObsUtil obsUtil;
@PostMapping("/create") @PostMapping("/create")
@ApiOperation("新建banner") @ApiOperation("新建banner")
......
...@@ -6,11 +6,12 @@ import com.fzm.common.model.ResponseModel; ...@@ -6,11 +6,12 @@ import com.fzm.common.model.ResponseModel;
import com.fzm.common.service.CategoryService; import com.fzm.common.service.CategoryService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
...@@ -21,10 +22,9 @@ import java.util.List; ...@@ -21,10 +22,9 @@ import java.util.List;
@RestController @RestController
@RequestMapping(value = "/category") @RequestMapping(value = "/category")
@Api(tags = "类目管理") @Api(tags = "类目管理")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CategoryController { public class CategoryController {
private final CategoryService categoryService;
@Resource
private CategoryService categoryService;
@GetMapping("/list") @GetMapping("/list")
@ApiOperation(value = "查询所有类目信息") @ApiOperation(value = "查询所有类目信息")
......
...@@ -7,10 +7,10 @@ import com.fzm.common.service.ChargeService; ...@@ -7,10 +7,10 @@ import com.fzm.common.service.ChargeService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/** /**
* @author tangtuo * @author tangtuo
* @date 2022/1/25 10:13 * @date 2022/1/25 10:13
...@@ -19,10 +19,10 @@ import javax.annotation.Resource; ...@@ -19,10 +19,10 @@ import javax.annotation.Resource;
@RestController @RestController
@RequestMapping(value = "/charge") @RequestMapping(value = "/charge")
@Api(tags = "收费管理") @Api(tags = "收费管理")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class ChargeController { public class ChargeController {
@Resource private final ChargeService chargeService;
private ChargeService chargeService;
@PostMapping("/update") @PostMapping("/update")
@ApiOperation("编辑") @ApiOperation("编辑")
......
...@@ -9,9 +9,10 @@ import com.github.pagehelper.PageInfo; ...@@ -9,9 +9,10 @@ import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
...@@ -23,11 +24,9 @@ import java.util.concurrent.ExecutionException; ...@@ -23,11 +24,9 @@ import java.util.concurrent.ExecutionException;
@RestController @RestController
@RequestMapping(value = "/copyright/apply") @RequestMapping(value = "/copyright/apply")
@Api(tags = "版权审核") @Api(tags = "版权审核")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CopyrightApplyController { public class CopyrightApplyController {
private final CopyrightApplyService copyrightApplyService;
@Resource
private CopyrightApplyService copyrightApplyService;
@GetMapping(value = "/pages") @GetMapping(value = "/pages")
@ApiOperation(value = "分页查询") @ApiOperation(value = "分页查询")
......
...@@ -8,13 +8,13 @@ import com.github.pagehelper.PageInfo; ...@@ -8,13 +8,13 @@ import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/** /**
* @author tangtuo * @author tangtuo
* @date 2022/1/11 17:19 * @date 2022/1/11 17:19
...@@ -23,12 +23,9 @@ import javax.annotation.Resource; ...@@ -23,12 +23,9 @@ import javax.annotation.Resource;
@RestController @RestController
@RequestMapping("/entrust/shelf") @RequestMapping("/entrust/shelf")
@Api(tags = "委托上架") @Api(tags = "委托上架")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class EntrustShelfController { public class EntrustShelfController {
private final EntrustShelfService entrustShelfService;
@Resource
private EntrustShelfService entrustShelfService;
@GetMapping("/page") @GetMapping("/page")
@ApiOperation(value = "分页查询") @ApiOperation(value = "分页查询")
......
...@@ -12,10 +12,11 @@ import com.github.pagehelper.PageInfo; ...@@ -12,10 +12,11 @@ import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
...@@ -27,13 +28,10 @@ import java.util.List; ...@@ -27,13 +28,10 @@ import java.util.List;
@RestController @RestController
@RequestMapping("/nft") @RequestMapping("/nft")
@Api(tags = "剧本nft管理") @Api(tags = "剧本nft管理")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class NftController { public class NftController {
private final NftService nftService;
@Resource private final NftTransferRecordService nftTransferRecordService;
private NftService nftService;
@Resource
private NftTransferRecordService nftTransferRecordService;
@GetMapping("/list") @GetMapping("/list")
@ApiOperation(value = "查询nft列表") @ApiOperation(value = "查询nft列表")
......
...@@ -8,13 +8,13 @@ import com.github.pagehelper.PageInfo; ...@@ -8,13 +8,13 @@ import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/** /**
* @author tangtuo * @author tangtuo
* @date 2022/2/8 16:11 * @date 2022/2/8 16:11
...@@ -23,10 +23,9 @@ import javax.annotation.Resource; ...@@ -23,10 +23,9 @@ import javax.annotation.Resource;
@RestController @RestController
@RequestMapping("/payment") @RequestMapping("/payment")
@Api(tags = "支付流水管理") @Api(tags = "支付流水管理")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class PaymentController { public class PaymentController {
private final PaymentService paymentService;
@Resource
private PaymentService paymentService;
@GetMapping("/pages") @GetMapping("/pages")
@ApiOperation(value = "分页查询") @ApiOperation(value = "分页查询")
......
...@@ -8,12 +8,13 @@ import com.github.pagehelper.PageInfo; ...@@ -8,12 +8,13 @@ import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
/** /**
...@@ -24,10 +25,9 @@ import java.io.IOException; ...@@ -24,10 +25,9 @@ import java.io.IOException;
@RestController @RestController
@RequestMapping("/refund") @RequestMapping("/refund")
@Api(tags = "退款管理") @Api(tags = "退款管理")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class RefundController { public class RefundController {
private final RefundService refundService;
@Resource
private RefundService refundService;
@GetMapping("/pages") @GetMapping("/pages")
@ApiOperation(value = "退款分页列表") @ApiOperation(value = "退款分页列表")
......
...@@ -11,12 +11,13 @@ import com.github.pagehelper.PageInfo; ...@@ -11,12 +11,13 @@ import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
...@@ -27,10 +28,9 @@ import java.util.List; ...@@ -27,10 +28,9 @@ import java.util.List;
@RestController @RestController
@RequestMapping("/admin") @RequestMapping("/admin")
@Api(tags = "用户管理") @Api(tags = "用户管理")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class UserController { public class UserController {
private final UserService userService;
@Resource
private UserService userService;
@GetMapping("statistic") @GetMapping("statistic")
@ApiOperation(value = "用户概览", notes = "获取已注册用户、已实名用户等统计信息") @ApiOperation(value = "用户概览", notes = "获取已注册用户、已实名用户等统计信息")
......
...@@ -6,13 +6,14 @@ import com.fzm.common.entity.CopyrightApply; ...@@ -6,13 +6,14 @@ import com.fzm.common.entity.CopyrightApply;
import com.fzm.common.entity.dto.EvidenceHashMessage; import com.fzm.common.entity.dto.EvidenceHashMessage;
import com.fzm.common.service.CopyrightApplyService; import com.fzm.common.service.CopyrightApplyService;
import com.rabbitmq.client.Channel; import com.rabbitmq.client.Channel;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.amqp.core.Message; import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
/** /**
...@@ -21,13 +22,10 @@ import java.io.IOException; ...@@ -21,13 +22,10 @@ import java.io.IOException;
*/ */
@Slf4j @Slf4j
@Component @Component
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class EvidenceHashLister { public class EvidenceHashLister {
private final CopyrightApplyService copyrightApplyService;
@Resource private final ParaChainClient paraChainClient;
private CopyrightApplyService copyrightApplyService;
@Resource
private ParaChainClient paraChainClient;
/** /**
* 更新存证hash * 更新存证hash
......
...@@ -17,10 +17,6 @@ public class RabbitMQConfig { ...@@ -17,10 +17,6 @@ public class RabbitMQConfig {
public static final String DEAD_LETTER_DIRECT = "dl.direct"; public static final String DEAD_LETTER_DIRECT = "dl.direct";
public static final String COPYRIGHT_QUEUE = "copyright.queue";
public static final String DEAD_LETTER_QUEUE = "dl.queue";
public static final String EVIDENCE_HASH_QUEUE = "evidence.hash.queue"; public static final String EVIDENCE_HASH_QUEUE = "evidence.hash.queue";
......
package com.fzm.common.config; package com.fzm.common.config;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.cache.CacheProperties; import org.springframework.boot.autoconfigure.cache.CacheProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
...@@ -12,10 +13,9 @@ import org.springframework.data.redis.serializer.StringRedisSerializer; ...@@ -12,10 +13,9 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
@Configuration @Configuration
@EnableConfigurationProperties(value = CacheProperties.class) @EnableConfigurationProperties(value = CacheProperties.class)
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class RedisCacheConfig { public class RedisCacheConfig {
private final CacheProperties cacheProperties;
@Autowired
private CacheProperties cacheProperties;
@Bean @Bean
public RedisCacheConfiguration redisCacheConfiguration() { public RedisCacheConfiguration redisCacheConfiguration() {
......
package com.fzm.common.config; package com.fzm.common.config;
import lombok.RequiredArgsConstructor;
import org.redisson.Redisson; import org.redisson.Redisson;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
import org.redisson.config.Config; import org.redisson.config.Config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.data.redis.RedisProperties; import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import javax.annotation.Resource;
/** /**
* @author tangtuo * @author tangtuo
* @date 2021/7/19 10:25 * @date 2021/7/19 10:25
...@@ -17,10 +17,9 @@ import javax.annotation.Resource; ...@@ -17,10 +17,9 @@ import javax.annotation.Resource;
* </p> * </p>
*/ */
@Configuration @Configuration
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class RedissonConfig { public class RedissonConfig {
private final RedisProperties redisProperties;
@Resource
RedisProperties redisProperties;
@Bean @Bean
public RedissonClient redisson() { public RedissonClient redisson() {
...@@ -28,7 +27,6 @@ public class RedissonConfig { ...@@ -28,7 +27,6 @@ public class RedissonConfig {
config.useSingleServer(). config.useSingleServer().
setAddress(String.format("redis://%s:%s", redisProperties.getHost(), redisProperties.getPort())). setAddress(String.format("redis://%s:%s", redisProperties.getHost(), redisProperties.getPort())).
setPassword(redisProperties.getPassword()); setPassword(redisProperties.getPassword());
RedissonClient redisson = Redisson.create(config); return Redisson.create(config);
return redisson;
} }
} }
...@@ -12,12 +12,13 @@ import com.wechat.pay.contrib.apache.httpclient.cert.CertificatesManager; ...@@ -12,12 +12,13 @@ import com.wechat.pay.contrib.apache.httpclient.cert.CertificatesManager;
import com.wechat.pay.contrib.apache.httpclient.exception.HttpCodeException; import com.wechat.pay.contrib.apache.httpclient.exception.HttpCodeException;
import com.wechat.pay.contrib.apache.httpclient.exception.NotFoundException; import com.wechat.pay.contrib.apache.httpclient.exception.NotFoundException;
import com.wechat.pay.contrib.apache.httpclient.util.PemUtil; import com.wechat.pay.contrib.apache.httpclient.util.PemUtil;
import lombok.RequiredArgsConstructor;
import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.CloseableHttpClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.security.GeneralSecurityException; import java.security.GeneralSecurityException;
...@@ -28,11 +29,9 @@ import java.security.PrivateKey; ...@@ -28,11 +29,9 @@ import java.security.PrivateKey;
* @date 2022/1/12 16:30 * @date 2022/1/12 16:30
*/ */
@Configuration @Configuration
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class WxPayConfig { public class WxPayConfig {
private final WxPayProperties wxPayProperties;
@Resource
private WxPayProperties wxPayProperties;
@Bean @Bean
public PrivateKey wxPrivateKey() { public PrivateKey wxPrivateKey() {
......
...@@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; ...@@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fzm.common.constant.TokenConstant; import com.fzm.common.constant.TokenConstant;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.util.Date; import java.util.Date;
...@@ -13,6 +14,7 @@ import java.util.Date; ...@@ -13,6 +14,7 @@ import java.util.Date;
* @author tangtuo * @author tangtuo
* @date 2021/7/5 15:02 * @date 2021/7/5 15:02
*/ */
@EqualsAndHashCode(callSuper = true)
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@TableName("tb_admin") @TableName("tb_admin")
......
...@@ -3,12 +3,14 @@ package com.fzm.common.entity; ...@@ -3,12 +3,14 @@ package com.fzm.common.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
/** /**
* @author tangtuo * @author tangtuo
* @date 2021/7/1 14:32 * @date 2021/7/1 14:32
*/ */
@EqualsAndHashCode(callSuper = true)
@Data @Data
@TableName("tb_category") @TableName("tb_category")
@Accessors(chain = true) @Accessors(chain = true)
......
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableName; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
...@@ -15,6 +16,7 @@ import java.util.Date; ...@@ -15,6 +16,7 @@ import java.util.Date;
* @author tangtuo * @author tangtuo
* @date 2021/6/30 15:42 * @date 2021/6/30 15:42
*/ */
@EqualsAndHashCode(callSuper = true)
@Data @Data
@ApiModel("nft信息") @ApiModel("nft信息")
@Accessors(chain = true) @Accessors(chain = true)
......
...@@ -6,6 +6,7 @@ import com.fzm.common.constant.TokenConstant; ...@@ -6,6 +6,7 @@ import com.fzm.common.constant.TokenConstant;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
...@@ -15,6 +16,7 @@ import java.util.Date; ...@@ -15,6 +16,7 @@ import java.util.Date;
* @author tangtuo * @author tangtuo
* @date 2021/6/23 11:54 * @date 2021/6/23 11:54
*/ */
@EqualsAndHashCode(callSuper = true)
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@ApiModel("用户信息") @ApiModel("用户信息")
......
/**
* Copyright 2021 bejson.com
*/
package com.fzm.common.entity.dto; package com.fzm.common.entity.dto;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
...@@ -102,7 +99,6 @@ public class CopyrightRequest { ...@@ -102,7 +99,6 @@ public class CopyrightRequest {
@ApiModelProperty(value = "著作权人列表") @ApiModelProperty(value = "著作权人列表")
private List<Owner> owner_list = new ArrayList<>(); private List<Owner> owner_list = new ArrayList<>();
;
@ApiModelProperty(value = "发表地点") @ApiModelProperty(value = "发表地点")
private String publish_address; private String publish_address;
......
...@@ -15,7 +15,7 @@ public enum AuthStatus { ...@@ -15,7 +15,7 @@ public enum AuthStatus {
SUCCESS(1, "认证成功"), SUCCESS(1, "认证成功"),
FAIL(2, "认证失败"), FAIL(2, "认证失败"),
; ;
private Integer status; private final Integer status;
private String desc; private final String desc;
} }
...@@ -11,9 +11,9 @@ public enum AuthType { ...@@ -11,9 +11,9 @@ public enum AuthType {
PERSON(0, "个人认证"), PERSON(0, "个人认证"),
ENTERPRISE(1, "企业认证"); ENTERPRISE(1, "企业认证");
private Integer type; private final Integer type;
private String desc; private final String desc;
AuthType(Integer type, String desc) { AuthType(Integer type, String desc) {
this.type = type; this.type = type;
......
...@@ -18,8 +18,8 @@ public enum AuthorityAcquire { ...@@ -18,8 +18,8 @@ public enum AuthorityAcquire {
OTHER(4, "其他"), OTHER(4, "其他"),
; ;
private int code; private final int code;
private String val; private final String val;
public static int getByType(String type) { public static int getByType(String type) {
for (AuthorityAcquire value : AuthorityAcquire.values()) { for (AuthorityAcquire value : AuthorityAcquire.values()) {
......
...@@ -19,8 +19,8 @@ public enum AuthorityType { ...@@ -19,8 +19,8 @@ public enum AuthorityType {
ENTRUST(5, "委托作品"), ENTRUST(5, "委托作品"),
; ;
private int code; private final int code;
private String val; private final String val;
public static int getByType(String type) { public static int getByType(String type) {
for (AuthorityType value : AuthorityType.values()) { for (AuthorityType value : AuthorityType.values()) {
......
...@@ -28,11 +28,11 @@ public enum CertificatesType { ...@@ -28,11 +28,11 @@ public enum CertificatesType {
; ;
@ApiModelProperty(value = "证件类型编码(湖北版权局)") @ApiModelProperty(value = "证件类型编码(湖北版权局)")
private int code; private final int code;
private String value; private final String value;
//0-身份证 1-营业执照 2-企业法人营业执照 3-组织机构代码证书 4-事业单位法人证书 5-社团法人证书 6-统一社会信用代码 7其他有效证件 //0-身份证 1-营业执照 2-企业法人营业执照 3-组织机构代码证书 4-事业单位法人证书 5-社团法人证书 6-统一社会信用代码 7其他有效证件
@ApiModelProperty(value = "数据库对应的每种证件类型的type") @ApiModelProperty(value = "数据库对应的每种证件类型的type")
private int type; private final int type;
public static CertificatesType getByType(int type) { public static CertificatesType getByType(int type) {
for (CertificatesType value : CertificatesType.values()) { for (CertificatesType value : CertificatesType.values()) {
......
...@@ -23,9 +23,9 @@ public enum CopyrightApplyState { ...@@ -23,9 +23,9 @@ public enum CopyrightApplyState {
FINAL_JUDGMENT(7, "待终审", ""), FINAL_JUDGMENT(7, "待终审", ""),
; ;
private int code; private final int code;
private String value; private final String value;
private String msg; private final String msg;
public static CopyrightApplyState getByState(int state) { public static CopyrightApplyState getByState(int state) {
for (CopyrightApplyState stateEnum : CopyrightApplyState.values()) { for (CopyrightApplyState stateEnum : CopyrightApplyState.values()) {
......
...@@ -17,6 +17,6 @@ public enum IdCardVerificationResponse { ...@@ -17,6 +17,6 @@ public enum IdCardVerificationResponse {
FAILED4("-4", "证件库服务异常"), FAILED4("-4", "证件库服务异常"),
FAILED5("-5", "证件库中无此身份证记录"), FAILED5("-5", "证件库中无此身份证记录"),
; ;
private String code; private final String code;
private String desc; private final String desc;
} }
...@@ -23,8 +23,8 @@ public enum OpusProperty { ...@@ -23,8 +23,8 @@ public enum OpusProperty {
ARRANGEMENT(6, "整理"), ARRANGEMENT(6, "整理"),
OTHER(7, "其他"), OTHER(7, "其他"),
; ;
private int code; private final int code;
private String value; private final String value;
public static List<String> queryAll() { public static List<String> queryAll() {
return Arrays.stream(OpusProperty.values()).map(OpusProperty::getValue).collect(Collectors.toList()); return Arrays.stream(OpusProperty.values()).map(OpusProperty::getValue).collect(Collectors.toList());
......
...@@ -30,6 +30,6 @@ public enum OrderStatus { ...@@ -30,6 +30,6 @@ public enum OrderStatus {
CANCEL(5), CANCEL(5),
; ;
private Integer status; private final Integer status;
} }
...@@ -15,8 +15,8 @@ public enum OwnerType { ...@@ -15,8 +15,8 @@ public enum OwnerType {
LEGAL(1, "法人"), LEGAL(1, "法人"),
; ;
private int type; private final int type;
private String desc; private final String desc;
public static String getByType(int type) { public static String getByType(int type) {
return type == PERSON.getType() ? PERSON.getDesc() : LEGAL.getDesc(); return type == PERSON.getType() ? PERSON.getDesc() : LEGAL.getDesc();
......
...@@ -15,8 +15,8 @@ public enum PayScene { ...@@ -15,8 +15,8 @@ public enum PayScene {
COPYRIGHT(2, "版权申请"); COPYRIGHT(2, "版权申请");
private Integer code; private final Integer code;
private String type; private final String type;
public static String getTypeByCode(Integer code) { public static String getTypeByCode(Integer code) {
for (PayScene value : PayScene.values()) { for (PayScene value : PayScene.values()) {
......
...@@ -20,6 +20,6 @@ public enum PayType { ...@@ -20,6 +20,6 @@ public enum PayType {
/** /**
* 类型 * 类型
*/ */
private Integer code; private final Integer code;
private final String type; private final String type;
} }
...@@ -21,8 +21,8 @@ public enum PublishStatus { ...@@ -21,8 +21,8 @@ public enum PublishStatus {
SUSSED(2, "发行成功"), SUSSED(2, "发行成功"),
FAILED(3, "发行失败"); FAILED(3, "发行失败");
private Integer code; private final Integer code;
private String type; private final String type;
} }
...@@ -20,6 +20,6 @@ public enum RefundLaunchChannel { ...@@ -20,6 +20,6 @@ public enum RefundLaunchChannel {
ADMIN(2); ADMIN(2);
private Integer code; private final Integer code;
} }
...@@ -16,6 +16,6 @@ public enum RefundStatus { ...@@ -16,6 +16,6 @@ public enum RefundStatus {
FAINED(3), FAINED(3),
; ;
private Integer status; private final Integer status;
} }
...@@ -15,8 +15,8 @@ public enum SignatureType { ...@@ -15,8 +15,8 @@ public enum SignatureType {
ALIAS(2, "别名"), ALIAS(2, "别名"),
ANONYMOUS(3, "匿名"), ANONYMOUS(3, "匿名"),
; ;
private int code; private final int code;
private String value; private final String value;
public static int getCode(String value) { public static int getCode(String value) {
for (SignatureType signatureType : SignatureType.values()) { for (SignatureType signatureType : SignatureType.values()) {
......
...@@ -25,8 +25,8 @@ public enum WxPayStatus { ...@@ -25,8 +25,8 @@ public enum WxPayStatus {
PAYERROR("PAYERROR", "支付失败(仅付款码支付会返回)"); PAYERROR("PAYERROR", "支付失败(仅付款码支付会返回)");
private String status; private final String status;
private String desc; private final String desc;
} }
...@@ -12,12 +12,13 @@ import com.fzm.common.service.AdminService; ...@@ -12,12 +12,13 @@ import com.fzm.common.service.AdminService;
import com.fzm.common.service.UserService; import com.fzm.common.service.UserService;
import com.fzm.common.utils.JwtUtil; import com.fzm.common.utils.JwtUtil;
import com.fzm.common.utils.RedisUtil; import com.fzm.common.utils.RedisUtil;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.method.HandlerMethod; import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Method; import java.lang.reflect.Method;
...@@ -27,16 +28,11 @@ import java.util.Date; ...@@ -27,16 +28,11 @@ import java.util.Date;
* @author tangtuo * @author tangtuo
* @date 2021/7/13 14:30 * @date 2021/7/13 14:30
*/ */
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class AuthenticationInterceptor implements HandlerInterceptor { public class AuthenticationInterceptor implements HandlerInterceptor {
private final RedisUtil redisUtil;
@Resource private final UserService userService;
private RedisUtil redisUtil; private final AdminService adminService;
@Resource
private UserService userService;
@Resource
private AdminService adminService;
@Override @Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
......
package com.fzm.common.model;
import com.google.zxing.LuminanceSource;
import java.awt.*;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
public class BufferedImageLuminanceSource extends LuminanceSource {
private final BufferedImage image;
private final int left;
private final int top;
public BufferedImageLuminanceSource(BufferedImage image) {
this(image, 0, 0, image.getWidth(), image.getHeight());
}
public BufferedImageLuminanceSource(BufferedImage image, int left, int top, int width, int height) {
super(width, height);
int sourceWidth = image.getWidth();
int sourceHeight = image.getHeight();
if (left + width > sourceWidth || top + height > sourceHeight) {
throw new IllegalArgumentException("Crop rectangle does not fit within image data.");
}
for (int y = top; y < top + height; y++) {
for (int x = left; x < left + width; x++) {
if ((image.getRGB(x, y) & 0xFF000000) == 0) {
image.setRGB(x, y, 0xFFFFFFFF); // = white
}
}
}
this.image = new BufferedImage(sourceWidth, sourceHeight, BufferedImage.TYPE_BYTE_GRAY);
this.image.getGraphics().drawImage(image, 0, 0, null);
this.left = left;
this.top = top;
}
public byte[] getRow(int y, byte[] row) {
if (y < 0 || y >= getHeight()) {
throw new IllegalArgumentException("Requested row is outside the image: " + y);
}
int width = getWidth();
if (row == null || row.length < width) {
row = new byte[width];
}
image.getRaster().getDataElements(left, top + y, width, 1, row);
return row;
}
public byte[] getMatrix() {
int width = getWidth();
int height = getHeight();
int area = width * height;
byte[] matrix = new byte[area];
image.getRaster().getDataElements(left, top, width, height, matrix);
return matrix;
}
@Override
public boolean isCropSupported() {
return true;
}
@Override
public LuminanceSource crop(int left, int top, int width, int height) {
return new BufferedImageLuminanceSource(image, this.left + left, this.top + top, width, height);
}
@Override
public boolean isRotateSupported() {
return true;
}
@Override
public LuminanceSource rotateCounterClockwise() {
int sourceWidth = image.getWidth();
int sourceHeight = image.getHeight();
AffineTransform transform = new AffineTransform(0.0, -1.0, 1.0, 0.0, 0.0, sourceWidth);
BufferedImage rotatedImage = new BufferedImage(sourceHeight, sourceWidth, BufferedImage.TYPE_BYTE_GRAY);
Graphics2D g = rotatedImage.createGraphics();
g.drawImage(image, transform, null);
g.dispose();
int width = getWidth();
return new BufferedImageLuminanceSource(rotatedImage, top, sourceWidth - (left + width), getHeight(), width);
}
}
\ No newline at end of file
...@@ -23,7 +23,6 @@ public class NotifyConsumer { ...@@ -23,7 +23,6 @@ public class NotifyConsumer {
private final NotifyMapper notifyMapper; private final NotifyMapper notifyMapper;
private final NotifyStateMapper notifyStateMapper; private final NotifyStateMapper notifyStateMapper;
@RabbitListener(queues = {NotifyConfig.NOTIFY_QUEUE}) @RabbitListener(queues = {NotifyConfig.NOTIFY_QUEUE})
public void notifyMessageUser(String content) { public void notifyMessageUser(String content) {
if (StringUtils.isBlank(content)) { if (StringUtils.isBlank(content)) {
......
...@@ -16,9 +16,8 @@ public interface CopyrightApplyOwnerRelationService extends IService<CopyrightAp ...@@ -16,9 +16,8 @@ public interface CopyrightApplyOwnerRelationService extends IService<CopyrightAp
* 根据版权id删除记录 * 根据版权id删除记录
* *
* @param copyrightId * @param copyrightId
* @return
*/ */
Integer delByCopyrightId(Integer copyrightId); void delByCopyrightId(Integer copyrightId);
/** /**
* 根据版权id查询 * 根据版权id查询
......
...@@ -149,9 +149,8 @@ public interface CopyrightApplyService extends IService<CopyrightApply> { ...@@ -149,9 +149,8 @@ public interface CopyrightApplyService extends IService<CopyrightApply> {
* *
* @param copyrightId * @param copyrightId
* @param state * @param state
* @return
*/ */
boolean updateRegisterState(Integer copyrightId, int state); void updateRegisterState(Integer copyrightId, int state);
void replaceNftHash(String oldNftHash, String newNftHash); void replaceNftHash(String oldNftHash, String newNftHash);
} }
...@@ -15,9 +15,8 @@ public interface CopyrightAuthorService extends IService<CopyrightAuthor> { ...@@ -15,9 +15,8 @@ public interface CopyrightAuthorService extends IService<CopyrightAuthor> {
* 根据版权id删除 * 根据版权id删除
* *
* @param id * @param id
* @return
*/ */
Integer delByCopyrightId(Integer id); void delByCopyrightId(Integer id);
/** /**
* 根据版权id查询作者列表 * 根据版权id查询作者列表
......
...@@ -14,6 +14,6 @@ public interface CopyrightAuthorityRelationService extends IService<CopyrightAut ...@@ -14,6 +14,6 @@ public interface CopyrightAuthorityRelationService extends IService<CopyrightAut
* *
* @param copyrightId * @param copyrightId
*/ */
Integer delByCopyrightId(Integer copyrightId); void delByCopyrightId(Integer copyrightId);
} }
...@@ -24,7 +24,6 @@ public interface CopyrightFileService extends IService<CopyrightFile> { ...@@ -24,7 +24,6 @@ public interface CopyrightFileService extends IService<CopyrightFile> {
* 根据版权id删除 * 根据版权id删除
* *
* @param id * @param id
* @return
*/ */
Integer delByCopyrightId(Integer id, boolean delFile); void delByCopyrightId(Integer id, boolean delFile);
} }
...@@ -126,7 +126,7 @@ public interface NftService extends IService<Nft> { ...@@ -126,7 +126,7 @@ public interface NftService extends IService<Nft> {
* @param id * @param id
* @return * @return
*/ */
Integer publish(Integer id); void publish(Integer id);
/** /**
* nft转让 * nft转让
......
...@@ -45,7 +45,7 @@ public interface OrderService extends IService<Order> { ...@@ -45,7 +45,7 @@ public interface OrderService extends IService<Order> {
* @param orderId * @param orderId
* @param payType * @param payType
*/ */
Boolean updatePayType(Long orderId, Integer payType); void updatePayType(Long orderId, Integer payType);
/** /**
* 取消订单 * 取消订单
......
...@@ -5,7 +5,6 @@ import com.fzm.common.entity.dto.JsapiPayDto; ...@@ -5,7 +5,6 @@ import com.fzm.common.entity.dto.JsapiPayDto;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.IOException; import java.io.IOException;
import java.security.GeneralSecurityException;
import java.util.Map; import java.util.Map;
/** /**
...@@ -32,7 +31,7 @@ public interface WxPayService { ...@@ -32,7 +31,7 @@ public interface WxPayService {
* *
* @param jsonObject * @param jsonObject
*/ */
void processOrder(JSONObject jsonObject) throws GeneralSecurityException, InterruptedException; void processOrder(JSONObject jsonObject) throws InterruptedException;
String queryOrder(Long orderId) throws IOException, InterruptedException; String queryOrder(Long orderId) throws IOException, InterruptedException;
......
...@@ -5,9 +5,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -5,9 +5,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fzm.common.entity.Authority; import com.fzm.common.entity.Authority;
import com.fzm.common.mapper.AuthorityMapper; import com.fzm.common.mapper.AuthorityMapper;
import com.fzm.common.service.AuthorityService; import com.fzm.common.service.AuthorityService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
...@@ -15,12 +16,9 @@ import java.util.List; ...@@ -15,12 +16,9 @@ import java.util.List;
* @date 2021/12/9 11:42 * @date 2021/12/9 11:42
*/ */
@Service @Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class AuthorityServiceImpl extends ServiceImpl<AuthorityMapper, Authority> implements AuthorityService { public class AuthorityServiceImpl extends ServiceImpl<AuthorityMapper, Authority> implements AuthorityService {
private final AuthorityMapper authorityMapper;
@Resource
private AuthorityMapper authorityMapper;
@Override @Override
public List<Authority> getByType(int type) { public List<Authority> getByType(int type) {
......
...@@ -5,9 +5,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -5,9 +5,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fzm.common.entity.TbCollection; import com.fzm.common.entity.TbCollection;
import com.fzm.common.mapper.CollectionMapper; import com.fzm.common.mapper.CollectionMapper;
import com.fzm.common.service.CollectionService; import com.fzm.common.service.CollectionService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
...@@ -15,10 +16,10 @@ import java.util.List; ...@@ -15,10 +16,10 @@ import java.util.List;
* @date 2021/7/1 14:36 * @date 2021/7/1 14:36
*/ */
@Service @Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CollectionServiceImpl extends ServiceImpl<CollectionMapper, TbCollection> implements CollectionService { public class CollectionServiceImpl extends ServiceImpl<CollectionMapper, TbCollection> implements CollectionService {
@Resource private final CollectionMapper collectionMapper;
private CollectionMapper collectionMapper;
@Override @Override
public void deleteByUserIdAndNftId(int userId, Integer nftId) { public void deleteByUserIdAndNftId(int userId, Integer nftId) {
......
...@@ -18,19 +18,19 @@ import com.fzm.common.enums.ResultCode; ...@@ -18,19 +18,19 @@ import com.fzm.common.enums.ResultCode;
import com.fzm.common.exception.GlobalException; import com.fzm.common.exception.GlobalException;
import com.fzm.common.mapper.CommemorateNftMapper; import com.fzm.common.mapper.CommemorateNftMapper;
import com.fzm.common.service.CommemorateNftService; import com.fzm.common.service.CommemorateNftService;
import com.fzm.common.service.NftChainInfoService;
import com.fzm.common.service.NftService; import com.fzm.common.service.NftService;
import com.fzm.common.service.UserService; import com.fzm.common.service.UserService;
import com.fzm.common.utils.RedisUtil; import com.fzm.common.utils.RedisUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.redisson.api.RLock; import org.redisson.api.RLock;
import org.redisson.api.RSemaphore; import org.redisson.api.RSemaphore;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.Instant; import java.time.Instant;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
...@@ -43,31 +43,18 @@ import java.util.concurrent.TimeUnit; ...@@ -43,31 +43,18 @@ import java.util.concurrent.TimeUnit;
*/ */
@Slf4j @Slf4j
@Service @Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CommemorateNftServiceImpl extends ServiceImpl<CommemorateNftMapper, CommemorateNft> implements CommemorateNftService { public class CommemorateNftServiceImpl extends ServiceImpl<CommemorateNftMapper, CommemorateNft> implements CommemorateNftService {
@Resource private final NftService nftService;
NftChainInfoService nftChainInfoService; private final ParaChainClient paraChainClient;
private final UserService userService;
@Resource private final RedissonClient redisson;
private NftService nftService; private final RedisUtil redisUtil;
@Resource
private ParaChainClient paraChainClient;
@Value("${chain.para.cAddr}") @Value("${chain.para.cAddr}")
private String contractAddr; private String contractAddr;
@Resource
private UserService userService;
@Resource
private RedissonClient redisson;
@Resource
private RedisUtil redisUtil;
@Override @Override
public Integer publish(CommemorateNft commemorateNft) { public Integer publish(CommemorateNft commemorateNft) {
User user = userService.getUserByToken(); User user = userService.getUserByToken();
......
...@@ -6,9 +6,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -6,9 +6,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fzm.common.entity.CopyrightApplyOwnerRelation; import com.fzm.common.entity.CopyrightApplyOwnerRelation;
import com.fzm.common.mapper.CopyrightApplyOwnerRelationMapper; import com.fzm.common.mapper.CopyrightApplyOwnerRelationMapper;
import com.fzm.common.service.CopyrightApplyOwnerRelationService; import com.fzm.common.service.CopyrightApplyOwnerRelationService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
...@@ -16,16 +17,15 @@ import java.util.List; ...@@ -16,16 +17,15 @@ import java.util.List;
* @date 2021/12/13 11:25 * @date 2021/12/13 11:25
*/ */
@Service @Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CopyrightApplyOwnerRelationServiceImpl extends ServiceImpl<CopyrightApplyOwnerRelationMapper, CopyrightApplyOwnerRelation> implements CopyrightApplyOwnerRelationService { public class CopyrightApplyOwnerRelationServiceImpl extends ServiceImpl<CopyrightApplyOwnerRelationMapper, CopyrightApplyOwnerRelation> implements CopyrightApplyOwnerRelationService {
private final CopyrightApplyOwnerRelationMapper copyrightApplyOwnerRelationMapper;
@Resource
private CopyrightApplyOwnerRelationMapper copyrightApplyOwnerRelationMapper;
@Override @Override
public Integer delByCopyrightId(Integer copyrightId) { public void delByCopyrightId(Integer copyrightId) {
UpdateWrapper<CopyrightApplyOwnerRelation> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<CopyrightApplyOwnerRelation> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("copyright_id", copyrightId); updateWrapper.eq("copyright_id", copyrightId);
return copyrightApplyOwnerRelationMapper.delete(updateWrapper); copyrightApplyOwnerRelationMapper.delete(updateWrapper);
} }
@Override @Override
......
...@@ -28,16 +28,17 @@ import com.fzm.common.utils.CopyrightSignUtil; ...@@ -28,16 +28,17 @@ import com.fzm.common.utils.CopyrightSignUtil;
import com.fzm.common.utils.ObsUtil; import com.fzm.common.utils.ObsUtil;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.redisson.Redisson; import org.redisson.Redisson;
import org.redisson.api.RLock; import org.redisson.api.RLock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException; import org.springframework.dao.DuplicateKeyException;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
...@@ -54,64 +55,27 @@ import java.util.concurrent.TimeUnit; ...@@ -54,64 +55,27 @@ import java.util.concurrent.TimeUnit;
@Slf4j @Slf4j
@Service @Service
@Transactional(rollbackFor = RuntimeException.class) @Transactional(rollbackFor = RuntimeException.class)
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper, CopyrightApply> implements CopyrightApplyService { public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper, CopyrightApply> implements CopyrightApplyService {
private final CopyrightApplyMapper copyrightApplyMapper;
@Resource private final CopyrightFileService copyrightFileService;
private CopyrightApplyMapper copyrightApplyMapper; private final CopyrightApplyOwnerRelationService copyrightApplyOwnerRelationService;
private final CopyrightAuthorService copyrightAuthorService;
@Resource private final CopyrightAuthorityRelationService copyrightAuthorityRelationService;
private CopyrightFileService copyrightFileService; private final AuthorityService authorityService;
private final CopyrightOwnerService copyrightOwnerService;
@Resource private final UserService userService;
private CopyrightApplyOwnerRelationService copyrightApplyOwnerRelationService; private final AuthPersonService authPersonService;
private final NftService nftService;
@Resource private final ObsUtil obsUtil;
private CopyrightAuthorService copyrightAuthorService; private final ThreadPoolTaskExecutor threadPoolTaskExecutor;
private final OpusCategoryService opusCategoryService;
@Resource private final CopyrightProperties copyrightProperties;
private CopyrightAuthorityRelationService copyrightAuthorityRelationService; private final Redisson redisson;
private final DraftService draftService;
@Resource private final OrderService orderService;
private AuthorityService authorityService; private final WxPayService wxPayService;
private final NotifyPublisher notifyPublisher;
@Resource
private CopyrightOwnerService copyrightOwnerService;
@Resource
private UserService userService;
@Resource
private AuthPersonService authPersonService;
@Resource
private NftService nftService;
@Resource
private ObsUtil obsUtil;
@Resource
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
@Resource
private OpusCategoryService opusCategoryService;
@Resource
private CopyrightProperties copyrightProperties;
@Resource
private Redisson redisson;
@Resource
private DraftService draftService;
@Resource
private OrderService orderService;
@Resource
private WxPayService wxPayService;
@Resource
private NotifyPublisher notifyPublisher;
@Override @Override
...@@ -490,11 +454,11 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper, ...@@ -490,11 +454,11 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
} }
@Override @Override
public boolean updateRegisterState(Integer copyrightId, int state) { public void updateRegisterState(Integer copyrightId, int state) {
CopyrightApply copyrightApply = new CopyrightApply(); CopyrightApply copyrightApply = new CopyrightApply();
copyrightApply.setId(copyrightId); copyrightApply.setId(copyrightId);
copyrightApply.setRegisterState(state); copyrightApply.setRegisterState(state);
return updateById(copyrightApply); updateById(copyrightApply);
} }
@Override @Override
......
...@@ -6,9 +6,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -6,9 +6,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fzm.common.entity.CopyrightAuthor; import com.fzm.common.entity.CopyrightAuthor;
import com.fzm.common.mapper.CopyrightAuthorMapper; import com.fzm.common.mapper.CopyrightAuthorMapper;
import com.fzm.common.service.CopyrightAuthorService; import com.fzm.common.service.CopyrightAuthorService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
...@@ -16,16 +17,16 @@ import java.util.List; ...@@ -16,16 +17,16 @@ import java.util.List;
* @date 2021/12/9 11:41 * @date 2021/12/9 11:41
*/ */
@Service @Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CopyrightAuthorServiceImpl extends ServiceImpl<CopyrightAuthorMapper, CopyrightAuthor> implements CopyrightAuthorService { public class CopyrightAuthorServiceImpl extends ServiceImpl<CopyrightAuthorMapper, CopyrightAuthor> implements CopyrightAuthorService {
@Resource private final CopyrightAuthorMapper copyrightAuthorMapper;
private CopyrightAuthorMapper copyrightAuthorMapper;
@Override @Override
public Integer delByCopyrightId(Integer copyrightId) { public void delByCopyrightId(Integer copyrightId) {
UpdateWrapper<CopyrightAuthor> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<CopyrightAuthor> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("copyright_id", copyrightId); updateWrapper.eq("copyright_id", copyrightId);
return copyrightAuthorMapper.delete(updateWrapper); copyrightAuthorMapper.delete(updateWrapper);
} }
@Override @Override
......
...@@ -5,25 +5,25 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -5,25 +5,25 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fzm.common.entity.CopyrightAuthorityRelation; import com.fzm.common.entity.CopyrightAuthorityRelation;
import com.fzm.common.mapper.CopyrightAuthorityRelationMapper; import com.fzm.common.mapper.CopyrightAuthorityRelationMapper;
import com.fzm.common.service.CopyrightAuthorityRelationService; import com.fzm.common.service.CopyrightAuthorityRelationService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/** /**
* @author tangtuo * @author tangtuo
* @date 2021/12/9 11:44 * @date 2021/12/9 11:44
*/ */
@Service @Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CopyrightAuthorityRelationServiceImpl extends ServiceImpl<CopyrightAuthorityRelationMapper, CopyrightAuthorityRelation> implements CopyrightAuthorityRelationService { public class CopyrightAuthorityRelationServiceImpl extends ServiceImpl<CopyrightAuthorityRelationMapper, CopyrightAuthorityRelation> implements CopyrightAuthorityRelationService {
@Resource private final CopyrightAuthorityRelationMapper copyrightAuthorityRelationMapper;
private CopyrightAuthorityRelationMapper copyrightAuthorityRelationMapper;
@Override @Override
public Integer delByCopyrightId(Integer copyrightId) { public void delByCopyrightId(Integer copyrightId) {
UpdateWrapper<CopyrightAuthorityRelation> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<CopyrightAuthorityRelation> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("copyright_id", copyrightId); updateWrapper.eq("copyright_id", copyrightId);
return copyrightAuthorityRelationMapper.delete(updateWrapper); copyrightAuthorityRelationMapper.delete(updateWrapper);
} }
} }
...@@ -7,9 +7,10 @@ import com.fzm.common.entity.CopyrightFile; ...@@ -7,9 +7,10 @@ import com.fzm.common.entity.CopyrightFile;
import com.fzm.common.mapper.CopyrightFileMapper; import com.fzm.common.mapper.CopyrightFileMapper;
import com.fzm.common.service.CopyrightFileService; import com.fzm.common.service.CopyrightFileService;
import com.fzm.common.utils.ObsUtil; import com.fzm.common.utils.ObsUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
...@@ -17,13 +18,12 @@ import java.util.List; ...@@ -17,13 +18,12 @@ import java.util.List;
* @date 2021/12/9 11:43 * @date 2021/12/9 11:43
*/ */
@Service @Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CopyrightFileServiceImpl extends ServiceImpl<CopyrightFileMapper, CopyrightFile> implements CopyrightFileService { public class CopyrightFileServiceImpl extends ServiceImpl<CopyrightFileMapper, CopyrightFile> implements CopyrightFileService {
@Resource private final CopyrightFileMapper copyrightFileMapper;
private CopyrightFileMapper copyrightFileMapper;
@Resource private final ObsUtil obsUtil;
private ObsUtil obsUtil;
@Override @Override
...@@ -34,7 +34,7 @@ public class CopyrightFileServiceImpl extends ServiceImpl<CopyrightFileMapper, C ...@@ -34,7 +34,7 @@ public class CopyrightFileServiceImpl extends ServiceImpl<CopyrightFileMapper, C
} }
@Override @Override
public Integer delByCopyrightId(Integer copyrightId, boolean delFile) { public void delByCopyrightId(Integer copyrightId, boolean delFile) {
if (delFile) { if (delFile) {
List<CopyrightFile> list = getByCopyrightId(copyrightId); List<CopyrightFile> list = getByCopyrightId(copyrightId);
for (CopyrightFile file : list) { for (CopyrightFile file : list) {
...@@ -44,6 +44,6 @@ public class CopyrightFileServiceImpl extends ServiceImpl<CopyrightFileMapper, C ...@@ -44,6 +44,6 @@ public class CopyrightFileServiceImpl extends ServiceImpl<CopyrightFileMapper, C
UpdateWrapper<CopyrightFile> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<CopyrightFile> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("copyright_id", copyrightId); updateWrapper.eq("copyright_id", copyrightId);
return copyrightFileMapper.delete(updateWrapper); copyrightFileMapper.delete(updateWrapper);
} }
} }
...@@ -5,9 +5,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -5,9 +5,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fzm.common.entity.CopyrightOwner; import com.fzm.common.entity.CopyrightOwner;
import com.fzm.common.mapper.CopyrightOwnerMapper; import com.fzm.common.mapper.CopyrightOwnerMapper;
import com.fzm.common.service.CopyrightOwnerService; import com.fzm.common.service.CopyrightOwnerService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
...@@ -15,10 +16,10 @@ import java.util.List; ...@@ -15,10 +16,10 @@ import java.util.List;
* @date 2021/12/9 11:40 * @date 2021/12/9 11:40
*/ */
@Service @Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CopyrightOwnerServiceImpl extends ServiceImpl<CopyrightOwnerMapper, CopyrightOwner> implements CopyrightOwnerService { public class CopyrightOwnerServiceImpl extends ServiceImpl<CopyrightOwnerMapper, CopyrightOwner> implements CopyrightOwnerService {
@Resource private final CopyrightOwnerMapper ownerMapper;
private CopyrightOwnerMapper ownerMapper;
@Override @Override
public List<CopyrightOwner> getByUserId(Integer userId) { public List<CopyrightOwner> getByUserId(Integer userId) {
......
...@@ -11,12 +11,13 @@ import com.fzm.common.entity.dto.DraftDTO; ...@@ -11,12 +11,13 @@ import com.fzm.common.entity.dto.DraftDTO;
import com.fzm.common.enums.ResultCode; import com.fzm.common.enums.ResultCode;
import com.fzm.common.exception.GlobalException; import com.fzm.common.exception.GlobalException;
import com.fzm.common.mapper.DraftMapper; import com.fzm.common.mapper.DraftMapper;
import com.fzm.common.service.*; import com.fzm.common.service.DraftService;
import com.fzm.common.utils.ObsUtil; import com.fzm.common.utils.ObsUtil;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.Duration; import java.time.Duration;
import java.time.Instant; import java.time.Instant;
import java.util.List; import java.util.List;
...@@ -26,25 +27,10 @@ import java.util.List; ...@@ -26,25 +27,10 @@ import java.util.List;
* @date 2021/12/10 10:18 * @date 2021/12/10 10:18
*/ */
@Service @Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class DraftServiceImpl extends ServiceImpl<DraftMapper, Draft> implements DraftService { public class DraftServiceImpl extends ServiceImpl<DraftMapper, Draft> implements DraftService {
private final DraftMapper draftMapper;
@Resource private final ObsUtil obsUtil;
private DraftMapper draftMapper;
@Resource
private ObsUtil obsUtil;
@Resource
private CopyrightApplyService copyrightApplyService;
@Resource
private CopyrightFileService copyrightFileService;
@Resource
private CopyrightAuthorityRelationService copyrightAuthorityRelationService;
@Resource
private CopyrightAuthorService copyrightAuthorService;
@Override @Override
public List<Draft> getByUserId(Integer userId) { public List<Draft> getByUserId(Integer userId) {
......
...@@ -7,35 +7,29 @@ import com.fzm.common.constant.SystemConstant; ...@@ -7,35 +7,29 @@ import com.fzm.common.constant.SystemConstant;
import com.fzm.common.entity.EntrustShelf; import com.fzm.common.entity.EntrustShelf;
import com.fzm.common.enums.ResultCode; import com.fzm.common.enums.ResultCode;
import com.fzm.common.exception.GlobalException; import com.fzm.common.exception.GlobalException;
import com.fzm.common.interceptor.LoginUserInfo;
import com.fzm.common.mapper.EntrustShelfMapper; import com.fzm.common.mapper.EntrustShelfMapper;
import com.fzm.common.service.EntrustShelfService; import com.fzm.common.service.EntrustShelfService;
import com.fzm.common.service.NftService; import com.fzm.common.service.NftService;
import com.fzm.common.utils.JwtUtil;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
/** /**
* @author tangtuo * @author tangtuo
* @date 2021/7/5 15:09 * @date 2021/7/5 15:09
*/ */
@Service @Service
@Transactional(rollbackFor = RuntimeException.class) @RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class EntrustShelfServiceImpl extends ServiceImpl<EntrustShelfMapper, EntrustShelf> implements EntrustShelfService { public class EntrustShelfServiceImpl extends ServiceImpl<EntrustShelfMapper, EntrustShelf> implements EntrustShelfService {
private final NftService nftService;
@Resource
private HttpServletRequest request;
@Resource
private NftService nftService;
@Override @Override
@Transactional(rollbackFor = Exception.class)
public Boolean submit(EntrustShelf entrustShelf) { public Boolean submit(EntrustShelf entrustShelf) {
// 查询当前nft是否已提交过申请 // 查询当前nft是否已提交过申请
QueryWrapper<EntrustShelf> queryWrapper = new QueryWrapper<>(); QueryWrapper<EntrustShelf> queryWrapper = new QueryWrapper<>();
...@@ -46,13 +40,13 @@ public class EntrustShelfServiceImpl extends ServiceImpl<EntrustShelfMapper, Ent ...@@ -46,13 +40,13 @@ public class EntrustShelfServiceImpl extends ServiceImpl<EntrustShelfMapper, Ent
} }
// 修改当前nft的是否已申请的状态为是 // 修改当前nft的是否已申请的状态为是
nftService.updateEntrust(entrustShelf.getNftHash(), SystemConstant.BOOLEAN_DATA_TRUE); nftService.updateEntrust(entrustShelf.getNftHash(), SystemConstant.BOOLEAN_DATA_TRUE);
String authorization = request.getHeader("Authorization"); Integer userId = LoginUserInfo.getLoginUser().getUserId();
Integer userId = JwtUtil.getUserIdFromToken(authorization);
entrustShelf.setUserId(userId); entrustShelf.setUserId(userId);
return this.save(entrustShelf); return this.save(entrustShelf);
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public Boolean cancel(Integer id) { public Boolean cancel(Integer id) {
EntrustShelf entrustShelf = this.getById(id); EntrustShelf entrustShelf = this.getById(id);
if (entrustShelf == null) { if (entrustShelf == null) {
......
...@@ -11,10 +11,11 @@ import com.fzm.common.entity.vo.NftTransferRecordVo; ...@@ -11,10 +11,11 @@ import com.fzm.common.entity.vo.NftTransferRecordVo;
import com.fzm.common.mapper.NftTransferRecordMapper; import com.fzm.common.mapper.NftTransferRecordMapper;
import com.fzm.common.service.NftTransferRecordService; import com.fzm.common.service.NftTransferRecordService;
import com.fzm.common.service.UserService; import com.fzm.common.service.UserService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
...@@ -22,13 +23,10 @@ import java.util.List; ...@@ -22,13 +23,10 @@ import java.util.List;
* @date 2021/6/28 11:29 * @date 2021/6/28 11:29
*/ */
@Service @Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class NftTransferRecordServiceImpl extends ServiceImpl<NftTransferRecordMapper, NftTransferRecord> implements NftTransferRecordService { public class NftTransferRecordServiceImpl extends ServiceImpl<NftTransferRecordMapper, NftTransferRecord> implements NftTransferRecordService {
private final NftTransferRecordMapper nftTransferRecordMapper;
@Resource private final UserService userService;
private NftTransferRecordMapper nftTransferRecordMapper;
@Resource
private UserService userService;
@Override @Override
public List<NftTransferRecordVo> getTransferRecordList(String nftHash, String fromAddress, String toAddress, String startDate, String endDate) { public List<NftTransferRecordVo> getTransferRecordList(String nftHash, String fromAddress, String toAddress, String startDate, String endDate) {
......
...@@ -12,16 +12,16 @@ import com.fzm.common.enums.PayScene; ...@@ -12,16 +12,16 @@ import com.fzm.common.enums.PayScene;
import com.fzm.common.enums.PayType; import com.fzm.common.enums.PayType;
import com.fzm.common.enums.ResultCode; import com.fzm.common.enums.ResultCode;
import com.fzm.common.exception.GlobalException; import com.fzm.common.exception.GlobalException;
import com.fzm.common.interceptor.LoginUserInfo;
import com.fzm.common.mapper.OrderMapper; import com.fzm.common.mapper.OrderMapper;
import com.fzm.common.service.*; import com.fzm.common.service.*;
import com.fzm.common.utils.JwtUtil;
import com.fzm.common.utils.SnowflakeUtil; import com.fzm.common.utils.SnowflakeUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException; import java.io.IOException;
import java.time.Duration; import java.time.Duration;
import java.time.Instant; import java.time.Instant;
...@@ -34,31 +34,15 @@ import java.util.List; ...@@ -34,31 +34,15 @@ import java.util.List;
*/ */
@Service @Service
@Transactional(rollbackFor = RuntimeException.class) @Transactional(rollbackFor = RuntimeException.class)
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService { public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService {
private final NftService nftService;
@Resource private final CopyrightApplyService copyrightApplyService;
private NftService nftService; private final SnowflakeUtil snowflakeUtil;
private final RabbitTemplate rabbitTemplate;
@Resource private final OrderMapper orderMapper;
private CopyrightApplyService copyrightApplyService; private final WxPayService wxPayService;
private final ChargeService chargeService;
@Resource
private SnowflakeUtil snowflakeUtil;
@Resource
private HttpServletRequest request;
@Resource
private RabbitTemplate rabbitTemplate;
@Resource
private OrderMapper orderMapper;
@Resource
private WxPayService wxPayService;
@Resource
private ChargeService chargeService;
@Override @Override
public Order getByPaySceneAndProductId(Integer payScene, Integer productId, Integer orderStatus) { public Order getByPaySceneAndProductId(Integer payScene, Integer productId, Integer orderStatus) {
...@@ -107,7 +91,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements ...@@ -107,7 +91,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
order.setOrderName(orderName); order.setOrderName(orderName);
order.setFee(orderDto.getFee()); order.setFee(orderDto.getFee());
order.setProductId(productId); order.setProductId(productId);
order.setUserId(JwtUtil.getUserIdFromToken(request.getHeader("Authorization"))); order.setUserId(LoginUserInfo.getLoginUser().getUserId());
order.setCreateDate(new Date()); order.setCreateDate(new Date());
order.setUpdateDate(new Date()); order.setUpdateDate(new Date());
Integer orderStatus; Integer orderStatus;
...@@ -124,11 +108,11 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements ...@@ -124,11 +108,11 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
} }
@Override @Override
public Boolean updatePayType(Long orderId, Integer payType) { public void updatePayType(Long orderId, Integer payType) {
Order o = new Order(); Order o = new Order();
o.setId(orderId); o.setId(orderId);
o.setPayType(payType); o.setPayType(payType);
return updateById(o); updateById(o);
} }
@Override @Override
...@@ -150,7 +134,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements ...@@ -150,7 +134,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
@Override @Override
public List<OrderVo> listOrder(Integer payScene, Integer orderStatus) { public List<OrderVo> listOrder(Integer payScene, Integer orderStatus) {
Integer userId = JwtUtil.getUserIdFromToken(request.getHeader("Authorization")); Integer userId = LoginUserInfo.getLoginUser().getUserId();
return orderMapper.getByPayScene(payScene, userId, orderStatus); return orderMapper.getByPayScene(payScene, userId, orderStatus);
} }
......
...@@ -10,11 +10,12 @@ import com.fzm.common.mapper.PaymentMapper; ...@@ -10,11 +10,12 @@ import com.fzm.common.mapper.PaymentMapper;
import com.fzm.common.service.PaymentService; import com.fzm.common.service.PaymentService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
...@@ -23,10 +24,9 @@ import java.util.List; ...@@ -23,10 +24,9 @@ import java.util.List;
*/ */
@Service @Service
@Transactional(rollbackFor = RuntimeException.class) @Transactional(rollbackFor = RuntimeException.class)
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class PaymentServiceImpl extends ServiceImpl<PaymentMapper, Payment> implements PaymentService { public class PaymentServiceImpl extends ServiceImpl<PaymentMapper, Payment> implements PaymentService {
private final PaymentMapper paymentMapper;
@Resource
private PaymentMapper paymentMapper;
@Override @Override
......
...@@ -12,11 +12,12 @@ import com.fzm.common.service.RefundService; ...@@ -12,11 +12,12 @@ import com.fzm.common.service.RefundService;
import com.fzm.common.service.WxPayService; import com.fzm.common.service.WxPayService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
...@@ -26,13 +27,11 @@ import java.util.List; ...@@ -26,13 +27,11 @@ import java.util.List;
*/ */
@Service @Service
@Transactional(rollbackFor = RuntimeException.class) @Transactional(rollbackFor = RuntimeException.class)
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class RefundServiceImpl extends ServiceImpl<RefundMapper, Refund> implements RefundService { public class RefundServiceImpl extends ServiceImpl<RefundMapper, Refund> implements RefundService {
@Resource private final WxPayService wxPayService;
private WxPayService wxPayService; private final RefundMapper refundMapper;
@Resource
private RefundMapper refundMapper;
@Override @Override
public Refund getByOrderId(Long orderId) { public Refund getByOrderId(Long orderId) {
......
...@@ -6,10 +6,11 @@ import com.fzm.common.service.OrderService; ...@@ -6,10 +6,11 @@ import com.fzm.common.service.OrderService;
import com.fzm.common.service.SmsService; import com.fzm.common.service.SmsService;
import com.fzm.common.service.UserService; import com.fzm.common.service.UserService;
import com.fzm.common.utils.SmsUtil; import com.fzm.common.utils.SmsUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
...@@ -17,16 +18,11 @@ import java.math.BigDecimal; ...@@ -17,16 +18,11 @@ import java.math.BigDecimal;
* @date 2022/2/8 14:12 * @date 2022/2/8 14:12
*/ */
@Service @Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class SmsServiceImpl implements SmsService { public class SmsServiceImpl implements SmsService {
private final UserService userService;
@Resource private final SmsUtil smsUtil;
private UserService userService; private final OrderService orderService;
@Resource
private SmsUtil smsUtil;
@Resource
private OrderService orderService;
@Override @Override
@Async("threadPoolTaskExecutor") @Async("threadPoolTaskExecutor")
......
...@@ -20,6 +20,7 @@ import com.fzm.common.enums.AuthType; ...@@ -20,6 +20,7 @@ import com.fzm.common.enums.AuthType;
import com.fzm.common.enums.IdCardVerificationResponse; import com.fzm.common.enums.IdCardVerificationResponse;
import com.fzm.common.enums.ResultCode; import com.fzm.common.enums.ResultCode;
import com.fzm.common.exception.GlobalException; import com.fzm.common.exception.GlobalException;
import com.fzm.common.interceptor.LoginUserInfo;
import com.fzm.common.mapper.UserMapper; import com.fzm.common.mapper.UserMapper;
import com.fzm.common.mq.NotifyPublisher; import com.fzm.common.mq.NotifyPublisher;
import com.fzm.common.params.LoginParam; import com.fzm.common.params.LoginParam;
...@@ -27,7 +28,10 @@ import com.fzm.common.properties.DebugProperties; ...@@ -27,7 +28,10 @@ import com.fzm.common.properties.DebugProperties;
import com.fzm.common.properties.SmsProperties; import com.fzm.common.properties.SmsProperties;
import com.fzm.common.service.AuthPersonService; import com.fzm.common.service.AuthPersonService;
import com.fzm.common.service.UserService; import com.fzm.common.service.UserService;
import com.fzm.common.utils.*; import com.fzm.common.utils.ObsUtil;
import com.fzm.common.utils.RedisUtil;
import com.fzm.common.utils.SmsUtil;
import com.fzm.common.utils.TencentApi;
import com.tencentcloudapi.common.Credential; import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException; import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.common.profile.ClientProfile; import com.tencentcloudapi.common.profile.ClientProfile;
...@@ -35,15 +39,16 @@ import com.tencentcloudapi.common.profile.HttpProfile; ...@@ -35,15 +39,16 @@ import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.faceid.v20180301.FaceidClient; import com.tencentcloudapi.faceid.v20180301.FaceidClient;
import com.tencentcloudapi.faceid.v20180301.models.IdCardOCRVerificationRequest; import com.tencentcloudapi.faceid.v20180301.models.IdCardOCRVerificationRequest;
import com.tencentcloudapi.faceid.v20180301.models.IdCardOCRVerificationResponse; import com.tencentcloudapi.faceid.v20180301.models.IdCardOCRVerificationResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.IOException; import java.io.IOException;
import java.util.Base64; import java.util.Base64;
...@@ -56,40 +61,19 @@ import java.util.List; ...@@ -56,40 +61,19 @@ import java.util.List;
@Slf4j @Slf4j
@Service @Service
@Transactional(rollbackFor = RuntimeException.class) @Transactional(rollbackFor = RuntimeException.class)
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService { public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
private final UserMapper userMapper;
@Resource private final PasswordEncoder passwordEncoder;
private UserMapper userMapper; private final SmsProperties smsProperties;
private final SmsUtil smsUtil;
@Resource private final RedisUtil redisUtil;
private PasswordEncoder passwordEncoder; private final AuthPersonService authPersonService;
private final ParaChainClient paraClient;
@Resource private final HttpServletRequest request;
private SmsProperties smsProperties; private final ObsUtil obsUtil;
private final DebugProperties debugProperties;
@Resource private final NotifyPublisher notifyPublisher;
private SmsUtil smsUtil;
@Resource
private RedisUtil redisUtil;
@Resource
private AuthPersonService authPersonService;
@Resource
private ParaChainClient paraClient;
@Resource
private HttpServletRequest request;
@Resource
private ObsUtil obsUtil;
@Resource
private DebugProperties debugProperties;
@Resource
private NotifyPublisher notifyPublisher;
@Override @Override
...@@ -164,7 +148,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us ...@@ -164,7 +148,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
if (StringUtils.isBlank(token)) { if (StringUtils.isBlank(token)) {
throw GlobalException.newException(ResultCode.UNAUTHORIZED, "您还没有登录,请先登录"); throw GlobalException.newException(ResultCode.UNAUTHORIZED, "您还没有登录,请先登录");
} }
Integer userId = JwtUtil.getUserIdFromToken(token); Integer userId = LoginUserInfo.getLoginUser().getUserId();
return getById(userId); return getById(userId);
} }
...@@ -329,7 +313,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us ...@@ -329,7 +313,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
// 输出json格式的字符串回包 // 输出json格式的字符串回包
System.out.println(IdCardOCRVerificationResponse.toJsonString(resp)); System.out.println(IdCardOCRVerificationResponse.toJsonString(resp));
} catch (TencentCloudSDKException e) { } catch (TencentCloudSDKException e) {
System.out.println(e.toString()); System.out.println(e);
} }
} }
} }
...@@ -17,6 +17,7 @@ import com.fzm.common.properties.WxPayProperties; ...@@ -17,6 +17,7 @@ import com.fzm.common.properties.WxPayProperties;
import com.fzm.common.service.*; import com.fzm.common.service.*;
import com.fzm.common.utils.SnowflakeUtil; import com.fzm.common.utils.SnowflakeUtil;
import com.wechat.pay.contrib.apache.httpclient.util.AesUtil; import com.wechat.pay.contrib.apache.httpclient.util.AesUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.CloseableHttpResponse;
...@@ -28,11 +29,11 @@ import org.apache.http.util.EntityUtils; ...@@ -28,11 +29,11 @@ import org.apache.http.util.EntityUtils;
import org.redisson.Redisson; import org.redisson.Redisson;
import org.redisson.api.RLock; import org.redisson.api.RLock;
import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Base64Utils; import org.springframework.util.Base64Utils;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
...@@ -53,38 +54,19 @@ import java.util.concurrent.TimeUnit; ...@@ -53,38 +54,19 @@ import java.util.concurrent.TimeUnit;
@Slf4j @Slf4j
@Service @Service
@Transactional(rollbackFor = RuntimeException.class) @Transactional(rollbackFor = RuntimeException.class)
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class WxPayServiceImpl implements WxPayService { public class WxPayServiceImpl implements WxPayService {
private final CloseableHttpClient httpClient;
@Resource private final WxPayProperties wxPayProperties;
private CloseableHttpClient httpClient; private final PrivateKey wxPrivateKey;
private final OrderService orderService;
@Resource private final Redisson redisson;
private WxPayProperties wxPayProperties; private final PaymentService paymentService;
private final RabbitTemplate rabbitTemplate;
@Resource private final SnowflakeUtil snowflakeUtil;
private PrivateKey wxPrivateKey; private final RefundService refundService;
private final SmsService smsService;
@Resource
private OrderService orderService;
@Resource
private Redisson redisson;
@Resource
private PaymentService paymentService;
@Resource
private RabbitTemplate rabbitTemplate;
@Resource
private SnowflakeUtil snowflakeUtil;
@Resource
private RefundService refundService;
@Resource
private SmsService smsService;
public Map<String, Object> payJsapi(JsapiPayDto jsapiPayDto) throws Exception { public Map<String, Object> payJsapi(JsapiPayDto jsapiPayDto) throws Exception {
RLock lock = redisson.getLock("pay-" + jsapiPayDto.getOrderId()); RLock lock = redisson.getLock("pay-" + jsapiPayDto.getOrderId());
......
package com.fzm.common.utils; package com.fzm.common.utils;
import cn.hutool.crypto.SecureUtil; import cn.hutool.crypto.SecureUtil;
import lombok.extern.slf4j.Slf4j;
import java.util.Map; import java.util.Map;
import java.util.TreeMap; import java.util.TreeMap;
...@@ -10,10 +9,8 @@ import java.util.TreeMap; ...@@ -10,10 +9,8 @@ import java.util.TreeMap;
* @author tangtuo * @author tangtuo
* @date 2021/12/23 11:40 * @date 2021/12/23 11:40
*/ */
@Slf4j
public class CopyrightSignUtil { public class CopyrightSignUtil {
public static String generateSign(TreeMap<String, String> param) { public static String generateSign(TreeMap<String, String> param) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (Map.Entry<String, String> entry : param.entrySet()) { for (Map.Entry<String, String> entry : param.entrySet()) {
...@@ -23,7 +20,6 @@ public class CopyrightSignUtil { ...@@ -23,7 +20,6 @@ public class CopyrightSignUtil {
sb.append(key).append("=").append(value).append("&"); sb.append(key).append("=").append(value).append("&");
} }
String signStr = sb.deleteCharAt(sb.length() - 1).toString(); String signStr = sb.deleteCharAt(sb.length() - 1).toString();
log.info("signStr: {}", signStr);
return SecureUtil.md5(signStr); return SecureUtil.md5(signStr);
} }
} }
...@@ -2,7 +2,6 @@ package com.fzm.common.utils; ...@@ -2,7 +2,6 @@ package com.fzm.common.utils;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import java.lang.reflect.Type; import java.lang.reflect.Type;
...@@ -10,8 +9,8 @@ import java.lang.reflect.Type; ...@@ -10,8 +9,8 @@ import java.lang.reflect.Type;
public class JsonUtil { public class JsonUtil {
private static Gson gson; private static final Gson gson;
private static JsonParser jsonParser; private static final JsonParser jsonParser;
private JsonUtil() { private JsonUtil() {
} }
...@@ -48,12 +47,5 @@ public class JsonUtil { ...@@ -48,12 +47,5 @@ public class JsonUtil {
public static String toJson(Object object) { public static String toJson(Object object) {
return gson.toJson(object); return gson.toJson(object);
} }
/**
* String转为jsonObject
*/
public static JsonObject toJsonObject(String string) {
return jsonParser.parse(string).getAsJsonObject();
}
} }
...@@ -21,7 +21,6 @@ import java.util.Map; ...@@ -21,7 +21,6 @@ import java.util.Map;
*/ */
public class JwtUtil { public class JwtUtil {
private static final String CLAIM_KEY_USERNAME = "sub";
private static final String CLAIM_KEY_CREATED = "created"; private static final String CLAIM_KEY_CREATED = "created";
private static final String CLAIM_KEY_USERID = "userId"; private static final String CLAIM_KEY_USERID = "userId";
private static final String CLAIM_KEY_APP_ID = "appId"; private static final String CLAIM_KEY_APP_ID = "appId";
...@@ -45,10 +44,9 @@ public class JwtUtil { ...@@ -45,10 +44,9 @@ public class JwtUtil {
* 从token中获取JWT中的负载 * 从token中获取JWT中的负载
*/ */
private static Claims getClaimsFromToken(String token) { private static Claims getClaimsFromToken(String token) {
Claims claims = null;
token = token.replace(TOKEN_PREFIX, ""); token = token.replace(TOKEN_PREFIX, "");
try { try {
claims = Jwts.parser() return Jwts.parser()
.setSigningKey(SECRET) .setSigningKey(SECRET)
.parseClaimsJws(token) .parseClaimsJws(token)
.getBody(); .getBody();
...@@ -57,7 +55,6 @@ public class JwtUtil { ...@@ -57,7 +55,6 @@ public class JwtUtil {
} catch (Exception e) { } catch (Exception e) {
throw GlobalException.newException(ResultCode.UNAUTHORIZED, e.getMessage()); throw GlobalException.newException(ResultCode.UNAUTHORIZED, e.getMessage());
} }
return claims;
} }
/** /**
...@@ -110,12 +107,12 @@ public class JwtUtil { ...@@ -110,12 +107,12 @@ public class JwtUtil {
} }
} }
/** // /**
* 验证token是否还有效 // * 验证token是否还有效
* // *
* @param token 客户端传入的token // * @param token 客户端传入的token
* @param userDetails 从数据库中查询出来的用户信息 // * @param userDetails 从数据库中查询出来的用户信息
*/ // */
/* public static boolean validateToken(String token, UserDetails userDetails) { /* public static boolean validateToken(String token, UserDetails userDetails) {
String username = getUserNameFromToken(token); String username = getUserNameFromToken(token);
return username.equals(userDetails.getUsername()) && !isTokenExpired(token); return username.equals(userDetails.getUsername()) && !isTokenExpired(token);
......
...@@ -8,11 +8,13 @@ import com.obs.services.ObsClient; ...@@ -8,11 +8,13 @@ import com.obs.services.ObsClient;
import com.obs.services.model.DeleteObjectResult; import com.obs.services.model.DeleteObjectResult;
import com.obs.services.model.ObsObject; import com.obs.services.model.ObsObject;
import com.obs.services.model.PutObjectResult; import com.obs.services.model.PutObjectResult;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.*;
...@@ -28,16 +30,11 @@ import java.net.URLEncoder; ...@@ -28,16 +30,11 @@ import java.net.URLEncoder;
*/ */
@Slf4j @Slf4j
@Component @Component
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class ObsUtil { public class ObsUtil {
private final ObsClient obsClient;
@Resource private final ObsProperties obsProperties;
private ObsClient obsClient; private final HttpServletResponse response;
@Resource
private ObsProperties obsProperties;
@Resource
private HttpServletResponse response;
/** /**
* 上传对象 * 上传对象
...@@ -46,7 +43,11 @@ public class ObsUtil { ...@@ -46,7 +43,11 @@ public class ObsUtil {
* @return * @return
*/ */
public String putObject(MultipartFile file) throws IOException { public String putObject(MultipartFile file) throws IOException {
String objectName = IdUtil.simpleUUID().concat("/").concat(file.getOriginalFilename().replaceAll(" ", "")); String originalFilename = file.getOriginalFilename();
if (StringUtils.isBlank(originalFilename)) {
throw GlobalException.newException(ResultCode.VALIDATE_FAILED, "文件名不能为空");
}
String objectName = IdUtil.simpleUUID().concat("/").concat(originalFilename.replaceAll(" ", ""));
obsClient.putObject(obsProperties.getBucket(), objectName, file.getInputStream()); obsClient.putObject(obsProperties.getBucket(), objectName, file.getInputStream());
return String.format("https://%s.%s/%s", obsProperties.getBucket(), obsProperties.getEndPoint(), objectName); return String.format("https://%s.%s/%s", obsProperties.getBucket(), obsProperties.getEndPoint(), objectName);
} }
......
package com.fzm.common.utils; package com.fzm.common.utils;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.DataType; import org.springframework.data.redis.connection.DataType;
import org.springframework.data.redis.core.Cursor; import org.springframework.data.redis.core.Cursor;
...@@ -13,13 +14,12 @@ import java.util.Map.Entry; ...@@ -13,13 +14,12 @@ import java.util.Map.Entry;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@Component @Component
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class RedisUtil { public class RedisUtil {
private final StringRedisTemplate redisTemplate;
@Autowired
private StringRedisTemplate redisTemplate;
/* -------------------key相关操作--------------------- */
/** -------------------key相关操作--------------------- */
/** /**
* 删除key * 删除key
...@@ -174,7 +174,7 @@ public class RedisUtil { ...@@ -174,7 +174,7 @@ public class RedisUtil {
return redisTemplate.type(key); return redisTemplate.type(key);
} }
/** -------------------string相关操作--------------------- */ /* -------------------string相关操作--------------------- */
/** /**
* 设置指定 key 的值 * 设置指定 key 的值
...@@ -241,17 +241,6 @@ public class RedisUtil { ...@@ -241,17 +241,6 @@ public class RedisUtil {
} }
/** /**
* 设置ASCII码, 字符串'a'的ASCII码是97, 转为二进制是'01100001', 此方法是将二进制第offset位值变为value
*
* @param key 位置
* @param value 值,true为1, false为0
* @return
*/
public boolean setBit(String key, long offset, boolean value) {
return redisTemplate.opsForValue().setBit(key, offset, value);
}
/**
* 将值 value 关联到 key ,并将 key 的过期时间设为 timeout * 将值 value 关联到 key ,并将 key 的过期时间设为 timeout
* *
* @param key * @param key
...@@ -265,17 +254,6 @@ public class RedisUtil { ...@@ -265,17 +254,6 @@ public class RedisUtil {
} }
/** /**
* 只有在 key 不存在时设置 key 的值
*
* @param key
* @param value
* @return 之前已经存在返回false, 不存在返回true
*/
public boolean setIfAbsent(String key, String value) {
return redisTemplate.opsForValue().setIfAbsent(key, value);
}
/**
* 用 value 参数覆写给定 key 所储存的字符串值,从偏移量 offset 开始 * 用 value 参数覆写给定 key 所储存的字符串值,从偏移量 offset 开始
* *
* @param key * @param key
...@@ -305,15 +283,6 @@ public class RedisUtil { ...@@ -305,15 +283,6 @@ public class RedisUtil {
redisTemplate.opsForValue().multiSet(maps); redisTemplate.opsForValue().multiSet(maps);
} }
/**
* 同时设置一个或多个 key-value 对,当且仅当所有给定 key 都不存在
*
* @param maps
* @return 之前已经存在返回false, 不存在返回true
*/
public boolean multiSetIfAbsent(Map<String, String> maps) {
return redisTemplate.opsForValue().multiSetIfAbsent(maps);
}
/** /**
* 增加(自增长), 负数则为自减 * 增加(自增长), 负数则为自减
...@@ -344,7 +313,7 @@ public class RedisUtil { ...@@ -344,7 +313,7 @@ public class RedisUtil {
return redisTemplate.opsForValue().append(key, value); return redisTemplate.opsForValue().append(key, value);
} }
/** -------------------hash相关操作------------------------- */ /* -------------------hash相关操作------------------------- */
/** /**
* 获取存储在哈希表中指定字段的值 * 获取存储在哈希表中指定字段的值
...@@ -485,7 +454,7 @@ public class RedisUtil { ...@@ -485,7 +454,7 @@ public class RedisUtil {
return redisTemplate.opsForHash().scan(key, options); return redisTemplate.opsForHash().scan(key, options);
} }
/** ------------------------list相关操作---------------------------- */ /* ------------------------list相关操作---------------------------- */
/** /**
* 通过索引获取列表中的元素 * 通过索引获取列表中的元素
...@@ -728,7 +697,7 @@ public class RedisUtil { ...@@ -728,7 +697,7 @@ public class RedisUtil {
return redisTemplate.opsForList().size(key); return redisTemplate.opsForList().size(key);
} }
/** --------------------set相关操作-------------------------- */ /* --------------------set相关操作-------------------------- */
/** /**
* set添加元素 * set添加元素
...@@ -991,7 +960,7 @@ public class RedisUtil { ...@@ -991,7 +960,7 @@ public class RedisUtil {
return redisTemplate.opsForSet().scan(key, options); return redisTemplate.opsForSet().scan(key, options);
} }
/**------------------zSet相关操作--------------------------------*/ /*------------------zSet相关操作--------------------------------*/
/** /**
* 添加元素,有序集合是按照元素的score值由小到大排列 * 添加元素,有序集合是按照元素的score值由小到大排列
......
...@@ -11,31 +11,29 @@ import com.fzm.common.enums.ResultCode; ...@@ -11,31 +11,29 @@ import com.fzm.common.enums.ResultCode;
import com.fzm.common.exception.GlobalException; import com.fzm.common.exception.GlobalException;
import com.fzm.common.properties.DebugProperties; import com.fzm.common.properties.DebugProperties;
import com.fzm.common.properties.SmsProperties; import com.fzm.common.properties.SmsProperties;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import java.util.Date;
import java.util.*; import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
/** /**
* @author tangtuo * @author tangtuo
* @date 2021/6/28 16:02 * @date 2021/6/28 16:02
*/ */
@Component @Component
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class SmsUtil { public class SmsUtil {
private final SmsProperties smsProperties;
@Resource private final DebugProperties debugProperties;
private SmsProperties smsProperties;
@Resource
private DebugProperties debugProperties;
public static String getStringToSignOfStr(Map<String, Object> map) { public static String getStringToSignOfStr(Map<String, Object> map) {
TreeMap<String, String> treeMap = new TreeMap<>(); TreeMap<String, String> treeMap = new TreeMap<>();
Iterator<String> iterator = map.keySet().iterator(); for (String key : map.keySet()) {
while (iterator.hasNext()) {
String key = iterator.next();
treeMap.put(key, map.get(key).toString()); treeMap.put(key, map.get(key).toString());
} }
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
...@@ -99,11 +97,10 @@ public class SmsUtil { ...@@ -99,11 +97,10 @@ public class SmsUtil {
* *
* @param mobile * @param mobile
* @param fee * @param fee
* @return
*/ */
public Boolean sendRefundSms(String mobile, String fee) { public void sendRefundSms(String mobile, String fee) {
if (debugProperties.getSms()) { if (debugProperties.getSms()) {
return true; return;
} }
String timestamp = getTimestamp(); String timestamp = getTimestamp();
...@@ -119,13 +116,12 @@ public class SmsUtil { ...@@ -119,13 +116,12 @@ public class SmsUtil {
header("FZM-Ca-AppKey", smsProperties.getAppKey()). header("FZM-Ca-AppKey", smsProperties.getAppKey()).
header("FZM-Ca-Signature", sign).form(params).execute(); header("FZM-Ca-Signature", sign).form(params).execute();
if (response == null || StringUtils.isBlank(response.body())) { if (response == null || StringUtils.isBlank(response.body())) {
return false; return;
} }
JSONObject jsonObject = JSONUtil.parseObj(response.body()); JSONObject jsonObject = JSONUtil.parseObj(response.body());
if (jsonObject.get("code", Integer.class) != HttpStatus.HTTP_OK) { if (jsonObject.get("code", Integer.class) != HttpStatus.HTTP_OK) {
throw GlobalException.newException(ResultCode.CODE_ERROR, jsonObject.getStr("message")); throw GlobalException.newException(ResultCode.CODE_ERROR, jsonObject.getStr("message"));
} }
return true;
} }
/** /**
......
...@@ -4,23 +4,20 @@ import cn.hutool.core.lang.Snowflake; ...@@ -4,23 +4,20 @@ import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.net.NetUtil; import cn.hutool.core.net.NetUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
@Component @Component
@Slf4j
public class SnowflakeUtil { public class SnowflakeUtil {
@JsonFormat(shape = JsonFormat.Shape.STRING) @JsonFormat(shape = JsonFormat.Shape.STRING)
private long workerId = 0;//为终端ID private long workerId = 0;//为终端ID
private long datacenterId = 1;//数据中心ID private final long datacenterId = 1;//数据中心ID
private Snowflake snowflake = IdUtil.createSnowflake(workerId, datacenterId); private final Snowflake snowflake = IdUtil.createSnowflake(workerId, datacenterId);
@PostConstruct @PostConstruct
public void init() { public void init() {
workerId = NetUtil.ipv4ToLong(NetUtil.getLocalhostStr()); workerId = NetUtil.ipv4ToLong(NetUtil.getLocalhostStr());
log.info("当前机器的workId:{}", workerId);
} }
public long snowflakeId() { public long snowflakeId() {
......
...@@ -33,8 +33,7 @@ public class TencentApi { ...@@ -33,8 +33,7 @@ public class TencentApi {
req.setImageBase64(imageBase64); req.setImageBase64(imageBase64);
// 返回的resp是一个IdCardOCRVerificationResponse的实例,与请求对象对应 // 返回的resp是一个IdCardOCRVerificationResponse的实例,与请求对象对应
try { try {
IdCardOCRVerificationResponse resp = client.IdCardOCRVerification(req); return client.IdCardOCRVerification(req);
return resp;
} catch (TencentCloudSDKException e) { } catch (TencentCloudSDKException e) {
throw GlobalException.newException(ResultCode.ID_CARD_VERIFICATION_ERROR, "实名认证失败,失败原因: " + e.getMessage()); throw GlobalException.newException(ResultCode.ID_CARD_VERIFICATION_ERROR, "实名认证失败,失败原因: " + e.getMessage());
} }
......
package com.fzm.portal.aop; package com.fzm.portal.aop;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
...@@ -8,6 +9,7 @@ import org.aspectj.lang.annotation.Aspect; ...@@ -8,6 +9,7 @@ import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature; import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
...@@ -15,7 +17,6 @@ import org.springframework.web.bind.annotation.PathVariable; ...@@ -15,7 +17,6 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.lang.reflect.Parameter; import java.lang.reflect.Parameter;
...@@ -32,12 +33,12 @@ import java.util.Map; ...@@ -32,12 +33,12 @@ import java.util.Map;
@Order(1) @Order(1)
@Component @Component
@Aspect @Aspect
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class LogAop { public class LogAop {
@Resource private final HttpServletRequest request;
private HttpServletRequest request;
private static ThreadLocal<Long> threadLocal = new ThreadLocal<>(); private static final ThreadLocal<Long> threadLocal = new ThreadLocal<>();
@Pointcut(value = "execution(public * com.fzm.portal.controller..*.*(..))") @Pointcut(value = "execution(public * com.fzm.portal.controller..*.*(..))")
public void pointCut() { public void pointCut() {
......
...@@ -6,12 +6,13 @@ import com.fzm.common.model.ResponseModel; ...@@ -6,12 +6,13 @@ import com.fzm.common.model.ResponseModel;
import com.fzm.common.service.AuthorityService; import com.fzm.common.service.AuthorityService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
...@@ -21,10 +22,10 @@ import java.util.List; ...@@ -21,10 +22,10 @@ import java.util.List;
@RestController @RestController
@RequestMapping("/authority") @RequestMapping("/authority")
@Api(tags = "权力") @Api(tags = "权力")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class AuthorityController { public class AuthorityController {
@Resource private final AuthorityService authorityService;
private AuthorityService authorityService;
@GetMapping("/list") @GetMapping("/list")
......
...@@ -5,11 +5,12 @@ import com.fzm.common.model.ResponseModel; ...@@ -5,11 +5,12 @@ import com.fzm.common.model.ResponseModel;
import com.fzm.common.service.BannerService; import com.fzm.common.service.BannerService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
...@@ -19,10 +20,10 @@ import java.util.List; ...@@ -19,10 +20,10 @@ import java.util.List;
@RestController @RestController
@RequestMapping("/banner") @RequestMapping("/banner")
@Api(tags = "banner页管理") @Api(tags = "banner页管理")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class BannerController { public class BannerController {
@Resource private final BannerService bannerService;
private BannerService bannerService;
@GetMapping("/list") @GetMapping("/list")
@ApiOperation(value = "查询banner页列表") @ApiOperation(value = "查询banner页列表")
......
...@@ -5,11 +5,12 @@ import com.fzm.common.model.ResponseModel; ...@@ -5,11 +5,12 @@ import com.fzm.common.model.ResponseModel;
import com.fzm.common.service.CategoryService; import com.fzm.common.service.CategoryService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
...@@ -19,10 +20,10 @@ import java.util.List; ...@@ -19,10 +20,10 @@ import java.util.List;
@RestController @RestController
@RequestMapping(value = "/category") @RequestMapping(value = "/category")
@Api(tags = "类目管理") @Api(tags = "类目管理")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CategoryController { public class CategoryController {
@Resource private final CategoryService categoryService;
private CategoryService categoryService;
@GetMapping("/list") @GetMapping("/list")
@ApiOperation(value = "查询所有类目信息") @ApiOperation(value = "查询所有类目信息")
......
...@@ -7,13 +7,13 @@ import com.fzm.common.service.ChargeService; ...@@ -7,13 +7,13 @@ import com.fzm.common.service.ChargeService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/** /**
* @author tangtuo * @author tangtuo
* @date 2022/1/25 10:13 * @date 2022/1/25 10:13
...@@ -22,10 +22,10 @@ import javax.annotation.Resource; ...@@ -22,10 +22,10 @@ import javax.annotation.Resource;
@RestController @RestController
@RequestMapping(value = "/charge") @RequestMapping(value = "/charge")
@Api(tags = "收费管理") @Api(tags = "收费管理")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class ChargeController { public class ChargeController {
@Resource private final ChargeService chargeService;
private ChargeService chargeService;
@GetMapping("/fee/{type}") @GetMapping("/fee/{type}")
......
...@@ -7,9 +7,10 @@ import com.fzm.common.service.NftService; ...@@ -7,9 +7,10 @@ import com.fzm.common.service.NftService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
...@@ -19,10 +20,10 @@ import java.util.List; ...@@ -19,10 +20,10 @@ import java.util.List;
@RestController @RestController
@RequestMapping(value = "/collection") @RequestMapping(value = "/collection")
@Api(tags = "收藏") @Api(tags = "收藏")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CollectionController { public class CollectionController {
@Resource private final NftService nftService;
private NftService nftService;
@Authentication @Authentication
......
...@@ -18,13 +18,14 @@ import com.fzm.common.utils.RedisUtil; ...@@ -18,13 +18,14 @@ import com.fzm.common.utils.RedisUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.redisson.api.RSemaphore; import org.redisson.api.RSemaphore;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
...@@ -35,25 +36,14 @@ import java.util.List; ...@@ -35,25 +36,14 @@ import java.util.List;
@RestController @RestController
@RequestMapping(value = "/commemorate/nft") @RequestMapping(value = "/commemorate/nft")
@Api(tags = "纪念版nft") @Api(tags = "纪念版nft")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CommemorateNftController { public class CommemorateNftController {
private final CommemorateNftService commemorateNftService;
@Resource private final ObsUtil obsUtil;
private CommemorateNftService commemorateNftService; private final UserService userService;
private final CategoryService categoryService;
@Resource private final RedissonClient redisson;
private ObsUtil obsUtil; private final RedisUtil redisUtil;
@Resource
private UserService userService;
@Resource
private CategoryService categoryService;
@Resource
private RedissonClient redisson;
@Resource
private RedisUtil redisUtil;
@Authentication @Authentication
@PostMapping("/publish") @PostMapping("/publish")
...@@ -67,7 +57,11 @@ public class CommemorateNftController { ...@@ -67,7 +57,11 @@ public class CommemorateNftController {
if (file == null || cover == null) { if (file == null || cover == null) {
throw GlobalException.newException(ResultCode.VALIDATE_FAILED, "文件不能为空"); throw GlobalException.newException(ResultCode.VALIDATE_FAILED, "文件不能为空");
} }
String coverName = cover.getOriginalFilename().toLowerCase(); String originalFilename = cover.getOriginalFilename();
if (StringUtils.isBlank(originalFilename)) {
throw GlobalException.newException(ResultCode.VALIDATE_FAILED, "文件名不能为空");
}
String coverName = originalFilename.toLowerCase();
if (!coverName.endsWith(".png") && !coverName.endsWith(".jpg")) { if (!coverName.endsWith(".png") && !coverName.endsWith(".jpg")) {
throw GlobalException.newException(ResultCode.FILE_UPLOAD_ERROR, "封面类型有误"); throw GlobalException.newException(ResultCode.FILE_UPLOAD_ERROR, "封面类型有误");
} }
......
...@@ -9,16 +9,17 @@ import com.fzm.common.entity.vo.CopyrightVo; ...@@ -9,16 +9,17 @@ import com.fzm.common.entity.vo.CopyrightVo;
import com.fzm.common.enums.CopyrightApplyState; import com.fzm.common.enums.CopyrightApplyState;
import com.fzm.common.enums.ResultCode; import com.fzm.common.enums.ResultCode;
import com.fzm.common.exception.GlobalException; import com.fzm.common.exception.GlobalException;
import com.fzm.common.interceptor.LoginUserInfo;
import com.fzm.common.model.ResponseModel; import com.fzm.common.model.ResponseModel;
import com.fzm.common.service.CopyrightApplyService; import com.fzm.common.service.CopyrightApplyService;
import com.fzm.common.utils.JwtUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
...@@ -30,10 +31,10 @@ import java.util.concurrent.ExecutionException; ...@@ -30,10 +31,10 @@ import java.util.concurrent.ExecutionException;
@RestController @RestController
@Api(tags = "版权申请") @Api(tags = "版权申请")
@RequestMapping("/copyright/apply") @RequestMapping("/copyright/apply")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CopyrightApplyController { public class CopyrightApplyController {
@Resource private final CopyrightApplyService copyrightApplyService;
private CopyrightApplyService copyrightApplyService;
@Authentication @Authentication
@PostMapping("/submit") @PostMapping("/submit")
...@@ -47,8 +48,8 @@ public class CopyrightApplyController { ...@@ -47,8 +48,8 @@ public class CopyrightApplyController {
@Authentication @Authentication
@GetMapping("/list") @GetMapping("/list")
@ApiOperation(value = "查询版权登记列表") @ApiOperation(value = "查询版权登记列表")
public ResponseModel<List<CopyrightApply>> list(@RequestHeader(value = "Authorization") String token, @ApiParam("状态 0-全部 1-进行中 2-已完成") @RequestParam Integer state) { public ResponseModel<List<CopyrightApply>> list(@ApiParam("状态 0-全部 1-进行中 2-已完成") @RequestParam Integer state) {
Integer userId = JwtUtil.getUserIdFromToken(token); Integer userId = LoginUserInfo.getLoginUser().getUserId();
List<CopyrightApply> list = copyrightApplyService.list(userId, state); List<CopyrightApply> list = copyrightApplyService.list(userId, state);
return ResponseModel.success(list); return ResponseModel.success(list);
} }
......
...@@ -8,12 +8,14 @@ import com.fzm.common.model.ResponseModel; ...@@ -8,12 +8,14 @@ import com.fzm.common.model.ResponseModel;
import com.fzm.common.utils.ObsUtil; import com.fzm.common.utils.ObsUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
/** /**
...@@ -24,12 +26,12 @@ import java.io.IOException; ...@@ -24,12 +26,12 @@ import java.io.IOException;
@Authentication @Authentication
@RestController @RestController
@RequestMapping(value = "/copyright/file") @RequestMapping(value = "/copyright/file")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CopyrightFileController { public class CopyrightFileController {
private static final long maxSize = 1024 * 1024 * 200; private static final long maxSize = 1024 * 1024 * 200;
@Resource private final ObsUtil obsUtil;
private ObsUtil obsUtil;
@PostMapping("/upload") @PostMapping("/upload")
@ApiOperation(value = "上传版权申请附件") @ApiOperation(value = "上传版权申请附件")
...@@ -39,6 +41,9 @@ public class CopyrightFileController { ...@@ -39,6 +41,9 @@ public class CopyrightFileController {
throw GlobalException.newException(ResultCode.FILE_UPLOAD_ERROR, "单个文件最大支持200M"); throw GlobalException.newException(ResultCode.FILE_UPLOAD_ERROR, "单个文件最大支持200M");
} }
String fileName = file.getOriginalFilename(); String fileName = file.getOriginalFilename();
if (StringUtils.isBlank(fileName)) {
throw GlobalException.newException(ResultCode.VALIDATE_FAILED, "文件名不能为空");
}
String fileSuffix = fileName.substring(fileName.lastIndexOf(".") + 1); String fileSuffix = fileName.substring(fileName.lastIndexOf(".") + 1);
if (!FileSuffix.validFileType(fileSuffix)) { if (!FileSuffix.validFileType(fileSuffix)) {
throw GlobalException.newException(ResultCode.FILE_UPLOAD_ERROR, "不支持当前上传的文件类型"); throw GlobalException.newException(ResultCode.FILE_UPLOAD_ERROR, "不支持当前上传的文件类型");
......
...@@ -5,16 +5,17 @@ import com.fzm.common.entity.CopyrightOwner; ...@@ -5,16 +5,17 @@ import com.fzm.common.entity.CopyrightOwner;
import com.fzm.common.enums.OwnerType; import com.fzm.common.enums.OwnerType;
import com.fzm.common.enums.ResultCode; import com.fzm.common.enums.ResultCode;
import com.fzm.common.exception.GlobalException; import com.fzm.common.exception.GlobalException;
import com.fzm.common.interceptor.LoginUserInfo;
import com.fzm.common.model.ResponseModel; import com.fzm.common.model.ResponseModel;
import com.fzm.common.service.CopyrightOwnerService; import com.fzm.common.service.CopyrightOwnerService;
import com.fzm.common.utils.JwtUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
...@@ -25,14 +26,14 @@ import java.util.List; ...@@ -25,14 +26,14 @@ import java.util.List;
@RestController @RestController
@RequestMapping("/copyright/owner") @RequestMapping("/copyright/owner")
@Api(tags = "著作权人") @Api(tags = "著作权人")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CopyrightOwnerController { public class CopyrightOwnerController {
@Resource private final CopyrightOwnerService copyrightOwnerService;
private CopyrightOwnerService copyrightOwnerService;
@PostMapping(value = "/add") @PostMapping(value = "/add")
@ApiOperation(value = "新增著作权人") @ApiOperation(value = "新增著作权人")
public ResponseModel<Integer> add(@RequestHeader String Authorization, @Validated @RequestBody CopyrightOwner owner) { public ResponseModel<Integer> add(@Validated @RequestBody CopyrightOwner owner) {
// 如果著作权人是个人的话,身份证正反面照片 著作权人手持身份证照片等信息必传 // 如果著作权人是个人的话,身份证正反面照片 著作权人手持身份证照片等信息必传
if (owner.getType().equals(OwnerType.PERSON.getType())) { if (owner.getType().equals(OwnerType.PERSON.getType())) {
if (StringUtils.isAnyBlank(owner.getBackPhoto(), owner.getPositivePhoto(), owner.getPersonalPhoto())) { if (StringUtils.isAnyBlank(owner.getBackPhoto(), owner.getPositivePhoto(), owner.getPersonalPhoto())) {
...@@ -44,7 +45,7 @@ public class CopyrightOwnerController { ...@@ -44,7 +45,7 @@ public class CopyrightOwnerController {
throw GlobalException.newException(ResultCode.VALIDATE_FAILED); throw GlobalException.newException(ResultCode.VALIDATE_FAILED);
} }
} }
Integer userId = JwtUtil.getUserIdFromToken(Authorization); Integer userId = LoginUserInfo.getLoginUser().getUserId();
owner.setUserId(userId); owner.setUserId(userId);
copyrightOwnerService.save(owner); copyrightOwnerService.save(owner);
return ResponseModel.success(owner.getId()); return ResponseModel.success(owner.getId());
...@@ -52,8 +53,8 @@ public class CopyrightOwnerController { ...@@ -52,8 +53,8 @@ public class CopyrightOwnerController {
@GetMapping(value = "/list") @GetMapping(value = "/list")
@ApiOperation(value = "获取我的著作权人列表") @ApiOperation(value = "获取我的著作权人列表")
public ResponseModel<List<CopyrightOwner>> list(@RequestHeader(value = "Authorization") String token) { public ResponseModel<List<CopyrightOwner>> list() {
Integer userId = JwtUtil.getUserIdFromToken(token); Integer userId = LoginUserInfo.getLoginUser().getUserId();
List<CopyrightOwner> list = copyrightOwnerService.getByUserId(userId); List<CopyrightOwner> list = copyrightOwnerService.getByUserId(userId);
return ResponseModel.success(list); return ResponseModel.success(list);
} }
......
...@@ -3,14 +3,15 @@ package com.fzm.portal.controller; ...@@ -3,14 +3,15 @@ package com.fzm.portal.controller;
import com.fzm.common.annotation.Authentication; import com.fzm.common.annotation.Authentication;
import com.fzm.common.entity.Draft; import com.fzm.common.entity.Draft;
import com.fzm.common.entity.dto.DraftDTO; import com.fzm.common.entity.dto.DraftDTO;
import com.fzm.common.interceptor.LoginUserInfo;
import com.fzm.common.model.ResponseModel; import com.fzm.common.model.ResponseModel;
import com.fzm.common.service.DraftService; import com.fzm.common.service.DraftService;
import com.fzm.common.utils.JwtUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
...@@ -21,23 +22,23 @@ import java.util.List; ...@@ -21,23 +22,23 @@ import java.util.List;
@RestController @RestController
@RequestMapping("/Draft") @RequestMapping("/Draft")
@Api(tags = "草稿管理") @Api(tags = "草稿管理")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class DraftController { public class DraftController {
@Resource private final DraftService draftService;
private DraftService draftService;
@PostMapping("/save") @PostMapping("/save")
@ApiOperation(value = "保存草稿") @ApiOperation(value = "保存草稿")
public ResponseModel<Integer> save(@RequestHeader(value = "Authorization") String token, @RequestBody DraftDTO draft) { public ResponseModel<Integer> save(@RequestBody DraftDTO draft) {
draft.setUserId(JwtUtil.getUserIdFromToken(token)); draft.setUserId(LoginUserInfo.getLoginUser().getUserId());
Integer id = draftService.saveDraft(draft); Integer id = draftService.saveDraft(draft);
return ResponseModel.success(id); return ResponseModel.success(id);
} }
@GetMapping("/list") @GetMapping("/list")
@ApiOperation(value = "查询我的草稿列表") @ApiOperation(value = "查询我的草稿列表")
public ResponseModel<List<Draft>> list(@RequestHeader(value = "Authorization") String token) { public ResponseModel<List<Draft>> list() {
Integer userId = JwtUtil.getUserIdFromToken(token); Integer userId = LoginUserInfo.getLoginUser().getUserId();
List<Draft> list = draftService.getByUserId(userId); List<Draft> list = draftService.getByUserId(userId);
return ResponseModel.success(list); return ResponseModel.success(list);
} }
......
...@@ -8,11 +8,11 @@ import com.fzm.common.valid.InsertGroup; ...@@ -8,11 +8,11 @@ import com.fzm.common.valid.InsertGroup;
import com.fzm.common.valid.UpdateGroup; import com.fzm.common.valid.UpdateGroup;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/** /**
* @author tangtuo * @author tangtuo
* @date 2022/1/11 17:19 * @date 2022/1/11 17:19
...@@ -21,11 +21,10 @@ import javax.annotation.Resource; ...@@ -21,11 +21,10 @@ import javax.annotation.Resource;
@RestController @RestController
@RequestMapping("/entrust/shelf") @RequestMapping("/entrust/shelf")
@Api(tags = "委托上架") @Api(tags = "委托上架")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class EntrustShelfController { public class EntrustShelfController {
private final EntrustShelfService entrustShelfService;
@Resource
private EntrustShelfService entrustShelfService;
@PostMapping("/submit") @PostMapping("/submit")
......
...@@ -6,12 +6,13 @@ import com.fzm.common.service.FileTemplateService; ...@@ -6,12 +6,13 @@ import com.fzm.common.service.FileTemplateService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
...@@ -21,10 +22,10 @@ import java.util.List; ...@@ -21,10 +22,10 @@ import java.util.List;
@RestController @RestController
@RequestMapping("/file/template") @RequestMapping("/file/template")
@Api(tags = "文件模板") @Api(tags = "文件模板")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class FileTemplateController { public class FileTemplateController {
@Resource private final FileTemplateService fileTemplateService;
private FileTemplateService fileTemplateService;
@GetMapping("/list/{type}") @GetMapping("/list/{type}")
@ApiOperation(value = "根据类型查询文件列表") @ApiOperation(value = "根据类型查询文件列表")
......
...@@ -11,23 +11,23 @@ import com.fzm.common.entity.vo.NftVo; ...@@ -11,23 +11,23 @@ import com.fzm.common.entity.vo.NftVo;
import com.fzm.common.enums.CopyrightApplyState; import com.fzm.common.enums.CopyrightApplyState;
import com.fzm.common.enums.ResultCode; import com.fzm.common.enums.ResultCode;
import com.fzm.common.exception.GlobalException; import com.fzm.common.exception.GlobalException;
import com.fzm.common.interceptor.LoginUserInfo;
import com.fzm.common.model.ResponseModel; import com.fzm.common.model.ResponseModel;
import com.fzm.common.params.NftTransferParam; import com.fzm.common.params.NftTransferParam;
import com.fzm.common.service.NftService; import com.fzm.common.service.NftService;
import com.fzm.common.service.UserService; import com.fzm.common.service.UserService;
import com.fzm.common.utils.JsonUtil; import com.fzm.common.utils.JsonUtil;
import com.fzm.common.utils.JwtUtil;
import com.fzm.common.utils.QRCodeUtil; import com.fzm.common.utils.QRCodeUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -42,17 +42,11 @@ import java.util.concurrent.ExecutionException; ...@@ -42,17 +42,11 @@ import java.util.concurrent.ExecutionException;
@RestController @RestController
@RequestMapping(value = "/nft") @RequestMapping(value = "/nft")
@Api(tags = "nft管理") @Api(tags = "nft管理")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class NftController { public class NftController {
@Resource private final NftService nftService;
private NftService nftService; private final UserService userService;
@Resource
private UserService userService;
@Resource
private HttpServletRequest request;
@Authentication @Authentication
@PostMapping("/save") @PostMapping("/save")
...@@ -95,8 +89,8 @@ public class NftController { ...@@ -95,8 +89,8 @@ public class NftController {
@Authentication @Authentication
@GetMapping("/list/current") @GetMapping("/list/current")
@ApiOperation(value = "获取我的nft列表") @ApiOperation(value = "获取我的nft列表")
public ResponseModel<Map<String, Object>> listCurrent(@ApiParam(value = "类目id,查询全部的时候传null") @RequestParam(required = false) Integer categoryId) throws Exception { public ResponseModel<Map<String, Object>> listCurrent(@ApiParam(value = "类目id,查询全部的时候传null") @RequestParam(required = false) Integer categoryId) {
Integer userId = JwtUtil.getUserIdFromToken(request.getHeader("Authorization")); Integer userId = LoginUserInfo.getLoginUser().getUserId();
List<CollectionNftVo> list = nftService.listCurrent(categoryId, userId); List<CollectionNftVo> list = nftService.listCurrent(categoryId, userId);
User user = userService.getById(userId); User user = userService.getById(userId);
// 生成二维码 // 生成二维码
...@@ -132,12 +126,12 @@ public class NftController { ...@@ -132,12 +126,12 @@ public class NftController {
@Authentication @Authentication
@GetMapping("/certificate/{id}") @GetMapping("/certificate/{id}")
@ApiOperation(value = "nft证书") @ApiOperation(value = "nft证书")
public ResponseModel<NftCertificateVo> certificate(@PathVariable Integer id, @RequestHeader String Authorization) throws Exception { public ResponseModel<NftCertificateVo> certificate(@PathVariable Integer id) {
Nft nft = nftService.getById(id); Nft nft = nftService.getById(id);
if (nft == null) { if (nft == null) {
throw GlobalException.newException(ResultCode.DATA_ERROR, "没找到此nft的详情"); throw GlobalException.newException(ResultCode.DATA_ERROR, "没找到此nft的详情");
} }
int userId = JwtUtil.getUserIdFromToken(Authorization); int userId = LoginUserInfo.getLoginUser().getUserId();
if (!nft.getUserId().equals(userId)) { if (!nft.getUserId().equals(userId)) {
throw GlobalException.newException(ResultCode.FORBIDDEN, "您无权查看别人的nft证书"); throw GlobalException.newException(ResultCode.FORBIDDEN, "您无权查看别人的nft证书");
} }
...@@ -176,8 +170,8 @@ public class NftController { ...@@ -176,8 +170,8 @@ public class NftController {
@Authentication @Authentication
@ApiOperation(value = "查询用户还未成功申请版权的nft列表") @ApiOperation(value = "查询用户还未成功申请版权的nft列表")
@GetMapping(value = "/list/copyright") @GetMapping(value = "/list/copyright")
public ResponseModel<List<CollectionNftVo>> listCopyright(@RequestHeader(value = "Authorization") String token) { public ResponseModel<List<CollectionNftVo>> listCopyright() {
Integer userId = JwtUtil.getUserIdFromToken(token); Integer userId = LoginUserInfo.getLoginUser().getUserId();
List<CollectionNftVo> list = nftService.listCopyright(userId); List<CollectionNftVo> list = nftService.listCopyright(userId);
return ResponseModel.success(list); return ResponseModel.success(list);
} }
......
...@@ -7,13 +7,14 @@ import com.fzm.common.service.NftTransferRecordService; ...@@ -7,13 +7,14 @@ import com.fzm.common.service.NftTransferRecordService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
...@@ -25,10 +26,10 @@ import java.util.List; ...@@ -25,10 +26,10 @@ import java.util.List;
@Authentication @Authentication
@RequestMapping(value = "/nft/transfer/record") @RequestMapping(value = "/nft/transfer/record")
@Api(tags = "nft转让记录") @Api(tags = "nft转让记录")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class NftTransferRecordController { public class NftTransferRecordController {
@Resource private final NftTransferRecordService nftTransferRecordService;
private NftTransferRecordService nftTransferRecordService;
@GetMapping("/list/{type}") @GetMapping("/list/{type}")
@ApiOperation(value = "查询我的nft流转记录") @ApiOperation(value = "查询我的nft流转记录")
......
...@@ -5,11 +5,12 @@ import com.fzm.common.model.ResponseModel; ...@@ -5,11 +5,12 @@ import com.fzm.common.model.ResponseModel;
import com.fzm.common.service.OpusCategoryService; import com.fzm.common.service.OpusCategoryService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
...@@ -19,10 +20,10 @@ import java.util.List; ...@@ -19,10 +20,10 @@ import java.util.List;
@Api(tags = "作品类别") @Api(tags = "作品类别")
@RestController @RestController
@RequestMapping("/opus/category") @RequestMapping("/opus/category")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class OpusCategoryController { public class OpusCategoryController {
@Resource private final OpusCategoryService opusCategoryService;
private OpusCategoryService opusCategoryService;
@GetMapping("/list") @GetMapping("/list")
@ApiOperation(value = "查询作品类别列表") @ApiOperation(value = "查询作品类别列表")
......
...@@ -9,9 +9,10 @@ import com.fzm.common.model.ResponseModel; ...@@ -9,9 +9,10 @@ import com.fzm.common.model.ResponseModel;
import com.fzm.common.service.OrderService; import com.fzm.common.service.OrderService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
...@@ -23,10 +24,10 @@ import java.util.List; ...@@ -23,10 +24,10 @@ import java.util.List;
@Api(tags = "订单管理") @Api(tags = "订单管理")
@RestController @RestController
@RequestMapping("/order") @RequestMapping("/order")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class OrderController { public class OrderController {
@Resource private final OrderService orderService;
private OrderService orderService;
@PostMapping("/create") @PostMapping("/create")
......
...@@ -5,13 +5,14 @@ import com.fzm.common.model.ResponseModel; ...@@ -5,13 +5,14 @@ import com.fzm.common.model.ResponseModel;
import com.fzm.common.utils.ObsUtil; import com.fzm.common.utils.ObsUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
/** /**
...@@ -21,10 +22,10 @@ import java.io.IOException; ...@@ -21,10 +22,10 @@ import java.io.IOException;
@RestController @RestController
@RequestMapping("/oss") @RequestMapping("/oss")
@Api(tags = "oss相关") @Api(tags = "oss相关")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class OssController { public class OssController {
@Resource private final ObsUtil obsUtil;
private ObsUtil obsUtil;
@Authentication @Authentication
......
...@@ -6,6 +6,7 @@ import com.fzm.common.constant.TokenConstant; ...@@ -6,6 +6,7 @@ import com.fzm.common.constant.TokenConstant;
import com.fzm.common.entity.User; import com.fzm.common.entity.User;
import com.fzm.common.enums.ResultCode; import com.fzm.common.enums.ResultCode;
import com.fzm.common.exception.GlobalException; import com.fzm.common.exception.GlobalException;
import com.fzm.common.interceptor.LoginUserInfo;
import com.fzm.common.model.ResponseModel; import com.fzm.common.model.ResponseModel;
import com.fzm.common.params.LoginParam; import com.fzm.common.params.LoginParam;
import com.fzm.common.service.UserService; import com.fzm.common.service.UserService;
...@@ -16,12 +17,13 @@ import com.tencentcloudapi.faceid.v20180301.models.IdCardOCRVerificationResponse ...@@ -16,12 +17,13 @@ import com.tencentcloudapi.faceid.v20180301.models.IdCardOCRVerificationResponse
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -34,16 +36,12 @@ import java.util.concurrent.TimeUnit; ...@@ -34,16 +36,12 @@ import java.util.concurrent.TimeUnit;
@RestController @RestController
@RequestMapping(value = "/user") @RequestMapping(value = "/user")
@Api(tags = "用户管理") @Api(tags = "用户管理")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class UserController { public class UserController {
@Resource private final UserService userService;
private UserService userService; private final ObsUtil obsUtil;
private final RedisUtil redisUtil;
@Resource
private ObsUtil obsUtil;
@Resource
private RedisUtil redisUtil;
@PostMapping(value = "/login") @PostMapping(value = "/login")
@ApiOperation(value = "登录|注册") @ApiOperation(value = "登录|注册")
...@@ -85,8 +83,8 @@ public class UserController { ...@@ -85,8 +83,8 @@ public class UserController {
@Authentication @Authentication
@PostMapping(value = "/logout") @PostMapping(value = "/logout")
@ApiOperation(value = "退出登录") @ApiOperation(value = "退出登录")
public ResponseModel<Boolean> logout(@RequestHeader String Authorization) { public ResponseModel<Boolean> logout() {
Integer userId = JwtUtil.getUserIdFromToken(Authorization); Integer userId = LoginUserInfo.getLoginUser().getUserId();
redisUtil.delete(RedisConstant.PORTAL_USER_TOKEN_PREFIX + userId); redisUtil.delete(RedisConstant.PORTAL_USER_TOKEN_PREFIX + userId);
return ResponseModel.success(); return ResponseModel.success();
} }
...@@ -99,8 +97,8 @@ public class UserController { ...@@ -99,8 +97,8 @@ public class UserController {
@Authentication @Authentication
@ApiOperation(value = "修改昵称 | 修改个性签名", notes = "用户修改哪项信息就传那一个参数就可以了") @ApiOperation(value = "修改昵称 | 修改个性签名", notes = "用户修改哪项信息就传那一个参数就可以了")
@PostMapping("/update") @PostMapping("/update")
public ResponseModel<User> update(@Validated @RequestBody User user, @RequestHeader String Authorization) { public ResponseModel<User> update(@Validated @RequestBody User user) {
Integer userId = JwtUtil.getUserIdFromToken(Authorization); Integer userId = LoginUserInfo.getLoginUser().getUserId();
user.setId(userId); user.setId(userId);
userService.updateById(user); userService.updateById(user);
return ResponseModel.success(userService.getById(userId)); return ResponseModel.success(userService.getById(userId));
......
...@@ -12,14 +12,14 @@ import io.swagger.annotations.Api; ...@@ -12,14 +12,14 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/** /**
* @author tangtuo * @author tangtuo
* @date 2021/6/23 15:56 * @date 2021/6/23 15:56
...@@ -27,17 +27,12 @@ import javax.annotation.Resource; ...@@ -27,17 +27,12 @@ import javax.annotation.Resource;
@RestController @RestController
@RequestMapping(value = "/verificationCode") @RequestMapping(value = "/verificationCode")
@Api(tags = "验证码管理") @Api(tags = "验证码管理")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class VerificationCodeController { public class VerificationCodeController {
private final UserService userService;
@Resource private final SmsProperties smsProperties;
private UserService userService; private final SmsUtil smsUtil;
@Resource
private SmsProperties smsProperties;
@Resource
private SmsUtil smsUtil;
@PostMapping(value = "/send/sms") @PostMapping(value = "/send/sms")
...@@ -67,6 +62,8 @@ public class VerificationCodeController { ...@@ -67,6 +62,8 @@ public class VerificationCodeController {
switch (type) { switch (type) {
case 1: case 1:
return smsProperties.getLoginMessageCodetype(); return smsProperties.getLoginMessageCodetype();
case 2:
case 3:
default: default:
throw GlobalException.newException(ResultCode.CODE_ERROR); throw GlobalException.newException(ResultCode.CODE_ERROR);
} }
......
...@@ -8,9 +8,10 @@ import com.fzm.common.model.ResponseModel; ...@@ -8,9 +8,10 @@ import com.fzm.common.model.ResponseModel;
import com.fzm.common.service.WxPayService; import com.fzm.common.service.WxPayService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
...@@ -24,10 +25,10 @@ import java.util.Map; ...@@ -24,10 +25,10 @@ import java.util.Map;
@Api(tags = "微信支付") @Api(tags = "微信支付")
@RestController @RestController
@RequestMapping("/wx-pay") @RequestMapping("/wx-pay")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class WxPayController { public class WxPayController {
@Resource private final WxPayService wxPayService;
private WxPayService wxPayService;
@Authentication @Authentication
@PostMapping("/pay/jsapi") @PostMapping("/pay/jsapi")
......
...@@ -7,13 +7,13 @@ import com.fzm.common.model.ResponseModel; ...@@ -7,13 +7,13 @@ import com.fzm.common.model.ResponseModel;
import com.fzm.common.service.NftService; import com.fzm.common.service.NftService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/** /**
* @author tangtuo * @author tangtuo
* @date 2021/12/22 14:13 * @date 2021/12/22 14:13
...@@ -21,10 +21,10 @@ import javax.annotation.Resource; ...@@ -21,10 +21,10 @@ import javax.annotation.Resource;
@RestController @RestController
@Api(tags = "对外服务") @Api(tags = "对外服务")
@RequestMapping("/open/nft") @RequestMapping("/open/nft")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class NftApiController { public class NftApiController {
@Resource private final NftService nftService;
private NftService nftService;
@GetMapping(value = "/hash") @GetMapping(value = "/hash")
@ApiOperation(value = "根据tokenId获取nft哈希") @ApiOperation(value = "根据tokenId获取nft哈希")
......
...@@ -16,41 +16,29 @@ import com.fzm.common.service.OrderService; ...@@ -16,41 +16,29 @@ import com.fzm.common.service.OrderService;
import com.fzm.common.service.UserService; import com.fzm.common.service.UserService;
import com.fzm.common.service.WxPayService; import com.fzm.common.service.WxPayService;
import com.fzm.common.utils.RedisUtil; import com.fzm.common.utils.RedisUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/** /**
* @author tangtuo * @author tangtuo
* @date 2022/1/21 16:49 * @date 2022/1/21 16:49
*/ */
@Slf4j @Slf4j
@Component @Component
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class NftListener { public class NftListener {
@Resource private final ParaChainClient paraChainClient;
private ParaChainClient paraChainClient; private final NftService nftService;
private final UserService userService;
@Resource private final RedisUtil redisUtil;
private NftService nftService; private final OrderService orderService;
private final WxPayService wxPayService;
@Resource private final NotifyPublisher notifyPublisher;
UserService userService;
@Resource
private RedisUtil redisUtil;
@Resource
private OrderService orderService;
@Resource
private WxPayService wxPayService;
@Resource
private NotifyPublisher notifyPublisher;
/** /**
* 监听nft发行结果 * 监听nft发行结果
......
...@@ -9,28 +9,24 @@ import com.fzm.common.enums.RefundLaunchChannel; ...@@ -9,28 +9,24 @@ import com.fzm.common.enums.RefundLaunchChannel;
import com.fzm.common.service.CopyrightApplyService; import com.fzm.common.service.CopyrightApplyService;
import com.fzm.common.service.NftService; import com.fzm.common.service.NftService;
import com.fzm.common.service.WxPayService; import com.fzm.common.service.WxPayService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/** /**
* @author tangtuo * @author tangtuo
* @date 2022/1/21 11:44 * @date 2022/1/21 11:44
*/ */
@Slf4j @Slf4j
@Component @Component
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class OrderListener { public class OrderListener {
@Resource private final NftService nftService;
private NftService nftService; private final CopyrightApplyService copyrightApplyService;
private final WxPayService wxPayService;
@Resource
private CopyrightApplyService copyrightApplyService;
@Resource
private WxPayService wxPayService;
@RabbitListener(queues = "order.process.queue") @RabbitListener(queues = "order.process.queue")
public void listenProcessOrder(OrderProcessMsg msg) throws Exception { public void listenProcessOrder(OrderProcessMsg msg) throws Exception {
......
...@@ -2,13 +2,14 @@ package com.fzm.portal.schedule; ...@@ -2,13 +2,14 @@ package com.fzm.portal.schedule;
import com.fzm.common.entity.Draft; import com.fzm.common.entity.Draft;
import com.fzm.common.service.DraftService; import com.fzm.common.service.DraftService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.redisson.Redisson; import org.redisson.Redisson;
import org.redisson.api.RLock; import org.redisson.api.RLock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
...@@ -18,13 +19,11 @@ import java.util.concurrent.TimeUnit; ...@@ -18,13 +19,11 @@ import java.util.concurrent.TimeUnit;
*/ */
@Slf4j @Slf4j
@Component @Component
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class DraftTask { public class DraftTask {
@Resource private final DraftService draftService;
private DraftService draftService; private final Redisson redisson;
@Resource
private Redisson redisson;
/** /**
* 删除创建时间大于7天的草稿 * 删除创建时间大于7天的草稿
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment