Commit aadccc00 authored by tangtuo's avatar tangtuo

debug

parent d651a897
......@@ -80,8 +80,8 @@ chain:
token-manager:
token-manager-key: 4e92bda2477ded0e7c07a9e3acd2370de8d7401c68cc83ee8376806db3121e77
title: user.p.FILMCHAIN.
cName: user.evm.0xdc173544bb1876b9811d679f0dd33acc03772c6694f34a9f51b79cbae8af10f4
cAddr: 1MHibNozeurswCpinxR9md147dYUUG3vRN
cName: user.evm.0xa038a372ab27d9038328932c98454e52390b94555a69ab9559e8ab14ff2e540f
cAddr: 1Nhju8CgSUmkQQwc7ECk4bFxnv48iRLNRX
copyright:
......
......@@ -31,7 +31,10 @@ public class RedisConstant {
*/
public static final String COMMEMORATE_NFT_MEMBERS_PREFIX = "commemorateNft:members:";
/**
* 微信支付的jsapi支付
*/
public static final String WX_PAY_JSAPI_PREFIX = "wx-pay:jsapi:";
}
......@@ -4,22 +4,48 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.stream.Stream;
/**
* @author tangtuo
* @date 2022/1/25 10:07
*/
@Data
@AllArgsConstructor
@TableName("tb_charge")
public class Charge {
public class Charge implements Comparable<Charge> {
@NotNull(message = "id不能为空")
@TableId(type = IdType.AUTO)
private Integer id;
@NotNull(message = "金额不能为空")
@Min(value = 0, message = "金额必须大于等于0")
@ApiModelProperty("收费金额")
private Long fee;
@NotNull(message = "收费类型不能为空")
@ApiModelProperty("收费类型 1-nft发行 2-版权申请")
private Integer type;
@Override
public int compareTo(Charge o) {
return -this.getFee().compareTo(o.getFee());
}
public static void main(String[] args) {
Charge charge1 = new Charge(1, 1L, 1);
Charge charge2 = new Charge(1, 3L, 1);
Charge charge3 = new Charge(1, 5L, 1);
Charge charge4 = new Charge(1, 2L, 1);
Stream.of(charge1, charge2, charge3, charge4).sorted(Comparator.reverseOrder()).forEach(System.out::println);
}
}
......@@ -3,6 +3,8 @@ package com.fzm.common.entity.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @author tangtuo
* @date 2022/1/19 15:09
......@@ -10,10 +12,11 @@ import lombok.Data;
@Data
public class OrderDto {
@NotNull(message = "订单金额不能为空")
@ApiModelProperty("订单价格")
private Long fee;
@NotNull(message = "支付场景不能为空")
@ApiModelProperty("支付场景 1-nft发行 2-版权申请")
private Integer payScene;
......
package com.fzm.common.entity.vo;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fzm.common.entity.Order;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @author tangtuo
* @date 2022/1/24 16:44
* @date 2022/1/19 15:33
*/
@Data
@NoArgsConstructor
public class OrderVo {
private Long id;
@ApiModelProperty("主键")
private String id;
@ApiModelProperty("订单名")
private String orderName;
@ApiModelProperty("支付场景 1-nft发行 2-版权申请")
private Integer payScene;
@ApiModelProperty("产品id nft主键或者版权主键")
private Integer productId;
@ApiModelProperty("用户id")
private Integer userId;
@ApiModelProperty("订单价格-单位(分)")
private Long fee;
@ApiModelProperty("0-支付中 1-支付成功 2-订单已关闭 3-已退款")
private Integer orderStatus;
@ApiModelProperty("支付类型 1-微信支付 2-支付宝支付")
private Integer payType;
@ApiModelProperty("创建时间")
private Date createDate;
@ApiModelProperty("最后一次修改时间")
private Date updateDate;
private Integer categoryId;
public OrderVo(Order order) {
BeanUtil.copyProperties(order, this, true);
}
}
......@@ -11,7 +11,7 @@ import lombok.Getter;
@Getter
public enum OrderStatus {
// 支付中
// 待支付
PAYING(0),
// 支付成功
......@@ -26,7 +26,7 @@ public enum OrderStatus {
// 退款成功
REFUNDED(4),
// 订单已取消(已关闭)
// 订单已取消
CANCEL(5),
;
......
......@@ -45,4 +45,6 @@ public interface NftMapper extends BaseMapper<Nft> {
List<CollectionNftVo> listCurrent(@Param("categoryId") Integer categoryId, @Param("userId") Integer userId);
List<CollectionNftVo> listCopyright(@Param("userId") Integer userId);
List<Nft> get();
}
......@@ -2,7 +2,11 @@ package com.fzm.common.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fzm.common.entity.Order;
import com.fzm.common.entity.vo.OrderVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author tangtuo
......@@ -10,4 +14,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface OrderMapper extends BaseMapper<Order> {
List<OrderVo> getByPayScene(@Param("payScene") Integer payScene, @Param("userId") Integer userId);
}
......@@ -151,4 +151,6 @@ public interface CopyrightApplyService extends IService<CopyrightApply> {
* @return
*/
boolean updateRegisterState(Integer copyrightId, int state);
void replaceNftHash(String oldNftHash, String newNftHash);
}
......@@ -182,4 +182,7 @@ public interface NftService extends IService<Nft> {
* @param id
*/
void delete(Integer id);
void republish();
}
......@@ -41,4 +41,6 @@ public interface NftTransferRecordService extends IService<NftTransferRecord> {
* @return
*/
NftTransferDetailVo getDetail(Integer id);
NftTransferRecord getByNftHash(String nftHash);
}
......@@ -3,6 +3,7 @@ package com.fzm.common.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fzm.common.entity.Order;
import com.fzm.common.entity.dto.OrderDto;
import com.fzm.common.entity.vo.OrderVo;
import com.fzm.common.enums.OrderStatus;
import java.util.List;
......@@ -51,7 +52,7 @@ public interface OrderService extends IService<Order> {
* @param orderStatus
* @return
*/
Boolean cancel(Long orderId, OrderStatus orderStatus);
Boolean cancel(Long orderId);
/**
* 获取我的订单
......@@ -59,7 +60,7 @@ public interface OrderService extends IService<Order> {
* @param payScene
* @return
*/
List<Order> listOrder(Integer payScene);
List<OrderVo> listOrder(Integer payScene);
void processOrder(Long orderId, Integer productId, Integer payScene);
}
......@@ -7,6 +7,7 @@ import cn.hutool.core.lang.TypeReference;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fzm.common.constant.SystemConstant;
import com.fzm.common.entity.*;
......@@ -453,4 +454,13 @@ public class CopyrightApplyServiceImpl extends ServiceImpl<CopyrightApplyMapper,
return updateById(copyrightApply);
}
@Override
public void replaceNftHash(String oldNftHash, String newNftHash) {
UpdateWrapper<CopyrightApply> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("nft_hash", oldNftHash);
CopyrightApply copyrightApply = new CopyrightApply();
copyrightApply.setNftHash(newNftHash);
this.update(copyrightApply, updateWrapper);
}
}
......@@ -2,6 +2,7 @@ package com.fzm.common.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fzm.common.entity.AuthPerson;
import com.fzm.common.entity.NftTransferRecord;
......@@ -55,4 +56,11 @@ public class NftTransferRecordServiceImpl extends ServiceImpl<NftTransferRecordM
public NftTransferDetailVo getDetail(Integer id) {
return nftTransferRecordMapper.getDetail(id);
}
@Override
public NftTransferRecord getByNftHash(String nftHash) {
QueryWrapper<NftTransferRecord> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("nft_hash", nftHash);
return this.getOne(queryWrapper);
}
}
......@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fzm.common.entity.Order;
import com.fzm.common.entity.dto.OrderDto;
import com.fzm.common.entity.dto.OrderProcessMsg;
import com.fzm.common.entity.vo.OrderVo;
import com.fzm.common.enums.OrderStatus;
import com.fzm.common.enums.PayScene;
import com.fzm.common.mapper.OrderMapper;
......@@ -19,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -44,6 +46,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
@Resource
private RabbitTemplate rabbitTemplate;
@Resource
private OrderMapper orderMapper;
@Override
public Order getByPaySceneAndProductId(Integer payScene, Integer productId, Integer orderStatus) {
QueryWrapper<Order> queryWrapper = new QueryWrapper<>();
......@@ -102,7 +107,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
}
@Override
public Boolean cancel(Long orderId, OrderStatus orderStatus) {
public Boolean cancel(Long orderId) {
Order order = this.getById(orderId);
Integer productId = order.getProductId();
// 判断订单的类型
......@@ -114,17 +119,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
copyrightApplyService.delete(productId);
}
// 修改订单状态为取消
this.updateOrderStatus(orderId, orderStatus);
this.updateOrderStatus(orderId, OrderStatus.CANCEL);
return true;
}
@Override
public List<Order> listOrder(Integer payScene) {
public List<OrderVo> listOrder(Integer payScene) {
Integer userId = JwtUtil.getUserIdFromToken(request.getHeader("Authorization"));
QueryWrapper<Order> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("pay_scene", payScene);
queryWrapper.eq("user_id", userId);
return this.list(queryWrapper);
return orderMapper.getByPayScene(payScene, userId);
}
@Override
......
......@@ -103,5 +103,8 @@
AND publish_status = 2
AND nft_hash NOT IN ( SELECT nft_hash FROM tb_copyright_apply)
</select>
<select id="get" resultType="com.fzm.common.entity.Nft">
select * from tb_nft where nft_hash != ''
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fzm.common.mapper.OrderMapper">
<select id="getByPayScene" resultType="com.fzm.common.entity.vo.OrderVo">
select a.*,b.category_id from tb_order a
<if test="payScene == 1">
left join tb_nft b on a.product_id = b.id
</if>
<if test="payScene == 2">
left join tb_copyright_apply c on a.product_id = c.id
left join tb_nft b on b.nft_hash = c.nft_hash
</if>
where a.pay_scene = #{payScene} and a.user_id = #{userId}
order by a.update_date desc
</select>
</mapper>
\ No newline at end of file
......@@ -183,4 +183,10 @@ public class NftController {
return ResponseModel.success(list);
}
@GetMapping("/republish")
public ResponseModel<String> republish(){
nftService.republish();
return ResponseModel.success();
}
}
......@@ -3,6 +3,7 @@ package com.fzm.portal.controller;
import com.fzm.common.annotation.Authentication;
import com.fzm.common.entity.Order;
import com.fzm.common.entity.dto.OrderDto;
import com.fzm.common.entity.vo.OrderVo;
import com.fzm.common.enums.OrderStatus;
import com.fzm.common.model.ResponseModel;
import com.fzm.common.service.OrderService;
......@@ -45,15 +46,15 @@ public class OrderController {
@PostMapping("/cancel")
@ApiOperation("取消订单")
public ResponseModel<Boolean> cancelOrder(@RequestParam Long orderId) {
Boolean result = orderService.cancel(orderId, OrderStatus.CANCEL);
Boolean result = orderService.cancel(orderId);
return ResponseModel.success(result);
}
@GetMapping("/list/{payScene}")
@ApiOperation(value = "获取我的订单列表")
public ResponseModel<List<Order>> listOrder(@PathVariable Integer payScene) {
List<Order> orders = orderService.listOrder(payScene);
public ResponseModel<List<OrderVo>> listOrder(@PathVariable Integer payScene) {
List<OrderVo> orders = orderService.listOrder(payScene);
return ResponseModel.success(orders);
}
......
......@@ -97,8 +97,9 @@ chain:
token-manager:
token-manager-key: 4e92bda2477ded0e7c07a9e3acd2370de8d7401c68cc83ee8376806db3121e77
title: user.p.FILMCHAIN.
cName: user.evm.0xdc173544bb1876b9811d679f0dd33acc03772c6694f34a9f51b79cbae8af10f4
cAddr: 1MHibNozeurswCpinxR9md147dYUUG3vRN
cName: user.evm.0xa038a372ab27d9038328932c98454e52390b94555a69ab9559e8ab14ff2e540f
cAddr: 1Nhju8CgSUmkQQwc7ECk4bFxnv48iRLNRX
huaweiyun:
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -614,5 +614,5 @@ CREATE TABLE `tb_order` (
-- v2.3.0
alter table tb_nft add column publish_status TINYINT(1) not null default 1 comment '发行状态 1-待支付 2-发行成功 3-发行失败' after publish_time;
alter table tb_nft add column publish_status TINYINT(1) not null default 1 comment '发行状态 0-待支付 1-发行中 2-发行成功 3-发行失败' after publish_time;
update tb_nft set publish_status =2 where nft_hash !='';
\ No newline at end of file
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