Commit f725f7e2 by 宋祥

Merge branch 'mymaster' into 'master'

【ID1000886】广告位,支持定时多次投放到微信群

See merge request rays/pcloud-book!46
parents 495d4287 29e05e5b
package com.pcloud.book.advertising.service;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.pcloud.common.exceptions.BizException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.Map;
@FeignClient(value = "pcloud-service-book", qualifier = "advertisingSpaceServiceCloud", path = "book/v1.0/advertisingSpaceService")
@Api(description = "广告位内部接口")
public interface AdvertisingSpaceService {
......@@ -18,4 +22,8 @@ public interface AdvertisingSpaceService {
@ApiOperation(value = "每日凌晨计算昨日广告位收益", httpMethod = "GET")
@RequestMapping(value = "calculateAdvertisingIncomeYesterday", method = RequestMethod.GET)
void calculateAdvertisingIncomeYesterday() throws BizException;
@ApiOperation("发送广告计划")
@PostMapping("sendAdvertisingPlan")
void sendAdvertisingPlan(@RequestBody Map<String, Object> map) throws BizException;
}
package com.pcloud.book.advertising.biz;
import java.util.List;
import java.util.Map;
import com.pcloud.book.advertising.dto.AdvertisingMasterDTO;
import com.pcloud.book.advertising.dto.AdvertisingSpaceDTO;
import com.pcloud.book.advertising.dto.QrcodeAdvertisingSpaceCountDTO;
......@@ -10,9 +12,6 @@ import com.pcloud.common.page.PageBean;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import java.util.List;
import java.util.Map;
/**
* Description 广告位业务逻辑层接口
* @author PENG
......@@ -62,9 +61,10 @@ public interface AdvertisingSpaceBiz {
/**
* 投放微信群
* @param book 广告位书刊实体
* @param isPlan 是否广告位计划
* @throws BizException
*/
void distributeWechatGroup(AdvertisingDistributionBook book) throws BizException;
void distributeWechatGroup(AdvertisingDistributionBook book, Boolean isPlan) throws BizException;
/**
* 获取出版社书刊权限
......@@ -409,4 +409,38 @@ public interface AdvertisingSpaceBiz {
* @param id
*/
public void updateTestStatus(Boolean isTest, Long id);
/**
* 创建广告位计划
* @param advertisingPlan
* @return
*/
Long createAdvertisingPlan(AdvertisingPlan advertisingPlan);
/**
* 修改广告位计划
* @param advertisingPlan
*/
void updateAdvertisingPlan(AdvertisingPlan advertisingPlan);
/**
* 发送广告位计划
*/
void sendAdvertisingPlan(Long advertisingPutId);
/**
* 删除广告位计划
*/
void deleteAdvertisingPlan(Long advertisingPlanId, Long partyId);
/**
* 获取广告位计划
*/
AdvertisingPlan getAdvertisingPlan(Long advertisingPlanId);
/**
* 获取广告位计划列表
*/
PageBeanNew<AdvertisingPlan> getAdvertisingPlanList(String keyword, Long partyId, Integer currentPage, Integer numPerPage);
}
package com.pcloud.book.advertising.check;
import com.pcloud.book.advertising.entity.AdvertisingPlan;
import com.pcloud.book.advertising.entity.AdvertisingPut;
import com.pcloud.book.advertising.entity.AdvertisingPlanGroup;
import com.pcloud.book.advertising.enums.PutTypeEnum;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.utils.ListUtils;
import org.springframework.stereotype.Component;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/27 16:13
**/
@Component("advertisingPlanCheck")
public class AdvertisingPlanCheck {
@ParamLog("新增广告位计划参数校验")
public void checkCreateAdvertisingPlan(AdvertisingPlan advertisingPlan) {
if (ListUtils.isEmpty(advertisingPlan.getAdvertisingPuts())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "广告位定时投放不能为空!");
}
if (ListUtils.isEmpty(advertisingPlan.getAdvertisingPlanGroups())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "关联群不能为空!");
}
for (AdvertisingPut advertisingPut : advertisingPlan.getAdvertisingPuts()) {
if (advertisingPut == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "广告位定时投放不能为空!");
}
if (advertisingPut.getAdvertisingSpaceId() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "广告位id不能为空!");
}
if (advertisingPut.getPutType() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "投放类型不能为空!");
}
if (advertisingPut.getPutTime() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "投放时间不能为空!");
}
if (PutTypeEnum.DAY.value.equals(advertisingPut.getPutType()) || PutTypeEnum.DAY.value.equals(advertisingPut.getPutType())) {
if (advertisingPut.getStartTime() == null || advertisingPut.getEndTime() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "开始时间结束时间不能为空!");
}
}
}
for (AdvertisingPlanGroup advertisingPutGroup : advertisingPlan.getAdvertisingPlanGroups()) {
if (advertisingPutGroup == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "广告位计划关联不能为空!");
}
if (advertisingPutGroup.getBookId() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "bookId不能为空!");
}
if (advertisingPutGroup.getBookGroupId() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "bookGroupId不能为空!");
}
if (advertisingPutGroup.getClassifyId() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "分类不能为空!");
}
if (advertisingPutGroup.getQrcodeId() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "群id不能为空!");
}
if (advertisingPutGroup.getWeixinGroupId() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "微信群号不能为空!");
}
}
}
}
package com.pcloud.book.advertising.dao;
import com.pcloud.book.advertising.entity.AdvertisingPlan;
import com.pcloud.common.core.dao.BaseDao;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/27 15:36
**/
public interface AdvertisingPlanDao extends BaseDao<AdvertisingPlan> {
}
package com.pcloud.book.advertising.dao;
import com.pcloud.book.advertising.entity.AdvertisingPlanGroup;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
public interface AdvertisingPlanGroupDao extends BaseDao<AdvertisingPlanGroup> {
Integer batchInsert(List<AdvertisingPlanGroup> advertisingPlanGroups);
/**
* 根据计划id查询
*/
List<AdvertisingPlanGroup> getListByPlanId(Long planId);
/**
* 批量删除
*/
void deleteByIds(List<Long> ids, Long partyId);
/**
* 根据计划id删除
*/
void deleteByPlanId(Long planId, Long partyId);
/**
* 根据计划id集合查询
*/
List<AdvertisingPlanGroup> getListByPlanIds(List<Long> planIds);
}
package com.pcloud.book.advertising.dao;
import com.pcloud.book.advertising.entity.AdvertisingPut;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
public interface AdvertisingPutDao extends BaseDao<AdvertisingPut> {
Integer batchInsert(List<AdvertisingPut> advertisingPuts);
/**
* 根据计划id查询
*/
List<AdvertisingPut> getListByPlanId(Long planId);
/**
* 根据id集合删除
*/
void deleteByIds(List<Long> ids, Long partyId);
/**
* 根据计划id结合查询
*/
List<AdvertisingPut> getListByPlanIds(List<Long> planIds);
}
package com.pcloud.book.advertising.dao.impl;
import com.pcloud.book.advertising.dao.AdvertisingPlanDao;
import com.pcloud.book.advertising.entity.AdvertisingPlan;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/27 15:37
**/
@Repository("advertisingPlanDao")
public class AdvertisingPlanDaoImpl extends BaseDaoImpl<AdvertisingPlan> implements AdvertisingPlanDao {
}
package com.pcloud.book.advertising.dao.impl;
import com.pcloud.book.advertising.dao.AdvertisingPlanGroupDao;
import com.pcloud.book.advertising.entity.AdvertisingPlanGroup;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/27 15:37
**/
@Repository("advertisingPlanGroupDao")
public class AdvertisingPlanGroupDaoImpl extends BaseDaoImpl<AdvertisingPlanGroup> implements AdvertisingPlanGroupDao {
@Override
public Integer batchInsert(List<AdvertisingPlanGroup> list) {
return super.getSqlSession().insert(getStatement("batchInsert"), list);
}
@Override
public List<AdvertisingPlanGroup> getListByPlanId(Long planId) {
return super.getSqlSession().selectList(getStatement("getListByPlanId"), planId);
}
@Override
public void deleteByIds(List<Long> ids, Long partyId) {
Map<String, Object> map = new HashMap<>();
map.put("ids", ids);
map.put("partyId", partyId);
super.getSqlSession().delete(getStatement("deleteByIds"), map);
}
@Override
public void deleteByPlanId(Long planId, Long partyId) {
Map<String, Object> map = new HashMap<>();
map.put("planId", planId);
map.put("partyId", partyId);
super.getSqlSession().delete(getStatement("deleteByPlanId"), map);
}
@Override
public List<AdvertisingPlanGroup> getListByPlanIds(List<Long> planIds) {
Map<String, Object> map = new HashMap<>();
map.put("planIds", planIds);
return super.getSqlSession().selectList(getStatement("getListByPlanIds"), map);
}
}
package com.pcloud.book.advertising.dao.impl;
import com.pcloud.book.advertising.dao.AdvertisingPutDao;
import com.pcloud.book.advertising.entity.AdvertisingPut;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/27 15:37
**/
@Repository("advertisingPutDao")
public class AdvertisingPutDaoImpl extends BaseDaoImpl<AdvertisingPut> implements AdvertisingPutDao {
@Override
public Integer batchInsert(List<AdvertisingPut> list) {
return super.getSqlSession().insert(getStatement("batchInsert"), list);
}
@Override
public List<AdvertisingPut> getListByPlanId(Long planId) {
return super.getSqlSession().selectList(getStatement("getListByPlanId"), planId);
}
@Override
public void deleteByIds(List<Long> ids, Long partyId) {
Map<String, Object> map = new HashMap<>();
map.put("ids", ids);
map.put("partyId", partyId);
super.getSqlSession().delete(getStatement("deleteByIds"), map);
}
@Override
public List<AdvertisingPut> getListByPlanIds(List<Long> planIds) {
Map<String, Object> map = new HashMap<>();
map.put("planIds", planIds);
return super.getSqlSession().selectList(getStatement("getListByPlanIds"), map);
}
}
package com.pcloud.book.advertising.dto;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/28 17:24
**/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class WeixinClassifyInfoDTO implements Serializable {
private static final long serialVersionUID = 6382137896580487792L;
@ApiModelProperty("书id")
private Long bookId;
@ApiModelProperty("书名")
private String bookName;
@ApiModelProperty("分类id")
private Long classifyId;
@ApiModelProperty("分类名称")
private String classify;
@ApiModelProperty("社群id")
private Long bookGroupId;
@ApiModelProperty("社群码名称")
private String groupQrcodeName;
@ApiModelProperty("社群书群id")
private Long qrcodeId;
@ApiModelProperty("微信群id")
private String weixinGroupId;
@ApiModelProperty("微信群名称")
private String weixinGroupName;
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 getClassifyId() {
return classifyId;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public String getClassify() {
return classify;
}
public void setClassify(String classify) {
this.classify = classify;
}
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 getQrcodeId() {
return qrcodeId;
}
public void setQrcodeId(Long qrcodeId) {
this.qrcodeId = qrcodeId;
}
public String getWeixinGroupId() {
return weixinGroupId;
}
public void setWeixinGroupId(String weixinGroupId) {
this.weixinGroupId = weixinGroupId;
}
public String getWeixinGroupName() {
return weixinGroupName;
}
public void setWeixinGroupName(String weixinGroupName) {
this.weixinGroupName = weixinGroupName;
}
@Override
public String toString() {
return "WeixinClassifyInfoDTO{" +
"bookId=" + bookId +
", bookName='" + bookName + '\'' +
", classifyId=" + classifyId +
", classify='" + classify + '\'' +
", bookGroupId=" + bookGroupId +
", groupQrcodeName='" + groupQrcodeName + '\'' +
", qrcodeId=" + qrcodeId +
", weixinGroupId='" + weixinGroupId + '\'' +
", weixinGroupName='" + weixinGroupName + '\'' +
'}';
}
}
package com.pcloud.book.advertising.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/27 15:02
**/
@ApiModel("广告位投放计划id")
public class AdvertisingPlan extends BaseEntity {
private static final long serialVersionUID = 6433715659057254836L;
@ApiModelProperty("是否删除")
private Boolean isDelete;
@ApiModelProperty("创建人")
private Long createUser;
@ApiModelProperty("修改人")
private Long updateUser;
private List<AdvertisingPut> advertisingPuts;
private List<AdvertisingPlanGroup> advertisingPlanGroups;
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;
}
public List<AdvertisingPut> getAdvertisingPuts() {
return advertisingPuts;
}
public void setAdvertisingPuts(List<AdvertisingPut> advertisingPuts) {
this.advertisingPuts = advertisingPuts;
}
public List<AdvertisingPlanGroup> getAdvertisingPlanGroups() {
return advertisingPlanGroups;
}
public void setAdvertisingPlanGroups(List<AdvertisingPlanGroup> advertisingPlanGroups) {
this.advertisingPlanGroups = advertisingPlanGroups;
}
@Override
public String toString() {
return "AdvertisingPlan{" +
"isDelete=" + isDelete +
", createUser=" + createUser +
", updateUser=" + updateUser +
", advertisingPuts=" + advertisingPuts +
", advertisingPlanGroups=" + advertisingPlanGroups +
"} " + super.toString();
}
}
package com.pcloud.book.advertising.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/27 15:06
**/
@ApiModel("广告位投放关联")
public class AdvertisingPlanGroup extends BaseEntity {
private static final long serialVersionUID = 6369920743164721663L;
@ApiModelProperty("广告位计划id")
private Long advertisingPlanId;
@ApiModelProperty("书id")
private Long bookId;
@ApiModelProperty("社群id")
private Long bookGroupId;
@ApiModelProperty("分类id")
private Long classifyId;
@ApiModelProperty("社群书群id")
private Long qrcodeId;
@ApiModelProperty("微信群id")
private String weixinGroupId;
@ApiModelProperty("是否删除")
private Boolean isDelete;
@ApiModelProperty("创建人")
private Long createUser;
@ApiModelProperty("修改人")
private Long updateUser;
@ApiModelProperty("书名")
private String bookName;
@ApiModelProperty("社群码名称")
private String groupQrcodeName;
@ApiModelProperty("分类名称")
private String classify;
@ApiModelProperty("微信群名称")
private String weixinGroupName;
public Long getAdvertisingPlanId() {
return advertisingPlanId;
}
public void setAdvertisingPlanId(Long advertisingPlanId) {
this.advertisingPlanId = advertisingPlanId;
}
public Long getBookId() {
return bookId;
}
public void setBookId(Long bookId) {
this.bookId = bookId;
}
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
public Long getClassifyId() {
return classifyId;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public Long getQrcodeId() {
return qrcodeId;
}
public void setQrcodeId(Long qrcodeId) {
this.qrcodeId = qrcodeId;
}
public String getWeixinGroupId() {
return weixinGroupId;
}
public void setWeixinGroupId(String weixinGroupId) {
this.weixinGroupId = weixinGroupId;
}
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;
}
public String getBookName() {
return bookName;
}
public void setBookName(String bookName) {
this.bookName = bookName;
}
public String getGroupQrcodeName() {
return groupQrcodeName;
}
public void setGroupQrcodeName(String groupQrcodeName) {
this.groupQrcodeName = groupQrcodeName;
}
public String getClassify() {
return classify;
}
public void setClassify(String classify) {
this.classify = classify;
}
public String getWeixinGroupName() {
return weixinGroupName;
}
public void setWeixinGroupName(String weixinGroupName) {
this.weixinGroupName = weixinGroupName;
}
@Override
public String toString() {
return "AdvertisingPlanGroup{" +
"advertisingPlanId=" + advertisingPlanId +
", bookId=" + bookId +
", bookGroupId=" + bookGroupId +
", classifyId=" + classifyId +
", qrcodeId=" + qrcodeId +
", weixinGroupId='" + weixinGroupId + '\'' +
", isDelete=" + isDelete +
", createUser=" + createUser +
", updateUser=" + updateUser +
", bookName='" + bookName + '\'' +
", groupQrcodeName='" + groupQrcodeName + '\'' +
", classify='" + classify + '\'' +
", weixinGroupName='" + weixinGroupName + '\'' +
"} " + super.toString();
}
}
package com.pcloud.book.advertising.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/27 14:55
**/
@ApiModel("广告位定时投放模型")
public class AdvertisingPut extends BaseEntity {
private static final long serialVersionUID = 6433715659057254836L;
@ApiModelProperty("广告位id")
private Long advertisingSpaceId;
@ApiModelProperty("广告位计划id")
private Long advertisingPlanId;
@ApiModelProperty("投放时间类型(1:单次发送 2:每天发送 3:每周发送)")
private Integer putType;
@ApiModelProperty("投放时间")
private String putTime;
@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 Boolean isDelete;
@ApiModelProperty("创建人")
private Long createUser;
@ApiModelProperty("修改人")
private Long updateUser;
@ApiModelProperty("广告位")
private AdvertisingSpace advertisingSpace;
public Long getAdvertisingSpaceId() {
return advertisingSpaceId;
}
public void setAdvertisingSpaceId(Long advertisingSpaceId) {
this.advertisingSpaceId = advertisingSpaceId;
}
public Long getAdvertisingPlanId() {
return advertisingPlanId;
}
public void setAdvertisingPlanId(Long advertisingPlanId) {
this.advertisingPlanId = advertisingPlanId;
}
public Integer getPutType() {
return putType;
}
public void setPutType(Integer putType) {
this.putType = putType;
}
public String getPutTime() {
return putTime;
}
public void setPutTime(String putTime) {
this.putTime = putTime;
}
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 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;
}
public AdvertisingSpace getAdvertisingSpace() {
return advertisingSpace;
}
public void setAdvertisingSpace(AdvertisingSpace advertisingSpace) {
this.advertisingSpace = advertisingSpace;
}
@Override
public String toString() {
return "AdvertisingPut{" +
"advertisingSpaceId=" + advertisingSpaceId +
", advertisingPlanId=" + advertisingPlanId +
", putType=" + putType +
", putTime='" + putTime + '\'' +
", startTime=" + startTime +
", endTime=" + endTime +
", weekDay=" + weekDay +
", isDelete=" + isDelete +
", createUser=" + createUser +
", updateUser=" + updateUser +
", advertisingSpace=" + advertisingSpace +
"} " + super.toString();
}
}
package com.pcloud.book.advertising.enums;
public enum PutTypeEnum {
/**
* 单次发送
*/
ONE(1),
/**
* 每天发送
*/
DAY(2),
/**
* 每周
*/
WEEK(3);
public final Integer value;
PutTypeEnum(Integer value) {
this.value = value;
}
}
......@@ -858,4 +858,41 @@ public interface AdvertisingSpaceFacade {
@PostMapping("updateTestStatus")
public ResponseDto<?> updateTestStatus(@RequestHeader("token") String token, @RequestBody @ApiParam TestParamDTO testParamDTO) throws PermissionException;
@ApiOperation("创建广告位计划")
@PostMapping("createAdvertisingPlan")
ResponseDto<?> createAdvertisingPlan(
@RequestHeader("token") String token,
@RequestBody @ApiParam("广告位计划") AdvertisingPlan advertisingPlan
) throws PermissionException, BizException, JsonParseException;
@ApiOperation("修改广告位计划")
@PostMapping("updateAdvertisingPlan")
ResponseDto<?> updateAdvertisingPlan(
@RequestHeader("token") String token,
@RequestBody @ApiParam("广告位计划") AdvertisingPlan advertisingPlan
) throws PermissionException, BizException, JsonParseException;
@ApiOperation("删除广告位计划")
@GetMapping("deleteAdvertisingPlan")
ResponseDto<?> deleteAdvertisingPlan(
@RequestHeader("token") String token,
@RequestParam @ApiParam("广告位计划id") Long advertisingPlanId
) throws PermissionException, BizException, JsonParseException;
@ApiOperation("获取广告位计划")
@GetMapping("getAdvertisingPlan")
ResponseDto<?> getAdvertisingPlan(
@RequestHeader("token") String token,
@RequestParam @ApiParam("广告位计划id") Long advertisingPlanId
) throws PermissionException, BizException, JsonParseException;
@ApiOperation("获取广告位计划列表")
@GetMapping("getAdvertisingPlanList")
ResponseDto<?> getAdvertisingPlanList(
@RequestHeader("token") String token,
@RequestParam(value = "keyword", required = false) String keyword,
@RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage
) throws PermissionException, BizException, JsonParseException;
}
......@@ -133,7 +133,7 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade {
if (null == advertisingDistributionBook) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
}
advertisingSpaceBiz.distributeWechatGroup(advertisingDistributionBook);
advertisingSpaceBiz.distributeWechatGroup(advertisingDistributionBook, false);
return new ResponseDto<>();
}
......@@ -701,4 +701,84 @@ public class AdvertisingSpaceFacadeImpl implements AdvertisingSpaceFacade {
return new ResponseDto<>();
}
@ApiOperation("创建广告位计划")
@PostMapping("createAdvertisingPlan")
@Override
public ResponseDto<?> createAdvertisingPlan(
@RequestHeader("token") String token,
@RequestBody @ApiParam("广告位计划") AdvertisingPlan advertisingPlan
) throws PermissionException, BizException, JsonParseException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (null == advertisingPlan) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
}
advertisingPlan.setCreateUser(partyId);
advertisingPlan.setUpdateUser(partyId);
return new ResponseDto<>(advertisingSpaceBiz.createAdvertisingPlan(advertisingPlan));
}
@ApiOperation("修改广告位计划")
@PostMapping("updateAdvertisingPlan")
@Override
public ResponseDto<?> updateAdvertisingPlan(
@RequestHeader("token") String token,
@RequestBody @ApiParam("广告位计划") AdvertisingPlan advertisingPlan
) throws PermissionException, BizException, JsonParseException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (null == advertisingPlan) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
}
if (advertisingPlan.getId() == null) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "计划id不能为空!");
}
advertisingPlan.setUpdateUser(partyId);
advertisingSpaceBiz.updateAdvertisingPlan(advertisingPlan);
return new ResponseDto<>();
}
@ApiOperation("删除广告位计划")
@GetMapping("deleteAdvertisingPlan")
@Override
public ResponseDto<?> deleteAdvertisingPlan(
@RequestHeader("token") String token,
@RequestParam @ApiParam("广告位计划id") Long advertisingPlanId
) throws PermissionException, BizException, JsonParseException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (null == advertisingPlanId) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
}
advertisingSpaceBiz.deleteAdvertisingPlan(advertisingPlanId,partyId);
return new ResponseDto<>();
}
@ApiOperation("获取广告位计划")
@GetMapping("getAdvertisingPlan")
@Override
public ResponseDto<?> getAdvertisingPlan(
@RequestHeader("token") String token,
@RequestParam @ApiParam("广告位计划id") Long advertisingPlanId
) throws PermissionException, BizException, JsonParseException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (null == advertisingPlanId) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数有误!");
}
return new ResponseDto<>(advertisingSpaceBiz.getAdvertisingPlan(advertisingPlanId));
}
@ApiOperation("获取广告位计划列表")
@GetMapping("getAdvertisingPlanList")
@Override
public ResponseDto<?> getAdvertisingPlanList(
@RequestHeader("token") String token,
@RequestParam(value = "keyword", required = false) String keyword,
@RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage
) throws PermissionException, BizException, JsonParseException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (currentPage==null||currentPage<0||numPerPage==null||numPerPage<=0){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"分页参数错误");
}
return new ResponseDto<>(advertisingSpaceBiz.getAdvertisingPlanList(keyword,partyId,currentPage,numPerPage));
}
}
package com.pcloud.book.advertising.service.impl;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.pcloud.book.advertising.biz.AdvertisingSpaceBiz;
import com.pcloud.book.advertising.service.AdvertisingSpaceService;
import com.pcloud.common.exceptions.BizException;
import java.util.Map;
/**
* Description 广告位内部接口实现类
* Created by PENG on 2019/5/6.
......@@ -16,6 +19,8 @@ import com.pcloud.common.exceptions.BizException;
@RequestMapping("advertisingSpaceService")
public class AdvertisingSpaceServiceImpl implements AdvertisingSpaceService {
private static final Logger LOGGER = LoggerFactory.getLogger(AdvertisingSpaceServiceImpl.class);
@Autowired
private AdvertisingSpaceBiz advertisingSpaceBiz;
......@@ -27,4 +32,12 @@ public class AdvertisingSpaceServiceImpl implements AdvertisingSpaceService {
public void calculateAdvertisingIncomeYesterday() throws BizException {
advertisingSpaceBiz.calculateAdvertisingIncomeYesterday();
}
@ApiOperation("发送广告计划")
@PostMapping("sendAdvertisingPlan")
@Override
public void sendAdvertisingPlan(@RequestBody Map<String, Object> map) throws BizException {
LOGGER.info("内部接口群发广告被调用"+map.toString());
advertisingSpaceBiz.sendAdvertisingPlan(new Long(map.get("advertisingPutId").toString()));
}
}
......@@ -253,4 +253,18 @@ public class WechatGroupConsr {
}
return map;
}
@ParamLog(value = "根据群id集合最近7天活跃人数")
public Map<Long,Integer> get7DayActiveUserCountByQrcode(List<Long> qrcodeIds) {
Map<Long, Integer> map = new HashMap<>();
try {
map = ResponseHandleUtil.parseMapResponse(messageService.get7DayActiveUserCountByQrcode(qrcodeIds), Long.class, Integer.class);
} catch (Exception e) {
log.error("根据群id集合最近7天活跃人数.[get7DayActiveUserCountByQrcode]:" + e.getMessage(), e);
}
if (map == null) {
return new HashMap<>();
}
return map;
}
}
package com.pcloud.book.group.dao;
import com.pcloud.book.advertising.dto.WeixinClassifyInfoDTO;
import com.pcloud.book.group.dto.ChangeGroupNameDTO;
import com.pcloud.book.group.dto.GroupAndUserNumberDTO;
import com.pcloud.book.group.dto.GroupQrcodeDTO;
......@@ -185,6 +186,11 @@ public interface GroupQrcodeDao extends BaseDao<GroupQrcode> {
List<Long> listQrcodeIdsByLabelQuery(Map<String, Object> paramMap);
/**
* 根据id集合查询微信群相关信息
*/
List<WeixinClassifyInfoDTO> getGroupInfoByQrcodeId(List<Long> ids);
/**
* 过滤删除的群二维码id
* @param wxGroupIdList
* @return
......
......@@ -2,6 +2,7 @@ package com.pcloud.book.group.dao.impl;
import com.google.common.collect.Maps;
import com.pcloud.book.advertising.dto.WeixinClassifyInfoDTO;
import com.pcloud.book.group.dao.GroupQrcodeDao;
import com.pcloud.book.group.dto.ChangeGroupNameDTO;
import com.pcloud.book.group.dto.GroupAndUserNumberDTO;
......@@ -176,6 +177,12 @@ public class GroupQrcodeDaoImpl extends BaseDaoImpl<GroupQrcode> implements Grou
return this.getSqlSession().selectList(getStatement("listQrcodeIdsByLabelQuery"),paramMap);
}
@Override
public List<WeixinClassifyInfoDTO> getGroupInfoByQrcodeId(List<Long> ids) {
Map<String, Object> map = new HashMap<>();
map.put("ids", ids);
return this.getSqlSession().selectList(getStatement("getGroupInfoByQrcodeId"),map);
}
@Override
public List<Long> filterDeleteQrcodeId(List<String> wxGroupIdList) {
......
......@@ -66,6 +66,18 @@ public class GroupQrcodeVO implements Serializable {
@ApiModelProperty("目的标签名称")
private String purLabelName;
@ApiModelProperty("用户数量")
private Integer userNumber;
@ApiModelProperty("7天活跃人数")
private Integer weekActiveCount;
@ApiModelProperty("ISBN编号")
private String isbn;
@ApiModelProperty("微信群名称")
private String weixinGroupId;
public Long getClassifyId() {
return classifyId;
......@@ -211,6 +223,38 @@ public class GroupQrcodeVO implements Serializable {
this.purLabelName = purLabelName;
}
public Integer getUserNumber() {
return userNumber;
}
public void setUserNumber(Integer userNumber) {
this.userNumber = userNumber;
}
public Integer getWeekActiveCount() {
return weekActiveCount;
}
public void setWeekActiveCount(Integer weekActiveCount) {
this.weekActiveCount = weekActiveCount;
}
public String getIsbn() {
return isbn;
}
public void setIsbn(String isbn) {
this.isbn = isbn;
}
public String getWeixinGroupId() {
return weixinGroupId;
}
public void setWeixinGroupId(String weixinGroupId) {
this.weixinGroupId = weixinGroupId;
}
@Override
public String toString() {
return "GroupQrcodeVO{" +
......@@ -231,6 +275,10 @@ public class GroupQrcodeVO implements Serializable {
", depLabelName='" + depLabelName + '\'' +
", purLabelId=" + purLabelId +
", purLabelName='" + purLabelName + '\'' +
", userNumber=" + userNumber +
", weekActiveCount=" + weekActiveCount +
", isbn='" + isbn + '\'' +
", weixinGroupId='" + weixinGroupId + '\'' +
'}';
}
}
<?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.advertising.dao.impl.AdvertisingPlanGroupDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.advertising.entity.AdvertisingPlanGroup">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="advertising_plan_id" property="advertisingPlanId" jdbcType="BIGINT"/>
<result column="book_id" property="bookId" jdbcType="BIGINT"/>
<result column="book_group_id" property="bookGroupId" jdbcType="BIGINT"/>
<result column="classify_id" property="classifyId" jdbcType="BIGINT"/>
<result column="qrcode_id" property="qrcodeId" jdbcType="BIGINT"/>
<result column="weixin_group_id" property="weixinGroupId" jdbcType="VARCHAR"/>
<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, advertising_plan_id, book_id, book_group_id, classify_id, qrcode_id,
weixin_group_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 advertising_plan_group
where id = #{id}
</select>
<update id="deleteById" parameterType="java.lang.Long">
update advertising_plan_group
set is_delete=1
where id = #{id}
</update>
<insert id="insert" parameterType="com.pcloud.book.advertising.entity.AdvertisingPlanGroup"
useGeneratedKeys="true" keyProperty="id">
insert into advertising_plan_group
<trim prefix="(" suffix=")" suffixOverrides=",">
advertising_plan_id,
book_id,
book_group_id,
classify_id,
qrcode_id,
weixin_group_id,
is_delete,
create_user,
create_time,
update_user,
update_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{advertisingPlanId,jdbcType=BIGINT},
#{bookId,jdbcType=BIGINT},
#{bookGroupId,jdbcType=BIGINT},
#{classifyId,jdbcType=BIGINT},
#{qrcodeId,jdbcType=BIGINT},
#{weixinGroupId,jdbcType=VARCHAR},
0,
#{createUser,jdbcType=BIGINT},
NOW(),
#{updateUser,jdbcType=BIGINT},
NOW(),
</trim>
</insert>
<update id="update" parameterType="com.pcloud.book.advertising.entity.AdvertisingPlanGroup">
update advertising_plan_group
<set>
<if test="advertisingPlanId != null">
advertising_plan_id = #{advertisingPlanId,jdbcType=BIGINT},
</if>
<if test="bookId != null">
book_id = #{bookId,jdbcType=BIGINT},
</if>
<if test="bookGroupId != null">
book_group_id = #{bookGroupId,jdbcType=INTEGER},
</if>
<if test="classifyId != null">
classify_id = #{classifyId,jdbcType=VARCHAR},
</if>
<if test="qrcodeId != null">
qrcode_id = #{qrcodeId,jdbcType=TIMESTAMP},
</if>
<if test="weixinGroupId != null">
weixin_group_id = #{weixinGroupId,jdbcType=TIMESTAMP},
</if>
<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}
</update>
<!--批量插入-->
<insert id="batchInsert" parameterType="com.pcloud.book.advertising.entity.AdvertisingPlanGroup" useGeneratedKeys="true" keyProperty="id">
insert into advertising_plan_group (
advertising_plan_id,
book_id,
book_group_id,
classify_id,
qrcode_id,
weixin_group_id,
is_delete,
create_user,
create_time,
update_user,
update_time
) values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.advertisingPlanId,jdbcType=BIGINT},
#{item.bookId,jdbcType=BIGINT},
#{item.bookGroupId,jdbcType=BIGINT},
#{item.classifyId,jdbcType=BIGINT},
#{item.qrcodeId,jdbcType=BIGINT},
#{item.weixinGroupId,jdbcType=VARCHAR},
0,
#{item.createUser,jdbcType=BIGINT},
NOW(),
#{item.updateUser,jdbcType=BIGINT},
NOW()
)
</foreach>
</insert>
<!--根据计划id查询 -->
<select id="getListByPlanId" parameterType="long" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> from advertising_plan_group
where is_delete=0 and advertising_plan_id=#{planId}
</select>
<!--批量删除-->
<update id="deleteByIds" parameterType="Long">
UPDATE
advertising_plan_group
SET is_delete = 1,
update_user = #{partyId},
update_time = now()
WHERE id in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
${item}
</foreach>
</update>
<!--根据计划id删除-->
<update id="deleteByPlanId" parameterType="map">
UPDATE
advertising_plan_group
SET is_delete = 1,
update_user = #{partyId},
update_time = now()
WHERE advertising_plan_id=#{planId}
</update>
<!--根据计划id集合查询-->
<select id="getListByPlanIds" parameterType="map" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> from advertising_plan_group t
where t.is_delete=0 and advertising_plan_id in
<foreach collection="planIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</select>
</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.advertising.dao.impl.AdvertisingPlanDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.advertising.entity.AdvertisingPlan">
<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 advertising_plan
where is_delete=0 and id = #{id}
</select>
<update id="deleteById" parameterType="java.lang.Long">
update advertising_plan
set is_delete=1
where id = #{id}
</update>
<insert id="insert" parameterType="com.pcloud.book.advertising.entity.AdvertisingPlan"
useGeneratedKeys="true" keyProperty="id">
insert into advertising_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>
<!--查询列表-->
<select id="getAdvertisingPlanList" parameterType="map" resultMap="BaseResultMap">
SELECT
t1.id,
t1.is_delete,
t1.create_user,
t1.create_time,
t1.update_user,
t1.update_time
FROM
advertising_plan t1
<if test="keyword!=null">
LEFT JOIN advertising_put t2 ON t1.id = t2.advertising_plan_id
LEFT JOIN advertising_plan_group t3 ON t1.id = t3.advertising_plan_id
LEFT JOIN advertising_space t4 ON t2.advertising_space_id = t4.id
LEFT JOIN book t5 ON t3.book_id = t5.BOOK_ID
LEFT JOIN book_group_qrcode t6 ON qrcode_id = t6.id
</if>
WHERE
t1.is_delete = 0
AND t1.create_user=#{partyId}
<if test="keyword!=null">
AND (
t5.BOOK_NAME LIKE concat('%', #{keyword}, '%')
OR t6.group_name LIKE concat('%', #{keyword}, '%')
OR t4.ad_name LIKE concat('%', #{keyword}, '%')
)
</if>
GROUP BY t1.id
order by t1.create_time desc
</select>
</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.advertising.dao.impl.AdvertisingPutDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.advertising.entity.AdvertisingPut">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="advertising_space_id" property="advertisingSpaceId" jdbcType="BIGINT"/>
<result column="advertising_plan_id" property="advertisingPlanId" jdbcType="BIGINT"/>
<result column="put_type" property="putType" jdbcType="INTEGER"/>
<result column="put_time" property="putTime" 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="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, advertising_space_id, advertising_plan_id, put_type, put_time, start_time,
end_time, week_day, 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 advertising_put
where id = #{id}
</select>
<update id="deleteById" parameterType="java.lang.Long">
update advertising_put
set is_delete=1
where id = #{id}
</update>
<insert id="insert" parameterType="com.pcloud.book.advertising.entity.AdvertisingPut"
useGeneratedKeys="true" keyProperty="id">
insert into advertising_put
<trim prefix="(" suffix=")" suffixOverrides=",">
advertising_space_id,
advertising_plan_id,
put_type,
put_time,
start_time,
end_time,
week_day,
is_delete,
create_user,
create_time,
update_user,
update_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{advertisingSpaceId,jdbcType=BIGINT},
#{advertisingPlanId,jdbcType=BIGINT},
#{putType,jdbcType=INTEGER},
#{putTime,jdbcType=VARCHAR},
#{startTime,jdbcType=TIMESTAMP},
#{endTime,jdbcType=TIMESTAMP},
#{weekDay,jdbcType=INTEGER},
0,
#{createUser,jdbcType=BIGINT},
NOW(),
#{updateUser,jdbcType=BIGINT},
NOW(),
</trim>
</insert>
<update id="update" parameterType="com.pcloud.book.advertising.entity.AdvertisingPut">
update advertising_put
<set>
<if test="advertisingSpaceId != null">
advertising_space_id = #{advertisingSpaceId,jdbcType=BIGINT},
</if>
<if test="advertisingPlanId != null">
advertising_plan_id = #{advertisingPlanId,jdbcType=BIGINT},
</if>
<if test="putType != null">
put_type = #{putType,jdbcType=INTEGER},
</if>
<if test="putTime != null">
put_time = #{putTime,jdbcType=VARCHAR},
</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="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}
</update>
<!--批量插入-->
<insert id="batchInsert" parameterType="com.pcloud.book.advertising.entity.AdvertisingPut" useGeneratedKeys="true" keyProperty="id">
insert into advertising_put (
advertising_space_id,
advertising_plan_id,
put_type,
put_time,
start_time,
end_time,
week_day,
is_delete,
create_user,
create_time,
update_user,
update_time
) values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.advertisingSpaceId,jdbcType=BIGINT},
#{item.advertisingPlanId,jdbcType=BIGINT},
#{item.putType,jdbcType=INTEGER},
#{item.putTime,jdbcType=VARCHAR},
#{item.startTime,jdbcType=TIMESTAMP},
#{item.endTime,jdbcType=TIMESTAMP},
#{item.weekDay,jdbcType=INTEGER},
0,
#{item.createUser,jdbcType=BIGINT},
NOW(),
#{item.updateUser,jdbcType=BIGINT},
NOW()
)
</foreach>
</insert>
<!--根据计划id查询-->
<select id="getListByPlanId" parameterType="Long" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> from advertising_put t
where t.is_delete=0 and advertising_plan_id=#{planId}
</select>
<!--批量删除-->
<update id="deleteByIds" parameterType="Long">
UPDATE
advertising_put
SET is_delete = 1,
update_user = #{partyId},
update_time = now()
WHERE id in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
${item}
</foreach>
</update>
<!--根据计划id集合查询-->
<select id="getListByPlanIds" parameterType="map" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> from advertising_put t
where t.is_delete=0 and advertising_plan_id in
<foreach collection="planIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</select>
</mapper>
\ No newline at end of file
......@@ -409,11 +409,14 @@
SELECT
g.id groupQrcodeId,
g.group_name groupName,
g.user_number userNumber,
g.weixin_group_id weixinGroupId,
c.id classifyId,
c.book_id bookId,
c.channel_id channelId,
c.create_user adviserId,
b.BOOK_NAME bookName,
b.ISBN isbn,
c.classify,
c.book_group_id bookGroupId,
g.group_name groupQrcodeName,
......@@ -453,6 +456,7 @@
book_name LIKE CONCAT('%', #{name},'%')
OR group_name LIKE CONCAT('%', #{name},'%')
OR classify LIKE CONCAT('%', #{name},'%')
OR b.ISBN like CONCAT('%', #{name},'%')
)
</if>
<if test="depLabelId != null">
......
......@@ -415,6 +415,27 @@
AND g.weixin_group_id != ""
</select>
<!--根据id集合查询微信群相关信息-->
<select id="getGroupInfoByQrcodeId" parameterType="map" resultType="com.pcloud.book.advertising.dto.WeixinClassifyInfoDTO">
SELECT
t.id qrcodeId,
t.group_name weixinGroupName,
t1.id classifyId,
t1.classify classify,
t2.id bookGroupId,
t2.group_qrcode_name groupQrcodeName,
t3.BOOK_ID bookId,
t3.BOOK_NAME bookName
FROM
book_group_qrcode t
INNER JOIN book_group_classify t1 ON t.classify_id = t1.id
INNER JOIN book_group t2 ON t1.book_group_id = t2.id
INNER JOIN book t3 ON t2.book_id = t3.BOOK_ID
where t.id in
<foreach collection="ids" item="item" open="(" separator="," close=")">
${item}
</foreach>
</select>
<select id="filterDeleteQrcodeId" resultType="Long" parameterType="list">
SELECT
......
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