Commit a7b4dc77 authored by tangtuo's avatar tangtuo

委托上架接口编写

parent 3823264a
package com.fzm.admin.controller;
import com.fzm.common.annotation.Authentication;
import com.fzm.common.entity.EntrustShelf;
import com.fzm.common.model.ResponseModel;
import com.fzm.common.service.EntrustShelfService;
import com.fzm.common.valid.InsertGroup;
import com.fzm.common.valid.UpdateGroup;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* @author tangtuo
* @date 2022/1/11 17:19
*/
@Authentication
@RestController
@RequestMapping("/entrust/shelf")
@Api(tags = "委托上架")
public class EntrustShelfController {
@Resource
private EntrustShelfService entrustShelfService;
@GetMapping("/page")
@ApiOperation(value = "分页查询")
public ResponseModel<PageInfo<EntrustShelf>> page(@ApiParam(value = "页码", required = true) @RequestParam Integer pageNum,
@ApiParam(value = "每页记录数", required = true) @RequestParam Integer pageSize,
@ApiParam(value = "手机号") @RequestParam(required = false) String telephone,
@ApiParam(value = "用户姓名") @RequestParam(required = false) String name,
@ApiParam(value = "审核开始日期 yyyy-MM-dd") @RequestParam(required = false) String from,
@ApiParam(value = "审核截止日期 yyyy-MM-dd") @RequestParam(required = false) String to) {
PageInfo<EntrustShelf> pageInfo = entrustShelfService.getPages(pageNum, pageSize, telephone, name, from, to);
return ResponseModel.success(pageInfo);
}
}
...@@ -6,6 +6,8 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -6,6 +6,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.Date;
/** /**
* @author tangtuo * @author tangtuo
* @date 2021/7/1 17:54 * @date 2021/7/1 17:54
...@@ -38,6 +40,12 @@ public class CollectionNftVo { ...@@ -38,6 +40,12 @@ public class CollectionNftVo {
@ApiModelProperty("是否是纪念版nft 0-否 1-是") @ApiModelProperty("是否是纪念版nft 0-否 1-是")
private Integer isCommemorate; private Integer isCommemorate;
@ApiModelProperty("nft发行时间")
private Date publishTime;
@ApiModelProperty("是否已委托上架 0-否 1-是")
private Integer isEntrust;
public CollectionNftVo(Nft nft, Category category) { public CollectionNftVo(Nft nft, Category category) {
this.id = nft.getId(); this.id = nft.getId();
this.nftId = nft.getNftId(); this.nftId = nft.getNftId();
...@@ -46,5 +54,7 @@ public class CollectionNftVo { ...@@ -46,5 +54,7 @@ public class CollectionNftVo {
this.cover = nft.getCover(); this.cover = nft.getCover();
this.isCommemorate = nft.getIsCommemorate(); this.isCommemorate = nft.getIsCommemorate();
this.fileUrl = nft.getFileUrl(); this.fileUrl = nft.getFileUrl();
this.publishTime = nft.getPublishTime();
this.isEntrust = nft.getIsEntrust();
} }
} }
package com.fzm.common.mapper; package com.fzm.common.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fzm.common.entity.AuthPerson;
import com.fzm.common.entity.EntrustShelf; import com.fzm.common.entity.EntrustShelf;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
......
...@@ -3,6 +3,7 @@ package com.fzm.common.service; ...@@ -3,6 +3,7 @@ package com.fzm.common.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.fzm.common.entity.AuthPerson; import com.fzm.common.entity.AuthPerson;
import com.fzm.common.entity.EntrustShelf; import com.fzm.common.entity.EntrustShelf;
import com.github.pagehelper.PageInfo;
/** /**
* @author tangtuo * @author tangtuo
...@@ -25,4 +26,17 @@ public interface EntrustShelfService extends IService<EntrustShelf> { ...@@ -25,4 +26,17 @@ public interface EntrustShelfService extends IService<EntrustShelf> {
* @return * @return
*/ */
Boolean cancel(Integer id); Boolean cancel(Integer id);
/**
* 分页查询
*
* @param pageNum
* @param pageSize
* @param telephone
* @param name
* @param from
* @param to
* @return
*/
PageInfo<EntrustShelf> getPages(Integer pageNum, Integer pageSize, String telephone, String name, String from, String to);
} }
package com.fzm.common.service.impl; package com.fzm.common.service.impl;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fzm.common.constant.SystemConstant; import com.fzm.common.constant.SystemConstant;
import com.fzm.common.entity.EntrustShelf; import com.fzm.common.entity.EntrustShelf;
...@@ -9,6 +11,9 @@ import com.fzm.common.mapper.EntrustShelfMapper; ...@@ -9,6 +11,9 @@ 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.fzm.common.utils.JwtUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.dao.DuplicateKeyException; import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -30,6 +35,7 @@ public class EntrustShelfServiceImpl extends ServiceImpl<EntrustShelfMapper, Ent ...@@ -30,6 +35,7 @@ public class EntrustShelfServiceImpl extends ServiceImpl<EntrustShelfMapper, Ent
@Resource @Resource
private NftService nftService; private NftService nftService;
@Override @Override
public Boolean submit(EntrustShelf entrustShelf) { public Boolean submit(EntrustShelf entrustShelf) {
// 修改当前nft的是否已申请的状态为是 // 修改当前nft的是否已申请的状态为是
...@@ -59,4 +65,25 @@ public class EntrustShelfServiceImpl extends ServiceImpl<EntrustShelfMapper, Ent ...@@ -59,4 +65,25 @@ public class EntrustShelfServiceImpl extends ServiceImpl<EntrustShelfMapper, Ent
entrustShelf.setStatus(SystemConstant.BOOLEAN_DATA_TRUE); entrustShelf.setStatus(SystemConstant.BOOLEAN_DATA_TRUE);
return this.updateById(entrustShelf); return this.updateById(entrustShelf);
} }
@Override
public PageInfo<EntrustShelf> getPages(Integer pageNum, Integer pageSize, String telephone, String name, String from, String to) {
PageHelper.startPage(pageNum, pageSize);
QueryWrapper<EntrustShelf> queryWrapper = new QueryWrapper<>();
if (StringUtils.isNotBlank(name)) {
queryWrapper.eq("name", name);
}
if (StringUtils.isNotBlank(telephone)) {
queryWrapper.eq("telephone", telephone);
}
if (StringUtils.isNotBlank(from)) {
queryWrapper.ge("create_date", DateUtil.parse(from + " 00:00:00", "yyyy-MM-dd HH:mm:ss"));
}
if (StringUtils.isNotBlank(to)) {
queryWrapper.le("create_date", DateUtil.parse(to + " 23:59:59", "yyyy-MM-dd HH:mm:ss"));
}
return new PageInfo<>(this.list(queryWrapper));
}
} }
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