1.4.3版本,后台图标更新、新增加用户账单流水,后台模块重新拆分,物流快递单独管理,导出最新sql

This commit is contained in:
hupeng
2019-12-12 19:25:05 +08:00
parent fe9bd6c901
commit 2d89095296
185 changed files with 751 additions and 516 deletions

View File

@ -0,0 +1,159 @@
package co.yixiang.modules.activity.domain;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.io.Serializable;
import java.util.Date;
/**
* @author hupeng
* @date 2019-11-18
*/
@Entity
@Data
@Table(name="yx_store_combination")
public class YxStoreCombination implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
// 商品id
@Column(name = "product_id",nullable = false)
private Integer productId;
// 商户id
@Column(name = "mer_id",insertable = false)
private Integer merId;
// 推荐图
@Column(name = "image",nullable = false)
@NotBlank(message = "请上传产品图片")
private String image;
// 轮播图
@Column(name = "images",nullable = false)
@NotBlank(message = "请上传产品轮播图")
private String images;
// 活动标题
@Column(name = "title",nullable = false)
@NotBlank(message = "请输入拼团名称")
private String title;
// 活动属性
@Column(name = "attr")
private String attr;
// 参团人数
@Column(name = "people",nullable = false)
@NotNull(message = "拼团人数必填")
@Min(value = 2,message = "拼团人数必须大于1")
private Integer people;
// 简介
@Column(name = "info",nullable = false)
@NotBlank(message = "请输入拼团简介")
private String info;
// 价格
@Column(name = "price",nullable = false)
@NotNull(message = "拼团价必填")
@Min(value = 0,message = "拼团价必须大于0")
private BigDecimal price;
// 排序
@Column(name = "sort",nullable = false)
@NotNull(message = "排序必填")
private Integer sort;
// 销量
@Column(name = "sales",nullable = false)
@NotNull(message = "销量必填")
private Integer sales;
// 库存
@Column(name = "stock",nullable = false)
@NotNull(message = "库存必填")
private Integer stock;
// 添加时间
@Column(name = "add_time",nullable = false)
private String addTime;
// 推荐
@Column(name = "is_host",nullable = false)
@NotNull(message = "推荐必须选择")
private Integer isHost;
// 产品状态
@Column(name = "is_show",nullable = false)
@NotNull(message = "状态必须选择")
private Integer isShow;
@Column(name = "is_del",nullable = false,insertable = false)
private Integer isDel;
@Column(name = "combination",nullable = false,insertable = false)
private Integer combination;
// 商户是否可用1可用0不可用
@Column(name = "mer_use")
private Integer merUse;
// 是否包邮1是0否
@Column(name = "is_postage",nullable = false)
@NotNull(message = "包邮状态必须选择")
private Integer isPostage;
// 邮费
@Column(name = "postage",nullable = false)
@NotNull(message = "邮费必填")
private BigDecimal postage;
// 拼团内容
@Column(name = "description",nullable = false)
@NotBlank(message = "拼团内容不能为空")
private String description;
// 拼团开始时间
@Column(name = "start_time",nullable = false)
private Integer startTime;
// 拼团结束时间
@Column(name = "stop_time",nullable = false)
private Integer stopTime;
@NotNull(message = "开始时间不能为空")
private Date startTimeDate;
@NotNull(message = "结束时间不能为空")
private Date endTimeDate;
// 拼团订单有效时间
@Column(name = "effective_time",nullable = false)
private Integer effectiveTime;
// 拼图产品成本
@Column(name = "cost",nullable = false)
private Integer cost;
// 浏览量
@Column(name = "browse")
private Integer browse;
// 单位名
@Column(name = "unit_name",nullable = false)
private String unitName;
public void copy(YxStoreCombination source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -0,0 +1,69 @@
package co.yixiang.modules.activity.domain;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @author hupeng
* @date 2019-11-09
*/
@Entity
@Data
@Table(name="yx_store_coupon")
public class YxStoreCoupon implements Serializable {
// 优惠券表ID
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
// 优惠券名称
@Column(name = "title",nullable = false)
@NotBlank(message = "名称必填")
private String title;
// 兑换消耗积分值
@Column(name = "integral",nullable = false)
private Integer integral;
// 兑换的优惠券面值
@Column(name = "coupon_price",nullable = false)
@Min(value = 1,message = "面值必须大于1")
private BigDecimal couponPrice;
// 最低消费多少金额可用优惠券
@Column(name = "use_min_price",nullable = false)
@Min(value = 1,message = "最低消费必须大于1")
private BigDecimal useMinPrice;
// 优惠券有效期限(单位:天)
@Column(name = "coupon_time",nullable = false)
private Integer couponTime;
// 排序
@Column(name = "sort",nullable = false)
private Integer sort;
// 状态0关闭1开启
@Column(name = "status",nullable = false)
private Integer status;
// 兑换项目添加时间
@Column(name = "add_time",nullable = false)
private Integer addTime;
// 是否删除
@Column(name = "is_del",nullable = false,insertable = false)
private Integer isDel;
public void copy(YxStoreCoupon source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -0,0 +1,74 @@
package co.yixiang.modules.activity.domain;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import lombok.NonNull;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
/**
* @author hupeng
* @date 2019-11-09
*/
@Entity
@Data
@Table(name="yx_store_coupon_issue")
public class YxStoreCouponIssue implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
// 优惠券ID
@Column(name = "cid")
private Integer cid;
@Column(name = "cname")
private String cname;
// 优惠券领取开启时间
@Column(name = "start_time")
private Integer startTime;
@NotNull(message = "领取时间不能为空")
private Date startTimeDate;
@NotNull(message = "结束时间不能为空")
private Date endTimeDate;
// 优惠券领取结束时间
@Column(name = "end_time")
private Integer endTime;
// 优惠券领取数量
@Column(name = "total_count")
private Integer totalCount;
// 优惠券剩余领取数量
@Column(name = "remain_count")
private Integer remainCount;
// 是否无限张数
@Column(name = "is_permanent",nullable = false)
private Integer isPermanent;
// 1 正常 0 未开启 -1 已无效
@Column(name = "status",nullable = false)
private Integer status;
@Column(name = "is_del",nullable = false)
private Integer isDel;
// 优惠券添加时间
@Column(name = "add_time")
private Integer addTime;
public void copy(YxStoreCouponIssue source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -0,0 +1,38 @@
package co.yixiang.modules.activity.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-11-09
*/
@Entity
@Data
@Table(name="yx_store_coupon_issue_user")
public class YxStoreCouponIssueUser implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
// 领取优惠券用户ID
@Column(name = "uid")
private Integer uid;
// 优惠券前台领取ID
@Column(name = "issue_coupon_id")
private Integer issueCouponId;
// 领取时间
@Column(name = "add_time")
private Integer addTime;
public void copy(YxStoreCouponIssueUser source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -0,0 +1,72 @@
package co.yixiang.modules.activity.domain;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @author hupeng
* @date 2019-11-10
*/
@Entity
@Data
@Table(name="yx_store_coupon_user")
public class YxStoreCouponUser implements Serializable {
// 优惠券发放记录id
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
// 兑换的项目id
@Column(name = "cid",nullable = false)
private Integer cid;
// 优惠券所属用户
@Column(name = "uid",nullable = false)
private Integer uid;
// 优惠券名称
@Column(name = "coupon_title",nullable = false)
private String couponTitle;
// 优惠券的面值
@Column(name = "coupon_price",nullable = false)
private BigDecimal couponPrice;
// 最低消费多少金额可用优惠券
@Column(name = "use_min_price",nullable = false)
private BigDecimal useMinPrice;
// 优惠券创建时间
@Column(name = "add_time",nullable = false)
private Integer addTime;
// 优惠券结束时间
@Column(name = "end_time",nullable = false)
private Integer endTime;
// 使用时间
@Column(name = "use_time",nullable = false)
private Integer useTime;
// 获取方式
@Column(name = "type",nullable = false)
private String type;
// 状态0未使用1已使用, 2:已过期)
@Column(name = "status",nullable = false)
private Integer status;
// 是否有效
@Column(name = "is_fail",nullable = false)
private Integer isFail;
public void copy(YxStoreCouponUser source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -0,0 +1,86 @@
package co.yixiang.modules.activity.domain;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @author hupeng
* @date 2019-11-18
*/
@Entity
@Data
@Table(name="yx_store_pink")
public class YxStorePink implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
// 用户id
@Column(name = "uid",nullable = false)
private Integer uid;
// 订单id 生成
@Column(name = "order_id",nullable = false)
private String orderId;
// 订单id 数据库
@Column(name = "order_id_key",nullable = false)
private Integer orderIdKey;
// 购买商品个数
@Column(name = "total_num",nullable = false)
private Integer totalNum;
// 购买总金额
@Column(name = "total_price",nullable = false)
private BigDecimal totalPrice;
// 拼团产品id
@Column(name = "cid",nullable = false)
private Integer cid;
// 产品id
@Column(name = "pid",nullable = false)
private Integer pid;
// 拼图总人数
@Column(name = "people",nullable = false)
private Integer people;
// 拼团产品单价
@Column(name = "price",nullable = false)
private BigDecimal price;
// 开始时间
@Column(name = "add_time",nullable = false)
private String addTime;
@Column(name = "stop_time",nullable = false)
private String stopTime;
// 团长id 0为团长
@Column(name = "k_id",nullable = false)
private Integer kId;
// 是否发送模板消息0未发送1已发送
@Column(name = "is_tpl",nullable = false)
private Integer isTpl;
// 是否退款 0未退款 1已退款
@Column(name = "is_refund",nullable = false)
private Integer isRefund;
// 状态1进行中2已完成3未完成
@Column(name = "status",nullable = false)
private Integer status;
public void copy(YxStorePink source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -0,0 +1,58 @@
package co.yixiang.modules.activity.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-11-18
*/
@Entity
@Data
@Table(name="yx_store_visit")
public class YxStoreVisit implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
// 产品ID
@Column(name = "product_id")
private Integer productId;
// 产品类型
@Column(name = "product_type")
private String productType;
// 产品分类ID
@Column(name = "cate_id")
private Integer cateId;
// 产品类型
@Column(name = "type")
private String type;
// 用户ID
@Column(name = "uid")
private Integer uid;
// 访问次数
@Column(name = "count")
private Integer count;
// 备注描述
@Column(name = "content")
private String content;
// 添加时间
@Column(name = "add_time")
private Integer addTime;
public void copy(YxStoreVisit source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -0,0 +1,79 @@
package co.yixiang.modules.activity.domain;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @author hupeng
* @date 2019-11-14
*/
@Entity
@Data
@Table(name="yx_user_extract")
public class YxUserExtract implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
@Column(name = "uid")
private Integer uid;
// 名称
@Column(name = "real_name")
private String realName;
// bank = 银行卡 alipay = 支付宝wx=微信
@Column(name = "extract_type")
private String extractType;
// 银行卡
@Column(name = "bank_code")
private String bankCode;
// 开户地址
@Column(name = "bank_address")
private String bankAddress;
// 支付宝账号
@Column(name = "alipay_code")
private String alipayCode;
// 提现金额
@Column(name = "extract_price")
private BigDecimal extractPrice;
@Column(name = "mark")
private String mark;
@Column(name = "balance")
private BigDecimal balance;
// 无效原因
@Column(name = "fail_msg")
private String failMsg;
@Column(name = "fail_time")
private Integer failTime;
// 添加时间
@Column(name = "add_time")
private Integer addTime;
// -1 未通过 0 审核中 1 已提现
@Column(name = "status")
private Integer status;
// 微信号
@Column(name = "wechat")
private String wechat;
public void copy(YxUserExtract source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -0,0 +1,18 @@
package co.yixiang.modules.activity.repository;
import co.yixiang.modules.activity.domain.YxStoreCombination;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
/**
* @author hupeng
* @date 2019-11-18
*/
public interface YxStoreCombinationRepository extends JpaRepository<YxStoreCombination, Integer>, JpaSpecificationExecutor {
@Modifying
@Query(value = "update yx_store_combination set is_show = ?1 where id = ?2",nativeQuery = true)
void updateOnsale(int status,int id);
}

View File

@ -0,0 +1,12 @@
package co.yixiang.modules.activity.repository;
import co.yixiang.modules.activity.domain.YxStoreCouponIssue;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @author hupeng
* @date 2019-11-09
*/
public interface YxStoreCouponIssueRepository extends JpaRepository<YxStoreCouponIssue, Integer>, JpaSpecificationExecutor {
}

View File

@ -0,0 +1,12 @@
package co.yixiang.modules.activity.repository;
import co.yixiang.modules.activity.domain.YxStoreCouponIssueUser;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @author hupeng
* @date 2019-11-09
*/
public interface YxStoreCouponIssueUserRepository extends JpaRepository<YxStoreCouponIssueUser, Integer>, JpaSpecificationExecutor {
}

View File

@ -0,0 +1,12 @@
package co.yixiang.modules.activity.repository;
import co.yixiang.modules.activity.domain.YxStoreCoupon;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @author hupeng
* @date 2019-11-09
*/
public interface YxStoreCouponRepository extends JpaRepository<YxStoreCoupon, Integer>, JpaSpecificationExecutor {
}

View File

@ -0,0 +1,12 @@
package co.yixiang.modules.activity.repository;
import co.yixiang.modules.activity.domain.YxStoreCouponUser;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @author hupeng
* @date 2019-11-10
*/
public interface YxStoreCouponUserRepository extends JpaRepository<YxStoreCouponUser, Integer>, JpaSpecificationExecutor {
}

View File

@ -0,0 +1,20 @@
package co.yixiang.modules.activity.repository;
import co.yixiang.modules.activity.domain.YxStorePink;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @author hupeng
* @date 2019-11-18
*/
public interface YxStorePinkRepository extends JpaRepository<YxStorePink, Integer>, JpaSpecificationExecutor {
int countByCid(int cid);
int countByCidAndKId(int cid,int kid);
int countByKId(int kid);
YxStorePink findByOrderIdKey(int id);
}

View File

@ -0,0 +1,13 @@
package co.yixiang.modules.activity.repository;
import co.yixiang.modules.activity.domain.YxStoreVisit;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @author hupeng
* @date 2019-11-18
*/
public interface YxStoreVisitRepository extends JpaRepository<YxStoreVisit, Integer>, JpaSpecificationExecutor {
int countByProductIdAndProductType(int productId,String productType);
}

View File

@ -0,0 +1,12 @@
package co.yixiang.modules.activity.repository;
import co.yixiang.modules.activity.domain.YxUserExtract;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @author hupeng
* @date 2019-11-14
*/
public interface YxUserExtractRepository extends JpaRepository<YxUserExtract, Integer>, JpaSpecificationExecutor {
}

View File

@ -0,0 +1,90 @@
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;
import co.yixiang.modules.activity.service.YxStoreCombinationService;
import co.yixiang.modules.activity.service.dto.YxStoreCombinationQueryCriteria;
import co.yixiang.utils.OrderUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
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-11-18
*/
@Api(tags = "拼团管理")
@RestController
@RequestMapping("api")
public class YxStoreCombinationController {
@Autowired
private YxStoreCombinationService yxStoreCombinationService;
@Log("查询拼团")
@ApiOperation(value = "查询拼团")
@GetMapping(value = "/yxStoreCombination")
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECOMBINATION_ALL','YXSTORECOMBINATION_SELECT')")
public ResponseEntity getYxStoreCombinations(YxStoreCombinationQueryCriteria criteria, Pageable pageable){
return new ResponseEntity(yxStoreCombinationService.queryAll(criteria,pageable),HttpStatus.OK);
}
@Log("修改拼团")
@ApiOperation(value = "新增/修改拼团")
@PutMapping(value = "/yxStoreCombination")
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECOMBINATION_ALL','YXSTORECOMBINATION_EDIT')")
public ResponseEntity update(@Validated @RequestBody YxStoreCombination resources){
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
if(ObjectUtil.isNotNull(resources.getStartTimeDate())){
resources.setStartTime(OrderUtil.
dateToTimestamp(resources.getStartTimeDate()));
}
if(ObjectUtil.isNotNull(resources.getEndTimeDate())){
resources.setStopTime(OrderUtil.
dateToTimestamp(resources.getEndTimeDate()));
}
if(ObjectUtil.isNull(resources.getId())){
resources.setAddTime(String.valueOf(OrderUtil.getSecondTimestampTwo()));
return new ResponseEntity(yxStoreCombinationService.create(resources),HttpStatus.CREATED);
}else{
yxStoreCombinationService.update(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
}
@ApiOperation(value = "开启关闭")
@PostMapping(value = "/yxStoreCombination/onsale/{id}")
public ResponseEntity onSale(@PathVariable Integer id,@RequestBody String jsonStr){
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
JSONObject jsonObject = JSON.parseObject(jsonStr);
int status = Integer.valueOf(jsonObject.get("status").toString());
//System.out.println(status);
yxStoreCombinationService.onSale(id,status);
return new ResponseEntity(HttpStatus.OK);
}
@Log("删除拼团")
@ApiOperation(value = "删除拼团")
@DeleteMapping(value = "/yxStoreCombination/{id}")
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECOMBINATION_ALL','YXSTORECOMBINATION_DELETE')")
public ResponseEntity delete(@PathVariable Integer id){
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
YxStoreCombination combination = new YxStoreCombination();
combination.setIsDel(1);
yxStoreCombinationService.update(combination);
return new ResponseEntity(HttpStatus.OK);
}
}

View File

@ -0,0 +1,66 @@
package co.yixiang.modules.activity.rest;
import co.yixiang.aop.log.Log;
import co.yixiang.modules.activity.domain.YxStoreCoupon;
import co.yixiang.modules.activity.service.YxStoreCouponService;
import co.yixiang.modules.activity.service.dto.YxStoreCouponQueryCriteria;
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-11-09
*/
@Api(tags = "优惠券管理")
@RestController
@RequestMapping("api")
public class YxStoreCouponController {
@Autowired
private YxStoreCouponService yxStoreCouponService;
@Log("查询")
@ApiOperation(value = "查询")
@GetMapping(value = "/yxStoreCoupon")
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECOUPON_ALL','YXSTORECOUPON_SELECT')")
public ResponseEntity getYxStoreCoupons(YxStoreCouponQueryCriteria criteria, Pageable pageable){
return new ResponseEntity(yxStoreCouponService.queryAll(criteria,pageable),HttpStatus.OK);
}
@Log("新增")
@ApiOperation(value = "新增")
@PostMapping(value = "/yxStoreCoupon")
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECOUPON_ALL','YXSTORECOUPON_CREATE')")
public ResponseEntity create(@Validated @RequestBody YxStoreCoupon resources){
resources.setAddTime(OrderUtil.getSecondTimestampTwo());
return new ResponseEntity(yxStoreCouponService.create(resources),HttpStatus.CREATED);
}
@Log("修改")
@ApiOperation(value = "修改")
@PutMapping(value = "/yxStoreCoupon")
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECOUPON_ALL','YXSTORECOUPON_EDIT')")
public ResponseEntity update(@Validated @RequestBody YxStoreCoupon resources){
yxStoreCouponService.update(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
@Log("删除")
@ApiOperation(value = "删除")
@DeleteMapping(value = "/yxStoreCoupon/{id}")
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECOUPON_ALL','YXSTORECOUPON_DELETE')")
public ResponseEntity delete(@PathVariable Integer id){
YxStoreCoupon resources = new YxStoreCoupon();
resources.setId(id);
resources.setIsDel(1);
yxStoreCouponService.update(resources);
return new ResponseEntity(HttpStatus.OK);
}
}

View File

@ -0,0 +1,79 @@
package co.yixiang.modules.activity.rest;
import cn.hutool.core.util.ObjectUtil;
import co.yixiang.aop.log.Log;
import co.yixiang.modules.activity.domain.YxStoreCouponIssue;
import co.yixiang.modules.activity.service.YxStoreCouponIssueService;
import co.yixiang.modules.activity.service.dto.YxStoreCouponIssueQueryCriteria;
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-11-09
*/
@Api(tags = "发布管理")
@RestController
@RequestMapping("api")
public class YxStoreCouponIssueController {
@Autowired
private YxStoreCouponIssueService yxStoreCouponIssueService;
@Log("查询已发布")
@ApiOperation(value = "查询已发布")
@GetMapping(value = "/yxStoreCouponIssue")
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECOUPONISSUE_ALL','YXSTORECOUPONISSUE_SELECT')")
public ResponseEntity getYxStoreCouponIssues(YxStoreCouponIssueQueryCriteria criteria, Pageable pageable){
criteria.setIsDel(0);
return new ResponseEntity(yxStoreCouponIssueService.queryAll(criteria,pageable),HttpStatus.OK);
}
@Log("发布")
@ApiOperation(value = "发布")
@PostMapping(value = "/yxStoreCouponIssue")
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECOUPONISSUE_ALL','YXSTORECOUPONISSUE_CREATE')")
public ResponseEntity create(@Validated @RequestBody YxStoreCouponIssue resources){
if(ObjectUtil.isNotNull(resources.getStartTimeDate())){
resources.setStartTime(OrderUtil.
dateToTimestamp(resources.getStartTimeDate()));
}
if(ObjectUtil.isNotNull(resources.getEndTimeDate())){
resources.setEndTime(OrderUtil.
dateToTimestamp(resources.getEndTimeDate()));
}
if(resources.getTotalCount() > 0) {
resources.setRemainCount(resources.getTotalCount());
}
resources.setAddTime(OrderUtil.getSecondTimestampTwo());
return new ResponseEntity(yxStoreCouponIssueService.create(resources),HttpStatus.CREATED);
}
@Log("修改状态")
@ApiOperation(value = "修改状态")
@PutMapping(value = "/yxStoreCouponIssue")
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECOUPONISSUE_ALL','YXSTORECOUPONISSUE_EDIT')")
public ResponseEntity update(@Validated @RequestBody YxStoreCouponIssue resources){
yxStoreCouponIssueService.update(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
@Log("删除")
@ApiOperation(value = "删除")
@DeleteMapping(value = "/yxStoreCouponIssue/{id}")
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECOUPONISSUE_ALL','YXSTORECOUPONISSUE_DELETE')")
public ResponseEntity delete(@PathVariable Integer id){
YxStoreCouponIssue resources = new YxStoreCouponIssue();
resources.setId(id);
resources.setIsDel(1);
yxStoreCouponIssueService.update(resources);
return new ResponseEntity(HttpStatus.OK);
}
}

View File

@ -0,0 +1,61 @@
package co.yixiang.modules.activity.rest;
import co.yixiang.aop.log.Log;
import co.yixiang.modules.activity.domain.YxStoreCouponIssueUser;
import co.yixiang.modules.activity.service.YxStoreCouponIssueUserService;
import co.yixiang.modules.activity.service.dto.YxStoreCouponIssueUserQueryCriteria;
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-11-09
*/
@Api(tags = "YxStoreCouponIssueUser管理")
@RestController
@RequestMapping("api")
public class YxStoreCouponIssueUserController {
@Autowired
private YxStoreCouponIssueUserService yxStoreCouponIssueUserService;
@Log("查询YxStoreCouponIssueUser")
@ApiOperation(value = "查询YxStoreCouponIssueUser")
@GetMapping(value = "/yxStoreCouponIssueUser")
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECOUPONISSUEUSER_ALL','YXSTORECOUPONISSUEUSER_SELECT')")
public ResponseEntity getYxStoreCouponIssueUsers(YxStoreCouponIssueUserQueryCriteria criteria, Pageable pageable){
return new ResponseEntity(yxStoreCouponIssueUserService.queryAll(criteria,pageable),HttpStatus.OK);
}
@Log("新增YxStoreCouponIssueUser")
@ApiOperation(value = "新增YxStoreCouponIssueUser")
@PostMapping(value = "/yxStoreCouponIssueUser")
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECOUPONISSUEUSER_ALL','YXSTORECOUPONISSUEUSER_CREATE')")
public ResponseEntity create(@Validated @RequestBody YxStoreCouponIssueUser resources){
return new ResponseEntity(yxStoreCouponIssueUserService.create(resources),HttpStatus.CREATED);
}
@Log("修改YxStoreCouponIssueUser")
@ApiOperation(value = "修改YxStoreCouponIssueUser")
@PutMapping(value = "/yxStoreCouponIssueUser")
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECOUPONISSUEUSER_ALL','YXSTORECOUPONISSUEUSER_EDIT')")
public ResponseEntity update(@Validated @RequestBody YxStoreCouponIssueUser resources){
yxStoreCouponIssueUserService.update(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
@Log("删除YxStoreCouponIssueUser")
@ApiOperation(value = "删除YxStoreCouponIssueUser")
@DeleteMapping(value = "/yxStoreCouponIssueUser/{id}")
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECOUPONISSUEUSER_ALL','YXSTORECOUPONISSUEUSER_DELETE')")
public ResponseEntity delete(@PathVariable Integer id){
yxStoreCouponIssueUserService.delete(id);
return new ResponseEntity(HttpStatus.OK);
}
}

View File

@ -0,0 +1,61 @@
package co.yixiang.modules.activity.rest;
import co.yixiang.aop.log.Log;
import co.yixiang.modules.activity.domain.YxStoreCouponUser;
import co.yixiang.modules.activity.service.YxStoreCouponUserService;
import co.yixiang.modules.activity.service.dto.YxStoreCouponUserQueryCriteria;
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-11-10
*/
@Api(tags = "优惠券发放记录管理")
@RestController
@RequestMapping("api")
public class YxStoreCouponUserController {
@Autowired
private YxStoreCouponUserService yxStoreCouponUserService;
@Log("查询Y")
@ApiOperation(value = "查询")
@GetMapping(value = "/yxStoreCouponUser")
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECOUPONUSER_ALL','YXSTORECOUPONUSER_SELECT')")
public ResponseEntity getYxStoreCouponUsers(YxStoreCouponUserQueryCriteria criteria, Pageable pageable){
return new ResponseEntity(yxStoreCouponUserService.queryAll(criteria,pageable),HttpStatus.OK);
}
@Log("新增YxStoreCouponUser")
@ApiOperation(value = "新增YxStoreCouponUser")
@PostMapping(value = "/yxStoreCouponUser")
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECOUPONUSER_ALL','YXSTORECOUPONUSER_CREATE')")
public ResponseEntity create(@Validated @RequestBody YxStoreCouponUser resources){
return new ResponseEntity(yxStoreCouponUserService.create(resources),HttpStatus.CREATED);
}
@Log("修改YxStoreCouponUser")
@ApiOperation(value = "修改YxStoreCouponUser")
@PutMapping(value = "/yxStoreCouponUser")
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECOUPONUSER_ALL','YXSTORECOUPONUSER_EDIT')")
public ResponseEntity update(@Validated @RequestBody YxStoreCouponUser resources){
yxStoreCouponUserService.update(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
@Log("删除YxStoreCouponUser")
@ApiOperation(value = "删除YxStoreCouponUser")
@DeleteMapping(value = "/yxStoreCouponUser/{id}")
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECOUPONUSER_ALL','YXSTORECOUPONUSER_DELETE')")
public ResponseEntity delete(@PathVariable Integer id){
yxStoreCouponUserService.delete(id);
return new ResponseEntity(HttpStatus.OK);
}
}

View File

@ -0,0 +1,61 @@
package co.yixiang.modules.activity.rest;
import co.yixiang.aop.log.Log;
import co.yixiang.modules.activity.domain.YxStorePink;
import co.yixiang.modules.activity.service.YxStorePinkService;
import co.yixiang.modules.activity.service.dto.YxStorePinkQueryCriteria;
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-11-18
*/
@Api(tags = "拼团记录管理")
@RestController
@RequestMapping("api")
public class YxStorePinkController {
@Autowired
private YxStorePinkService yxStorePinkService;
@Log("查询记录")
@ApiOperation(value = "查询记录")
@GetMapping(value = "/yxStorePink")
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREPINK_ALL','YXSTOREPINK_SELECT')")
public ResponseEntity getYxStorePinks(YxStorePinkQueryCriteria criteria, Pageable pageable){
return new ResponseEntity(yxStorePinkService.queryAll(criteria,pageable),HttpStatus.OK);
}
@Log("新增YxStorePink")
@ApiOperation(value = "新增YxStorePink")
@PostMapping(value = "/yxStorePink")
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREPINK_ALL','YXSTOREPINK_CREATE')")
public ResponseEntity create(@Validated @RequestBody YxStorePink resources){
return new ResponseEntity(yxStorePinkService.create(resources),HttpStatus.CREATED);
}
@Log("修改YxStorePink")
@ApiOperation(value = "修改YxStorePink")
@PutMapping(value = "/yxStorePink")
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREPINK_ALL','YXSTOREPINK_EDIT')")
public ResponseEntity update(@Validated @RequestBody YxStorePink resources){
yxStorePinkService.update(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
@Log("删除YxStorePink")
@ApiOperation(value = "删除YxStorePink")
@DeleteMapping(value = "/yxStorePink/{id}")
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREPINK_ALL','YXSTOREPINK_DELETE')")
public ResponseEntity delete(@PathVariable Integer id){
yxStorePinkService.delete(id);
return new ResponseEntity(HttpStatus.OK);
}
}

View File

@ -0,0 +1,61 @@
package co.yixiang.modules.activity.rest;
import co.yixiang.aop.log.Log;
import co.yixiang.modules.activity.domain.YxStoreVisit;
import co.yixiang.modules.activity.service.YxStoreVisitService;
import co.yixiang.modules.activity.service.dto.YxStoreVisitQueryCriteria;
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-11-18
*/
@Api(tags = "YxStoreVisit管理")
@RestController
@RequestMapping("api")
public class YxStoreVisitController {
@Autowired
private YxStoreVisitService yxStoreVisitService;
@Log("查询YxStoreVisit")
@ApiOperation(value = "查询YxStoreVisit")
@GetMapping(value = "/yxStoreVisit")
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREVISIT_ALL','YXSTOREVISIT_SELECT')")
public ResponseEntity getYxStoreVisits(YxStoreVisitQueryCriteria criteria, Pageable pageable){
return new ResponseEntity(yxStoreVisitService.queryAll(criteria,pageable),HttpStatus.OK);
}
@Log("新增YxStoreVisit")
@ApiOperation(value = "新增YxStoreVisit")
@PostMapping(value = "/yxStoreVisit")
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREVISIT_ALL','YXSTOREVISIT_CREATE')")
public ResponseEntity create(@Validated @RequestBody YxStoreVisit resources){
return new ResponseEntity(yxStoreVisitService.create(resources),HttpStatus.CREATED);
}
@Log("修改YxStoreVisit")
@ApiOperation(value = "修改YxStoreVisit")
@PutMapping(value = "/yxStoreVisit")
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREVISIT_ALL','YXSTOREVISIT_EDIT')")
public ResponseEntity update(@Validated @RequestBody YxStoreVisit resources){
yxStoreVisitService.update(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
@Log("删除YxStoreVisit")
@ApiOperation(value = "删除YxStoreVisit")
@DeleteMapping(value = "/yxStoreVisit/{id}")
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREVISIT_ALL','YXSTOREVISIT_DELETE')")
public ResponseEntity delete(@PathVariable Integer id){
yxStoreVisitService.delete(id);
return new ResponseEntity(HttpStatus.OK);
}
}

View File

@ -0,0 +1,98 @@
package co.yixiang.modules.activity.rest;
import cn.hutool.core.util.NumberUtil;
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.YxUserExtract;
import co.yixiang.modules.activity.service.YxUserExtractService;
import co.yixiang.modules.activity.service.dto.YxUserExtractQueryCriteria;
import co.yixiang.modules.shop.domain.YxUserBill;
import co.yixiang.modules.shop.service.YxUserBillService;
import co.yixiang.modules.shop.service.YxUserService;
import co.yixiang.modules.shop.service.dto.YxUserDTO;
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-11-14
*/
@Api(tags = "YxUserExtract管理")
@RestController
@RequestMapping("api")
public class YxUserExtractController {
@Autowired
private YxUserExtractService yxUserExtractService;
@Autowired
private YxUserService yxUserService;
@Autowired
private YxUserBillService yxUserBillService;
@Log("查询YxUserExtract")
@ApiOperation(value = "查询YxUserExtract")
@GetMapping(value = "/yxUserExtract")
@PreAuthorize("hasAnyRole('ADMIN','YXUSEREXTRACT_ALL','YXUSEREXTRACT_SELECT')")
public ResponseEntity getYxUserExtracts(YxUserExtractQueryCriteria criteria, Pageable pageable){
return new ResponseEntity(yxUserExtractService.queryAll(criteria,pageable),HttpStatus.OK);
}
@Log("修改")
@ApiOperation(value = "修改")
@PutMapping(value = "/yxUserExtract")
@PreAuthorize("hasAnyRole('ADMIN','YXUSEREXTRACT_ALL','YXUSEREXTRACT_EDIT')")
public ResponseEntity update(@Validated @RequestBody YxUserExtract resources){
if(StrUtil.isEmpty(resources.getStatus().toString())){
throw new BadRequestException("请选择审核状态");
}
if(resources.getStatus() != -1 && resources.getStatus() != 1){
throw new BadRequestException("请选择审核状态");
}
if(resources.getStatus() == -1){
if(StrUtil.isEmpty(resources.getFailMsg())){
throw new BadRequestException("请填写失败原因");
}
String mark = "提现失败,退回佣金"+resources.getExtractPrice()+"";
YxUserDTO userDTO = yxUserService.findById(resources.getUid());
//增加流水
YxUserBill userBill = new YxUserBill();
userBill.setTitle("提现失败");
userBill.setUid(resources.getUid());
userBill.setCategory("now_money");
userBill.setType("extract");
userBill.setNumber(resources.getExtractPrice());
userBill.setLinkId(resources.getId().toString());
userBill.setBalance(NumberUtil.add(userDTO.getBrokeragePrice(),resources.getExtractPrice()));
userBill.setMark(mark);
userBill.setStatus(1);
userBill.setAddTime(OrderUtil.getSecondTimestampTwo());
userBill.setPm(1);
yxUserBillService.create(userBill);
//返回提现金额
yxUserService.incBrokeragePrice(resources.getExtractPrice().doubleValue()
,resources.getUid());
resources.setFailTime(OrderUtil.getSecondTimestampTwo());
}
yxUserExtractService.update(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
}

View File

@ -0,0 +1,68 @@
package co.yixiang.modules.activity.service;
import co.yixiang.modules.activity.domain.YxStoreCombination;
import co.yixiang.modules.activity.service.dto.YxStoreCombinationDTO;
import co.yixiang.modules.activity.service.dto.YxStoreCombinationQueryCriteria;
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-11-18
*/
//@CacheConfig(cacheNames = "yxStoreCombination")
public interface YxStoreCombinationService {
void onSale(Integer id, Integer status);
/**
* 查询数据分页
* @param criteria
* @param pageable
* @return
*/
//@Cacheable
Map<String,Object> queryAll(YxStoreCombinationQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria
* @return
*/
//@Cacheable
List<YxStoreCombinationDTO> queryAll(YxStoreCombinationQueryCriteria criteria);
/**
* 根据ID查询
* @param id
* @return
*/
//@Cacheable(key = "#p0")
YxStoreCombinationDTO findById(Integer id);
/**
* 创建
* @param resources
* @return
*/
//@CacheEvict(allEntries = true)
YxStoreCombinationDTO create(YxStoreCombination resources);
/**
* 编辑
* @param resources
*/
//@CacheEvict(allEntries = true)
void update(YxStoreCombination resources);
/**
* 删除
* @param id
*/
//@CacheEvict(allEntries = true)
void delete(Integer id);
}

View File

@ -0,0 +1,66 @@
package co.yixiang.modules.activity.service;
import co.yixiang.modules.activity.domain.YxStoreCouponIssue;
import co.yixiang.modules.activity.service.dto.YxStoreCouponIssueDTO;
import co.yixiang.modules.activity.service.dto.YxStoreCouponIssueQueryCriteria;
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-11-09
*/
//@CacheConfig(cacheNames = "yxStoreCouponIssue")
public interface YxStoreCouponIssueService {
/**
* 查询数据分页
* @param criteria
* @param pageable
* @return
*/
//@Cacheable
Map<String,Object> queryAll(YxStoreCouponIssueQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria
* @return
*/
//@Cacheable
List<YxStoreCouponIssueDTO> queryAll(YxStoreCouponIssueQueryCriteria criteria);
/**
* 根据ID查询
* @param id
* @return
*/
//@Cacheable(key = "#p0")
YxStoreCouponIssueDTO findById(Integer id);
/**
* 创建
* @param resources
* @return
*/
//@CacheEvict(allEntries = true)
YxStoreCouponIssueDTO create(YxStoreCouponIssue resources);
/**
* 编辑
* @param resources
*/
//@CacheEvict(allEntries = true)
void update(YxStoreCouponIssue resources);
/**
* 删除
* @param id
*/
//@CacheEvict(allEntries = true)
void delete(Integer id);
}

View File

@ -0,0 +1,66 @@
package co.yixiang.modules.activity.service;
import co.yixiang.modules.activity.domain.YxStoreCouponIssueUser;
import co.yixiang.modules.activity.service.dto.YxStoreCouponIssueUserDTO;
import co.yixiang.modules.activity.service.dto.YxStoreCouponIssueUserQueryCriteria;
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-11-09
*/
//@CacheConfig(cacheNames = "yxStoreCouponIssueUser")
public interface YxStoreCouponIssueUserService {
/**
* 查询数据分页
* @param criteria
* @param pageable
* @return
*/
//@Cacheable
Map<String,Object> queryAll(YxStoreCouponIssueUserQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria
* @return
*/
//@Cacheable
List<YxStoreCouponIssueUserDTO> queryAll(YxStoreCouponIssueUserQueryCriteria criteria);
/**
* 根据ID查询
* @param id
* @return
*/
//@Cacheable(key = "#p0")
YxStoreCouponIssueUserDTO findById(Integer id);
/**
* 创建
* @param resources
* @return
*/
//@CacheEvict(allEntries = true)
YxStoreCouponIssueUserDTO create(YxStoreCouponIssueUser resources);
/**
* 编辑
* @param resources
*/
//@CacheEvict(allEntries = true)
void update(YxStoreCouponIssueUser resources);
/**
* 删除
* @param id
*/
//@CacheEvict(allEntries = true)
void delete(Integer id);
}

View File

@ -0,0 +1,66 @@
package co.yixiang.modules.activity.service;
import co.yixiang.modules.activity.domain.YxStoreCoupon;
import co.yixiang.modules.activity.service.dto.YxStoreCouponDTO;
import co.yixiang.modules.activity.service.dto.YxStoreCouponQueryCriteria;
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-11-09
*/
//@CacheConfig(cacheNames = "yxStoreCoupon")
public interface YxStoreCouponService {
/**
* 查询数据分页
* @param criteria
* @param pageable
* @return
*/
//@Cacheable
Map<String,Object> queryAll(YxStoreCouponQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria
* @return
*/
//@Cacheable
List<YxStoreCouponDTO> queryAll(YxStoreCouponQueryCriteria criteria);
/**
* 根据ID查询
* @param id
* @return
*/
//@Cacheable(key = "#p0")
YxStoreCouponDTO findById(Integer id);
/**
* 创建
* @param resources
* @return
*/
//@CacheEvict(allEntries = true)
YxStoreCouponDTO create(YxStoreCoupon resources);
/**
* 编辑
* @param resources
*/
//@CacheEvict(allEntries = true)
void update(YxStoreCoupon resources);
/**
* 删除
* @param id
*/
//@CacheEvict(allEntries = true)
void delete(Integer id);
}

View File

@ -0,0 +1,66 @@
package co.yixiang.modules.activity.service;
import co.yixiang.modules.activity.domain.YxStoreCouponUser;
import co.yixiang.modules.activity.service.dto.YxStoreCouponUserDTO;
import co.yixiang.modules.activity.service.dto.YxStoreCouponUserQueryCriteria;
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-11-10
*/
//@CacheConfig(cacheNames = "yxStoreCouponUser")
public interface YxStoreCouponUserService {
/**
* 查询数据分页
* @param criteria
* @param pageable
* @return
*/
//@Cacheable
Map<String,Object> queryAll(YxStoreCouponUserQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria
* @return
*/
//@Cacheable
List<YxStoreCouponUserDTO> queryAll(YxStoreCouponUserQueryCriteria criteria);
/**
* 根据ID查询
* @param id
* @return
*/
//@Cacheable(key = "#p0")
YxStoreCouponUserDTO findById(Integer id);
/**
* 创建
* @param resources
* @return
*/
//@CacheEvict(allEntries = true)
YxStoreCouponUserDTO create(YxStoreCouponUser resources);
/**
* 编辑
* @param resources
*/
//@CacheEvict(allEntries = true)
void update(YxStoreCouponUser resources);
/**
* 删除
* @param id
*/
//@CacheEvict(allEntries = true)
void delete(Integer id);
}

View File

@ -0,0 +1,68 @@
package co.yixiang.modules.activity.service;
import co.yixiang.modules.activity.domain.YxStorePink;
import co.yixiang.modules.activity.service.dto.YxStorePinkDTO;
import co.yixiang.modules.activity.service.dto.YxStorePinkQueryCriteria;
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-11-18
*/
//@CacheConfig(cacheNames = "yxStorePink")
public interface YxStorePinkService {
int countPeople(int id);
/**
* 查询数据分页
* @param criteria
* @param pageable
* @return
*/
//@Cacheable
Map<String,Object> queryAll(YxStorePinkQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria
* @return
*/
//@Cacheable
List<YxStorePinkDTO> queryAll(YxStorePinkQueryCriteria criteria);
/**
* 根据ID查询
* @param id
* @return
*/
//@Cacheable(key = "#p0")
YxStorePinkDTO findById(Integer id);
/**
* 创建
* @param resources
* @return
*/
//@CacheEvict(allEntries = true)
YxStorePinkDTO create(YxStorePink resources);
/**
* 编辑
* @param resources
*/
//@CacheEvict(allEntries = true)
void update(YxStorePink resources);
/**
* 删除
* @param id
*/
//@CacheEvict(allEntries = true)
void delete(Integer id);
}

View File

@ -0,0 +1,66 @@
package co.yixiang.modules.activity.service;
import co.yixiang.modules.activity.domain.YxStoreVisit;
import co.yixiang.modules.activity.service.dto.YxStoreVisitDTO;
import co.yixiang.modules.activity.service.dto.YxStoreVisitQueryCriteria;
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-11-18
*/
//@CacheConfig(cacheNames = "yxStoreVisit")
public interface YxStoreVisitService {
/**
* 查询数据分页
* @param criteria
* @param pageable
* @return
*/
//@Cacheable
Map<String,Object> queryAll(YxStoreVisitQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria
* @return
*/
//@Cacheable
List<YxStoreVisitDTO> queryAll(YxStoreVisitQueryCriteria criteria);
/**
* 根据ID查询
* @param id
* @return
*/
//@Cacheable(key = "#p0")
YxStoreVisitDTO findById(Integer id);
/**
* 创建
* @param resources
* @return
*/
//@CacheEvict(allEntries = true)
YxStoreVisitDTO create(YxStoreVisit resources);
/**
* 编辑
* @param resources
*/
//@CacheEvict(allEntries = true)
void update(YxStoreVisit resources);
/**
* 删除
* @param id
*/
//@CacheEvict(allEntries = true)
void delete(Integer id);
}

View File

@ -0,0 +1,66 @@
package co.yixiang.modules.activity.service;
import co.yixiang.modules.activity.domain.YxUserExtract;
import co.yixiang.modules.activity.service.dto.YxUserExtractDTO;
import co.yixiang.modules.activity.service.dto.YxUserExtractQueryCriteria;
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-11-14
*/
//@CacheConfig(cacheNames = "yxUserExtract")
public interface YxUserExtractService {
/**
* 查询数据分页
* @param criteria
* @param pageable
* @return
*/
//@Cacheable
Map<String,Object> queryAll(YxUserExtractQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria
* @return
*/
//@Cacheable
List<YxUserExtractDTO> queryAll(YxUserExtractQueryCriteria criteria);
/**
* 根据ID查询
* @param id
* @return
*/
//@Cacheable(key = "#p0")
YxUserExtractDTO findById(Integer id);
/**
* 创建
* @param resources
* @return
*/
//@CacheEvict(allEntries = true)
YxUserExtractDTO create(YxUserExtract resources);
/**
* 编辑
* @param resources
*/
//@CacheEvict(allEntries = true)
void update(YxUserExtract resources);
/**
* 删除
* @param id
*/
//@CacheEvict(allEntries = true)
void delete(Integer id);
}

View File

@ -0,0 +1,113 @@
package co.yixiang.modules.activity.service.dto;
import lombok.Data;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.io.Serializable;
import java.util.Date;
/**
* @author hupeng
* @date 2019-11-18
*/
@Data
public class YxStoreCombinationDTO implements Serializable {
private Integer id;
// 商品id
private Integer productId;
// 商户id
private Integer merId;
// 推荐图
private String image;
// 轮播图
private String images;
//参与人数
private Integer countPeopleAll;
//成团人数
private Integer countPeoplePink;
//访问人数
private Integer countPeopleBrowse;
// 活动标题
private String title;
// 活动属性
private String attr;
// 参团人数
private Integer people;
// 简介
private String info;
// 价格
private BigDecimal price;
// 排序
private Integer sort;
// 销量
private Integer sales;
// 库存
private Integer stock;
// 添加时间
private String addTime;
// 推荐
private Integer isHost;
// 产品状态
private Integer isShow;
private Integer isDel;
private Integer combination;
// 商户是否可用1可用0不可用
private Integer merUse;
// 是否包邮1是0否
private Integer isPostage;
// 邮费
private BigDecimal postage;
// 拼团内容
private String description;
// 拼团开始时间
private Integer startTime;
// 拼团结束时间
private Integer stopTime;
private Date startTimeDate;
private Date endTimeDate;
// 拼团订单有效时间
private Integer effectiveTime;
// 拼图产品成本
private Integer cost;
// 浏览量
private Integer browse;
// 单位名
private String unitName;
}

View File

@ -0,0 +1,20 @@
package co.yixiang.modules.activity.service.dto;
import lombok.Data;
import java.math.BigDecimal;
import co.yixiang.annotation.Query;
/**
* @author hupeng
* @date 2019-11-18
*/
@Data
public class YxStoreCombinationQueryCriteria{
// 模糊
@Query(type = Query.Type.INNER_LIKE)
private String title;
@Query
private Integer isDel;
}

View File

@ -0,0 +1,44 @@
package co.yixiang.modules.activity.service.dto;
import lombok.Data;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @author hupeng
* @date 2019-11-09
*/
@Data
public class YxStoreCouponDTO implements Serializable {
// 优惠券表ID
private Integer id;
// 优惠券名称
private String title;
// 兑换消耗积分值
private Integer integral;
// 兑换的优惠券面值
private BigDecimal couponPrice;
// 最低消费多少金额可用优惠券
private BigDecimal useMinPrice;
// 优惠券有效期限(单位:天)
private Integer couponTime;
// 排序
private Integer sort;
// 状态0关闭1开启
private Integer status;
// 兑换项目添加时间
private Integer addTime;
// 是否删除
private Integer isDel;
}

View File

@ -0,0 +1,43 @@
package co.yixiang.modules.activity.service.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @author hupeng
* @date 2019-11-09
*/
@Data
public class YxStoreCouponIssueDTO implements Serializable {
private Integer id;
// 优惠券ID
private Integer cid;
private String cname;
// 优惠券领取开启时间
private Integer startTime;
// 优惠券领取结束时间
private Integer endTime;
// 优惠券领取数量
private Integer totalCount;
// 优惠券剩余领取数量
private Integer remainCount;
// 是否无限张数
private Integer isPermanent;
// 1 正常 0 未开启 -1 已无效
private Integer status;
private Integer isDel;
// 优惠券添加时间
private Integer addTime;
}

View File

@ -0,0 +1,14 @@
package co.yixiang.modules.activity.service.dto;
import lombok.Data;
import co.yixiang.annotation.Query;
/**
* @author hupeng
* @date 2019-11-09
*/
@Data
public class YxStoreCouponIssueQueryCriteria{
@Query
private Integer isDel;
}

View File

@ -0,0 +1,24 @@
package co.yixiang.modules.activity.service.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @author hupeng
* @date 2019-11-09
*/
@Data
public class YxStoreCouponIssueUserDTO implements Serializable {
private Integer id;
// 领取优惠券用户ID
private Integer uid;
// 优惠券前台领取ID
private Integer issueCouponId;
// 领取时间
private Integer addTime;
}

View File

@ -0,0 +1,12 @@
package co.yixiang.modules.activity.service.dto;
import lombok.Data;
import co.yixiang.annotation.Query;
/**
* @author hupeng
* @date 2019-11-09
*/
@Data
public class YxStoreCouponIssueUserQueryCriteria{
}

View File

@ -0,0 +1,15 @@
package co.yixiang.modules.activity.service.dto;
import lombok.Data;
import java.math.BigDecimal;
import co.yixiang.annotation.Query;
/**
* @author hupeng
* @date 2019-11-09
*/
@Data
public class YxStoreCouponQueryCriteria{
@Query
private Integer isDel;
}

View File

@ -0,0 +1,52 @@
package co.yixiang.modules.activity.service.dto;
import lombok.Data;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @author hupeng
* @date 2019-11-10
*/
@Data
public class YxStoreCouponUserDTO implements Serializable {
// 优惠券发放记录id
private Integer id;
// 兑换的项目id
private Integer cid;
// 优惠券所属用户
private Integer uid;
private String nickname;
// 优惠券名称
private String couponTitle;
// 优惠券的面值
private BigDecimal couponPrice;
// 最低消费多少金额可用优惠券
private BigDecimal useMinPrice;
// 优惠券创建时间
private Integer addTime;
// 优惠券结束时间
private Integer endTime;
// 使用时间
private Integer useTime;
// 获取方式
private String type;
// 状态0未使用1已使用, 2:已过期)
private Integer status;
// 是否有效
private Integer isFail;
}

View File

@ -0,0 +1,17 @@
package co.yixiang.modules.activity.service.dto;
import lombok.Data;
import java.math.BigDecimal;
import co.yixiang.annotation.Query;
/**
* @author hupeng
* @date 2019-11-10
*/
@Data
public class YxStoreCouponUserQueryCriteria{
// 模糊
@Query(type = Query.Type.INNER_LIKE)
private String couponTitle;
}

View File

@ -0,0 +1,68 @@
package co.yixiang.modules.activity.service.dto;
import lombok.Data;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @author hupeng
* @date 2019-11-18
*/
@Data
public class YxStorePinkDTO implements Serializable {
private Integer id;
// 用户id
private Integer uid;
// 订单id 生成
private String orderId;
// 订单id 数据库
private Integer orderIdKey;
private String title;
private String nickname;
private String avatar;
private Integer countPeople;
// 购买商品个数
private Integer totalNum;
// 购买总金额
private BigDecimal totalPrice;
// 拼团产品id
private Integer cid;
// 产品id
private Integer pid;
// 拼图总人数
private Integer people;
// 拼团产品单价
private BigDecimal price;
// 开始时间
private String addTime;
private String stopTime;
// 团长id 0为团长
private Integer kId;
// 是否发送模板消息0未发送1已发送
private Integer isTpl;
// 是否退款 0未退款 1已退款
private Integer isRefund;
// 状态1进行中2已完成3未完成
private Integer status;
}

View File

@ -0,0 +1,15 @@
package co.yixiang.modules.activity.service.dto;
import lombok.Data;
import java.math.BigDecimal;
import co.yixiang.annotation.Query;
/**
* @author hupeng
* @date 2019-11-18
*/
@Data
public class YxStorePinkQueryCriteria{
@Query
private Integer kId;
}

View File

@ -0,0 +1,39 @@
package co.yixiang.modules.activity.service.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @author hupeng
* @date 2019-11-18
*/
@Data
public class YxStoreVisitDTO implements Serializable {
private Integer id;
// 产品ID
private Integer productId;
// 产品类型
private String productType;
// 产品分类ID
private Integer cateId;
// 产品类型
private String type;
// 用户ID
private Integer uid;
// 访问次数
private Integer count;
// 备注描述
private String content;
// 添加时间
private Integer addTime;
}

View File

@ -0,0 +1,12 @@
package co.yixiang.modules.activity.service.dto;
import lombok.Data;
import co.yixiang.annotation.Query;
/**
* @author hupeng
* @date 2019-11-18
*/
@Data
public class YxStoreVisitQueryCriteria{
}

View File

@ -0,0 +1,54 @@
package co.yixiang.modules.activity.service.dto;
import lombok.Data;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @author hupeng
* @date 2019-11-14
*/
@Data
public class YxUserExtractDTO implements Serializable {
private Integer id;
private Integer uid;
// 名称
private String realName;
// bank = 银行卡 alipay = 支付宝wx=微信
private String extractType;
// 银行卡
private String bankCode;
// 开户地址
private String bankAddress;
// 支付宝账号
private String alipayCode;
// 提现金额
private BigDecimal extractPrice;
private String mark;
private BigDecimal balance;
// 无效原因
private String failMsg;
private Integer failTime;
// 添加时间
private Integer addTime;
// -1 未通过 0 审核中 1 已提现
private Integer status;
// 微信号
private String wechat;
}

View File

@ -0,0 +1,17 @@
package co.yixiang.modules.activity.service.dto;
import lombok.Data;
import java.math.BigDecimal;
import co.yixiang.annotation.Query;
/**
* @author hupeng
* @date 2019-11-14
*/
@Data
public class YxUserExtractQueryCriteria{
// 模糊
@Query(type = Query.Type.INNER_LIKE)
private String realName;
}

View File

@ -0,0 +1,121 @@
package co.yixiang.modules.activity.service.impl;
import co.yixiang.modules.activity.domain.YxStoreCombination;
import co.yixiang.modules.activity.repository.YxStorePinkRepository;
import co.yixiang.modules.activity.repository.YxStoreVisitRepository;
import co.yixiang.utils.ValidationUtil;
import co.yixiang.modules.activity.repository.YxStoreCombinationRepository;
import co.yixiang.modules.activity.service.YxStoreCombinationService;
import co.yixiang.modules.activity.service.dto.YxStoreCombinationDTO;
import co.yixiang.modules.activity.service.dto.YxStoreCombinationQueryCriteria;
import co.yixiang.modules.activity.service.mapper.YxStoreCombinationMapper;
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-11-18
*/
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class YxStoreCombinationServiceImpl implements YxStoreCombinationService {
@Autowired
private YxStoreCombinationRepository yxStoreCombinationRepository;
@Autowired
private YxStorePinkRepository storePinkRepository;
@Autowired
private YxStoreVisitRepository storeVisitRepository;
@Autowired
private YxStoreCombinationMapper yxStoreCombinationMapper;
@Override
public Map<String,Object> queryAll(YxStoreCombinationQueryCriteria criteria, Pageable pageable){
criteria.setIsDel(0);
Page<YxStoreCombination> page = yxStoreCombinationRepository
.findAll((root, criteriaQuery, criteriaBuilder)
-> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
List<YxStoreCombinationDTO> combinationDTOS = yxStoreCombinationMapper
.toDto(page.getContent());
for (YxStoreCombinationDTO combinationDTO : combinationDTOS) {
//参与人数
combinationDTO.setCountPeopleAll(storePinkRepository
.countByCid(combinationDTO.getId()));
//成团人数
combinationDTO.setCountPeoplePink(storePinkRepository.countByCidAndKId(combinationDTO.getId(),
0));
//获取查看拼团产品人数
combinationDTO.setCountPeopleBrowse(storeVisitRepository
.countByProductIdAndProductType(combinationDTO.getId(),"combination"));
//System.out.println(combinationDTO);
}
Map<String,Object> map = new LinkedHashMap<>(2);
map.put("content",combinationDTOS);
map.put("totalElements",page.getTotalElements());
return map;
//return PageUtil.toPage(page.map(yxStoreCombinationMapper::toDto));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void onSale(Integer id, Integer status) {
if(status == 1){
status = 0;
}else{
status = 1;
}
yxStoreCombinationRepository.updateOnsale(status,id);
}
@Override
public List<YxStoreCombinationDTO> queryAll(YxStoreCombinationQueryCriteria criteria){
return yxStoreCombinationMapper.toDto(yxStoreCombinationRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
public YxStoreCombinationDTO findById(Integer id) {
Optional<YxStoreCombination> yxStoreCombination = yxStoreCombinationRepository.findById(id);
ValidationUtil.isNull(yxStoreCombination,"YxStoreCombination","id",id);
return yxStoreCombinationMapper.toDto(yxStoreCombination.get());
}
@Override
@Transactional(rollbackFor = Exception.class)
public YxStoreCombinationDTO create(YxStoreCombination resources) {
return yxStoreCombinationMapper.toDto(yxStoreCombinationRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(YxStoreCombination resources) {
Optional<YxStoreCombination> optionalYxStoreCombination = yxStoreCombinationRepository.findById(resources.getId());
ValidationUtil.isNull( optionalYxStoreCombination,"YxStoreCombination","id",resources.getId());
YxStoreCombination yxStoreCombination = optionalYxStoreCombination.get();
yxStoreCombination.copy(resources);
yxStoreCombinationRepository.save(yxStoreCombination);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(Integer id) {
yxStoreCombinationRepository.deleteById(id);
}
}

View File

@ -0,0 +1,75 @@
package co.yixiang.modules.activity.service.impl;
import co.yixiang.modules.activity.domain.YxStoreCouponIssue;
import co.yixiang.utils.ValidationUtil;
import co.yixiang.modules.activity.repository.YxStoreCouponIssueRepository;
import co.yixiang.modules.activity.service.YxStoreCouponIssueService;
import co.yixiang.modules.activity.service.dto.YxStoreCouponIssueDTO;
import co.yixiang.modules.activity.service.dto.YxStoreCouponIssueQueryCriteria;
import co.yixiang.modules.activity.service.mapper.YxStoreCouponIssueMapper;
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-11-09
*/
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class YxStoreCouponIssueServiceImpl implements YxStoreCouponIssueService {
@Autowired
private YxStoreCouponIssueRepository yxStoreCouponIssueRepository;
@Autowired
private YxStoreCouponIssueMapper yxStoreCouponIssueMapper;
@Override
public Map<String,Object> queryAll(YxStoreCouponIssueQueryCriteria criteria, Pageable pageable){
Page<YxStoreCouponIssue> page = yxStoreCouponIssueRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(yxStoreCouponIssueMapper::toDto));
}
@Override
public List<YxStoreCouponIssueDTO> queryAll(YxStoreCouponIssueQueryCriteria criteria){
return yxStoreCouponIssueMapper.toDto(yxStoreCouponIssueRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
public YxStoreCouponIssueDTO findById(Integer id) {
Optional<YxStoreCouponIssue> yxStoreCouponIssue = yxStoreCouponIssueRepository.findById(id);
ValidationUtil.isNull(yxStoreCouponIssue,"YxStoreCouponIssue","id",id);
return yxStoreCouponIssueMapper.toDto(yxStoreCouponIssue.get());
}
@Override
@Transactional(rollbackFor = Exception.class)
public YxStoreCouponIssueDTO create(YxStoreCouponIssue resources) {
return yxStoreCouponIssueMapper.toDto(yxStoreCouponIssueRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(YxStoreCouponIssue resources) {
Optional<YxStoreCouponIssue> optionalYxStoreCouponIssue = yxStoreCouponIssueRepository.findById(resources.getId());
ValidationUtil.isNull( optionalYxStoreCouponIssue,"YxStoreCouponIssue","id",resources.getId());
YxStoreCouponIssue yxStoreCouponIssue = optionalYxStoreCouponIssue.get();
yxStoreCouponIssue.copy(resources);
yxStoreCouponIssueRepository.save(yxStoreCouponIssue);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(Integer id) {
yxStoreCouponIssueRepository.deleteById(id);
}
}

View File

@ -0,0 +1,75 @@
package co.yixiang.modules.activity.service.impl;
import co.yixiang.modules.activity.domain.YxStoreCouponIssueUser;
import co.yixiang.utils.ValidationUtil;
import co.yixiang.modules.activity.repository.YxStoreCouponIssueUserRepository;
import co.yixiang.modules.activity.service.YxStoreCouponIssueUserService;
import co.yixiang.modules.activity.service.dto.YxStoreCouponIssueUserDTO;
import co.yixiang.modules.activity.service.dto.YxStoreCouponIssueUserQueryCriteria;
import co.yixiang.modules.activity.service.mapper.YxStoreCouponIssueUserMapper;
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-11-09
*/
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class YxStoreCouponIssueUserServiceImpl implements YxStoreCouponIssueUserService {
@Autowired
private YxStoreCouponIssueUserRepository yxStoreCouponIssueUserRepository;
@Autowired
private YxStoreCouponIssueUserMapper yxStoreCouponIssueUserMapper;
@Override
public Map<String,Object> queryAll(YxStoreCouponIssueUserQueryCriteria criteria, Pageable pageable){
Page<YxStoreCouponIssueUser> page = yxStoreCouponIssueUserRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(yxStoreCouponIssueUserMapper::toDto));
}
@Override
public List<YxStoreCouponIssueUserDTO> queryAll(YxStoreCouponIssueUserQueryCriteria criteria){
return yxStoreCouponIssueUserMapper.toDto(yxStoreCouponIssueUserRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
public YxStoreCouponIssueUserDTO findById(Integer id) {
Optional<YxStoreCouponIssueUser> yxStoreCouponIssueUser = yxStoreCouponIssueUserRepository.findById(id);
ValidationUtil.isNull(yxStoreCouponIssueUser,"YxStoreCouponIssueUser","id",id);
return yxStoreCouponIssueUserMapper.toDto(yxStoreCouponIssueUser.get());
}
@Override
@Transactional(rollbackFor = Exception.class)
public YxStoreCouponIssueUserDTO create(YxStoreCouponIssueUser resources) {
return yxStoreCouponIssueUserMapper.toDto(yxStoreCouponIssueUserRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(YxStoreCouponIssueUser resources) {
Optional<YxStoreCouponIssueUser> optionalYxStoreCouponIssueUser = yxStoreCouponIssueUserRepository.findById(resources.getId());
ValidationUtil.isNull( optionalYxStoreCouponIssueUser,"YxStoreCouponIssueUser","id",resources.getId());
YxStoreCouponIssueUser yxStoreCouponIssueUser = optionalYxStoreCouponIssueUser.get();
yxStoreCouponIssueUser.copy(resources);
yxStoreCouponIssueUserRepository.save(yxStoreCouponIssueUser);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(Integer id) {
yxStoreCouponIssueUserRepository.deleteById(id);
}
}

View File

@ -0,0 +1,75 @@
package co.yixiang.modules.activity.service.impl;
import co.yixiang.modules.activity.domain.YxStoreCoupon;
import co.yixiang.utils.ValidationUtil;
import co.yixiang.modules.activity.repository.YxStoreCouponRepository;
import co.yixiang.modules.activity.service.YxStoreCouponService;
import co.yixiang.modules.activity.service.dto.YxStoreCouponDTO;
import co.yixiang.modules.activity.service.dto.YxStoreCouponQueryCriteria;
import co.yixiang.modules.activity.service.mapper.YxStoreCouponMapper;
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-11-09
*/
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class YxStoreCouponServiceImpl implements YxStoreCouponService {
@Autowired
private YxStoreCouponRepository yxStoreCouponRepository;
@Autowired
private YxStoreCouponMapper yxStoreCouponMapper;
@Override
public Map<String,Object> queryAll(YxStoreCouponQueryCriteria criteria, Pageable pageable){
Page<YxStoreCoupon> page = yxStoreCouponRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(yxStoreCouponMapper::toDto));
}
@Override
public List<YxStoreCouponDTO> queryAll(YxStoreCouponQueryCriteria criteria){
return yxStoreCouponMapper.toDto(yxStoreCouponRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
public YxStoreCouponDTO findById(Integer id) {
Optional<YxStoreCoupon> yxStoreCoupon = yxStoreCouponRepository.findById(id);
ValidationUtil.isNull(yxStoreCoupon,"YxStoreCoupon","id",id);
return yxStoreCouponMapper.toDto(yxStoreCoupon.get());
}
@Override
@Transactional(rollbackFor = Exception.class)
public YxStoreCouponDTO create(YxStoreCoupon resources) {
return yxStoreCouponMapper.toDto(yxStoreCouponRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(YxStoreCoupon resources) {
Optional<YxStoreCoupon> optionalYxStoreCoupon = yxStoreCouponRepository.findById(resources.getId());
ValidationUtil.isNull( optionalYxStoreCoupon,"YxStoreCoupon","id",resources.getId());
YxStoreCoupon yxStoreCoupon = optionalYxStoreCoupon.get();
yxStoreCoupon.copy(resources);
yxStoreCouponRepository.save(yxStoreCoupon);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(Integer id) {
yxStoreCouponRepository.deleteById(id);
}
}

View File

@ -0,0 +1,92 @@
package co.yixiang.modules.activity.service.impl;
import co.yixiang.modules.activity.domain.YxStoreCouponUser;
import co.yixiang.modules.shop.service.YxUserService;
import co.yixiang.utils.ValidationUtil;
import co.yixiang.modules.activity.repository.YxStoreCouponUserRepository;
import co.yixiang.modules.activity.service.YxStoreCouponUserService;
import co.yixiang.modules.activity.service.dto.YxStoreCouponUserDTO;
import co.yixiang.modules.activity.service.dto.YxStoreCouponUserQueryCriteria;
import co.yixiang.modules.activity.service.mapper.YxStoreCouponUserMapper;
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.*;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import co.yixiang.utils.PageUtil;
import co.yixiang.utils.QueryHelp;
/**
* @author hupeng
* @date 2019-11-10
*/
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class YxStoreCouponUserServiceImpl implements YxStoreCouponUserService {
@Autowired
private YxStoreCouponUserRepository yxStoreCouponUserRepository;
@Autowired
private YxStoreCouponUserMapper yxStoreCouponUserMapper;
@Autowired
private YxUserService userService;
@Override
public Map<String,Object> queryAll(YxStoreCouponUserQueryCriteria criteria, Pageable pageable){
Page<YxStoreCouponUser> page = yxStoreCouponUserRepository.
findAll((root, criteriaQuery, criteriaBuilder)
-> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
//List<YxStoreCouponUserDTO> storeOrderDTOS = new ArrayList<>();
List<YxStoreCouponUserDTO> storeOrderDTOS = yxStoreCouponUserMapper
.toDto(page.getContent());
for (YxStoreCouponUserDTO couponUserDTO : storeOrderDTOS) {
couponUserDTO.setNickname(userService.findById(couponUserDTO.getUid()).getNickname());
}
Map<String,Object> map = new LinkedHashMap<>(2);
map.put("content",storeOrderDTOS);
map.put("totalElements",page.getTotalElements());
return map;
//return PageUtil.toPage(page.map(yxStoreCouponUserMapper::toDto));
}
@Override
public List<YxStoreCouponUserDTO> queryAll(YxStoreCouponUserQueryCriteria criteria){
return yxStoreCouponUserMapper.toDto(yxStoreCouponUserRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
public YxStoreCouponUserDTO findById(Integer id) {
Optional<YxStoreCouponUser> yxStoreCouponUser = yxStoreCouponUserRepository.findById(id);
ValidationUtil.isNull(yxStoreCouponUser,"YxStoreCouponUser","id",id);
return yxStoreCouponUserMapper.toDto(yxStoreCouponUser.get());
}
@Override
@Transactional(rollbackFor = Exception.class)
public YxStoreCouponUserDTO create(YxStoreCouponUser resources) {
return yxStoreCouponUserMapper.toDto(yxStoreCouponUserRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(YxStoreCouponUser resources) {
Optional<YxStoreCouponUser> optionalYxStoreCouponUser = yxStoreCouponUserRepository.findById(resources.getId());
ValidationUtil.isNull( optionalYxStoreCouponUser,"YxStoreCouponUser","id",resources.getId());
YxStoreCouponUser yxStoreCouponUser = optionalYxStoreCouponUser.get();
yxStoreCouponUser.copy(resources);
yxStoreCouponUserRepository.save(yxStoreCouponUser);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(Integer id) {
yxStoreCouponUserRepository.deleteById(id);
}
}

View File

@ -0,0 +1,115 @@
package co.yixiang.modules.activity.service.impl;
import co.yixiang.modules.activity.domain.YxStorePink;
import co.yixiang.modules.activity.service.YxStoreCombinationService;
import co.yixiang.modules.activity.service.dto.YxStoreCombinationDTO;
import co.yixiang.modules.shop.service.YxUserService;
import co.yixiang.modules.shop.service.dto.YxUserDTO;
import co.yixiang.utils.ValidationUtil;
import co.yixiang.modules.activity.repository.YxStorePinkRepository;
import co.yixiang.modules.activity.service.YxStorePinkService;
import co.yixiang.modules.activity.service.dto.YxStorePinkDTO;
import co.yixiang.modules.activity.service.dto.YxStorePinkQueryCriteria;
import co.yixiang.modules.activity.service.mapper.YxStorePinkMapper;
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-11-18
*/
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class YxStorePinkServiceImpl implements YxStorePinkService {
@Autowired
private YxStorePinkRepository yxStorePinkRepository;
@Autowired
private YxStoreCombinationService combinationService;
@Autowired
private YxUserService userService;
@Autowired
private YxStorePinkMapper yxStorePinkMapper;
/**
* 参与拼团的人
* @param id id
* @return
*/
@Override
public int countPeople(int id) {
return yxStorePinkRepository.countByKId(id) + 1;
}
@Override
public Map<String,Object> queryAll(YxStorePinkQueryCriteria criteria, Pageable pageable){
criteria.setKId(0);
Page<YxStorePink> page = yxStorePinkRepository
.findAll((root, criteriaQuery, criteriaBuilder)
-> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
List<YxStorePinkDTO> storePinkDTOS = yxStorePinkMapper.toDto(page.getContent());
for (YxStorePinkDTO storePinkDTO : storePinkDTOS) {
YxStoreCombinationDTO combinationDTO = combinationService
.findById(storePinkDTO.getCid());
YxUserDTO userDTO = userService.findById(storePinkDTO.getUid());
storePinkDTO.setAvatar(userDTO.getAvatar());
storePinkDTO.setNickname(userDTO.getNickname());
storePinkDTO.setTitle(combinationDTO.getTitle());
storePinkDTO.setCountPeople(countPeople(storePinkDTO.getId()));
}
Map<String,Object> map = new LinkedHashMap<>(2);
map.put("content",storePinkDTOS);
map.put("totalElements",page.getTotalElements());
return map;
}
@Override
public List<YxStorePinkDTO> queryAll(YxStorePinkQueryCriteria criteria){
return yxStorePinkMapper.toDto(yxStorePinkRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
public YxStorePinkDTO findById(Integer id) {
Optional<YxStorePink> yxStorePink = yxStorePinkRepository.findById(id);
ValidationUtil.isNull(yxStorePink,"YxStorePink","id",id);
return yxStorePinkMapper.toDto(yxStorePink.get());
}
@Override
@Transactional(rollbackFor = Exception.class)
public YxStorePinkDTO create(YxStorePink resources) {
return yxStorePinkMapper.toDto(yxStorePinkRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(YxStorePink resources) {
Optional<YxStorePink> optionalYxStorePink = yxStorePinkRepository.findById(resources.getId());
ValidationUtil.isNull( optionalYxStorePink,"YxStorePink","id",resources.getId());
YxStorePink yxStorePink = optionalYxStorePink.get();
yxStorePink.copy(resources);
yxStorePinkRepository.save(yxStorePink);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(Integer id) {
yxStorePinkRepository.deleteById(id);
}
}

View File

@ -0,0 +1,75 @@
package co.yixiang.modules.activity.service.impl;
import co.yixiang.modules.activity.domain.YxStoreVisit;
import co.yixiang.utils.ValidationUtil;
import co.yixiang.modules.activity.repository.YxStoreVisitRepository;
import co.yixiang.modules.activity.service.YxStoreVisitService;
import co.yixiang.modules.activity.service.dto.YxStoreVisitDTO;
import co.yixiang.modules.activity.service.dto.YxStoreVisitQueryCriteria;
import co.yixiang.modules.activity.service.mapper.YxStoreVisitMapper;
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-11-18
*/
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class YxStoreVisitServiceImpl implements YxStoreVisitService {
@Autowired
private YxStoreVisitRepository yxStoreVisitRepository;
@Autowired
private YxStoreVisitMapper yxStoreVisitMapper;
@Override
public Map<String,Object> queryAll(YxStoreVisitQueryCriteria criteria, Pageable pageable){
Page<YxStoreVisit> page = yxStoreVisitRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(yxStoreVisitMapper::toDto));
}
@Override
public List<YxStoreVisitDTO> queryAll(YxStoreVisitQueryCriteria criteria){
return yxStoreVisitMapper.toDto(yxStoreVisitRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
public YxStoreVisitDTO findById(Integer id) {
Optional<YxStoreVisit> yxStoreVisit = yxStoreVisitRepository.findById(id);
ValidationUtil.isNull(yxStoreVisit,"YxStoreVisit","id",id);
return yxStoreVisitMapper.toDto(yxStoreVisit.get());
}
@Override
@Transactional(rollbackFor = Exception.class)
public YxStoreVisitDTO create(YxStoreVisit resources) {
return yxStoreVisitMapper.toDto(yxStoreVisitRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(YxStoreVisit resources) {
Optional<YxStoreVisit> optionalYxStoreVisit = yxStoreVisitRepository.findById(resources.getId());
ValidationUtil.isNull( optionalYxStoreVisit,"YxStoreVisit","id",resources.getId());
YxStoreVisit yxStoreVisit = optionalYxStoreVisit.get();
yxStoreVisit.copy(resources);
yxStoreVisitRepository.save(yxStoreVisit);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(Integer id) {
yxStoreVisitRepository.deleteById(id);
}
}

View File

@ -0,0 +1,75 @@
package co.yixiang.modules.activity.service.impl;
import co.yixiang.modules.activity.domain.YxUserExtract;
import co.yixiang.utils.ValidationUtil;
import co.yixiang.modules.activity.repository.YxUserExtractRepository;
import co.yixiang.modules.activity.service.YxUserExtractService;
import co.yixiang.modules.activity.service.dto.YxUserExtractDTO;
import co.yixiang.modules.activity.service.dto.YxUserExtractQueryCriteria;
import co.yixiang.modules.activity.service.mapper.YxUserExtractMapper;
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-11-14
*/
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class YxUserExtractServiceImpl implements YxUserExtractService {
@Autowired
private YxUserExtractRepository yxUserExtractRepository;
@Autowired
private YxUserExtractMapper yxUserExtractMapper;
@Override
public Map<String,Object> queryAll(YxUserExtractQueryCriteria criteria, Pageable pageable){
Page<YxUserExtract> page = yxUserExtractRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(yxUserExtractMapper::toDto));
}
@Override
public List<YxUserExtractDTO> queryAll(YxUserExtractQueryCriteria criteria){
return yxUserExtractMapper.toDto(yxUserExtractRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
public YxUserExtractDTO findById(Integer id) {
Optional<YxUserExtract> yxUserExtract = yxUserExtractRepository.findById(id);
ValidationUtil.isNull(yxUserExtract,"YxUserExtract","id",id);
return yxUserExtractMapper.toDto(yxUserExtract.get());
}
@Override
@Transactional(rollbackFor = Exception.class)
public YxUserExtractDTO create(YxUserExtract resources) {
return yxUserExtractMapper.toDto(yxUserExtractRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(YxUserExtract resources) {
Optional<YxUserExtract> optionalYxUserExtract = yxUserExtractRepository.findById(resources.getId());
ValidationUtil.isNull( optionalYxUserExtract,"YxUserExtract","id",resources.getId());
YxUserExtract yxUserExtract = optionalYxUserExtract.get();
yxUserExtract.copy(resources);
yxUserExtractRepository.save(yxUserExtract);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(Integer id) {
yxUserExtractRepository.deleteById(id);
}
}

View File

@ -0,0 +1,16 @@
package co.yixiang.modules.activity.service.mapper;
import co.yixiang.mapper.EntityMapper;
import co.yixiang.modules.activity.domain.YxStoreCombination;
import co.yixiang.modules.activity.service.dto.YxStoreCombinationDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @author hupeng
* @date 2019-11-18
*/
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface YxStoreCombinationMapper extends EntityMapper<YxStoreCombinationDTO, YxStoreCombination> {
}

View File

@ -0,0 +1,16 @@
package co.yixiang.modules.activity.service.mapper;
import co.yixiang.mapper.EntityMapper;
import co.yixiang.modules.activity.domain.YxStoreCouponIssue;
import co.yixiang.modules.activity.service.dto.YxStoreCouponIssueDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @author hupeng
* @date 2019-11-09
*/
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface YxStoreCouponIssueMapper extends EntityMapper<YxStoreCouponIssueDTO, YxStoreCouponIssue> {
}

View File

@ -0,0 +1,16 @@
package co.yixiang.modules.activity.service.mapper;
import co.yixiang.mapper.EntityMapper;
import co.yixiang.modules.activity.domain.YxStoreCouponIssueUser;
import co.yixiang.modules.activity.service.dto.YxStoreCouponIssueUserDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @author hupeng
* @date 2019-11-09
*/
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface YxStoreCouponIssueUserMapper extends EntityMapper<YxStoreCouponIssueUserDTO, YxStoreCouponIssueUser> {
}

View File

@ -0,0 +1,16 @@
package co.yixiang.modules.activity.service.mapper;
import co.yixiang.mapper.EntityMapper;
import co.yixiang.modules.activity.domain.YxStoreCoupon;
import co.yixiang.modules.activity.service.dto.YxStoreCouponDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @author hupeng
* @date 2019-11-09
*/
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface YxStoreCouponMapper extends EntityMapper<YxStoreCouponDTO, YxStoreCoupon> {
}

View File

@ -0,0 +1,16 @@
package co.yixiang.modules.activity.service.mapper;
import co.yixiang.mapper.EntityMapper;
import co.yixiang.modules.activity.domain.YxStoreCouponUser;
import co.yixiang.modules.activity.service.dto.YxStoreCouponUserDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @author hupeng
* @date 2019-11-10
*/
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface YxStoreCouponUserMapper extends EntityMapper<YxStoreCouponUserDTO, YxStoreCouponUser> {
}

View File

@ -0,0 +1,16 @@
package co.yixiang.modules.activity.service.mapper;
import co.yixiang.mapper.EntityMapper;
import co.yixiang.modules.activity.domain.YxStorePink;
import co.yixiang.modules.activity.service.dto.YxStorePinkDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @author hupeng
* @date 2019-11-18
*/
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface YxStorePinkMapper extends EntityMapper<YxStorePinkDTO, YxStorePink> {
}

View File

@ -0,0 +1,16 @@
package co.yixiang.modules.activity.service.mapper;
import co.yixiang.mapper.EntityMapper;
import co.yixiang.modules.activity.domain.YxStoreVisit;
import co.yixiang.modules.activity.service.dto.YxStoreVisitDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @author hupeng
* @date 2019-11-18
*/
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface YxStoreVisitMapper extends EntityMapper<YxStoreVisitDTO, YxStoreVisit> {
}

View File

@ -0,0 +1,16 @@
package co.yixiang.modules.activity.service.mapper;
import co.yixiang.mapper.EntityMapper;
import co.yixiang.modules.activity.domain.YxUserExtract;
import co.yixiang.modules.activity.service.dto.YxUserExtractDTO;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
/**
* @author hupeng
* @date 2019-11-14
*/
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface YxUserExtractMapper extends EntityMapper<YxUserExtractDTO, YxUserExtract> {
}

View File

@ -0,0 +1,36 @@
package co.yixiang.modules.shop.domain;
import lombok.Data;
import javax.persistence.*;
/**
* @ClassName StoreOrderCartInfo
* @Author hupeng <610796224@qq.com>
* @Date 2019/10/14
**/
@Entity
@Data
@Table(name="yx_store_order_cart_info")
public class StoreOrderCartInfo {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
@Column(name = "oid")
private Integer oid;
@Column(name = "cart_id")
private Integer cartId;
@Column(name = "cart_info")
private String cartInfo;
@Column(name = "unique")
private String unique;
}

View File

@ -0,0 +1,48 @@
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.io.Serializable;
/**
* @author hupeng
* @date 2019-12-12
*/
@Entity
@Data
@Table(name="yx_express")
public class YxExpress implements Serializable {
// 快递公司id
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
// 快递公司简称
@Column(name = "code",unique = true,nullable = false)
@NotBlank(message = "快递公司编号不能为空")
private String code;
// 快递公司全称
@Column(name = "name",nullable = false)
@NotBlank(message = "快递公司名称不能为空")
private String name;
// 排序
@Column(name = "sort",nullable = false)
@NotNull(message = "排序必填")
private Integer sort;
// 是否显示
@Column(name = "is_show",insertable = false)
private Integer isShow;
public void copy(YxExpress source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -0,0 +1,54 @@
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 java.io.Serializable;
/**
* @author hupeng
* @date 2019-10-03
*/
@Entity
@Data
@Table(name="yx_store_category")
public class YxStoreCategory implements Serializable {
// 商品分类表ID
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
// 父id
@Column(name = "pid",nullable = false)
private Integer pid;
// 分类名称
@Column(name = "cate_name",nullable = false)
@NotBlank(message = "分类名称不能为空")
private String cateName;
// 排序
@Column(name = "sort",nullable = false)
private Integer sort;
// 图标
@Column(name = "pic",nullable = false)
@NotBlank(message = "请上传分类图片")
private String pic;
// 是否推荐
@Column(name = "is_show",nullable = false)
private Integer isShow;
// 添加时间
@Column(name = "add_time",nullable = false)
private Integer addTime;
public void copy(YxStoreCategory source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -0,0 +1,232 @@
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 java.math.BigDecimal;
import java.io.Serializable;
/**
* @author hupeng
* @date 2019-10-14
*/
@Entity
@Data
@Table(name="yx_store_order")
public class YxStoreOrder implements Serializable {
// 订单ID
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
// 订单号
@Column(name = "order_id",nullable = false)
private String orderId;
// 用户id
@Column(name = "uid",nullable = false)
private Integer uid;
// 用户姓名
@Column(name = "real_name",nullable = false)
private String realName;
// 用户电话
@Column(name = "user_phone",nullable = false)
private String userPhone;
// 详细地址
@Column(name = "user_address",nullable = false)
private String userAddress;
// 购物车id
@Column(name = "cart_id",nullable = false)
private String cartId;
// 运费金额
@Column(name = "freight_price",nullable = false)
private BigDecimal freightPrice;
// 订单商品总数
@Column(name = "total_num",nullable = false)
private Integer totalNum;
// 订单总价
@Column(name = "total_price",nullable = false)
private BigDecimal totalPrice;
// 邮费
@Column(name = "total_postage",nullable = false)
private BigDecimal totalPostage;
// 实际支付金额
@Column(name = "pay_price",nullable = false)
private BigDecimal payPrice;
// 支付邮费
@Column(name = "pay_postage",nullable = false)
private BigDecimal payPostage;
// 抵扣金额
@Column(name = "deduction_price",nullable = false)
private BigDecimal deductionPrice;
// 优惠券id
@Column(name = "coupon_id",nullable = false)
private Integer couponId;
// 优惠券金额
@Column(name = "coupon_price",nullable = false)
private BigDecimal couponPrice;
// 支付状态
@Column(name = "paid",nullable = false)
private Integer paid;
// 支付时间
@Column(name = "pay_time")
private Integer payTime;
// 支付方式
@Column(name = "pay_type",nullable = false)
private String payType;
// 创建时间
@Column(name = "add_time",nullable = false)
private Integer addTime;
// 订单状态(-1 : 申请退款 -2 : 退货成功 0待发货1待收货2已收货3待评价-1已退款
@Column(name = "status",nullable = false)
private Integer status;
// 0 未退款 1 申请中 2 已退款
@Column(name = "refund_status",nullable = false)
private Integer refundStatus;
// 退款图片
@Column(name = "refund_reason_wap_img")
private String refundReasonWapImg;
// 退款用户说明
@Column(name = "refund_reason_wap_explain")
private String refundReasonWapExplain;
// 退款时间
@Column(name = "refund_reason_time")
private Integer refundReasonTime;
// 前台退款原因
@Column(name = "refund_reason_wap")
private String refundReasonWap;
// 不退款的理由
@Column(name = "refund_reason")
private String refundReason;
// 退款金额
@Column(name = "refund_price",nullable = false)
private BigDecimal refundPrice;
// 快递名称/送货人姓名
@Column(name = "delivery_name")
@NotBlank(message = "请选择快递公司")
private String deliveryName;
@Column(name = "delivery_sn")
private String deliverySn;
// 发货类型
@Column(name = "delivery_type")
private String deliveryType;
// 快递单号/手机号
@Column(name = "delivery_id")
@NotBlank(message = "快递单号不能为空")
private String deliveryId;
// 消费赚取积分
@Column(name = "gain_integral",nullable = false)
private BigDecimal gainIntegral;
// 使用积分
@Column(name = "use_integral",nullable = false)
private BigDecimal useIntegral;
// 给用户退了多少积分
@Column(name = "back_integral")
private BigDecimal backIntegral;
// 备注
@Column(name = "mark",nullable = false)
private String mark;
// 是否删除
@Column(name = "is_del",nullable = false)
private Integer isDel;
// 唯一id(md5加密)类似id
@Column(name = "`unique`",unique = true,nullable = false)
private String unique;
// 管理员备注
@Column(name = "remark")
private String remark;
// 商户ID
@Column(name = "mer_id",nullable = false)
private Integer merId;
@Column(name = "is_mer_check",nullable = false)
private Integer isMerCheck;
// 拼团产品id0一般产品
@Column(name = "combination_id")
private Integer combinationId;
// 拼团id 0没有拼团
@Column(name = "pink_id",nullable = false)
private Integer pinkId;
// 成本价
@Column(name = "cost",nullable = false)
private BigDecimal cost;
// 秒杀产品ID
@Column(name = "seckill_id",nullable = false)
private Integer seckillId;
// 砍价id
@Column(name = "bargain_id")
private Integer bargainId;
// 核销码
@Column(name = "verify_code",nullable = false)
private String verifyCode;
// 门店id
@Column(name = "store_id",nullable = false)
private Integer storeId;
// 配送方式 1=快递 2=门店自提
@Column(name = "shipping_type",nullable = false)
private Integer shippingType;
// 支付渠道(0微信公众号1微信小程序)
@Column(name = "is_channel")
private Integer isChannel;
@Column(name = "is_remind")
private Integer isRemind;
@Column(name = "is_system_del")
private Integer isSystemDel;
public void copy(YxStoreOrder source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -0,0 +1,42 @@
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-11-02
*/
@Entity
@Data
@Table(name="yx_store_order_status")
public class YxStoreOrderStatus implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
// 订单id
@Column(name = "oid",nullable = false)
private Integer oid;
// 操作类型
@Column(name = "change_type",nullable = false)
private String changeType;
// 操作备注
@Column(name = "change_message",nullable = false)
private String changeMessage;
// 操作时间
@Column(name = "change_time",nullable = false)
private Integer changeTime;
public void copy(YxStoreOrderStatus source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -0,0 +1,203 @@
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.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @author hupeng
* @date 2019-10-04
*/
@Entity
@Data
@Table(name="yx_store_product")
public class YxStoreProduct implements Serializable {
// 商品id
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
// 商户Id(0为总后台管理员创建,不为0的时候是商户后台创建)
@Column(name = "mer_id",nullable = false)
private Integer merId;
// 商品图片
@Column(name = "image",nullable = false)
@NotBlank(message = "请上传商品图片")
private String image;
// 轮播图
@Column(name = "slider_image",nullable = false)
@NotBlank(message = "请上传轮播图")
private String sliderImage;
// 商品名称
@Column(name = "store_name",nullable = false)
@NotBlank(message = "请填写商品名称")
private String storeName;
// 商品简介
@Column(name = "store_info",nullable = false)
@NotBlank(message = "请填写商品简介")
private String storeInfo;
// 关键字
@Column(name = "keyword",nullable = false)
@NotBlank(message = "请填写关键字")
private String keyword;
// 产品条码(一维码)
@Column(name = "bar_code",nullable = false)
private String barCode;
// 分类id
@Column(name = "cate_id",nullable = false)
@NotBlank(message = "请选择分类")
private String cateId;
// 商品价格
@Column(name = "price",nullable = false)
@NotNull(message = "价格必填")
@Min(value = 0)
private BigDecimal price;
// 会员价格
@Column(name = "vip_price",insertable = false)
//@NotNull(message = "会员价必填")
//@Min(value = 0)
private BigDecimal vipPrice;
// 市场价
@Column(name = "ot_price",nullable = false)
@NotNull(message = "原价必填")
@Min(value = 0)
private BigDecimal otPrice;
// 邮费
@Column(name = "postage",nullable = false)
@NotNull(message = "邮费必填")
@Min(value = 0)
private BigDecimal postage;
// 单位名
@Column(name = "unit_name",nullable = false)
@NotBlank(message = "请填写单位")
private String unitName;
// 排序
@Column(name = "sort",nullable = false)
@NotNull(message = "排序必填")
@Min(value = 0)
private Integer sort;
// 销量
@Column(name = "sales",nullable = false)
@NotNull(message = "销量必填")
@Min(value = 0)
private Integer sales;
// 库存
@Column(name = "stock",nullable = false)
@NotNull(message = "库存必填")
@Min(value = 0)
private Integer stock;
// 状态0未上架1上架
@Column(name = "is_show",insertable = false)
//@NotNull(message = "状态必须选择")
private Integer isShow;
// 是否热卖
@Column(name = "is_hot")
@NotNull(message = "热卖单品必须选择")
private Integer isHot;
// 是否优惠
@Column(name = "is_benefit")
@NotNull(message = "优惠推荐必须选择")
private Integer isBenefit;
// 是否精品
@Column(name = "is_best",columnDefinition="int default 0")
@NotNull(message = "精品状态必须选择")
private Integer isBest;
// 是否新品
@Column(name = "is_new",columnDefinition="int default 0")
@NotNull(message = "首发新品必须选择")
private Integer isNew;
// 产品描述
@Column(name = "description",nullable = false)
@NotBlank(message = "产品描述")
private String description;
// 添加时间
@Column(name = "add_time",nullable = false)
private Integer addTime;
// 是否包邮
@Column(name = "is_postage")
@NotNull(message = "包邮状态必须选择")
private Integer isPostage;
// 是否删除
@Column(name = "is_del",insertable = false)
private Integer isDel;
// 商户是否代理 0不可代理1可代理
@Column(name = "mer_use",nullable = false)
private Integer merUse;
// 获得积分
@Column(name = "give_integral")
@NotNull(message = "奖励积分不能为空")
@Min(value = 0)
private BigDecimal giveIntegral;
// 成本价
@Column(name = "cost")
@NotNull(message = "成本价不能为空")
@Min(value = 0)
private BigDecimal cost;
// 秒杀状态 0 未开启 1已开启
@Column(name = "is_seckill",columnDefinition="int default 0")
private Integer isSeckill;
// 砍价状态 0未开启 1开启
@Column(name = "is_bargain",columnDefinition="int default 0")
private Integer isBargain;
// 是否优品推荐
@Column(name = "is_good",columnDefinition="int default 0")
private Integer isGood;
// 虚拟销量
@Column(name = "ficti",columnDefinition="int default 0")
private Integer ficti;
// 浏览量
@Column(name = "browse",columnDefinition="int default 0")
private Integer browse;
// 产品二维码地址(用户小程序海报)
@Column(name = "code_path",nullable = false)
private String codePath;
// 淘宝京东1688类型
@Column(name = "soure_link")
private String soureLink;
public void copy(YxStoreProduct source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -0,0 +1,37 @@
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-10-13
*/
@Entity
@Data
@Table(name="yx_store_product_attr")
public class YxStoreProductAttr implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
// 商品ID
@Column(name = "product_id",nullable = false)
private Integer productId;
// 属性名
@Column(name = "attr_name",nullable = false)
private String attrName;
// 属性值
@Column(name = "attr_values",nullable = false)
private String attrValues;
public void copy(YxStoreProductAttr source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -0,0 +1,38 @@
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-10-13
*/
@Entity
@Data
@Table(name="yx_store_product_attr_result")
public class YxStoreProductAttrResult implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
// 商品ID
@Column(name = "product_id",nullable = false)
private Integer productId;
// 商品属性参数
@Column(name = "result",nullable = false)
private String result;
// 上次修改时间
@Column(name = "change_time",nullable = false)
private Integer changeTime;
public void copy(YxStoreProductAttrResult source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -0,0 +1,59 @@
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.math.BigDecimal;
import java.io.Serializable;
/**
* @author hupeng
* @date 2019-10-13
*/
@Entity
@Data
@Table(name="yx_store_product_attr_value")
public class YxStoreProductAttrValue implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
// 商品ID
@Column(name = "product_id",nullable = false)
private Integer productId;
// 商品属性索引值 (attr_value|attr_value[|....])
@Column(name = "suk",nullable = false)
private String suk;
// 属性对应的库存
@Column(name = "stock",nullable = false)
private Integer stock;
// 销量
@Column(name = "sales",nullable = false)
private Integer sales;
// 属性金额
@Column(name = "price",nullable = false)
private BigDecimal price;
// 图片
@Column(name = "image")
private String image;
// 唯一值
@Column(name = "`unique`",nullable = false)
private String unique;
// 成本价
@Column(name = "cost",nullable = false)
private BigDecimal cost;
public void copy(YxStoreProductAttrValue source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -0,0 +1,83 @@
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-11-03
*/
@Entity
@Data
@Table(name="yx_store_product_reply")
public class YxStoreProductReply implements Serializable {
// 评论ID
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
// 用户ID
@Column(name = "uid",nullable = false)
private Integer uid;
// 订单ID
@Column(name = "oid",nullable = false)
private Integer oid;
// 唯一id
@Column(name = "`unique`",nullable = false)
private String unique;
// 产品id
@Column(name = "product_id",nullable = false)
private Integer productId;
// 某种商品类型(普通商品、秒杀商品)
@Column(name = "reply_type",nullable = false)
private String replyType;
// 商品分数
@Column(name = "product_score",nullable = false)
private Integer productScore;
// 服务分数
@Column(name = "service_score",nullable = false)
private Integer serviceScore;
// 评论内容
@Column(name = "comment",nullable = false)
private String comment;
// 评论图片
@Column(name = "pics",nullable = false)
private String pics;
// 评论时间
@Column(name = "add_time",nullable = false)
private Integer addTime;
// 管理员回复内容
@Column(name = "merchant_reply_content")
private String merchantReplyContent;
// 管理员回复时间
@Column(name = "merchant_reply_time")
private Integer merchantReplyTime;
// 0未删除1已删除
@Column(name = "is_del",nullable = false)
private Integer isDel;
// 0未回复1已回复
@Column(name = "is_reply",nullable = false)
private Integer isReply;
public void copy(YxStoreProductReply source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -0,0 +1,47 @@
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-10-18
*/
@Entity
@Data
@Table(name="yx_system_group_data")
public class YxSystemGroupData implements Serializable {
// 组合数据详情ID
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
// 对应的数据名称
@Column(name = "group_name",nullable = false)
private String groupName;
// 数据组对应的数据值json数据
@Column(name = "value",nullable = false)
private String value;
// 添加数据时间
@Column(name = "add_time",nullable = false)
private Integer addTime;
// 数据排序
@Column(name = "sort",nullable = false)
private Integer sort;
// 状态1开启2关闭
@Column(name = "status",nullable = false)
private Integer status;
public void copy(YxSystemGroupData source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -0,0 +1,152 @@
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.math.BigDecimal;
import java.io.Serializable;
/**
* @author hupeng
* @date 2019-10-06
*/
@Entity
@Data
@Table(name="yx_user")
public class YxUser implements Serializable {
// 用户id
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "uid")
private Integer uid;
// 用户账号
@Column(name = "account",nullable = false)
private String account;
// 用户密码
@Column(name = "pwd",nullable = false)
private String pwd;
// 真实姓名
@Column(name = "real_name",nullable = false)
private String realName;
// 生日
@Column(name = "birthday",nullable = false)
private Integer birthday;
// 身份证号码
@Column(name = "card_id",nullable = false)
private String cardId;
// 用户备注
@Column(name = "mark",nullable = false)
private String mark;
// 合伙人id
@Column(name = "partner_id",nullable = false)
private Integer partnerId;
// 用户分组id
@Column(name = "group_id",nullable = false)
private Integer groupId;
// 用户昵称
@Column(name = "nickname",nullable = false)
private String nickname;
// 用户头像
@Column(name = "avatar",nullable = false)
private String avatar;
// 手机号码
@Column(name = "phone")
private String phone;
// 添加时间
@Column(name = "add_time",nullable = false)
private Integer addTime;
// 添加ip
@Column(name = "add_ip",nullable = false)
private String addIp;
// 最后一次登录时间
@Column(name = "last_time",nullable = false)
private Integer lastTime;
// 最后一次登录ip
@Column(name = "last_ip",nullable = false)
private String lastIp;
// 用户余额
@Column(name = "now_money",nullable = false)
private BigDecimal nowMoney;
// 佣金金额
@Column(name = "brokerage_price",nullable = false)
private BigDecimal brokeragePrice;
// 用户剩余积分
@Column(name = "integral",nullable = false)
private BigDecimal integral;
// 连续签到天数
@Column(name = "sign_num",nullable = false)
private Integer signNum;
// 1为正常0为禁止
@Column(name = "status",nullable = false)
private Integer status;
// 等级
@Column(name = "level",nullable = false)
private Integer level;
// 推广元id
@Column(name = "spread_uid",nullable = false)
private Integer spreadUid;
// 推广员关联时间
@Column(name = "spread_time",nullable = false)
private Integer spreadTime;
// 用户类型
@Column(name = "user_type",nullable = false)
private String userType;
// 是否为推广员
@Column(name = "is_promoter",nullable = false)
private Integer isPromoter;
// 用户购买次数
@Column(name = "pay_count")
private Integer payCount;
// 下级人数
@Column(name = "spread_count")
private Integer spreadCount;
// 清理会员时间
@Column(name = "clean_time")
private Integer cleanTime;
// 详细地址
@Column(name = "addres",nullable = false)
private String addres;
// 管理员编号
@Column(name = "adminid")
private Integer adminid;
// 用户登陆类型h5,wechat,routine
@Column(name = "login_type",nullable = false)
private String loginType;
public void copy(YxUser source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -0,0 +1,74 @@
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.math.BigDecimal;
import java.io.Serializable;
/**
* @author hupeng
* @date 2019-11-06
*/
@Entity
@Data
@Table(name="yx_user_bill")
public class YxUserBill implements Serializable {
// 用户账单id
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
//用户uid
@Column(name = "uid",nullable = false)
private Integer uid;
// 关联id
@Column(name = "link_id",nullable = false)
private String linkId;
// 0 = 支出 1 = 获得
@Column(name = "pm",nullable = false)
private Integer pm;
// 账单标题
@Column(name = "title",nullable = false)
private String title;
// 明细种类
@Column(name = "category",nullable = false)
private String category;
// 明细类型
@Column(name = "type",nullable = false)
private String type;
// 明细数字
@Column(name = "number",nullable = false)
private BigDecimal number;
// 剩余
@Column(name = "balance",nullable = false)
private BigDecimal balance;
// 备注
@Column(name = "mark",nullable = false)
private String mark;
// 添加时间
@Column(name = "add_time",nullable = false)
private Integer addTime;
// 0 = 带确定 1 = 有效 -1 = 无效
@Column(name = "status",nullable = false)
private Integer status;
public void copy(YxUserBill source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}

View File

@ -0,0 +1,19 @@
package co.yixiang.modules.shop.repository;
import co.yixiang.modules.shop.domain.YxExpress;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @author hupeng
* @date 2019-12-12
*/
public interface YxExpressRepository extends JpaRepository<YxExpress, Integer>, JpaSpecificationExecutor {
/**
* findByCode
* @param code
* @return
*/
YxExpress findByCode(String code);
}

View File

@ -0,0 +1,16 @@
package co.yixiang.modules.shop.repository;
import co.yixiang.modules.shop.domain.YxStoreCategory;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
/**
* @author hupeng
* @date 2019-10-03
*/
public interface YxStoreCategoryRepository extends JpaRepository<YxStoreCategory, Integer>, JpaSpecificationExecutor {
@Query(value = "select cate_name from yx_store_category where id = ?1",nativeQuery = true)
String findNameById(Integer id);
}

View File

@ -0,0 +1,17 @@
package co.yixiang.modules.shop.repository;
import co.yixiang.modules.shop.domain.StoreOrderCartInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import java.util.List;
/**
* @author hupeng
* @date 2019-10-14
*/
public interface YxStoreOrderCartInfoRepository extends JpaRepository<StoreOrderCartInfo, Integer>, JpaSpecificationExecutor {
List<StoreOrderCartInfo> findByOid(int oid);
}

View File

@ -0,0 +1,53 @@
package co.yixiang.modules.shop.repository;
import co.yixiang.modules.shop.domain.YxStoreOrder;
import co.yixiang.modules.shop.service.dto.ChartDataDTO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
/**
* @author hupeng
* @date 2019-10-14
*/
public interface YxStoreOrderRepository extends JpaRepository<YxStoreOrder, Integer>, JpaSpecificationExecutor {
//今天 //上周 //本月
int countByPayTimeGreaterThanEqual(int time);
//昨天
int countByPayTimeLessThanAndPayTimeGreaterThanEqual(int timeO,int timeT);
@Query(value = "select IFNULL(sum(pay_price),0) from yx_store_order " +
"where refund_status=0 and is_del=0 and paid=1 and pay_time >= ?1",nativeQuery = true)
double sumPrice(Integer time);
@Query(value = "select IFNULL(sum(pay_price),0) from yx_store_order " +
"where refund_status=0 and is_del=0 and paid=1 and pay_time >= ?1 and pay_time < ?2",nativeQuery = true)
double sumTPrice(Integer timeO,Integer timeT);
@Query(value = "SELECT IFNULL(sum(pay_price),0) as num," +
"FROM_UNIXTIME(add_time, '%m-%d') as time " +
" FROM yx_store_order where refund_status=0 and is_del=0 and paid=1 and pay_time >= ?1" +
" GROUP BY FROM_UNIXTIME(add_time,'%Y-%m-%d') " +
" ORDER BY add_time ASC",nativeQuery = true)
List<ChartDataDTO> chartList(Integer time);
@Query(value = "SELECT count(id) as num," +
"FROM_UNIXTIME(add_time, '%m-%d') as time " +
" FROM yx_store_order where refund_status=0 and is_del=0 and paid=1 and pay_time >= ?1" +
" GROUP BY FROM_UNIXTIME(add_time,'%Y-%m-%d') " +
" ORDER BY add_time ASC",nativeQuery = true)
List<ChartDataDTO> chartListT(Integer time);
/**
* findByUnique
* @param unique
* @return
*/
YxStoreOrder findByUnique(String unique);
}

View File

@ -0,0 +1,12 @@
package co.yixiang.modules.shop.repository;
import co.yixiang.modules.shop.domain.YxStoreOrderStatus;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @author hupeng
* @date 2019-11-02
*/
public interface YxStoreOrderStatusRepository extends JpaRepository<YxStoreOrderStatus, Integer>, JpaSpecificationExecutor {
}

View File

@ -0,0 +1,15 @@
package co.yixiang.modules.shop.repository;
import co.yixiang.modules.shop.domain.YxStoreProductAttr;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @author hupeng
* @date 2019-10-13
*/
public interface YxStoreProductAttrRepository extends JpaRepository<YxStoreProductAttr, Integer>, JpaSpecificationExecutor {
//@Modifying
//@Query(value = "delete from yx_store_product_attr where product_id =?1",nativeQuery = true)
void deleteByProductId(int id);
}

View File

@ -0,0 +1,21 @@
package co.yixiang.modules.shop.repository;
import co.yixiang.modules.shop.domain.YxStoreProductAttrResult;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @author hupeng
* @date 2019-10-13
*/
public interface YxStoreProductAttrResultRepository extends JpaRepository<YxStoreProductAttrResult, Integer>, JpaSpecificationExecutor {
/**
* findByProductId
* @param product_id
* @return
*/
YxStoreProductAttrResult findByProductId(Integer product_id);
void deleteByProductId(Integer product_id);
}

View File

@ -0,0 +1,16 @@
package co.yixiang.modules.shop.repository;
import co.yixiang.modules.shop.domain.YxStoreProductAttrValue;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @author hupeng
* @date 2019-10-13
*/
public interface YxStoreProductAttrValueRepository extends JpaRepository<YxStoreProductAttrValue, Integer>, JpaSpecificationExecutor {
//@Modifying
// @Query(value = "delete from yx_store_product_attr_value where product_id =?1",nativeQuery = true)
void deleteByProductId(Integer id);
}

View File

@ -0,0 +1,12 @@
package co.yixiang.modules.shop.repository;
import co.yixiang.modules.shop.domain.YxStoreProductReply;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @author hupeng
* @date 2019-11-03
*/
public interface YxStoreProductReplyRepository extends JpaRepository<YxStoreProductReply, Integer>, JpaSpecificationExecutor {
}

View File

@ -0,0 +1,21 @@
package co.yixiang.modules.shop.repository;
import co.yixiang.modules.shop.domain.YxStoreProduct;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
/**
* @author hupeng
* @date 2019-10-04
*/
public interface YxStoreProductRepository extends JpaRepository<YxStoreProduct, Integer>, JpaSpecificationExecutor {
@Modifying
@Query(value = "update yx_store_product set is_show = ?1 where id = ?2",nativeQuery = true)
void updateOnsale(int status,int id);
@Modifying
@Query(value = "update yx_store_product set is_del = ?1 where id = ?2",nativeQuery = true)
void updateDel(int status,int id);
}

View File

@ -0,0 +1,12 @@
package co.yixiang.modules.shop.repository;
import co.yixiang.modules.shop.domain.YxSystemGroupData;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @author hupeng
* @date 2019-10-18
*/
public interface YxSystemGroupDataRepository extends JpaRepository<YxSystemGroupData, Integer>, JpaSpecificationExecutor {
}

View File

@ -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 {
}

View File

@ -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 {
}

View File

@ -0,0 +1,29 @@
package co.yixiang.modules.shop.repository;
import co.yixiang.modules.shop.domain.YxUserBill;
import co.yixiang.modules.shop.service.dto.UserBillDTO;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import java.util.Map;
/**
* @author hupeng
* @date 2019-11-06
*/
public interface YxUserBillRepository extends JpaRepository<YxUserBill, Integer>, JpaSpecificationExecutor {
@Query(nativeQuery = true,
value = "select b.title,b.pm,b.category,b.type,b.number,b.add_time as addTime," +
"u.nickname from yx_user_bill b left join yx_user u on u.uid=b.uid " +
" where if(?1 !='',b.category=?1,1=1) and if(?2 !='',b.type=?2,1=1) " +
"and if(?3 !='',u.nickname LIKE CONCAT('%',?3,'%'),1=1)",
countQuery = "select count(*) from yx_user_bill b left join yx_user u on u.uid=b.uid" +
" where if(?1 !='',b.category=?1,1=1) and if(?2 !='',b.type=?2,1=1) " +
"and if(?3 !='',u.nickname LIKE CONCAT('%',?3,'%'),1=1)")
Page<Map> findAllByPageable(String category, String type, String nickname,
Pageable pageable);
}

View File

@ -0,0 +1,30 @@
package co.yixiang.modules.shop.repository;
import co.yixiang.modules.shop.domain.YxUser;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
/**
* @author hupeng
* @date 2019-10-06
*/
public interface YxUserRepository extends JpaRepository<YxUser, Integer>, JpaSpecificationExecutor {
@Modifying
@Query(value = "update yx_user set status = ?1 where uid = ?2",nativeQuery = true)
void updateOnstatus(int status,int id);
@Modifying
@Query(value = "update yx_user set now_money = now_money + ?1 where uid = ?2",nativeQuery = true)
void updateMoney(double money,int id);
@Modifying
@Query(value = "update yx_user set brokerage_price = brokerage_price+?1 where uid = ?2",nativeQuery = true)
void incBrokeragePrice(double price,int id);
}

View File

@ -0,0 +1,66 @@
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.YxExpress;
import co.yixiang.modules.shop.service.YxExpressService;
import co.yixiang.modules.shop.service.dto.YxExpressQueryCriteria;
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-12
*/
@Api(tags = "YxExpress管理")
@RestController
@RequestMapping("api")
public class YxExpressController {
@Autowired
private YxExpressService yxExpressService;
@Log("查询YxExpress")
@ApiOperation(value = "查询YxExpress")
@GetMapping(value = "/yxExpress")
@PreAuthorize("hasAnyRole('ADMIN','YXEXPRESS_ALL','YXEXPRESS_SELECT')")
public ResponseEntity getYxExpresss(YxExpressQueryCriteria criteria, Pageable pageable){
return new ResponseEntity(yxExpressService.queryAll(criteria,pageable),HttpStatus.OK);
}
@Log("新增YxExpress")
@ApiOperation(value = "新增YxExpress")
@PostMapping(value = "/yxExpress")
@PreAuthorize("hasAnyRole('ADMIN','YXEXPRESS_ALL','YXEXPRESS_CREATE')")
public ResponseEntity create(@Validated @RequestBody YxExpress resources){
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
return new ResponseEntity(yxExpressService.create(resources),HttpStatus.CREATED);
}
@Log("修改YxExpress")
@ApiOperation(value = "修改YxExpress")
@PutMapping(value = "/yxExpress")
@PreAuthorize("hasAnyRole('ADMIN','YXEXPRESS_ALL','YXEXPRESS_EDIT')")
public ResponseEntity update(@Validated @RequestBody YxExpress resources){
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
yxExpressService.update(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
@Log("删除YxExpress")
@ApiOperation(value = "删除YxExpress")
@DeleteMapping(value = "/yxExpress/{id}")
@PreAuthorize("hasAnyRole('ADMIN','YXEXPRESS_ALL','YXEXPRESS_DELETE')")
public ResponseEntity delete(@PathVariable Integer id){
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
yxExpressService.delete(id);
return new ResponseEntity(HttpStatus.OK);
}
}

View File

@ -0,0 +1,75 @@
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;
import co.yixiang.modules.shop.service.YxStoreCategoryService;
import co.yixiang.modules.shop.service.dto.YxStoreCategoryDTO;
import co.yixiang.modules.shop.service.dto.YxStoreCategoryQueryCriteria;
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.*;
import java.util.List;
/**
* @author hupeng
* @date 2019-10-03
*/
@Api(tags = "商品分类管理")
@RestController
@RequestMapping("api")
public class YxStoreCategoryController {
@Autowired
private YxStoreCategoryService yxStoreCategoryService;
@Log("查询商品分类")
@ApiOperation(value = "查询商品分类")
@GetMapping(value = "/yxStoreCategory")
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECATEGORY_ALL','YXSTORECATEGORY_SELECT')")
public ResponseEntity getYxStoreCategorys(YxStoreCategoryQueryCriteria criteria, Pageable pageable){
List<YxStoreCategoryDTO> categoryDTOList = yxStoreCategoryService.queryAll(criteria);
return new ResponseEntity(yxStoreCategoryService.buildTree(categoryDTOList),HttpStatus.OK);
}
@Log("新增商品分类")
@ApiOperation(value = "新增商品分类")
@PostMapping(value = "/yxStoreCategory")
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECATEGORY_ALL','YXSTORECATEGORY_CREATE')")
public ResponseEntity create(@Validated @RequestBody YxStoreCategory resources){
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
resources.setAddTime(OrderUtil.getSecondTimestampTwo());
return new ResponseEntity(yxStoreCategoryService.create(resources),HttpStatus.CREATED);
}
@Log("修改商品分类")
@ApiOperation(value = "修改商品分类")
@PutMapping(value = "/yxStoreCategory")
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECATEGORY_ALL','YXSTORECATEGORY_EDIT')")
public ResponseEntity update(@Validated @RequestBody YxStoreCategory resources){
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
yxStoreCategoryService.update(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
@Log("删除商品分类")
@ApiOperation(value = "删除商品分类")
@DeleteMapping(value = "/yxStoreCategory/{id}")
@PreAuthorize("hasAnyRole('ADMIN','YXSTORECATEGORY_ALL','YXSTORECATEGORY_DELETE')")
public ResponseEntity delete(@PathVariable Integer id){
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
yxStoreCategoryService.delete(id);
return new ResponseEntity(HttpStatus.OK);
}
}

View File

@ -0,0 +1,167 @@
package co.yixiang.modules.shop.rest;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import co.yixiang.exception.BadRequestException;
import co.yixiang.modules.shop.domain.YxStoreOrder;
import co.yixiang.modules.shop.domain.YxStoreOrderStatus;
import co.yixiang.modules.shop.service.YxExpressService;
import co.yixiang.modules.shop.service.YxStoreOrderService;
import co.yixiang.aop.log.Log;
import co.yixiang.modules.shop.service.YxStoreOrderStatusService;
import co.yixiang.modules.shop.service.dto.YxExpressDTO;
import co.yixiang.modules.shop.service.dto.YxStoreOrderQueryCriteria;
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-10-14
*/
@Api(tags = "订单管理")
@RestController
@RequestMapping("api")
public class YxStoreOrderController {
@Autowired
private YxStoreOrderService yxStoreOrderService;
@Autowired
private YxStoreOrderStatusService yxStoreOrderStatusService;
@Autowired
private YxExpressService yxExpressService;
@GetMapping(value = "/data/count")
//@PreAuthorize("hasAnyRole('ADMIN','YXSTOREORDER_ALL','YXSTOREORDER_SELECT')")
public ResponseEntity getCount(){
return new ResponseEntity(yxStoreOrderService.getOrderTimeData(),HttpStatus.OK);
}
@GetMapping(value = "/data/chart")
//@PreAuthorize("hasAnyRole('ADMIN','YXSTOREORDER_ALL','YXSTOREORDER_SELECT')")
public ResponseEntity getChart(){
return new ResponseEntity(yxStoreOrderService.chartCount(),HttpStatus.OK);
}
@ApiOperation(value = "查询订单")
@GetMapping(value = "/yxStoreOrder")
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREORDER_ALL','YXSTOREORDER_SELECT')")
public ResponseEntity getYxStoreOrders(YxStoreOrderQueryCriteria criteria,
Pageable pageable,
@RequestParam(name = "orderStatus") String orderStatus){
if(StrUtil.isNotEmpty(orderStatus)){
switch (orderStatus){
case "0":
criteria.setIsDel(0);
criteria.setPaid(0);
criteria.setStatus(0);
criteria.setRefundStatus(0);
break;
case "1":
System.out.println(orderStatus);
criteria.setIsDel(0);
criteria.setPaid(1);
criteria.setStatus(0);
criteria.setRefundStatus(0);
break;
case "2":
criteria.setIsDel(0);
criteria.setPaid(1);
criteria.setStatus(1);
criteria.setRefundStatus(0);
break;
case "3":
criteria.setIsDel(0);
criteria.setPaid(1);
criteria.setStatus(2);
criteria.setRefundStatus(0);
break;
case "4":
criteria.setIsDel(0);
criteria.setPaid(1);
criteria.setStatus(3);
criteria.setRefundStatus(0);
break;
case "-1":
criteria.setIsDel(0);
criteria.setPaid(1);
criteria.setRefundStatus(1);
break;
case "-2":
criteria.setIsDel(0);
criteria.setPaid(1);
criteria.setRefundStatus(2);
break;
case "-4":
criteria.setIsDel(1);
break;
}
}
return new ResponseEntity(yxStoreOrderService.queryAll(criteria,pageable),HttpStatus.OK);
}
@ApiOperation(value = "发货")
@PutMapping(value = "/yxStoreOrder")
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
public ResponseEntity update(@Validated @RequestBody YxStoreOrder resources){
YxExpressDTO expressDTO = yxExpressService.findById(Integer.valueOf(resources
.getDeliveryName()));
if(ObjectUtil.isNull(expressDTO)){
throw new BadRequestException("请先添加快递公司");
}
resources.setStatus(1);
resources.setDeliveryType("express");
resources.setDeliveryName(expressDTO.getName());
resources.setDeliverySn(expressDTO.getCode());
yxStoreOrderService.update(resources);
YxStoreOrderStatus storeOrderStatus = new YxStoreOrderStatus();
storeOrderStatus.setOid(resources.getId());
storeOrderStatus.setChangeType("delivery_goods");
storeOrderStatus.setChangeMessage("已发货 快递公司:"+resources.getDeliveryName()
+" 快递单号:"+resources.getDeliveryId());
storeOrderStatus.setChangeTime(OrderUtil.getSecondTimestampTwo());
yxStoreOrderStatusService.create(storeOrderStatus);
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
@ApiOperation(value = "退款")
@PostMapping(value = "/yxStoreOrder/refund")
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
public ResponseEntity refund(@Validated @RequestBody YxStoreOrder resources){
yxStoreOrderService.refund(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
@Log("删除")
@ApiOperation(value = "删除")
@DeleteMapping(value = "/yxStoreOrder/{id}")
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREORDER_ALL','YXSTOREORDER_DELETE')")
public ResponseEntity delete(@PathVariable Integer id){
yxStoreOrderService.delete(id);
return new ResponseEntity(HttpStatus.OK);
}
}

View File

@ -0,0 +1,128 @@
package co.yixiang.modules.shop.rest;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import co.yixiang.exception.BadRequestException;
import co.yixiang.utils.OrderUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import co.yixiang.aop.log.Log;
import co.yixiang.modules.shop.domain.YxStoreProduct;
import co.yixiang.modules.shop.service.YxStoreProductService;
import co.yixiang.modules.shop.service.dto.YxStoreProductQueryCriteria;
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.*;
import java.math.BigDecimal;
/**
* @author hupeng
* @date 2019-10-04
*/
@Api(tags = "商品管理")
@RestController
@RequestMapping("api")
public class YxStoreProductController {
@Autowired
private YxStoreProductService yxStoreProductService;
@Log("查询商品")
@ApiOperation(value = "查询商品")
@GetMapping(value = "/yxStoreProduct")
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREPRODUCT_ALL','YXSTOREPRODUCT_SELECT')")
public ResponseEntity getYxStoreProducts(YxStoreProductQueryCriteria criteria, Pageable pageable){
return new ResponseEntity(yxStoreProductService.queryAll(criteria,pageable),HttpStatus.OK);
}
@Log("新增商品")
@ApiOperation(value = "新增商品")
@PostMapping(value = "/yxStoreProduct")
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREPRODUCT_ALL','YXSTOREPRODUCT_CREATE')")
public ResponseEntity create(@Validated @RequestBody YxStoreProduct resources){
//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);
return new ResponseEntity(yxStoreProductService.create(resources),HttpStatus.CREATED);
}
@Log("修改商品")
@ApiOperation(value = "修改商品")
@PutMapping(value = "/yxStoreProduct")
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREPRODUCT_ALL','YXSTOREPRODUCT_EDIT')")
public ResponseEntity update(@Validated @RequestBody YxStoreProduct resources){
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
yxStoreProductService.update(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
@Log("删除商品")
@ApiOperation(value = "删除商品")
@DeleteMapping(value = "/yxStoreProduct/{id}")
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREPRODUCT_ALL','YXSTOREPRODUCT_DELETE')")
public ResponseEntity delete(@PathVariable Integer id){
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
yxStoreProductService.delete(id);
return new ResponseEntity(HttpStatus.OK);
}
@ApiOperation(value = "恢复数据")
@DeleteMapping(value = "/yxStoreProduct/recovery/{id}")
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREPRODUCT_ALL','YXSTOREPRODUCT_DELETE')")
public ResponseEntity recovery(@PathVariable Integer id){
yxStoreProductService.recovery(id);
return new ResponseEntity(HttpStatus.OK);
}
@ApiOperation(value = "商品上架下架")
@PostMapping(value = "/yxStoreProduct/onsale/{id}")
public ResponseEntity onSale(@PathVariable Integer id,@RequestBody String jsonStr){
JSONObject jsonObject = JSON.parseObject(jsonStr);
int status = Integer.valueOf(jsonObject.get("status").toString());
//System.out.println(status);
yxStoreProductService.onSale(id,status);
return new ResponseEntity(HttpStatus.OK);
}
@ApiOperation(value = "生成属性")
@PostMapping(value = "/yxStoreProduct/isFormatAttr/{id}")
public ResponseEntity isFormatAttr(@PathVariable Integer id,@RequestBody String jsonStr){
return new ResponseEntity(yxStoreProductService.isFormatAttr(id,jsonStr),HttpStatus.OK);
}
@ApiOperation(value = "设置保存属性")
@PostMapping(value = "/yxStoreProduct/setAttr/{id}")
public ResponseEntity setAttr(@PathVariable Integer id,@RequestBody String jsonStr){
yxStoreProductService.createProductAttr(id,jsonStr);
return new ResponseEntity(HttpStatus.OK);
}
@ApiOperation(value = "清除属性")
@PostMapping(value = "/yxStoreProduct/clearAttr/{id}")
public ResponseEntity clearAttr(@PathVariable Integer id){
yxStoreProductService.clearProductAttr(id,true);
return new ResponseEntity(HttpStatus.OK);
}
@ApiOperation(value = "获取属性")
@GetMapping(value = "/yxStoreProduct/attr/{id}")
public ResponseEntity attr(@PathVariable Integer id){
String str = yxStoreProductService.getStoreProductAttrResult(id);
if(StrUtil.isEmpty(str)){
return new ResponseEntity(HttpStatus.OK);
}
JSONObject jsonObject = JSON.parseObject(str);
return new ResponseEntity(jsonObject,HttpStatus.OK);
}
}

View File

@ -0,0 +1,59 @@
package co.yixiang.modules.shop.rest;
import co.yixiang.aop.log.Log;
import co.yixiang.modules.shop.domain.YxStoreProductReply;
import co.yixiang.modules.shop.service.YxStoreProductReplyService;
import co.yixiang.modules.shop.service.dto.YxStoreProductReplyQueryCriteria;
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-11-03
*/
@Api(tags = "评论管理")
@RestController
@RequestMapping("api")
public class YxStoreProductReplyController {
@Autowired
private YxStoreProductReplyService yxStoreProductReplyService;
@Log("查询")
@ApiOperation(value = "查询")
@GetMapping(value = "/yxStoreProductReply")
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREPRODUCTREPLY_ALL','YXSTOREPRODUCTREPLY_SELECT')")
public ResponseEntity getYxStoreProductReplys(YxStoreProductReplyQueryCriteria criteria, Pageable pageable){
criteria.setIsDel(0);
return new ResponseEntity(yxStoreProductReplyService.queryAll(criteria,pageable),HttpStatus.OK);
}
@Log("修改")
@ApiOperation(value = "修改")
@PutMapping(value = "/yxStoreProductReply")
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREPRODUCTREPLY_ALL','YXSTOREPRODUCTREPLY_EDIT')")
public ResponseEntity update(@Validated @RequestBody YxStoreProductReply resources){
yxStoreProductReplyService.update(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
@Log("删除")
@ApiOperation(value = "删除")
@DeleteMapping(value = "/yxStoreProductReply/{id}")
@PreAuthorize("hasAnyRole('ADMIN','YXSTOREPRODUCTREPLY_ALL','YXSTOREPRODUCTREPLY_DELETE')")
public ResponseEntity delete(@PathVariable Integer id){
YxStoreProductReply reply = new YxStoreProductReply();
reply.setIsDel(1);
reply.setId(id);
yxStoreProductReplyService.update(reply);
return new ResponseEntity(HttpStatus.OK);
}
}

View File

@ -0,0 +1,130 @@
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.YxSystemGroupData;
import co.yixiang.modules.shop.service.YxSystemGroupDataService;
import co.yixiang.modules.shop.service.dto.YxSystemGroupDataQueryCriteria;
import co.yixiang.utils.OrderUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
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-10-18
*/
@Api(tags = "数据配置管理")
@RestController
@RequestMapping("api")
public class YxSystemGroupDataController {
@Autowired
private YxSystemGroupDataService yxSystemGroupDataService;
@Log("查询数据配置")
@ApiOperation(value = "查询数据配置")
@GetMapping(value = "/yxSystemGroupData")
@PreAuthorize("hasAnyRole('ADMIN','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_SELECT')")
public ResponseEntity getYxSystemGroupDatas(YxSystemGroupDataQueryCriteria criteria, Pageable pageable){
return new ResponseEntity(yxSystemGroupDataService.queryAll(criteria,pageable),HttpStatus.OK);
}
@Log("新增数据配置")
@ApiOperation(value = "新增数据配置")
@PostMapping(value = "/yxSystemGroupData")
@PreAuthorize("hasAnyRole('ADMIN','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_CREATE')")
public ResponseEntity create(@RequestBody String jsonStr){
//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())){
throw new BadRequestException("名称必须填写");
}
}
if(ObjectUtil.isNotNull(jsonObject.get("title"))){
if(StrUtil.isEmpty(jsonObject.get("title").toString())){
throw new BadRequestException("标题必须填写");
}
}
if(ObjectUtil.isNotNull(jsonObject.get("info"))){
if(StrUtil.isEmpty(jsonObject.get("info").toString())){
throw new BadRequestException("简介必须填写");
}
}
if(ObjectUtil.isNotNull(jsonObject.get("pic"))){
if(StrUtil.isEmpty(jsonObject.get("pic").toString())){
throw new BadRequestException("图片必须上传");
}
}
YxSystemGroupData yxSystemGroupData = new YxSystemGroupData();
yxSystemGroupData.setGroupName(jsonObject.get("groupName").toString());
jsonObject.remove("groupName");
yxSystemGroupData.setValue(jsonObject.toJSONString());
yxSystemGroupData.setStatus(1);
yxSystemGroupData.setAddTime(OrderUtil.getSecondTimestampTwo());
return new ResponseEntity(yxSystemGroupDataService.create(yxSystemGroupData),HttpStatus.CREATED);
}
@Log("修改数据配置")
@ApiOperation(value = "修改数据配置")
@PutMapping(value = "/yxSystemGroupData")
@PreAuthorize("hasAnyRole('ADMIN','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_EDIT')")
public ResponseEntity update(@RequestBody String jsonStr){
//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())){
throw new BadRequestException("名称必须填写");
}
}
if(ObjectUtil.isNotNull(jsonObject.get("title"))){
if(StrUtil.isEmpty(jsonObject.get("title").toString())){
throw new BadRequestException("标题必须填写");
}
}
if(ObjectUtil.isNotNull(jsonObject.get("pic"))){
if(StrUtil.isEmpty(jsonObject.get("pic").toString())){
throw new BadRequestException("图片必须上传");
}
}
YxSystemGroupData yxSystemGroupData = new YxSystemGroupData();
yxSystemGroupData.setGroupName(jsonObject.get("groupName").toString());
jsonObject.remove("groupName");
yxSystemGroupData.setValue(jsonObject.toJSONString());
yxSystemGroupData.setId(Integer.valueOf(jsonObject.get("id").toString()));
yxSystemGroupDataService.update(yxSystemGroupData);
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
@Log("删除数据配置")
@ApiOperation(value = "删除数据配置")
@DeleteMapping(value = "/yxSystemGroupData/{id}")
@PreAuthorize("hasAnyRole('ADMIN','YXSYSTEMGROUPDATA_ALL','YXSYSTEMGROUPDATA_DELETE')")
public ResponseEntity delete(@PathVariable Integer id){
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
yxSystemGroupDataService.delete(id);
return new ResponseEntity(HttpStatus.OK);
}
}

Some files were not shown because too many files have changed in this diff Show More