拼桌bug修正与新增商品功能完善
This commit is contained in:
parent
79c487eb20
commit
94e7d0c186
|
@ -1,7 +1,5 @@
|
|||
package com.ruoyi.bst.chat.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
@ -25,4 +23,7 @@ public class ChatQuery extends ChatVO{
|
|||
@ApiModelProperty("接收人名称")
|
||||
private String receiveName;
|
||||
|
||||
@ApiModelProperty("最大的ID,用于查询之前的数据")
|
||||
private Long latestId;
|
||||
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="query.deadline != null "> and bc.create_time < #{query.deadline}</if>
|
||||
<if test="query.senderName != null "> and su_send.nick_name like concat ('%',#{query.senderName},'%')</if>
|
||||
<if test="query.receiverName != null "> and su_receive.nick_name like concat ('%',#{query.receiverName},'%')</if>
|
||||
<if test="query.latestId != null "> and bc.id < #{query.latestId}</if>
|
||||
<if test="query.joinTime != null "> and bc.create_time > #{query.joinTime}</if>
|
||||
${query.params.dataScope}
|
||||
${@com.ruoyi.framework.util.DataScopeUtil@create(query.scope)
|
||||
|
|
|
@ -72,4 +72,5 @@ public interface ChatService
|
|||
List<ChatVO> selectTeamMsgList(ChatQuery query);
|
||||
|
||||
ChatVO selectOne(ChatQuery query);
|
||||
|
||||
}
|
||||
|
|
|
@ -186,6 +186,7 @@ public class ChatServiceImpl implements ChatService {
|
|||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int batchInsert(List<Chat> list) {
|
||||
if (CollectionUtils.isEmptyElement(list)) {
|
||||
|
|
|
@ -7,9 +7,11 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
|
|||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import org.apache.poi.hpsf.Decimal;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -65,6 +67,20 @@ public class Goods extends BaseEntity
|
|||
|
||||
@Excel(name = "排序")
|
||||
@ApiModelProperty("排序")
|
||||
private Long sort;
|
||||
private Integer sort;
|
||||
|
||||
@Excel(name = "最小价格")
|
||||
@ApiModelProperty("最小价格")
|
||||
private BigDecimal minPrice;
|
||||
|
||||
@Excel(name = "最大价格")
|
||||
@ApiModelProperty("最大价格")
|
||||
private BigDecimal maxPrice;
|
||||
|
||||
@Excel(name = "库存")
|
||||
@ApiModelProperty("库存")
|
||||
private Integer totalStock;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.ruoyi.bst.goods.domain;
|
|||
import com.ruoyi.bst.sku.domain.SkuVO;
|
||||
import com.ruoyi.bst.spec.domain.SpecVO;
|
||||
import com.ruoyi.bst.specValue.domain.SpecValueVO;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
|
@ -16,21 +16,28 @@
|
|||
<result property="status" column="status"/>
|
||||
<result property="sort" column="sort"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="minPrice" column="min_price"/>
|
||||
<result property="maxPrice" column="max_price"/>
|
||||
<result property="totalStock" column="total_stock"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectGoodsVo">
|
||||
select bg.id,
|
||||
bg.store_id,
|
||||
bg.category_id,
|
||||
bg.name,
|
||||
bg.image,
|
||||
bg.deposit,
|
||||
bg.sales,
|
||||
bg.virtual_sales,
|
||||
bg.status,
|
||||
bg.sort,
|
||||
bg.create_time
|
||||
from <include refid="searchTables"/>
|
||||
bg.store_id,
|
||||
bg.category_id,
|
||||
bg.name,
|
||||
bg.image,
|
||||
bg.deposit,
|
||||
bg.sales,
|
||||
bg.virtual_sales,
|
||||
bg.status,
|
||||
bg.sort,
|
||||
bg.create_time,
|
||||
bg.min_price,
|
||||
bg.max_price,
|
||||
bg.total_stock
|
||||
from
|
||||
<include refid="searchTables"/>
|
||||
</sql>
|
||||
|
||||
<sql id="searchTables">
|
||||
|
@ -70,7 +77,8 @@
|
|||
|
||||
<!--selectIdByQuery-->
|
||||
<select id="selectIdByQuery" resultType="java.lang.Long">
|
||||
select bg.id from <include refid="searchTables"/>
|
||||
select bg.id from
|
||||
<include refid="searchTables"/>
|
||||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
|
@ -89,6 +97,9 @@
|
|||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="sort != null">sort,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="minPrice != null">min_price,</if>
|
||||
<if test="maxPrice != null">max_price,</if>
|
||||
<if test="totalStock != null">total_stock,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="storeId != null">#{storeId},</if>
|
||||
|
@ -101,6 +112,9 @@
|
|||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="sort != null">#{sort},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="minPrice != null">#{minPrice},</if>
|
||||
<if test="maxPrice != null">#{maxPrice},</if>
|
||||
<if test="totalStock != null">#{totalStock},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
@ -274,6 +288,9 @@
|
|||
<if test="data.status != null and data.status != ''">status = #{data.status},</if>
|
||||
<if test="data.sort != null">sort = #{data.sort},</if>
|
||||
<if test="data.createTime != null">create_time = #{data.createTime},</if>
|
||||
<if test="data.minPrice != null">min_price = #{data.minPrice},</if>
|
||||
<if test="data.maxPrice != null">max_price = #{data.maxPrice},</if>
|
||||
<if test="data.totalStock != null">total_stock = #{data.totalStock},</if>
|
||||
</sql>
|
||||
|
||||
<delete id="deleteGoodsById" parameterType="Long">
|
||||
|
|
|
@ -67,4 +67,5 @@ public interface GoodsService
|
|||
|
||||
public Goods selectOne(GoodsQuery query);
|
||||
|
||||
int changeStatusAndSort(Goods goods);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.ruoyi.bst.goods.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
|
@ -86,6 +88,7 @@ public class GoodsServiceImpl implements GoodsService
|
|||
goodsVO.setCreateTime(DateUtils.getNowDate());
|
||||
Integer result = transactionTemplate.execute(status -> {
|
||||
// 新增商品
|
||||
this.generatePriceRangeAndStock(goodsVO);
|
||||
int i = goodsMapper.insertGoods(goodsVO);
|
||||
ServiceUtil.assertion(i != 1,"新增商品失败");
|
||||
|
||||
|
@ -103,6 +106,28 @@ public class GoodsServiceImpl implements GoodsService
|
|||
return result;
|
||||
}
|
||||
|
||||
private void generatePriceRangeAndStock(GoodsVO goodsVO) {
|
||||
if (goodsVO.getSkuVO()!=null) {
|
||||
// 初始化价格和库存
|
||||
ArrayList<BigDecimal> price = new ArrayList<BigDecimal>();
|
||||
Integer totalStock = 0;
|
||||
|
||||
// 获取价格和库存
|
||||
List<SkuVO> skuList = goodsVO.getSkuVO();
|
||||
for (SkuVO skuVO : skuList) {
|
||||
price.add(skuVO.getPrice());
|
||||
totalStock += skuVO.getStock();
|
||||
}
|
||||
BigDecimal minPrice = price.isEmpty() ? BigDecimal.ZERO : Collections.min(price);
|
||||
BigDecimal maxPrice = price.isEmpty() ? BigDecimal.ZERO : Collections.max(price);
|
||||
|
||||
// 设置价格和库存
|
||||
goodsVO.setMinPrice(minPrice);
|
||||
goodsVO.setMaxPrice(maxPrice);
|
||||
goodsVO.setTotalStock(totalStock);
|
||||
}
|
||||
}
|
||||
|
||||
private int saveSku(GoodsVO goodsVO) {
|
||||
List<SkuVO> skuList = goodsVO.getSkuVO();
|
||||
skuList.forEach(skuVO -> {
|
||||
|
@ -219,6 +244,7 @@ public class GoodsServiceImpl implements GoodsService
|
|||
goodsVO.setUpdateTime(DateUtils.getNowDate());
|
||||
Integer result = transactionTemplate.execute(status -> {
|
||||
// 修改商品
|
||||
this.generatePriceRangeAndStock(goodsVO);
|
||||
int i = goodsMapper.updateGoods(goodsVO);
|
||||
ServiceUtil.assertion(i != 1,"修改商品失败");
|
||||
|
||||
|
@ -296,4 +322,13 @@ public class GoodsServiceImpl implements GoodsService
|
|||
List<GoodsVO> notice = this.selectGoodsList(query);
|
||||
return CollectionUtils.firstElement(notice);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int changeStatusAndSort(Goods goods) {
|
||||
Goods data = new Goods();
|
||||
data.setId(goods.getId());
|
||||
data.setSort(goods.getSort());
|
||||
data.setStatus(goods.getStatus());
|
||||
return goodsMapper.updateGoods(goods);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class Sku extends BaseEntity
|
|||
|
||||
@Excel(name = "库存数量")
|
||||
@ApiModelProperty("库存数量")
|
||||
private Long stock;
|
||||
private Integer stock;
|
||||
|
||||
@Excel(name = "图片")
|
||||
@ApiModelProperty("图片")
|
||||
|
|
|
@ -10,4 +10,7 @@ public class TeamUserQuery extends TeamUserVO{
|
|||
|
||||
@ApiModelProperty("队伍ID列表")
|
||||
private List<Long> teamIds;
|
||||
|
||||
@ApiModelProperty("队伍类型 1-现场拼桌 2-预约拼桌")
|
||||
private String teamType;
|
||||
}
|
||||
|
|
|
@ -80,4 +80,6 @@ public interface TeamUserMapper
|
|||
int updateByQuery(@Param("data") TeamUser data,@Param("query") TeamUserQuery query);
|
||||
|
||||
List<Long> selectUserIdsByTeamId(@Param("teamId") Long teamId);
|
||||
|
||||
List<TeamUserVO> selectDistinctTeamUserList(@Param("query") TeamUserQuery query);
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="query.nickName != null and query.nickName != ''"> and su.nick_name like concat('%', #{query.nickName}, '%')</if>
|
||||
<if test="query.teamName != null and query.teamName != ''"> and bt.name like concat('%', #{query.teamName}, '%')</if>
|
||||
<if test="query.inviterName != null and query.inviterName != ''"> and su_inviter.nick_name like concat('%', #{query.inviterName}, '%')</if>
|
||||
<if test="query.teamType != null and query.teamType != ''"> and bt.type = #{query.teamType}</if>
|
||||
<if test="query.teamIds != null and query.teamIds.size() > 0">
|
||||
and btu.team_id in
|
||||
<foreach item="item" collection="query.teamIds" open="(" separator="," close=")">
|
||||
|
@ -96,6 +97,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where btu.team_id = #{teamId} and btu.status = 1
|
||||
</select>
|
||||
|
||||
<select id="selectDistinctTeamUserList" resultType="com.ruoyi.bst.teamUser.domain.TeamUserVO">
|
||||
<include refid="selectTeamUserVo"/>
|
||||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
distinct by btu.user_id
|
||||
</select>
|
||||
|
||||
<insert id="insertTeamUser" parameterType="TeamUser" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into bst_team_user
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
|
|
@ -74,4 +74,5 @@ public interface TeamUserService
|
|||
TeamUserVO getTeamUser(TeamUserQuery query);
|
||||
|
||||
int kick(Long teamId,Long userId);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.bst.teamUser.service.impl;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
|
@ -161,4 +162,6 @@ public class TeamUserServiceImpl implements TeamUserService
|
|||
public int kick(Long teamId, Long userId) {
|
||||
return teamService.kick(teamId, userId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
@ -63,7 +64,6 @@ public class AppChatController extends BaseController {
|
|||
public TableDataInfo receiveList(ChatQuery query) {
|
||||
startPage();
|
||||
PageHelper.orderBy("create_time desc");
|
||||
query.setDeleted(false);
|
||||
List<ChatVO> list = chatService.selectChatList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.web.app;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.ruoyi.bst.team.domain.Team;
|
||||
import com.ruoyi.bst.team.domain.TeamQuery;
|
||||
import com.ruoyi.bst.team.domain.TeamVO;
|
||||
|
@ -178,5 +179,16 @@ public class AppTeamController extends BaseController {
|
|||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("历史拼桌人数信息")
|
||||
@GetMapping("/teamJoinRecord")
|
||||
public TableDataInfo teamJoinRecord(TeamUserQuery query) {
|
||||
startPage();
|
||||
PageHelper.orderBy("create_time desc");
|
||||
List<TeamUserVO> list = teamUserService.selectTeamUserList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -125,4 +125,21 @@ public class GoodsController extends BaseController {
|
|||
}
|
||||
return toAjax(goodsService.deleteGoodsByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品上架/下架
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('bst:goods:changeStatus')")
|
||||
@Log(title = "商品上架/下架,修改排序", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/changeStatusAndSort")
|
||||
public AjaxResult changeStatusAndSort(@RequestBody Goods goods) {
|
||||
if (!goodsValidator.canEdit(goods.getId())){
|
||||
return error("您无权限修改该商品相关信息");
|
||||
}
|
||||
if (!storeValidator.canEdit(goods.getStoreId())) {
|
||||
return error("您无权限修改该店铺相关信息");
|
||||
}
|
||||
return toAjax(goodsService.changeStatusAndSort(goods));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user