修复订单发货 退款 核销等问题 增加了实体验证等

This commit is contained in:
hupeng
2020-05-18 21:13:10 +08:00
parent b1add77a43
commit 0f0f1e2b6b
18 changed files with 177 additions and 15 deletions

View File

@ -11,6 +11,8 @@ import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
@ -33,10 +35,12 @@ public class YxStoreBargain implements Serializable {
/** 砍价活动名称 */
@NotBlank(message = "请填写砍价名称")
private String title;
/** 砍价活动图片 */
@NotBlank(message = "请上传商品图片")
private String image;
@ -45,6 +49,8 @@ public class YxStoreBargain implements Serializable {
/** 库存 */
@NotNull(message = "请输入库存")
@Min(message = "库存不能小于0",value = 1)
private Integer stock;
@ -53,6 +59,7 @@ public class YxStoreBargain implements Serializable {
/** 砍价产品轮播图 */
@NotBlank(message = "请上传商品轮播")
private String images;
@ -69,26 +76,42 @@ public class YxStoreBargain implements Serializable {
/** 砍价金额 */
@NotNull(message = "请输入砍价金额")
@DecimalMin(value="0.00", message = "砍价金额不在合法范围内" )
@DecimalMax(value="99999999.99", message = "砍价金额不在合法范围内")
private BigDecimal price;
/** 砍价商品最低价 */
@NotNull(message = "请输入砍到最低价")
@DecimalMin(value="0.00", message = "砍到最低价不在合法范围内" )
@DecimalMax(value="99999999.99", message = "砍到最低价不在合法范围内")
private BigDecimal minPrice;
/** 每次购买的砍价产品数量 */
@NotNull(message = "请输入限购")
@Min(message = "限购不能小于0",value = 1)
private Integer num;
/** 用户每次砍价的最大金额 */
@NotNull(message = "请输入单次砍最高价")
@DecimalMin(value="0.00", message = "单次砍最高价不在合法范围内" )
@DecimalMax(value="99999999.99", message = "单次砍最高价不在合法范围内")
private BigDecimal bargainMaxPrice;
/** 用户每次砍价的最小金额 */
@NotNull(message = "请输入单次砍最低价")
@DecimalMin(value="0.00", message = "单次砍最低价不在合法范围内" )
@DecimalMax(value="99999999.99", message = "单次砍最低价小金额不在合法范围内")
private BigDecimal bargainMinPrice;
/** 用户每次砍价的次数 */
@NotNull(message = "请输入砍价的次数")
@Min(message = "砍价的次数不能小于0",value = 1)
private Integer bargainNum;
@ -97,6 +120,7 @@ public class YxStoreBargain implements Serializable {
/** 砍价详情 */
@NotBlank(message = "请填写详情")
private String description;
@ -137,6 +161,7 @@ public class YxStoreBargain implements Serializable {
/** 砍价规则 */
@NotBlank(message = "请填写砍价规则")
private String rule;
@ -147,10 +172,10 @@ public class YxStoreBargain implements Serializable {
/** 砍价产品分享量 */
private Integer share;
@NotNull(message = "请选择结束时间")
private Timestamp endTimeDate;
@NotNull(message = "请选择开始时间")
private Timestamp startTimeDate;

View File

@ -11,6 +11,8 @@ import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
@ -36,14 +38,17 @@ public class YxStoreCombination implements Serializable {
/** 推荐图 */
@NotBlank(message = "请上传商品图片")
private String image;
/** 轮播图 */
@NotBlank(message = "请上传商品轮播")
private String images;
/** 活动标题 */
@NotBlank(message = "请填写拼团名称")
private String title;
@ -52,6 +57,8 @@ public class YxStoreCombination implements Serializable {
/** 参团人数 */
@NotNull(message = "请输入拼团人数")
@Min(message = "拼团人数小于0",value = 1)
private Integer people;
@ -60,6 +67,9 @@ public class YxStoreCombination implements Serializable {
/** 价格 */
@NotNull(message = "请输入拼团价")
@DecimalMin(value="0.00", message = "拼团价不在合法范围内" )
@DecimalMax(value="99999999.99", message = "拼团价不在合法范围内")
private BigDecimal price;
@ -72,6 +82,8 @@ public class YxStoreCombination implements Serializable {
/** 库存 */
@NotNull(message = "请输入库存")
@Min(message = "库存不能小于0",value = 1)
private Integer stock;
@ -106,6 +118,7 @@ public class YxStoreCombination implements Serializable {
/** 拼团内容 */
@NotBlank(message = "请填写详情")
private String description;
@ -118,6 +131,8 @@ public class YxStoreCombination implements Serializable {
/** 拼团订单有效时间 */
@NotNull(message = "请输入拼团时效")
@Min(message = "拼团时效不能小于0",value = 1)
private Integer effectiveTime;
@ -132,10 +147,10 @@ public class YxStoreCombination implements Serializable {
/** 单位名 */
private String unitName;
@NotNull(message = "请选择结束时间")
private Timestamp endTimeDate;
@NotNull(message = "请选择开始时间")
private Timestamp startTimeDate;

View File

@ -11,6 +11,11 @@ import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.io.Serializable;
@ -28,6 +33,7 @@ public class YxStoreCoupon implements Serializable {
/** 优惠券名称 */
@NotBlank(message = "请填写优惠券名称")
private String title;
@ -36,14 +42,19 @@ public class YxStoreCoupon implements Serializable {
/** 兑换的优惠券面值 */
@DecimalMin(value="0.00", message = "优惠券面值不在合法范围内" )
@DecimalMax(value="99999999.99", message = "优惠券面值不在合法范围内")
private BigDecimal couponPrice;
/** 最低消费多少金额可用优惠券 */
@DecimalMin(value="0.00", message = "最低消费不在合法范围内" )
@DecimalMax(value="99999999.99", message = "最低消费不在合法范围内")
private BigDecimal useMinPrice;
/** 优惠券有效期限(单位:天) */
@NotNull(message = "请输入有效期限")
private Integer couponTime;

View File

@ -11,6 +11,8 @@ import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.NotNull;
import java.sql.Timestamp;
import java.io.Serializable;
@ -64,9 +66,10 @@ public class YxStoreCouponIssue implements Serializable {
private Integer addTime;
@NotNull(message = "请选择结束时间")
private Timestamp endTimeDate;
@NotNull(message = "请选择开始时间")
private Timestamp startTimeDate;

View File

@ -11,6 +11,8 @@ import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
@ -33,14 +35,17 @@ public class YxStoreSeckill implements Serializable {
/** 推荐图 */
@NotBlank(message = "请上传商品图片")
private String image;
/** 轮播图 */
@NotBlank(message = "请上传商品轮播")
private String images;
/** 活动标题 */
@NotBlank(message = "请填写秒杀名称")
private String title;
@ -49,6 +54,9 @@ public class YxStoreSeckill implements Serializable {
/** 价格 */
@NotNull(message = "请输入秒杀价")
@DecimalMin(value="0.00", message = "秒杀价不在合法范围内" )
@DecimalMax(value="99999999.99", message = "秒杀价不在合法范围内")
private BigDecimal price;
@ -69,6 +77,8 @@ public class YxStoreSeckill implements Serializable {
/** 库存 */
@NotNull(message = "请输入库存")
@Min(message = "库存不能小于0",value = 1)
private Integer stock;
@ -85,6 +95,7 @@ public class YxStoreSeckill implements Serializable {
/** 内容 */
@NotBlank(message = "请填写详情")
private String description;
@ -117,20 +128,23 @@ public class YxStoreSeckill implements Serializable {
/** 最多秒杀几个 */
@NotNull(message = "请输入限购")
@Min(message = "限购不能小于0",value = 1)
private Integer num;
/** 显示 */
private Integer isShow;
@NotNull(message = "请选择秒杀结束时间")
private Timestamp endTimeDate;
@NotNull(message = "请选择秒杀开始时间")
private Timestamp startTimeDate;
/** 时间段id */
@NotNull(message = "请选择开始时间")
private Integer timeId;

View File

@ -11,6 +11,8 @@ import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
@ -28,10 +30,13 @@ public class YxExpress implements Serializable {
/** 快递公司简称 */
@NotBlank(message = "请输入快递公司编号")
private String code;
/** 快递公司全称 */
@NotBlank(message = "请输入快递公司名称")
private String name;

View File

@ -11,6 +11,8 @@ import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
@ -32,6 +34,7 @@ public class YxStoreCategory implements Serializable {
/** 分类名称 */
@NotBlank(message = "分类名称必填")
private String cateName;

View File

@ -12,6 +12,11 @@ import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.io.Serializable;
@ -34,14 +39,17 @@ public class YxStoreProduct implements Serializable {
/** 商品图片 */
@NotBlank(message = "请上传商品图片")
private String image;
/** 轮播图 */
@NotBlank(message = "请上传商品轮播")
private String sliderImage;
/** 商品名称 */
@NotBlank(message = "商品名称不能空")
private String storeName;
@ -58,10 +66,14 @@ public class YxStoreProduct implements Serializable {
/** 分类id */
@NotBlank(message = "请选择分类")
private String cateId;
/** 商品价格 */
@NotNull(message = "请输入商品价格")
@DecimalMin(value="0.00", message = "商品价格不在合法范围内" )
@DecimalMax(value="99999999.99", message = "商品价格不在合法范围内")
private BigDecimal price;
@ -70,6 +82,9 @@ public class YxStoreProduct implements Serializable {
/** 市场价 */
@NotNull(message = "请输入市场价")
@DecimalMin(value="0.00", message = "市场价不在合法范围内" )
@DecimalMax(value="99999999.99", message = "市场价不在合法范围内")
private BigDecimal otPrice;
@ -78,6 +93,7 @@ public class YxStoreProduct implements Serializable {
/** 单位名 */
@NotBlank(message = "请填写单位")
private String unitName;
@ -114,6 +130,7 @@ public class YxStoreProduct implements Serializable {
/** 产品描述 */
@NotBlank(message = "请填写商品详情")
private String description;
@ -134,10 +151,15 @@ public class YxStoreProduct implements Serializable {
/** 获得积分 */
@DecimalMin(value="0.00", message = "获得积分不在合法范围内" )
@DecimalMax(value="99999999.99", message = "获得积分不在合法范围内")
private BigDecimal giveIntegral;
/** 成本价 */
@NotNull(message = "请输入成本价")
@DecimalMin(value="0.00", message = "成本价不在合法范围内" )
@DecimalMax(value="99999999.99", message = "成本价不在合法范围内")
private BigDecimal cost;

View File

@ -11,7 +11,10 @@ import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;
/**
* @author hupeng
@ -27,18 +30,22 @@ public class YxSystemStore implements Serializable {
/** 门店名称 */
@NotBlank(message = "请填写门店名称")
private String name;
/** 简介 */
@NotBlank(message = "请填写门店简介")
private String introduction;
/** 手机号码 */
@NotBlank(message = "请填手机号码")
private String phone;
/** 省市区 */
@NotBlank(message = "请填地址")
private String address;
@ -47,22 +54,27 @@ public class YxSystemStore implements Serializable {
/** 门店logo */
@NotBlank(message = "请上传门店logo")
private String image;
/** 纬度 */
@NotBlank(message = "请输入纬度")
private String latitude;
/** 经度 */
@NotBlank(message = "请输入经度")
private String longitude;
/** 核销有效日期 */
@NotBlank(message = "请输入核销时效")
private String validTime;
/** 每日营业开关时间 */
@NotBlank(message = "请输入营业时间")
private String dayTime;
@ -78,6 +90,14 @@ public class YxSystemStore implements Serializable {
/** 是否删除 */
private Integer isDel;
private Date validTimeEnd;
private Date validTimeStart;
private Date dayTimeStart;
private Date dayTimeEnd;
public void copy(YxSystemStore source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));

View File

@ -11,6 +11,9 @@ import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
@ -31,18 +34,22 @@ public class YxSystemStoreStaff implements Serializable {
/** 店员头像 */
@NotBlank(message = "请选择用户")
private String avatar;
/** 门店id */
@NotNull(message = "请选择门店")
private Integer storeId;
/** 店员名称 */
@NotBlank(message = "请输入店员名称")
private String staffName;
/** 手机号码 */
@NotBlank(message = "请输入手机号码")
private String phone;

View File

@ -11,6 +11,9 @@ import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.io.Serializable;
@ -32,6 +35,7 @@ public class YxSystemUserLevel implements Serializable {
/** 会员名称 */
@NotBlank(message = "名称必填")
private String name;
@ -56,17 +60,21 @@ public class YxSystemUserLevel implements Serializable {
/** 会员等级 */
@NotNull(message = "请输入会员等级")
private Integer grade;
/** 享受折扣 */
@NotNull(message = "请输入会员折扣")
private BigDecimal discount;
/** 会员卡背景 */
@NotBlank(message = "请上传会员背景")
private String image;
/** 会员图标 */
@NotBlank(message = "请上传会员图标")
private String icon;

View File

@ -281,6 +281,7 @@ public class StoreOrderController {
String url = StrUtil.format(apiUrl+"/order/admin/order_verific/{}", resources.getVerifyCode());
String text = rest.getForObject(url, String.class);
JSONObject jsonObject = JSON.parseObject(text);
Integer status = jsonObject.getInteger("status");

View File

@ -10,10 +10,13 @@ package co.yixiang.modules.shop.rest;
import co.yixiang.logging.aop.log.Log;
import co.yixiang.dozer.service.IGenerator;
import co.yixiang.modules.shop.domain.YxSystemStore;
import co.yixiang.modules.shop.domain.YxSystemStoreStaff;
import co.yixiang.modules.shop.service.YxSystemStoreService;
import co.yixiang.modules.shop.service.YxSystemStoreStaffService;
import co.yixiang.modules.shop.service.dto.YxSystemStoreStaffDto;
import co.yixiang.modules.shop.service.dto.YxSystemStoreStaffQueryCriteria;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.Pageable;
@ -38,10 +41,12 @@ import java.util.Arrays;
public class SystemStoreStaffController {
private final YxSystemStoreStaffService yxSystemStoreStaffService;
private final YxSystemStoreService yxSystemStoreService;
private final IGenerator generator;
public SystemStoreStaffController(YxSystemStoreStaffService yxSystemStoreStaffService, IGenerator generator) {
public SystemStoreStaffController(YxSystemStoreService yxSystemStoreService,YxSystemStoreStaffService yxSystemStoreStaffService, IGenerator generator) {
this.yxSystemStoreService = yxSystemStoreService;
this.yxSystemStoreStaffService = yxSystemStoreStaffService;
this.generator = generator;
}
@ -67,6 +72,9 @@ public class SystemStoreStaffController {
@ApiOperation("新增门店店员")
@PreAuthorize("@el.check('yxSystemStoreStaff:add')")
public ResponseEntity<Object> create(@Validated @RequestBody YxSystemStoreStaff resources){
YxSystemStore systemStore = yxSystemStoreService.getOne(Wrappers.<YxSystemStore>lambdaQuery()
.eq(YxSystemStore::getId,resources.getStoreId()));
resources.setStoreName(systemStore.getName());
return new ResponseEntity<>(yxSystemStoreStaffService.save(resources),HttpStatus.CREATED);
}
@ -75,6 +83,9 @@ public class SystemStoreStaffController {
@ApiOperation("修改门店店员")
@PreAuthorize("@el.check('yxSystemStoreStaff:edit')")
public ResponseEntity<Object> update(@Validated @RequestBody YxSystemStoreStaff resources){
YxSystemStore systemStore = yxSystemStoreService.getOne(Wrappers.<YxSystemStore>lambdaQuery()
.eq(YxSystemStore::getId,resources.getStoreId()));
resources.setStoreName(systemStore.getName());
yxSystemStoreStaffService.saveOrUpdate(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}

View File

@ -10,6 +10,7 @@ package co.yixiang.modules.shop.service.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @author hupeng
@ -58,4 +59,13 @@ public class YxSystemStoreDto implements Serializable {
/** 是否删除 */
private Integer isDel;
private Date validTimeEnd;
private Date validTimeStart;
private Date dayTimeStart;
private Date dayTimeEnd;
}

View File

@ -231,7 +231,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
@Override
@Transactional(rollbackFor = Exception.class)
public YxStoreOrderDto create(YxStoreOrder resources) {
if(this.getOne(new QueryWrapper<YxStoreOrder>().eq("unique",resources.getUnique())) != null){
if(this.getOne(new QueryWrapper<YxStoreOrder>().eq("`unique`",resources.getUnique())) != null){
throw new EntityExistException(YxStoreOrder.class,"unique",resources.getUnique());
}
this.save(resources);
@ -242,7 +242,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
@Transactional(rollbackFor = Exception.class)
public void update(YxStoreOrder resources) {
YxStoreOrder yxStoreOrder = this.getById(resources.getId());
YxStoreOrder yxStoreOrder1 = this.getOne(new QueryWrapper<YxStoreOrder>().eq("unique",resources.getUnique()));
YxStoreOrder yxStoreOrder1 = this.getOne(new QueryWrapper<YxStoreOrder>().eq("`unique`",resources.getUnique()));
if(yxStoreOrder1 != null && !yxStoreOrder1.getId().equals(yxStoreOrder.getId())){
throw new EntityExistException(YxStoreOrder.class,"unique",resources.getUnique());
}
@ -422,7 +422,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
//修改状态
resources.setRefundStatus(2);
resources.setRefundPrice(resources.getPayPrice());
this.save(resources);
this.updateById(resources);
//退款到余额
YxUserDto userDTO = generator.convert(userService.getOne(new QueryWrapper<YxUser>().eq("uid",resources.getUid())),YxUserDto.class);