Commit 2dfbaa16 by zhuyajie

群发修改

parent d4149129
...@@ -87,4 +87,16 @@ public class PartyConsr { ...@@ -87,4 +87,16 @@ public class PartyConsr {
return userLogin; return userLogin;
} }
@ParamLog("根据partyId获取登录账号信息")
public UserLogin getUserLoginInfoByPartyId(Long partyId,String systemCode, String isSystem){
UserLogin userLogin = new UserLogin();
try {
userLogin = ResponseHandleUtil.parseResponse(userLoginService.getUserLoginInfo(partyId,systemCode,isSystem),UserLogin.class);
}catch (Exception e){
LOGGER.error("【用户中心】getUserLoginInfoByPartyId失败" + e.getMessage(), e);
}
return userLogin;
}
} }
...@@ -41,4 +41,10 @@ public interface SelfPushBiz { ...@@ -41,4 +41,10 @@ public interface SelfPushBiz {
* @param pushId * @param pushId
*/ */
void sendSelfMsgQuartz(Long pushId); void sendSelfMsgQuartz(Long pushId);
/**
* 根据pushId删除
* @param pushId
*/
void deleteByPushId(Long pushId);
} }
package com.pcloud.book.push.biz.impl; package com.pcloud.book.push.biz.impl;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.consumer.user.PartyConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr; import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.group.dao.BookGroupCipherUserDao; import com.pcloud.book.group.dao.BookGroupCipherUserDao;
import com.pcloud.book.group.dao.BookGroupDao; import com.pcloud.book.group.dao.BookGroupDao;
...@@ -31,6 +33,7 @@ import com.pcloud.common.utils.string.StringUtil; ...@@ -31,6 +33,7 @@ import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.facade.quartz.entity.CallBackParam; import com.pcloud.facade.quartz.entity.CallBackParam;
import com.pcloud.facade.quartz.entity.ScheduleJob; import com.pcloud.facade.quartz.entity.ScheduleJob;
import com.pcloud.facade.quartz.service.ScheduleService; import com.pcloud.facade.quartz.service.ScheduleService;
import com.pcloud.usercenter.user.entity.UserLogin;
import com.pcloud.wechatgroup.group.dto.GroupRobotDTO; import com.pcloud.wechatgroup.group.dto.GroupRobotDTO;
import com.pcloud.wechatgroup.group.dto.GroupUserDTO; import com.pcloud.wechatgroup.group.dto.GroupUserDTO;
import com.sdk.wxgroup.SendArticleMessageVO; import com.sdk.wxgroup.SendArticleMessageVO;
...@@ -84,6 +87,8 @@ public class SelfPushBizImpl implements SelfPushBiz { ...@@ -84,6 +87,8 @@ public class SelfPushBizImpl implements SelfPushBiz {
private String envStr; private String envStr;
@Autowired @Autowired
private BookGroupDao bookGroupDao; private BookGroupDao bookGroupDao;
@Autowired
private PartyConsr partyConsr;
@Override @Override
public void createSelfPush(Long partyId, SelfPushAddParamDTO addParamDTO) { public void createSelfPush(Long partyId, SelfPushAddParamDTO addParamDTO) {
...@@ -94,9 +99,15 @@ public class SelfPushBizImpl implements SelfPushBiz { ...@@ -94,9 +99,15 @@ public class SelfPushBizImpl implements SelfPushBiz {
selfPush.setUpdateUser(partyId); selfPush.setUpdateUser(partyId);
if (SystemCode.adviser.code.equalsIgnoreCase(addParamDTO.getSystemCode())){ if (SystemCode.adviser.code.equalsIgnoreCase(addParamDTO.getSystemCode())){
selfPush.setBookGroupId(addParamDTO.getBookGroupId()); selfPush.setBookGroupId(addParamDTO.getBookGroupId());
selfPush.setSendAll(false);
} }
if (SystemCode.pcloud.code.equalsIgnoreCase(addParamDTO.getSystemCode())){ if (SystemCode.pcloud.code.equalsIgnoreCase(addParamDTO.getSystemCode())){
selfPush.setAltId(addParamDTO.getAltId()); selfPush.setAltId(addParamDTO.getAltId());
if (addParamDTO.getSendAll()){//发送全部好友
List<String> userIdList = wechatGroupConsr.getFriendByRobotId(addParamDTO.getAltId());
addParamDTO.setUserIdList(userIdList);
}
selfPush.setSendAll(addParamDTO.getSendAll());
} }
selfPush.setSendNow(sendNow); selfPush.setSendNow(sendNow);
if (sendNow) { if (sendNow) {
...@@ -159,17 +170,6 @@ public class SelfPushBizImpl implements SelfPushBiz { ...@@ -159,17 +170,6 @@ public class SelfPushBizImpl implements SelfPushBiz {
SelfPush selfPush = selfPushDao.getById(pushId); SelfPush selfPush = selfPushDao.getById(pushId);
if (!StringUtil.isEmpty(selfPush.getAltId())){//平台端群发 if (!StringUtil.isEmpty(selfPush.getAltId())){//平台端群发
String altId = selfPush.getAltId(); String altId = selfPush.getAltId();
Boolean sendAllFriend = false;
if ("pro".equalsIgnoreCase(envStr) && altId.equals("wxid_x8i897ryabo722")){//小睿给所有好友发 1002302
sendAllFriend = true;
} else if ("uat".equalsIgnoreCase(envStr) && altId.equals("wxid_p7gywuxkk89112")) {
sendAllFriend = true;
} else if ("test".equalsIgnoreCase(envStr) && altId.equals("wxid_zus32xb5ukjn22")){
sendAllFriend = true;
}
if (sendAllFriend){
userIdList = wechatGroupConsr.getFriendByRobotId(altId);
}
List<String> sendUserIds = new ArrayList<>(); List<String> sendUserIds = new ArrayList<>();
sendUserIds.addAll(userIdList); sendUserIds.addAll(userIdList);
ThreadPoolUtils.SEND_MESSAGE_THREAD_POOL.execute(() -> { ThreadPoolUtils.SEND_MESSAGE_THREAD_POOL.execute(() -> {
...@@ -333,11 +333,22 @@ public class SelfPushBizImpl implements SelfPushBiz { ...@@ -333,11 +333,22 @@ public class SelfPushBizImpl implements SelfPushBiz {
if (null == pageBeanNew || ListUtils.isEmpty(pageBeanNew.getRecordList())) { if (null == pageBeanNew || ListUtils.isEmpty(pageBeanNew.getRecordList())) {
return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>()); return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>());
} }
List<String> wxIds = pageBeanNew.getRecordList().stream().filter(s -> s != null).map(SelfPushRecordDTO::getAltId).distinct().collect(Collectors.toList()); List<String> wxIds = pageBeanNew.getRecordList().stream().filter(s -> !StringUtil.isEmpty(s.getAltId())).map(SelfPushRecordDTO::getAltId).distinct().collect(Collectors.toList());
Map<String, GroupUserDTO> robotMap = new HashMap<>(); Map<String, GroupUserDTO> robotMap = new HashMap<>();
if (!ListUtils.isEmpty(wxIds)){ if (!ListUtils.isEmpty(wxIds)){
robotMap = wechatGroupConsr.mapRobotInfoByIdList(wxIds); robotMap = wechatGroupConsr.mapRobotInfoByIdList(wxIds);
} }
List<Long> pcloudPartyIds = pageBeanNew.getRecordList().stream().filter(s->!StringUtil.isEmpty(s.getAltId())).map(SelfPushRecordDTO::getCreateUser).distinct().collect(Collectors.toList());
Map<Long, UserLogin> loginMap = new HashMap<>();
if (!ListUtils.isEmpty(pcloudPartyIds)){
for (Long id : pcloudPartyIds){
if (id == 0L){
continue;
}
UserLogin userLogin = partyConsr.getUserLoginInfoByPartyId(id,SystemCode.pcloud.code,"0");
loginMap.put(id,userLogin);
}
}
for (SelfPushRecordDTO dto : pageBeanNew.getRecordList()) { for (SelfPushRecordDTO dto : pageBeanNew.getRecordList()) {
Integer userCount = selfPushUserDao.getCountByPushId(dto.getPushId()); Integer userCount = selfPushUserDao.getCountByPushId(dto.getPushId());
dto.setUserCount(userCount); dto.setUserCount(userCount);
...@@ -349,6 +360,14 @@ public class SelfPushBizImpl implements SelfPushBiz { ...@@ -349,6 +360,14 @@ public class SelfPushBizImpl implements SelfPushBiz {
BookGroupDTO bookGroupDTO = bookGroupDao.getBookBaseInfoById(dto.getBookGroupId()); BookGroupDTO bookGroupDTO = bookGroupDao.getBookBaseInfoById(dto.getBookGroupId());
dto.setBookName(bookGroupDTO.getBookName()); dto.setBookName(bookGroupDTO.getBookName());
} }
if (!StringUtil.isEmpty(dto.getAltId())){//平台端登录账号
if (dto.getCreateUser() == 0L){
dto.setUserName("pcloud");
}else if (!MapUtils.isEmpty(loginMap) && loginMap.containsKey(dto.getCreateUser())){
UserLogin userLogin = loginMap.get(dto.getCreateUser());
dto.setUserName(null == userLogin? "":userLogin.getUserName());
}
}
} }
return pageBeanNew; return pageBeanNew;
} }
...@@ -360,6 +379,11 @@ public class SelfPushBizImpl implements SelfPushBiz { ...@@ -360,6 +379,11 @@ public class SelfPushBizImpl implements SelfPushBiz {
return; return;
} }
List<String> userIdList = selfPushUserDao.getUserIdListByPushId(pushId); List<String> userIdList = selfPushUserDao.getUserIdListByPushId(pushId);
if (selfPush.getSendAll() && !StringUtil.isEmpty(selfPush.getAltId())){//群发所有好友,更新发送好友列表
userIdList = wechatGroupConsr.getFriendByRobotId(selfPush.getAltId());
selfPushUserDao.deleteByPushId(pushId);
setSelfPushUser(userIdList, selfPush.getCreateUser(), pushId);
}
List<SelfPushItem> itemList = selfPushItemDao.getByPushId(pushId); List<SelfPushItem> itemList = selfPushItemDao.getByPushId(pushId);
if (ListUtils.isEmpty(userIdList) || ListUtils.isEmpty(itemList)) { if (ListUtils.isEmpty(userIdList) || ListUtils.isEmpty(itemList)) {
return; return;
...@@ -367,4 +391,15 @@ public class SelfPushBizImpl implements SelfPushBiz { ...@@ -367,4 +391,15 @@ public class SelfPushBizImpl implements SelfPushBiz {
selfPushItemDao.updatePushStatusByPushId(PushStatusEnum.PUSHING.value, pushId); selfPushItemDao.updatePushStatusByPushId(PushStatusEnum.PUSHING.value, pushId);
msgPush(userIdList, itemList, pushId); msgPush(userIdList, itemList, pushId);
} }
@Override
public void deleteByPushId(Long pushId) {
SelfPush selfPush = selfPushDao.getById(pushId);
if (null != selfPush && selfPush.getSendTime().before(new Date())){
throw new BookBizException(BookBizException.ERROR,"已发送,不能删除");
}
selfPushDao.deleteById(pushId);
selfPushItemDao.deleteByPushId(pushId);
selfPushUserDao.deleteByPushId(pushId);
}
} }
...@@ -290,12 +290,22 @@ public class PushCheck { ...@@ -290,12 +290,22 @@ public class PushCheck {
if (null == addParamDTO) { if (null == addParamDTO) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数为空"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数为空");
} }
if (SystemCode.adviser.code.equalsIgnoreCase(addParamDTO.getSystemCode()) && null == addParamDTO.getBookGroupId()){ if (SystemCode.adviser.code.equalsIgnoreCase(addParamDTO.getSystemCode())){//编辑端群发
if (null == addParamDTO.getBookGroupId()){
throw new BookBizException(BookBizException.PARAM_IS_NULL, "缺少bookGroupId"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "缺少bookGroupId");
} }
if (SystemCode.pcloud.code.equalsIgnoreCase(addParamDTO.getSystemCode()) && StringUtil.isEmpty(addParamDTO.getAltId())){ if (ListUtils.isEmpty(addParamDTO.getUserIdList())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "请选择群发对象");
}
}
if (SystemCode.pcloud.code.equalsIgnoreCase(addParamDTO.getSystemCode())){//平台端群发
if (StringUtil.isEmpty(addParamDTO.getAltId())){
throw new BookBizException(BookBizException.PARAM_IS_NULL, "缺少个人号id"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "缺少个人号id");
} }
if (ListUtils.isEmpty(addParamDTO.getUserIdList()) && null == addParamDTO.getSendAll()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "请选择群发对象");
}
}
if (null == addParamDTO.getSendNow()) { if (null == addParamDTO.getSendNow()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "缺少立即发送字段"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "缺少立即发送字段");
} }
...@@ -304,16 +314,13 @@ public class PushCheck { ...@@ -304,16 +314,13 @@ public class PushCheck {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "自定义发送时间设置有误"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "自定义发送时间设置有误");
} }
} }
if (ListUtils.isEmpty(addParamDTO.getUserIdList())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "群发好友为空");
}
if (ListUtils.isEmpty(addParamDTO.getPushItemList())) { if (ListUtils.isEmpty(addParamDTO.getPushItemList())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "发送消息为空"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "发送消息为空");
} }
if (addParamDTO.getPushItemList().size() > 4) { if (addParamDTO.getPushItemList().size() > 4) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "发送消息数量不能超过4条"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "发送消息数量不能超过4条");
} }
if (addParamDTO.getUserIdList().size() > 100) { if (!ListUtils.isEmpty(addParamDTO.getUserIdList()) && addParamDTO.getUserIdList().size() > 100) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "好友数量不能超过100"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "好友数量不能超过100");
} }
for (SelfPushItem pushItem : addParamDTO.getPushItemList()) { for (SelfPushItem pushItem : addParamDTO.getPushItemList()) {
......
...@@ -26,4 +26,6 @@ public interface SelfPushItemDao extends BaseDao<SelfPushItem>{ ...@@ -26,4 +26,6 @@ public interface SelfPushItemDao extends BaseDao<SelfPushItem>{
* @return * @return
*/ */
List<SelfPushItem> getByPushId(Long pushId); List<SelfPushItem> getByPushId(Long pushId);
public void deleteByPushId(Long pushId);
} }
...@@ -26,4 +26,6 @@ public interface SelfPushUserDao extends BaseDao<SelfPushUser>{ ...@@ -26,4 +26,6 @@ public interface SelfPushUserDao extends BaseDao<SelfPushUser>{
* @return * @return
*/ */
List<String> getUserIdListByPushId(Long pushId); List<String> getUserIdListByPushId(Long pushId);
public void deleteByPushId(Long pushId);
} }
...@@ -31,4 +31,9 @@ public class SelfPushItemDaoImpl extends BaseDaoImpl<SelfPushItem> implements Se ...@@ -31,4 +31,9 @@ public class SelfPushItemDaoImpl extends BaseDaoImpl<SelfPushItem> implements Se
public List<SelfPushItem> getByPushId(Long pushId) { public List<SelfPushItem> getByPushId(Long pushId) {
return getSessionTemplate().selectList(getStatement("getByPushId"), pushId); return getSessionTemplate().selectList(getStatement("getByPushId"), pushId);
} }
@Override
public void deleteByPushId(Long pushId) {
getSessionTemplate().delete(getStatement("deleteByPushId"), pushId);
}
} }
...@@ -26,4 +26,9 @@ public class SelfPushUserDaoImpl extends BaseDaoImpl<SelfPushUser>implements Sel ...@@ -26,4 +26,9 @@ public class SelfPushUserDaoImpl extends BaseDaoImpl<SelfPushUser>implements Sel
public List<String> getUserIdListByPushId(Long pushId) { public List<String> getUserIdListByPushId(Long pushId) {
return getSessionTemplate().selectList(getStatement("getUserIdListByPushId"), pushId); return getSessionTemplate().selectList(getStatement("getUserIdListByPushId"), pushId);
} }
@Override
public void deleteByPushId(Long pushId) {
getSessionTemplate().delete(getStatement("deleteByPushId"), pushId);
}
} }
...@@ -2,10 +2,10 @@ package com.pcloud.book.push.dto; ...@@ -2,10 +2,10 @@ package com.pcloud.book.push.dto;
import com.pcloud.book.push.entity.SelfPushItem; import com.pcloud.book.push.entity.SelfPushItem;
import lombok.Data;
import java.util.List; import java.util.List;
import lombok.Data;
/** /**
* @描述:个人号群发新增 * @描述:个人号群发新增
...@@ -13,6 +13,7 @@ import lombok.Data; ...@@ -13,6 +13,7 @@ import lombok.Data;
* @创建时间:9:49 2019/11/27 * @创建时间:9:49 2019/11/27
* @版本:1.0 * @版本:1.0
*/ */
@Data
public class SelfPushAddParamDTO { public class SelfPushAddParamDTO {
/** /**
...@@ -42,59 +43,10 @@ public class SelfPushAddParamDTO { ...@@ -42,59 +43,10 @@ public class SelfPushAddParamDTO {
private Long bookGroupId; private Long bookGroupId;
public String getAltId() { /**
return altId; * 是否发送所有好友
} */
private Boolean sendAll;
public void setAltId(String altId) {
this.altId = altId;
}
public List<String> getUserIdList() {
return userIdList;
}
public void setUserIdList(List<String> userIdList) {
this.userIdList = userIdList;
}
public List<SelfPushItem> getPushItemList() {
return pushItemList;
}
public void setPushItemList(List<SelfPushItem> pushItemList) {
this.pushItemList = pushItemList;
}
public Boolean getSendNow() {
return sendNow;
}
public void setSendNow(Boolean sendNow) {
this.sendNow = sendNow;
}
public String getSendTime() {
return sendTime;
}
public void setSendTime(String sendTime) {
this.sendTime = sendTime;
}
public String getSystemCode() {
return systemCode;
}
public void setSystemCode(String systemCode) {
this.systemCode = systemCode;
}
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
} }
...@@ -14,6 +14,7 @@ import lombok.Data; ...@@ -14,6 +14,7 @@ import lombok.Data;
* @创建时间:16:50 2019/11/27 * @创建时间:16:50 2019/11/27
* @版本:1.0 * @版本:1.0
*/ */
@Data
public class SelfPushRecordDTO extends BaseDto{ public class SelfPushRecordDTO extends BaseDto{
@ApiModelProperty("群发小号id") @ApiModelProperty("群发小号id")
...@@ -81,171 +82,14 @@ public class SelfPushRecordDTO extends BaseDto{ ...@@ -81,171 +82,14 @@ public class SelfPushRecordDTO extends BaseDto{
@ApiModelProperty("bookName") @ApiModelProperty("bookName")
private String bookName; private String bookName;
public String getAltId() { @ApiModelProperty("是否发送所有好友")
return altId; private Boolean sendAll;
}
public void setAltId(String altId) { @ApiModelProperty("创建人")
this.altId = altId; private Long createUser;
}
public String getRobotName() { @ApiModelProperty("创建人账号")
return robotName; private String userName;
}
public void setRobotName(String robotName) {
this.robotName = robotName;
}
public Long getPushId() {
return pushId;
}
public void setPushId(Long pushId) {
this.pushId = pushId;
}
public Long getPushItemId() {
return pushItemId;
}
public void setPushItemId(Long pushItemId) {
this.pushItemId = pushItemId;
}
public Integer getItemType() {
return itemType;
}
public void setItemType(Integer itemType) {
this.itemType = itemType;
}
public String getTextContent() {
return textContent;
}
public void setTextContent(String textContent) {
this.textContent = textContent;
}
public String getLinkUrl() {
return linkUrl;
}
public void setLinkUrl(String linkUrl) {
this.linkUrl = linkUrl;
}
public String getLinkTitle() {
return linkTitle;
}
public void setLinkTitle(String linkTitle) {
this.linkTitle = linkTitle;
}
public String getLinkDescription() {
return linkDescription;
}
public void setLinkDescription(String linkDescription) {
this.linkDescription = linkDescription;
}
public String getLinkImageUrl() {
return linkImageUrl;
}
public void setLinkImageUrl(String linkImageUrl) {
this.linkImageUrl = linkImageUrl;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public Long getAppId() {
return appId;
}
public void setAppId(Long appId) {
this.appId = appId;
}
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
public String getAppUrl() {
return appUrl;
}
public void setAppUrl(String appUrl) {
this.appUrl = appUrl;
}
public String getProductUrl() {
return productUrl;
}
public void setProductUrl(String productUrl) {
this.productUrl = productUrl;
}
public Integer getPushStatus() {
return pushStatus;
}
public void setPushStatus(Integer pushStatus) {
this.pushStatus = pushStatus;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getUserCount() {
return userCount;
}
public void setUserCount(Integer userCount) {
this.userCount = userCount;
}
public Date getSendTime() {
return sendTime;
}
public void setSendTime(Date sendTime) {
this.sendTime = sendTime;
}
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
public String getBookName() {
return bookName;
}
public void setBookName(String bookName) {
this.bookName = bookName;
}
} }
...@@ -39,6 +39,9 @@ public class SelfPush extends BaseEntity{ ...@@ -39,6 +39,9 @@ public class SelfPush extends BaseEntity{
@ApiModelProperty("bookGroupId") @ApiModelProperty("bookGroupId")
private Long bookGroupId; private Long bookGroupId;
@ApiModelProperty("是否发送所有好友")
private Boolean sendAll;
public String getAltId() { public String getAltId() {
return altId; return altId;
} }
...@@ -106,4 +109,12 @@ public class SelfPush extends BaseEntity{ ...@@ -106,4 +109,12 @@ public class SelfPush extends BaseEntity{
public void setBookGroupId(Long bookGroupId) { public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId; this.bookGroupId = bookGroupId;
} }
public Boolean getSendAll() {
return sendAll;
}
public void setSendAll(Boolean sendAll) {
this.sendAll = sendAll;
}
} }
\ No newline at end of file
...@@ -34,7 +34,7 @@ import io.swagger.annotations.ApiParam; ...@@ -34,7 +34,7 @@ import io.swagger.annotations.ApiParam;
* @版本:1.0 * @版本:1.0
*/ */
@Api(description = "个人号群发") @Api(description = "个人号群发")
@RestController("selfPush") @RestController("selfPushFacade")
@RequestMapping("selfPushFacade") @RequestMapping("selfPushFacade")
public class SelfPushFacade { public class SelfPushFacade {
@Autowired @Autowired
...@@ -99,4 +99,12 @@ public class SelfPushFacade { ...@@ -99,4 +99,12 @@ public class SelfPushFacade {
PageBeanNew<SelfPushRecordDTO> pageBeanNew = selfPushBiz.listSelfPushRecord(currentPage, numPerPage, startTime, endTime, status,partyId); PageBeanNew<SelfPushRecordDTO> pageBeanNew = selfPushBiz.listSelfPushRecord(currentPage, numPerPage, startTime, endTime, status,partyId);
return new ResponseDto<>(pageBeanNew); return new ResponseDto<>(pageBeanNew);
} }
@ApiOperation("根据pushId删除")
@GetMapping("deleteByPushId")
public ResponseDto<?> deleteByPushId(@RequestHeader("token") String token,@RequestParam("pushId") Long pushId) throws PermissionException {
SessionUtil.getInfoToken4Redis(token);
selfPushBiz.deleteByPushId(pushId);
return new ResponseDto<>();
}
} }
...@@ -112,7 +112,9 @@ ...@@ -112,7 +112,9 @@
i.product_url productUrl, i.product_url productUrl,
i.push_status pushStatus, i.push_status pushStatus,
i.create_time createTime, i.create_time createTime,
i.send_time sendTime i.send_time sendTime,
p.send_all sendAll,
p.create_user createUser
FROM FROM
self_push_item i self_push_item i
LEFT JOIN self_push p ON i.push_id = p.id LEFT JOIN self_push p ON i.push_id = p.id
...@@ -124,7 +126,14 @@ ...@@ -124,7 +126,14 @@
<if test="pushStatus != null"> <if test="pushStatus != null">
AND i.push_status = #{pushStatus} AND i.push_status = #{pushStatus}
</if> </if>
<choose>
<when test="partyId == 0">
AND p.alt_id IS NOT NULL
</when>
<otherwise>
AND p.create_user = #{partyId} AND p.create_user = #{partyId}
</otherwise>
</choose>
ORDER BY ORDER BY
i.create_time DESC, i.id DESC i.create_time DESC, i.id DESC
</select> </select>
...@@ -141,4 +150,10 @@ ...@@ -141,4 +150,10 @@
WHERE push_id = #{pushId} WHERE push_id = #{pushId}
</select> </select>
<delete id="deleteByPushId" parameterType="long">
delete from
self_push_item
WHERE push_id = #{pushId}
</delete>
</mapper> </mapper>
\ No newline at end of file
...@@ -11,20 +11,21 @@ ...@@ -11,20 +11,21 @@
<result column="send_now" property="sendNow" jdbcType="BIT" /> <result column="send_now" property="sendNow" jdbcType="BIT" />
<result column="send_time" property="sendTime" jdbcType="TIMESTAMP" /> <result column="send_time" property="sendTime" jdbcType="TIMESTAMP" />
<result column="book_group_id" property="bookGroupId" jdbcType="BIGINT" /> <result column="book_group_id" property="bookGroupId" jdbcType="BIGINT" />
<result column="send_all" property="sendAll" jdbcType="BIT" />
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
id, alt_id, create_user, create_time, update_user, update_time, send_now, send_time, book_group_id id, alt_id, create_user, create_time, update_user, update_time, send_now, send_time, book_group_id, send_all
</sql> </sql>
<insert id="insert" parameterType="com.pcloud.book.push.entity.SelfPush" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" parameterType="com.pcloud.book.push.entity.SelfPush" useGeneratedKeys="true" keyProperty="id">
insert into self_push (id, alt_id, create_user, insert into self_push (id, alt_id, create_user,
create_time, update_user, update_time, send_now, send_time, book_group_id create_time, update_user, update_time, send_now, send_time, book_group_id, send_all
) )
values (#{id,jdbcType=BIGINT}, #{altId,jdbcType=VARCHAR}, #{createUser,jdbcType=BIGINT}, values (#{id,jdbcType=BIGINT}, #{altId,jdbcType=VARCHAR}, #{createUser,jdbcType=BIGINT},
now(), #{updateUser,jdbcType=BIGINT}, now(), #{sendNow}, #{sendTime}, #{bookGroupId} now(), #{updateUser,jdbcType=BIGINT}, now(), #{sendNow}, #{sendTime}, #{bookGroupId}, #{sendAll}
) )
</insert> </insert>
...@@ -35,4 +36,10 @@ ...@@ -35,4 +36,10 @@
WHERE id= #{id} WHERE id= #{id}
</select> </select>
<delete id="deleteById" parameterType="long">
delete from
self_push
WHERE id= #{id}
</delete>
</mapper> </mapper>
\ No newline at end of file
...@@ -66,4 +66,10 @@ ...@@ -66,4 +66,10 @@
push_id = #{pushId} push_id = #{pushId}
</select> </select>
<delete id="deleteByPushId" parameterType="long">
delete from
self_push_user
WHERE push_id = #{pushId}
</delete>
</mapper> </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