yshop1.4版本发布,新增积分会员功能等,详细看文档介绍
This commit is contained in:
14
README.md
14
README.md
@ -84,7 +84,7 @@ yshop基于当前流行技术组合的前后端分离商城系统: SpringBoot2
|
||||
</table>
|
||||
<table>
|
||||
<tr>
|
||||
<td><img src="https://images.gitee.com/uploads/images/2019/1129/234509_744765f9_477893.jpeg"/></td>
|
||||
<td><img src="https://images.gitee.com/uploads/images/2019/1130/114819_99540fd3_477893.jpeg"/></td>
|
||||
<td><img src="https://images.gitee.com/uploads/images/2019/1129/234538_62ba99b7_477893.jpeg"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -92,7 +92,7 @@ yshop基于当前流行技术组合的前后端分离商城系统: SpringBoot2
|
||||
<td><img src="https://images.gitee.com/uploads/images/2019/1129/234622_6f593729_477893.jpeg"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img src="https://images.gitee.com/uploads/images/2019/1129/234644_242668a1_477893.jpeg"/></td>
|
||||
<td><img src="https://images.gitee.com/uploads/images/2019/1130/114845_9ed3c82c_477893.jpeg"/></td>
|
||||
<td><img src="https://images.gitee.com/uploads/images/2019/1129/234703_49e8fe4f_477893.jpeg"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -131,7 +131,15 @@ yshop基于当前流行技术组合的前后端分离商城系统: SpringBoot2
|
||||
- 1.3.1版本手机端新增商户管理、后台新增统计
|
||||
- 1.3.2新增后台微信相关及其支付配置,新增自动回复配置
|
||||
- 1.3.3新增 后台微信图文发送功能,小程序配置,增加小程序授权等,修复一些bug等
|
||||
- 1.4版本规划:补充公众号功能、发布mpvue小程序
|
||||
- yshop1.4版本发布,更新如下:
|
||||
- 1.1、新增积分签到
|
||||
- 1.2、新增会员等级、任务等功能,新增会员价格等
|
||||
- 1.3、修复Redisson linux系统启动报错问题
|
||||
- 1.4、修复商户简单权限功能
|
||||
- 1.5、修复加入购物车覆盖问题
|
||||
- 1.6、修复拼团出现undefined
|
||||
- 1.7、会员后台新增余额调整
|
||||
- 1.8、修复新增配置数据有时候不成功问题等
|
||||
|
||||
|
||||
#### 反馈交流
|
||||
|
2
pom.xml
2
pom.xml
@ -7,7 +7,7 @@
|
||||
<groupId>co.yixiang</groupId>
|
||||
<artifactId>yshop</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.3</version>
|
||||
<version>1.4</version>
|
||||
|
||||
<modules>
|
||||
<module>yshop-common</module>
|
||||
|
@ -1 +1 @@
|
||||
nohup java -jar yshop-api-1.2.jar --spring.profiles.active=prod &
|
||||
nohup java -jar yshop-api-1.4.jar --spring.profiles.active=prod &
|
@ -1,4 +1,4 @@
|
||||
PID=$(ps -ef | grep yshop-api-1.2.jar | grep -v grep | awk '{ print $2 }')
|
||||
PID=$(ps -ef | grep yshop-api-1.4.jar | grep -v grep | awk '{ print $2 }')
|
||||
if [ -z "$PID" ];then
|
||||
echo Application is already stopped
|
||||
else
|
||||
|
834
sql/yxshop.sql
834
sql/yxshop.sql
File diff suppressed because one or more lines are too long
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>yshop</artifactId>
|
||||
<groupId>co.yixiang</groupId>
|
||||
<version>1.3</version>
|
||||
<version>1.4</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -21,18 +21,18 @@
|
||||
<dependency>
|
||||
<groupId>co.yixiang</groupId>
|
||||
<artifactId>yshop-common</artifactId>
|
||||
<version>1.3</version>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>co.yixiang</groupId>
|
||||
<artifactId>yshop-tools</artifactId>
|
||||
<version>1.3</version>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>co.yixiang</groupId>
|
||||
<artifactId>yshop-mp</artifactId>
|
||||
<version>1.3</version>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
|
||||
<!--jwt-->
|
||||
|
@ -12,6 +12,8 @@ import co.yixiang.modules.manage.web.param.OrderRemarkParam;
|
||||
import co.yixiang.modules.order.service.YxStoreOrderService;
|
||||
import co.yixiang.modules.order.web.dto.OrderCountDTO;
|
||||
import co.yixiang.modules.order.web.vo.YxStoreOrderQueryVo;
|
||||
import co.yixiang.modules.user.service.YxUserService;
|
||||
import co.yixiang.modules.user.web.vo.YxUserQueryVo;
|
||||
import co.yixiang.utils.SecurityUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@ -36,6 +38,7 @@ import java.util.Map;
|
||||
public class ShoperController extends BaseController {
|
||||
|
||||
private final YxStoreOrderService storeOrderService;
|
||||
//private final YxUserService yxUserService;
|
||||
|
||||
/**
|
||||
* 订单数据统计
|
||||
@ -43,7 +46,8 @@ public class ShoperController extends BaseController {
|
||||
@GetMapping("/admin/order/statistics")
|
||||
@ApiOperation(value = "订单数据统计",notes = "订单数据统计")
|
||||
public ApiResult<Object> statistics(){
|
||||
int uid = SecurityUtils.getUserId().intValue();
|
||||
//int uid = SecurityUtils.getUserId().intValue();
|
||||
|
||||
OrderCountDTO orderCountDTO = storeOrderService.orderData(0);
|
||||
OrderTimeDataDTO orderTimeDataDTO = storeOrderService.getOrderTimeData();
|
||||
|
||||
|
@ -50,7 +50,6 @@ import co.yixiang.modules.user.web.vo.YxUserQueryVo;
|
||||
import co.yixiang.modules.user.web.vo.YxWechatUserQueryVo;
|
||||
//import co.yixiang.redisson.DelayJob;
|
||||
//import co.yixiang.redisson.DelayJobService;
|
||||
import co.yixiang.redisson.DelayJob;
|
||||
import co.yixiang.redisson.DelayJobService;
|
||||
import co.yixiang.utils.OrderUtil;
|
||||
import co.yixiang.utils.RedisUtil;
|
||||
@ -1155,10 +1154,12 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<YxStoreOrderMapper,
|
||||
|
||||
|
||||
// 添加订单支付超期延时任务
|
||||
DelayJob delayJob = new DelayJob();
|
||||
delayJob.setOderId(storeOrder.getId());
|
||||
delayJob.setAClass(CancelOrderService.class);
|
||||
// 添加订单支付超期延时任务
|
||||
Map<String,Object> delayJob = new HashMap<>();
|
||||
delayJob.put("delayJobName","CANCEL_ORVERTIME_ORDER");
|
||||
delayJob.put("orderId",storeOrder.getId());
|
||||
delayJobService.submitJob(delayJob, CommonConstant.ORDER_OUTTIME_UNPAY);
|
||||
log.info("添加定时任务成功 订单id: [{}]:", storeOrder.getId());
|
||||
return storeOrder;
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ import java.util.List;
|
||||
*/
|
||||
public interface YxStoreProductService extends BaseService<YxStoreProduct> {
|
||||
|
||||
|
||||
void incProductStock(int num,int productId,String unique);
|
||||
|
||||
void decProductStock(int num,int productId,String unique);
|
||||
|
@ -18,6 +18,7 @@ import co.yixiang.modules.shop.web.vo.YxStoreCartQueryVo;
|
||||
import co.yixiang.common.service.impl.BaseServiceImpl;
|
||||
import co.yixiang.common.web.vo.Paging;
|
||||
import co.yixiang.modules.shop.web.vo.YxStoreProductQueryVo;
|
||||
import co.yixiang.modules.user.service.YxUserService;
|
||||
import co.yixiang.utils.OrderUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.Builder;
|
||||
@ -69,6 +70,9 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<YxStoreCartMapper, Y
|
||||
@Autowired
|
||||
private YxStoreCombinationMapper storeCombinationMapper;
|
||||
|
||||
@Autowired
|
||||
private YxUserService userService;
|
||||
|
||||
@Autowired
|
||||
private CartMap cartMap;
|
||||
|
||||
@ -174,8 +178,10 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<YxStoreCartMapper, Y
|
||||
storeProduct.setAttrInfo(productAttrValue);
|
||||
|
||||
//todo 设置真实价格
|
||||
storeCartQueryVo.setTruePrice(productAttrValue.getPrice()
|
||||
.doubleValue());
|
||||
//设置VIP价格
|
||||
double vipPrice = userService.setLevelPrice(
|
||||
productAttrValue.getPrice().doubleValue(),uid);
|
||||
storeCartQueryVo.setTruePrice(vipPrice);
|
||||
//todo 设置会员价
|
||||
storeCartQueryVo.setVipTruePrice(productAttrValue.getPrice()
|
||||
.doubleValue());
|
||||
@ -186,9 +192,10 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<YxStoreCartMapper, Y
|
||||
valid.add(storeCartQueryVo);
|
||||
}
|
||||
}else{
|
||||
|
||||
storeCartQueryVo.setTruePrice(storeProduct.getPrice()
|
||||
.doubleValue());
|
||||
//设置VIP价格
|
||||
double vipPrice = userService.setLevelPrice(
|
||||
storeProduct.getPrice().doubleValue(),uid);
|
||||
storeCartQueryVo.setTruePrice(vipPrice);
|
||||
//todo 设置会员价
|
||||
storeCartQueryVo.setVipTruePrice(0d);
|
||||
storeCartQueryVo.setCostPrice(storeProduct.getCost()
|
||||
@ -245,6 +252,7 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<YxStoreCartMapper, Y
|
||||
|
||||
QueryWrapper<YxStoreCart> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("uid",uid).eq("type",type).eq("is_pay",0).eq("is_del",0)
|
||||
.eq("product_id",productId)
|
||||
.eq("is_new",isNew).eq("product_attr_unique",productAttrUnique)
|
||||
.eq("combination_id",combinationId).eq("bargain_id",bargainId)
|
||||
.eq("seckill_id",seckillId);
|
||||
|
@ -16,6 +16,7 @@ import co.yixiang.modules.shop.web.vo.YxStoreProductAttrQueryVo;
|
||||
import co.yixiang.modules.shop.web.vo.YxStoreProductQueryVo;
|
||||
import co.yixiang.common.service.impl.BaseServiceImpl;
|
||||
import co.yixiang.common.web.vo.Paging;
|
||||
import co.yixiang.modules.user.service.YxUserService;
|
||||
import co.yixiang.utils.CateDTO;
|
||||
import co.yixiang.utils.TreeUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@ -28,6 +29,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -60,6 +62,10 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<YxStoreProductMap
|
||||
@Autowired
|
||||
private YxStoreProductReplyService replyService;
|
||||
|
||||
@Autowired
|
||||
private YxUserService userService;
|
||||
|
||||
|
||||
/**
|
||||
* 增加库存 减少销量
|
||||
* @param num
|
||||
@ -119,6 +125,10 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<YxStoreProductMap
|
||||
Map<String, Object> returnMap = storeProductAttrService.getProductAttrDetail(id,0,0);
|
||||
ProductDTO productDTO = new ProductDTO();
|
||||
YxStoreProductQueryVo storeProductQueryVo = storeProductMap.toDto(storeProduct);
|
||||
//设置VIP价格
|
||||
double vipPrice = userService.setLevelPrice(
|
||||
storeProductQueryVo.getPrice().doubleValue(),uid);
|
||||
storeProductQueryVo.setVipPrice(BigDecimal.valueOf(vipPrice));
|
||||
storeProductQueryVo.setUserCollect(relationService
|
||||
.isProductRelation(id,"product",uid,"collect"));
|
||||
productDTO.setStoreInfo(storeProductQueryVo);
|
||||
|
@ -3,26 +3,28 @@ package co.yixiang.modules.task;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import co.yixiang.modules.order.entity.YxStoreOrder;
|
||||
import co.yixiang.modules.order.service.YxStoreOrderService;
|
||||
import co.yixiang.redisson.DelayJob;
|
||||
import co.yixiang.redisson.ExecuteJob;
|
||||
import co.yixiang.utils.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class CancelOrderService implements ExecuteJob {
|
||||
@Override
|
||||
public void execute(DelayJob job) {
|
||||
log.info("系统开始处理延时任务---订单超时未付款---" + job.getOderId());
|
||||
public void execute(Map<String,Object> job) {
|
||||
if(job.get("delayJobName").equals("CANCEL_ORVERTIME_ORDER")){
|
||||
log.info("系统开始处理延时任务---订单超时未付款---" + job.get("orderId"));
|
||||
|
||||
YxStoreOrderService yxorderService = BeanUtil.getBean(YxStoreOrderService.class);
|
||||
|
||||
YxStoreOrder order = null;
|
||||
try {
|
||||
order = yxorderService.getOne(new QueryWrapper<YxStoreOrder>().eq("id", job.getOderId()).eq("is_del",0));
|
||||
order = yxorderService.getOne(new QueryWrapper<YxStoreOrder>().eq("id", job.get("orderId")).eq("is_del",0));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -32,7 +34,9 @@ public class CancelOrderService implements ExecuteJob {
|
||||
if(order.getPaid() != 0){
|
||||
return;
|
||||
}
|
||||
yxorderService.cancelOrderByTask(job.getOderId());
|
||||
log.info("系统结束处理延时任务---订单超时未付款取消---" + job.getOderId());
|
||||
yxorderService.cancelOrderByTask((int)job.get("orderId"));
|
||||
log.info("系统结束处理延时任务---订单超时未付款取消---" + job.get("orderId"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,77 @@
|
||||
package co.yixiang.modules.user.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import co.yixiang.common.entity.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 设置用户等级表
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-06
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "YxSystemUserLevel对象", description = "设置用户等级表")
|
||||
public class YxSystemUserLevel extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "商户id")
|
||||
private Integer merId;
|
||||
|
||||
@ApiModelProperty(value = "会员名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "购买金额")
|
||||
private BigDecimal money;
|
||||
|
||||
@ApiModelProperty(value = "有效时间")
|
||||
private Integer validDate;
|
||||
|
||||
@ApiModelProperty(value = "是否为永久会员")
|
||||
private Integer isForever;
|
||||
|
||||
@ApiModelProperty(value = "是否购买,1=购买,0=不购买")
|
||||
private Integer isPay;
|
||||
|
||||
@ApiModelProperty(value = "是否显示 1=显示,0=隐藏")
|
||||
private Integer isShow;
|
||||
|
||||
@ApiModelProperty(value = "会员等级")
|
||||
private Integer grade;
|
||||
|
||||
@ApiModelProperty(value = "享受折扣")
|
||||
private BigDecimal discount;
|
||||
|
||||
@ApiModelProperty(value = "会员卡背景")
|
||||
private String image;
|
||||
|
||||
@ApiModelProperty(value = "会员图标")
|
||||
private String icon;
|
||||
|
||||
@ApiModelProperty(value = "说明")
|
||||
@TableField(value = "`explain`")
|
||||
private String explain;
|
||||
|
||||
@ApiModelProperty(value = "添加时间")
|
||||
private Integer addTime;
|
||||
|
||||
@ApiModelProperty(value = "是否删除.1=删除,0=未删除")
|
||||
private Integer isDel;
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package co.yixiang.modules.user.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import co.yixiang.common.entity.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 等级任务设置
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-06
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "YxSystemUserTask对象", description = "等级任务设置")
|
||||
public class YxSystemUserTask extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "任务名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "配置原名")
|
||||
private String realName;
|
||||
|
||||
@ApiModelProperty(value = "任务类型")
|
||||
private String taskType;
|
||||
|
||||
@ApiModelProperty(value = "限定数")
|
||||
private Integer number;
|
||||
|
||||
@ApiModelProperty(value = "等级id")
|
||||
private Integer levelId;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty(value = "是否显示")
|
||||
private Integer isShow;
|
||||
|
||||
@ApiModelProperty(value = "是否务必达成任务,1务必达成,0=满足其一")
|
||||
private Integer isMust;
|
||||
|
||||
@ApiModelProperty(value = "任务说明")
|
||||
private String illustrate;
|
||||
|
||||
@ApiModelProperty(value = "新增时间")
|
||||
private Integer addTime;
|
||||
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package co.yixiang.modules.user.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import co.yixiang.common.entity.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户等级记录表
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-06
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "YxUserLevel对象", description = "用户等级记录表")
|
||||
public class YxUserLevel extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "用户uid")
|
||||
private Integer uid;
|
||||
|
||||
@ApiModelProperty(value = "等级vip")
|
||||
private Integer levelId;
|
||||
|
||||
@ApiModelProperty(value = "会员等级")
|
||||
private Integer grade;
|
||||
|
||||
@ApiModelProperty(value = "过期时间")
|
||||
private Integer validTime;
|
||||
|
||||
@ApiModelProperty(value = "是否永久")
|
||||
private Integer isForever;
|
||||
|
||||
@ApiModelProperty(value = "商户id")
|
||||
private Integer merId;
|
||||
|
||||
@ApiModelProperty(value = "0:禁止,1:正常")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String mark;
|
||||
|
||||
@ApiModelProperty(value = "是否已通知")
|
||||
private Integer remind;
|
||||
|
||||
@ApiModelProperty(value = "是否删除,0=未删除,1=删除")
|
||||
private Integer isDel;
|
||||
|
||||
@ApiModelProperty(value = "添加时间")
|
||||
private Integer addTime;
|
||||
|
||||
@ApiModelProperty(value = "享受折扣")
|
||||
private Integer discount;
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package co.yixiang.modules.user.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import co.yixiang.common.entity.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 签到记录表
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-05
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "YxUserSign对象", description = "签到记录表")
|
||||
public class YxUserSign extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "用户uid")
|
||||
private Integer uid;
|
||||
|
||||
@ApiModelProperty(value = "签到说明")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "获得积分")
|
||||
private Integer number;
|
||||
|
||||
@ApiModelProperty(value = "剩余积分")
|
||||
private Integer balance;
|
||||
|
||||
@ApiModelProperty(value = "添加时间")
|
||||
private Integer addTime;
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package co.yixiang.modules.user.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import co.yixiang.common.entity.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户任务完成记录表
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-07
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "YxUserTaskFinish对象", description = "用户任务完成记录表")
|
||||
public class YxUserTaskFinish extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "任务id")
|
||||
private Integer taskId;
|
||||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Integer uid;
|
||||
|
||||
@ApiModelProperty(value = "是否有效")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "添加时间")
|
||||
private Integer addTime;
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package co.yixiang.modules.user.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import co.yixiang.modules.user.entity.YxSystemUserLevel;
|
||||
import co.yixiang.modules.user.web.param.YxSystemUserLevelQueryParam;
|
||||
import co.yixiang.modules.user.web.vo.YxSystemUserLevelQueryVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 设置用户等级表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-06
|
||||
*/
|
||||
@Repository
|
||||
public interface YxSystemUserLevelMapper extends BaseMapper<YxSystemUserLevel> {
|
||||
|
||||
/**
|
||||
* 根据ID获取查询对象
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
YxSystemUserLevelQueryVo getYxSystemUserLevelById(Serializable id);
|
||||
|
||||
/**
|
||||
* 获取分页对象
|
||||
* @param page
|
||||
* @param yxSystemUserLevelQueryParam
|
||||
* @return
|
||||
*/
|
||||
IPage<YxSystemUserLevelQueryVo> getYxSystemUserLevelPageList(@Param("page") Page page, @Param("param") YxSystemUserLevelQueryParam yxSystemUserLevelQueryParam);
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package co.yixiang.modules.user.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import co.yixiang.modules.user.entity.YxSystemUserTask;
|
||||
import co.yixiang.modules.user.web.param.YxSystemUserTaskQueryParam;
|
||||
import co.yixiang.modules.user.web.vo.YxSystemUserTaskQueryVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 等级任务设置 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-06
|
||||
*/
|
||||
@Repository
|
||||
public interface YxSystemUserTaskMapper extends BaseMapper<YxSystemUserTask> {
|
||||
|
||||
/**
|
||||
* 根据ID获取查询对象
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
YxSystemUserTaskQueryVo getYxSystemUserTaskById(Serializable id);
|
||||
|
||||
/**
|
||||
* 获取分页对象
|
||||
* @param page
|
||||
* @param yxSystemUserTaskQueryParam
|
||||
* @return
|
||||
*/
|
||||
IPage<YxSystemUserTaskQueryVo> getYxSystemUserTaskPageList(@Param("page") Page page, @Param("param") YxSystemUserTaskQueryParam yxSystemUserTaskQueryParam);
|
||||
|
||||
}
|
@ -1,9 +1,6 @@
|
||||
package co.yixiang.modules.user.mapper;
|
||||
|
||||
import co.yixiang.modules.user.web.dto.BillDTO;
|
||||
import co.yixiang.modules.user.web.dto.BillOrderRecordDTO;
|
||||
import co.yixiang.modules.user.web.dto.PromUserDTO;
|
||||
import co.yixiang.modules.user.web.dto.UserBillDTO;
|
||||
import co.yixiang.modules.user.web.dto.*;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
@ -30,6 +27,17 @@ import java.util.List;
|
||||
@Repository
|
||||
public interface YxUserBillMapper extends BaseMapper<YxUserBill> {
|
||||
|
||||
@Select("select IFNULL(sum(number),0) from yx_user_bill " +
|
||||
"where status=1 and type='sign' and pm=1 and category='integral' " +
|
||||
"and uid=#{uid}")
|
||||
double sumIntegral(@Param("uid") int uid);
|
||||
|
||||
@Select("SELECT FROM_UNIXTIME(a.add_time,'%Y-%m-%d') as addTime,a.title,a.number " +
|
||||
"FROM yx_user_bill a INNER JOIN yx_user u ON u.uid=a.uid WHERE a.category = 'integral'" +
|
||||
" AND a.type = 'sign' AND a.status = 1 AND a.uid = #{uid} " +
|
||||
"ORDER BY a.add_time DESC")
|
||||
List<SignDTO> getSignList(@Param("uid") int uid, Page page);
|
||||
|
||||
@Select("SELECT o.order_id as orderId,FROM_UNIXTIME(b.add_time, '%Y-%m-%d %H:%i') as time," +
|
||||
"b.number,u.avatar,u.nickname FROM yx_user_bill b " +
|
||||
"INNER JOIN yx_store_order o ON o.id=b.link_id " +
|
||||
|
@ -0,0 +1,47 @@
|
||||
package co.yixiang.modules.user.mapper;
|
||||
|
||||
import co.yixiang.modules.user.web.dto.UserLevelInfoDTO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import co.yixiang.modules.user.entity.YxUserLevel;
|
||||
import co.yixiang.modules.user.web.param.YxUserLevelQueryParam;
|
||||
import co.yixiang.modules.user.web.vo.YxUserLevelQueryVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户等级记录表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-06
|
||||
*/
|
||||
@Repository
|
||||
public interface YxUserLevelMapper extends BaseMapper<YxUserLevel> {
|
||||
|
||||
@Select("SELECT l.id,a.add_time as addTime,l.discount,a.level_id as levelId,l.name," +
|
||||
"l.icon,l.grade FROM yx_user_level a INNER JOIN yx_system_user_level l " +
|
||||
"ON l.id=a.level_id WHERE a.status = 1 AND a.is_del = 0 AND a.id = #{id} LIMIT 1")
|
||||
UserLevelInfoDTO getUserLevelInfo(int id);
|
||||
|
||||
/**
|
||||
* 根据ID获取查询对象
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
YxUserLevelQueryVo getYxUserLevelById(Serializable id);
|
||||
|
||||
/**
|
||||
* 获取分页对象
|
||||
* @param page
|
||||
* @param yxUserLevelQueryParam
|
||||
* @return
|
||||
*/
|
||||
IPage<YxUserLevelQueryVo> getYxUserLevelPageList(@Param("page") Page page, @Param("param") YxUserLevelQueryParam yxUserLevelQueryParam);
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package co.yixiang.modules.user.mapper;
|
||||
|
||||
import co.yixiang.modules.user.entity.YxUserBill;
|
||||
import co.yixiang.modules.user.web.dto.BillDTO;
|
||||
import co.yixiang.modules.user.web.dto.SignDTO;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import co.yixiang.modules.user.entity.YxUserSign;
|
||||
import co.yixiang.modules.user.web.param.YxUserSignQueryParam;
|
||||
import co.yixiang.modules.user.web.vo.YxUserSignQueryVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 签到记录表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-05
|
||||
*/
|
||||
@Repository
|
||||
public interface YxUserSignMapper extends BaseMapper<YxUserSign> {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据ID获取查询对象
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
YxUserSignQueryVo getYxUserSignById(Serializable id);
|
||||
|
||||
/**
|
||||
* 获取分页对象
|
||||
* @param page
|
||||
* @param yxUserSignQueryParam
|
||||
* @return
|
||||
*/
|
||||
IPage<YxUserSignQueryVo> getYxUserSignPageList(@Param("page") Page page, @Param("param") YxUserSignQueryParam yxUserSignQueryParam);
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package co.yixiang.modules.user.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import co.yixiang.modules.user.entity.YxUserTaskFinish;
|
||||
import co.yixiang.modules.user.web.param.YxUserTaskFinishQueryParam;
|
||||
import co.yixiang.modules.user.web.vo.YxUserTaskFinishQueryVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户任务完成记录表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-07
|
||||
*/
|
||||
@Repository
|
||||
public interface YxUserTaskFinishMapper extends BaseMapper<YxUserTaskFinish> {
|
||||
|
||||
/**
|
||||
* 根据ID获取查询对象
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
YxUserTaskFinishQueryVo getYxUserTaskFinishById(Serializable id);
|
||||
|
||||
/**
|
||||
* 获取分页对象
|
||||
* @param page
|
||||
* @param yxUserTaskFinishQueryParam
|
||||
* @return
|
||||
*/
|
||||
IPage<YxUserTaskFinishQueryVo> getYxUserTaskFinishPageList(@Param("page") Page page, @Param("param") YxUserTaskFinishQueryParam yxUserTaskFinishQueryParam);
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package co.yixiang.modules.user.mapping;
|
||||
|
||||
import co.yixiang.mapper.EntityMapper;
|
||||
import co.yixiang.modules.user.entity.YxSystemUserLevel;
|
||||
import co.yixiang.modules.user.web.vo.YxSystemUserLevelQueryVo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-12-7
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface SystemUserLevelMap extends EntityMapper<YxSystemUserLevelQueryVo, YxSystemUserLevel> {
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package co.yixiang.modules.user.mapping;
|
||||
|
||||
import co.yixiang.mapper.EntityMapper;
|
||||
import co.yixiang.modules.user.entity.YxSystemUserTask;
|
||||
import co.yixiang.modules.user.web.vo.YxSystemUserTaskQueryVo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-12-7
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface SystemUserTaskMap extends EntityMapper<YxSystemUserTaskQueryVo, YxSystemUserTask> {
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package co.yixiang.modules.user.service;
|
||||
|
||||
import co.yixiang.modules.user.entity.YxSystemUserLevel;
|
||||
import co.yixiang.common.service.BaseService;
|
||||
import co.yixiang.modules.user.web.dto.UserLevelDTO;
|
||||
import co.yixiang.modules.user.web.param.YxSystemUserLevelQueryParam;
|
||||
import co.yixiang.modules.user.web.vo.YxSystemUserLevelQueryVo;
|
||||
import co.yixiang.common.web.vo.Paging;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 设置用户等级表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-06
|
||||
*/
|
||||
public interface YxSystemUserLevelService extends BaseService<YxSystemUserLevel> {
|
||||
|
||||
int getNextLevelId(int levelId);
|
||||
|
||||
boolean getClear(int levelId);
|
||||
|
||||
List<YxSystemUserLevelQueryVo> getLevelListAndGrade(Integer levelId,boolean isTask);
|
||||
|
||||
UserLevelDTO getLevelInfo(int uid,boolean isTask);
|
||||
|
||||
/**
|
||||
* 根据ID获取查询对象
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
YxSystemUserLevelQueryVo getYxSystemUserLevelById(Serializable id);
|
||||
|
||||
/**
|
||||
* 获取分页对象
|
||||
* @param yxSystemUserLevelQueryParam
|
||||
* @return
|
||||
*/
|
||||
Paging<YxSystemUserLevelQueryVo> getYxSystemUserLevelPageList(YxSystemUserLevelQueryParam yxSystemUserLevelQueryParam) throws Exception;
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package co.yixiang.modules.user.service;
|
||||
|
||||
import co.yixiang.modules.user.entity.YxSystemUserTask;
|
||||
import co.yixiang.common.service.BaseService;
|
||||
import co.yixiang.modules.user.web.dto.TaskDTO;
|
||||
import co.yixiang.modules.user.web.dto.UserLevelInfoDTO;
|
||||
import co.yixiang.modules.user.web.param.YxSystemUserTaskQueryParam;
|
||||
import co.yixiang.modules.user.web.vo.YxSystemUserTaskQueryVo;
|
||||
import co.yixiang.common.web.vo.Paging;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 等级任务设置 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-06
|
||||
*/
|
||||
public interface YxSystemUserTaskService extends BaseService<YxSystemUserTask> {
|
||||
|
||||
List<YxSystemUserTaskQueryVo> tidyTask(List<YxSystemUserTaskQueryVo> task,int uid);
|
||||
|
||||
int getTaskComplete(int levelId,int uid);
|
||||
|
||||
TaskDTO getTaskList(int levelId, int uid, UserLevelInfoDTO level);
|
||||
|
||||
/**
|
||||
* 根据ID获取查询对象
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
YxSystemUserTaskQueryVo getYxSystemUserTaskById(Serializable id) throws Exception;
|
||||
|
||||
/**
|
||||
* 获取分页对象
|
||||
* @param yxSystemUserTaskQueryParam
|
||||
* @return
|
||||
*/
|
||||
Paging<YxSystemUserTaskQueryVo> getYxSystemUserTaskPageList(YxSystemUserTaskQueryParam yxSystemUserTaskQueryParam) throws Exception;
|
||||
|
||||
}
|
@ -22,6 +22,8 @@ import java.util.Map;
|
||||
*/
|
||||
public interface YxUserBillService extends BaseService<YxUserBill> {
|
||||
|
||||
int cumulativeAttendance(int uid);
|
||||
|
||||
Map<String,Object> spreadOrder(int uid,int page,int limit);
|
||||
|
||||
List<BillDTO> getUserBillList(int page, int limit, int uid, int type);
|
||||
|
@ -0,0 +1,44 @@
|
||||
package co.yixiang.modules.user.service;
|
||||
|
||||
import co.yixiang.modules.user.entity.YxUserLevel;
|
||||
import co.yixiang.common.service.BaseService;
|
||||
import co.yixiang.modules.user.web.dto.UserLevelInfoDTO;
|
||||
import co.yixiang.modules.user.web.param.YxUserLevelQueryParam;
|
||||
import co.yixiang.modules.user.web.vo.YxUserLevelQueryVo;
|
||||
import co.yixiang.common.web.vo.Paging;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户等级记录表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-06
|
||||
*/
|
||||
public interface YxUserLevelService extends BaseService<YxUserLevel> {
|
||||
|
||||
void setUserLevel(int uid,int levelId);
|
||||
|
||||
void setLevelComplete(int uid);
|
||||
|
||||
UserLevelInfoDTO getUserLevelInfo(int id);
|
||||
|
||||
int getUserLevel(int uid,int grade);
|
||||
|
||||
/**
|
||||
* 根据ID获取查询对象
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
YxUserLevelQueryVo getYxUserLevelById(Serializable id) throws Exception;
|
||||
|
||||
/**
|
||||
* 获取分页对象
|
||||
* @param yxUserLevelQueryParam
|
||||
* @return
|
||||
*/
|
||||
Paging<YxUserLevelQueryVo> getYxUserLevelPageList(YxUserLevelQueryParam yxUserLevelQueryParam) throws Exception;
|
||||
|
||||
}
|
@ -23,6 +23,8 @@ import java.util.List;
|
||||
*/
|
||||
public interface YxUserService extends BaseService<YxUser> {
|
||||
|
||||
double setLevelPrice(double price, int uid);
|
||||
|
||||
void incMoney(int uid,double price);
|
||||
|
||||
void incIntegral(int uid,double integral);
|
||||
|
@ -0,0 +1,47 @@
|
||||
package co.yixiang.modules.user.service;
|
||||
|
||||
import co.yixiang.modules.user.entity.YxUserSign;
|
||||
import co.yixiang.common.service.BaseService;
|
||||
import co.yixiang.modules.user.web.dto.SignDTO;
|
||||
import co.yixiang.modules.user.web.param.YxUserSignQueryParam;
|
||||
import co.yixiang.modules.user.web.vo.YxUserSignQueryVo;
|
||||
import co.yixiang.common.web.vo.Paging;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 签到记录表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-05
|
||||
*/
|
||||
public interface YxUserSignService extends BaseService<YxUserSign> {
|
||||
|
||||
int sign(int uid);
|
||||
|
||||
List<SignDTO> getSignList(int uid,int page,int limit);
|
||||
|
||||
boolean getYesterDayIsSign(int uid);
|
||||
|
||||
boolean getToDayIsSign(int uid);
|
||||
|
||||
int getSignSumDay(int uid);
|
||||
|
||||
/**
|
||||
* 根据ID获取查询对象
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
YxUserSignQueryVo getYxUserSignById(Serializable id) throws Exception;
|
||||
|
||||
/**
|
||||
* 获取分页对象
|
||||
* @param yxUserSignQueryParam
|
||||
* @return
|
||||
*/
|
||||
Paging<YxUserSignQueryVo> getYxUserSignPageList(YxUserSignQueryParam yxUserSignQueryParam) throws Exception;
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package co.yixiang.modules.user.service;
|
||||
|
||||
import co.yixiang.modules.user.entity.YxUserTaskFinish;
|
||||
import co.yixiang.common.service.BaseService;
|
||||
import co.yixiang.modules.user.web.param.YxUserTaskFinishQueryParam;
|
||||
import co.yixiang.modules.user.web.vo.YxUserTaskFinishQueryVo;
|
||||
import co.yixiang.common.web.vo.Paging;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户任务完成记录表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-07
|
||||
*/
|
||||
public interface YxUserTaskFinishService extends BaseService<YxUserTaskFinish> {
|
||||
|
||||
void setFinish(int uid,int taskId);
|
||||
|
||||
/**
|
||||
* 根据ID获取查询对象
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
YxUserTaskFinishQueryVo getYxUserTaskFinishById(Serializable id) throws Exception;
|
||||
|
||||
/**
|
||||
* 获取分页对象
|
||||
* @param yxUserTaskFinishQueryParam
|
||||
* @return
|
||||
*/
|
||||
Paging<YxUserTaskFinishQueryVo> getYxUserTaskFinishPageList(YxUserTaskFinishQueryParam yxUserTaskFinishQueryParam) throws Exception;
|
||||
|
||||
}
|
@ -0,0 +1,156 @@
|
||||
package co.yixiang.modules.user.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import co.yixiang.modules.user.entity.YxSystemUserLevel;
|
||||
import co.yixiang.modules.user.mapper.YxSystemUserLevelMapper;
|
||||
import co.yixiang.modules.user.mapping.SystemUserLevelMap;
|
||||
import co.yixiang.modules.user.service.YxSystemUserLevelService;
|
||||
import co.yixiang.modules.user.service.YxSystemUserTaskService;
|
||||
import co.yixiang.modules.user.service.YxUserLevelService;
|
||||
import co.yixiang.modules.user.web.dto.TaskDTO;
|
||||
import co.yixiang.modules.user.web.dto.UserLevelDTO;
|
||||
import co.yixiang.modules.user.web.dto.UserLevelInfoDTO;
|
||||
import co.yixiang.modules.user.web.param.YxSystemUserLevelQueryParam;
|
||||
import co.yixiang.modules.user.web.vo.YxSystemUserLevelQueryVo;
|
||||
import co.yixiang.common.service.impl.BaseServiceImpl;
|
||||
import co.yixiang.common.web.vo.Paging;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 设置用户等级表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-06
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class YxSystemUserLevelServiceImpl extends BaseServiceImpl<YxSystemUserLevelMapper, YxSystemUserLevel> implements YxSystemUserLevelService {
|
||||
|
||||
@Autowired
|
||||
private YxSystemUserLevelMapper yxSystemUserLevelMapper;
|
||||
|
||||
@Autowired
|
||||
private YxUserLevelService userLevelService;
|
||||
|
||||
@Autowired
|
||||
private SystemUserLevelMap systemUserLevelMap;
|
||||
|
||||
@Autowired
|
||||
private YxSystemUserTaskService systemUserTaskService;
|
||||
|
||||
/**
|
||||
* 获取当前的下一个会员id
|
||||
* @param levelId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int getNextLevelId(int levelId) {
|
||||
QueryWrapper<YxSystemUserLevel> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("is_del",0).eq("is_show",1).orderByAsc("grade");
|
||||
List<YxSystemUserLevel> list = yxSystemUserLevelMapper.selectList(wrapper);
|
||||
int grade = 0;
|
||||
for (YxSystemUserLevel userLevel : list) {
|
||||
if(userLevel.getId() == levelId) grade = userLevel.getGrade();
|
||||
}
|
||||
|
||||
QueryWrapper<YxSystemUserLevel> wrapperT = new QueryWrapper<>();
|
||||
wrapperT.eq("is_del",0).eq("is_show",1).orderByAsc("grade")
|
||||
.gt("grade",grade).last("limit 1");
|
||||
YxSystemUserLevel userLevel = yxSystemUserLevelMapper.selectOne(wrapperT);
|
||||
if(ObjectUtil.isNull(userLevel)) return 0;
|
||||
return userLevel.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getClear(int levelId) {
|
||||
List<YxSystemUserLevelQueryVo> systemUserLevelQueryVos = getLevelListAndGrade(
|
||||
levelId,false);
|
||||
for (YxSystemUserLevelQueryVo userLevelQueryVo : systemUserLevelQueryVos) {
|
||||
if(userLevelQueryVo.getId() == levelId) return userLevelQueryVo.getIsClear();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取会员等级列表
|
||||
* @param levelId
|
||||
* @param isTask
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<YxSystemUserLevelQueryVo> getLevelListAndGrade(Integer levelId, boolean isTask) {
|
||||
int grade = 0;
|
||||
|
||||
// QueryWrapper<YxSystemUserLevel> wrapper = new QueryWrapper<>();
|
||||
// wrapper.eq("is_del",0).eq("is_show",1).orderByAsc("grade").last("LIMIT 1");
|
||||
|
||||
// if(levelId == 0){
|
||||
// //levelId = yxSystemUserLevelMapper.selectOne(wrapper).getId();
|
||||
// }else{
|
||||
// levelId = 0;
|
||||
// }
|
||||
|
||||
QueryWrapper<YxSystemUserLevel> wrapperT = new QueryWrapper<>();
|
||||
wrapperT.eq("is_del",0).eq("is_show",1).orderByAsc("grade");
|
||||
List<YxSystemUserLevel> list = yxSystemUserLevelMapper.selectList(wrapperT);
|
||||
List<YxSystemUserLevelQueryVo> newList = systemUserLevelMap.toDto(list);
|
||||
for (YxSystemUserLevelQueryVo userLevelQueryVo : newList) {
|
||||
if(userLevelQueryVo.getId() == levelId) grade = userLevelQueryVo.getGrade();
|
||||
|
||||
if(grade < userLevelQueryVo.getGrade()){
|
||||
userLevelQueryVo.setIsClear(true);
|
||||
}else{
|
||||
userLevelQueryVo.setIsClear(false);//开启会员解锁
|
||||
}
|
||||
}
|
||||
return newList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取会员等级列表
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public UserLevelDTO getLevelInfo(int uid,boolean isTask) {
|
||||
int id = userLevelService.getUserLevel(uid,0); //用户当前等级id
|
||||
UserLevelInfoDTO userLevelInfoDTO = null;
|
||||
if(id > 0) userLevelInfoDTO = userLevelService.getUserLevelInfo(id);
|
||||
int levelId = 0;
|
||||
if(ObjectUtil.isNotNull(userLevelInfoDTO)) levelId = userLevelInfoDTO.getId();
|
||||
List<YxSystemUserLevelQueryVo> list = getLevelListAndGrade(levelId,false);
|
||||
TaskDTO taskDTO = systemUserTaskService.getTaskList(list.get(0).getId(),uid,null);
|
||||
|
||||
UserLevelDTO userLevelDTO = new UserLevelDTO();
|
||||
userLevelDTO.setList(list);
|
||||
userLevelDTO.setTask(taskDTO);
|
||||
|
||||
return userLevelDTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public YxSystemUserLevelQueryVo getYxSystemUserLevelById(Serializable id){
|
||||
return yxSystemUserLevelMapper.getYxSystemUserLevelById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Paging<YxSystemUserLevelQueryVo> getYxSystemUserLevelPageList(YxSystemUserLevelQueryParam yxSystemUserLevelQueryParam) throws Exception{
|
||||
Page page = setPageParam(yxSystemUserLevelQueryParam,OrderItem.desc("create_time"));
|
||||
IPage<YxSystemUserLevelQueryVo> iPage = yxSystemUserLevelMapper.getYxSystemUserLevelPageList(page,yxSystemUserLevelQueryParam);
|
||||
return new Paging(iPage);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,185 @@
|
||||
package co.yixiang.modules.user.service.impl;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import co.yixiang.modules.order.mapper.YxStoreOrderMapper;
|
||||
import co.yixiang.modules.user.entity.YxSystemUserTask;
|
||||
import co.yixiang.modules.user.entity.YxUserTaskFinish;
|
||||
import co.yixiang.modules.user.mapper.YxSystemUserTaskMapper;
|
||||
import co.yixiang.modules.user.mapper.YxUserBillMapper;
|
||||
import co.yixiang.modules.user.mapper.YxUserTaskFinishMapper;
|
||||
import co.yixiang.modules.user.mapping.SystemUserTaskMap;
|
||||
import co.yixiang.modules.user.service.YxSystemUserLevelService;
|
||||
import co.yixiang.modules.user.service.YxSystemUserTaskService;
|
||||
import co.yixiang.modules.user.service.YxUserBillService;
|
||||
import co.yixiang.modules.user.service.YxUserTaskFinishService;
|
||||
import co.yixiang.modules.user.web.dto.TaskDTO;
|
||||
import co.yixiang.modules.user.web.dto.UserLevelInfoDTO;
|
||||
import co.yixiang.modules.user.web.param.YxSystemUserTaskQueryParam;
|
||||
import co.yixiang.modules.user.web.vo.YxSystemUserTaskQueryVo;
|
||||
import co.yixiang.common.service.impl.BaseServiceImpl;
|
||||
import co.yixiang.common.web.vo.Paging;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.io.Serializable;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 等级任务设置 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-06
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class YxSystemUserTaskServiceImpl extends BaseServiceImpl<YxSystemUserTaskMapper, YxSystemUserTask> implements YxSystemUserTaskService {
|
||||
|
||||
@Autowired
|
||||
private YxSystemUserTaskMapper yxSystemUserTaskMapper;
|
||||
|
||||
@Autowired
|
||||
private SystemUserTaskMap systemUserTaskMap;
|
||||
|
||||
@Autowired
|
||||
private YxSystemUserLevelService systemUserLevelService;
|
||||
|
||||
@Autowired
|
||||
private YxUserTaskFinishMapper yxUserTaskFinishMapper;
|
||||
|
||||
@Autowired
|
||||
private YxUserBillMapper userBillMapper;
|
||||
|
||||
@Autowired
|
||||
private YxStoreOrderMapper storeOrderMapper;
|
||||
|
||||
@Autowired
|
||||
private YxUserTaskFinishService userTaskFinishService;
|
||||
|
||||
@Autowired
|
||||
private YxUserBillService userBillService;
|
||||
|
||||
/**
|
||||
* 设置任务内容完成情况
|
||||
* @param task
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<YxSystemUserTaskQueryVo> tidyTask(List<YxSystemUserTaskQueryVo> task,int uid) {
|
||||
QueryWrapper<YxUserTaskFinish> wrapper = new QueryWrapper<>();
|
||||
for (YxSystemUserTaskQueryVo taskQueryVo : task) {
|
||||
wrapper.in("task_id",taskQueryVo.getId()).eq("uid",uid);
|
||||
int count = yxUserTaskFinishMapper.selectCount(wrapper);
|
||||
if(count > 0){
|
||||
taskQueryVo.setNewNumber(taskQueryVo.getNumber());
|
||||
taskQueryVo.setSpeed(100);
|
||||
taskQueryVo.setFinish(1);
|
||||
taskQueryVo.setTaskTypeTitle("");
|
||||
}else{
|
||||
double sumNumber = 0d;
|
||||
String title = "";
|
||||
switch (taskQueryVo.getTaskType()){
|
||||
case "SatisfactionIntegral":
|
||||
sumNumber = userBillMapper.sumIntegral(uid);
|
||||
title = "还需要{0}经验";
|
||||
break;
|
||||
case "ConsumptionAmount":
|
||||
sumNumber = storeOrderMapper.sumPrice(uid);
|
||||
title = "还需消费{0}元";
|
||||
break;
|
||||
case "CumulativeAttendance":
|
||||
sumNumber = userBillService.cumulativeAttendance(uid);
|
||||
title = "还需签到{0}天";
|
||||
break;
|
||||
}
|
||||
|
||||
//System.out.println("sumNumber:"+sumNumber);
|
||||
//System.out.println("sumNumber2:"+taskQueryVo.getNumber());
|
||||
if(sumNumber >= taskQueryVo.getNumber()){
|
||||
userTaskFinishService.setFinish(uid,taskQueryVo.getId());
|
||||
taskQueryVo.setFinish(1);
|
||||
taskQueryVo.setSpeed(100);
|
||||
taskQueryVo.setTaskTypeTitle("");
|
||||
taskQueryVo.setNewNumber(taskQueryVo.getNumber());
|
||||
}else{
|
||||
double numdata = NumberUtil.sub(taskQueryVo.getNumber().doubleValue(),sumNumber);
|
||||
taskQueryVo.setTaskTypeTitle(MessageFormat.format(title,numdata));
|
||||
double speed = NumberUtil.div(sumNumber,taskQueryVo.getNumber().doubleValue());
|
||||
taskQueryVo.setSpeed(Double.valueOf(NumberUtil.mul(speed,100)).intValue());
|
||||
taskQueryVo.setFinish(0);
|
||||
taskQueryVo.setNewNumber(Double.valueOf(sumNumber).intValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return task;
|
||||
}
|
||||
|
||||
/**
|
||||
* 后去已经完成的任务数量
|
||||
* @param levelId
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int getTaskComplete(int levelId, int uid) {
|
||||
QueryWrapper<YxSystemUserTask> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("level_id",levelId).eq("is_show",1);
|
||||
List<YxSystemUserTask> list = yxSystemUserTaskMapper.selectList(wrapper);
|
||||
List<Integer> taskIds = list.stream().map(YxSystemUserTask::getId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
QueryWrapper<YxUserTaskFinish> wrapperT = new QueryWrapper<>();
|
||||
wrapperT.in("task_id",taskIds).eq("uid",uid);
|
||||
int count = yxUserTaskFinishMapper.selectCount(wrapperT);
|
||||
//System.out.println("count:"+count);
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取等级会员任务列表
|
||||
* @param levelId
|
||||
* @param uid
|
||||
* @param level
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public TaskDTO getTaskList(int levelId, int uid, UserLevelInfoDTO level) {
|
||||
QueryWrapper<YxSystemUserTask> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("level_id",levelId).eq("is_show",1)
|
||||
.orderByDesc("sort");
|
||||
List<YxSystemUserTaskQueryVo> list = systemUserTaskMap.toDto(yxSystemUserTaskMapper
|
||||
.selectList(wrapper));
|
||||
|
||||
TaskDTO taskDTO = new TaskDTO();
|
||||
taskDTO.setList(list);
|
||||
taskDTO.setReachCount(getTaskComplete(levelId,uid));
|
||||
taskDTO.setTask(tidyTask(list,uid));
|
||||
|
||||
return taskDTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public YxSystemUserTaskQueryVo getYxSystemUserTaskById(Serializable id) throws Exception{
|
||||
return yxSystemUserTaskMapper.getYxSystemUserTaskById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Paging<YxSystemUserTaskQueryVo> getYxSystemUserTaskPageList(YxSystemUserTaskQueryParam yxSystemUserTaskQueryParam) throws Exception{
|
||||
Page page = setPageParam(yxSystemUserTaskQueryParam,OrderItem.desc("create_time"));
|
||||
IPage<YxSystemUserTaskQueryVo> iPage = yxSystemUserTaskMapper.getYxSystemUserTaskPageList(page,yxSystemUserTaskQueryParam);
|
||||
return new Paging(iPage);
|
||||
}
|
||||
|
||||
}
|
@ -46,6 +46,20 @@ public class YxUserBillServiceImpl extends BaseServiceImpl<YxUserBillMapper, YxU
|
||||
@Autowired
|
||||
private BiillMap biillMap;
|
||||
|
||||
|
||||
/**
|
||||
* 签到了多少次
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int cumulativeAttendance(int uid) {
|
||||
QueryWrapper<YxUserBill> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("uid",uid).eq("category","integral")
|
||||
.eq("type","sign").eq("pm",1);
|
||||
return yxUserBillMapper.selectCount(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> spreadOrder(int uid, int page, int limit) {
|
||||
QueryWrapper<YxUserBill> wrapper = new QueryWrapper<>();
|
||||
@ -83,25 +97,33 @@ public class YxUserBillServiceImpl extends BaseServiceImpl<YxUserBillMapper, YxU
|
||||
@Override
|
||||
public List<BillDTO> getUserBillList(int page, int limit, int uid, int type) {
|
||||
QueryWrapper<YxUserBill> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("category","now_money").eq("uid",uid).
|
||||
orderByDesc("add_time").groupBy("time");
|
||||
wrapper.eq("uid",uid).orderByDesc("add_time").groupBy("time");
|
||||
switch (type){
|
||||
case 0:
|
||||
wrapper.eq("category","now_money");
|
||||
String str = "recharge,brokerage,pay_product,system_add,pay_product_refund,system_sub";
|
||||
wrapper.in("type",str.split(","));
|
||||
break;
|
||||
case 1:
|
||||
wrapper.eq("category","now_money");
|
||||
wrapper.eq("type","pay_product");
|
||||
break;
|
||||
case 2:
|
||||
wrapper.eq("category","now_money");
|
||||
wrapper.eq("type","recharge");
|
||||
break;
|
||||
case 3:
|
||||
wrapper.eq("category","now_money");
|
||||
wrapper.eq("type","brokerage");
|
||||
break;
|
||||
case 4:
|
||||
wrapper.eq("category","now_money");
|
||||
wrapper.eq("type","extract");
|
||||
break;
|
||||
case 5:
|
||||
wrapper.eq("category","integral");
|
||||
wrapper.eq("type","sign");
|
||||
break;
|
||||
}
|
||||
Page<YxUserBill> pageModel = new Page<>(page, limit);
|
||||
List<BillDTO> billDTOList = yxUserBillMapper.getBillList(wrapper,pageModel);
|
||||
|
@ -0,0 +1,180 @@
|
||||
package co.yixiang.modules.user.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import co.yixiang.exception.ErrorRequestException;
|
||||
import co.yixiang.modules.user.entity.YxSystemUserTask;
|
||||
import co.yixiang.modules.user.entity.YxUser;
|
||||
import co.yixiang.modules.user.entity.YxUserLevel;
|
||||
import co.yixiang.modules.user.mapper.YxSystemUserTaskMapper;
|
||||
import co.yixiang.modules.user.mapper.YxUserLevelMapper;
|
||||
import co.yixiang.modules.user.service.YxSystemUserLevelService;
|
||||
import co.yixiang.modules.user.service.YxSystemUserTaskService;
|
||||
import co.yixiang.modules.user.service.YxUserLevelService;
|
||||
import co.yixiang.modules.user.service.YxUserService;
|
||||
import co.yixiang.modules.user.web.dto.UserLevelInfoDTO;
|
||||
import co.yixiang.modules.user.web.param.YxUserLevelQueryParam;
|
||||
import co.yixiang.modules.user.web.vo.YxSystemUserLevelQueryVo;
|
||||
import co.yixiang.modules.user.web.vo.YxUserLevelQueryVo;
|
||||
import co.yixiang.common.service.impl.BaseServiceImpl;
|
||||
import co.yixiang.common.web.vo.Paging;
|
||||
import co.yixiang.modules.user.web.vo.YxUserQueryVo;
|
||||
import co.yixiang.utils.OrderUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户等级记录表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-06
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class YxUserLevelServiceImpl extends BaseServiceImpl<YxUserLevelMapper, YxUserLevel> implements YxUserLevelService {
|
||||
|
||||
@Autowired
|
||||
private YxUserLevelMapper yxUserLevelMapper;
|
||||
|
||||
@Autowired
|
||||
private YxUserService userService;
|
||||
|
||||
@Autowired
|
||||
private YxSystemUserLevelService systemUserLevelService;
|
||||
|
||||
@Autowired
|
||||
private YxSystemUserTaskMapper yxSystemUserTaskMapper;
|
||||
|
||||
@Autowired
|
||||
private YxSystemUserTaskService systemUserTaskService;
|
||||
|
||||
/**
|
||||
* 设置会员等级
|
||||
* @param uid
|
||||
* @param levelId
|
||||
*/
|
||||
@Override
|
||||
public void setUserLevel(int uid, int levelId){
|
||||
YxSystemUserLevelQueryVo systemUserLevelQueryVo = systemUserLevelService
|
||||
.getYxSystemUserLevelById(levelId);
|
||||
if(ObjectUtil.isNull(systemUserLevelQueryVo)) return;
|
||||
|
||||
int validTime = systemUserLevelQueryVo.getValidDate() * 86400;
|
||||
|
||||
QueryWrapper<YxUserLevel> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("is_del",0).eq("status",1).eq("uid",uid)
|
||||
.eq("level_id",levelId).last("limit 1");
|
||||
YxUserLevel userLevel = yxUserLevelMapper.selectOne(wrapper);
|
||||
if(ObjectUtil.isNotNull(userLevel)){
|
||||
//todo
|
||||
}else{
|
||||
YxUserLevel yxUserLevel = new YxUserLevel();
|
||||
yxUserLevel.setIsForever(systemUserLevelQueryVo.getIsForever());
|
||||
yxUserLevel.setStatus(1);
|
||||
yxUserLevel.setIsDel(0);
|
||||
yxUserLevel.setGrade(systemUserLevelQueryVo.getGrade());
|
||||
yxUserLevel.setUid(uid);
|
||||
yxUserLevel.setAddTime(OrderUtil.getSecondTimestampTwo());
|
||||
yxUserLevel.setLevelId(levelId);
|
||||
yxUserLevel.setDiscount(systemUserLevelQueryVo.getDiscount().intValue());
|
||||
|
||||
if(systemUserLevelQueryVo.getIsForever() == 1){
|
||||
yxUserLevel.setValidTime(0);
|
||||
}else{
|
||||
yxUserLevel.setValidTime(validTime+OrderUtil.getSecondTimestampTwo());
|
||||
}
|
||||
|
||||
yxUserLevel.setMark("恭喜你成为了"+systemUserLevelQueryVo.getName());
|
||||
yxUserLevelMapper.insert(yxUserLevel);
|
||||
|
||||
YxUser yxUser = new YxUser();
|
||||
yxUser.setLevel(levelId);
|
||||
yxUser.setUid(uid);
|
||||
userService.updateById(yxUser);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否能成为会员
|
||||
* @param uid
|
||||
*/
|
||||
@Override
|
||||
public void setLevelComplete(int uid) {
|
||||
YxUserQueryVo userQueryVo = userService.getYxUserById(uid);
|
||||
if(ObjectUtil.isNull(userQueryVo)) return;
|
||||
|
||||
int levelId = getUserLevel(uid,9);
|
||||
|
||||
int nextLevelId = systemUserLevelService.getNextLevelId(levelId);
|
||||
if(nextLevelId == 0) return;
|
||||
|
||||
//QueryWrapper<YxSystemUserTask> wrapper = new QueryWrapper<>();
|
||||
//wrapper.eq("level_id",nextLevelId).eq("is_show",1);
|
||||
// List<YxSystemUserTask> taskList = yxSystemUserTaskMapper.selectList(wrapper);
|
||||
|
||||
int finishCount = systemUserTaskService.getTaskComplete(nextLevelId,uid);
|
||||
if(finishCount == 3){
|
||||
setUserLevel(uid,nextLevelId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserLevelInfoDTO getUserLevelInfo(int id) {
|
||||
return yxUserLevelMapper.getUserLevelInfo(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户会员等级返回当前用户等级id
|
||||
* @param uid
|
||||
* @param grade
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int getUserLevel(int uid, int grade) {
|
||||
QueryWrapper<YxUserLevel> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("is_del",0).eq("status",1)
|
||||
.eq("uid",uid).orderByDesc("grade");
|
||||
if(grade > 0) wrapper.lt("grade",grade);
|
||||
YxUserLevel userLevel = yxUserLevelMapper.selectOne(wrapper);
|
||||
if(ObjectUtil.isNull(userLevel)) return 0;
|
||||
if(userLevel.getIsForever() == 1) return userLevel.getId();
|
||||
int nowTime = OrderUtil.getSecondTimestampTwo();
|
||||
if(nowTime > userLevel.getValidTime()){
|
||||
if(userLevel.getStatus() == 1){
|
||||
userLevel.setStatus(0);
|
||||
yxUserLevelMapper.updateById(userLevel);
|
||||
}
|
||||
|
||||
return getUserLevel(uid,userLevel.getGrade());
|
||||
}
|
||||
return userLevel.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public YxUserLevelQueryVo getYxUserLevelById(Serializable id) throws Exception{
|
||||
return yxUserLevelMapper.getYxUserLevelById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Paging<YxUserLevelQueryVo> getYxUserLevelPageList(YxUserLevelQueryParam yxUserLevelQueryParam) throws Exception{
|
||||
Page page = setPageParam(yxUserLevelQueryParam,OrderItem.desc("create_time"));
|
||||
IPage<YxUserLevelQueryVo> iPage = yxUserLevelMapper.getYxUserLevelPageList(page,yxUserLevelQueryParam);
|
||||
return new Paging(iPage);
|
||||
}
|
||||
|
||||
}
|
@ -9,8 +9,11 @@ import co.yixiang.modules.order.web.vo.YxStoreOrderQueryVo;
|
||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||
import co.yixiang.modules.user.entity.YxUser;
|
||||
import co.yixiang.modules.user.entity.YxUserBill;
|
||||
import co.yixiang.modules.user.entity.YxUserLevel;
|
||||
import co.yixiang.modules.user.mapper.YxUserMapper;
|
||||
import co.yixiang.modules.user.service.YxSystemUserLevelService;
|
||||
import co.yixiang.modules.user.service.YxUserBillService;
|
||||
import co.yixiang.modules.user.service.YxUserLevelService;
|
||||
import co.yixiang.modules.user.service.YxUserService;
|
||||
import co.yixiang.modules.user.web.dto.PromUserDTO;
|
||||
import co.yixiang.modules.user.web.dto.UserRankDTO;
|
||||
@ -61,6 +64,27 @@ public class YxUserServiceImpl extends BaseServiceImpl<YxUserMapper, YxUser> imp
|
||||
@Autowired
|
||||
private YxUserBillService billService;
|
||||
|
||||
@Autowired
|
||||
private YxUserLevelService userLevelService;
|
||||
|
||||
/**
|
||||
* 返回会员价
|
||||
* @param price
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public double setLevelPrice(double price, int uid) {
|
||||
QueryWrapper<YxUserLevel> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("is_del",0).eq("status",1)
|
||||
.eq("uid",uid).orderByDesc("grade").last("limit 1");
|
||||
YxUserLevel userLevel = userLevelService.getOne(wrapper);
|
||||
int discount = 100;
|
||||
if(ObjectUtil.isNotNull(userLevel)) discount = userLevel.getDiscount();
|
||||
return NumberUtil.mul(NumberUtil.div(discount,100),price);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 更新用户余额
|
||||
@ -399,6 +423,8 @@ public class YxUserServiceImpl extends BaseServiceImpl<YxUserMapper, YxUser> imp
|
||||
}else{
|
||||
userQueryVo.setStatu(0);
|
||||
}
|
||||
//todo 测试环境设置所有人是管理员,生成环境记得去掉
|
||||
userQueryVo.setAdminid(1);
|
||||
return userQueryVo;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,210 @@
|
||||
package co.yixiang.modules.user.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import co.yixiang.exception.ErrorRequestException;
|
||||
import co.yixiang.modules.shop.service.YxSystemGroupDataService;
|
||||
import co.yixiang.modules.user.entity.YxUser;
|
||||
import co.yixiang.modules.user.entity.YxUserBill;
|
||||
import co.yixiang.modules.user.entity.YxUserSign;
|
||||
import co.yixiang.modules.user.mapper.YxUserBillMapper;
|
||||
import co.yixiang.modules.user.mapper.YxUserSignMapper;
|
||||
import co.yixiang.modules.user.service.YxUserBillService;
|
||||
import co.yixiang.modules.user.service.YxUserService;
|
||||
import co.yixiang.modules.user.service.YxUserSignService;
|
||||
import co.yixiang.modules.user.web.dto.SignDTO;
|
||||
import co.yixiang.modules.user.web.param.YxUserSignQueryParam;
|
||||
import co.yixiang.modules.user.web.vo.YxUserQueryVo;
|
||||
import co.yixiang.modules.user.web.vo.YxUserSignQueryVo;
|
||||
import co.yixiang.common.service.impl.BaseServiceImpl;
|
||||
import co.yixiang.common.web.vo.Paging;
|
||||
import co.yixiang.utils.OrderUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 签到记录表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-05
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class YxUserSignServiceImpl extends BaseServiceImpl<YxUserSignMapper, YxUserSign> implements YxUserSignService {
|
||||
|
||||
@Autowired
|
||||
private YxUserSignMapper yxUserSignMapper;
|
||||
|
||||
@Autowired
|
||||
private YxSystemGroupDataService systemGroupDataService;
|
||||
|
||||
@Autowired
|
||||
private YxUserService yxUserService;
|
||||
|
||||
@Autowired
|
||||
private YxUserBillService billService;
|
||||
|
||||
@Autowired
|
||||
private YxUserBillMapper userBillMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 用户签到
|
||||
* @param uid
|
||||
*/
|
||||
@Override
|
||||
public int sign(int uid) {
|
||||
List<Map<String,Object>> list = systemGroupDataService.getDatas("sign_day_num");
|
||||
if(ObjectUtil.isNull(list)) throw new ErrorRequestException("请先配置签到天数");
|
||||
|
||||
YxUserQueryVo userQueryVo = yxUserService.getYxUserById(uid);
|
||||
int signNumber = 0; //积分
|
||||
int userSignNum = userQueryVo.getSignNum(); //签到次数
|
||||
if(getYesterDayIsSign(uid)){
|
||||
if(userQueryVo.getSignNum() > (list.size() - 1)){
|
||||
userSignNum = 0;
|
||||
}
|
||||
}else{
|
||||
userSignNum = 0;
|
||||
}
|
||||
int index = 0;
|
||||
for (Map<String,Object> map : list) {
|
||||
if(index == userSignNum){
|
||||
signNumber = Integer.valueOf(map.get("sign_num").toString());
|
||||
break;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
userSignNum += 1;
|
||||
|
||||
YxUserSign userSign = new YxUserSign();
|
||||
userSign.setUid(uid);
|
||||
String title = "签到奖励";
|
||||
if(userSignNum == list.size()){
|
||||
title = "连续签到奖励";
|
||||
}
|
||||
userSign.setTitle(title);
|
||||
userSign.setNumber(signNumber);
|
||||
userSign.setBalance(userQueryVo.getIntegral().intValueExact());
|
||||
userSign.setAddTime(OrderUtil.getSecondTimestampTwo());
|
||||
yxUserSignMapper.insert(userSign);
|
||||
|
||||
//用户积分增加
|
||||
YxUser yxUser = new YxUser();
|
||||
yxUser.setIntegral(NumberUtil.add(userQueryVo.getIntegral(),signNumber));
|
||||
yxUser.setUid(uid);
|
||||
yxUser.setSignNum(userSignNum);
|
||||
yxUserService.updateById(yxUser);
|
||||
|
||||
//插入流水
|
||||
YxUserBill userBill = new YxUserBill();
|
||||
userBill.setUid(uid);
|
||||
userBill.setTitle(title);
|
||||
userBill.setLinkId("0");
|
||||
userBill.setCategory("integral");
|
||||
userBill.setType("sign");
|
||||
userBill.setNumber(BigDecimal.valueOf(signNumber));
|
||||
userBill.setBalance(userQueryVo.getIntegral());
|
||||
userBill.setMark("");
|
||||
userBill.setStatus(1);
|
||||
userBill.setPm(1);
|
||||
userBill.setAddTime(OrderUtil.getSecondTimestampTwo());
|
||||
billService.save(userBill);
|
||||
|
||||
return signNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取用户签到数据
|
||||
* @param uid
|
||||
* @param page
|
||||
* @param limit
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SignDTO> getSignList(int uid, int page, int limit) {
|
||||
Page<YxUserBill> pageModel = new Page<>(page, limit);
|
||||
return userBillMapper.getSignList(uid,pageModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户昨天是否签到
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean getYesterDayIsSign(int uid) {
|
||||
int today = OrderUtil.dateToTimestampT(DateUtil.beginOfDay(new Date()));
|
||||
int yesterday = OrderUtil.dateToTimestampT(DateUtil.beginOfDay(DateUtil.
|
||||
yesterday()));
|
||||
|
||||
QueryWrapper<YxUserSign> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("uid",uid).lt("add_time",today).ge("add_time",yesterday);
|
||||
int count = yxUserSignMapper.selectCount(wrapper);
|
||||
if(count > 0) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户今天是否签到
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean getToDayIsSign(int uid) {
|
||||
int today = OrderUtil.dateToTimestampT(DateUtil.beginOfDay(new Date()));
|
||||
int yesterday = OrderUtil.dateToTimestampT(DateUtil.beginOfDay(DateUtil.
|
||||
yesterday()));
|
||||
|
||||
QueryWrapper<YxUserSign> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("uid",uid).ge("add_time",today);
|
||||
int count = yxUserSignMapper.selectCount(wrapper);
|
||||
if(count > 0) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户累计签到次数
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int getSignSumDay(int uid) {
|
||||
QueryWrapper<YxUserSign> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("uid",uid);
|
||||
int count = yxUserSignMapper.selectCount(wrapper);
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public YxUserSignQueryVo getYxUserSignById(Serializable id) throws Exception{
|
||||
return yxUserSignMapper.getYxUserSignById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Paging<YxUserSignQueryVo> getYxUserSignPageList(YxUserSignQueryParam yxUserSignQueryParam) throws Exception{
|
||||
Page page = setPageParam(yxUserSignQueryParam,OrderItem.desc("create_time"));
|
||||
IPage<YxUserSignQueryVo> iPage = yxUserSignMapper.getYxUserSignPageList(page,yxUserSignQueryParam);
|
||||
return new Paging(iPage);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package co.yixiang.modules.user.service.impl;
|
||||
|
||||
import co.yixiang.modules.user.entity.YxUserTaskFinish;
|
||||
import co.yixiang.modules.user.mapper.YxUserTaskFinishMapper;
|
||||
import co.yixiang.modules.user.service.YxUserTaskFinishService;
|
||||
import co.yixiang.modules.user.web.param.YxUserTaskFinishQueryParam;
|
||||
import co.yixiang.modules.user.web.vo.YxUserTaskFinishQueryVo;
|
||||
import co.yixiang.common.service.impl.BaseServiceImpl;
|
||||
import co.yixiang.common.web.vo.Paging;
|
||||
import co.yixiang.utils.OrderUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户任务完成记录表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-07
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class YxUserTaskFinishServiceImpl extends BaseServiceImpl<YxUserTaskFinishMapper, YxUserTaskFinish> implements YxUserTaskFinishService {
|
||||
|
||||
@Autowired
|
||||
private YxUserTaskFinishMapper yxUserTaskFinishMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 设置任务完成
|
||||
* @param uid
|
||||
* @param taskId
|
||||
*/
|
||||
@Override
|
||||
public void setFinish(int uid, int taskId) {
|
||||
QueryWrapper<YxUserTaskFinish> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("uid",uid).eq("task_id",taskId);
|
||||
int count = yxUserTaskFinishMapper.selectCount(wrapper);
|
||||
if(count == 0){
|
||||
YxUserTaskFinish userTaskFinish = new YxUserTaskFinish();
|
||||
userTaskFinish.setAddTime(OrderUtil.getSecondTimestampTwo());
|
||||
userTaskFinish.setUid(uid);
|
||||
userTaskFinish.setTaskId(taskId);
|
||||
userTaskFinish.setStatus(0);
|
||||
|
||||
yxUserTaskFinishMapper.insert(userTaskFinish);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public YxUserTaskFinishQueryVo getYxUserTaskFinishById(Serializable id) throws Exception{
|
||||
return yxUserTaskFinishMapper.getYxUserTaskFinishById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Paging<YxUserTaskFinishQueryVo> getYxUserTaskFinishPageList(YxUserTaskFinishQueryParam yxUserTaskFinishQueryParam) throws Exception{
|
||||
Page page = setPageParam(yxUserTaskFinishQueryParam,OrderItem.desc("create_time"));
|
||||
IPage<YxUserTaskFinishQueryVo> iPage = yxUserTaskFinishMapper.getYxUserTaskFinishPageList(page,yxUserTaskFinishQueryParam);
|
||||
return new Paging(iPage);
|
||||
}
|
||||
|
||||
}
|
@ -8,14 +8,18 @@ import co.yixiang.modules.order.service.YxStoreOrderService;
|
||||
import co.yixiang.modules.shop.service.YxStoreProductRelationService;
|
||||
import co.yixiang.modules.shop.service.YxSystemGroupDataService;
|
||||
import co.yixiang.modules.user.entity.YxUser;
|
||||
import co.yixiang.modules.user.service.YxUserService;
|
||||
import co.yixiang.modules.user.service.*;
|
||||
import co.yixiang.modules.user.web.param.YxUserQueryParam;
|
||||
import co.yixiang.modules.user.web.vo.YxSystemUserLevelQueryVo;
|
||||
import co.yixiang.modules.user.web.vo.YxUserQueryVo;
|
||||
import co.yixiang.utils.SecurityUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.omg.CORBA.PRIVATE_MEMBER;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -41,6 +45,9 @@ public class UserController extends BaseController {
|
||||
private final YxSystemGroupDataService systemGroupDataService;
|
||||
private final YxStoreOrderService orderService;
|
||||
private final YxStoreProductRelationService relationService;
|
||||
private final YxUserSignService userSignService;
|
||||
private final YxUserBillService userBillService;
|
||||
private final YxSystemUserLevelService systemUserLevelService;
|
||||
|
||||
|
||||
|
||||
@ -74,7 +81,18 @@ public class UserController extends BaseController {
|
||||
@ApiOperation(value = "个人中心",notes = "个人中心")
|
||||
public ApiResult<Object> user(){
|
||||
int uid = SecurityUtils.getUserId().intValue();
|
||||
return ApiResult.ok(yxUserService.getNewYxUserById(uid));
|
||||
YxUserQueryVo yxUserQueryVo = yxUserService.getNewYxUserById(uid);
|
||||
|
||||
|
||||
if(yxUserQueryVo.getLevel() > 0) {
|
||||
yxUserQueryVo.setVip(true);
|
||||
YxSystemUserLevelQueryVo systemUserLevelQueryVo = systemUserLevelService
|
||||
.getYxSystemUserLevelById(yxUserQueryVo.getLevel());
|
||||
yxUserQueryVo.setVipIcon(systemUserLevelQueryVo.getIcon());
|
||||
yxUserQueryVo.setVipId(yxUserQueryVo.getLevel());
|
||||
yxUserQueryVo.setVipName(systemUserLevelQueryVo.getName());
|
||||
}
|
||||
return ApiResult.ok(yxUserQueryVo);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -126,13 +144,68 @@ public class UserController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取活动状态
|
||||
* 签到用户信息
|
||||
*/
|
||||
@PostMapping("/sign/user")
|
||||
@ApiOperation(value = "获取活动状态",notes = "获取活动状态")
|
||||
public ApiResult<Object> sign(){
|
||||
@ApiOperation(value = "签到用户信息",notes = "签到用户信息")
|
||||
public ApiResult<Object> sign(@RequestBody String jsonStr){
|
||||
JSONObject jsonObject = JSON.parseObject(jsonStr);
|
||||
int uid = SecurityUtils.getUserId().intValue();
|
||||
return ApiResult.ok(yxUserService.getYxUserById(uid));
|
||||
YxUserQueryVo userQueryVo = yxUserService.getYxUserById(uid);
|
||||
int sumSignDay = userSignService.getSignSumDay(uid);
|
||||
boolean isDaySign = userSignService.getToDayIsSign(uid);
|
||||
boolean isYesterDaySign = userSignService.getYesterDayIsSign(uid);
|
||||
userQueryVo.setSumSignDay(sumSignDay);
|
||||
userQueryVo.setIsDaySign(isDaySign);
|
||||
userQueryVo.setIsYesterDaySign(isYesterDaySign);
|
||||
if(!isDaySign && !isYesterDaySign) userQueryVo.setSignNum(0);
|
||||
return ApiResult.ok(userQueryVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 签到配置
|
||||
*/
|
||||
@GetMapping("/sign/config")
|
||||
@ApiOperation(value = "签到配置",notes = "签到配置")
|
||||
public ApiResult<Object> signConfig(){
|
||||
return ApiResult.ok(systemGroupDataService.getDatas("sign_day_num"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 签到列表
|
||||
*/
|
||||
@GetMapping("/sign/list")
|
||||
@ApiOperation(value = "签到列表",notes = "签到列表")
|
||||
public ApiResult<Object> signList(@RequestParam(value = "page",defaultValue = "1") int page,
|
||||
@RequestParam(value = "limit",defaultValue = "10") int limit){
|
||||
int uid = SecurityUtils.getUserId().intValue();
|
||||
return ApiResult.ok(userSignService.getSignList(uid,page,limit));
|
||||
}
|
||||
|
||||
/**
|
||||
* 签到列表(年月)
|
||||
*/
|
||||
@GetMapping("/sign/month")
|
||||
@ApiOperation(value = "签到列表(年月)",notes = "签到列表(年月)")
|
||||
public ApiResult<Object> signMonthList(@RequestParam(value = "page",defaultValue = "1") int page,
|
||||
@RequestParam(value = "limit",defaultValue = "10") int limit){
|
||||
int uid = SecurityUtils.getUserId().intValue();
|
||||
return ApiResult.ok(userBillService.getUserBillList(page,limit,uid,5));
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始签到
|
||||
*/
|
||||
@PostMapping("/sign/integral")
|
||||
@ApiOperation(value = "开始签到",notes = "开始签到")
|
||||
public ApiResult<Object> signIntegral(){
|
||||
int uid = SecurityUtils.getUserId().intValue();
|
||||
boolean isDaySign = userSignService.getToDayIsSign(uid);
|
||||
if(isDaySign) return ApiResult.fail("已签到");
|
||||
int integral = userSignService.sign(uid);
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("integral",integral);
|
||||
return ApiResult.ok(map,"签到获得" + integral + "积分");
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,76 @@
|
||||
package co.yixiang.modules.user.web.controller;
|
||||
|
||||
import co.yixiang.common.api.ApiResult;
|
||||
import co.yixiang.common.web.controller.BaseController;
|
||||
import co.yixiang.common.web.param.IdParam;
|
||||
import co.yixiang.common.web.vo.Paging;
|
||||
import co.yixiang.modules.user.entity.YxUserLevel;
|
||||
import co.yixiang.modules.user.service.YxSystemUserLevelService;
|
||||
import co.yixiang.modules.user.service.YxSystemUserTaskService;
|
||||
import co.yixiang.modules.user.service.YxUserLevelService;
|
||||
import co.yixiang.modules.user.web.param.YxUserLevelQueryParam;
|
||||
import co.yixiang.modules.user.web.vo.YxUserLevelQueryVo;
|
||||
import co.yixiang.utils.SecurityUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户等级 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-12-06
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
@Api(value = "用户等级", tags = "用户等级", description = "用户等级")
|
||||
public class UserLevelController extends BaseController {
|
||||
|
||||
|
||||
private final YxUserLevelService userLevelService;
|
||||
private final YxSystemUserLevelService systemUserLevelService;
|
||||
private final YxSystemUserTaskService systemUserTaskService;
|
||||
|
||||
/**
|
||||
* 会员等级列表
|
||||
*/
|
||||
@GetMapping("/user/level/grade")
|
||||
@ApiOperation(value = "会员等级列表",notes = "会员等级列表")
|
||||
public ApiResult<Object> getLevelInfo(){
|
||||
int uid = SecurityUtils.getUserId().intValue();
|
||||
return ApiResult.ok(systemUserLevelService.getLevelInfo(uid,true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取等级任务
|
||||
*/
|
||||
@GetMapping("/user/level/task/{id}")
|
||||
@ApiOperation(value = "获取等级任务",notes = "获取等级任务")
|
||||
public ApiResult<Object> getTask(@PathVariable Integer id){
|
||||
int uid = SecurityUtils.getUserId().intValue();
|
||||
return ApiResult.ok(systemUserTaskService.getTaskList(id,uid,null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测用户是否可以成为会员
|
||||
*/
|
||||
@GetMapping("/user/level/detection")
|
||||
@ApiOperation(value = "检测用户是否可以成为会员",notes = "检测用户是否可以成为会员")
|
||||
public ApiResult<Object> detection(){
|
||||
int uid = SecurityUtils.getUserId().intValue();
|
||||
userLevelService.setLevelComplete(uid);
|
||||
return ApiResult.ok("ok");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,91 +0,0 @@
|
||||
package co.yixiang.modules.user.web.controller;
|
||||
|
||||
import co.yixiang.modules.user.entity.YxUserExtract;
|
||||
import co.yixiang.modules.user.service.YxUserExtractService;
|
||||
import co.yixiang.modules.user.web.param.YxUserExtractQueryParam;
|
||||
import co.yixiang.modules.user.web.vo.YxUserExtractQueryVo;
|
||||
import co.yixiang.common.web.controller.BaseController;
|
||||
import co.yixiang.common.api.ApiResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
import co.yixiang.common.web.vo.Paging;
|
||||
import co.yixiang.common.web.param.IdParam;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户提现表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @since 2019-11-11
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/yxUserExtract")
|
||||
@Api("用户提现表 API")
|
||||
public class YxUserExtractController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private YxUserExtractService yxUserExtractService;
|
||||
|
||||
/**
|
||||
* 添加用户提现表
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
@ApiOperation(value = "添加YxUserExtract对象",notes = "添加用户提现表",response = ApiResult.class)
|
||||
public ApiResult<Boolean> addYxUserExtract(@Valid @RequestBody YxUserExtract yxUserExtract) throws Exception{
|
||||
boolean flag = yxUserExtractService.save(yxUserExtract);
|
||||
return ApiResult.result(flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户提现表
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
@ApiOperation(value = "修改YxUserExtract对象",notes = "修改用户提现表",response = ApiResult.class)
|
||||
public ApiResult<Boolean> updateYxUserExtract(@Valid @RequestBody YxUserExtract yxUserExtract) throws Exception{
|
||||
boolean flag = yxUserExtractService.updateById(yxUserExtract);
|
||||
return ApiResult.result(flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户提现表
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation(value = "删除YxUserExtract对象",notes = "删除用户提现表",response = ApiResult.class)
|
||||
public ApiResult<Boolean> deleteYxUserExtract(@Valid @RequestBody IdParam idParam) throws Exception{
|
||||
boolean flag = yxUserExtractService.removeById(idParam.getId());
|
||||
return ApiResult.result(flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户提现表
|
||||
*/
|
||||
@PostMapping("/info")
|
||||
@ApiOperation(value = "获取YxUserExtract对象详情",notes = "查看用户提现表",response = YxUserExtractQueryVo.class)
|
||||
public ApiResult<YxUserExtractQueryVo> getYxUserExtract(@Valid @RequestBody IdParam idParam) throws Exception{
|
||||
YxUserExtractQueryVo yxUserExtractQueryVo = yxUserExtractService.getYxUserExtractById(idParam.getId());
|
||||
return ApiResult.ok(yxUserExtractQueryVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户提现表分页列表
|
||||
*/
|
||||
@PostMapping("/getPageList")
|
||||
@ApiOperation(value = "获取YxUserExtract分页列表",notes = "用户提现表分页列表",response = YxUserExtractQueryVo.class)
|
||||
public ApiResult<Paging<YxUserExtractQueryVo>> getYxUserExtractPageList(@Valid @RequestBody(required = false) YxUserExtractQueryParam yxUserExtractQueryParam) throws Exception{
|
||||
Paging<YxUserExtractQueryVo> paging = yxUserExtractService.getYxUserExtractPageList(yxUserExtractQueryParam);
|
||||
return ApiResult.ok(paging);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
package co.yixiang.modules.user.web.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* @ClassName SignDTO
|
||||
* @Author hupeng <610796224@qq.com>
|
||||
* @Date 2019/12/5
|
||||
**/
|
||||
@Data
|
||||
public class SignDTO implements Serializable {
|
||||
private String addTime;
|
||||
private String title;
|
||||
private Integer number;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package co.yixiang.modules.user.web.dto;
|
||||
|
||||
import co.yixiang.modules.user.web.vo.YxSystemUserTaskQueryVo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName TaskDTO
|
||||
* @Author hupeng <610796224@qq.com>
|
||||
* @Date 2019/12/6
|
||||
**/
|
||||
@Data
|
||||
public class TaskDTO implements Serializable {
|
||||
private List<YxSystemUserTaskQueryVo> list;
|
||||
private Integer reachCount;
|
||||
private List<YxSystemUserTaskQueryVo> task;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package co.yixiang.modules.user.web.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* @ClassName TaskFinishDTO
|
||||
* @Author hupeng <610796224@qq.com>
|
||||
* @Date 2019/12/6
|
||||
**/
|
||||
@Data
|
||||
public class TaskFinishDTO implements Serializable {
|
||||
private String addTime;
|
||||
private String title;
|
||||
private Integer number;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package co.yixiang.modules.user.web.dto;
|
||||
|
||||
import co.yixiang.modules.user.entity.YxSystemUserLevel;
|
||||
import co.yixiang.modules.user.web.vo.YxSystemUserLevelQueryVo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName UserLevelDTO
|
||||
* @Author hupeng <610796224@qq.com>
|
||||
* @Date 2019/12/6
|
||||
**/
|
||||
@Data
|
||||
public class UserLevelDTO implements Serializable {
|
||||
private List<YxSystemUserLevelQueryVo> list;
|
||||
private TaskDTO task;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package co.yixiang.modules.user.web.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @ClassName UserLevelInfoDTO
|
||||
* @Author hupeng <610796224@qq.com>
|
||||
* @Date 2019/12/7
|
||||
**/
|
||||
@Data
|
||||
public class UserLevelInfoDTO implements Serializable {
|
||||
private Integer id;
|
||||
private Integer addTime;
|
||||
private Double discount;
|
||||
private Integer levelId;
|
||||
private String name;
|
||||
private String icon;
|
||||
private Integer grade;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package co.yixiang.modules.user.web.param;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import co.yixiang.common.web.param.QueryParam;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 设置用户等级表 查询参数对象
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @date 2019-12-06
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value="YxSystemUserLevelQueryParam对象", description="设置用户等级表查询参数")
|
||||
public class YxSystemUserLevelQueryParam extends QueryParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package co.yixiang.modules.user.web.param;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import co.yixiang.common.web.param.QueryParam;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 等级任务设置 查询参数对象
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @date 2019-12-06
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value="YxSystemUserTaskQueryParam对象", description="等级任务设置查询参数")
|
||||
public class YxSystemUserTaskQueryParam extends QueryParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package co.yixiang.modules.user.web.param;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import co.yixiang.common.web.param.QueryParam;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户等级记录表 查询参数对象
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @date 2019-12-06
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value="YxUserLevelQueryParam对象", description="用户等级记录表查询参数")
|
||||
public class YxUserLevelQueryParam extends QueryParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package co.yixiang.modules.user.web.param;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import co.yixiang.common.web.param.QueryParam;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 签到记录表 查询参数对象
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @date 2019-12-05
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value="YxUserSignQueryParam对象", description="签到记录表查询参数")
|
||||
public class YxUserSignQueryParam extends QueryParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package co.yixiang.modules.user.web.param;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import co.yixiang.common.web.param.QueryParam;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户任务完成记录表 查询参数对象
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @date 2019-12-07
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value="YxUserTaskFinishQueryParam对象", description="用户任务完成记录表查询参数")
|
||||
public class YxUserTaskFinishQueryParam extends QueryParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package co.yixiang.modules.user.web.vo;
|
||||
|
||||
import co.yixiang.modules.user.web.dto.TaskDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 设置用户等级表 查询结果对象
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @date 2019-12-06
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "YxSystemUserLevelQueryVo对象", description = "设置用户等级表查询参数")
|
||||
public class YxSystemUserLevelQueryVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "商户id")
|
||||
private Integer merId;
|
||||
|
||||
@ApiModelProperty(value = "会员名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "购买金额")
|
||||
private BigDecimal money;
|
||||
|
||||
@ApiModelProperty(value = "有效时间")
|
||||
private Integer validDate;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "会员等级")
|
||||
private Integer grade;
|
||||
|
||||
@ApiModelProperty(value = "享受折扣")
|
||||
private BigDecimal discount;
|
||||
|
||||
@ApiModelProperty(value = "会员卡背景")
|
||||
private String image;
|
||||
|
||||
@ApiModelProperty(value = "会员图标")
|
||||
private String icon;
|
||||
|
||||
@ApiModelProperty(value = "说明")
|
||||
private String explain;
|
||||
|
||||
@ApiModelProperty(value = "添加时间")
|
||||
private Integer addTime;
|
||||
|
||||
private TaskDTO taskList;
|
||||
|
||||
private Boolean isClear;
|
||||
|
||||
private Integer isForever;
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package co.yixiang.modules.user.web.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 等级任务设置 查询结果对象
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @date 2019-12-06
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "YxSystemUserTaskQueryVo对象", description = "等级任务设置查询参数")
|
||||
public class YxSystemUserTaskQueryVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "任务名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "配置原名")
|
||||
private String realName;
|
||||
|
||||
@ApiModelProperty(value = "任务类型")
|
||||
private String taskType;
|
||||
|
||||
@ApiModelProperty(value = "限定数")
|
||||
private Integer number;
|
||||
|
||||
@ApiModelProperty(value = "等级id")
|
||||
private Integer levelId;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty(value = "是否显示")
|
||||
private Integer isShow;
|
||||
|
||||
@ApiModelProperty(value = "是否务必达成任务,1务必达成,0=满足其一")
|
||||
private Integer isMust;
|
||||
|
||||
@ApiModelProperty(value = "任务说明")
|
||||
private String illustrate;
|
||||
|
||||
@ApiModelProperty(value = "新增时间")
|
||||
private Integer addTime;
|
||||
|
||||
private Integer newNumber;//已经完成了多少
|
||||
|
||||
private Integer speed;//进度比例
|
||||
|
||||
private Integer finish;//是否完成
|
||||
|
||||
private String taskTypeTitle;//任务类型标题
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package co.yixiang.modules.user.web.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户等级记录表 查询结果对象
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @date 2019-12-06
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value="YxUserLevelQueryVo对象", description="用户等级记录表查询参数")
|
||||
public class YxUserLevelQueryVo implements Serializable{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "用户uid")
|
||||
private Integer uid;
|
||||
|
||||
@ApiModelProperty(value = "等级vip")
|
||||
private Integer levelId;
|
||||
|
||||
@ApiModelProperty(value = "会员等级")
|
||||
private Integer grade;
|
||||
|
||||
@ApiModelProperty(value = "过期时间")
|
||||
private Integer validTime;
|
||||
|
||||
@ApiModelProperty(value = "是否永久")
|
||||
private Boolean isForever;
|
||||
|
||||
@ApiModelProperty(value = "商户id")
|
||||
private Integer merId;
|
||||
|
||||
@ApiModelProperty(value = "0:禁止,1:正常")
|
||||
private Boolean status;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String mark;
|
||||
|
||||
@ApiModelProperty(value = "是否已通知")
|
||||
private Boolean remind;
|
||||
|
||||
@ApiModelProperty(value = "是否删除,0=未删除,1=删除")
|
||||
private Boolean isDel;
|
||||
|
||||
@ApiModelProperty(value = "添加时间")
|
||||
private Integer addTime;
|
||||
|
||||
@ApiModelProperty(value = "享受折扣")
|
||||
private Integer discount;
|
||||
|
||||
}
|
@ -39,6 +39,12 @@ public class YxUserQueryVo implements Serializable {
|
||||
|
||||
private Integer statu;
|
||||
|
||||
private Integer sumSignDay;
|
||||
|
||||
private Boolean isDaySign;
|
||||
|
||||
private Boolean isYesterDaySign;
|
||||
|
||||
|
||||
|
||||
// @ApiModelProperty(value = "用户密码(跟pwd)")
|
||||
@ -139,4 +145,12 @@ public class YxUserQueryVo implements Serializable {
|
||||
@ApiModelProperty(value = "用户登陆类型,h5,wechat,routine")
|
||||
private String loginType;
|
||||
|
||||
private Boolean vip;
|
||||
|
||||
private Integer vipId;
|
||||
|
||||
private String vipIcon;
|
||||
|
||||
private String vipName;
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package co.yixiang.modules.user.web.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 签到记录表 查询结果对象
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @date 2019-12-05
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "YxUserSignQueryVo对象", description = "签到记录表查询参数")
|
||||
public class YxUserSignQueryVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "用户uid")
|
||||
private Integer uid;
|
||||
|
||||
@ApiModelProperty(value = "签到说明")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "获得积分")
|
||||
private Integer number;
|
||||
|
||||
@ApiModelProperty(value = "剩余积分")
|
||||
private Integer balance;
|
||||
|
||||
@ApiModelProperty(value = "添加时间")
|
||||
private Integer addTime;
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package co.yixiang.modules.user.web.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户任务完成记录表 查询结果对象
|
||||
* </p>
|
||||
*
|
||||
* @author hupeng
|
||||
* @date 2019-12-07
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value="YxUserTaskFinishQueryVo对象", description="用户任务完成记录表查询参数")
|
||||
public class YxUserTaskFinishQueryVo implements Serializable{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "任务id")
|
||||
private Integer taskId;
|
||||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Integer uid;
|
||||
|
||||
@ApiModelProperty(value = "是否有效")
|
||||
private Boolean status;
|
||||
|
||||
@ApiModelProperty(value = "添加时间")
|
||||
private Integer addTime;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<?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="co.yixiang.modules.user.mapper.YxSystemUserLevelMapper">
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, mer_id, name, money, valid_date, is_forever, is_pay, is_show, grade, discount, image, icon, `explain`, add_time, is_del
|
||||
</sql>
|
||||
|
||||
<select id="getYxSystemUserLevelById" resultType="co.yixiang.modules.user.web.vo.YxSystemUserLevelQueryVo">
|
||||
select <include refid="Base_Column_List"/> from yx_system_user_level where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getYxSystemUserLevelPageList" resultType="co.yixiang.modules.user.web.vo.YxSystemUserLevelQueryVo">
|
||||
select <include refid="Base_Column_List"/> from yx_system_user_level
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,18 @@
|
||||
<?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="co.yixiang.modules.user.mapper.YxSystemUserTaskMapper">
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, name, real_name, task_type, number, level_id, sort, is_show, is_must, illustrate, add_time
|
||||
</sql>
|
||||
|
||||
<select id="getYxSystemUserTaskById" resultType="co.yixiang.modules.user.web.vo.YxSystemUserTaskQueryVo">
|
||||
select <include refid="Base_Column_List"/> from yx_system_user_task where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getYxSystemUserTaskPageList" resultType="co.yixiang.modules.user.web.vo.YxSystemUserTaskQueryVo">
|
||||
select <include refid="Base_Column_List"/> from yx_system_user_task
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,18 @@
|
||||
<?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="co.yixiang.modules.user.mapper.YxUserLevelMapper">
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, uid, level_id, grade, valid_time, is_forever, mer_id, status, mark, remind, is_del, add_time, discount
|
||||
</sql>
|
||||
|
||||
<select id="getYxUserLevelById" resultType="co.yixiang.modules.user.web.vo.YxUserLevelQueryVo">
|
||||
select <include refid="Base_Column_List"/> from yx_user_level where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getYxUserLevelPageList" resultType="co.yixiang.modules.user.web.vo.YxUserLevelQueryVo">
|
||||
select <include refid="Base_Column_List"/> from yx_user_level
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,18 @@
|
||||
<?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="co.yixiang.modules.user.mapper.YxUserSignMapper">
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, uid, title, number, balance, add_time
|
||||
</sql>
|
||||
|
||||
<select id="getYxUserSignById" resultType="co.yixiang.modules.user.web.vo.YxUserSignQueryVo">
|
||||
select <include refid="Base_Column_List"/> from yx_user_sign where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getYxUserSignPageList" resultType="co.yixiang.modules.user.web.vo.YxUserSignQueryVo">
|
||||
select <include refid="Base_Column_List"/> from yx_user_sign
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,18 @@
|
||||
<?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="co.yixiang.modules.user.mapper.YxUserTaskFinishMapper">
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, task_id, uid, status, add_time
|
||||
</sql>
|
||||
|
||||
<select id="getYxUserTaskFinishById" resultType="co.yixiang.modules.user.web.vo.YxUserTaskFinishQueryVo">
|
||||
select <include refid="Base_Column_List"/> from yx_user_task_finish where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getYxUserTaskFinishPageList" resultType="co.yixiang.modules.user.web.vo.YxUserTaskFinishQueryVo">
|
||||
select <include refid="Base_Column_List"/> from yx_user_task_finish
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -24,10 +24,10 @@ public class CodeGenerator {
|
||||
|
||||
private static final String USER_NAME = "root";
|
||||
|
||||
private static final String PASSWORD = "Admin@123";
|
||||
private static final String PASSWORD = "root";
|
||||
private static final String DRIVER_NAME = "com.mysql.cj.jdbc.Driver";
|
||||
|
||||
private static final String DRIVER_URL = "jdbc:mysql://106.12.82.39:3306/yxshop?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8";
|
||||
private static final String DRIVER_URL = "jdbc:mysql://localhost:3306/yxshop?autoReconnect=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8";
|
||||
|
||||
private static final String PARENT_PACKAGE = "co.yixiang";
|
||||
private static final String SUPER_ENTITY = PARENT_PACKAGE + ".common.entity.BaseEntity";
|
||||
@ -43,11 +43,11 @@ public class CodeGenerator {
|
||||
|
||||
// ############################ 配置部分 start ############################
|
||||
// 模块名称
|
||||
private static final String MODULE_NAME = "activity";
|
||||
private static final String MODULE_NAME = "user";
|
||||
// 作者
|
||||
private static final String AUTHOR = "hupeng";
|
||||
// 生成的表名称
|
||||
private static final String TABLE_NAME = "yx_system_attachment"; // 主键数据库列名称
|
||||
private static final String TABLE_NAME = "yx_user_task_finish"; // 主键数据库列名称
|
||||
private static final String PK_ID_COLUMN_NAME = "id";
|
||||
// 代码生成策略 true:All/false:SIMPLE
|
||||
private static final boolean GENERATOR_STRATEGY = true;
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>yshop</artifactId>
|
||||
<groupId>co.yixiang</groupId>
|
||||
<version>1.3</version>
|
||||
<version>1.4</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -1,16 +0,0 @@
|
||||
package co.yixiang.redisson;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* Created by kl on 2018/7/20.
|
||||
* Content :延时job
|
||||
*/
|
||||
@Data
|
||||
public class DelayJob implements Serializable {
|
||||
private Integer oderId;//job执行参数
|
||||
private Class aClass;//具体执行实例实现
|
||||
}
|
@ -2,10 +2,12 @@ package co.yixiang.redisson;
|
||||
|
||||
import org.redisson.api.RBlockingQueue;
|
||||
import org.redisson.api.RDelayedQueue;
|
||||
import org.redisson.api.RQueue;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
@ -23,22 +25,10 @@ public class DelayJobService {
|
||||
* @param job 任务
|
||||
* @param delay 超时时间
|
||||
*/
|
||||
public void submitJob(DelayJob job, Long delay){
|
||||
RBlockingQueue blockingQueue = client.getBlockingQueue(JobTimer.CUSTOMER_JOB_TIMER_JOBS);
|
||||
RDelayedQueue delayedQueue = client.getDelayedQueue(blockingQueue);
|
||||
public void submitJob(Map<String,Object> job, Long delay){
|
||||
RQueue<Map<String,Object>> blockingQueue = client.getQueue(JobTimer.CUSTOMER_JOB_TIMER_JOBS);
|
||||
RDelayedQueue<Map<String,Object>> delayedQueue = client.getDelayedQueue(blockingQueue);
|
||||
delayedQueue.offer(job,delay,TimeUnit.MILLISECONDS);
|
||||
delayedQueue.destroy();
|
||||
}
|
||||
/**
|
||||
* 用户付款后取消队列
|
||||
* @param job 任务
|
||||
*/
|
||||
public void cancelJob(DelayJob job){
|
||||
RBlockingQueue blockingQueue = client.getBlockingQueue(JobTimer.CUSTOMER_JOB_TIMER_JOBS);
|
||||
RDelayedQueue delayedQueue = client.getDelayedQueue(blockingQueue);
|
||||
delayedQueue.remove(job);
|
||||
delayedQueue.destroy();
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -1,10 +1,12 @@
|
||||
package co.yixiang.redisson;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by kl on 2018/7/20.
|
||||
* Content :延时job执行器接口
|
||||
*/
|
||||
public interface ExecuteJob {
|
||||
|
||||
void execute(DelayJob job);
|
||||
void execute(Map<String,Object> job);
|
||||
}
|
||||
|
@ -4,10 +4,10 @@ import org.redisson.api.RBlockingQueue;
|
||||
import org.redisson.api.RDelayedQueue;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@ -23,18 +23,18 @@ public class JobTimer {
|
||||
private RedissonClient client;
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
private ExecuteJob service;
|
||||
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2);
|
||||
@PostConstruct
|
||||
public void startJobTimer() {
|
||||
RBlockingQueue blockingQueue = client.getBlockingQueue(CUSTOMER_JOB_TIMER_JOBS);
|
||||
RDelayedQueue delayedQueue = client.getDelayedQueue(blockingQueue);
|
||||
RBlockingQueue<Map<String,Object>> blockingQueue = client.getBlockingQueue(CUSTOMER_JOB_TIMER_JOBS);
|
||||
RDelayedQueue<Map<String,Object>> delayedQueue = client.getDelayedQueue(blockingQueue);
|
||||
new Thread(() -> {
|
||||
while (true) {
|
||||
try {
|
||||
DelayJob job = (DelayJob) blockingQueue.take();
|
||||
executorService.execute(new ExecutorTask(context, job));
|
||||
Map<String,Object> job = blockingQueue.take();
|
||||
executorService.execute(new ExecutorTask(job));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
@ -50,18 +50,14 @@ public class JobTimer {
|
||||
}
|
||||
class ExecutorTask implements Runnable {
|
||||
|
||||
private ApplicationContext context;
|
||||
|
||||
private DelayJob delayJob;
|
||||
private Map<String,Object> delayJob;
|
||||
|
||||
public ExecutorTask(ApplicationContext context, DelayJob delayJob) {
|
||||
this.context = context;
|
||||
public ExecutorTask(Map<String,Object> delayJob) {
|
||||
this.delayJob = delayJob;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
ExecuteJob service = (ExecuteJob) context.getBean(delayJob.getAClass());
|
||||
service.execute(delayJob);
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>yshop</artifactId>
|
||||
<groupId>co.yixiang</groupId>
|
||||
<version>1.3</version>
|
||||
<version>1.4</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
<dependency>
|
||||
<groupId>co.yixiang</groupId>
|
||||
<artifactId>yshop-common</artifactId>
|
||||
<version>1.3</version>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
|
||||
<!--模板引擎-->
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>yshop</artifactId>
|
||||
<groupId>co.yixiang</groupId>
|
||||
<version>1.3</version>
|
||||
<version>1.4</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
<dependency>
|
||||
<groupId>co.yixiang</groupId>
|
||||
<artifactId>yshop-common</artifactId>
|
||||
<version>1.3</version>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>yshop</artifactId>
|
||||
<groupId>co.yixiang</groupId>
|
||||
<version>1.3</version>
|
||||
<version>1.4</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
<dependency>
|
||||
<groupId>co.yixiang</groupId>
|
||||
<artifactId>yshop-common</artifactId>
|
||||
<version>1.3</version>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class YxArticleController {
|
||||
@DeleteMapping(value = "/yxArticle/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXARTICLE_ALL','YXARTICLE_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Integer id){
|
||||
//if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
yxArticleService.delete(id);
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
@ -69,7 +69,7 @@ public class YxArticleController {
|
||||
@GetMapping(value = "/yxArticle/publish/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXARTICLE_ALL','YXARTICLE_DELETE')")
|
||||
public ResponseEntity publish(@PathVariable Integer id) throws Exception{
|
||||
//if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
YxArticleDTO yxArticleDTO= yxArticleService.findById(id);
|
||||
yxArticleService.uploadNews(yxArticleDTO);
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
|
@ -47,7 +47,7 @@ public class YxCacheController {
|
||||
@PostMapping(value = "/yxCache")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXCACHE_ALL','YXCACHE_CREATE')")
|
||||
public ResponseEntity create( @RequestBody String jsonStr){
|
||||
//if(StrUtil.isNotEmpty(jsonStr)) throw new BadRequestException("演示环境禁止操作");
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
JSONObject jsonObject = JSON.parseObject(jsonStr);
|
||||
String jsonButton = jsonObject.get("buttons").toString();
|
||||
YxCache yxCache = new YxCache();
|
||||
|
@ -41,7 +41,7 @@ public class YxWechatReplyController {
|
||||
@PostMapping(value = "/yxWechatReply")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXWECHATREPLY_ALL','YXWECHATREPLY_CREATE')")
|
||||
public ResponseEntity create(@RequestBody String jsonStr){
|
||||
//if(StrUtil.isNotEmpty(jsonStr)) throw new BadRequestException("演示环境禁止操作");
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
JSONObject jsonObject = JSON.parseObject(jsonStr);
|
||||
YxWechatReply yxWechatReply = new YxWechatReply();
|
||||
YxWechatReply isExist = yxWechatReplyService.isExist(jsonObject.get("key").toString());
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>yshop</artifactId>
|
||||
<groupId>co.yixiang</groupId>
|
||||
<version>1.3</version>
|
||||
<version>1.4</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
<dependency>
|
||||
<groupId>co.yixiang</groupId>
|
||||
<artifactId>yshop-generator</artifactId>
|
||||
<version>1.3</version>
|
||||
<version>1.4</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>co.yixiang</groupId>
|
||||
@ -32,12 +32,12 @@
|
||||
<dependency>
|
||||
<groupId>co.yixiang</groupId>
|
||||
<artifactId>yshop-tools</artifactId>
|
||||
<version>1.3</version>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>co.yixiang</groupId>
|
||||
<artifactId>yshop-mp</artifactId>
|
||||
<version>1.3</version>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
|
||||
<!--jwt-->
|
||||
|
@ -1,6 +1,7 @@
|
||||
package co.yixiang.modules.activity.rest;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import co.yixiang.aop.log.Log;
|
||||
import co.yixiang.exception.BadRequestException;
|
||||
import co.yixiang.modules.activity.domain.YxStoreCombination;
|
||||
@ -45,7 +46,7 @@ public class YxStoreCombinationController {
|
||||
@PutMapping(value = "/yxStoreCombination")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECOMBINATION_ALL','YXSTORECOMBINATION_EDIT')")
|
||||
public ResponseEntity update(@Validated @RequestBody YxStoreCombination resources){
|
||||
//if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
if(ObjectUtil.isNotNull(resources.getStartTimeDate())){
|
||||
resources.setStartTime(OrderUtil.
|
||||
dateToTimestamp(resources.getStartTimeDate()));
|
||||
@ -67,7 +68,7 @@ public class YxStoreCombinationController {
|
||||
@ApiOperation(value = "开启关闭")
|
||||
@PostMapping(value = "/yxStoreCombination/onsale/{id}")
|
||||
public ResponseEntity onSale(@PathVariable Integer id,@RequestBody String jsonStr){
|
||||
//if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
JSONObject jsonObject = JSON.parseObject(jsonStr);
|
||||
int status = Integer.valueOf(jsonObject.get("status").toString());
|
||||
//System.out.println(status);
|
||||
@ -80,7 +81,7 @@ public class YxStoreCombinationController {
|
||||
@DeleteMapping(value = "/yxStoreCombination/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECOMBINATION_ALL','YXSTORECOMBINATION_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Integer id){
|
||||
//if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
YxStoreCombination combination = new YxStoreCombination();
|
||||
combination.setIsDel(1);
|
||||
yxStoreCombinationService.update(combination);
|
||||
|
@ -35,7 +35,7 @@ public class RedisController {
|
||||
@DeleteMapping(value = "/redis")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','REDIS_ALL','REDIS_DELETE')")
|
||||
public ResponseEntity delete(@RequestBody RedisVo resources){
|
||||
//if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
redisService.delete(resources.getKey());
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package co.yixiang.modules.quartz.rest;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import co.yixiang.exception.BadRequestException;
|
||||
import co.yixiang.modules.quartz.domain.QuartzJob;
|
||||
import co.yixiang.modules.quartz.service.QuartzJobService;
|
||||
@ -46,7 +47,7 @@ public class QuartzJobController {
|
||||
@PostMapping(value = "/jobs")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','JOB_ALL','JOB_CREATE')")
|
||||
public ResponseEntity create(@Validated @RequestBody QuartzJob resources){
|
||||
//if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
if (resources.getId() != null) {
|
||||
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
|
||||
}
|
||||
@ -57,7 +58,7 @@ public class QuartzJobController {
|
||||
@PutMapping(value = "/jobs")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','JOB_ALL','JOB_EDIT')")
|
||||
public ResponseEntity update(@Validated(QuartzJob.Update.class) @RequestBody QuartzJob resources){
|
||||
//if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
quartzJobService.update(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@ -66,7 +67,7 @@ public class QuartzJobController {
|
||||
@PutMapping(value = "/jobs/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','JOB_ALL','JOB_EDIT')")
|
||||
public ResponseEntity updateIsPause(@PathVariable Long id){
|
||||
//if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
quartzJobService.updateIsPause(quartzJobService.findById(id));
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@ -75,7 +76,7 @@ public class QuartzJobController {
|
||||
@PutMapping(value = "/jobs/exec/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','JOB_ALL','JOB_EDIT')")
|
||||
public ResponseEntity execution(@PathVariable Long id){
|
||||
//if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
quartzJobService.execution(quartzJobService.findById(id));
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@ -84,7 +85,7 @@ public class QuartzJobController {
|
||||
@DeleteMapping(value = "/jobs/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','JOB_ALL','JOB_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Long id){
|
||||
//if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
quartzJobService.delete(quartzJobService.findById(id));
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
|
@ -70,9 +70,9 @@ public class YxStoreProduct implements Serializable {
|
||||
private BigDecimal price;
|
||||
|
||||
// 会员价格
|
||||
@Column(name = "vip_price",nullable = false)
|
||||
@NotNull(message = "会员价必填")
|
||||
@Min(value = 0)
|
||||
@Column(name = "vip_price",insertable = false)
|
||||
//@NotNull(message = "会员价必填")
|
||||
//@Min(value = 0)
|
||||
private BigDecimal vipPrice;
|
||||
|
||||
// 市场价
|
||||
@ -112,7 +112,7 @@ public class YxStoreProduct implements Serializable {
|
||||
|
||||
// 状态(0:未上架,1:上架)
|
||||
@Column(name = "is_show",insertable = false)
|
||||
@NotNull(message = "状态必须选择")
|
||||
//@NotNull(message = "状态必须选择")
|
||||
private Integer isShow;
|
||||
|
||||
// 是否热卖
|
||||
|
@ -0,0 +1,91 @@
|
||||
package co.yixiang.modules.shop.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-12-04
|
||||
*/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="yx_system_user_level")
|
||||
public class YxSystemUserLevel implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
|
||||
// 商户id
|
||||
@Column(name = "mer_id",insertable = false)
|
||||
private Integer merId;
|
||||
|
||||
// 会员名称
|
||||
@Column(name = "name",nullable = false)
|
||||
@NotBlank(message = "请填写等级名称")
|
||||
private String name;
|
||||
|
||||
// 购买金额
|
||||
@Column(name = "money",insertable = false)
|
||||
private BigDecimal money;
|
||||
|
||||
// 有效时间
|
||||
@Column(name = "valid_date",nullable = false)
|
||||
private Integer validDate;
|
||||
|
||||
// 是否为永久会员
|
||||
@Column(name = "is_forever",nullable = false)
|
||||
private Integer isForever;
|
||||
|
||||
// 是否购买,1=购买,0=不购买
|
||||
@Column(name = "is_pay",insertable = false)
|
||||
private Integer isPay;
|
||||
|
||||
// 是否显示 1=显示,0=隐藏
|
||||
@Column(name = "is_show",nullable = false)
|
||||
private Integer isShow;
|
||||
|
||||
// 会员等级
|
||||
@Column(name = "grade",nullable = false)
|
||||
@NotNull(message = "等级必填")
|
||||
private Integer grade;
|
||||
|
||||
// 享受折扣
|
||||
@Column(name = "discount",nullable = false)
|
||||
@NotNull(message = "折扣必填")
|
||||
private BigDecimal discount;
|
||||
|
||||
// 会员卡背景
|
||||
@Column(name = "image",nullable = false)
|
||||
@NotBlank(message = "请上传背景")
|
||||
private String image;
|
||||
|
||||
// 会员图标
|
||||
@Column(name = "icon",nullable = false)
|
||||
@NotBlank(message = "请上传图标")
|
||||
private String icon;
|
||||
|
||||
// 说明
|
||||
@Column(name = "`explain`",nullable = false)
|
||||
@NotBlank(message = "请填写说明")
|
||||
private String explain;
|
||||
|
||||
// 添加时间
|
||||
@Column(name = "add_time",nullable = false)
|
||||
private Integer addTime;
|
||||
|
||||
// 是否删除.1=删除,0=未删除
|
||||
@Column(name = "is_del",insertable = false)
|
||||
private Integer isDel;
|
||||
|
||||
public void copy(YxSystemUserLevel source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package co.yixiang.modules.shop.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-12-04
|
||||
*/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="yx_system_user_task")
|
||||
public class YxSystemUserTask implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id")
|
||||
private Integer id;
|
||||
|
||||
// 任务名称
|
||||
@Column(name = "name",nullable = false)
|
||||
private String name;
|
||||
|
||||
// 配置原名
|
||||
@Column(name = "real_name",nullable = false)
|
||||
private String realName;
|
||||
|
||||
// 任务类型
|
||||
@Column(name = "task_type",nullable = false)
|
||||
private String taskType;
|
||||
|
||||
// 限定数
|
||||
@Column(name = "number",nullable = false)
|
||||
private Integer number;
|
||||
|
||||
// 等级id
|
||||
@Column(name = "level_id",nullable = false)
|
||||
private Integer levelId;
|
||||
|
||||
// 排序
|
||||
@Column(name = "sort",nullable = false)
|
||||
private Integer sort;
|
||||
|
||||
// 是否显示
|
||||
@Column(name = "is_show",nullable = false)
|
||||
private Integer isShow;
|
||||
|
||||
// 是否务必达成任务,1务必达成,0=满足其一
|
||||
@Column(name = "is_must",nullable = false)
|
||||
private Integer isMust;
|
||||
|
||||
// 任务说明
|
||||
@Column(name = "illustrate",nullable = false)
|
||||
private String illustrate;
|
||||
|
||||
// 新增时间
|
||||
@Column(name = "add_time",nullable = false)
|
||||
private Integer addTime;
|
||||
|
||||
public void copy(YxSystemUserTask source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package co.yixiang.modules.shop.repository;
|
||||
|
||||
import co.yixiang.modules.shop.domain.YxSystemUserLevel;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-12-04
|
||||
*/
|
||||
public interface YxSystemUserLevelRepository extends JpaRepository<YxSystemUserLevel, Integer>, JpaSpecificationExecutor {
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package co.yixiang.modules.shop.repository;
|
||||
|
||||
import co.yixiang.modules.shop.domain.YxSystemUserTask;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-12-04
|
||||
*/
|
||||
public interface YxSystemUserTaskRepository extends JpaRepository<YxSystemUserTask, Integer>, JpaSpecificationExecutor {
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package co.yixiang.modules.shop.rest;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import co.yixiang.aop.log.Log;
|
||||
import co.yixiang.exception.BadRequestException;
|
||||
import co.yixiang.modules.shop.domain.YxStoreCategory;
|
||||
@ -47,7 +48,7 @@ public class YxStoreCategoryController {
|
||||
@PostMapping(value = "/yxStoreCategory")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECATEGORY_ALL','YXSTORECATEGORY_CREATE')")
|
||||
public ResponseEntity create(@Validated @RequestBody YxStoreCategory resources){
|
||||
//if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
resources.setAddTime(OrderUtil.getSecondTimestampTwo());
|
||||
return new ResponseEntity(yxStoreCategoryService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
@ -57,7 +58,7 @@ public class YxStoreCategoryController {
|
||||
@PutMapping(value = "/yxStoreCategory")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECATEGORY_ALL','YXSTORECATEGORY_EDIT')")
|
||||
public ResponseEntity update(@Validated @RequestBody YxStoreCategory resources){
|
||||
//if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
yxStoreCategoryService.update(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@ -67,7 +68,7 @@ public class YxStoreCategoryController {
|
||||
@DeleteMapping(value = "/yxStoreCategory/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECATEGORY_ALL','YXSTORECATEGORY_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Integer id){
|
||||
//if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
yxStoreCategoryService.delete(id);
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public class YxStoreProductController {
|
||||
@PostMapping(value = "/yxStoreProduct")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREPRODUCT_ALL','YXSTOREPRODUCT_CREATE')")
|
||||
public ResponseEntity create(@Validated @RequestBody YxStoreProduct resources){
|
||||
//if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
resources.setAddTime(OrderUtil.getSecondTimestampTwo());
|
||||
if(ObjectUtil.isEmpty(resources.getGiveIntegral())) resources.setGiveIntegral(BigDecimal.ZERO);
|
||||
if(ObjectUtil.isEmpty(resources.getCost())) resources.setCost(BigDecimal.ZERO);
|
||||
@ -58,7 +58,7 @@ public class YxStoreProductController {
|
||||
@PutMapping(value = "/yxStoreProduct")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREPRODUCT_ALL','YXSTOREPRODUCT_EDIT')")
|
||||
public ResponseEntity update(@Validated @RequestBody YxStoreProduct resources){
|
||||
//if(ObjectUtil.isNotNull(resources)) throw new BadRequestException("演示环境禁止操作");
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
yxStoreProductService.update(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@ -68,7 +68,7 @@ public class YxStoreProductController {
|
||||
@DeleteMapping(value = "/yxStoreProduct/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREPRODUCT_ALL','YXSTOREPRODUCT_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Integer id){
|
||||
//if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
yxStoreProductService.delete(id);
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class YxSystemGroupDataController {
|
||||
@PostMapping(value = "/yxSystemGroupData")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_CREATE')")
|
||||
public ResponseEntity create(@RequestBody String jsonStr){
|
||||
//if(StrUtil.isNotEmpty(jsonStr)) throw new BadRequestException("演示环境禁止操作");
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
JSONObject jsonObject = JSON.parseObject(jsonStr);
|
||||
|
||||
if(ObjectUtil.isNotNull(jsonObject.get("name"))){
|
||||
@ -88,7 +88,7 @@ public class YxSystemGroupDataController {
|
||||
@PutMapping(value = "/yxSystemGroupData")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_EDIT')")
|
||||
public ResponseEntity update(@RequestBody String jsonStr){
|
||||
//if(StrUtil.isNotEmpty(jsonStr)) throw new BadRequestException("演示环境禁止操作");
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
JSONObject jsonObject = JSON.parseObject(jsonStr);
|
||||
if(ObjectUtil.isNotNull(jsonObject.get("name"))){
|
||||
if(StrUtil.isEmpty(jsonObject.get("name").toString())){
|
||||
@ -123,7 +123,7 @@ public class YxSystemGroupDataController {
|
||||
@DeleteMapping(value = "/yxSystemGroupData/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Integer id){
|
||||
//if(id > 0) throw new BadRequestException("演示环境禁止操作");
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
yxSystemGroupDataService.delete(id);
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
|
@ -0,0 +1,68 @@
|
||||
package co.yixiang.modules.shop.rest;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import co.yixiang.aop.log.Log;
|
||||
import co.yixiang.exception.BadRequestException;
|
||||
import co.yixiang.modules.shop.domain.YxSystemUserLevel;
|
||||
import co.yixiang.modules.shop.service.YxSystemUserLevelService;
|
||||
import co.yixiang.modules.shop.service.dto.YxSystemUserLevelQueryCriteria;
|
||||
import co.yixiang.utils.OrderUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-12-04
|
||||
*/
|
||||
@Api(tags = "YxSystemUserLevel管理")
|
||||
@RestController
|
||||
@RequestMapping("api")
|
||||
public class YxSystemUserLevelController {
|
||||
|
||||
@Autowired
|
||||
private YxSystemUserLevelService yxSystemUserLevelService;
|
||||
|
||||
@Log("查询")
|
||||
@ApiOperation(value = "查询")
|
||||
@GetMapping(value = "/yxSystemUserLevel")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSYSTEMUSERLEVEL_ALL','YXSYSTEMUSERLEVEL_SELECT')")
|
||||
public ResponseEntity getYxSystemUserLevels(YxSystemUserLevelQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity(yxSystemUserLevelService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("新增")
|
||||
@ApiOperation(value = "新增")
|
||||
@PostMapping(value = "/yxSystemUserLevel")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSYSTEMUSERLEVEL_ALL','YXSYSTEMUSERLEVEL_CREATE')")
|
||||
public ResponseEntity create(@Validated @RequestBody YxSystemUserLevel resources){
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
resources.setAddTime(OrderUtil.getSecondTimestampTwo());
|
||||
return new ResponseEntity(yxSystemUserLevelService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Log("修改YxSystemUserLevel")
|
||||
@ApiOperation(value = "修改YxSystemUserLevel")
|
||||
@PutMapping(value = "/yxSystemUserLevel")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSYSTEMUSERLEVEL_ALL','YXSYSTEMUSERLEVEL_EDIT')")
|
||||
public ResponseEntity update(@Validated @RequestBody YxSystemUserLevel resources){
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
yxSystemUserLevelService.update(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除YxSystemUserLevel")
|
||||
@ApiOperation(value = "删除YxSystemUserLevel")
|
||||
@DeleteMapping(value = "/yxSystemUserLevel/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSYSTEMUSERLEVEL_ALL','YXSYSTEMUSERLEVEL_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Integer id){
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
yxSystemUserLevelService.delete(id);
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package co.yixiang.modules.shop.rest;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import co.yixiang.aop.log.Log;
|
||||
import co.yixiang.exception.BadRequestException;
|
||||
import co.yixiang.modules.shop.domain.YxSystemUserTask;
|
||||
import co.yixiang.modules.shop.service.YxSystemUserTaskService;
|
||||
import co.yixiang.modules.shop.service.dto.YxSystemUserTaskQueryCriteria;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-12-04
|
||||
*/
|
||||
@Api(tags = "YxSystemUserTask管理")
|
||||
@RestController
|
||||
@RequestMapping("api")
|
||||
public class YxSystemUserTaskController {
|
||||
|
||||
@Autowired
|
||||
private YxSystemUserTaskService yxSystemUserTaskService;
|
||||
|
||||
@Log("查询YxSystemUserTask")
|
||||
@ApiOperation(value = "查询YxSystemUserTask")
|
||||
@GetMapping(value = "/yxSystemUserTask")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSYSTEMUSERTASK_ALL','YXSYSTEMUSERTASK_SELECT')")
|
||||
public ResponseEntity getYxSystemUserTasks(YxSystemUserTaskQueryCriteria criteria,
|
||||
Pageable pageable){
|
||||
Sort sort = new Sort(Sort.Direction.ASC, "levelId");
|
||||
Pageable pageableT = new PageRequest(pageable.getPageNumber(),
|
||||
pageable.getPageSize(),
|
||||
sort);
|
||||
return new ResponseEntity(yxSystemUserTaskService.queryAll(criteria,pageableT),
|
||||
HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("新增YxSystemUserTask")
|
||||
@ApiOperation(value = "新增YxSystemUserTask")
|
||||
@PostMapping(value = "/yxSystemUserTask")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSYSTEMUSERTASK_ALL','YXSYSTEMUSERTASK_CREATE')")
|
||||
public ResponseEntity create(@Validated @RequestBody YxSystemUserTask resources){
|
||||
return new ResponseEntity(yxSystemUserTaskService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Log("修改YxSystemUserTask")
|
||||
@ApiOperation(value = "修改YxSystemUserTask")
|
||||
@PutMapping(value = "/yxSystemUserTask")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSYSTEMUSERTASK_ALL','YXSYSTEMUSERTASK_EDIT')")
|
||||
public ResponseEntity update(@Validated @RequestBody YxSystemUserTask resources){
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
yxSystemUserTaskService.update(resources);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除YxSystemUserTask")
|
||||
@ApiOperation(value = "删除YxSystemUserTask")
|
||||
@DeleteMapping(value = "/yxSystemUserTask/{id}")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXSYSTEMUSERTASK_ALL','YXSYSTEMUSERTASK_DELETE')")
|
||||
public ResponseEntity delete(@PathVariable Integer id){
|
||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||
yxSystemUserTaskService.delete(id);
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
}
|
@ -2,6 +2,8 @@ package co.yixiang.modules.shop.rest;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import co.yixiang.modules.shop.service.YxUserService;
|
||||
import co.yixiang.modules.shop.service.dto.UserMoneyDTO;
|
||||
import co.yixiang.modules.shop.service.dto.YxUserDTO;
|
||||
import co.yixiang.modules.wechat.service.YxSystemConfigService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@ -85,4 +87,13 @@ public class YxUserController {
|
||||
return new ResponseEntity(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改余额")
|
||||
@PostMapping(value = "/yxUser/money")
|
||||
@PreAuthorize("hasAnyRole('ADMIN','YXUSER_ALL','YXUSER_EDIT')")
|
||||
public ResponseEntity updatePrice(@Validated @RequestBody UserMoneyDTO param){
|
||||
|
||||
yxUserService.updateMoney(param);
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package co.yixiang.modules.shop.service;
|
||||
|
||||
import co.yixiang.modules.shop.domain.YxSystemUserLevel;
|
||||
import co.yixiang.modules.shop.service.dto.YxSystemUserLevelDTO;
|
||||
import co.yixiang.modules.shop.service.dto.YxSystemUserLevelQueryCriteria;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-12-04
|
||||
*/
|
||||
//@CacheConfig(cacheNames = "yxSystemUserLevel")
|
||||
public interface YxSystemUserLevelService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria
|
||||
* @param pageable
|
||||
* @return
|
||||
*/
|
||||
//@Cacheable
|
||||
Map<String,Object> queryAll(YxSystemUserLevelQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria
|
||||
* @return
|
||||
*/
|
||||
//@Cacheable
|
||||
List<YxSystemUserLevelDTO> queryAll(YxSystemUserLevelQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@Cacheable(key = "#p0")
|
||||
YxSystemUserLevelDTO findById(Integer id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param resources
|
||||
* @return
|
||||
*/
|
||||
//@CacheEvict(allEntries = true)
|
||||
YxSystemUserLevelDTO create(YxSystemUserLevel resources);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param resources
|
||||
*/
|
||||
//@CacheEvict(allEntries = true)
|
||||
void update(YxSystemUserLevel resources);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
*/
|
||||
//@CacheEvict(allEntries = true)
|
||||
void delete(Integer id);
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package co.yixiang.modules.shop.service;
|
||||
|
||||
import co.yixiang.modules.shop.domain.YxSystemUserTask;
|
||||
import co.yixiang.modules.shop.service.dto.YxSystemUserTaskDTO;
|
||||
import co.yixiang.modules.shop.service.dto.YxSystemUserTaskQueryCriteria;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-12-04
|
||||
*/
|
||||
//@CacheConfig(cacheNames = "yxSystemUserTask")
|
||||
public interface YxSystemUserTaskService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria
|
||||
* @param pageable
|
||||
* @return
|
||||
*/
|
||||
//@Cacheable
|
||||
Map<String,Object> queryAll(YxSystemUserTaskQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria
|
||||
* @return
|
||||
*/
|
||||
//@Cacheable
|
||||
List<YxSystemUserTaskDTO> queryAll(YxSystemUserTaskQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@Cacheable(key = "#p0")
|
||||
YxSystemUserTaskDTO findById(Integer id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param resources
|
||||
* @return
|
||||
*/
|
||||
//@CacheEvict(allEntries = true)
|
||||
YxSystemUserTaskDTO create(YxSystemUserTask resources);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param resources
|
||||
*/
|
||||
//@CacheEvict(allEntries = true)
|
||||
void update(YxSystemUserTask resources);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
*/
|
||||
//@CacheEvict(allEntries = true)
|
||||
void delete(Integer id);
|
||||
|
||||
List<Map<String,Object>> getTaskType();
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package co.yixiang.modules.shop.service;
|
||||
|
||||
import co.yixiang.modules.shop.domain.YxUser;
|
||||
import co.yixiang.modules.shop.service.dto.UserMoneyDTO;
|
||||
import co.yixiang.modules.shop.service.dto.YxUserDTO;
|
||||
import co.yixiang.modules.shop.service.dto.YxUserQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@ -14,6 +15,8 @@ import java.util.List;
|
||||
//@CacheConfig(cacheNames = "yxUser")
|
||||
public interface YxUserService {
|
||||
|
||||
void updateMoney(UserMoneyDTO param);
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria
|
||||
|
@ -0,0 +1,23 @@
|
||||
package co.yixiang.modules.shop.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @ClassName UserMoneyDTO
|
||||
* @Author hupeng <610796224@qq.com>
|
||||
* @Date 2019/12/4
|
||||
**/
|
||||
@Data
|
||||
public class UserMoneyDTO implements Serializable {
|
||||
@NotNull(message = "参数缺失")
|
||||
private Integer uid;
|
||||
@NotNull(message = "请选择修改余额方式")
|
||||
private Integer ptype;
|
||||
@NotNull(message = "金额必填")
|
||||
@Min(message = "最低金额为0",value = 0)
|
||||
private Double money;
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package co.yixiang.modules.shop.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-12-04
|
||||
*/
|
||||
@Data
|
||||
public class YxSystemUserLevelDTO implements Serializable {
|
||||
|
||||
private Integer id;
|
||||
|
||||
// 商户id
|
||||
private Integer merId;
|
||||
|
||||
// 会员名称
|
||||
private String name;
|
||||
|
||||
// 购买金额
|
||||
private BigDecimal money;
|
||||
|
||||
// 有效时间
|
||||
private Integer validDate;
|
||||
|
||||
// 是否为永久会员
|
||||
private Integer isForever;
|
||||
|
||||
// 是否购买,1=购买,0=不购买
|
||||
private Integer isPay;
|
||||
|
||||
// 是否显示 1=显示,0=隐藏
|
||||
private Integer isShow;
|
||||
|
||||
// 会员等级
|
||||
private Integer grade;
|
||||
|
||||
// 享受折扣
|
||||
private BigDecimal discount;
|
||||
|
||||
// 会员卡背景
|
||||
private String image;
|
||||
|
||||
// 会员图标
|
||||
private String icon;
|
||||
|
||||
// 说明
|
||||
private String explain;
|
||||
|
||||
// 添加时间
|
||||
private Integer addTime;
|
||||
|
||||
// 是否删除.1=删除,0=未删除
|
||||
private Integer isDel;
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package co.yixiang.modules.shop.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
import co.yixiang.annotation.Query;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-12-04
|
||||
*/
|
||||
@Data
|
||||
public class YxSystemUserLevelQueryCriteria{
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package co.yixiang.modules.shop.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-12-04
|
||||
*/
|
||||
@Data
|
||||
public class YxSystemUserTaskDTO implements Serializable {
|
||||
|
||||
private Integer id;
|
||||
|
||||
// 任务名称
|
||||
private String name;
|
||||
|
||||
// 配置原名
|
||||
private String realName;
|
||||
|
||||
// 任务类型
|
||||
private String taskType;
|
||||
|
||||
// 限定数
|
||||
private Integer number;
|
||||
|
||||
// 等级id
|
||||
private Integer levelId;
|
||||
|
||||
private String levalName;
|
||||
|
||||
// 排序
|
||||
private Integer sort;
|
||||
|
||||
// 是否显示
|
||||
private Integer isShow;
|
||||
|
||||
// 是否务必达成任务,1务必达成,0=满足其一
|
||||
private Integer isMust;
|
||||
|
||||
// 任务说明
|
||||
private String illustrate;
|
||||
|
||||
// 新增时间
|
||||
private Integer addTime;
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package co.yixiang.modules.shop.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import co.yixiang.annotation.Query;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-12-04
|
||||
*/
|
||||
@Data
|
||||
public class YxSystemUserTaskQueryCriteria{
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package co.yixiang.modules.shop.service.impl;
|
||||
|
||||
import co.yixiang.modules.shop.domain.YxSystemUserLevel;
|
||||
import co.yixiang.utils.ValidationUtil;
|
||||
import co.yixiang.modules.shop.repository.YxSystemUserLevelRepository;
|
||||
import co.yixiang.modules.shop.service.YxSystemUserLevelService;
|
||||
import co.yixiang.modules.shop.service.dto.YxSystemUserLevelDTO;
|
||||
import co.yixiang.modules.shop.service.dto.YxSystemUserLevelQueryCriteria;
|
||||
import co.yixiang.modules.shop.service.mapper.YxSystemUserLevelMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.Optional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import co.yixiang.utils.PageUtil;
|
||||
import co.yixiang.utils.QueryHelp;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-12-04
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class YxSystemUserLevelServiceImpl implements YxSystemUserLevelService {
|
||||
|
||||
@Autowired
|
||||
private YxSystemUserLevelRepository yxSystemUserLevelRepository;
|
||||
|
||||
@Autowired
|
||||
private YxSystemUserLevelMapper yxSystemUserLevelMapper;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(YxSystemUserLevelQueryCriteria criteria, Pageable pageable){
|
||||
Page<YxSystemUserLevel> page = yxSystemUserLevelRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(yxSystemUserLevelMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<YxSystemUserLevelDTO> queryAll(YxSystemUserLevelQueryCriteria criteria){
|
||||
return yxSystemUserLevelMapper.toDto(yxSystemUserLevelRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public YxSystemUserLevelDTO findById(Integer id) {
|
||||
Optional<YxSystemUserLevel> yxSystemUserLevel = yxSystemUserLevelRepository.findById(id);
|
||||
ValidationUtil.isNull(yxSystemUserLevel,"YxSystemUserLevel","id",id);
|
||||
return yxSystemUserLevelMapper.toDto(yxSystemUserLevel.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public YxSystemUserLevelDTO create(YxSystemUserLevel resources) {
|
||||
return yxSystemUserLevelMapper.toDto(yxSystemUserLevelRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(YxSystemUserLevel resources) {
|
||||
Optional<YxSystemUserLevel> optionalYxSystemUserLevel = yxSystemUserLevelRepository.findById(resources.getId());
|
||||
ValidationUtil.isNull( optionalYxSystemUserLevel,"YxSystemUserLevel","id",resources.getId());
|
||||
YxSystemUserLevel yxSystemUserLevel = optionalYxSystemUserLevel.get();
|
||||
yxSystemUserLevel.copy(resources);
|
||||
yxSystemUserLevelRepository.save(yxSystemUserLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(Integer id) {
|
||||
yxSystemUserLevelRepository.deleteById(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,114 @@
|
||||
package co.yixiang.modules.shop.service.impl;
|
||||
|
||||
import co.yixiang.modules.shop.domain.YxSystemUserTask;
|
||||
import co.yixiang.modules.shop.service.YxSystemUserLevelService;
|
||||
import co.yixiang.utils.ValidationUtil;
|
||||
import co.yixiang.modules.shop.repository.YxSystemUserTaskRepository;
|
||||
import co.yixiang.modules.shop.service.YxSystemUserTaskService;
|
||||
import co.yixiang.modules.shop.service.dto.YxSystemUserTaskDTO;
|
||||
import co.yixiang.modules.shop.service.dto.YxSystemUserTaskQueryCriteria;
|
||||
import co.yixiang.modules.shop.service.mapper.YxSystemUserTaskMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Optional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import co.yixiang.utils.PageUtil;
|
||||
import co.yixiang.utils.QueryHelp;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* @date 2019-12-04
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class YxSystemUserTaskServiceImpl implements YxSystemUserTaskService {
|
||||
|
||||
@Autowired
|
||||
private YxSystemUserTaskRepository yxSystemUserTaskRepository;
|
||||
|
||||
@Autowired
|
||||
private YxSystemUserTaskMapper yxSystemUserTaskMapper;
|
||||
|
||||
@Autowired
|
||||
private YxSystemUserLevelService systemUserLevelService;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(YxSystemUserTaskQueryCriteria criteria, Pageable pageable){
|
||||
|
||||
Page<YxSystemUserTask> page = yxSystemUserTaskRepository
|
||||
.findAll((root, criteriaQuery, criteriaBuilder)
|
||||
-> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
|
||||
List<YxSystemUserTaskDTO> systemUserTaskDTOS = yxSystemUserTaskMapper
|
||||
.toDto(page.getContent());
|
||||
for (YxSystemUserTaskDTO systemUserTaskDTO : systemUserTaskDTOS) {
|
||||
systemUserTaskDTO.setLevalName(systemUserLevelService
|
||||
.findById(systemUserTaskDTO.getLevelId()).getName());
|
||||
}
|
||||
|
||||
Map<String,Object> map = new LinkedHashMap<>(2);
|
||||
map.put("content",systemUserTaskDTOS);
|
||||
map.put("totalElements",page.getTotalElements());
|
||||
|
||||
return map;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<YxSystemUserTaskDTO> queryAll(YxSystemUserTaskQueryCriteria criteria){
|
||||
return yxSystemUserTaskMapper.toDto(yxSystemUserTaskRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public YxSystemUserTaskDTO findById(Integer id) {
|
||||
Optional<YxSystemUserTask> yxSystemUserTask = yxSystemUserTaskRepository.findById(id);
|
||||
ValidationUtil.isNull(yxSystemUserTask,"YxSystemUserTask","id",id);
|
||||
return yxSystemUserTaskMapper.toDto(yxSystemUserTask.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public YxSystemUserTaskDTO create(YxSystemUserTask resources) {
|
||||
return yxSystemUserTaskMapper.toDto(yxSystemUserTaskRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(YxSystemUserTask resources) {
|
||||
Optional<YxSystemUserTask> optionalYxSystemUserTask = yxSystemUserTaskRepository.findById(resources.getId());
|
||||
ValidationUtil.isNull( optionalYxSystemUserTask,"YxSystemUserTask","id",resources.getId());
|
||||
YxSystemUserTask yxSystemUserTask = optionalYxSystemUserTask.get();
|
||||
yxSystemUserTask.copy(resources);
|
||||
yxSystemUserTaskRepository.save(yxSystemUserTask);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(Integer id) {
|
||||
yxSystemUserTaskRepository.deleteById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务类型
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getTaskType() {
|
||||
List<Map<String, Object>> list = null;
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("type","SatisfactionIntegral");
|
||||
map.put("type","SatisfactionIntegral");
|
||||
map.put("type","SatisfactionIntegral");
|
||||
map.put("type","SatisfactionIntegral");
|
||||
map.put("type","SatisfactionIntegral");
|
||||
map.put("type","SatisfactionIntegral");
|
||||
return null;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user