积分任务完成,订单model创建
parent
bb97d7a4b4
commit
c20b304c67
|
|
@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("api/article")
|
@RequestMapping("api/article1234567")
|
||||||
@Api(tags = "文章数据管理")
|
@Api(tags = "文章数据管理")
|
||||||
public class ArticleController {
|
public class ArticleController {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
package com.wyh.admin.controller;
|
||||||
|
|
||||||
|
import com.wyh.admin.aop.Log;
|
||||||
|
import com.wyh.admin.service.IWxArticleService;
|
||||||
|
import com.wyh.admin.validate.commons.IdValidate;
|
||||||
|
import com.wyh.admin.validate.commons.PageValidate;
|
||||||
|
import com.wyh.common.core.AjaxResult;
|
||||||
|
import com.wyh.common.core.PageResult;
|
||||||
|
import com.wyh.common.validator.WxArticleCreateValidate;
|
||||||
|
import com.wyh.common.validator.WxArticleSearchValidate;
|
||||||
|
import com.wyh.common.validator.WxArticleUpdateValidate;
|
||||||
|
import com.wyh.common.validator.annotation.IDMust;
|
||||||
|
import com.wyh.common.vo.WxArticleDetailVo;
|
||||||
|
import com.wyh.common.vo.WxArticleListedVo;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("api/article")
|
||||||
|
@Api(tags = "分享任务文章管理")
|
||||||
|
public class WxArticleController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
IWxArticleService iWxArticleService;
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@ApiOperation(value="分享任务文章列表")
|
||||||
|
public AjaxResult<PageResult<WxArticleListedVo>> list(@Validated PageValidate pageValidate,
|
||||||
|
@Validated WxArticleSearchValidate searchValidate) {
|
||||||
|
PageResult<WxArticleListedVo> list = iWxArticleService.list(pageValidate, searchValidate);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/detail")
|
||||||
|
@ApiOperation(value="分享任务文章详情")
|
||||||
|
public AjaxResult<WxArticleDetailVo> detail(@Validated @IDMust() @RequestParam("id") Integer id) {
|
||||||
|
WxArticleDetailVo detail = iWxArticleService.detail(id);
|
||||||
|
return AjaxResult.success(detail);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "分享任务文章新增")
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ApiOperation(value="分享任务文章新增")
|
||||||
|
public AjaxResult<Object> add(@Validated @RequestBody WxArticleCreateValidate createValidate) {
|
||||||
|
iWxArticleService.add(createValidate);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "分享任务文章编辑")
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ApiOperation(value="分享任务文章编辑")
|
||||||
|
public AjaxResult<Object> edit(@Validated @RequestBody WxArticleUpdateValidate updateValidate) {
|
||||||
|
iWxArticleService.edit(updateValidate);
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "分享任务文章删除")
|
||||||
|
@PostMapping("/del")
|
||||||
|
@ApiOperation(value="分享任务文章删除")
|
||||||
|
public AjaxResult<Object> del(@Validated @RequestBody IdValidate idValidate) {
|
||||||
|
iWxArticleService.del(idValidate.getId());
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
package com.wyh.admin.service;
|
||||||
|
|
||||||
|
import com.wyh.admin.validate.commons.PageValidate;
|
||||||
|
import com.wyh.common.core.PageResult;
|
||||||
|
import com.wyh.common.validator.WxArticleCreateValidate;
|
||||||
|
import com.wyh.common.validator.WxArticleSearchValidate;
|
||||||
|
import com.wyh.common.validator.WxArticleUpdateValidate;
|
||||||
|
import com.wyh.common.vo.WxArticleDetailVo;
|
||||||
|
import com.wyh.common.vo.WxArticleListedVo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享任务文章服务接口类
|
||||||
|
* @author wyh
|
||||||
|
*/
|
||||||
|
public interface IWxArticleService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享任务文章列表
|
||||||
|
*
|
||||||
|
* @author wyh
|
||||||
|
* @param pageValidate 分页参数
|
||||||
|
* @param searchValidate 搜索参数
|
||||||
|
* @return PageResult<WxArticleListedVo>
|
||||||
|
*/
|
||||||
|
PageResult<WxArticleListedVo> list(PageValidate pageValidate, WxArticleSearchValidate searchValidate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享任务文章详情
|
||||||
|
*
|
||||||
|
* @author wyh
|
||||||
|
* @param id 主键ID
|
||||||
|
* @return WxArticleDetailVo
|
||||||
|
*/
|
||||||
|
WxArticleDetailVo detail(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享任务文章新增
|
||||||
|
*
|
||||||
|
* @author wyh
|
||||||
|
* @param createValidate 参数
|
||||||
|
*/
|
||||||
|
void add(WxArticleCreateValidate createValidate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享任务文章编辑
|
||||||
|
*
|
||||||
|
* @author wyh
|
||||||
|
* @param updateValidate 参数
|
||||||
|
*/
|
||||||
|
void edit(WxArticleUpdateValidate updateValidate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享任务文章删除
|
||||||
|
*
|
||||||
|
* @author wyh
|
||||||
|
* @param id 主键ID
|
||||||
|
*/
|
||||||
|
void del(Integer id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -36,9 +36,11 @@ import java.util.*;
|
||||||
@Service
|
@Service
|
||||||
public class SystemLoginServiceImpl implements ISystemLoginService {
|
public class SystemLoginServiceImpl implements ISystemLoginService {
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
Producer captchaProducer;
|
Producer captchaProducer;
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
SystemLogLoginMapper systemLogLoginMapper;
|
SystemLogLoginMapper systemLogLoginMapper;
|
||||||
|
|
||||||
|
|
@ -163,8 +165,11 @@ public class SystemLoginServiceImpl implements ISystemLoginService {
|
||||||
* @param token 令牌
|
* @param token 令牌
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void logout(String token) {
|
public void logout(String token) {
|
||||||
//RedisUtil.del(AdminConfig.backstageTokenKey + token);
|
|
||||||
|
Integer adminId = StpUtil.getLoginIdAsInt();
|
||||||
|
StpUtil.logout(adminId);
|
||||||
|
// RedisUtils.del("Authorization");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,159 @@
|
||||||
|
package com.wyh.admin.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.wyh.admin.service.IWxArticleService;
|
||||||
|
import com.wyh.admin.validate.commons.PageValidate;
|
||||||
|
import com.wyh.common.core.PageResult;
|
||||||
|
import com.wyh.common.entity.WxArticle;
|
||||||
|
import com.wyh.common.mapper.WxArticleMapper;
|
||||||
|
import com.wyh.common.util.TimeUtils;
|
||||||
|
import com.wyh.common.util.UrlUtils;
|
||||||
|
import com.wyh.common.validator.WxArticleCreateValidate;
|
||||||
|
import com.wyh.common.validator.WxArticleSearchValidate;
|
||||||
|
import com.wyh.common.validator.WxArticleUpdateValidate;
|
||||||
|
import com.wyh.common.vo.WxArticleDetailVo;
|
||||||
|
import com.wyh.common.vo.WxArticleListedVo;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享任务文章实现类
|
||||||
|
* @author wyh
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class WxArticleServiceImpl implements IWxArticleService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
WxArticleMapper wxArticleMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享任务文章列表
|
||||||
|
*
|
||||||
|
* @author wyh
|
||||||
|
* @param pageValidate 分页参数
|
||||||
|
* @param searchValidate 搜索参数
|
||||||
|
* @return PageResult<WxArticleListedVo>
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PageResult<WxArticleListedVo> list(PageValidate pageValidate, WxArticleSearchValidate searchValidate) {
|
||||||
|
Integer page = pageValidate.getPageNo();
|
||||||
|
Integer limit = pageValidate.getPageSize();
|
||||||
|
|
||||||
|
QueryWrapper<WxArticle> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("is_delete", 0);
|
||||||
|
queryWrapper.orderByDesc("id");
|
||||||
|
|
||||||
|
wxArticleMapper.setSearch(queryWrapper, searchValidate, new String[]{
|
||||||
|
"=:linkUrl@link_url:str",
|
||||||
|
"like:title:str",
|
||||||
|
"=:image:str",
|
||||||
|
});
|
||||||
|
|
||||||
|
IPage<WxArticle> iPage = wxArticleMapper.selectPage(new Page<>(page, limit), queryWrapper);
|
||||||
|
|
||||||
|
List<WxArticleListedVo> list = new LinkedList<>();
|
||||||
|
for(WxArticle item : iPage.getRecords()) {
|
||||||
|
WxArticleListedVo vo = new WxArticleListedVo();
|
||||||
|
BeanUtils.copyProperties(item, vo);
|
||||||
|
vo.setImage(UrlUtils.toAbsoluteUrl(item.getImage()));
|
||||||
|
vo.setCreateTime(TimeUtils.timestampToDate(item.getCreateTime()));
|
||||||
|
vo.setUpdateTime(TimeUtils.timestampToDate(item.getUpdateTime()));
|
||||||
|
list.add(vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享任务文章详情
|
||||||
|
*
|
||||||
|
* @author wyh
|
||||||
|
* @param id 主键参数
|
||||||
|
* @return WxArticle
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public WxArticleDetailVo detail(Integer id) {
|
||||||
|
WxArticle model = wxArticleMapper.selectOne(
|
||||||
|
new QueryWrapper<WxArticle>()
|
||||||
|
.eq("id", id)
|
||||||
|
.eq("is_delete", 0)
|
||||||
|
.last("limit 1"));
|
||||||
|
|
||||||
|
Assert.notNull(model, "数据不存在");
|
||||||
|
|
||||||
|
WxArticleDetailVo vo = new WxArticleDetailVo();
|
||||||
|
BeanUtils.copyProperties(model, vo);
|
||||||
|
vo.setImage(UrlUtils.toAbsoluteUrl(model.getImage()));
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享任务文章新增
|
||||||
|
*
|
||||||
|
* @author wyh
|
||||||
|
* @param createValidate 参数
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void add(WxArticleCreateValidate createValidate) {
|
||||||
|
WxArticle model = new WxArticle();
|
||||||
|
model.setCreateTime(System.currentTimeMillis() / 1000);
|
||||||
|
model.setUpdateTime(System.currentTimeMillis() / 1000);
|
||||||
|
model.setLinkUrl(createValidate.getLinkUrl());
|
||||||
|
model.setTitle(createValidate.getTitle());
|
||||||
|
model.setImage(UrlUtils.toRelativeUrl(createValidate.getImage()));
|
||||||
|
wxArticleMapper.insert(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享任务文章编辑
|
||||||
|
*
|
||||||
|
* @author wyh
|
||||||
|
* @param updateValidate 参数
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void edit(WxArticleUpdateValidate updateValidate) {
|
||||||
|
WxArticle model = wxArticleMapper.selectOne(
|
||||||
|
new QueryWrapper<WxArticle>()
|
||||||
|
.eq("id", updateValidate.getId())
|
||||||
|
.eq("is_delete", 0)
|
||||||
|
.last("limit 1"));
|
||||||
|
|
||||||
|
Assert.notNull(model, "数据不存在!");
|
||||||
|
|
||||||
|
model.setId(updateValidate.getId());
|
||||||
|
model.setUpdateTime(System.currentTimeMillis() / 1000);
|
||||||
|
model.setLinkUrl(updateValidate.getLinkUrl());
|
||||||
|
model.setTitle(updateValidate.getTitle());
|
||||||
|
model.setImage(UrlUtils.toRelativeUrl(updateValidate.getImage()));
|
||||||
|
wxArticleMapper.updateById(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享任务文章删除
|
||||||
|
*
|
||||||
|
* @author wyh
|
||||||
|
* @param id 主键ID
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void del(Integer id) {
|
||||||
|
WxArticle model = wxArticleMapper.selectOne(
|
||||||
|
new QueryWrapper<WxArticle>()
|
||||||
|
.eq("id", id)
|
||||||
|
.eq("is_delete", 0)
|
||||||
|
.last("limit 1"));
|
||||||
|
|
||||||
|
Assert.notNull(model, "数据不存在!");
|
||||||
|
|
||||||
|
model.setIsDelete(1);
|
||||||
|
model.setDeleteTime(System.currentTimeMillis() / 1000);
|
||||||
|
wxArticleMapper.updateById(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@ApiModel("用户Vo")
|
@ApiModel("用户Vo")
|
||||||
|
|
@ -48,6 +49,9 @@ public class UserVo implements Serializable {
|
||||||
@ApiModelProperty(value = "创建时间")
|
@ApiModelProperty(value = "创建时间")
|
||||||
private String createTime;
|
private String createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("用户钱包")
|
||||||
|
private BigDecimal money;
|
||||||
|
|
||||||
public void setSex(Integer sex) {
|
public void setSex(Integer sex) {
|
||||||
switch (sex) {
|
switch (sex) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,6 @@ spring:
|
||||||
database: 11
|
database: 11
|
||||||
|
|
||||||
# Mybatis-plus配置 【是否开启SQL日志输出】
|
# Mybatis-plus配置 【是否开启SQL日志输出】
|
||||||
mybatis-plus:
|
#mybatis-plus:
|
||||||
configuration:
|
# configuration:
|
||||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.wyh.common.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel("订单信息实体")
|
||||||
|
public class Order implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value="id", type= IdType.AUTO)
|
||||||
|
@ApiModelProperty(value = "主键")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否删除: 0=否, 1=是")
|
||||||
|
private Integer isDelete;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private Long createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "更新时间")
|
||||||
|
private Long updateTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "删除时间")
|
||||||
|
private Long deleteTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户id")
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "地址信息id")
|
||||||
|
private Integer adId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单状态:1:待审核,2:待收货,3:租用中,4:已返还")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单总金额")
|
||||||
|
private BigDecimal totalPrice;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单编号")
|
||||||
|
private String sn;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "外部订单号")
|
||||||
|
private String outSn;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
package com.wyh.common.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel("分享任务记录实体")
|
||||||
|
public class ShareRecord implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value="id", type= IdType.AUTO)
|
||||||
|
@ApiModelProperty(value = "主键")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否删除: 0=否, 1=是")
|
||||||
|
private Integer isDelete;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private Long createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "更新时间")
|
||||||
|
private Long updateTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "删除时间")
|
||||||
|
private Long deleteTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "任务执行人")
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "得分")
|
||||||
|
private BigDecimal scope;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.wyh.common.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel("签到任务记录实体")
|
||||||
|
public class SignLog implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value="id", type= IdType.AUTO)
|
||||||
|
@ApiModelProperty(value = "主键")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否删除: 0=否, 1=是")
|
||||||
|
private Integer isDelete;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private Long createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "更新时间")
|
||||||
|
private Long updateTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "删除时间")
|
||||||
|
private Long deleteTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "签到用户")
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "签到日期")
|
||||||
|
private String signDate;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "连续签到天数")
|
||||||
|
private Integer continueNums;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "签到获取金额")
|
||||||
|
private BigDecimal signMoney;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.wyh.common.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel("分享任务文章实体")
|
||||||
|
public class WxArticle implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value="id", type= IdType.AUTO)
|
||||||
|
@ApiModelProperty(value = "主键")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否删除: 0=否, 1=是")
|
||||||
|
private Integer isDelete;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private Long createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "更新时间")
|
||||||
|
private Long updateTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "删除时间")
|
||||||
|
private Long deleteTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "链接地址")
|
||||||
|
private String linkUrl;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "文章标题")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "文章分享图")
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.wyh.common.mapper;
|
||||||
|
|
||||||
|
import com.wyh.common.core.basics.IBaseMapper;
|
||||||
|
import com.wyh.common.entity.Order;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单信息Mapper
|
||||||
|
* @author wyh
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface OrderMapper extends IBaseMapper<Order> {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.wyh.common.mapper;
|
||||||
|
|
||||||
|
import com.wyh.common.core.basics.IBaseMapper;
|
||||||
|
import com.wyh.common.entity.ShareRecord;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享任务记录Mapper
|
||||||
|
* @author wyh
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ShareRecordMapper extends IBaseMapper<ShareRecord> {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.wyh.common.mapper;
|
||||||
|
|
||||||
|
import com.wyh.common.core.basics.IBaseMapper;
|
||||||
|
import com.wyh.common.entity.SignLog;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 签到任务记录Mapper
|
||||||
|
* @author wyh
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SignLogMapper extends IBaseMapper<SignLog> {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.wyh.common.mapper;
|
||||||
|
|
||||||
|
import com.wyh.common.core.basics.IBaseMapper;
|
||||||
|
import com.wyh.common.entity.WxArticle;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享任务文章Mapper
|
||||||
|
* @author wyh
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface WxArticleMapper extends IBaseMapper<WxArticle> {
|
||||||
|
}
|
||||||
|
|
@ -5,6 +5,7 @@ import java.lang.management.ManagementFactory;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.ParsePosition;
|
import java.text.ParsePosition;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
|
@ -535,4 +536,23 @@ public class TimeUtils {
|
||||||
// long sec = diff % nd % nh % nm / ns;
|
// long sec = diff % nd % nh % nm / ns;
|
||||||
return day + "天" + hour + "小时" + min + "分钟";
|
return day + "天" + hour + "小时" + min + "分钟";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static List<String> generateDateList() {
|
||||||
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
|
||||||
|
LocalDate startDate = LocalDate.now().minusDays(2);
|
||||||
|
LocalDate endDate = LocalDate.now().plusDays(4);
|
||||||
|
|
||||||
|
List<String> dateRange = new ArrayList<>();
|
||||||
|
LocalDate tempDate = startDate;
|
||||||
|
while (!tempDate.isAfter(endDate)) {
|
||||||
|
dateRange.add(simpleDateFormat.format(java.sql.Date.valueOf(tempDate)));
|
||||||
|
tempDate = tempDate.plusDays(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dateRange;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.wyh.common.validator;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel("订单信息创建参数")
|
||||||
|
public class OrderCreateValidate implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@NotNull(message = "userId参数缺失")
|
||||||
|
@ApiModelProperty(value = "用户id")
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@NotNull(message = "adId参数缺失")
|
||||||
|
@ApiModelProperty(value = "地址信息id")
|
||||||
|
private Integer adId;
|
||||||
|
|
||||||
|
@NotNull(message = "status参数缺失")
|
||||||
|
@ApiModelProperty(value = "订单状态:1:待审核,2:待收货,3:租用中,4:已返还")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@NotNull(message = "totalPrice参数缺失")
|
||||||
|
@ApiModelProperty(value = "订单总金额")
|
||||||
|
private BigDecimal totalPrice;
|
||||||
|
|
||||||
|
@NotNull(message = "sn参数缺失")
|
||||||
|
@ApiModelProperty(value = "订单编号")
|
||||||
|
private String sn;
|
||||||
|
|
||||||
|
@NotNull(message = "outSn参数缺失")
|
||||||
|
@ApiModelProperty(value = "外部订单号")
|
||||||
|
private String outSn;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.wyh.common.validator;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel("订单信息搜素参数")
|
||||||
|
public class OrderSearchValidate implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户id")
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "地址信息id")
|
||||||
|
private Integer adId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单状态:1:待审核,2:待收货,3:租用中,4:已返还")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单总金额")
|
||||||
|
private BigDecimal totalPrice;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单编号")
|
||||||
|
private String sn;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "外部订单号")
|
||||||
|
private String outSn;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.wyh.common.validator;
|
||||||
|
|
||||||
|
import com.wyh.common.validator.annotation.IDMust;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单信息参数
|
||||||
|
* @author wyh
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel("订单信息更新参数")
|
||||||
|
public class OrderUpdateValidate implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@IDMust(message = "id参数必传且需大于0")
|
||||||
|
@ApiModelProperty(value = "主键")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@NotNull(message = "userId参数缺失")
|
||||||
|
@ApiModelProperty(value = "用户id")
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@NotNull(message = "adId参数缺失")
|
||||||
|
@ApiModelProperty(value = "地址信息id")
|
||||||
|
private Integer adId;
|
||||||
|
|
||||||
|
@NotNull(message = "status参数缺失")
|
||||||
|
@ApiModelProperty(value = "订单状态:1:待审核,2:待收货,3:租用中,4:已返还")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@NotNull(message = "totalPrice参数缺失")
|
||||||
|
@ApiModelProperty(value = "订单总金额")
|
||||||
|
private BigDecimal totalPrice;
|
||||||
|
|
||||||
|
@NotNull(message = "sn参数缺失")
|
||||||
|
@ApiModelProperty(value = "订单编号")
|
||||||
|
private String sn;
|
||||||
|
|
||||||
|
@NotNull(message = "outSn参数缺失")
|
||||||
|
@ApiModelProperty(value = "外部订单号")
|
||||||
|
private String outSn;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.wyh.common.validator;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel("分享任务文章创建参数")
|
||||||
|
public class WxArticleCreateValidate implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@NotNull(message = "linkUrl参数缺失")
|
||||||
|
@ApiModelProperty(value = "链接地址")
|
||||||
|
private String linkUrl;
|
||||||
|
|
||||||
|
@NotNull(message = "title参数缺失")
|
||||||
|
@ApiModelProperty(value = "文章标题")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@NotNull(message = "image参数缺失")
|
||||||
|
@ApiModelProperty(value = "文章分享图")
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.wyh.common.validator;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel("分享任务文章搜素参数")
|
||||||
|
public class WxArticleSearchValidate implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "链接地址")
|
||||||
|
private String linkUrl;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "文章标题")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "文章分享图")
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.wyh.common.validator;
|
||||||
|
|
||||||
|
import com.wyh.common.validator.annotation.IDMust;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享任务文章参数
|
||||||
|
* @author wyh
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel("分享任务文章更新参数")
|
||||||
|
public class WxArticleUpdateValidate implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@IDMust(message = "id参数必传且需大于0")
|
||||||
|
@ApiModelProperty(value = "主键")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@NotNull(message = "linkUrl参数缺失")
|
||||||
|
@ApiModelProperty(value = "链接地址")
|
||||||
|
private String linkUrl;
|
||||||
|
|
||||||
|
@NotNull(message = "title参数缺失")
|
||||||
|
@ApiModelProperty(value = "文章标题")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@NotNull(message = "image参数缺失")
|
||||||
|
@ApiModelProperty(value = "文章分享图")
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.wyh.common.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel("订单信息详情Vo")
|
||||||
|
public class OrderDetailVo implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "主键")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户id")
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "地址信息id")
|
||||||
|
private Integer adId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单状态:1:待审核,2:待收货,3:租用中,4:已返还")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单总金额")
|
||||||
|
private BigDecimal totalPrice;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单编号")
|
||||||
|
private String sn;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "外部订单号")
|
||||||
|
private String outSn;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.wyh.common.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel("订单信息列表Vo")
|
||||||
|
public class OrderListedVo implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "主键")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private String createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "更新时间")
|
||||||
|
private String updateTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户id")
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "地址信息id")
|
||||||
|
private Integer adId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单状态:1:待审核,2:待收货,3:租用中,4:已返还")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单总金额")
|
||||||
|
private BigDecimal totalPrice;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单编号")
|
||||||
|
private String sn;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "外部订单号")
|
||||||
|
private String outSn;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.wyh.common.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel("签到记录")
|
||||||
|
public class SignDateVo {
|
||||||
|
@ApiModelProperty("日期")
|
||||||
|
private String date;
|
||||||
|
@ApiModelProperty("是否签到")
|
||||||
|
private Boolean isSign;
|
||||||
|
|
||||||
|
@ApiModelProperty("签到获取金额")
|
||||||
|
private BigDecimal signMoney;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.wyh.common.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@ApiModel("用户签到记录VO")
|
||||||
|
@Data
|
||||||
|
public class SignLogVo {
|
||||||
|
|
||||||
|
@ApiModelProperty("用户id")
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@ApiModelProperty("积分余额")
|
||||||
|
private BigDecimal money;
|
||||||
|
|
||||||
|
@ApiModelProperty("连续签到天数")
|
||||||
|
private Integer continuousDays;
|
||||||
|
|
||||||
|
@ApiModelProperty("签到日期列表")
|
||||||
|
private List<SignDateVo> signDateList;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.wyh.common.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel("分享任务文章详情Vo")
|
||||||
|
public class WxArticleDetailVo implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "主键")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "链接地址")
|
||||||
|
private String linkUrl;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "文章标题")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "文章分享图")
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.wyh.common.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel("分享任务文章列表Vo")
|
||||||
|
public class WxArticleListedVo implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "主键")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private String createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "更新时间")
|
||||||
|
private String updateTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "链接地址")
|
||||||
|
private String linkUrl;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "文章标题")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "文章分享图")
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -2,6 +2,7 @@ package com.wyh.front.controller;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.wyh.common.aop.NotLogin;
|
import com.wyh.common.aop.NotLogin;
|
||||||
|
import com.wyh.common.aop.NotPower;
|
||||||
import com.wyh.common.core.AjaxResult;
|
import com.wyh.common.core.AjaxResult;
|
||||||
import com.wyh.common.entity.notice.NoticeRecord;
|
import com.wyh.common.entity.notice.NoticeRecord;
|
||||||
import com.wyh.common.enums.NoticeEnum;
|
import com.wyh.common.enums.NoticeEnum;
|
||||||
|
|
@ -26,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
import springfox.documentation.annotations.ApiIgnore;
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
@ -177,6 +179,14 @@ public class LoginController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@NotPower
|
||||||
|
@PostMapping("/logout")
|
||||||
|
@ApiOperation(value="退出登录")
|
||||||
|
public AjaxResult<Object> logout(HttpServletRequest request) {
|
||||||
|
iLoginService.logout(request.getHeader("token"));
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
ZJFrontThreadLocal.getUserId();
|
ZJFrontThreadLocal.getUserId();
|
||||||
String s = HttpUtils.sendGet("https://github.com/modood/Administrative-divisions-of-China/blob/master/dist/pca-code.json");
|
String s = HttpUtils.sendGet("https://github.com/modood/Administrative-divisions-of-China/blob/master/dist/pca-code.json");
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.wyh.front.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("front/order")
|
||||||
|
@Api(tags = "订单")
|
||||||
|
public class OrderController {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("add")
|
||||||
|
@ApiOperation("添加订单")
|
||||||
|
public void add(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
package com.wyh.front.controller;
|
||||||
|
|
||||||
|
import com.wyh.common.core.AjaxResult;
|
||||||
|
import com.wyh.common.vo.SignLogVo;
|
||||||
|
import com.wyh.front.service.SignService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("front/sign")
|
||||||
|
@Api(tags = "签到任务")
|
||||||
|
public class SignController {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SignService signService;
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("add")
|
||||||
|
@ApiOperation(value = "签到")
|
||||||
|
public AjaxResult<Object> add() {
|
||||||
|
signService.add();
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
@ApiOperation(value = "获取签到状态")
|
||||||
|
public AjaxResult<SignLogVo> getSignStatus() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return AjaxResult.success(signService.getSignStatus());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("article/list")
|
||||||
|
@ApiOperation(value = "文章列表")
|
||||||
|
public AjaxResult<Object> articleList() {
|
||||||
|
return AjaxResult.success(signService.articleList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("shareAdd")
|
||||||
|
@ApiOperation(value = "分享任务获取积分")
|
||||||
|
public AjaxResult<Object> shareAdd() {
|
||||||
|
return AjaxResult.success(signService.shareAdd());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -102,4 +102,6 @@ public interface ILoginService {
|
||||||
* @return LoginTokenVo
|
* @return LoginTokenVo
|
||||||
*/
|
*/
|
||||||
LoginTokenVo phonePwdLogin(String mobile, String password, Integer terminal);
|
LoginTokenVo phonePwdLogin(String mobile, String password, Integer terminal);
|
||||||
|
|
||||||
|
void logout(String token);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.wyh.front.service;
|
||||||
|
|
||||||
|
import com.wyh.common.entity.ShareRecord;
|
||||||
|
import com.wyh.common.vo.SignLogVo;
|
||||||
|
import com.wyh.common.vo.WxArticleListedVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface SignService {
|
||||||
|
void add();
|
||||||
|
|
||||||
|
SignLogVo getSignStatus();
|
||||||
|
|
||||||
|
List<WxArticleListedVo> articleList();
|
||||||
|
|
||||||
|
ShareRecord shareAdd();
|
||||||
|
}
|
||||||
|
|
@ -329,6 +329,12 @@ public class LoginServiceImpl implements ILoginService {
|
||||||
return this.__loginToken(user.getId(), user.getMobile(), user.getIsNew(), terminal);
|
return this.__loginToken(user.getId(), user.getMobile(), user.getIsNew(), terminal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void logout(String token) {
|
||||||
|
Integer userId = StpUtil.getLoginIdAsInt();
|
||||||
|
StpUtil.logout(userId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理微信登录
|
* 处理微信登录
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,177 @@
|
||||||
|
package com.wyh.front.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.wyh.common.entity.ShareRecord;
|
||||||
|
import com.wyh.common.entity.SignLog;
|
||||||
|
import com.wyh.common.entity.WxArticle;
|
||||||
|
import com.wyh.common.entity.user.User;
|
||||||
|
import com.wyh.common.enums.LogMoneyEnum;
|
||||||
|
import com.wyh.common.mapper.ShareRecordMapper;
|
||||||
|
import com.wyh.common.mapper.SignLogMapper;
|
||||||
|
import com.wyh.common.mapper.WxArticleMapper;
|
||||||
|
import com.wyh.common.mapper.log.LogMoneyMapper;
|
||||||
|
import com.wyh.common.mapper.user.UserMapper;
|
||||||
|
import com.wyh.common.util.TimeUtils;
|
||||||
|
import com.wyh.common.util.UrlUtils;
|
||||||
|
import com.wyh.common.vo.SignDateVo;
|
||||||
|
import com.wyh.common.vo.SignLogVo;
|
||||||
|
import com.wyh.common.vo.WxArticleListedVo;
|
||||||
|
import com.wyh.front.ZJFrontThreadLocal;
|
||||||
|
import com.wyh.front.service.SignService;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import static com.wyh.common.util.TimeUtils.generateDateList;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class SignServiceImpl implements SignService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ShareRecordMapper shareRecordMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserMapper userMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SignLogMapper signLogMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private LogMoneyMapper logMoneyMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WxArticleMapper wxArticleMapper;
|
||||||
|
|
||||||
|
private static BigDecimal amountToAdd = new BigDecimal(100);
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void add() {
|
||||||
|
|
||||||
|
Integer userId = ZJFrontThreadLocal.getUserId();
|
||||||
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
//获取当前时间
|
||||||
|
String date = simpleDateFormat.format(new Date());
|
||||||
|
//获取昨天的时间
|
||||||
|
String yesterday = simpleDateFormat.format(new Date().getTime() - 1000 * 60 * 60 * 24);
|
||||||
|
Long l = signLogMapper.selectCount(Wrappers.<SignLog>lambdaQuery().eq(SignLog::getUserId, userId).eq(SignLog::getSignDate, date));
|
||||||
|
Assert.isTrue(l == 0, "今日已签到");
|
||||||
|
SignLog signLog1 = signLogMapper.selectOne(Wrappers.<SignLog>lambdaQuery().eq(SignLog::getUserId, userId).eq(SignLog::getSignDate, yesterday).orderByDesc(SignLog::getSignDate));
|
||||||
|
SignLog signLog = new SignLog();
|
||||||
|
if (signLog1 != null) {
|
||||||
|
signLog.setContinueNums(signLog1.getContinueNums() + 1);
|
||||||
|
}else {
|
||||||
|
signLog.setContinueNums(1);
|
||||||
|
}
|
||||||
|
User user = userMapper.selectById(userId);
|
||||||
|
Assert.notNull(user, "用户不存在");
|
||||||
|
user.setMoney(user.getMoney().add(amountToAdd));
|
||||||
|
|
||||||
|
userMapper.updateById(user);
|
||||||
|
signLog.setUserId(userId);
|
||||||
|
signLog.setSignDate(date);
|
||||||
|
signLog.setCreateTime(System.currentTimeMillis()/1000);
|
||||||
|
signLog.setUpdateTime(System.currentTimeMillis()/1000);
|
||||||
|
signLog.setSignMoney(amountToAdd);
|
||||||
|
signLogMapper.insert(signLog);
|
||||||
|
|
||||||
|
Integer changeType = LogMoneyEnum.UM_INC_ADMIN.getCode();
|
||||||
|
logMoneyMapper.add(userId,changeType,amountToAdd,0, "", "", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SignLogVo getSignStatus() {
|
||||||
|
Integer userId = ZJFrontThreadLocal.getUserId();
|
||||||
|
SignLogVo signLogVo = new SignLogVo();
|
||||||
|
|
||||||
|
User user = userMapper.selectById(userId);
|
||||||
|
Assert.notNull(user, "用户不存在");
|
||||||
|
signLogVo.setUserId(userId);
|
||||||
|
signLogVo.setMoney(user.getMoney());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List<String> stringList = generateDateList();
|
||||||
|
|
||||||
|
List<SignLog> signLogs = signLogMapper.selectList(Wrappers.<SignLog>lambdaQuery().eq(SignLog::getUserId, userId).in(SignLog::getSignDate, stringList).orderByDesc(SignLog::getCreateTime));
|
||||||
|
|
||||||
|
Set<String> stringSet = new HashSet<>(stringList);
|
||||||
|
List<SignDateVo> result = new ArrayList<>();
|
||||||
|
|
||||||
|
for (String date : stringSet) {
|
||||||
|
SignDateVo signDateVo = new SignDateVo();
|
||||||
|
signDateVo.setDate(date);
|
||||||
|
signDateVo.setIsSign(signLogs.stream().anyMatch(log -> log.getSignDate().equals(date)));
|
||||||
|
BigDecimal signMoneySum = signLogs.stream()
|
||||||
|
.filter(log -> log.getSignDate().equals(date))
|
||||||
|
.map(SignLog::getSignMoney)
|
||||||
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
signDateVo.setSignMoney(signMoneySum);
|
||||||
|
result.add(signDateVo);
|
||||||
|
}
|
||||||
|
result.sort((a, b) -> a.getDate().compareTo(b.getDate()));
|
||||||
|
signLogVo.setSignDateList(result);
|
||||||
|
int asInt = signLogs.stream().mapToInt(SignLog::getContinueNums).max().getAsInt();
|
||||||
|
signLogVo.setContinuousDays(asInt);
|
||||||
|
return signLogVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<WxArticleListedVo> articleList() {
|
||||||
|
List<WxArticle> wxArticles = wxArticleMapper.selectList(null);
|
||||||
|
List<WxArticleListedVo> wxArticleList = new ArrayList<>();
|
||||||
|
for (WxArticle wxArticle : wxArticles) {
|
||||||
|
WxArticleListedVo wxArticleListedVo = new WxArticleListedVo();
|
||||||
|
BeanUtils.copyProperties(wxArticle, wxArticleListedVo);
|
||||||
|
wxArticleListedVo.setCreateTime(TimeUtils.timestampToDate(wxArticle.getCreateTime()));
|
||||||
|
wxArticleListedVo.setUpdateTime(TimeUtils.timestampToDate(wxArticle.getUpdateTime()));
|
||||||
|
wxArticleListedVo.setImage(UrlUtils.toAbsoluteUrl(wxArticle.getImage()));
|
||||||
|
wxArticleList.add(wxArticleListedVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return wxArticleList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ShareRecord shareAdd() {
|
||||||
|
Integer userId = ZJFrontThreadLocal.getUserId();
|
||||||
|
List<ShareRecord> shareRecords = shareRecordMapper.selectList(Wrappers.<ShareRecord>lambdaQuery()
|
||||||
|
.eq(ShareRecord::getUserId, userId)
|
||||||
|
.in(ShareRecord::getCreateTime, TimeUtils.today())
|
||||||
|
.orderByDesc(ShareRecord::getCreateTime));
|
||||||
|
BigDecimal totalScope = shareRecords.stream().map(ShareRecord::getScope).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
Assert.isTrue(totalScope.compareTo(new BigDecimal("1000")) < 0, "今日分享任务已达上限");
|
||||||
|
ShareRecord shareRecord = new ShareRecord();
|
||||||
|
shareRecord.setUserId(userId);
|
||||||
|
shareRecord.setCreateTime(System.currentTimeMillis()/1000);
|
||||||
|
shareRecord.setUpdateTime(System.currentTimeMillis()/1000);
|
||||||
|
shareRecord.setScope(new BigDecimal("100"));
|
||||||
|
shareRecordMapper.insert(shareRecord);
|
||||||
|
|
||||||
|
User user = userMapper.selectById(userId);
|
||||||
|
Assert.notNull(user, "用户不存在");
|
||||||
|
user.setMoney(user.getMoney().add(amountToAdd));
|
||||||
|
userMapper.updateById(user);
|
||||||
|
|
||||||
|
Integer changeType = LogMoneyEnum.UM_INC_ADMIN.getCode();
|
||||||
|
logMoneyMapper.add(userId,changeType,amountToAdd,0, "", "", null);
|
||||||
|
|
||||||
|
return shareRecord;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
BigDecimal totalScope = new BigDecimal("900");
|
||||||
|
Assert.isTrue(totalScope.compareTo(new BigDecimal("1000")) < 0, "今日分享已达上限");
|
||||||
|
|
||||||
|
// Assert.isTrue(totalScope.compareTo(new BigDecimal("1000")) >= 0, "今日分享已达上限");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -12,17 +12,17 @@ spring:
|
||||||
username: root # 数据库账号
|
username: root # 数据库账号
|
||||||
password: ifpdge9z # 数据库密码
|
password: ifpdge9z # 数据库密码
|
||||||
# Redis配置
|
# Redis配置
|
||||||
# redis:
|
|
||||||
# host: 101.133.172.2 # Redis服务地址
|
|
||||||
# port: 2007 # Redis端口
|
|
||||||
# password: 123456 # Redis密码
|
|
||||||
# database: 14 # 数据库索引
|
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
host: 127.0.0.1 # Redis服务地址
|
host: 101.133.172.2 # Redis服务地址
|
||||||
port: 6379 # Redis端口
|
port: 2007 # Redis端口
|
||||||
password: 123456 # Redis密码
|
password: 123456 # Redis密码
|
||||||
database: 11
|
database: 14 # 数据库索引
|
||||||
|
|
||||||
|
# redis:
|
||||||
|
# host: 127.0.0.1 # Redis服务地址
|
||||||
|
# port: 6379 # Redis端口
|
||||||
|
# password: 123456 # Redis密码
|
||||||
|
# database: 11
|
||||||
# Mybatis-plus配置 【是否开启SQL日志输出】
|
# Mybatis-plus配置 【是否开启SQL日志输出】
|
||||||
#mybatis-plus:
|
#mybatis-plus:
|
||||||
# configuration:
|
# configuration:
|
||||||
|
|
|
||||||
|
|
@ -14,3 +14,8 @@ export function getUserDetail(params: any) {
|
||||||
export function userEdit(params: any) {
|
export function userEdit(params: any) {
|
||||||
return request.post({ url: '/user/edit', params })
|
return request.post({ url: '/user/edit', params })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function adjustMoney(params: any) {
|
||||||
|
return request.post({ url: '/user/adjustWallet', params })
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 分享任务文章列表
|
||||||
|
export function articleLists(params?: Record<string, any>) {
|
||||||
|
return request.get({ url: '/article/list', params })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 分享任务文章详情
|
||||||
|
export function articleDetail(params: Record<string, any>) {
|
||||||
|
return request.get({ url: '/article/detail', params })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 分享任务文章新增
|
||||||
|
export function articleAdd(params: Record<string, any>) {
|
||||||
|
return request.post({ url: '/article/add', params })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 分享任务文章编辑
|
||||||
|
export function articleEdit(params: Record<string, any>) {
|
||||||
|
return request.post({ url: '/article/edit', params })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 分享任务文章删除
|
||||||
|
export function articleDelete(params: Record<string, any>) {
|
||||||
|
return request.post({ url: '/article/del', params })
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,128 @@
|
||||||
|
<template>
|
||||||
|
<div class="edit-popup">
|
||||||
|
<popup
|
||||||
|
ref="popupRef"
|
||||||
|
:title="popupTitle"
|
||||||
|
:async="true"
|
||||||
|
width="550px"
|
||||||
|
:clickModalClose="true"
|
||||||
|
@confirm="handleSubmit"
|
||||||
|
@close="handleClose"
|
||||||
|
>
|
||||||
|
<el-form ref="formRef" :model="formData" label-width="84px" :rules="formRules">
|
||||||
|
<el-form-item label="链接地址" prop="linkUrl">
|
||||||
|
<el-input
|
||||||
|
v-model="formData.linkUrl"
|
||||||
|
placeholder="请输入链接地址"
|
||||||
|
type="textarea"
|
||||||
|
:autosize="{ minRows: 4, maxRows: 6 }"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="文章标题" prop="title">
|
||||||
|
<el-input v-model="formData.title" placeholder="请输入文章标题" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="文章分享图" prop="image">
|
||||||
|
<material-picker size="240px" file-size="200px" v-model="formData.image" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</popup>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import type { FormInstance } from 'element-plus'
|
||||||
|
import { articleEdit, articleAdd, articleDetail } from '@/api/article'
|
||||||
|
import Popup from '@/components/popup/index.vue'
|
||||||
|
import feedback from '@/utils/feedback'
|
||||||
|
import type { PropType } from 'vue'
|
||||||
|
defineProps({
|
||||||
|
dictData: {
|
||||||
|
type: Object as PropType<Record<string, any[]>>,
|
||||||
|
default: () => ({})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const emit = defineEmits(['success', 'close'])
|
||||||
|
const formRef = shallowRef<FormInstance>()
|
||||||
|
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
||||||
|
const mode = ref('add')
|
||||||
|
const popupTitle = computed(() => {
|
||||||
|
return mode.value == 'edit' ? '编辑分享任务文章' : '新增分享任务文章'
|
||||||
|
})
|
||||||
|
|
||||||
|
const formData = reactive({
|
||||||
|
id: '',
|
||||||
|
linkUrl: '',
|
||||||
|
title: '',
|
||||||
|
image: '',
|
||||||
|
})
|
||||||
|
|
||||||
|
const formRules = {
|
||||||
|
id: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入主键',
|
||||||
|
trigger: ['blur']
|
||||||
|
}
|
||||||
|
],
|
||||||
|
linkUrl: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入链接地址',
|
||||||
|
trigger: ['blur']
|
||||||
|
}
|
||||||
|
],
|
||||||
|
title: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入文章标题',
|
||||||
|
trigger: ['blur']
|
||||||
|
}
|
||||||
|
],
|
||||||
|
image: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请选择文章分享图',
|
||||||
|
trigger: ['blur']
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSubmit = async () => {
|
||||||
|
await formRef.value?.validate()
|
||||||
|
const data: any = { ...formData }
|
||||||
|
mode.value == 'edit' ? await articleEdit(data) : await articleAdd(data)
|
||||||
|
popupRef.value?.close()
|
||||||
|
feedback.msgSuccess('操作成功')
|
||||||
|
emit('success')
|
||||||
|
}
|
||||||
|
|
||||||
|
const open = (type = 'add') => {
|
||||||
|
mode.value = type
|
||||||
|
popupRef.value?.open()
|
||||||
|
}
|
||||||
|
|
||||||
|
const setFormData = async (data: Record<string, any>) => {
|
||||||
|
for (const key in formData) {
|
||||||
|
if (data[key] != null && data[key] != undefined) {
|
||||||
|
//@ts-ignore
|
||||||
|
formData[key] = data[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const getDetail = async (row: Record<string, any>) => {
|
||||||
|
const data = await articleDetail({
|
||||||
|
id: row.id
|
||||||
|
})
|
||||||
|
setFormData(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleClose = () => {
|
||||||
|
emit('close')
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
open,
|
||||||
|
setFormData,
|
||||||
|
getDetail
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,119 @@
|
||||||
|
<template>
|
||||||
|
<div class="index-lists">
|
||||||
|
<el-card class="!border-none" shadow="never">
|
||||||
|
<el-form ref="formRef" class="mb-[-16px]" :model="queryParams" :inline="true">
|
||||||
|
<el-form-item label="文章标题" prop="title">
|
||||||
|
<el-input class="w-[280px]" v-model="queryParams.title" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="resetPage">查询</el-button>
|
||||||
|
<el-button @click="resetParams">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
<el-card class="!border-none mt-4" shadow="never">
|
||||||
|
<div>
|
||||||
|
<el-button v-perms="['article:add']" type="primary" @click="handleAdd()">
|
||||||
|
<template #icon>
|
||||||
|
<icon name="el-icon-Plus" />
|
||||||
|
</template>
|
||||||
|
新增
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<el-table
|
||||||
|
class="mt-4"
|
||||||
|
size="large"
|
||||||
|
v-loading="pager.loading"
|
||||||
|
:data="pager.lists"
|
||||||
|
>
|
||||||
|
<el-table-column label="创建时间" prop="createTime" min-width="100" />
|
||||||
|
<el-table-column label="更新时间" prop="updateTime" min-width="100" />
|
||||||
|
<el-table-column label="链接地址" prop="linkUrl" min-width="100" />
|
||||||
|
<el-table-column label="文章标题" prop="title" min-width="100" />
|
||||||
|
<el-table-column label="文章分享图" prop="image" min-width="100">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<image-contain
|
||||||
|
:width="100"
|
||||||
|
:height="80"
|
||||||
|
:src="row.image"
|
||||||
|
:preview-src-list="[row.image]"
|
||||||
|
preview-teleported
|
||||||
|
hide-on-click-modal
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" width="120" fixed="right">
|
||||||
|
<template #default="{ row }">
|
||||||
|
<el-button
|
||||||
|
v-perms="['article:edit']"
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
@click="handleEdit(row)"
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-perms="['article:del']"
|
||||||
|
type="danger"
|
||||||
|
link
|
||||||
|
@click="handleDelete(row.id)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<div class="flex justify-end mt-4">
|
||||||
|
<pagination v-model="pager" @change="getLists" />
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
<edit-popup
|
||||||
|
v-if="showEdit"
|
||||||
|
ref="editRef"
|
||||||
|
@success="getLists"
|
||||||
|
@close="showEdit = false"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup name="article">
|
||||||
|
import { articleDelete, articleLists } from '@/api/article'
|
||||||
|
import { usePaging } from '@/hooks/usePaging'
|
||||||
|
import feedback from '@/utils/feedback'
|
||||||
|
import EditPopup from './edit.vue'
|
||||||
|
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||||
|
const showEdit = ref(false)
|
||||||
|
const queryParams = reactive({
|
||||||
|
linkUrl: '',
|
||||||
|
title: '',
|
||||||
|
image: '',
|
||||||
|
})
|
||||||
|
|
||||||
|
const { pager, getLists, resetPage, resetParams } = usePaging({
|
||||||
|
fetchFun: articleLists,
|
||||||
|
params: queryParams
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const handleAdd = async () => {
|
||||||
|
showEdit.value = true
|
||||||
|
await nextTick()
|
||||||
|
editRef.value?.open('add')
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleEdit = async (data: any) => {
|
||||||
|
showEdit.value = true
|
||||||
|
await nextTick()
|
||||||
|
editRef.value?.open('edit')
|
||||||
|
editRef.value?.getDetail(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleDelete = async (id: number) => {
|
||||||
|
await feedback.confirm('确定要删除?')
|
||||||
|
await articleDelete({ id })
|
||||||
|
feedback.msgSuccess('删除成功')
|
||||||
|
getLists()
|
||||||
|
}
|
||||||
|
|
||||||
|
getLists()
|
||||||
|
</script>
|
||||||
|
|
@ -16,9 +16,9 @@
|
||||||
<el-radio :label="2">扣减余额</el-radio>
|
<el-radio :label="2">扣减余额</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="调整余额" prop="num">
|
<el-form-item label="调整余额" prop="amount">
|
||||||
<el-input
|
<el-input
|
||||||
:model-value="formData.num"
|
:model-value="formData.amount"
|
||||||
placeholder="请输入调整的金额"
|
placeholder="请输入调整的金额"
|
||||||
type="number"
|
type="number"
|
||||||
@input="numberValidate"
|
@input="numberValidate"
|
||||||
|
|
@ -53,17 +53,17 @@ const emit = defineEmits<{
|
||||||
}>()
|
}>()
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
action: 1, //变动类型 1-增加 2-减少
|
action: 1, //变动类型 1-增加 2-减少
|
||||||
num: '',
|
amount: '',
|
||||||
remark: ''
|
remark: ''
|
||||||
})
|
})
|
||||||
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
||||||
|
|
||||||
const adjustmentMoney = computed(() => {
|
const adjustmentMoney = computed(() => {
|
||||||
return Number(props.value) + Number(formData.num) * (formData.action == 1 ? 1 : -1)
|
return Number(props.value) + Number(formData.amount) * (formData.action == 1 ? 1 : -1)
|
||||||
})
|
})
|
||||||
|
|
||||||
const formRules: FormRules = {
|
const formRules: FormRules = {
|
||||||
num: [
|
amount: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入调整的金额'
|
message: '请输入调整的金额'
|
||||||
|
|
@ -74,7 +74,7 @@ const numberValidate = (value: string) => {
|
||||||
if (value.includes('-')) {
|
if (value.includes('-')) {
|
||||||
return feedback.msgError('请输入正整数')
|
return feedback.msgError('请输入正整数')
|
||||||
}
|
}
|
||||||
formData.num = value
|
formData.amount = value
|
||||||
}
|
}
|
||||||
const handleConfirm = async () => {
|
const handleConfirm = async () => {
|
||||||
await formRef.value?.validate()
|
await formRef.value?.validate()
|
||||||
|
|
@ -98,7 +98,7 @@ watch(
|
||||||
watch(adjustmentMoney, (val) => {
|
watch(adjustmentMoney, (val) => {
|
||||||
if (val < 0) {
|
if (val < 0) {
|
||||||
feedback.msgError('调整后余额需大于0')
|
feedback.msgError('调整后余额需大于0')
|
||||||
formData.num = ''
|
formData.amount = ''
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -13,12 +13,12 @@
|
||||||
<div class="basis-40 flex flex-col justify-center items-center">
|
<div class="basis-40 flex flex-col justify-center items-center">
|
||||||
<div class="text-tx-regular">账户余额</div>
|
<div class="text-tx-regular">账户余额</div>
|
||||||
<div class="mt-2 flex items-center">
|
<div class="mt-2 flex items-center">
|
||||||
¥{{ formData.user_money }}
|
¥{{ formData.money || 0 }}
|
||||||
<el-button
|
<el-button
|
||||||
v-perms="['user.user/adjustMoney']"
|
v-perms="['user.user/adjustMoney']"
|
||||||
type="primary"
|
type="primary"
|
||||||
link
|
link
|
||||||
@click="handleAdjust(formData.user_money)"
|
@click="handleAdjust(formData.money)"
|
||||||
>
|
>
|
||||||
调整
|
调整
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
@ -106,7 +106,7 @@
|
||||||
|
|
||||||
<script lang="ts" setup name="consumerDetail">
|
<script lang="ts" setup name="consumerDetail">
|
||||||
import type { FormInstance } from 'element-plus'
|
import type { FormInstance } from 'element-plus'
|
||||||
import { getUserDetail, userEdit } from '@/api/consumer'
|
import { getUserDetail, userEdit ,adjustMoney } from '@/api/consumer'
|
||||||
import feedback from '@/utils/feedback'
|
import feedback from '@/utils/feedback'
|
||||||
import { isEmpty } from '@/utils/util'
|
import { isEmpty } from '@/utils/util'
|
||||||
import AccountAdjust from '../components/account-adjust.vue'
|
import AccountAdjust from '../components/account-adjust.vue'
|
||||||
|
|
@ -122,7 +122,8 @@ const formData = reactive({
|
||||||
realName: 0,
|
realName: 0,
|
||||||
sex: 0,
|
sex: 0,
|
||||||
sn: '',
|
sn: '',
|
||||||
username: ''
|
username: '',
|
||||||
|
money: 0
|
||||||
})
|
})
|
||||||
|
|
||||||
const formRef = shallowRef<FormInstance>()
|
const formRef = shallowRef<FormInstance>()
|
||||||
|
|
@ -155,7 +156,7 @@ const handleAdjust = (value: string) => {
|
||||||
adjustState.value = value
|
adjustState.value = value
|
||||||
}
|
}
|
||||||
const handleConfirmAdjust = async (value: any) => {
|
const handleConfirmAdjust = async (value: any) => {
|
||||||
await adjustMoney({ user_id: route.query.id, ...value })
|
await adjustMoney({ userId: route.query.id, ...value })
|
||||||
adjustState.show = false
|
adjustState.show = false
|
||||||
getDetails()
|
getDetails()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue