前台接口功能完善
This commit is contained in:
parent
8be737c5ed
commit
c67688823b
|
@ -37,4 +37,16 @@ public class AccessTokenUtil {
|
||||||
}
|
}
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除token
|
||||||
|
* @param appId
|
||||||
|
*/
|
||||||
|
public static void clearToken(String appId) {
|
||||||
|
if (StringUtils.isBlank(appId)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
RedisCache redisCache = SpringUtils.getBean(RedisCache.class);
|
||||||
|
redisCache.deleteObject(CacheConstants.WX_ACCESS_TOKEN + appId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class WxAuthService {
|
||||||
* @param config
|
* @param config
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String getWxPhoneNumber(String mobileCode, WxConfig config) {
|
public String getWxPhoneNumber(String mobileCode, WxConfig config,boolean retry) {
|
||||||
String url = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=";
|
String url = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=";
|
||||||
|
|
||||||
// 根据手机号获取到用户名
|
// 根据手机号获取到用户名
|
||||||
|
@ -73,7 +73,12 @@ public class WxAuthService {
|
||||||
Integer errcode = body.getInteger("errcode");
|
Integer errcode = body.getInteger("errcode");
|
||||||
if (errcode == null || !errcode.equals(0)) {
|
if (errcode == null || !errcode.equals(0)) {
|
||||||
log.error("获取手机号失败 {}", body);
|
log.error("获取手机号失败 {}", body);
|
||||||
throw new ServiceException("获取手机号失败");
|
// 若获取手机号失败,则清除access_token,并且重试
|
||||||
|
AccessTokenUtil.clearToken(config.getAppId());
|
||||||
|
if (retry) {
|
||||||
|
return getWxPhoneNumber(mobileCode, config, false);
|
||||||
|
}
|
||||||
|
throw new ServiceException("获取手机号失败" + body.toJSONString());
|
||||||
}
|
}
|
||||||
|
|
||||||
String phoneInfo = body.getString("phone_info");
|
String phoneInfo = body.getString("phone_info");
|
||||||
|
|
|
@ -249,7 +249,7 @@ public class SysLoginService
|
||||||
|
|
||||||
// 优先使用手机号登录(如果提供了手机号验证码)
|
// 优先使用手机号登录(如果提供了手机号验证码)
|
||||||
if (StringUtils.hasText(body.getMobileCode())) {
|
if (StringUtils.hasText(body.getMobileCode())) {
|
||||||
phone = wxAuthService.getWxPhoneNumber(body.getMobileCode(), wxConfig);
|
phone = wxAuthService.getWxPhoneNumber(body.getMobileCode(), wxConfig,true);
|
||||||
|
|
||||||
// 查询用户
|
// 查询用户
|
||||||
user = userService.selectUserByUserName(phone);
|
user = userService.selectUserByUserName(phone);
|
||||||
|
|
|
@ -11,4 +11,5 @@ public class GoodsQuery extends GoodsVO{
|
||||||
@ApiModelProperty("商品ID列表")
|
@ApiModelProperty("商品ID列表")
|
||||||
private List<Long> goodsIds;
|
private List<Long> goodsIds;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,4 +18,7 @@ public class GoodsVO extends Goods{
|
||||||
@ApiModelProperty("商品SKU")
|
@ApiModelProperty("商品SKU")
|
||||||
private List<SkuVO> skuVO;
|
private List<SkuVO> skuVO;
|
||||||
|
|
||||||
|
@ApiModelProperty("所属分类")
|
||||||
|
private String categoryName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package com.ruoyi.bst.goods.mapper;
|
package com.ruoyi.bst.goods.mapper;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.ruoyi.bst.goods.domain.Goods;
|
import com.ruoyi.bst.goods.domain.Goods;
|
||||||
import com.ruoyi.bst.goods.domain.GoodsVO;
|
import com.ruoyi.bst.goods.domain.GoodsVO;
|
||||||
import com.ruoyi.bst.goods.domain.GoodsQuery;
|
import com.ruoyi.bst.goods.domain.GoodsQuery;
|
||||||
|
import com.ruoyi.common.domain.vo.LongStringVO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,4 +75,6 @@ public interface GoodsMapper
|
||||||
public int deleteGoodsByIds(@Param("ids") List<Long> ids);
|
public int deleteGoodsByIds(@Param("ids") List<Long> ids);
|
||||||
|
|
||||||
List<Long> selectIdByQuery(@Param("query") GoodsQuery query);
|
List<Long> selectIdByQuery(@Param("query") GoodsQuery query);
|
||||||
|
|
||||||
|
List<LongStringVO> selectGoodsNameGroupById(@Param("query") GoodsQuery query);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,8 @@
|
||||||
bg.create_time,
|
bg.create_time,
|
||||||
bg.min_price,
|
bg.min_price,
|
||||||
bg.max_price,
|
bg.max_price,
|
||||||
bg.total_stock
|
bg.total_stock,
|
||||||
|
bgc.name as category_name
|
||||||
from
|
from
|
||||||
<include refid="searchTables"/>
|
<include refid="searchTables"/>
|
||||||
</sql>
|
</sql>
|
||||||
|
@ -43,6 +44,7 @@
|
||||||
<sql id="searchTables">
|
<sql id="searchTables">
|
||||||
bst_goods bg
|
bst_goods bg
|
||||||
left join bst_store bs on bg.store_id = bs.store_id
|
left join bst_store bs on bg.store_id = bs.store_id
|
||||||
|
left join bst_goods_category bgc on bg.category_id = bgc.id
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="searchCondition">
|
<sql id="searchCondition">
|
||||||
|
@ -85,6 +87,16 @@
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectGoodsNameGroupById" resultType="com.ruoyi.common.domain.vo.LongStringVO">
|
||||||
|
select bg.id as `key`,
|
||||||
|
bg.name as `value`
|
||||||
|
from <include refid="searchTables"/>
|
||||||
|
<where>
|
||||||
|
<include refid="searchCondition"/>
|
||||||
|
</where>
|
||||||
|
group by `key`
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertGoods" parameterType="Goods" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertGoods" parameterType="Goods" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into bst_goods
|
insert into bst_goods
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package com.ruoyi.bst.goods.service;
|
package com.ruoyi.bst.goods.service;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.ruoyi.bst.goods.domain.Goods;
|
import com.ruoyi.bst.goods.domain.Goods;
|
||||||
import com.ruoyi.bst.goods.domain.GoodsVO;
|
import com.ruoyi.bst.goods.domain.GoodsVO;
|
||||||
import com.ruoyi.bst.goods.domain.GoodsQuery;
|
import com.ruoyi.bst.goods.domain.GoodsQuery;
|
||||||
|
import com.ruoyi.common.domain.vo.LongStringVO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品Service接口
|
* 商品Service接口
|
||||||
|
@ -70,4 +72,7 @@ public interface GoodsService
|
||||||
int updateGoodsBasicInfo(Goods goods);
|
int updateGoodsBasicInfo(Goods goods);
|
||||||
|
|
||||||
|
|
||||||
|
void assembler(List<GoodsVO> list);
|
||||||
|
|
||||||
|
List<LongStringVO> selectGoodsNameGroupById(GoodsQuery query);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,13 @@ import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.ruoyi.bst.goods.service.GoodsAssembler;
|
||||||
import com.ruoyi.bst.goods.service.GoodsService;
|
import com.ruoyi.bst.goods.service.GoodsService;
|
||||||
import com.ruoyi.bst.sku.domain.Sku;
|
import com.ruoyi.bst.sku.domain.Sku;
|
||||||
import com.ruoyi.bst.sku.domain.SkuQuery;
|
import com.ruoyi.bst.sku.domain.SkuQuery;
|
||||||
import com.ruoyi.bst.sku.domain.SkuVO;
|
import com.ruoyi.bst.sku.domain.SkuVO;
|
||||||
import com.ruoyi.bst.sku.service.SkuService;
|
import com.ruoyi.bst.sku.service.SkuService;
|
||||||
|
import com.ruoyi.bst.spec.domain.Spec;
|
||||||
import com.ruoyi.bst.spec.domain.SpecQuery;
|
import com.ruoyi.bst.spec.domain.SpecQuery;
|
||||||
import com.ruoyi.bst.spec.domain.SpecVO;
|
import com.ruoyi.bst.spec.domain.SpecVO;
|
||||||
import com.ruoyi.bst.spec.service.SpecAssembler;
|
import com.ruoyi.bst.spec.service.SpecAssembler;
|
||||||
|
@ -19,6 +21,7 @@ import com.ruoyi.bst.specValue.domain.SpecValue;
|
||||||
import com.ruoyi.bst.specValue.domain.SpecValueVO;
|
import com.ruoyi.bst.specValue.domain.SpecValueVO;
|
||||||
import com.ruoyi.bst.specValue.service.SpecValueService;
|
import com.ruoyi.bst.specValue.service.SpecValueService;
|
||||||
import com.ruoyi.bst.storeStaff.domain.enums.StoreStaffPermission;
|
import com.ruoyi.bst.storeStaff.domain.enums.StoreStaffPermission;
|
||||||
|
import com.ruoyi.common.domain.vo.LongStringVO;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.common.utils.ServiceUtil;
|
import com.ruoyi.common.utils.ServiceUtil;
|
||||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||||
|
@ -52,6 +55,8 @@ public class GoodsServiceImpl implements GoodsService
|
||||||
private SkuService skuService;
|
private SkuService skuService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SpecAssembler specAssembler;
|
private SpecAssembler specAssembler;
|
||||||
|
@Autowired
|
||||||
|
private GoodsAssembler goodsAssembler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询商品
|
* 查询商品
|
||||||
|
@ -353,4 +358,16 @@ public class GoodsServiceImpl implements GoodsService
|
||||||
data.setStatus(goods.getStatus());
|
data.setStatus(goods.getStatus());
|
||||||
return goodsMapper.updateGoods(goods);
|
return goodsMapper.updateGoods(goods);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void assembler(List<GoodsVO> list) {
|
||||||
|
List<SpecVO> specList = new ArrayList<>();
|
||||||
|
goodsAssembler.assembleSpecList(list);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LongStringVO> selectGoodsNameGroupById(GoodsQuery query) {
|
||||||
|
return goodsMapper.selectGoodsNameGroupById(query);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ public class LocationAssemblerImpl implements LocationAssembler {
|
||||||
|
|
||||||
for (LocationVO location : list) {
|
for (LocationVO location : list) {
|
||||||
Integer currentNum = idToCurrentNum.get(location.getId());
|
Integer currentNum = idToCurrentNum.get(location.getId());
|
||||||
|
currentNum = currentNum == null ? 0 : currentNum;
|
||||||
location.setCurrentNum(currentNum);
|
location.setCurrentNum(currentNum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,15 @@ package com.ruoyi.bst.sku.domain;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class SkuQuery extends SkuVO {
|
public class SkuQuery extends SkuVO {
|
||||||
|
|
||||||
@ApiModelProperty("goodsId")
|
@ApiModelProperty("商品ID")
|
||||||
private Long goodsId;
|
private Long goodsId;
|
||||||
|
|
||||||
|
@ApiModelProperty("skuID列表")
|
||||||
|
private List<Long> skuIds;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.ruoyi.bst.storage.domain;
|
package com.ruoyi.bst.storage.domain;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -32,27 +33,27 @@ public class Storage extends BaseEntity
|
||||||
|
|
||||||
@Excel(name = "存放位置ID")
|
@Excel(name = "存放位置ID")
|
||||||
@ApiModelProperty("存放位置ID")
|
@ApiModelProperty("存放位置ID")
|
||||||
@NotNull(message = "存放位置ID不能为空",groups = {ValidGroup.Create.class})
|
|
||||||
private Long locationId;
|
private Long locationId;
|
||||||
|
|
||||||
@Excel(name = "店铺ID")
|
@Excel(name = "店铺ID")
|
||||||
@ApiModelProperty("店铺ID")
|
@ApiModelProperty("店铺ID")
|
||||||
@NotNull(message = "店铺ID不能为空",groups = {ValidGroup.Create.class})
|
|
||||||
private Long storeId;
|
private Long storeId;
|
||||||
|
|
||||||
|
@Excel(name = "商品ID")
|
||||||
|
@ApiModelProperty("商品ID不能为空")
|
||||||
|
@NotNull(message = "商品ID不能为空",groups = {ValidGroup.Create.class})
|
||||||
|
private Long goodsId;
|
||||||
|
|
||||||
@Excel(name = "用户ID")
|
@Excel(name = "用户ID")
|
||||||
@ApiModelProperty("用户ID")
|
@ApiModelProperty("用户ID")
|
||||||
@NotNull(message = "用户ID不能为空",groups = {ValidGroup.Create.class})
|
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
@Excel(name = "商品skuID")
|
@Excel(name = "商品skuID")
|
||||||
@ApiModelProperty("商品skuID")
|
@ApiModelProperty("商品skuID")
|
||||||
@NotNull(message = "商品skuID不能为空",groups = {ValidGroup.Create.class})
|
|
||||||
private Long skuId;
|
private Long skuId;
|
||||||
|
|
||||||
@Excel(name = "商品名称")
|
@Excel(name = "商品名称")
|
||||||
@ApiModelProperty("商品名称")
|
@ApiModelProperty("商品名称")
|
||||||
@NotBlank(message = "商品名称不能为空",groups = {ValidGroup.Create.class})
|
|
||||||
private String goodsName;
|
private String goodsName;
|
||||||
|
|
||||||
@Excel(name = "存放数量")
|
@Excel(name = "存放数量")
|
||||||
|
@ -67,10 +68,9 @@ public class Storage extends BaseEntity
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Excel(name = "存放期限", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
@Excel(name = "存放期限", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
@ApiModelProperty("存放期限")
|
@ApiModelProperty("存放期限")
|
||||||
private Date deadline;
|
private LocalDateTime deadline;
|
||||||
|
|
||||||
@ApiModelProperty("规格值列表")
|
@ApiModelProperty("规格值列表")
|
||||||
@NotNull(message = "规格值列表不能为空",groups = {ValidGroup.Create.class})
|
|
||||||
private List<SpecValue> specValue;
|
private List<SpecValue> specValue;
|
||||||
|
|
||||||
@Excel(name = "存放状态")
|
@Excel(name = "存放状态")
|
||||||
|
|
|
@ -17,4 +17,6 @@ public class StorageQuery extends StorageVO{
|
||||||
@ApiModelProperty("是否被取完")
|
@ApiModelProperty("是否被取完")
|
||||||
private Boolean takenAll;
|
private Boolean takenAll;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,6 @@ public class StorageVO extends Storage{
|
||||||
@ApiModelProperty("用户名称")
|
@ApiModelProperty("用户名称")
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
@ApiModelProperty("商品名称")
|
|
||||||
private String goodsName;
|
|
||||||
|
|
||||||
@ApiModelProperty("店铺名称")
|
@ApiModelProperty("店铺名称")
|
||||||
private String storeName;
|
private String storeName;
|
||||||
|
|
||||||
|
@ -22,9 +19,6 @@ public class StorageVO extends Storage{
|
||||||
@ApiModelProperty("当前数量")
|
@ApiModelProperty("当前数量")
|
||||||
private Integer currentNum;
|
private Integer currentNum;
|
||||||
|
|
||||||
@ApiModelProperty("商品ID")
|
|
||||||
private Long goodsId;
|
|
||||||
|
|
||||||
public Integer getCurrentNum() {
|
public Integer getCurrentNum() {
|
||||||
return getTotalNum() - getTakenNum();
|
return getTotalNum() - getTakenNum();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,23 @@
|
||||||
package com.ruoyi.bst.storage.domain.dto;
|
package com.ruoyi.bst.storage.domain.dto;
|
||||||
|
|
||||||
import com.ruoyi.bst.storage.domain.Storage;
|
import com.ruoyi.bst.storage.domain.Storage;
|
||||||
|
import com.ruoyi.bst.storage.domain.StorageVO;
|
||||||
import com.ruoyi.common.core.validate.ValidGroup;
|
import com.ruoyi.common.core.validate.ValidGroup;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class DepositStorageDTO {
|
public class DepositStorageDTO {
|
||||||
|
|
||||||
|
@ApiModelProperty("店铺ID")
|
||||||
|
@NotNull(message = "店铺ID不能为空",groups = ValidGroup.Create.class)
|
||||||
|
private Long storeId;
|
||||||
|
|
||||||
@ApiModelProperty("用户电话")
|
@ApiModelProperty("用户电话")
|
||||||
@NotNull(message = "用户电话不能为空",groups = ValidGroup.Create.class)
|
@NotNull(message = "用户电话不能为空",groups = ValidGroup.Create.class)
|
||||||
private String phone;
|
private String phone;
|
||||||
|
@ -19,9 +25,17 @@ public class DepositStorageDTO {
|
||||||
@ApiModelProperty("备注")
|
@ApiModelProperty("备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
@ApiModelProperty("存放位置ID")
|
||||||
|
@NotNull(message = "存放位置ID不能为空",groups = ValidGroup.Create.class)
|
||||||
|
private Long locationId;
|
||||||
|
|
||||||
|
@ApiModelProperty("存放天数")
|
||||||
|
private Integer storageDays;
|
||||||
|
|
||||||
@Valid
|
@Valid
|
||||||
@ApiModelProperty("存酒信息")
|
@ApiModelProperty("存酒信息")
|
||||||
@NotNull(message = "存酒信息不能为空",groups = ValidGroup.Create.class)
|
@NotNull(message = "存酒信息不能为空",groups = ValidGroup.Create.class)
|
||||||
private List<Storage> storage;
|
private List<Storage> storage;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
<result property="storeId" column="store_id"/>
|
<result property="storeId" column="store_id"/>
|
||||||
<result property="userId" column="user_id"/>
|
<result property="userId" column="user_id"/>
|
||||||
<result property="skuId" column="sku_id"/>
|
<result property="skuId" column="sku_id"/>
|
||||||
<result property="goodsName" column="goods_name"/>
|
|
||||||
<result property="totalNum" column="total_num"/>
|
<result property="totalNum" column="total_num"/>
|
||||||
<result property="takenNum" column="taken_num"/>
|
<result property="takenNum" column="taken_num"/>
|
||||||
<result property="deadline" column="deadline"/>
|
<result property="deadline" column="deadline"/>
|
||||||
|
@ -19,6 +18,7 @@
|
||||||
<result property="remark" column="remark"/>
|
<result property="remark" column="remark"/>
|
||||||
<result property="status" column="status"/>
|
<result property="status" column="status"/>
|
||||||
<result property="createTime" column="create_time"/>
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="goodsId" column="goods_id"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectStorageVo">
|
<sql id="selectStorageVo">
|
||||||
|
@ -32,12 +32,10 @@
|
||||||
bst.total_num,
|
bst.total_num,
|
||||||
bst.taken_num,
|
bst.taken_num,
|
||||||
bst.deadline,
|
bst.deadline,
|
||||||
bst.spec_value,
|
|
||||||
bst.remark,
|
bst.remark,
|
||||||
bst.create_time,
|
bst.create_time,
|
||||||
bst.status,
|
bst.status,
|
||||||
bg.name as goods_name,
|
bg.name as goods_name,
|
||||||
bg.id as goods_id,
|
|
||||||
bstor.store_name,
|
bstor.store_name,
|
||||||
su.user_name,
|
su.user_name,
|
||||||
bl.name as location_name
|
bl.name as location_name
|
||||||
|
@ -47,8 +45,7 @@
|
||||||
|
|
||||||
<sql id="searchTables">
|
<sql id="searchTables">
|
||||||
bst_storage bst
|
bst_storage bst
|
||||||
left join bst_sku bsk on bst.sku_id = bsk.id
|
left join bst_goods bg on bst.goods_id = bg.id
|
||||||
left join bst_goods bg on bsk.goods_id = bg.id
|
|
||||||
left join sys_user su on bst.user_id = su.user_id
|
left join sys_user su on bst.user_id = su.user_id
|
||||||
left join bst_store bstor on bst.store_id = bstor.store_id
|
left join bst_store bstor on bst.store_id = bstor.store_id
|
||||||
left join bst_location bl on bst.location_id = bl.id
|
left join bst_location bl on bst.location_id = bl.id
|
||||||
|
@ -165,13 +162,13 @@
|
||||||
store_id,
|
store_id,
|
||||||
user_id,
|
user_id,
|
||||||
sku_id,
|
sku_id,
|
||||||
goods_name,
|
|
||||||
total_num,
|
total_num,
|
||||||
taken_num,
|
taken_num,
|
||||||
deadline,
|
deadline,
|
||||||
spec_value,
|
spec_value,
|
||||||
remark,
|
remark,
|
||||||
create_time,
|
create_time,
|
||||||
|
goods_id,
|
||||||
</trim>
|
</trim>
|
||||||
values
|
values
|
||||||
<foreach collection="list" item="i" separator=",">
|
<foreach collection="list" item="i" separator=",">
|
||||||
|
@ -184,8 +181,6 @@
|
||||||
<if test="i.userId == null ">default,</if>
|
<if test="i.userId == null ">default,</if>
|
||||||
<if test="i.skuId != null ">#{i.skuId},</if>
|
<if test="i.skuId != null ">#{i.skuId},</if>
|
||||||
<if test="i.skuId == null ">default,</if>
|
<if test="i.skuId == null ">default,</if>
|
||||||
<if test="i.goodsName != null and i.goodsName != ''">#{i.goodsName},</if>
|
|
||||||
<if test="i.goodsName == null or i.goodsName == ''">default,</if>
|
|
||||||
<if test="i.totalNum != null ">#{i.totalNum},</if>
|
<if test="i.totalNum != null ">#{i.totalNum},</if>
|
||||||
<if test="i.totalNum == null ">default,</if>
|
<if test="i.totalNum == null ">default,</if>
|
||||||
<if test="i.takenNum != null ">#{i.takenNum},</if>
|
<if test="i.takenNum != null ">#{i.takenNum},</if>
|
||||||
|
@ -200,6 +195,8 @@
|
||||||
<if test="i.remark == null ">default,</if>
|
<if test="i.remark == null ">default,</if>
|
||||||
<if test="i.createTime != null ">#{i.createTime},</if>
|
<if test="i.createTime != null ">#{i.createTime},</if>
|
||||||
<if test="i.createTime == null ">default,</if>
|
<if test="i.createTime == null ">default,</if>
|
||||||
|
<if test="i.goodsId != null ">#{i.goodsId},</if>
|
||||||
|
<if test="i.goodsId == null ">default,</if>
|
||||||
</trim>
|
</trim>
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.ruoyi.bst.storage.service;
|
||||||
|
|
||||||
|
import com.ruoyi.bst.spec.domain.SpecVO;
|
||||||
|
import com.ruoyi.bst.storage.domain.Storage;
|
||||||
|
import com.ruoyi.bst.storage.domain.StorageVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface StorageAssembler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼接规格值列表
|
||||||
|
* @param list 规格项列表
|
||||||
|
*/
|
||||||
|
void assembleGoodsName(List<Storage> list);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.ruoyi.bst.storage.service.impl;
|
||||||
|
|
||||||
|
import com.ruoyi.bst.goods.domain.GoodsQuery;
|
||||||
|
import com.ruoyi.bst.goods.mapper.GoodsMapper;
|
||||||
|
import com.ruoyi.bst.goods.service.GoodsAssembler;
|
||||||
|
import com.ruoyi.bst.goods.service.GoodsService;
|
||||||
|
import com.ruoyi.bst.sku.domain.SkuQuery;
|
||||||
|
import com.ruoyi.bst.sku.domain.SkuVO;
|
||||||
|
import com.ruoyi.bst.sku.mapper.SkuMapper;
|
||||||
|
import com.ruoyi.bst.spec.domain.SpecVO;
|
||||||
|
import com.ruoyi.bst.spec.service.SpecAssembler;
|
||||||
|
import com.ruoyi.bst.specValue.domain.SpecValueQuery;
|
||||||
|
import com.ruoyi.bst.specValue.domain.SpecValueVO;
|
||||||
|
import com.ruoyi.bst.specValue.service.SpecValueService;
|
||||||
|
import com.ruoyi.bst.storage.domain.Storage;
|
||||||
|
import com.ruoyi.bst.storage.domain.StorageQuery;
|
||||||
|
import com.ruoyi.bst.storage.domain.StorageVO;
|
||||||
|
import com.ruoyi.bst.storage.mapper.StorageMapper;
|
||||||
|
import com.ruoyi.bst.storage.service.StorageAssembler;
|
||||||
|
import com.ruoyi.common.core.domain.vo.UserVO;
|
||||||
|
import com.ruoyi.common.domain.vo.LongIntegerVO;
|
||||||
|
import com.ruoyi.common.domain.vo.LongStringVO;
|
||||||
|
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||||
|
import javafx.util.converter.LongStringConverter;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class StorageAssemblerImpl implements StorageAssembler {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SpecValueService specValueService;
|
||||||
|
@Autowired
|
||||||
|
private StorageMapper storageMapper;
|
||||||
|
@Autowired
|
||||||
|
private SkuMapper skuMapper;
|
||||||
|
@Autowired
|
||||||
|
private GoodsService goodsService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void assembleGoodsName(List<Storage> list) {
|
||||||
|
if (CollectionUtils.isEmptyElement(list)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<Long> goodsIds = list.stream().map(Storage::getGoodsId).collect(Collectors.toList());
|
||||||
|
GoodsQuery query = new GoodsQuery();
|
||||||
|
query.setGoodsIds(goodsIds);
|
||||||
|
|
||||||
|
Map<Long, String> idToNameMap = goodsService.selectGoodsNameGroupById(query)
|
||||||
|
.stream().collect(Collectors.toMap(LongStringVO::getKey, LongStringVO::getValue));
|
||||||
|
for (Storage storage : list) {
|
||||||
|
storage.setGoodsName(idToNameMap.get(storage.getGoodsId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package com.ruoyi.bst.storage.service.impl;
|
package com.ruoyi.bst.storage.service.impl;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -7,11 +8,14 @@ import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.ruoyi.bst.goods.service.GoodsAssembler;
|
||||||
import com.ruoyi.bst.location.domain.LocationQuery;
|
import com.ruoyi.bst.location.domain.LocationQuery;
|
||||||
import com.ruoyi.bst.location.domain.LocationVO;
|
import com.ruoyi.bst.location.domain.LocationVO;
|
||||||
|
import com.ruoyi.bst.sku.service.SkuService;
|
||||||
import com.ruoyi.bst.storage.domain.dto.DepositStorageDTO;
|
import com.ruoyi.bst.storage.domain.dto.DepositStorageDTO;
|
||||||
import com.ruoyi.bst.storage.domain.dto.TakeOutWineDTO;
|
import com.ruoyi.bst.storage.domain.dto.TakeOutWineDTO;
|
||||||
import com.ruoyi.bst.storage.domain.enums.StorageStatus;
|
import com.ruoyi.bst.storage.domain.enums.StorageStatus;
|
||||||
|
import com.ruoyi.bst.storage.service.StorageAssembler;
|
||||||
import com.ruoyi.bst.storageRecord.domain.StorageRecord;
|
import com.ruoyi.bst.storageRecord.domain.StorageRecord;
|
||||||
import com.ruoyi.bst.storageRecord.service.StorageRecordService;
|
import com.ruoyi.bst.storageRecord.service.StorageRecordService;
|
||||||
import com.ruoyi.bst.storeStaff.domain.enums.StoreStaffPermission;
|
import com.ruoyi.bst.storeStaff.domain.enums.StoreStaffPermission;
|
||||||
|
@ -47,6 +51,12 @@ public class StorageServiceImpl implements StorageService {
|
||||||
private StorageService storageService;
|
private StorageService storageService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
@Autowired
|
||||||
|
private SkuService skuService;
|
||||||
|
@Autowired
|
||||||
|
private GoodsAssembler goodsAssembler;
|
||||||
|
@Autowired
|
||||||
|
private StorageAssembler storageAssembler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询存酒
|
* 查询存酒
|
||||||
|
@ -139,9 +149,13 @@ public class StorageServiceImpl implements StorageService {
|
||||||
UserVO user = userService.selectUserByPhonenumber(dto.getPhone());
|
UserVO user = userService.selectUserByPhonenumber(dto.getPhone());
|
||||||
ServiceUtil.assertion(user == null,"当前用户不存在");
|
ServiceUtil.assertion(user == null,"当前用户不存在");
|
||||||
|
|
||||||
|
storageAssembler.assembleGoodsName(dto.getStorage());
|
||||||
// 设置对应属性进行批量插入
|
// 设置对应属性进行批量插入
|
||||||
dto.getStorage().forEach(storage -> {
|
dto.getStorage().forEach(storage -> {
|
||||||
storage.setRemark(dto.getRemark());
|
storage.setRemark(dto.getRemark());
|
||||||
|
storage.setStoreId(dto.getStoreId());
|
||||||
|
storage.setLocationId(dto.getLocationId());
|
||||||
|
storage.setDeadline(LocalDateTime.now().plusDays(dto.getStorageDays()));
|
||||||
storage.setCreateTime(DateUtils.getNowDate());
|
storage.setCreateTime(DateUtils.getNowDate());
|
||||||
storage.setUserId(user.getUserId());
|
storage.setUserId(user.getUserId());
|
||||||
list.add(storage);
|
list.add(storage);
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
package com.ruoyi.bst.storageRecord.domain;
|
package com.ruoyi.bst.storageRecord.domain;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class StorageRecordQuery extends StorageRecordVO{
|
public class StorageRecordQuery extends StorageRecordVO{
|
||||||
|
|
||||||
|
@ApiModelProperty("商品名称")
|
||||||
|
private String goodsName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
bg.id as goods_id,
|
bg.id as goods_id,
|
||||||
su.user_name,
|
su.user_name,
|
||||||
bst.goods_name,
|
bst.goods_name,
|
||||||
bst.spec_value,
|
|
||||||
bst.total_num,
|
bst.total_num,
|
||||||
bst.taken_num
|
bst.taken_num
|
||||||
from <include refid="searchTables"/>
|
from <include refid="searchTables"/>
|
||||||
|
@ -53,8 +52,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="query.storeId != null "> and bsr.store_id = #{query.storeId}</if>
|
<if test="query.storeId != null "> and bsr.store_id = #{query.storeId}</if>
|
||||||
<if test="query.userId != null "> and bsr.user_id = #{query.userId}</if>
|
<if test="query.userId != null "> and bsr.user_id = #{query.userId}</if>
|
||||||
<if test="query.reason != null and query.reason != ''"> and bsr.reason = #{query.reason}</if>
|
<if test="query.reason != null and query.reason != ''"> and bsr.reason = #{query.reason}</if>
|
||||||
<if test="query.storeName != null and query.storeName != ''"> and bs.store_name = #{query.storeName}</if>
|
<if test="query.storeName != null and query.storeName != ''"> and bs.store_name like concat ('%',#{query.storeName},'%') </if>
|
||||||
<if test="query.userName != null and query.userName != ''"> and su.user_name = #{query.userName}</if>
|
<if test="query.userName != null and query.userName != ''"> and su.user_name like concat ('%',#{query.userName},'%') </if>
|
||||||
|
<if test="query.goodsName != null and query.goodsName != ''"> and bg.name like concat ('%',#{query.goodsName},'%') </if>
|
||||||
<if test="query.number != null "> and bsr.umber = #{query.number}</if>
|
<if test="query.number != null "> and bsr.umber = #{query.number}</if>
|
||||||
${@com.ruoyi.framework.util.DataScopeUtil@create(query.scope)
|
${@com.ruoyi.framework.util.DataScopeUtil@create(query.scope)
|
||||||
.userSetAlias("bs.user_id")
|
.userSetAlias("bs.user_id")
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.ruoyi.common.domain.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class LongStringVO {
|
||||||
|
|
||||||
|
private Long key;
|
||||||
|
|
||||||
|
private String value;
|
||||||
|
}
|
|
@ -34,10 +34,8 @@ public class ChatTask {
|
||||||
|
|
||||||
List<ChatCacheDTO> cacheList = redisCache.getAndClearCacheList(pendingKey);
|
List<ChatCacheDTO> cacheList = redisCache.getAndClearCacheList(pendingKey);
|
||||||
|
|
||||||
// TODO 批量新增主表
|
|
||||||
List<Chat> chatList = CollectionUtils.map(cacheList, ChatCacheDTO::getChat);
|
List<Chat> chatList = CollectionUtils.map(cacheList, ChatCacheDTO::getChat);
|
||||||
|
|
||||||
// TODO 获取子表数据,并扁平化
|
|
||||||
List<ChatMsg> msgList = cacheList.stream().map(ChatCacheDTO::getMsgList).flatMap(Collection::stream).collect(Collectors.toList());
|
List<ChatMsg> msgList = cacheList.stream().map(ChatCacheDTO::getMsgList).flatMap(Collection::stream).collect(Collectors.toList());
|
||||||
|
|
||||||
// 数据库操作
|
// 数据库操作
|
||||||
|
|
|
@ -26,9 +26,11 @@ public class AppStorageController extends BaseController {
|
||||||
@ApiOperation("我的存酒信息")
|
@ApiOperation("我的存酒信息")
|
||||||
@GetMapping("/myWine")
|
@GetMapping("/myWine")
|
||||||
public TableDataInfo myWine(@RequestParam Long storeId) {
|
public TableDataInfo myWine(@RequestParam Long storeId) {
|
||||||
|
startPage();
|
||||||
StorageQuery query = new StorageQuery();
|
StorageQuery query = new StorageQuery();
|
||||||
query.setUserId(getUserId());
|
query.setUserId(getUserId());
|
||||||
query.setStoreId(storeId);
|
query.setStoreId(storeId);
|
||||||
|
query.setTakenAll(false);
|
||||||
return getDataTable(storageService.selectStorageList(query));
|
return getDataTable(storageService.selectStorageList(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.ruoyi.web.bst;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.ruoyi.bst.goods.service.GoodsAssembler;
|
||||||
import com.ruoyi.bst.goods.service.GoodsConverter;
|
import com.ruoyi.bst.goods.service.GoodsConverter;
|
||||||
import com.ruoyi.bst.goods.service.GoodsService;
|
import com.ruoyi.bst.goods.service.GoodsService;
|
||||||
import com.ruoyi.bst.goods.service.GoodsValidator;
|
import com.ruoyi.bst.goods.service.GoodsValidator;
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class StorageController extends BaseController
|
||||||
* 导出存酒列表
|
* 导出存酒列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('bst:storage:export')")
|
@PreAuthorize("@ss.hasPermi('bst:storage:export')")
|
||||||
@Log(title = "存酒", businessType = BusinessType.EXPORT)
|
@Log(title = "导出存酒列表", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, StorageQuery query)
|
public void export(HttpServletResponse response, StorageQuery query)
|
||||||
{
|
{
|
||||||
|
@ -98,7 +98,7 @@ public class StorageController extends BaseController
|
||||||
* 修改存酒
|
* 修改存酒
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('bst:storage:edit')")
|
@PreAuthorize("@ss.hasPermi('bst:storage:edit')")
|
||||||
@Log(title = "存酒", businessType = BusinessType.UPDATE)
|
@Log(title = "修改存酒信息", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody @Validated(ValidGroup.Update.class) Storage storage)
|
public AjaxResult edit(@RequestBody @Validated(ValidGroup.Update.class) Storage storage)
|
||||||
{
|
{
|
||||||
|
@ -115,6 +115,14 @@ public class StorageController extends BaseController
|
||||||
@Log(title = "存酒", businessType = BusinessType.OTHER)
|
@Log(title = "存酒", businessType = BusinessType.OTHER)
|
||||||
@PutMapping("/storageWine")
|
@PutMapping("/storageWine")
|
||||||
public AjaxResult storageWine(@RequestBody @Validated(ValidGroup.Create.class) DepositStorageDTO dto) {
|
public AjaxResult storageWine(@RequestBody @Validated(ValidGroup.Create.class) DepositStorageDTO dto) {
|
||||||
|
// 权限校验
|
||||||
|
List<Long> ids = new ArrayList<>();
|
||||||
|
dto.getStorage().forEach(storage -> {
|
||||||
|
ids.add(storage.getId());
|
||||||
|
});
|
||||||
|
if (!storageValidator.canEdit(ids)){
|
||||||
|
return AjaxResult.error("您无权限修改当前存酒信息");
|
||||||
|
}
|
||||||
return AjaxResult.success(storageService.storageWine(dto));
|
return AjaxResult.success(storageService.storageWine(dto));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user