Commit c92e4e0d by 郑永强

早晚报公众号选择

parent d87b70b1
......@@ -56,7 +56,7 @@ public interface AdNewsBiz {
Long addAdNewsWechat(AdNewsWechat adNewsWechat);
/**
* 获取公众号列表
* 获取所有的公众号列表
* @param currentPage
* @param numPerPage
* @return
......
......@@ -387,11 +387,14 @@ public class AdNewsBizImpl implements AdNewsBiz {
adNewsWechatChoose.setUpdateUser(partyId);
adNewsWechatChooses.add(adNewsWechatChoose);
}
//校验重复添加
Integer count = adNewsWechatChooseDao.getCountByAdNewsWechatIdsAndPartyId(adNewsWechatIds, partyId);
if (count > 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "请勿重复添加!");
}
// //校验重复添加
// Integer count = adNewsWechatChooseDao.getCountByAdNewsWechatIdsAndPartyId(adNewsWechatIds, partyId);
// if (count > 0) {
// throw new BookBizException(BookBizException.PARAM_IS_ERROR, "请勿重复添加!");
// }
// 移除编辑之前的选择
adNewsWechatChooseDao.deleteAdNewsWechatChooseByPartyId(partyId);
// 重新建立关系
adNewsWechatChooseDao.batchInsert(adNewsWechatChooses);
}
......
......@@ -16,5 +16,7 @@ public interface AdNewsWechatChooseDao extends BaseDao<AdNewsWechatChoose> {
void deleteAdNewsWechatChooseById(Long adNewsWechatId, Long partyId);
void deleteAdNewsWechatChooseByPartyId(Long partyId);
Integer getCountByAdNewsWechatIdsAndPartyId(List<Long> adNewsIds, Long partyId);
}
......@@ -30,6 +30,13 @@ public class AdNewsWechatChooseDaoImpl extends BaseDaoImpl<AdNewsWechatChoose> i
}
@Override
public void deleteAdNewsWechatChooseByPartyId(Long partyId) {
Map<String, Object> map = new HashMap<>();
map.put("partyId", partyId);
super.getSqlSession().delete(getStatement("deleteAdNewsWechatChooseByPartyId"), map);
}
@Override
public Integer getCountByAdNewsWechatIdsAndPartyId(List<Long> adNewsWechatIds, Long partyId) {
Map<String, Object> map = new HashMap<>();
map.put("adNewsWechatIds", adNewsWechatIds);
......
package com.pcloud.book.adnews.facade;
import com.pcloud.book.adnews.entity.AdNewsSet;
import com.pcloud.book.adnews.entity.AdNewsWechat;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.permission.PermissionException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -12,7 +14,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.List;
@FeignClient(value = "pcloud-service-book",qualifier = "adNewsFacadeCloud",path = "adNews")
@FeignClient(value = "pcloud-service-book", qualifier = "adNewsFacadeCloud", path = "adNews")
@Api(description = "推送群消息外部接口")
public interface AdNewsFacade {
......@@ -54,7 +56,7 @@ public interface AdNewsFacade {
@GetMapping("/getAdNewsList")
ResponseDto<?> getAdNewsList(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "title",required = false) @ApiParam("标题") String title,
@RequestParam(value = "title", required = false) @ApiParam("标题") String title,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException;
......@@ -63,8 +65,8 @@ public interface AdNewsFacade {
@GetMapping("/getAdNewsChooseList")
ResponseDto<?> getAdNewsChooseList(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "title",required = false) @ApiParam("标题") String title,
@RequestParam(value = "hasUsed",required = false) @ApiParam("标题") Boolean hasUsed,
@RequestParam(value = "title", required = false) @ApiParam("标题") String title,
@RequestParam(value = "hasUsed", required = false) @ApiParam("标题") Boolean hasUsed,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException;
......@@ -74,7 +76,36 @@ public interface AdNewsFacade {
@PostMapping("/addAdNewsWechat")
ResponseDto<?> addAdNewsWechat(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "wechatName") @ApiParam("公众号id/微信号") String wechatName
) throws BizException,PermissionException;
@RequestParam(value = "wechatName") @ApiParam("公众号名称") String wechatName
) throws BizException, PermissionException;
@ApiOperation("添加编辑选择的公众号")
@PostMapping("/createAdNewsWechatChooseBatch")
ResponseDto<?> createAdNewsWechatChooseBatch(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestBody @ApiParam("选择的公众号主键") List<Long> adNewsWechatIds
) throws BizException, PermissionException;
@ApiOperation("移除编辑已选择的公众号")
@PostMapping("/deleteAdNewsWechatChoose")
ResponseDto<?> deleteAdNewsWechatChoose(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "adNewsWechatId") @ApiParam("公众号主键") Long adNewsWechatId
) throws BizException, PermissionException;
@ApiOperation("获取编辑已选择的公众号")
@GetMapping("/getAdNewsWechatChooseList")
ResponseDto<?> getAdNewsWechatChooseList(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException;
@ApiOperation("获取所有的公众号列表")
@GetMapping("/getAdNewsWechatList")
ResponseDto<?> getAdNewsWechatList(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException;
}
......@@ -85,10 +85,10 @@ public class AdNewsFacadeImpl implements AdNewsFacade {
@RequestBody @ApiParam("新闻id集合") List<Long> adNewsIds
) throws BizException, PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (ListUtils.isEmpty(adNewsIds)){
if (ListUtils.isEmpty(adNewsIds)) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数错误");
}
adNewsBiz.createAdNewsChooseBatch(adNewsIds,partyId);
adNewsBiz.createAdNewsChooseBatch(adNewsIds, partyId);
return new ResponseDto<>();
}
......@@ -112,7 +112,7 @@ public class AdNewsFacadeImpl implements AdNewsFacade {
@Override
public ResponseDto<?> getAdNewsList(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "title",required = false) @ApiParam("标题") String title,
@RequestParam(value = "title", required = false) @ApiParam("标题") String title,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException {
......@@ -123,7 +123,7 @@ public class AdNewsFacadeImpl implements AdNewsFacade {
if (numPerPage == null || numPerPage <= 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "每页条数不能为空且必须大于0!");
}
return new ResponseDto<>(adNewsBiz.getAdNewsList(title,partyId,currentPage,numPerPage));
return new ResponseDto<>(adNewsBiz.getAdNewsList(title, partyId, currentPage, numPerPage));
}
@ApiOperation("获取编辑选择的早晚报素材库")
......@@ -131,8 +131,8 @@ public class AdNewsFacadeImpl implements AdNewsFacade {
@Override
public ResponseDto<?> getAdNewsChooseList(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "title",required = false) @ApiParam("标题") String title,
@RequestParam(value = "hasUsed",required = false) @ApiParam("使用状态") Boolean hasUsed,
@RequestParam(value = "title", required = false) @ApiParam("标题") String title,
@RequestParam(value = "hasUsed", required = false) @ApiParam("使用状态") Boolean hasUsed,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException {
......@@ -152,9 +152,69 @@ public class AdNewsFacadeImpl implements AdNewsFacade {
public ResponseDto<?> addAdNewsWechat(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "wechatName") @ApiParam("公众号id/微信号") String wechatName
) throws BizException,PermissionException{
Long partyId = (Long) SessionUtil.getVlaue(token,SessionUtil.PARTY_ID);
AdNewsWechat adNewsWechat = new AdNewsWechat(null,wechatName,partyId,false);
) throws BizException, PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
AdNewsWechat adNewsWechat = new AdNewsWechat(null, wechatName, partyId, false);
return new ResponseDto<>(adNewsBiz.addAdNewsWechat(adNewsWechat));
}
@ApiOperation("添加编辑选择的公众号")
@PostMapping("/createAdNewsWechatChooseBatch")
@Override
public ResponseDto<?> createAdNewsWechatChooseBatch(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestBody @ApiParam("选择的公众号主键") List<Long> adNewsWechatIds
) throws BizException, PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
adNewsBiz.createAdNewsWechatChooseBatch(adNewsWechatIds,partyId);
return new ResponseDto<>();
}
@Override
@ApiOperation("移除编辑已选择的公众号")
@PostMapping("/deleteAdNewsWechatChoose")
public ResponseDto<?> deleteAdNewsWechatChoose(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "adNewsWechatId") @ApiParam("公众号主键") Long adNewsWechatId
) throws BizException, PermissionException{
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
adNewsBiz.deleteAdNewsWechatChoose(adNewsWechatId,partyId);
return new ResponseDto<>();
}
@Override
@ApiOperation("获取编辑已选择的公众号")
@GetMapping("/getAdNewsWechatChooseList")
public ResponseDto<?> getAdNewsWechatChooseList(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException{
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (currentPage == null || currentPage < 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "当前页不能为空且不能小于0!");
}
if (numPerPage == null || numPerPage <= 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "每页条数不能为空且必须大于0!");
}
return new ResponseDto<>(adNewsBiz.getAdNewsWechatChooseList(partyId, currentPage, numPerPage));
}
@Override
@ApiOperation("获取所有的公众号列表")
@GetMapping("/getAdNewsWechatList")
public ResponseDto<?> getAdNewsWechatList(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException{
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (currentPage == null || currentPage < 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "当前页不能为空且不能小于0!");
}
if (numPerPage == null || numPerPage <= 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "每页条数不能为空且必须大于0!");
}
return new ResponseDto<>(adNewsBiz.getAdNewsWechatList(currentPage, numPerPage));
}
}
......@@ -100,6 +100,15 @@
where ad_news_wechat_id=#{adNewsWechatId}
</update>
<!--根据编辑id删除-->
<update id="deleteAdNewsWechatChooseByPartyId" parameterType="map">
update ad_news_wechat_choose set
is_delete=1,
update_user=#{partyId},
update_time=now()
where adviser_id=#{partyId}
</update>
<!--根据条件获取数量-->
<select id="getCountByAdNewsWechatIdsAndPartyId" parameterType="map" resultType="Integer">
select count(1) from ad_news_wechat_choose where
......
......@@ -43,7 +43,7 @@
a.update_time
FROM
ad_news_wechat a
LEFT JOIN ad_news_wechat_choose b ON b.ad_news_wechat_id = b.id
INNER JOIN ad_news_wechat_choose b ON b.ad_news_wechat_id = a.id
AND b.is_delete = 0
AND b.adviser_id = #{partyId}
WHERE
......
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