Sfoglia il codice sorgente

小小训练营活动
直播间商品

zouxuan 3 anni fa
parent
commit
ee9388d2a2

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/LiveGoodsDao.java

@@ -0,0 +1,9 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.biz.dal.entity.LiveGoods;
+
+public interface LiveGoodsDao extends BaseDAO<Integer, LiveGoods> {
+
+	
+}

+ 16 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/LiveGoodsMapperDao.java

@@ -0,0 +1,16 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.biz.dal.entity.LiveGoodsMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface LiveGoodsMapperDao extends BaseDAO<Integer, LiveGoodsMapper> {
+
+    List<LiveGoodsMapper> findByLiveGoodsIdAndStatus(@Param("liveGoodsId") Integer liveGoodsId, @Param("status") Boolean status);
+
+    void updateStatus(@Param("liveId") String liveId, @Param("liveGoodsId") Integer liveGoodsId, @Param("status") boolean status);
+
+    LiveGoodsMapper findByLiveIdAndGoodsId(@Param("liveId") String liveId, @Param("liveGoodsId") Integer liveGoodsId);
+}

+ 266 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/LiveGoods.java

@@ -0,0 +1,266 @@
+package com.ym.mec.biz.dal.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * 对应数据库表(live_goods):
+ */
+public class LiveGoods {
+
+	@ApiModelProperty(value = "商品编号",required = false)
+	private Integer id;
+	
+	@ApiModelProperty(value = "产品分类",required = false)
+	private Integer goodsCategoryId;
+	
+	@ApiModelProperty(value = "商品货号",required = false)
+	private String sn;
+	
+	@ApiModelProperty(value = "商品名称",required = true)
+	@NotBlank(message = "商品名称不可为空")
+	private String name;
+	
+	@ApiModelProperty(value = "品牌",required = false)
+	private String brand;
+	
+	@ApiModelProperty(value = "规格",required = false)
+	private String specification;
+	
+	@ApiModelProperty(value = "展示图片的地址",required = true)
+	@NotBlank(message = "图片地址不可为空")
+	private String image;
+	
+	@ApiModelProperty(value = "库存",required = true)
+	@NotNull(message = "库存不可为空")
+	private Integer stockCount;
+	
+	@ApiModelProperty(value = "总销量数",required = false)
+	private Integer sellCount = 0;
+	
+	@ApiModelProperty(value = "现价",required = true)
+	@NotNull(message = "现价不可为空")
+	private java.math.BigDecimal currentPrice;
+	
+	@ApiModelProperty(value = "原价",required = true)
+	@NotNull(message = "原价不可为空")
+	private java.math.BigDecimal originalPrice;
+	
+	@ApiModelProperty(value = "页面简介",required = false)
+	private String brief;
+	
+	@ApiModelProperty(value = "商品的详细描述",required = false)
+	private String desc;
+	
+	@ApiModelProperty(value = "是否是新品(1,是  0,否)",required = false)
+	private Boolean newFlag = false;
+	
+	@ApiModelProperty(value = "是否置顶(1,置顶   0,不置顶)",required = false)
+	private Boolean topFlag = false;
+	
+	@ApiModelProperty(value = "状态(1,上下架  0,下架)",required = false)
+	private Boolean status = false;
+	
+	@ApiModelProperty(value = "备注",required = false)
+	private String memo;
+	
+	@ApiModelProperty(value = "发布时间",required = false)
+	private java.util.Date publishTime;
+	
+	@ApiModelProperty(value = "创建时间",required = false)
+	private java.util.Date createTime;
+	
+	@ApiModelProperty(value = "修改时间",required = false)
+	private java.util.Date updateTime;
+	
+	@ApiModelProperty(value = "机构",required = false)
+	private Integer tenantId;
+	
+	@ApiModelProperty(value = "附件商品列表编号(用逗号分开)",required = false)
+	private String complementGoodsIdList;
+
+	public Boolean getNewFlag() {
+		return newFlag;
+	}
+
+	public void setNewFlag(Boolean newFlag) {
+		this.newFlag = newFlag;
+	}
+
+	public Boolean getTopFlag() {
+		return topFlag;
+	}
+
+	public void setTopFlag(Boolean topFlag) {
+		this.topFlag = topFlag;
+	}
+
+	public Boolean getStatus() {
+		return status;
+	}
+
+	public void setStatus(Boolean status) {
+		this.status = status;
+	}
+
+	public void setId(Integer id){
+		this.id = id;
+	}
+	
+	public Integer getId(){
+		return this.id;
+	}
+			
+	public void setGoodsCategoryId(Integer goodsCategoryId){
+		this.goodsCategoryId = goodsCategoryId;
+	}
+	
+	public Integer getGoodsCategoryId(){
+		return this.goodsCategoryId;
+	}
+			
+	public void setSn(String sn){
+		this.sn = sn;
+	}
+	
+	public String getSn(){
+		return this.sn;
+	}
+			
+	public void setName(String name){
+		this.name = name;
+	}
+	
+	public String getName(){
+		return this.name;
+	}
+			
+	public void setBrand(String brand){
+		this.brand = brand;
+	}
+	
+	public String getBrand(){
+		return this.brand;
+	}
+			
+	public void setSpecification(String specification){
+		this.specification = specification;
+	}
+	
+	public String getSpecification(){
+		return this.specification;
+	}
+			
+	public void setImage(String image){
+		this.image = image;
+	}
+	
+	public String getImage(){
+		return this.image;
+	}
+			
+	public void setStockCount(Integer stockCount){
+		this.stockCount = stockCount;
+	}
+	
+	public Integer getStockCount(){
+		return this.stockCount;
+	}
+			
+	public void setSellCount(Integer sellCount){
+		this.sellCount = sellCount;
+	}
+	
+	public Integer getSellCount(){
+		return this.sellCount;
+	}
+			
+	public void setCurrentPrice(java.math.BigDecimal currentPrice){
+		this.currentPrice = currentPrice;
+	}
+	
+	public java.math.BigDecimal getCurrentPrice(){
+		return this.currentPrice;
+	}
+			
+	public void setOriginalPrice(java.math.BigDecimal originalPrice){
+		this.originalPrice = originalPrice;
+	}
+	
+	public java.math.BigDecimal getOriginalPrice(){
+		return this.originalPrice;
+	}
+			
+	public void setBrief(String brief){
+		this.brief = brief;
+	}
+	
+	public String getBrief(){
+		return this.brief;
+	}
+			
+	public void setDesc(String desc){
+		this.desc = desc;
+	}
+	
+	public String getDesc(){
+		return this.desc;
+	}
+
+	public void setMemo(String memo){
+		this.memo = memo;
+	}
+	
+	public String getMemo(){
+		return this.memo;
+	}
+			
+	public void setPublishTime(java.util.Date publishTime){
+		this.publishTime = publishTime;
+	}
+	
+	public java.util.Date getPublishTime(){
+		return this.publishTime;
+	}
+			
+	public void setCreateTime(java.util.Date createTime){
+		this.createTime = createTime;
+	}
+	
+	public java.util.Date getCreateTime(){
+		return this.createTime;
+	}
+			
+	public void setUpdateTime(java.util.Date updateTime){
+		this.updateTime = updateTime;
+	}
+	
+	public java.util.Date getUpdateTime(){
+		return this.updateTime;
+	}
+			
+	public void setTenantId(Integer tenantId){
+		this.tenantId = tenantId;
+	}
+	
+	public Integer getTenantId(){
+		return this.tenantId;
+	}
+			
+	public void setComplementGoodsIdList(String complementGoodsIdList){
+		this.complementGoodsIdList = complementGoodsIdList;
+	}
+	
+	public String getComplementGoodsIdList(){
+		return this.complementGoodsIdList;
+	}
+			
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

+ 103 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/LiveGoodsMapper.java

@@ -0,0 +1,103 @@
+package com.ym.mec.biz.dal.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(live_goods_mapper):
+ */
+public class LiveGoodsMapper {
+
+	/** 主键 */
+	private Integer id;
+	
+	/** 商品编号 */
+	private Integer goodsId;
+	
+	/** 直播间编号 */
+	private String liveId;
+	
+	/** 销量 */
+	private Integer sellCount;
+	
+	/** 直播间销售价 */
+	private java.math.BigDecimal livePrice;
+	
+	/** 状态(1,上架  0,下架) */
+	private Boolean status = false;
+	
+	/** 创建时间 */
+	private java.util.Date createTime;
+	
+	/** 修改时间 */
+	private java.util.Date updateTime;
+	
+	public void setId(Integer id){
+		this.id = id;
+	}
+	
+	public Integer getId(){
+		return this.id;
+	}
+			
+	public void setGoodsId(Integer goodsId){
+		this.goodsId = goodsId;
+	}
+	
+	public Integer getGoodsId(){
+		return this.goodsId;
+	}
+			
+	public void setLiveId(String liveId){
+		this.liveId = liveId;
+	}
+	
+	public String getLiveId(){
+		return this.liveId;
+	}
+			
+	public void setSellCount(Integer sellCount){
+		this.sellCount = sellCount;
+	}
+	
+	public Integer getSellCount(){
+		return this.sellCount;
+	}
+			
+	public void setLivePrice(java.math.BigDecimal livePrice){
+		this.livePrice = livePrice;
+	}
+	
+	public java.math.BigDecimal getLivePrice(){
+		return this.livePrice;
+	}
+
+	public Boolean getStatus() {
+		return status;
+	}
+
+	public void setStatus(Boolean status) {
+		this.status = status;
+	}
+
+	public void setCreateTime(java.util.Date createTime){
+		this.createTime = createTime;
+	}
+	
+	public java.util.Date getCreateTime(){
+		return this.createTime;
+	}
+			
+	public void setUpdateTime(java.util.Date updateTime){
+		this.updateTime = updateTime;
+	}
+	
+	public java.util.Date getUpdateTime(){
+		return this.updateTime;
+	}
+			
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

+ 16 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/LiveGoodsMapperService.java

@@ -0,0 +1,16 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.entity.LiveGoodsMapper;
+import com.ym.mec.common.service.BaseService;
+
+public interface LiveGoodsMapperService extends BaseService<Integer, LiveGoodsMapper> {
+
+    void add(LiveGoodsMapper liveGoodsMapper);
+
+    void downGoods(Integer liveGoodsId);
+
+    void downGoods(Integer liveGoodsId, String liveId);
+
+    void upGoods(Integer liveGoodsId, String liveId);
+
+}

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/LiveGoodsService.java

@@ -0,0 +1,11 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.entity.LiveGoods;
+import com.ym.mec.common.service.BaseService;
+
+public interface LiveGoodsService extends BaseService<Integer, LiveGoods> {
+
+    void updateLiveGoods(LiveGoods liveGoods);
+
+    void updateStatus(Integer liveGoodsId, Boolean status);
+}

+ 9 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/SysMessageService.java

@@ -50,13 +50,21 @@ public interface SysMessageService extends BaseService<Long, SysMessage> {
 	void batchSendImGroupMessage(MessageTypeEnum messageType,String senderId,String extra, String[] targetIds,String url, Object... args);
 
 	/**
-	 * 发送自定义消息
+	 * 发送文本消息
 	 * @param senderId
 	 * @param messageContent
 	 * @return
 	 */
 	void batchSendImGroupMessage(String messageContent,String senderId,String extra, String[] targetIds);
 
+	/**
+	 * 发送自定义文本消息
+	 * @param senderId
+	 * @param messageContent
+	 * @return
+	 */
+	void batchSendImGroupMessage(String messageContent,String senderId,String extra, String[] targetIds,String objectName);
+
 
 	/**
 	* @description: 发送图片消息

+ 103 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/LiveGoodsMapperServiceImpl.java

@@ -0,0 +1,103 @@
+package com.ym.mec.biz.service.impl;
+
+import com.ym.mec.biz.dal.dao.ImLiveBroadcastRoomDao;
+import com.ym.mec.biz.dal.dao.LiveGoodsDao;
+import com.ym.mec.biz.dal.entity.ImLiveBroadcastRoom;
+import com.ym.mec.biz.dal.entity.ImLiveBroadcastRoomData;
+import com.ym.mec.biz.dal.entity.LiveGoods;
+import com.ym.mec.biz.service.ImLiveBroadcastRoomService;
+import com.ym.mec.biz.service.SysMessageService;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.exception.BizException;
+import org.springframework.beans.factory.annotation.Autowired;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.biz.dal.entity.LiveGoodsMapper;
+import com.ym.mec.biz.service.LiveGoodsMapperService;
+import com.ym.mec.biz.dal.dao.LiveGoodsMapperDao;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+@Service
+public class LiveGoodsMapperServiceImpl extends BaseServiceImpl<Integer, LiveGoodsMapper>  implements LiveGoodsMapperService {
+	
+	@Autowired
+	private LiveGoodsMapperDao liveGoodsMapperDao;
+	@Autowired
+	private SysMessageService sysMessageService;
+	@Autowired
+	private LiveGoodsDao liveGoodsDao;
+	@Autowired
+	private ImLiveBroadcastRoomService imLiveBroadcastRoomService;
+
+	@Override
+	public BaseDAO<Integer, LiveGoodsMapper> getDAO() {
+		return liveGoodsMapperDao;
+	}
+
+    @Override
+	@Transactional(rollbackFor = Exception.class)
+    public void add(LiveGoodsMapper liveGoodsMapper) {
+		liveGoodsMapperDao.insert(liveGoodsMapper);
+		//通知上架
+		if (liveGoodsMapper.getStatus()) this.upGoods(liveGoodsMapper.getGoodsId(),liveGoodsMapper.getLiveId());
+    }
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void upGoods(Integer liveGoodsId, String liveId) {
+		liveGoodsMapperDao.updateStatus(liveId,liveGoodsId,true);
+		LiveGoods liveGoods = Optional.of(liveGoodsDao.get(liveGoodsId)).
+				orElseThrow(() -> new RuntimeException("商品不存在"));
+		ImLiveBroadcastRoom imLiveBroadcastRoom = Optional.of(imLiveBroadcastRoomService.getById(liveId)).
+				orElseThrow(() -> new RuntimeException("直播间不存在"));
+		//通知直播间商品上架
+		sysMessageService.batchSendImGroupMessage(liveGoods.getName() + "已上架",
+				imLiveBroadcastRoom.getSpeakerId().toString(),"",
+				new String[]{imLiveBroadcastRoom.getId().toString()},"DY:LIVE_GOODS_UP");
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void downGoods(Integer liveGoodsId, String liveId){
+		ImLiveBroadcastRoom imLiveBroadcastRoom = Optional.of(imLiveBroadcastRoomService.getById(liveId)).
+				orElseThrow(() -> new RuntimeException("直播间不存在"));
+		LiveGoods liveGoods = Optional.of(liveGoodsDao.get(liveGoodsId)).
+				orElseThrow(() -> new RuntimeException("商品不存在"));
+		LiveGoodsMapper liveGoodsMapper = Optional.of(liveGoodsMapperDao.findByLiveIdAndGoodsId(liveId, liveGoodsId)).
+				orElseThrow(() -> new RuntimeException("直播间不存在该商品"));
+		if(!liveGoodsMapper.getStatus()){
+			throw new BizException("该商品已下架");
+		}
+		//下架直播间商品
+		liveGoodsMapperDao.updateStatus(liveId,liveGoodsId,false);
+		//通知直播间,商品下架
+		sysMessageService.batchSendImGroupMessage(liveGoods.getName() + "已下架",
+				imLiveBroadcastRoom.getSpeakerId().toString(),"",
+				new String[]{imLiveBroadcastRoom.getId().toString()},"DY:LIVE_GOODS_DOWN");
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void downGoods(Integer liveGoodsId){
+		LiveGoods liveGoods = Optional.of(liveGoodsDao.get(liveGoodsId)).
+				orElseThrow(() -> new RuntimeException("商品不存在"));
+		List<LiveGoodsMapper> liveGoodsMappers = liveGoodsMapperDao.findByLiveGoodsIdAndStatus(liveGoodsId,true);
+		if(liveGoodsMappers.size()>0){
+			//下架直播间商品
+			liveGoodsMapperDao.updateStatus(null,liveGoodsId,false);
+			//通知直播间,商品下架
+			String messageContent = liveGoods.getName() + "已下架";
+			for (LiveGoodsMapper liveGoodsMapper : liveGoodsMappers) {
+				ImLiveBroadcastRoom imLiveBroadcastRoom = Optional.of(imLiveBroadcastRoomService.getById(liveGoodsMapper.getLiveId())).
+						orElseThrow(() -> new RuntimeException("直播间不存在"));
+				sysMessageService.batchSendImGroupMessage(messageContent,
+						imLiveBroadcastRoom.getSpeakerId().toString(),"",
+						new String[]{imLiveBroadcastRoom.getId().toString()},"DY:LIVE_GOODS_DOWN");
+			}
+		}
+	}
+}

+ 52 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/LiveGoodsServiceImpl.java

@@ -0,0 +1,52 @@
+package com.ym.mec.biz.service.impl;
+
+import com.ym.mec.biz.dal.dao.LiveGoodsMapperDao;
+import com.ym.mec.biz.dal.entity.LiveGoodsMapper;
+import com.ym.mec.biz.service.LiveGoodsMapperService;
+import com.ym.mec.common.dal.BaseDAO;
+import org.springframework.beans.factory.annotation.Autowired;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.biz.dal.entity.LiveGoods;
+import com.ym.mec.biz.service.LiveGoodsService;
+import com.ym.mec.biz.dal.dao.LiveGoodsDao;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+@Service
+public class LiveGoodsServiceImpl extends BaseServiceImpl<Integer, LiveGoods>  implements LiveGoodsService {
+	
+	@Autowired
+	private LiveGoodsDao liveGoodsDao;
+	@Autowired
+	private LiveGoodsMapperService liveGoodsMapperService;
+
+	@Override
+	public BaseDAO<Integer, LiveGoods> getDAO() {
+		return liveGoodsDao;
+	}
+
+    @Override
+	@Transactional(rollbackFor = Exception.class)
+    public void updateLiveGoods(LiveGoods liveGoods) {
+		Optional.of(liveGoodsDao.get(liveGoods.getId())).orElseThrow(() -> new RuntimeException("商品信息不存在"));
+		//下架直播间商品,并通知直播间
+		if (!liveGoods.getStatus()) liveGoodsMapperService.downGoods(liveGoods.getId());
+		//更新商品信息
+		liveGoodsDao.update(liveGoods);
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void updateStatus(Integer liveGoodsId, Boolean status) {
+		LiveGoods liveGoods = Optional.of(liveGoodsDao.get(liveGoodsId)).
+				orElseThrow(() -> new RuntimeException("商品信息不存在"));
+		//下架直播间商品,并通知直播间
+		if (!status) liveGoodsMapperService.downGoods(liveGoodsId);
+		liveGoods.setStatus(status);
+		liveGoodsDao.update(liveGoods);
+	}
+}

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMessageServiceImpl.java

@@ -262,6 +262,14 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 	}
 
 	@Override
+	public void batchSendImGroupMessage(String messageContent, String senderId,String extra, String[] targetIds,String objectName) {
+		ExecutorService executor = Executors.newCachedThreadPool();
+		CompletableFuture.runAsync(()->{
+			imFeignService.groupSend(getImGroupMessage(objectName,senderId,targetIds,messageContent,extra));
+		},executor);
+	}
+
+	@Override
 	public void batchSendImGroupMessage(String messageContent,String senderId,String extra,String imgUrl, String[] targetIds) {
 		ImMessageDto imMessageDto =
 				getImGroupMessage("RC:ImgMsg",senderId,targetIds,messageContent,extra);

+ 129 - 0
mec-biz/src/main/resources/config/mybatis/LiveGoodsMapper.xml

@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!--
+这个文件是自动生成的。
+不要修改此文件。所有改动将在下次重新自动生成时丢失。
+-->
+<mapper namespace="com.ym.mec.biz.dal.dao.LiveGoodsDao">
+	
+	<resultMap type="com.ym.mec.biz.dal.entity.LiveGoods" id="LiveGoods">
+		<result column="id_" property="id" />
+		<result column="goods_category_id_" property="goodsCategoryId" />
+		<result column="sn_" property="sn" />
+		<result column="name_" property="name" />
+		<result column="brand_" property="brand" />
+		<result column="specification_" property="specification" />
+		<result column="image_" property="image" />
+		<result column="stock_count_" property="stockCount" />
+		<result column="sell_count_" property="sellCount" />
+		<result column="current_price_" property="currentPrice" />
+		<result column="original_price_" property="originalPrice" />
+		<result column="brief_" property="brief" />
+		<result column="desc_" property="desc" />
+		<result column="new_flag_" property="newFlag" />
+		<result column="top_flag_" property="topFlag" />
+		<result column="status_" property="status" />
+		<result column="memo_" property="memo" />
+		<result column="publish_time_" property="publishTime" />
+		<result column="complement_goods_id_list_" property="complementGoodsIdList" />
+		<result column="create_time_" property="createTime" />
+		<result column="update_time_" property="updateTime" />
+		<result column="tenant_id_" property="tenantId" />
+	</resultMap>
+	
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="LiveGoods" >
+		SELECT * FROM live_goods WHERE id_ = #{id} 
+	</select>
+	
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="LiveGoods">
+		SELECT * FROM live_goods ORDER BY id_
+	</select>
+	
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.LiveGoods" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		INSERT INTO live_goods (goods_category_id_,sn_,name_,brand_,specification_,image_,stock_count_,sell_count_,current_price_,
+		                        original_price_,brief_,desc_,new_flag_,top_flag_,status_,memo_,publish_time_,complement_goods_id_list_,
+		                        create_time_,update_time_,tenant_id_)
+		VALUES(#{id},#{goodsCategoryId},#{sn},#{name},#{brand},#{specification},#{image},#{stockCount},#{sellCount},#{currentPrice},
+		       #{originalPrice},#{brief},#{desc},#{newFlag},#{topFlag},#{status},#{memo},NOW(),#{complementGoodsIdList},
+		       NOW(),NOW(),#{tenantId})
+	</insert>
+	
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.ym.mec.biz.dal.entity.LiveGoods">
+		UPDATE live_goods <set>
+		<if test="specification != null">
+		specification_ = #{specification},
+		</if>
+		<if test="status != null">
+		status_ = #{status},
+		</if>
+		<if test="topFlag != null">
+		top_flag_ = #{topFlag},
+		</if>
+		<if test="newFlag != null">
+		new_flag_ = #{newFlag},
+		</if>
+		<if test="sn != null">
+		sn_ = #{sn},
+		</if>
+		<if test="tenantId != null">
+		tenant_id_ = #{tenantId},
+		</if>
+		<if test="originalPrice != null">
+		original_price_ = #{originalPrice},
+		</if>
+		<if test="memo != null">
+		memo_ = #{memo},
+		</if>
+		<if test="name != null">
+		name_ = #{name},
+		</if>
+		<if test="complementGoodsIdList != null">
+		complement_goods_id_list_ = #{complementGoodsIdList},
+		</if>
+		<if test="stockCount != null">
+		stock_count_ = #{stockCount},
+		</if>
+		<if test="currentPrice != null">
+		current_price_ = #{currentPrice},
+		</if>
+		<if test="goodsCategoryId != null">
+		goods_category_id_ = #{goodsCategoryId},
+		</if>
+		<if test="brand != null">
+		brand_ = #{brand},
+		</if>
+		<if test="brief != null">
+		brief_ = #{brief},
+		</if>
+		<if test="sellCount != null">
+		sell_count_ = #{sellCount},
+		</if>
+		<if test="image != null">
+		image_ = #{image},
+		</if>
+		<if test="desc != null">
+		desc_ = #{desc},
+		</if>
+		update_time_ = NOW()
+	</set> WHERE id_ = #{id}
+	</update>
+	
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete" >
+		DELETE FROM live_goods WHERE id_ = #{id} 
+	</delete>
+	
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="LiveGoods" parameterType="map">
+		SELECT * FROM live_goods ORDER BY id_ <include refid="global.limit"/>
+	</select>
+	
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM live_goods
+	</select>
+</mapper>

+ 85 - 0
mec-biz/src/main/resources/config/mybatis/LiveGoodsMapperMapper.xml

@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!--
+这个文件是自动生成的。
+不要修改此文件。所有改动将在下次重新自动生成时丢失。
+-->
+<mapper namespace="com.ym.mec.biz.dal.dao.LiveGoodsMapperDao">
+	
+	<resultMap type="com.ym.mec.biz.dal.entity.LiveGoodsMapper" id="LiveGoodsMapper">
+		<result column="id_" property="id" />
+		<result column="goods_id_" property="goodsId" />
+		<result column="live_id_" property="liveId" />
+		<result column="sell_count_" property="sellCount" />
+		<result column="live_price_" property="livePrice" />
+		<result column="status_" property="status" />
+		<result column="create_time_" property="createTime" />
+		<result column="update_time_" property="updateTime" />
+	</resultMap>
+	
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="LiveGoodsMapper" >
+		SELECT * FROM live_goods_mapper WHERE id_ = #{id} 
+	</select>
+	
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="LiveGoodsMapper">
+		SELECT * FROM live_goods_mapper ORDER BY id_
+	</select>
+	
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.LiveGoodsMapper" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		INSERT INTO live_goods_mapper (goods_id_,live_id_,sell_count_,live_price_,status_,create_time_,update_time_)
+		VALUES(#{goodsId},#{liveId},#{sellCount},#{livePrice},#{status},NOW(),NOW())
+	</insert>
+	
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.ym.mec.biz.dal.entity.LiveGoodsMapper">
+		UPDATE live_goods_mapper <set>
+		<if test="status != null">
+		status_ = #{status},
+		</if>
+		<if test="liveId != null">
+		live_id_ = #{liveId},
+		</if>
+		<if test="livePrice != null">
+		live_price_ = #{livePrice},
+		</if>
+		<if test="sellCount != null">
+		sell_count_ = #{sellCount},
+		</if>
+		<if test="goodsId != null">
+		goods_id_ = #{goodsId},
+		</if>
+		update_time_ = NOW()
+	</set> WHERE id_ = #{id}
+	</update>
+	<update id="updateStatus">
+		UPDATE live_goods_mapper SET status_ = #{status},update_time_ = NOW()
+		WHERE id_ = #{liveGoodsId}
+		<if test="liveId != null and liveId != ''">
+		AND live_id_ = #{liveId}
+		</if>
+	</update>
+
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete" >
+		DELETE FROM live_goods_mapper WHERE id_ = #{id} 
+	</delete>
+	
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="LiveGoodsMapper" parameterType="map">
+		SELECT * FROM live_goods_mapper ORDER BY id_ <include refid="global.limit"/>
+	</select>
+	
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM live_goods_mapper
+	</select>
+	<select id="findByLiveGoodsIdAndStatus" resultMap="LiveGoodsMapper">
+		SELECT * FROM live_goods_mapper WHERE goods_id_ = #{goodsId} AND status_ = #{status}
+	</select>
+	<select id="findByLiveIdAndGoodsId" resultMap="LiveGoodsMapper">
+		SELECT * FROM live_goods_mapper WHERE live_id_ = #{liveId} AND goods_id_ = #{goodsId}
+	</select>
+</mapper>

+ 107 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/controller/ImSendGroupMessageController.java

@@ -0,0 +1,107 @@
+package com.ym.mec.teacher.controller;
+
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.entity.ImGroup;
+import com.ym.mec.biz.dal.entity.ImSendGroupMessage;
+import com.ym.mec.biz.dal.page.ImGroupQueryInfo;
+import com.ym.mec.biz.dal.page.ImSendGroupMessageQueryInfo;
+import com.ym.mec.biz.service.ImGroupService;
+import com.ym.mec.biz.service.ImSendGroupMessageService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.page.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Optional;
+
+@Api(tags = "群消息定时发送")
+@RequestMapping("imSendGroupMessage")
+@RestController
+public class ImSendGroupMessageController extends BaseController {
+
+    @Autowired
+    private ImSendGroupMessageService imSendGroupMessageService;
+    @Autowired
+    private ImGroupService imGroupService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
+
+    @ApiOperation("获取群消息列表")
+    @PostMapping(value = "/queryPage")
+    public HttpResponseResult<PageInfo<ImSendGroupMessage>> queryPage(ImSendGroupMessageQueryInfo queryInfo) throws Exception {
+        return succeed(imSendGroupMessageService.queryPage(queryInfo));
+    }
+
+    @ApiOperation("发送群聊消息")
+    @PostMapping(value = "/send")
+    public HttpResponseResult send(@RequestBody ImSendGroupMessage imSendGroupMessage) throws Exception {
+        imSendGroupMessageService.sendGroupMessage(imSendGroupMessage);
+        return succeed();
+    }
+
+    @ApiOperation("修改未发送的群消息")
+    @PostMapping(value = "/update")
+    public HttpResponseResult update(@RequestBody ImSendGroupMessage imSendGroupMessage) throws Exception {
+        imSendGroupMessageService.updateGroupMessage(imSendGroupMessage);
+        return succeed();
+    }
+
+    @ApiOperation("删除未发送的群消息")
+    @PostMapping(value = "/delete")
+    public HttpResponseResult delete(Long id) throws Exception {
+        imSendGroupMessageService.deleteGroupMessage(id);
+        return succeed();
+    }
+    @ApiOperation("删除未发送消息的群列表")
+    @PostMapping(value = "/deleteGroupList")
+    public HttpResponseResult deleteGroupList(Long imSendGroupMessageId,String groupIds) throws Exception {
+        Optional.ofNullable(groupIds).orElseThrow(() -> new BizException("群组id不能为空"));
+        Optional.ofNullable(imSendGroupMessageId).orElseThrow(() -> new BizException("群消息id不能为空"));
+        imSendGroupMessageService.deleteGroupList(imSendGroupMessageId,groupIds);
+        return succeed();
+    }
+    @ApiOperation("添加未发送消息的群列表")
+    @PostMapping(value = "/addGroupList")
+    public HttpResponseResult addGroupList(Long imSendGroupMessageId,String groupIds) throws Exception {
+        Optional.ofNullable(groupIds).orElseThrow(() -> new BizException("群组id不能为空"));
+        Optional.ofNullable(imSendGroupMessageId).orElseThrow(() -> new BizException("群消息id不能为空"));
+        imSendGroupMessageService.addGroupList(imSendGroupMessageId,groupIds);
+        return succeed();
+    }
+
+    @ApiOperation("查询群列表(没有在消息列表的)")
+    @PostMapping(value = "/queryGroupPage")
+    public HttpResponseResult<PageInfo<ImGroup>> queryGroupPage(ImGroupQueryInfo imGroupQueryInfo) throws Exception {
+        SysUser sysUser = Optional.of(sysUserFeignService.queryUserInfo()).
+                orElseThrow(() -> new Exception("请登录"));
+        imGroupQueryInfo.setUserId(sysUser.getId());
+        if(imGroupQueryInfo.getImSendGroupMessageId() != null){
+            ImSendGroupMessage imSendGroupMessage = Optional.of(imSendGroupMessageService.get(imGroupQueryInfo.getImSendGroupMessageId())).
+                    orElseThrow(()->new BizException("消息不存在"));
+            imGroupQueryInfo.setIgnoreIds(imSendGroupMessage.getTargetIds());
+        }
+        return succeed(imGroupService.queryPage(imGroupQueryInfo));
+    }
+
+    @ApiOperation("查询群列表(在消息列表的)")
+    @PostMapping(value = "/queryGroupPage1")
+    public HttpResponseResult<PageInfo<ImGroup>> queryGroupPage1(ImGroupQueryInfo imGroupQueryInfo) throws Exception {
+        SysUser sysUser = Optional.of(sysUserFeignService.queryUserInfo()).
+                orElseThrow(() -> new Exception("请登录"));
+        imGroupQueryInfo.setUserId(sysUser.getId());
+        if(imGroupQueryInfo.getImSendGroupMessageId() != null){
+            ImSendGroupMessage imSendGroupMessage = Optional.of(imSendGroupMessageService.get(imGroupQueryInfo.getImSendGroupMessageId())).
+                    orElseThrow(()->new BizException("消息不存在"));
+            imGroupQueryInfo.setTargetIds(imSendGroupMessage.getTargetIds());
+        }
+        return succeed(imGroupService.queryPage(imGroupQueryInfo));
+    }
+}

+ 46 - 0
mec-web/src/main/java/com/ym/mec/web/controller/LiveGoodsController.java

@@ -0,0 +1,46 @@
+package com.ym.mec.web.controller;
+
+import com.ym.mec.biz.dal.entity.LiveGoods;
+import com.ym.mec.biz.service.LiveGoodsService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Api(tags = "直播间商品管理")
+@RequestMapping("liveGoods")
+@RestController
+public class LiveGoodsController extends BaseController {
+
+    @Autowired
+    private LiveGoodsService liveGoodsService;
+
+    @ApiOperation("新增直播间商品")
+    @PostMapping("/add")
+    @PreAuthorize("@pcs.hasPermissions('liveGoods/add')")
+    public HttpResponseResult add(LiveGoods liveGoods) {
+        liveGoodsService.insert(liveGoods);
+        return succeed();
+    }
+
+    @ApiOperation("修改直播间商品")
+    @PostMapping("/update")
+    @PreAuthorize("@pcs.hasPermissions('liveGoods/update')")
+    public HttpResponseResult update(LiveGoods liveGoods) {
+        liveGoodsService.updateLiveGoods(liveGoods);
+        return succeed();
+    }
+
+    @ApiOperation("上架、下架直播间商品")
+    @PostMapping("/updateStatus")
+    @PreAuthorize("@pcs.hasPermissions('liveGoods/updateStatus')")
+    public HttpResponseResult updateStatus(Integer liveGoodsId, Boolean status) {
+        liveGoodsService.updateStatus(liveGoodsId, status);
+        return succeed();
+    }
+}

+ 30 - 0
mec-web/src/main/java/com/ym/mec/web/controller/LiveGoodsMapperController.java

@@ -0,0 +1,30 @@
+package com.ym.mec.web.controller;
+
+import com.ym.mec.biz.dal.entity.LiveGoodsMapper;
+import com.ym.mec.biz.service.LiveGoodsMapperService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Api(tags = "直播商品关联管理")
+@RequestMapping("liveGoodsMapper")
+@RestController
+public class LiveGoodsMapperController extends BaseController {
+
+    @Autowired
+    private LiveGoodsMapperService liveGoodsMapperService;
+
+    @ApiOperation("新增直播间商品关联")
+    @PostMapping("/add")
+    @PreAuthorize("@pcs.hasPermissions('liveGoodsMapper/add')")
+    public HttpResponseResult add(LiveGoodsMapper liveGoodsMapper) {
+        liveGoodsMapperService.add(liveGoodsMapper);
+        return succeed();
+    }
+}