Commit 3f09feae by 裴大威

Merge branch 'master' of http://192.168.89.173/rays/pcloud-book

parents 5b328081 151c2538
...@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -157,4 +158,18 @@ public class WechatGroupConsr { ...@@ -157,4 +158,18 @@ public class WechatGroupConsr {
LOGGER.info("【根据群号获取群主微信号,<END>--masterId=" + masterId); LOGGER.info("【根据群号获取群主微信号,<END>--masterId=" + masterId);
} }
} }
@ParamLog(value = "最近7天活跃人数")
public Map<Long, Integer> get7DayActiveUserCountByClassify(List<Long> classifyIds) throws BizException {
Map<Long, Integer> map = new HashMap<>();
try {
map = ResponseHandleUtil.parseMapResponse(messageService.get7DayActiveUserCountByClassify(classifyIds), Long.class, Integer.class);
} catch (Exception e) {
LOGGER.error("获取最近7天活跃人数失败.[get7DayActiveUserCountByClassify]:" + e.getMessage(), e);
}
if (map == null) {
return new HashMap<>();
}
return map;
}
} }
...@@ -119,10 +119,10 @@ public interface BookGroupClassifyBiz { ...@@ -119,10 +119,10 @@ public interface BookGroupClassifyBiz {
/** /**
* @Author:lili * @Author:lili
* @Desr:获取编辑所有的群二维码 * @Desr:获取编辑所有的分类
* @Date:2019/4/30 15:33 * @Date:2019/4/30 15:33
*/ */
PageBeanNew<GroupQrcodeVO> listGroupQrcodeByAdviser(ListGroupQrParam listGroupQrParam, Long adviserId); PageBeanNew<BookGroupClassifyVO> listGroupClassifyByAdviser(ListGroupClassifyParam listGroupClassifyParam, Long adviserId);
/** /**
* @Author:lili * @Author:lili
......
...@@ -38,8 +38,10 @@ import com.pcloud.common.page.PageBeanNew; ...@@ -38,8 +38,10 @@ import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam; import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.DateUtils; import com.pcloud.common.utils.DateUtils;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.common.utils.string.StringUtil; import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.facade.tradecenter.dto.QrGroupBuyDetailDto; import com.pcloud.facade.tradecenter.dto.QrGroupBuyDetailDto;
import com.pcloud.labelcenter.label.service.LabelService;
import com.pcloud.readercenter.wechat.dto.WechatUserRobotDto; import com.pcloud.readercenter.wechat.dto.WechatUserRobotDto;
import com.pcloud.resourcecenter.product.dto.UpdateAppProductParamDTO; import com.pcloud.resourcecenter.product.dto.UpdateAppProductParamDTO;
import com.pcloud.resourcecenter.product.entity.Product; import com.pcloud.resourcecenter.product.entity.Product;
...@@ -106,6 +108,8 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz { ...@@ -106,6 +108,8 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
private TradeConsr tradeConsr; private TradeConsr tradeConsr;
@Autowired @Autowired
private GroupAnnouncementBiz groupAnnouncementBiz; private GroupAnnouncementBiz groupAnnouncementBiz;
@Autowired
private LabelService labelService;
@Override @Override
@ParamLog("新增分类") @ParamLog("新增分类")
...@@ -464,18 +468,67 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz { ...@@ -464,18 +468,67 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
} }
@Override @Override
@ParamLog("获取编辑所有的群二维码") @ParamLog("获取编辑所有的分类")
public PageBeanNew<GroupQrcodeVO> listGroupQrcodeByAdviser(ListGroupQrParam listGroupQrParam, Long adviserId) { public PageBeanNew<BookGroupClassifyVO> listGroupClassifyByAdviser(ListGroupClassifyParam listGroupClassifyParam, Long adviserId) {
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("adviserId", adviserId); paramMap.put("adviserId", adviserId);
if (!StringUtil.isEmpty(listGroupQrParam.getName())) { if (!StringUtil.isEmpty(listGroupClassifyParam.getName())) {
paramMap.put("name", listGroupQrParam.getName()); paramMap.put("name", listGroupClassifyParam.getName());
} }
paramMap.put("bookIds", listGroupQrParam.getBookIds()); paramMap.put("bookIds", listGroupClassifyParam.getBookIds());
PageParam pageParam = new PageParam(listGroupQrParam.getCurrentPage(), listGroupQrParam.getNumPerPage()); paramMap.put("proLabelId",listGroupClassifyParam.getProLabelId());
PageBeanNew<GroupQrcodeVO> pageBeanNew = bookGroupClassifyDao.listPageNew(pageParam, paramMap, "listGroupQrcodeByAdviser"); paramMap.put("depLabelId",listGroupClassifyParam.getDepLabelId());
paramMap.put("purLabelId",listGroupClassifyParam.getPurLabelId());
PageParam pageParam = new PageParam(listGroupClassifyParam.getCurrentPage(), listGroupClassifyParam.getNumPerPage());
PageBeanNew<BookGroupClassifyVO> pageBeanNew = bookGroupClassifyDao.listPageNew(pageParam, paramMap, "listGroupClassifyByAdviser");
if (pageBeanNew == null) { if (pageBeanNew == null) {
return new PageBeanNew<>(listGroupQrParam.getCurrentPage(), listGroupQrParam.getNumPerPage(), new ArrayList<>()); return new PageBeanNew<>(listGroupClassifyParam.getCurrentPage(), listGroupClassifyParam.getNumPerPage(), new ArrayList<>());
}
//遍历填充标签
List<BookGroupClassifyVO> bookGroupClassifyVOS = pageBeanNew.getRecordList();
if (!ListUtils.isEmpty(bookGroupClassifyVOS)) {
List<Long> labelIds = new ArrayList<>();
List<Long> classifyIds = new ArrayList<>();
for (BookGroupClassifyVO bookGroupClassifyVO : bookGroupClassifyVOS) {
classifyIds.add(bookGroupClassifyVO.getClassifyId());
if (bookGroupClassifyVO.getProLabelId() != null) {
labelIds.add(bookGroupClassifyVO.getProLabelId());
}
if (bookGroupClassifyVO.getPurLabelId() != null) {
labelIds.add(bookGroupClassifyVO.getPurLabelId());
}
if (bookGroupClassifyVO.getDepLabelId() != null) {
labelIds.add(bookGroupClassifyVO.getDepLabelId());
}
}
Map<Long, Integer> activeCountMap = wechatGroupConsr.get7DayActiveUserCountByClassify(classifyIds);
Map<Long, String> labelMap = new HashMap<>();
if (!ListUtils.isEmpty(labelIds)) {
labelMap = ResponseHandleUtil.parseMap(labelService.getLabelName(labelIds), Long.class, String.class);
}
for (BookGroupClassifyVO bookGroupClassifyVO : bookGroupClassifyVOS) {
if (!MapUtils.isEmpty(labelMap)) {
Long proLabelId = bookGroupClassifyVO.getProLabelId();
Long purLabelId = bookGroupClassifyVO.getPurLabelId();
Long depLabelId = bookGroupClassifyVO.getDepLabelId();
if (proLabelId != null) {
bookGroupClassifyVO.setProLabelName(labelMap.get(proLabelId));
}
if (purLabelId != null) {
bookGroupClassifyVO.setPurLabelName(labelMap.get(purLabelId));
}
if (depLabelId != null) {
bookGroupClassifyVO.setDepLabelName(labelMap.get(depLabelId));
}
}
//最近7天活跃人数
Integer count = activeCountMap.get(bookGroupClassifyVO.getClassifyId());
if (count == null) {
bookGroupClassifyVO.setWeekActiveNumber(0);
} else {
bookGroupClassifyVO.setWeekActiveNumber(count);
}
}
} }
return pageBeanNew; return pageBeanNew;
} }
......
...@@ -25,6 +25,8 @@ import com.pcloud.book.group.vo.ListQrcodeByClassifyParamVO; ...@@ -25,6 +25,8 @@ import com.pcloud.book.group.vo.ListQrcodeByClassifyParamVO;
import com.pcloud.book.keywords.dao.BookKeywordRecordDao; import com.pcloud.book.keywords.dao.BookKeywordRecordDao;
import com.pcloud.book.keywords.dto.KeywordUserCountDTO; import com.pcloud.book.keywords.dto.KeywordUserCountDTO;
import com.pcloud.book.mq.producer.BookMQProducer; import com.pcloud.book.mq.producer.BookMQProducer;
import com.pcloud.book.push.dao.PushGroupDao;
import com.pcloud.book.push.entity.PushGroup;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam; import com.pcloud.common.page.PageParam;
...@@ -41,6 +43,8 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -41,6 +43,8 @@ import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/** /**
* @author lily * @author lily
...@@ -65,6 +69,10 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz { ...@@ -65,6 +69,10 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
private ReaderConsr readerConsr; private ReaderConsr readerConsr;
@Autowired @Autowired
private GroupAnnouncementBiz groupAnnouncementBiz; private GroupAnnouncementBiz groupAnnouncementBiz;
@Autowired
private PushGroupDao pushGroupDao;
private static final ExecutorService EXECUTOR_SERVICE = Executors.newFixedThreadPool(5);
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -260,9 +268,18 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz { ...@@ -260,9 +268,18 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
groupQrcode.setGroupName(groupName); groupQrcode.setGroupName(groupName);
groupQrcode.setClassifyId(classifyId); groupQrcode.setClassifyId(classifyId);
this.insert(groupQrcode); this.insert(groupQrcode);
//获取该社群书下是否有群公告 EXECUTOR_SERVICE.execute(()->{
ClassifyVO classifyVO = bookGroupClassifyBiz.getClassify(classifyId); //获取该社群书下是否有群公告
groupAnnouncementBiz.setAnForGroup(classifyVO.getBookGroupId(), classifyId, oneQrcode.getWeixinGroupId()); ClassifyVO classifyVO = bookGroupClassifyBiz.getClassify(classifyId);
groupAnnouncementBiz.setAnForGroup(classifyVO.getBookGroupId(), classifyId, oneQrcode.getWeixinGroupId());
//补充该分类下的群发关联
List<PushGroup> pushGroups = pushGroupDao.getListByClassifyId(classifyId);
if (!ListUtils.isEmpty(pushGroups)){
PushGroup pushGroup = pushGroups.get(0);
pushGroup.setBookGroupQrcodeId(groupQrcode.getId());
pushGroupDao.insert(pushGroup);
}
});
//String robotId = wechatGroupConsr.getRobotIdByGroupId(oneQrcode.getWeixinGroupId()); //String robotId = wechatGroupConsr.getRobotIdByGroupId(oneQrcode.getWeixinGroupId());
SendWeixinRequestTools.changeGroupName(oneQrcode.getRobotWxId(), oneQrcode.getWeixinGroupId(), groupName); SendWeixinRequestTools.changeGroupName(oneQrcode.getRobotWxId(), oneQrcode.getWeixinGroupId(), groupName);
} }
......
...@@ -144,6 +144,14 @@ public interface GroupQrcodeDao extends BaseDao<GroupQrcode> { ...@@ -144,6 +144,14 @@ public interface GroupQrcodeDao extends BaseDao<GroupQrcode> {
* @return * @return
*/ */
List<String> getWeixinGroupIdsByClassifyIdList(List<Long> classifyIds); List<String> getWeixinGroupIdsByClassifyIdList(List<Long> classifyIds);
/**
* 根据群分类查询id集合
* @param classifyId
* @return
*/
List<Long> getIdsByClassifyId(Long classifyId);
/** /**
* 修改群名称 * 修改群名称
* @param id * @param id
......
...@@ -129,6 +129,12 @@ public class GroupQrcodeDaoImpl extends BaseDaoImpl<GroupQrcode> implements Grou ...@@ -129,6 +129,12 @@ public class GroupQrcodeDaoImpl extends BaseDaoImpl<GroupQrcode> implements Grou
public List<String> getWeixinGroupIdsByClassifyIdList(List<Long> classifyIds) { public List<String> getWeixinGroupIdsByClassifyIdList(List<Long> classifyIds) {
return this.getSqlSession().selectList(this.getStatement("getWeixinGroupIdsByClassifyIdList"), classifyIds); return this.getSqlSession().selectList(this.getStatement("getWeixinGroupIdsByClassifyIdList"), classifyIds);
} }
@Override
public List<Long> getIdsByClassifyId(Long classifyId) {
return this.getSqlSession().selectList(this.getStatement("getIdsByClassifyId"), classifyId);
}
@Override @Override
public void updateGroupName(Long id, String groupName) { public void updateGroupName(Long id, String groupName) {
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
......
...@@ -119,13 +119,10 @@ public interface BookGroupClassifyFacade { ...@@ -119,13 +119,10 @@ public interface BookGroupClassifyFacade {
ResponseDto<GroupQrcode4ClassifyVO> getGroupQrcode4ClassifyWechat(@CookieValue("userInfo") String userInfo, @RequestParam("classifyId") Long classifyId); ResponseDto<GroupQrcode4ClassifyVO> getGroupQrcode4ClassifyWechat(@CookieValue("userInfo") String userInfo, @RequestParam("classifyId") Long classifyId);
@ApiOperation(value = "获取编辑所有的群二维码", httpMethod = "POST") @ApiOperation(value = "获取编辑所有的分类", httpMethod = "POST")
@RequestMapping(value = "listGroupQrcodeByAdviser", method = RequestMethod.POST) @RequestMapping(value = "listGroupClassifyByAdviser", method = RequestMethod.POST)
@ApiImplicitParams({@ApiImplicitParam(name = "token", value = "token", dataType = "String", paramType = "header"), @PostMapping("listGroupClassifyByAdviser")
@ApiImplicitParam(name = "listGroupQrParam", value = "群二维码查询参数", dataType = "ListGroupQrParam", paramType = "body") ResponseDto<PageBeanNew<BookGroupClassifyVO>> listGroupClassifyByAdviser(@RequestHeader("token") String token, @RequestBody @ApiParam("获取分类列表参数") ListGroupClassifyParam listGroupClassifyParam) throws PermissionException;
})
@GetMapping("listGroupQrcodeByAdviser")
ResponseDto<PageBeanNew<GroupQrcodeVO>> listGroupQrcodeByAdviser(@RequestHeader("token") String token, @RequestBody ListGroupQrParam listGroupQrParam) throws PermissionException;
@ApiOperation(value = "单个群统计", httpMethod = "POST") @ApiOperation(value = "单个群统计", httpMethod = "POST")
@RequestMapping(value = "listBookGroupQrcodeStatistic", method = RequestMethod.POST) @RequestMapping(value = "listBookGroupQrcodeStatistic", method = RequestMethod.POST)
......
...@@ -119,10 +119,10 @@ public class BookGroupClassifyFacadeImpl implements BookGroupClassifyFacade { ...@@ -119,10 +119,10 @@ public class BookGroupClassifyFacadeImpl implements BookGroupClassifyFacade {
} }
@Override @Override
@PostMapping("listGroupQrcodeByAdviser") @PostMapping("listGroupClassifyByAdviser")
public ResponseDto<PageBeanNew<GroupQrcodeVO>> listGroupQrcodeByAdviser(@RequestHeader("token") String token, @RequestBody ListGroupQrParam listGroupQrParam) throws PermissionException { public ResponseDto<PageBeanNew<BookGroupClassifyVO>> listGroupClassifyByAdviser(@RequestHeader("token") String token, @RequestBody @ApiParam("获取分类列表参数") ListGroupClassifyParam listGroupClassifyParam) throws PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID); Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
PageBeanNew<GroupQrcodeVO> pageBeanNew = bookGroupClassifyBiz.listGroupQrcodeByAdviser(listGroupQrParam, adviserId); PageBeanNew<BookGroupClassifyVO> pageBeanNew = bookGroupClassifyBiz.listGroupClassifyByAdviser(listGroupClassifyParam, adviserId);
return new ResponseDto<>(pageBeanNew); return new ResponseDto<>(pageBeanNew);
} }
......
package com.pcloud.book.group.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/6 16:26
**/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class BookGroupClassifyVO {
@ApiModelProperty("分类标识")
private Long classifyId;
@ApiModelProperty("图书标识")
private Long bookId;
@ApiModelProperty("图书名称")
private String bookName;
@ApiModelProperty("群分类")
private String classify;
@ApiModelProperty("社群码标识")
private String bookGroupId;
@ApiModelProperty("群二维码名称")
private String groupQrcodeName;
@ApiModelProperty("群人数")
private Integer userNumber;
@ApiModelProperty("最近7天活跃分数")
private Integer weekActiveNumber;
@ApiModelProperty("专业标签ID")
private Long proLabelId;
@ApiModelProperty("深度标签ID")
private Long depLabelId;
@ApiModelProperty("目的标签ID")
private Long purLabelId;
@ApiModelProperty("专业标签名称")
private String proLabelName;
@ApiModelProperty("深度标签名称")
private String depLabelName;
@ApiModelProperty("目的标签名称")
private String purLabelName;
public Long getClassifyId() {
return classifyId;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public Long getBookId() {
return bookId;
}
public void setBookId(Long bookId) {
this.bookId = bookId;
}
public String getBookName() {
return bookName;
}
public void setBookName(String bookName) {
this.bookName = bookName;
}
public String getClassify() {
return classify;
}
public void setClassify(String classify) {
this.classify = classify;
}
public String getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(String bookGroupId) {
this.bookGroupId = bookGroupId;
}
public String getGroupQrcodeName() {
return groupQrcodeName;
}
public void setGroupQrcodeName(String groupQrcodeName) {
this.groupQrcodeName = groupQrcodeName;
}
public Integer getUserNumber() {
return userNumber;
}
public void setUserNumber(Integer userNumber) {
this.userNumber = userNumber;
}
public Integer getWeekActiveNumber() {
return weekActiveNumber;
}
public void setWeekActiveNumber(Integer weekActiveNumber) {
this.weekActiveNumber = weekActiveNumber;
}
public Long getProLabelId() {
return proLabelId;
}
public void setProLabelId(Long proLabelId) {
this.proLabelId = proLabelId;
}
public Long getDepLabelId() {
return depLabelId;
}
public void setDepLabelId(Long depLabelId) {
this.depLabelId = depLabelId;
}
public Long getPurLabelId() {
return purLabelId;
}
public void setPurLabelId(Long purLabelId) {
this.purLabelId = purLabelId;
}
public String getProLabelName() {
return proLabelName;
}
public void setProLabelName(String proLabelName) {
this.proLabelName = proLabelName;
}
public String getDepLabelName() {
return depLabelName;
}
public void setDepLabelName(String depLabelName) {
this.depLabelName = depLabelName;
}
public String getPurLabelName() {
return purLabelName;
}
public void setPurLabelName(String purLabelName) {
this.purLabelName = purLabelName;
}
@Override
public String toString() {
return "BookGroupClassifyVO{" +
"classifyId=" + classifyId +
", bookId=" + bookId +
", bookName='" + bookName + '\'' +
", classify='" + classify + '\'' +
", bookGroupId='" + bookGroupId + '\'' +
", groupQrcodeName='" + groupQrcodeName + '\'' +
", userNumber=" + userNumber +
", weekActiveNumber=" + weekActiveNumber +
", proLabelId=" + proLabelId +
", depLabelId=" + depLabelId +
", purLabelId=" + purLabelId +
", proLabelName='" + proLabelName + '\'' +
", depLabelName='" + depLabelName + '\'' +
", purLabelName='" + purLabelName + '\'' +
'}';
}
}
package com.pcloud.book.group.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/6 16:33
**/
@ApiModel("获取分类列表参数")
public class ListGroupClassifyParam {
@ApiModelProperty("当前页数")
private Integer currentPage;
@ApiModelProperty("每页条数")
private Integer numPerPage;
@ApiModelProperty("图书标识")
private List<Long> bookIds;
@ApiModelProperty("分类名称或者书刊名称")
private String name;
@ApiModelProperty("专业标签ID")
private Long proLabelId;
@ApiModelProperty("深度标签ID")
private Long depLabelId;
@ApiModelProperty("目的标签ID")
private Long purLabelId;
public Integer getCurrentPage() {
return currentPage;
}
public void setCurrentPage(Integer currentPage) {
this.currentPage = currentPage;
}
public Integer getNumPerPage() {
return numPerPage;
}
public void setNumPerPage(Integer numPerPage) {
this.numPerPage = numPerPage;
}
public List<Long> getBookIds() {
return bookIds;
}
public void setBookIds(List<Long> bookIds) {
this.bookIds = bookIds;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getProLabelId() {
return proLabelId;
}
public void setProLabelId(Long proLabelId) {
this.proLabelId = proLabelId;
}
public Long getDepLabelId() {
return depLabelId;
}
public void setDepLabelId(Long depLabelId) {
this.depLabelId = depLabelId;
}
public Long getPurLabelId() {
return purLabelId;
}
public void setPurLabelId(Long purLabelId) {
this.purLabelId = purLabelId;
}
}
package com.pcloud.book.push.biz; package com.pcloud.book.push.biz;
import com.pcloud.book.push.dto.PushDTO; import com.pcloud.book.push.dto.*;
import com.pcloud.book.push.dto.PushGroupDTO;
import com.pcloud.book.push.dto.PushRecordDTO;
import com.pcloud.book.push.entity.Push; import com.pcloud.book.push.entity.Push;
import com.pcloud.book.push.entity.PushGroup; import com.pcloud.book.push.entity.PushGroup;
import com.pcloud.book.push.entity.PushItem; import com.pcloud.book.push.entity.PushItem;
...@@ -114,4 +112,33 @@ public interface PushBiz { ...@@ -114,4 +112,33 @@ public interface PushBiz {
* @return * @return
*/ */
PageBeanNew<PushRecordDTO> getPushRecordList(Long partyId, Integer currentPage, Integer numPerPage); PageBeanNew<PushRecordDTO> getPushRecordList(Long partyId, Integer currentPage, Integer numPerPage);
/**
* 新增计划式群发
*/
void createPushPlan(PushPlanDTO pushPlanDTO);
/**
* 修改计划式群发
*/
void updatePushPlan(PushPlanDTO pushPlanDTO);
/**
* 获取计划式群发
*/
PushPlanDTO getPushPlan(Long pushPlanId);
/**
* 删除计划式群发
*/
void deletePushPlan(Long pushPlanId, Long partyId);
/**
* 获取计划式群发列表
*/
PageBeanNew<PushPlanDTO> getPushPlanList(String keyword, String day, Integer weekDay, Integer currentPage, Integer numPerPage, Long partyId);
/**
* 获取计划日历
*/
List<String> getPushPlanCalendar(Long partyId);
} }
...@@ -98,7 +98,7 @@ public class PushCheck { ...@@ -98,7 +98,7 @@ public class PushCheck {
if (push == null) { if (push == null) {
return; return;
} }
if (PushTypeEnum.DAY.value.equals(push.getPushType()) || PushTypeEnum.ONE.value.equals(push.getPushType())) { if (PushTypeEnum.DAY.value.equals(push.getPushType()) || PushTypeEnum.ONE.value.equals(push.getPushType()) || PushTypeEnum.WEEK.value.equals(push.getPushType())) {
if (StringUtil.isEmpty(push.getPushTime())) { if (StringUtil.isEmpty(push.getPushTime())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "设置为定时发送时发送时间不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "设置为定时发送时发送时间不能为空!");
} }
...@@ -111,11 +111,16 @@ public class PushCheck { ...@@ -111,11 +111,16 @@ public class PushCheck {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "发送时间不能早于当前时间!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "发送时间不能早于当前时间!");
} }
} }
if (PushTypeEnum.DAY.value.equals(push.getPushType())) { if (PushTypeEnum.DAY.value.equals(push.getPushType()) || PushTypeEnum.WEEK.value.equals(push.getPushType())) {
if (!push.getPushTime().matches("([0-1]?[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$")) { if (!push.getPushTime().matches("([0-1]?[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$")) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "时间格式不对,应为HH:mm:ss!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "时间格式不对,应为HH:mm:ss!");
} }
} }
if (PushTypeEnum.WEEK.value.equals(push.getPushType())) {
if (push.getWeekDay() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "周几不能为空!");
}
}
} }
} }
......
...@@ -3,6 +3,8 @@ package com.pcloud.book.push.dao; ...@@ -3,6 +3,8 @@ package com.pcloud.book.push.dao;
import com.pcloud.book.push.entity.Push; import com.pcloud.book.push.entity.Push;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/** /**
* @Description * @Description
* @Author ruansiyuan * @Author ruansiyuan
...@@ -28,4 +30,25 @@ public interface PushDao extends BaseDao<Push> { ...@@ -28,4 +30,25 @@ public interface PushDao extends BaseDao<Push> {
* @param push * @param push
*/ */
void updatePushTime(Push push); void updatePushTime(Push push);
/**
* 根据计划id查询
* @param pushPlanId
* @return
*/
List<Push> getByPushPlanId(Long pushPlanId);
/**
* 根据群发is集合查询
* @param pushPlanIds
* @return
*/
List<Push> getByPushPlanIds(List<Long> pushPlanIds);
/**
* 根据创建人获取计划式群发
* @param partyId
* @return
*/
List<Push> getPlanPushListPartyId(Long partyId);
} }
package com.pcloud.book.push.dao; package com.pcloud.book.push.dao;
import com.pcloud.book.push.dto.PlanClassifyDTO;
import com.pcloud.book.push.entity.PushGroup; import com.pcloud.book.push.entity.PushGroup;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
...@@ -41,4 +42,25 @@ public interface PushGroupDao extends BaseDao<PushGroup> { ...@@ -41,4 +42,25 @@ public interface PushGroupDao extends BaseDao<PushGroup> {
* @return * @return
*/ */
List<PushGroup> getListByPushIds(List<Long> pushIds); List<PushGroup> getListByPushIds(List<Long> pushIds);
/**
* 根据群发计划id集合获取群发计划关联
* @param pushPlanIds
* @return
*/
List<PlanClassifyDTO> getPlanClassifyListByPlanIds(List<Long> pushPlanIds);
/**
* 根据分类id查询
* @param classifyId
* @return
*/
List<PushGroup> getListByClassifyId(Long classifyId);
/**
* 根据群发计划id获取群发计划关联
* @param pushPlanId
* @return
*/
List<PlanClassifyDTO> getPlanClassifyListByPlanId(Long pushPlanId);
} }
package com.pcloud.book.push.dao;
import com.pcloud.book.push.entity.PushPlan;
import com.pcloud.common.core.dao.BaseDao;
public interface PushPlanDao extends BaseDao<PushPlan> {
}
...@@ -6,6 +6,7 @@ import com.pcloud.common.core.dao.BaseDaoImpl; ...@@ -6,6 +6,7 @@ import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -32,4 +33,22 @@ public class PushDaoImpl extends BaseDaoImpl<Push> implements PushDao { ...@@ -32,4 +33,22 @@ public class PushDaoImpl extends BaseDaoImpl<Push> implements PushDao {
public void updatePushTime(Push push) { public void updatePushTime(Push push) {
super.getSqlSession().update(getStatement("updatePushTime"), push); super.getSqlSession().update(getStatement("updatePushTime"), push);
} }
@Override
public List<Push> getByPushPlanId(Long pushPlanId) {
return super.getSqlSession().selectList(getStatement("getByPushPlanId"), pushPlanId);
}
@Override
public List<Push> getByPushPlanIds(List<Long> pushPlanIds) {
Map<String, Object> map = new HashMap<>();
map.put("pushPlanIds", pushPlanIds);
return super.getSqlSession().selectList(getStatement("getByPushPlanIds"), map);
}
@Override
public List<Push> getPlanPushListPartyId(Long partyId) {
return super.getSqlSession().selectList(getStatement("getPlanPushListPartyId"), partyId);
}
} }
package com.pcloud.book.push.dao.impl; package com.pcloud.book.push.dao.impl;
import com.pcloud.book.push.dao.PushGroupDao; import com.pcloud.book.push.dao.PushGroupDao;
import com.pcloud.book.push.dto.PlanClassifyDTO;
import com.pcloud.book.push.entity.PushGroup; import com.pcloud.book.push.entity.PushGroup;
import com.pcloud.common.core.dao.BaseDaoImpl; import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -48,4 +49,21 @@ public class PushGroupDaoImpl extends BaseDaoImpl<PushGroup> implements PushGrou ...@@ -48,4 +49,21 @@ public class PushGroupDaoImpl extends BaseDaoImpl<PushGroup> implements PushGrou
map.put("pushIds",pushIds); map.put("pushIds",pushIds);
return super.getSqlSession().selectList(getStatement("getListByPushIds"), map); return super.getSqlSession().selectList(getStatement("getListByPushIds"), map);
} }
@Override
public List<PlanClassifyDTO> getPlanClassifyListByPlanIds(List<Long> pushPlanIds) {
Map<String, Object> map = new HashMap<>();
map.put("pushPlanIds",pushPlanIds);
return super.getSqlSession().selectList(getStatement("getPlanClassifyListByPlanIds"), map);
}
@Override
public List<PushGroup> getListByClassifyId(Long classifyId) {
return super.getSqlSession().selectList(getStatement("getListByClassifyId"), classifyId);
}
@Override
public List<PlanClassifyDTO> getPlanClassifyListByPlanId(Long pushPlanId) {
return super.getSqlSession().selectList(getStatement("getPlanClassifyListByPlanId"), pushPlanId);
}
} }
package com.pcloud.book.push.dao.impl;
import com.pcloud.book.push.dao.PushPlanDao;
import com.pcloud.book.push.entity.PushPlan;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/10 12:39
**/
@Repository("pushPlanDao")
public class PushPlanDaoImpl extends BaseDaoImpl<PushPlan> implements PushPlanDao {
}
package com.pcloud.book.push.dto;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/10 19:34
**/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class PlanClassifyDTO implements Serializable {
private static final long serialVersionUID = 3890723321481608455L;
@ApiModelProperty("计划id")
private Long pushPlanId;
@ApiModelProperty("书id")
private Long bookId;
@ApiModelProperty("书名")
private String bookName;
@ApiModelProperty("社群码id")
private Long bookGroupId;
@ApiModelProperty("社群码名称")
private String groupQrcodeName;
@ApiModelProperty("分类id")
private Long classifyId;
@ApiModelProperty("分类名称")
private String classify;
public Long getPushPlanId() {
return pushPlanId;
}
public void setPushPlanId(Long pushPlanId) {
this.pushPlanId = pushPlanId;
}
public Long getBookId() {
return bookId;
}
public void setBookId(Long bookId) {
this.bookId = bookId;
}
public String getBookName() {
return bookName;
}
public void setBookName(String bookName) {
this.bookName = bookName;
}
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
public String getGroupQrcodeName() {
return groupQrcodeName;
}
public void setGroupQrcodeName(String groupQrcodeName) {
this.groupQrcodeName = groupQrcodeName;
}
public Long getClassifyId() {
return classifyId;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public String getClassify() {
return classify;
}
public void setClassify(String classify) {
this.classify = classify;
}
@Override
public String toString() {
return "PlanClassifyDTO{" +
"pushPlanId=" + pushPlanId +
", bookId=" + bookId +
", bookName='" + bookName + '\'' +
", bookGroupId=" + bookGroupId +
", groupQrcodeName='" + groupQrcodeName + '\'' +
", classifyId=" + classifyId +
", classify='" + classify + '\'' +
'}';
}
}
...@@ -22,7 +22,7 @@ public class PushDTO implements Serializable { ...@@ -22,7 +22,7 @@ public class PushDTO implements Serializable {
@ApiModelProperty("主键") @ApiModelProperty("主键")
private Long id; private Long id;
@ApiModelProperty("发送类型(1:立即发送 2:单次发送 3:每天发送)") @ApiModelProperty("发送类型(1:立即发送 2:单次发送 3:每天发送 4:每周发送)")
private Integer pushType; private Integer pushType;
@ApiModelProperty("发送时间") @ApiModelProperty("发送时间")
......
package com.pcloud.book.push.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/10 12:57
**/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class PushPlanDTO implements Serializable {
private static final long serialVersionUID = -3956311764049212139L;
@ApiModelProperty("计划id")
private Long pushPlanId;
@ApiModelProperty("分类id")
private List<Long> classifyIds;
@ApiModelProperty("是否删除")
private Boolean isDelete;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
@ApiModelProperty("创建人")
private Long createUser;
@ApiModelProperty("修改人")
private Long updateUser;
private List<PushPlanItemDTO> pushPlanItemDTOList;
private List<PlanClassifyDTO> planClassifyDTOList;
public Long getPushPlanId() {
return pushPlanId;
}
public void setPushPlanId(Long pushPlanId) {
this.pushPlanId = pushPlanId;
}
public List<Long> getClassifyIds() {
return classifyIds;
}
public void setClassifyIds(List<Long> classifyIds) {
this.classifyIds = classifyIds;
}
public Boolean getIsDelete() {
return isDelete;
}
public void setIsDelete(Boolean isDelete) {
this.isDelete = isDelete;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
public Long getUpdateUser() {
return updateUser;
}
public void setUpdateUser(Long updateUser) {
this.updateUser = updateUser;
}
public List<PushPlanItemDTO> getPushPlanItemDTOList() {
return pushPlanItemDTOList;
}
public void setPushPlanItemDTOList(List<PushPlanItemDTO> pushPlanItemDTOList) {
this.pushPlanItemDTOList = pushPlanItemDTOList;
}
public List<PlanClassifyDTO> getPlanClassifyDTOList() {
return planClassifyDTOList;
}
public void setPlanClassifyDTOList(List<PlanClassifyDTO> planClassifyDTOList) {
this.planClassifyDTOList = planClassifyDTOList;
}
@Override
public String toString() {
return "PushPlanDTO{" +
"pushPlanId=" + pushPlanId +
", classifyIds=" + classifyIds +
", isDelete=" + isDelete +
", createTime=" + createTime +
", updateTime=" + updateTime +
", createUser=" + createUser +
", updateUser=" + updateUser +
", pushPlanItemDTOList=" + pushPlanItemDTOList +
", planClassifyDTOList=" + planClassifyDTOList +
'}';
}
}
package com.pcloud.book.push.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.pcloud.book.push.entity.PushItem;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/6 17:47
**/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class PushPlanItemDTO implements Serializable {
private static final long serialVersionUID = -3956311764049212139L;
@ApiModelProperty("群发id")
private Long pushId;
@ApiModelProperty("发送类型(1:立即发送 2:单次发送 3:每天发送 4:每周发送)")
private Integer pushType;
@ApiModelProperty("发送时间")
private String pushTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("开始时间")
private Date startTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("结束时间")
private Date endTime;
@ApiModelProperty("周几")
private Integer weekDay;
@ApiModelProperty("消息推送项模型集合")
private List<PushItem> pushItems;
public Long getPushId() {
return pushId;
}
public void setPushId(Long pushId) {
this.pushId = pushId;
}
public Integer getPushType() {
return pushType;
}
public void setPushType(Integer pushType) {
this.pushType = pushType;
}
public String getPushTime() {
return pushTime;
}
public void setPushTime(String pushTime) {
this.pushTime = pushTime;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public Integer getWeekDay() {
return weekDay;
}
public void setWeekDay(Integer weekDay) {
this.weekDay = weekDay;
}
public List<PushItem> getPushItems() {
return pushItems;
}
public void setPushItems(List<PushItem> pushItems) {
this.pushItems = pushItems;
}
@Override
public String toString() {
return "PushPlanItemDTO{" +
"pushId=" + pushId +
", pushType=" + pushType +
", pushTime='" + pushTime + '\'' +
", startTime=" + startTime +
", endTime=" + endTime +
", weekDay=" + weekDay +
", pushItems=" + pushItems +
'}';
}
}
package com.pcloud.book.push.entity; package com.pcloud.book.push.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.common.entity.BaseEntity; import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -14,12 +16,26 @@ import java.util.List; ...@@ -14,12 +16,26 @@ import java.util.List;
@ApiModel("消息推送模型") @ApiModel("消息推送模型")
public class Push extends BaseEntity { public class Push extends BaseEntity {
@ApiModelProperty("发送类型(1:立即发送 2:单次发送 3:每天发送)") @ApiModelProperty("发送类型(1:立即发送 2:单次发送 3:每天发送 4:每周发送)")
private Integer pushType; private Integer pushType;
@ApiModelProperty("发送时间") @ApiModelProperty("发送时间")
private String pushTime; private String pushTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("开始时间")
private Date startTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("结束时间")
private Date endTime;
@ApiModelProperty("周几")
private Integer weekDay;
@ApiModelProperty("计划id")
private Long pushPlanId;
@ApiModelProperty("是否删除") @ApiModelProperty("是否删除")
private Boolean isDelete; private Boolean isDelete;
...@@ -51,6 +67,38 @@ public class Push extends BaseEntity { ...@@ -51,6 +67,38 @@ public class Push extends BaseEntity {
this.pushTime = pushTime; this.pushTime = pushTime;
} }
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public Integer getWeekDay() {
return weekDay;
}
public void setWeekDay(Integer weekDay) {
this.weekDay = weekDay;
}
public Long getPushPlanId() {
return pushPlanId;
}
public void setPushPlanId(Long pushPlanId) {
this.pushPlanId = pushPlanId;
}
public Boolean getIsDelete() { public Boolean getIsDelete() {
return isDelete; return isDelete;
} }
...@@ -96,6 +144,10 @@ public class Push extends BaseEntity { ...@@ -96,6 +144,10 @@ public class Push extends BaseEntity {
return "Push{" + return "Push{" +
"pushType=" + pushType + "pushType=" + pushType +
", pushTime='" + pushTime + '\'' + ", pushTime='" + pushTime + '\'' +
", startTime=" + startTime +
", endTime=" + endTime +
", weekDay=" + weekDay +
", pushPlanId=" + pushPlanId +
", isDelete=" + isDelete + ", isDelete=" + isDelete +
", createUser=" + createUser + ", createUser=" + createUser +
", updateUser=" + updateUser + ", updateUser=" + updateUser +
......
package com.pcloud.book.push.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/10 12:05
**/
@ApiModel("计划模型")
public class PushPlan extends BaseEntity {
private static final long serialVersionUID = -8201420643667140625L;
@ApiModelProperty("是否删除")
private Boolean isDelete;
@ApiModelProperty("创建人")
private Long createUser;
@ApiModelProperty("修改人")
private Long updateUser;
public Boolean getIsDelete() {
return isDelete;
}
public void setIsDelete(Boolean isDelete) {
this.isDelete = isDelete;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
public Long getUpdateUser() {
return updateUser;
}
public void setUpdateUser(Long updateUser) {
this.updateUser = updateUser;
}
@Override
public String toString() {
return "PushPlan{" +
"isDelete=" + isDelete +
", createUser=" + createUser +
", updateUser=" + updateUser +
"} " + super.toString();
}
}
...@@ -18,7 +18,11 @@ public enum PushTypeEnum { ...@@ -18,7 +18,11 @@ public enum PushTypeEnum {
/** /**
* 每天发送 * 每天发送
*/ */
DAY(3); DAY(3),
/**
* 每周
*/
WEEK(4);
public final Integer value; public final Integer value;
......
package com.pcloud.book.push.facade; package com.pcloud.book.push.facade;
import com.pcloud.book.push.dto.PushPlanDTO;
import com.pcloud.book.push.entity.Push; import com.pcloud.book.push.entity.Push;
import com.pcloud.book.push.entity.PushGroup; import com.pcloud.book.push.entity.PushGroup;
import com.pcloud.book.push.entity.PushItem; import com.pcloud.book.push.entity.PushItem;
...@@ -115,4 +116,51 @@ public interface PushFacade { ...@@ -115,4 +116,51 @@ public interface PushFacade {
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage @RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException; ) throws BizException, PermissionException;
@ApiOperation("新增计划式群发")
@PostMapping("/createPushPlan")
ResponseDto<?> createPushPlan(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestBody @ApiParam("群发模型") PushPlanDTO pushPlanDTO
) throws BizException, PermissionException;
@ApiOperation("修改计划式群发")
@PostMapping("/updatePushPlan")
ResponseDto<?> updatePushPlan(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestBody @ApiParam("群发计划模型") PushPlanDTO pushPlanDTO
) throws BizException, PermissionException;
@ApiOperation("根据id获取计划式群发")
@GetMapping("/getPushPlan")
ResponseDto<?> getPushPlan(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("pushPlanId") Long pushPlanId
) throws BizException, PermissionException;
@ApiOperation("删除计划式群发")
@GetMapping("/deletePushPlan")
ResponseDto<?> deletePushPlan(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("pushPlanId") Long pushPlanId
) throws BizException, PermissionException;
@ApiOperation("获取计划列表")
@GetMapping("/getPushPlanList")
ResponseDto<?> getPushPlanList(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "keyword", required = false) @ApiParam("社群码名称、书名、分类名") String keyword,
@RequestParam(value = "day", required = false) @ApiParam("日期") String day,
@RequestParam(value = "weekDay", required = false) @ApiParam("周几") Integer weekDay,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException;
@ApiOperation("获取计划日历")
@GetMapping("/getPushPlanCalendar")
ResponseDto<?> getPushPlanCalendar(
@RequestHeader("token") @ApiParam("token信息") String token
) throws BizException, PermissionException;
} }
...@@ -2,6 +2,7 @@ package com.pcloud.book.push.facade.impl; ...@@ -2,6 +2,7 @@ package com.pcloud.book.push.facade.impl;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.push.biz.PushBiz; import com.pcloud.book.push.biz.PushBiz;
import com.pcloud.book.push.dto.PushPlanDTO;
import com.pcloud.book.push.entity.Push; import com.pcloud.book.push.entity.Push;
import com.pcloud.book.push.entity.PushGroup; import com.pcloud.book.push.entity.PushGroup;
import com.pcloud.book.push.entity.PushItem; import com.pcloud.book.push.entity.PushItem;
...@@ -9,6 +10,7 @@ import com.pcloud.book.push.facade.PushFacade; ...@@ -9,6 +10,7 @@ import com.pcloud.book.push.facade.PushFacade;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.permission.PermissionException; import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.SessionUtil; import com.pcloud.common.utils.SessionUtil;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
...@@ -221,4 +223,106 @@ public class PushFacadeImpl implements PushFacade { ...@@ -221,4 +223,106 @@ public class PushFacadeImpl implements PushFacade {
return new ResponseDto<>(pushBiz.getPushRecordList(partyId, currentPage, numPerPage)); return new ResponseDto<>(pushBiz.getPushRecordList(partyId, currentPage, numPerPage));
} }
@ApiOperation("新增计划式群发")
@PostMapping("/createPushPlan")
@Override
public ResponseDto<?> createPushPlan(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestBody @ApiParam("群发模型") PushPlanDTO pushPlanDTO
) throws BizException, PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (pushPlanDTO==null){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"参数错误");
}
if (ListUtils.isEmpty(pushPlanDTO.getClassifyIds())){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"参数错误");
}
if (ListUtils.isEmpty(pushPlanDTO.getPushPlanItemDTOList())){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"参数错误");
}
pushPlanDTO.setCreateUser(partyId);
pushPlanDTO.setUpdateUser(partyId);
pushBiz.createPushPlan(pushPlanDTO);
return new ResponseDto<>();
}
@ApiOperation("修改计划式群发")
@PostMapping("/updatePushPlan")
@Override
public ResponseDto<?> updatePushPlan(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestBody @ApiParam("群发计划模型") PushPlanDTO pushPlanDTO
) throws BizException, PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (pushPlanDTO==null){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"参数错误");
}
if (ListUtils.isEmpty(pushPlanDTO.getClassifyIds())){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"参数错误");
}
if (pushPlanDTO.getPushPlanId()==null){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"参数错误");
}
if (ListUtils.isEmpty(pushPlanDTO.getPushPlanItemDTOList())){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"参数错误");
}
pushPlanDTO.setUpdateUser(partyId);
pushBiz.updatePushPlan(pushPlanDTO);
return new ResponseDto<>();
}
@ApiOperation("根据id获取计划式群发")
@GetMapping("/getPushPlan")
@Override
public ResponseDto<?> getPushPlan(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("pushPlanId") Long pushPlanId
) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (pushPlanId==null){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"参数错误");
}
return new ResponseDto<>(pushBiz.getPushPlan(pushPlanId));
}
@ApiOperation("删除计划式群发")
@GetMapping("/deletePushPlan")
@Override
public ResponseDto<?> deletePushPlan(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("pushPlanId") Long pushPlanId
) throws BizException, PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (pushPlanId == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数错误");
}
pushBiz.deletePushPlan(pushPlanId, partyId);
return new ResponseDto<>();
}
@ApiOperation("获取计划列表")
@GetMapping("/getPushPlanList")
@Override
public ResponseDto<?> getPushPlanList(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "keyword", required = false) @ApiParam("社群码名称、书名、分类名") String keyword,
@RequestParam(value = "day", required = false) @ApiParam("日期") String day,
@RequestParam(value = "weekDay", required = false) @ApiParam("周几") Integer weekDay,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(pushBiz.getPushPlanList(keyword, day, weekDay, currentPage, numPerPage, partyId));
}
@ApiOperation("获取计划日历")
@GetMapping("/getPushPlanCalendar")
@Override
public ResponseDto<?> getPushPlanCalendar(
@RequestHeader("token") @ApiParam("token信息") String token
) throws BizException, PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(pushBiz.getPushPlanCalendar(partyId));
}
} }
...@@ -357,30 +357,27 @@ ...@@ -357,30 +357,27 @@
WHERE user_number <![CDATA[ < ]]> #{changeNumber} AND classify_id = #{classifyId} AND use_state = 1 AND is_delete = 0 limit 1 WHERE user_number <![CDATA[ < ]]> #{changeNumber} AND classify_id = #{classifyId} AND use_state = 1 AND is_delete = 0 limit 1
</select> </select>
<select id="listGroupQrcodeByAdviser" resultType="GroupQrcodeVO" parameterType="map"> <select id="listGroupClassifyByAdviser" resultType="com.pcloud.book.group.vo.BookGroupClassifyVO" parameterType="map">
SELECT SELECT
g.id groupQrcodeId,
g.group_name groupName,
c.id classifyId, c.id classifyId,
c.book_id bookId, c.book_id bookId,
b.BOOK_NAME bookName, b.BOOK_NAME bookName,
c.classify, c.classify,
c.book_group_id bookGroupId, c.book_group_id bookGroupId,
bg.group_qrcode_name groupQrcodeName bg.group_qrcode_name groupQrcodeName,
FROM sum(IFNULL(g.user_number,0)) userNumber,
book_group_classify c bg.pro_label_id proLabelId,
JOIN bg.dep_label_id depLabelId,
book_group_qrcode g ON c.id = g.classify_id bg.pur_label_id purLabelId
FROM book_group_classify c
INNER JOIN book_group_qrcode g ON c.id = g.classify_id
LEFT JOIN BOOK_GROUP bg on bg.id = c.book_group_id LEFT JOIN BOOK_GROUP bg on bg.id = c.book_group_id
LEFT JOIN book b ON c.book_id = b.book_id LEFT JOIN book b ON c.book_id = b.book_id
WHERE WHERE c.is_delete = 0
c.is_delete = 0 AND g.is_delete = 0
AND AND bg.is_delete = 0
g.is_delete = 0 AND b.is_delete = 0
AND bg.is_delete = 0 AND c.create_user = #{adviserId}
AND b.is_delete = 0
AND
c.create_user = #{adviserId}
<if test="bookIds != null"> <if test="bookIds != null">
AND c.book_id IN AND c.book_id IN
<foreach collection = "bookIds" index="index" item = "item" open = "(" separator= "," close = ")"> <foreach collection = "bookIds" index="index" item = "item" open = "(" separator= "," close = ")">
...@@ -390,9 +387,19 @@ ...@@ -390,9 +387,19 @@
<if test="name != null"> <if test="name != null">
AND ( AND (
book_name LIKE CONCAT('%', #{name},'%') book_name LIKE CONCAT('%', #{name},'%')
OR group_name LIKE CONCAT('%', #{name},'%') OR c.classify LIKE CONCAT('%', #{name},'%')
) )
</if> </if>
<if test="proLabelId!=null">
and bg.pro_label_id=#{proLabelId}
</if>
<if test="depLabelId!=null">
and bg.dep_label_id=#{depLabelId}
</if>
<if test="purLabelId!=null">
and bg.pur_label_id=#{purLabelId}
</if>
group by c.id
order by c.id desc, g.id desc order by c.id desc, g.id desc
</select> </select>
......
...@@ -298,6 +298,12 @@ ...@@ -298,6 +298,12 @@
${item} ${item}
</foreach> </foreach>
</select> </select>
<!--根据群分类查询id集合-->
<select id="getIdsByClassifyId" parameterType="Long" resultType="Long">
select id from book_group_qrcode where classify_id=#{classifyId}
</select>
<!--修改群名称--> <!--修改群名称-->
<update id="updateGroupName" parameterType="map"> <update id="updateGroupName" parameterType="map">
update book_group_qrcode update book_group_qrcode
......
...@@ -69,6 +69,26 @@ ...@@ -69,6 +69,26 @@
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<select id="getById" parameterType="Long" resultType="com.pcloud.book.keywords.entity.Keyword">
select
id ,
guide guide,
keywords keywords,
matching_rule matchingRule,
reply_type replyType,
content content,
description description,
link_url linkUrl,
pic_url picUrl,
serve_id serveId,
serve_type serveType,
create_user createUser,
create_time createTime
from keyword
where is_delete=0
and id=#{id}
</select>
<update id="updateServeInfo" parameterType="map"> <update id="updateServeInfo" parameterType="map">
update update
keyword keyword
......
...@@ -190,4 +190,41 @@ ...@@ -190,4 +190,41 @@
t1.is_delete = 0 t1.is_delete = 0
AND t1.push_id = #{pushId} AND t1.push_id = #{pushId}
</select> </select>
<!--根据群发计划id集合获取群发计划关联-->
<select id="getPlanClassifyListByPlanIds" parameterType="map" resultType="com.pcloud.book.push.dto.PlanClassifyDTO">
SELECT
t.classify_id classifyId, t2.classify, t2.book_group_id bookGroupId, t.book_id bookId, t1.push_plan_id pushPlanId
FROM
push_group t
LEFT JOIN push t1 ON t.push_id = t1.id
LEFT JOIN book_group_classify t2 ON t.classify_id = t2.id
where t.is_delete=0
and t1.is_delete=0
and t1.push_plan_id in
<foreach collection="pushPlanIds" index="index" item="item" separator="," open="(" close=")">
#{item}
</foreach>
GROUP BY t.classify_id,t1.push_plan_id
</select>
<!--根据分类id查询-->
<select id="getListByClassifyId" parameterType="Long" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> from push_group t
where t.classify_id=#{classifyId}
</select>
<!--根据群发计划id获取群发计划关联-->
<select id="getPlanClassifyListByPlanId" parameterType="Long" resultType="com.pcloud.book.push.dto.PlanClassifyDTO">
SELECT
t.classify_id classifyId, t2.classify, t2.book_group_id bookGroupId, t.book_id bookId, t1.push_plan_id pushPlanId
FROM
push_group t
LEFT JOIN push t1 ON t.push_id = t1.id
LEFT JOIN book_group_classify t2 ON t.classify_id = t2.id
where t.is_delete=0
and t1.is_delete=0
and t1.push_plan_id = #{pushPlanId}
GROUP BY t.classify_id
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
<id column="id" property="id" jdbcType="BIGINT"/> <id column="id" property="id" jdbcType="BIGINT"/>
<result column="push_type" property="pushType" jdbcType="INTEGER"/> <result column="push_type" property="pushType" jdbcType="INTEGER"/>
<result column="push_time" property="pushTime" jdbcType="VARCHAR"/> <result column="push_time" property="pushTime" jdbcType="VARCHAR"/>
<result column="start_time" property="startTime" jdbcType="TIMESTAMP"/>
<result column="end_time" property="endTime" jdbcType="TIMESTAMP"/>
<result column="week_day" property="weekDay" jdbcType="INTEGER"/>
<result column="push_plan_id" property="pushPlanId" jdbcType="BIGINT"/>
<result column="is_delete" property="isDelete" jdbcType="BOOLEAN"/> <result column="is_delete" property="isDelete" jdbcType="BOOLEAN"/>
<result column="create_user" property="createUser" jdbcType="BIGINT"/> <result column="create_user" property="createUser" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
...@@ -13,7 +17,7 @@ ...@@ -13,7 +17,7 @@
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, push_type, push_time, is_delete, create_user, create_time, update_user, update_time id, push_type, push_time, start_time, end_time, week_day, push_plan_id, is_delete, create_user, create_time, update_user, update_time
</sql> </sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long"> <select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
...@@ -33,6 +37,10 @@ ...@@ -33,6 +37,10 @@
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
push_type, push_type,
push_time, push_time,
start_time,
end_time,
week_day,
push_plan_id,
is_delete, is_delete,
create_user, create_user,
create_time, create_time,
...@@ -42,6 +50,10 @@ ...@@ -42,6 +50,10 @@
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
#{pushType,jdbcType=INTEGER}, #{pushType,jdbcType=INTEGER},
#{pushTime,jdbcType=VARCHAR}, #{pushTime,jdbcType=VARCHAR},
#{startTime,jdbcType=TIMESTAMP},
#{endTime,jdbcType=TIMESTAMP},
#{weekDay,jdbcType=INTEGER},
#{pushPlanId,jdbcType=BIGINT},
0, 0,
#{createUser,jdbcType=BIGINT}, #{createUser,jdbcType=BIGINT},
NOW(), NOW(),
...@@ -59,6 +71,18 @@ ...@@ -59,6 +71,18 @@
<if test="pushTime != null"> <if test="pushTime != null">
push_time = #{pushTime,jdbcType=VARCHAR}, push_time = #{pushTime,jdbcType=VARCHAR},
</if> </if>
<if test="startTime != null">
start_time = #{startTime,jdbcType=TIMESTAMP},
</if>
<if test="endTime != null">
end_time = #{endTime,jdbcType=TIMESTAMP},
</if>
<if test="weekDay != null">
week_day = #{weekDay,jdbcType=INTEGER},
</if>
<if test="pushPlanId != null">
push_plan_id = #{pushPlanId,jdbcType=BIGINT},
</if>
<if test="isDelete != null"> <if test="isDelete != null">
is_delete = #{isDelete,jdbcType=BOOLEAN}, is_delete = #{isDelete,jdbcType=BOOLEAN},
</if> </if>
...@@ -119,4 +143,39 @@ ...@@ -119,4 +143,39 @@
update_time=now() update_time=now()
where id = #{id} and is_delete = 0 where id = #{id} and is_delete = 0
</update> </update>
<!--根据计划id查询-->
<select id="getByPushPlanId" parameterType="Long" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> from push
where is_delete=0 and push_plan_id=#{pushPlanId}
</select>
<!--根据计划id集合查询-->
<select id="getByPushPlanIds" parameterType="map" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> from push
where is_delete=0 and push_plan_id in
<foreach collection="pushPlanIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
<!--根据创建人获取计划式群发-->
<select id="getPlanPushListPartyId" parameterType="Long" resultMap="BaseResultMap">
select
t1.id,
t1.push_type,
t1.push_time,
t1.start_time,
t1.end_time,
t1.week_day,
t1.push_plan_id,
t1.is_delete,
t1.create_user,
t1.create_time,
t1.update_user,
t1.update_time
from push t1
inner join push_plan t2 on t1.push_plan_id=t2.id
where t2.create_user=#{partyId}
</select>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.push.dao.impl.PushPlanDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.push.entity.PushPlan">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="is_delete" property="isDelete" jdbcType="BOOLEAN"/>
<result column="create_user" property="createUser" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_user" property="updateUser" jdbcType="BIGINT"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, is_delete, create_user, create_time, update_user, update_time
</sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
select
<include refid="Base_Column_List"/>
from push_plan
where is_delete=0 and id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteById" parameterType="java.lang.Long">
update push_plan set is_delete = 1
where id = #{id,jdbcType=BIGINT} and is_delete = 0
</delete>
<insert id="insert" parameterType="com.pcloud.book.push.entity.PushPlan" useGeneratedKeys="true" keyProperty="id">
insert into push_plan
<trim prefix="(" suffix=")" suffixOverrides=",">
is_delete,
create_user,
create_time,
update_user,
update_time,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
0,
#{createUser,jdbcType=BIGINT},
NOW(),
#{updateUser,jdbcType=BIGINT},
NOW(),
</trim>
</insert>
<update id="update" parameterType="com.pcloud.book.push.entity.PushPlan">
update push_plan
<set>
<if test="isDelete != null">
is_delete = #{isDelete,jdbcType=BOOLEAN},
</if>
<if test="updateUser != null">
update_user = #{updateUser,jdbcType=BIGINT},
</if>
update_time = NOW(),
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<!--查询计划集合-->
<select id="getPushPlanList" parameterType="map" resultType="com.pcloud.book.push.dto.PushPlanDTO">
SELECT
t.id pushPlanId,
t.is_delete isDelete,
t.create_user createUser,
t.create_time createTime,
t.update_user updateUser,
t.update_time updateTime
FROM
push_plan t
LEFT JOIN push t1 ON t.id = t1.push_plan_id
<if test="keyword!=null">
LEFT JOIN push_group t2 ON t1.id = t2.push_id
LEFT JOIN book_group_classify t3 ON t2.classify_id = t3.id
LEFT JOIN book_group t4 ON t3.book_group_id = t4.id
LEFT JOIN book t5 ON t3.book_id = t5.BOOK_ID
</if>
WHERE
t.is_delete = 0
AND t.create_user=#{partyId}
AND t1.is_delete = 0
<if test="keyword!=null">
AND t2.is_delete = 0
AND t3.is_delete = 0
AND t4.is_delete = 0
AND t5.IS_DELETE = 0
AND (
t5.BOOK_NAME LIKE concat('%', #{keyword}, '%')
OR t4.group_qrcode_name LIKE concat('%', #{keyword}, '%')
OR t3.classify LIKE concat('%', #{keyword}, '%')
)
</if>
<if test="day!=null and weekDay!=null">
AND (
t1.push_type = 2 AND DATE_FORMAT(t1.push_time, '%Y-%m-%d') = #{day}
OR
t1.push_type = 3 AND #{day} BETWEEN t1.start_time AND t1.end_time
OR
t1.push_type = 4 AND #{day} BETWEEN t1.start_time AND t1.end_time AND t1.week_day = #{weekDay}
)
</if>
GROUP BY t.id
order by t.create_time desc
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment