Commit 67cb4c89 by unknown

1002291代码提交

parent ef6a2592
package com.pcloud.book.timecontrol.dto;
import lombok.Data;
import java.io.Serializable;
@Data
public class BookTaskBindingDto implements Serializable {
private static final long serialVersionUID = -7515841010418305282L;
private Integer id;
private Integer taskId;
private String taskName;
private Integer bookId;
private String bookName;
private String isbn;
private String serialNumber;
private Integer state;
private Long proLabelId;
private String proLabelName;
private Long depLabelId;
private String depLabelName;
private Long purLabelId;
private String purLabelName;
private Integer taskCount;
private Integer preSendCount;
private Integer hasSentCount;
}
package com.pcloud.book.timecontrol.dto;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @date: 2020年01月31日 9:50
* @Author: Zcy
* @Descprition
*/
@Data
public class CreateReplyMessageDto implements Serializable {
private String messageType;
private String text;
private Integer appId;
private Integer productId;
private String imgUrl;
private String fileName;
private String fileUrl;
private String linkUrl;
/**
* 回复类型 0 普通回复 1 完成任务确认回复
*/
private Integer replyType;
private String fileId;
private String fileType;
private BigDecimal size;
}
package com.pcloud.book.timecontrol.dto;
import lombok.Builder;
import lombok.Data;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
/**
* @date: 2020年01月30日 14:08
* @Author: Zcy
* @Descprition 时间管理任务模板创建
*/
@Builder
@Data
public class CreateTaskDto implements Serializable {
@NotNull(message = "任务名称不能为空")
@Size(max = 20)
private String taskName;
@Size(max = 300)
@NotNull(message = "任务引导语不能为空")
private String taskIntroduce;
@Size(max = 20)
@NotNull(message = "订阅方式不能为空")
private String subscribeWord;
private Integer advancedSetting;
private Long depLabelId;
private Long purLabelId;
private Long proLabelId;
}
package com.pcloud.book.timecontrol.dto;
import lombok.Data;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* @date: 2020年01月30日 18:24
* @Author: Zcy
* @Descprition 任务配置
*/
@Data
public class CreateTaskItemDto implements Serializable {
@NotNull(message = "任务ID不能为空")
private Integer taskId;
@NotNull(message = "请输入天数")
@Max(value = 200)
private Integer startDay;
private Integer finishConfirm;
private String finishKeyWord;
List<CreateReplyMessageDto> replyMessageList;
private Integer tdConfirm;
private String finishLinkIntroduce;
private String finishLinkUrl;
List<CreateReplyMessageDto> completedReplyMessageList;
}
package com.pcloud.book.timecontrol.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @date: 2020年02月04日 17:32
* @Author: Zcy
* @Descprition
*/
@Data
public class LabelDto implements Serializable {
private Long depLabelId;
private String depLabelName;
}
package com.pcloud.book.timecontrol.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @Description:TODO
* @Author:zcy
* @Date:2020-01-31
* @Version:1.0
*/
@Data
public class ReplyMessageBaseDto implements Serializable {
private Integer id;
private Integer taskId;
private Integer startDay;
}
package com.pcloud.book.timecontrol.dto;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @date: 2020年01月31日 9:50
* @Author: Zcy
* @Descprition
*/
@Data
public class ReplyMessageDto implements Serializable {
private String messageType;
private String text;
private Integer appId;
private Integer productId;
private String imgUrl;
private String fileName;
private String fileUrl;
private String linkUrl;
private String fileId;
private String fileType;
private BigDecimal size;
}
package com.pcloud.book.timecontrol.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @date: 2020年01月30日 15:20
* @Author: Zcy
* @Descprition
*/
@Data
public class TaskDto implements Serializable {
private Integer taskId;
private String taskName;
private String taskIntroduce;
private String taskKeyWord;
private String subscribeWord;
private Integer advancedSetting;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
private Integer taskItemCount;
private Long depLabelId;
private Long purLabelId;
private Long proLabelId;
private String successSubscribeWord;
private String successUnSubscribeWord;
private Integer subscribeState;
private String proLabelName;
private String depLabelName;
private String purLabelName;
}
package com.pcloud.book.timecontrol.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Description:TODO
* @Author:zcy
* @Date:2020-01-31
* @Version:1.0
*/
@Data
public class TaskItemDto implements Serializable {
private Integer id;
private Integer taskId;
private Integer startDay;
private Integer finishConfirm;
private String finishKeyWord;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
private List<ReplyMessageDto> replyMessageList;
private Integer tdConfirm;
private String finishLinkIntroduce;
private String finishLinkUrl;
List<ReplyMessageDto> completedReplyMessageList;
}
package com.pcloud.book.timecontrol.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @date: 2020年02月01日 21:04
* @Author: lihao
* @Descprition
*/
@Data
public class TaskSendDto implements Serializable {
private Integer id;
private String robotWxId;
private String wxUserId;
private Integer taskId;
private Integer taskItemId;
private Integer completeState;
}
package com.pcloud.book.timecontrol.dto;
import lombok.Data;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
/**
* @Description:TODO
* @Author:zcy
* @Date:2020-01-30
* @Version:1.0
*/
@Data
public class UpdateTaskDto implements Serializable {
@NotNull(message = "任务ID缺失")
private Integer taskId;
@NotNull(message = "任务名称不能为空")
@Size(max = 20)
private String taskName;
@Size(max = 300)
@NotNull(message = "任务引导语不能为空")
private String taskIntroduce;
@Size(max = 20)
@NotNull(message = "订阅方式不能为空")
private String subscribeWord;
private Integer advancedSetting;
private Long depLabelId;
private Long purLabelId;
private Long proLabelId;
}
package com.pcloud.book.timecontrol.dto;
import lombok.Data;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* @date: 2020年01月30日 18:24
* @Author: Zcy
* @Descprition 任务配置
*/
@Data
public class UpdateTaskItemDto implements Serializable {
@NotNull(message = "消息配置ID不能为空")
private Integer id;
@NotNull(message = "请输入天数")
@Max(value = 200)
private Integer startDay;
private Integer finishConfirm;
private String finishKeyWord;
List<CreateReplyMessageDto> replyMessageList;
private Integer tdConfirm;
private String finishLinkIntroduce;
private String finishLinkUrl;
List<CreateReplyMessageDto> completedReplyMessageList;
}
package com.pcloud.book.timecontrol.enums;
public enum TaskSendStateEnum {
WAIT_SEND(0, "待发送"),
FINISH_SEND(1, "已发送"),
CANCEL(2, "已取消");
public Integer state;
public String desc;
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
TaskSendStateEnum(Integer state, String desc) {
this.state = state;
this.desc = desc;
}
}
package com.pcloud.book.timecontrol.enums;
public enum TaskSubscribeStateEnum {
UNSUBSCRIBE(0, "取消订阅"),
SUBSCRIBE(1, "订阅"),
FINISH(2, "完成");
public Integer state;
public String desc;
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
TaskSubscribeStateEnum(Integer state, String desc) {
this.state = state;
this.desc = desc;
}
}
package com.pcloud.book.timecontrol.service;
import com.pcloud.book.timecontrol.dto.BookTaskBindingDto;
import com.pcloud.book.timecontrol.dto.LabelDto;
import com.pcloud.book.timecontrol.dto.TaskDto;
import com.pcloud.common.dto.ResponseDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
/**
* @Description:TODO
* @Author:zcy
* @Date:2020-01-30
* @Version:1.0
*/
@FeignClient(value = "pcloud-service-wechatgroup", qualifier = "timeControlTaskServiceCloud", path = "/wechatgroup/v1.0/timeControlTaskService")
@Api(description = "时间管理内部接口")
public interface TimeControlTaskService {
@ApiOperation(value = "定时发送任务消息", httpMethod = "GET")
@GetMapping("sendTimeTaskMessage")
void sendTimeTaskMessage();
@ApiOperation(value = "获取任务信息")
@GetMapping("getTaskById")
ResponseEntity<ResponseDto<TaskDto>> getTaskById(@RequestParam(value = "taskId") Integer taskId);
@ApiOperation("获取任务列表")
@GetMapping("listTask")
ResponseEntity<ResponseDto<List<BookTaskBindingDto>>> listTask(@RequestParam(value = "search", required = false) String search);
@ApiOperation(value = "批量获取任务信息", httpMethod = "POST")
@PostMapping("getTaskBatch")
ResponseEntity<ResponseDto<Map<Integer, TaskDto>>> getTaskBatch(@RequestBody List<Integer> taskIds);
@ApiOperation(value = "获取最多的几个深度标签", httpMethod = "GET")
@GetMapping("listMaxDepLabel")
ResponseEntity<ResponseDto<List<LabelDto>>> listMaxDepLabel(@RequestParam(value = "num", required = false) Integer num);
@ApiOperation(value = "用户通过关键词查找任务列表", httpMethod = "GET")
@GetMapping("listTaskByKey4User")
ResponseEntity<ResponseDto<List<TaskDto>>> listTaskByKey4User(@RequestParam("wxUserId") String wxUserId, @RequestParam("search") String search);
@ApiOperation(value = "用户通过taskIds获取任务列表", httpMethod = "POST")
@PostMapping("listTaskByIds4User")
ResponseEntity<ResponseDto<List<TaskDto>>> listTaskByIds4User(@RequestParam("wxUserId") String wxUserId, @RequestBody List<Integer> taskIds);
@ApiOperation(value = "用户通过标签获取任务列表", httpMethod = "GET")
@GetMapping("listTaskByLabelIds4User")
ResponseEntity<ResponseDto<List<TaskDto>>> listTaskByLabelIds4User(@RequestParam("wxUserId") String wxUserId, @RequestParam(value = "labelId") Long labelId);
@ApiOperation(value = "订阅任务")
@GetMapping("unSubscribeTask")
void unSubscribeTask(@RequestParam("wxId") String wxId, @RequestParam("taskId") Integer taskId);
}
\ No newline at end of file
...@@ -251,4 +251,20 @@ public class ProductConsr { ...@@ -251,4 +251,20 @@ public class ProductConsr {
} }
} }
public Long getOneChannelIdByProId(Long productId) throws BizException {
LOGGER.info("【资源中心(消)】获取作品已上架的某个运营平台,<START>.[productId]=" + productId + "]");
if (productId == null) {
return null;
}
try {
return ResponseHandleUtil.parseResponse(productService.getOneChannelIdByProId(productId), Long.class);
} catch (BizException e) {
LOGGER.warn("【资源中心(消)】获取作品已上架的某个运营平台失败:" + e.getMessage(), e);
throw new BizException(e.getCode(), e.getMessage());
} catch (Exception e) {
LOGGER.error("【资源中心(消)】获取作品已上架的某个运营平台.[getOneChannelIdByProId]:" + e.getMessage(), e);
throw new BookBizException(BookBizException.INVOKE_RES_ERROR, "服务内部错误,请稍后重试");
}
}
} }
...@@ -55,7 +55,7 @@ public interface GroupQrcodeBiz { ...@@ -55,7 +55,7 @@ public interface GroupQrcodeBiz {
* @param numPerPage * @param numPerPage
* @return * @return
*/ */
PageBeanNew<ListGroupQrcodeResponseVO> listAllGroupQrcode(String wxGroupName, Integer currentPage, Integer numPerPage); PageBeanNew<ListGroupQrcodeResponseVO> listAllGroupQrcode(String wxGroupName, Long proLabelId, Long depLabelId, Integer currentPage, Integer numPerPage);
/** /**
* @Author:lili * @Author:lili
* @Desr:新增微信群二维码 * @Desr:新增微信群二维码
......
...@@ -332,18 +332,30 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz { ...@@ -332,18 +332,30 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
@Override @Override
@ParamLog("listAllGroupQrcode") @ParamLog("listAllGroupQrcode")
public PageBeanNew<ListGroupQrcodeResponseVO> listAllGroupQrcode(String wxGroupName, Integer currentPage, Integer numPerPage) { public PageBeanNew<ListGroupQrcodeResponseVO> listAllGroupQrcode(String wxGroupName, Long proLabelId, Long depLabelId, Integer currentPage, Integer numPerPage) {
PageParam pageParam = new PageParam(currentPage, numPerPage); PageParam pageParam = new PageParam(currentPage, numPerPage);
final Map<String, Object> map = Maps.newHashMap(); final Map<String, Object> map = Maps.newHashMap();
map.put("groupName", StringUtil.isEmpty(wxGroupName) ? null : wxGroupName); map.put("groupName", StringUtil.isEmpty(wxGroupName) ? null : wxGroupName);
map.put("proLabelId", proLabelId);
map.put("depLabelId", depLabelId);
final PageBeanNew<ListGroupQrcodeResponseVO> groupQrcode = this.groupQrcodeDao.listPageNew(pageParam, map, "listAllGroupQrcode"); final PageBeanNew<ListGroupQrcodeResponseVO> groupQrcode = this.groupQrcodeDao.listPageNew(pageParam, map, "listAllGroupQrcode");
if (null == groupQrcode || CollectionUtils.isEmpty(groupQrcode.getRecordList())) { if (null == groupQrcode || CollectionUtils.isEmpty(groupQrcode.getRecordList())) {
return groupQrcode; return groupQrcode;
} }
final List<Long> adviserIds = groupQrcode.getRecordList().stream().map(ListGroupQrcodeResponseVO::getAdviserId).distinct().collect(Collectors.toList()); final List<Long> adviserIds = Lists.newArrayList();
final List<Long> depLabelIds = Lists.newArrayList();
final List<Long> proLabelIds = Lists.newArrayList();
for (ListGroupQrcodeResponseVO vo : groupQrcode.getRecordList()) {
adviserIds.add(vo.getAdviserId());
depLabelIds.add(vo.getDepLabelId());
proLabelIds.add(vo.getProLabelId());
}
Map<Long, String> labelName = labelConsr.getLabelName(depLabelIds);
final Map<Long, String> names = adviserConsr.getNames(adviserIds); final Map<Long, String> names = adviserConsr.getNames(adviserIds);
for (ListGroupQrcodeResponseVO vo : groupQrcode.getRecordList()) { for (ListGroupQrcodeResponseVO vo : groupQrcode.getRecordList()) {
vo.setAdviserName(names.get(vo.getAdviserId())); vo.setAdviserName(names.get(vo.getAdviserId()));
vo.setDepLabelName(labelName.get(vo.getDepLabelId()));
vo.setProLabelName(labelName.get(vo.getProLabelId()));
} }
return groupQrcode; return groupQrcode;
} }
......
...@@ -57,9 +57,11 @@ public class GroupQrcodeFacadeImpl implements GroupQrcodeFacade { ...@@ -57,9 +57,11 @@ public class GroupQrcodeFacadeImpl implements GroupQrcodeFacade {
@GetMapping("listAllGroupQrcode") @GetMapping("listAllGroupQrcode")
public ResponseDto<PageBeanNew> listAllGroupQrcode(@RequestHeader("token") String token, public ResponseDto<PageBeanNew> listAllGroupQrcode(@RequestHeader("token") String token,
@RequestParam(value = "wxGroupName", required = false) String wxGroupName, @RequestParam(value = "wxGroupName", required = false) String wxGroupName,
@RequestParam(value = "proLabelId", required = false) Long proLabelId,
@RequestParam(value = "depLabelId", required = false) Long depLabelId,
@RequestParam("currentPage") Integer currentPage, @RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage) { @RequestParam("numPerPage") Integer numPerPage) {
return new ResponseDto<>(groupQrcodeBiz.listAllGroupQrcode(wxGroupName, currentPage, numPerPage)); return new ResponseDto<>(groupQrcodeBiz.listAllGroupQrcode(wxGroupName, proLabelId, depLabelId, currentPage, numPerPage));
} }
@PostMapping("updateGroupQrcode") @PostMapping("updateGroupQrcode")
......
package com.pcloud.book.group.handler; //package com.pcloud.book.group.handler;
//
import com.pcloud.book.group.biz.BookGroupBiz; //import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.common.utils.DateUtils; //import com.pcloud.common.utils.DateUtils;
//
import org.slf4j.Logger; //import org.slf4j.Logger;
import org.slf4j.LoggerFactory; //import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
//
import java.util.Random; //import java.util.Random;
//
import javax.annotation.PostConstruct; //import javax.annotation.PostConstruct;
//
/** ///**
* @Description 启动时开始推送1v1更新 // * @Description 启动时开始推送1v1更新
* @Author ruansiyuan // * @Author ruansiyuan
* @Date 2019/10/28 16:36 // * @Date 2019/10/28 16:36
**/ // **/
@Component //@Component
public class PushBookGroupUpdateHandler { //public class PushBookGroupUpdateHandler {
//
//
private static final Logger LOGGER = LoggerFactory.getLogger(PushBookGroupUpdateHandler.class); // private static final Logger LOGGER = LoggerFactory.getLogger(PushBookGroupUpdateHandler.class);
//
private static PushBookGroupUpdateHandler pushBookGroupUpdateHandler; // private static PushBookGroupUpdateHandler pushBookGroupUpdateHandler;
//
@Autowired // @Autowired
private BookGroupBiz bookGroupBiz; // private BookGroupBiz bookGroupBiz;
//
private static Thread thread = new Thread(new Runnable() { // private static Thread thread = new Thread(new Runnable() {
@Override // @Override
public void run() { // public void run() {
while (true) { // while (true) {
//随机睡10到15s // //随机睡10到15s
Long sleepMillis = Double.valueOf(new Random().nextInt(10) + 5).longValue() * 1000; // Long sleepMillis = Double.valueOf(new Random().nextInt(10) + 5).longValue() * 1000;
try { // try {
//判断是否是早八点到晚八点之间 // //判断是否是早八点到晚八点之间
Boolean isInTime = DateUtils.isInBetweenTimes("08:00:00", "20:00:00"); // Boolean isInTime = DateUtils.isInBetweenTimes("08:00:00", "20:00:00");
if (isInTime) { // if (isInTime) {
pushBookGroupUpdateHandler.bookGroupBiz.pushBookGroupUpdate(); // pushBookGroupUpdateHandler.bookGroupBiz.pushBookGroupUpdate();
} // }
Thread.sleep(sleepMillis); // Thread.sleep(sleepMillis);
} catch (Throwable e) { // } catch (Throwable e) {
LOGGER.error("启动时开始推送1v1更新异常" + e.getMessage(), e); // LOGGER.error("启动时开始推送1v1更新异常" + e.getMessage(), e);
} // }
} // }
} // }
}); // });
//
static { // static {
thread.start(); // thread.start();
} // }
//
@PostConstruct // @PostConstruct
public void init() { // public void init() {
pushBookGroupUpdateHandler = this; // pushBookGroupUpdateHandler = this;
pushBookGroupUpdateHandler.bookGroupBiz = this.bookGroupBiz; // pushBookGroupUpdateHandler.bookGroupBiz = this.bookGroupBiz;
} // }
//
public static Thread getInstance() { // public static Thread getInstance() {
return thread; // return thread;
} // }
//
//
//
} //}
package com.pcloud.book.group.handler;
import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import java.util.Random;
import lombok.extern.slf4j.Slf4j;
/**
* 项目启动制行的任务
*
* @author Gui_q
* @since 2020年2月3日 12点14分
*/
@Component
@Slf4j
public class PushBookGroupUpdateRunner implements ApplicationRunner {
@Autowired
private BookGroupBiz bookGroupBiz;
@Override
public void run(ApplicationArguments applicationArguments) throws Exception {
log.info("[启动时开始推送1v1更新]");
new Thread(() -> {
while (true) {
//随机睡10到15s
Long sleepMillis = Double.valueOf(new Random().nextInt(10) + 5).longValue() * 1000;
try {
//判断是否是早八点到晚八点之间
Boolean isInTime = DateUtils.isInBetweenTimes("08:00:00", "20:00:00");
if (isInTime) {
bookGroupBiz.pushBookGroupUpdate();
}
Thread.sleep(sleepMillis);
} catch (Throwable e) {
log.error("启动时开始推送1v1更新异常" + e.getMessage(), e);
try {
Thread.sleep(sleepMillis);
} catch (InterruptedException ex) {
log.error("启动时开始推送1v1更新休眠异常" + e.getMessage(), e);
}
}
}
}).start();
}
}
...@@ -20,4 +20,14 @@ public class ListGroupQrcodeResponseVO implements Serializable { ...@@ -20,4 +20,14 @@ public class ListGroupQrcodeResponseVO implements Serializable {
private String groupQrcode; private String groupQrcode;
private Integer userNumber;
private Long depLabelId;
private String depLabelName;
private Long proLabelId;
private String proLabelName;
} }
package com.pcloud.book.keywords.biz; package com.pcloud.book.keywords.biz;
import com.pcloud.book.keywords.dto.SelfRobotBookRecordDTO; import com.pcloud.book.keywords.dto.SelfRobotBookRecordDTO;
import com.pcloud.book.keywords.entity.RobotSkill4H5;
import com.pcloud.book.keywords.entity.RobotSkillDetail;
import com.pcloud.book.keywords.entity.SelfRobotKeyword; import com.pcloud.book.keywords.entity.SelfRobotKeyword;
import com.pcloud.book.keywords.vo.GuideWordVO; import com.pcloud.book.keywords.vo.GuideWordVO;
import com.pcloud.book.keywords.vo.LabelVO; import com.pcloud.book.keywords.vo.LabelVO;
...@@ -28,7 +30,7 @@ public interface SelfRobotKeywordBiz { ...@@ -28,7 +30,7 @@ public interface SelfRobotKeywordBiz {
List<SelfRobotReplyVO> getReplyByKeyWord(Integer type, String keyWord, String robotId, String wxUserId); List<SelfRobotReplyVO> getReplyByKeyWord(Integer type, String keyWord, String robotId, String wxUserId);
List<GuideWordVO> getGuideWordListByType(Integer type); List<RobotSkill4H5> getGuideWordListByType(Integer type, Long labelId, String wxUserId);
List<SelfRobotReplyVO> getReplyBuyGuide(Integer type, Integer id, String robotId, String wxUserId); List<SelfRobotReplyVO> getReplyBuyGuide(Integer type, Integer id, String robotId, String wxUserId);
...@@ -47,4 +49,8 @@ public interface SelfRobotKeywordBiz { ...@@ -47,4 +49,8 @@ public interface SelfRobotKeywordBiz {
Boolean hasKeyword (Long bookGroupId); Boolean hasKeyword (Long bookGroupId);
SelfRobotKeyword getById(Long id); SelfRobotKeyword getById(Long id);
RobotSkillDetail getSkillDetail(Integer type, Integer relSkillId, String wxUserId);
String confirmSkill(Integer id, Integer type, Integer relSkillId, String robotId, String wxUserId);
} }
package com.pcloud.book.keywords.entity;
import lombok.Data;
@Data
public class RobotSkill4H5 {
private Integer id;
private Integer type;
private Integer relSkillId;
private String relSkillName;
private String relSkillIntroduce;
private String keyWord;
private String guideWord;
private Integer depthId;
private String depthLabel;
private String resourceType;
private String text;
private String imgUrl;
private Integer productId;
private String fileUrl;
private String fileName;
private String groupId;
private String groupName;
private String replyContent;
private Integer state;
}
package com.pcloud.book.keywords.entity;
import lombok.Data;
@Data
public class RobotSkillDetail {
private Integer id;
private Integer type;
private Integer relSkillId;
private String relSkillName;
private String relSkillIntroduce;
private String keyWord;
private String guideWord;
private Integer depthId;
private String depthLabel;
private String resourceType;
private String text;
private String imgUrl;
private Integer productId;
private String fileUrl;
private String fileName;
private String groupId;
private String groupName;
private String replyContent;
private Integer state;
}
...@@ -82,7 +82,9 @@ public interface SelfRobotKeywordFacade { ...@@ -82,7 +82,9 @@ public interface SelfRobotKeywordFacade {
@ApiOperation("根据类型获取引导语列表") @ApiOperation("根据类型获取引导语列表")
@GetMapping("getGuideWordListByType") @GetMapping("getGuideWordListByType")
ResponseDto<?> getGuideWordListByType( ResponseDto<?> getGuideWordListByType(
@RequestParam("type") @ApiParam("技能类型") Integer type @RequestParam("type") @ApiParam("技能类型") Integer type,
@RequestParam(value = "labelId",required = false) @ApiParam("分类标签id") Long labelId,
@RequestParam(value = "wxUserId",required = false) @ApiParam("微信用户id") String wxUserId
) throws BizException, PermissionException; ) throws BizException, PermissionException;
@ApiOperation("根据类型获取标签列表") @ApiOperation("根据类型获取标签列表")
...@@ -110,7 +112,16 @@ public interface SelfRobotKeywordFacade { ...@@ -110,7 +112,16 @@ public interface SelfRobotKeywordFacade {
@GetMapping("getReplyByGuide") @GetMapping("getReplyByGuide")
ResponseDto<?> getReplyByGuide(Integer type, Integer id, String robotId, String wxUserId); ResponseDto<?> getReplyByGuide(Integer type, Integer id, String robotId, String wxUserId);
@ApiOperation(value = "获取资料", httpMethod = "GET") @ApiOperation(value = "根据任务id获取任务详情", httpMethod = "GET")
@GetMapping("getSkillDetail")
ResponseDto<?> getSkillDetail(Integer type, Integer relSkillId,String wxUserId);
@ApiOperation(value = "确认任务", httpMethod = "GET")
@GetMapping("confirmSkill")
ResponseDto<?> confirmSkill(Integer id,Integer type,Integer relSkillId, String robotId, String wxUserId);
@ApiOperation(value = "", httpMethod = "GET")
@GetMapping("getResource") @GetMapping("getResource")
ResponseDto<?> getResource(Integer id, String robotId, String wxUserId); ResponseDto<?> getResource(Integer id, String robotId, String wxUserId);
......
package com.pcloud.book.keywords.facade.impl; package com.pcloud.book.keywords.facade.impl;
import com.pcloud.book.keywords.biz.SelfRobotKeywordBiz; import com.pcloud.book.keywords.biz.SelfRobotKeywordBiz;
import com.pcloud.book.keywords.entity.RobotSkillDetail;
import com.pcloud.book.keywords.entity.SelfRobotKeyword; import com.pcloud.book.keywords.entity.SelfRobotKeyword;
import com.pcloud.book.keywords.facade.SelfRobotKeywordFacade; import com.pcloud.book.keywords.facade.SelfRobotKeywordFacade;
import com.pcloud.book.keywords.vo.LabelVO; import com.pcloud.book.keywords.vo.LabelVO;
...@@ -131,8 +132,9 @@ public class SelfRobotKeywordFacadeImpl implements SelfRobotKeywordFacade { ...@@ -131,8 +132,9 @@ public class SelfRobotKeywordFacadeImpl implements SelfRobotKeywordFacade {
@Override @Override
@GetMapping("getGuideWordListByType") @GetMapping("getGuideWordListByType")
public ResponseDto<?> getGuideWordListByType(@RequestParam("type") Integer type) throws BizException, PermissionException { public ResponseDto<?> getGuideWordListByType(@RequestParam("type") Integer type,@RequestParam(value = "labelId",required = false) Long labelId
return new ResponseDto<>(selfRobotKeywordBiz.getGuideWordListByType(type)); ,@RequestParam(value = "wxUserId",required = false) String wxUserId) throws BizException, PermissionException {
return new ResponseDto<>(selfRobotKeywordBiz.getGuideWordListByType(type,labelId,wxUserId));
} }
@Override @Override
...@@ -167,6 +169,21 @@ public class SelfRobotKeywordFacadeImpl implements SelfRobotKeywordFacade { ...@@ -167,6 +169,21 @@ public class SelfRobotKeywordFacadeImpl implements SelfRobotKeywordFacade {
} }
@Override @Override
@GetMapping("getSkillDetail")
public ResponseDto<?> getSkillDetail(@RequestParam Integer type, @RequestParam Integer relSkillId,@RequestParam String wxUserId) {
RobotSkillDetail robotSkillDetail = selfRobotKeywordBiz.getSkillDetail(type, relSkillId,wxUserId);
return new ResponseDto<>(robotSkillDetail);
}
@Override
@GetMapping("confirmSkill")
public ResponseDto<?> confirmSkill(@RequestParam Integer id,@RequestParam Integer type,@RequestParam Integer relSkillId, @RequestParam String robotId, @RequestParam String wxUserId) {
return new ResponseDto<>(selfRobotKeywordBiz.confirmSkill(id,type,relSkillId, robotId, wxUserId));
}
@Override
@GetMapping("getResource") @GetMapping("getResource")
public ResponseDto<?> getResource(@RequestParam Integer id, @RequestParam String robotId, @RequestParam String wxUserId) { public ResponseDto<?> getResource(@RequestParam Integer id, @RequestParam String robotId, @RequestParam String wxUserId) {
......
...@@ -38,6 +38,9 @@ public class PcloudRobot extends BaseEntity { ...@@ -38,6 +38,9 @@ public class PcloudRobot extends BaseEntity {
@ApiModelProperty("入口二维码url") @ApiModelProperty("入口二维码url")
private String entryQrcodeUrl; private String entryQrcodeUrl;
@ApiModelProperty("小号分类id")
private String classifyId;
@ApiModelProperty("状态:1 在线 2 离线") @ApiModelProperty("状态:1 在线 2 离线")
private Integer state; private Integer state;
......
...@@ -36,27 +36,17 @@ import com.pcloud.facade.quartz.service.ScheduleService; ...@@ -36,27 +36,17 @@ import com.pcloud.facade.quartz.service.ScheduleService;
import com.pcloud.usercenter.user.entity.UserLogin; 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.*;
import com.sdk.wxgroup.SendMessageTypeEnum; import lombok.extern.slf4j.Slf4j;
import com.sdk.wxgroup.SendPicMessageVO;
import com.sdk.wxgroup.SendTextMessageVO;
import com.sdk.wxgroup.WxGroupSDK;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
/** /**
* @描述:个人号群发 * @描述:个人号群发
* @作者:zhuyajie * @作者:zhuyajie
......
package com.pcloud.book.skill.biz;
import com.pcloud.book.skill.facade.request.QueryGroupActivityRequestVO;
import com.pcloud.book.skill.facade.request.SaveGroupActivityRequestVO;
import com.pcloud.book.skill.facade.request.UpdateGroupActivityRequestVO;
import com.pcloud.book.skill.facade.response.QueryGroupActivityResponseVO;
import com.pcloud.common.page.PageBeanNew;
import org.springframework.web.bind.annotation.RequestParam;
public interface PcloudGroupActivityBiz {
/**
* 保存共读活动
*/
void saveGroupActivity(SaveGroupActivityRequestVO vo);
/**
* 修改共读活动
*/
void updateGroupActivity(UpdateGroupActivityRequestVO vo);
/**
* 删除共读
*/
void deleteGroupActivity(Long id, Long partyId);
/**
* 处理共读选取
*/
void processGroup(String wxId, String robotWxId, Long id);
/**
* 获取共读活动列表(分页)
*/
PageBeanNew<QueryGroupActivityResponseVO> queryGroupActivity(String name, Long proLabelId, Long purLabelId, Long depLabelId, Integer numPerPage, Integer currentPage);
}
package com.pcloud.book.skill.biz;
import com.pcloud.book.skill.entity.PcloudResource;
import com.pcloud.book.skill.facade.response.QueryPcloudResponseVO;
import com.pcloud.common.page.PageBeanNew;
public interface PcloudResourceBiz {
void savePcloudResource(PcloudResource pcloudResource);
void updatePcloudResource(PcloudResource pcloudResource);
void deletePcloudResource(Long id);
PageBeanNew getPcloudResourceList(String name, Long proLabelId, Long depLabelId, Long purLabelId, Integer currentPage, Integer numPerPage);
QueryPcloudResponseVO getPcloudResource(Long id);
}
package com.pcloud.book.skill.biz;
import com.pcloud.book.skill.entity.PcloudSkill;
import com.pcloud.common.page.PageBeanNew;
public interface PcloudSkillBiz {
void createPcloudSkill(PcloudSkill pcloudSkill);
void updatePcloudSkill(PcloudSkill pcloudSkill);
PcloudSkill getPcloudSkill(Long id);
PageBeanNew<PcloudSkill> getPcloudSkillList(Integer skillType, Integer currentPage, Integer numPerPage);
void deletePcloudSkill(Long id);
String setSubscribeState(Long skillId, Integer taskId, String robotWxId, String userWxId, Boolean subState);
void updateSeqNum(PcloudSkill pcloudSkill);
void sendResource(Integer id, String wxUserId, String robotId, Integer relSkillId);
}
package com.pcloud.book.skill.biz.impl;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.consumer.label.LabelConsr;
import com.pcloud.book.group.biz.GroupQrcodeBiz;
import com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO;
import com.pcloud.book.reading.biz.ReadingActivityBiz;
import com.pcloud.book.skill.biz.PcloudGroupActivityBiz;
import com.pcloud.book.skill.dao.PcloudGroupActivityDao;
import com.pcloud.book.skill.entity.PcloudGroupActivity;
import com.pcloud.book.skill.facade.request.SaveGroupActivityRequestVO;
import com.pcloud.book.skill.facade.request.UpdateGroupActivityRequestVO;
import com.pcloud.book.skill.facade.response.QueryGroupActivityResponseVO;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import com.sdk.wxgroup.SendGroupInviteVO;
import com.sdk.wxgroup.WxGroupSDK;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@Service
public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
@Resource
private PcloudGroupActivityDao pcloudGroupActivityDao;
@Resource
private GroupQrcodeBiz groupQrcodeBiz;
@Resource
private ReadingActivityBiz readingActivityBiz;
@Resource
private LabelConsr labelConsr;
@ParamLog("保存共读活动")
@Override
public void saveGroupActivity(SaveGroupActivityRequestVO vo) {
vo.checkParam();
PcloudGroupActivity entity = vo.getEntity();
Date now = new Date();
entity.setCreateUser(vo.getUserId());
entity.setCreateTime(now);
entity.setUpdateUser(vo.getUserId());
entity.setUpdateTime(now);
entity.setIsDelete(0);
pcloudGroupActivityDao.insert(entity);
}
@Override
public void updateGroupActivity(UpdateGroupActivityRequestVO vo) {
vo.checkParam();
PcloudGroupActivity activity = pcloudGroupActivityDao.getById(vo.getId());
if (null == activity) {
throw new BookBizException(BookBizException.ID_NOT_EXIST, "共读活动不存在");
}
PcloudGroupActivity entity = vo.getEntity();
Date now = new Date();
entity.setUpdateUser(vo.getUserId());
entity.setUpdateTime(now);
pcloudGroupActivityDao.updateByPrimaryKeySelective(entity);
}
@Override
public void deleteGroupActivity(Long id, Long partyId) {
pcloudGroupActivityDao.deleteById(id);
}
@Override
@ParamLog("[processGroup]")
public void processGroup(String wxId, String robotWxId, Long id) {
PcloudGroupActivity byId = pcloudGroupActivityDao.getById(id);
if (Objects.isNull(byId)) {
log.error("[processGroup] error 共读不存在");
return;
}
GroupQrcodeBaseInfoVO groupQrcode = groupQrcodeBiz.getBaseById(byId.getBookGroupQrcodeId());
if (Objects.isNull(groupQrcode)) {
log.error("[processGroup] error 共读对应社群不存在");
return;
}
SendGroupInviteVO vo = new SendGroupInviteVO();
vo.setWxId(wxId);
vo.setAltId(robotWxId);
vo.setIp(readingActivityBiz.getIP(robotWxId));
vo.setWxGroupId(groupQrcode.getWeixinGroupId());
WxGroupSDK.sendGroupInvite(vo);
log.info("[processGroup] sendGroupInvite:{}", vo);
}
@Override
public PageBeanNew<QueryGroupActivityResponseVO> queryGroupActivity(String name, Long proLabelId, Long purLabelId, Long depLabelId, Integer numPerPage, Integer currentPage) {
PageParam pageParam = new PageParam(currentPage, numPerPage);
Map<String, Object> paraMap = Maps.newHashMap();
paraMap.put("name", name);
paraMap.put("proLabelId", proLabelId);
paraMap.put("purLabelId", purLabelId);
paraMap.put("depLabelId", depLabelId);
PageBeanNew<QueryGroupActivityResponseVO> queryGroupActivity = pcloudGroupActivityDao.listPageNew(pageParam, paraMap, "queryGroupActivity");
if (null == queryGroupActivity || CollectionUtils.isEmpty(queryGroupActivity.getRecordList())) {
return queryGroupActivity;
}
// 组装标签名称
List<Long> labelId = Lists.newArrayList();
for (QueryGroupActivityResponseVO responseVO : queryGroupActivity.getRecordList()) {
labelId.add(responseVO.getProLabelId());
labelId.add(responseVO.getPurLabelId());
labelId.add(responseVO.getDepLabelId());
}
Map<Long, String> labelName = labelConsr.getLabelName(labelId);
for (QueryGroupActivityResponseVO responseVO : queryGroupActivity.getRecordList()) {
responseVO.setPurLabelName(labelName.get(responseVO.getPurLabelId()));
responseVO.setProLabelName(labelName.get(responseVO.getProLabelId()));
responseVO.setDepLabelName(labelName.get(responseVO.getDepLabelId()));
}
return queryGroupActivity;
}
}
package com.pcloud.book.skill.biz.impl;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.consumer.label.LabelConsr;
import com.pcloud.book.skill.biz.PcloudResourceBiz;
import com.pcloud.book.skill.dao.PcloudResourceDao;
import com.pcloud.book.skill.entity.PcloudResource;
import com.pcloud.book.skill.facade.response.QueryPcloudResponseVO;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.string.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class PcloudResourceBizImpl implements PcloudResourceBiz {
@Autowired
private PcloudResourceDao pcloudResourceDao;
@Autowired
private LabelConsr labelConsr;
@ParamLog("创建资源")
@Transactional(rollbackFor = Exception.class)
@Override
public void savePcloudResource(PcloudResource pcloudResource) {
checkPcloudResource(pcloudResource);
// 处理资源盒子和列表关系
// pcloudResource.getItemList()
pcloudResourceDao.insert(pcloudResource);
}
@ParamLog("更新资源")
@Transactional(rollbackFor = Exception.class)
@Override
public void updatePcloudResource(PcloudResource pcloudResource) {
if (pcloudResource.getId() == null){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"id不能为空!");
}
checkPcloudResource(pcloudResource);
// 处理资源盒子和列表关系
// pcloudResource.getItemList()
pcloudResourceDao.update(pcloudResource);
}
@ParamLog("删除资源")
@Transactional(rollbackFor = Exception.class)
@Override
public void deletePcloudResource(Long id) {
if (id==null){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"参数为空!");
}
pcloudResourceDao.deletePcloudResource(id);
// 删除关系
// pcloudResourceItemDao.deleteByPcloudResourceId(id);
}
@ParamLog("获取资源列表")
@Override
public PageBeanNew getPcloudResourceList(String name, Long proLabelId, Long depLabelId, Long purLabelId, Integer currentPage, Integer numPerPage) {
HashMap<String, Object> map = Maps.newHashMap();
map.put("name", name);
map.put("proLabelId", proLabelId);
map.put("depLabelId", depLabelId);
map.put("purLabelId", purLabelId);
PageBeanNew<QueryPcloudResponseVO> pageBeanNew = pcloudResourceDao.listPageNew(new PageParam(currentPage, numPerPage), map, "getPcloudResourceList");
if (null == pageBeanNew || CollectionUtils.isEmpty(pageBeanNew.getRecordList())) {
return pageBeanNew;
}
// 组装标签名称
fillLabels(pageBeanNew.getRecordList());
return pageBeanNew;
}
@ParamLog("获取资源")
@Override
public QueryPcloudResponseVO getPcloudResource(Long id) {
if (id == null){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"参数为空!");
}
QueryPcloudResponseVO vo = pcloudResourceDao.getPcloudResource(id);
if(vo == null){
return new QueryPcloudResponseVO();
}
// 组装标签名称
fillLabels(Lists.newArrayList(vo));
return vo;
}
@ParamLog("组装标签名称")
private void fillLabels(List<QueryPcloudResponseVO> recordList) {
List<Long> labelId = Lists.newArrayList();
for (QueryPcloudResponseVO vo : recordList) {
labelId.add(vo.getProLabelId());
labelId.add(vo.getPurLabelId());
labelId.add(vo.getDepLabelId());
}
Map<Long, String> labelName = labelConsr.getLabelName(labelId);
for (QueryPcloudResponseVO vo : recordList) {
vo.setPurLabelName(labelName.get(vo.getPurLabelId()));
vo.setProLabelName(labelName.get(vo.getProLabelId()));
vo.setDepLabelName(labelName.get(vo.getDepLabelId()));
}
}
@ParamLog("检测参数")
private void checkPcloudResource(PcloudResource pcloudResource) {
if (StringUtil.isBlank(pcloudResource.getName()) || null == pcloudResource.getProLabelId() || null == pcloudResource.getDepLabelId() || null == pcloudResource.getPurLabelId()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "请求参数缺失");
}
}
}
package com.pcloud.book.skill.check;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.keywords.enums.ReplyTypeEnum;
import com.pcloud.book.skill.entity.PcloudSkill;
import com.pcloud.book.skill.entity.PcloudSkillGuide;
import com.pcloud.book.skill.entity.PcloudSubReply;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.string.StringUtil;
import org.springframework.stereotype.Component;
import java.util.List;
@Component("技能参数校验")
public class PcloudSkillCheck {
@ParamLog("新增技能参数校验")
public void createPcloudSkillCheck(PcloudSkill pcloudSkill) {
if (pcloudSkill==null){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"参数为空!");
}
if (pcloudSkill.getSkillType()==null){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"技能类型不能为空!");
}
if (StringUtil.isEmpty(pcloudSkill.getSkillFuseReply())){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"聚合页回复不能为空!");
}
checkReply(pcloudSkill.getCancelSubReplies());
checkReply(pcloudSkill.getSuccessSubReplies());
}
private void checkReply(List<PcloudSubReply> list){
if (ListUtils.isEmpty(list)){
return;
}
for (PcloudSubReply reply :list){
if (reply==null){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"回复不能为空!");
}
if (null == reply.getSubType()){
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "订阅回复类型不能为空!");
}
if (null == reply.getType()){
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "回复类型不能为空!");
}
Integer type = reply.getType();
if (ReplyTypeEnum.TEXT.value.equals(type) && StringUtil.isEmpty(reply.getContent())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "内容不能为空!");
}
if (ReplyTypeEnum.IMAGE.value.equals(type) && StringUtil.isEmpty(reply.getPicUrl())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "图片地址不能为空!");
}
if (ReplyTypeEnum.APP.value.equals(type) && (StringUtil.isEmpty(reply.getServeType()) || reply.getServeId() == null ||StringUtil.isEmpty(reply.getLinkUrl()))) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "应用或作品id和类型、链接不能为空!");
}
if (ReplyTypeEnum.RESOURCE.value.equals(type) && reply.getResourceId() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "资源id不能为空!");
}
}
}
@ParamLog("修改技能校验")
public void updatePcloudSkill(PcloudSkill pcloudSkill) {
if (pcloudSkill.getId()==null){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"id不能为空!");
}
createPcloudSkillCheck(pcloudSkill);
}
}
package com.pcloud.book.skill.dao;
import com.pcloud.book.skill.entity.PcloudGroupActivity;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
import java.util.Map;
public interface PcloudGroupActivityDao extends BaseDao<PcloudGroupActivity> {
Map<Long, PcloudGroupActivity> mayByIds(List<Long> ids);
void updateByPrimaryKeySelective(PcloudGroupActivity entity);
}
\ No newline at end of file
package com.pcloud.book.skill.dao;
import com.pcloud.book.skill.entity.PcloudResource;
import com.pcloud.book.skill.facade.response.QueryPcloudResponseVO;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
import java.util.Map;
public interface PcloudResourceDao extends BaseDao<PcloudResource> {
int deletePcloudResource(Long id);
QueryPcloudResponseVO getPcloudResource(Long id);
Map<Long,PcloudResource> mayByIds(List<Long> ids);
}
package com.pcloud.book.skill.dao;
import com.pcloud.book.keywords.entity.RobotSkill4H5;
import com.pcloud.book.keywords.entity.TempRobotSkill;
import com.pcloud.book.keywords.vo.LabelVO;
import com.pcloud.book.skill.entity.PcloudSkill;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
public interface PcloudSkillDao extends BaseDao<PcloudSkill> {
void updateSeqNum(Long id, Integer seqNum);
List<RobotSkill4H5> getSkillList4TimeController(Integer type, Long labelId, String wxUserId);
List<RobotSkill4H5> getSkillList4Activity(Integer type, Long labelId);
List<RobotSkill4H5> getSkillList4Resource(Integer type, Long labelId);
List<Long> getLabelList4Activity(Integer type);
List<Long> getLabelList4TimeController(Integer type);
List<Long> getLabelList4Resource(Integer type);
Integer getMaxSeqNum();
PcloudSkill getByRelSkillId(Integer relSkillId);
PcloudSkill getByRelId(Integer relSkillId, Integer type);
}
package com.pcloud.book.skill.dao;
import com.pcloud.book.skill.entity.PcloudSkillGuide;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
public interface PcloudSkillGuideDao extends BaseDao<PcloudSkillGuide> {
Integer batchInsert(List<PcloudSkillGuide> list);
void deleteByPcloudSkillId(Long pcloudSkillId);
List<PcloudSkillGuide> getListByPcloudSkillId(Long pcloudSkillId);
List<PcloudSkillGuide> getListByPcloudSkillIds(List<Long> pcloudSkillIds);
}
package com.pcloud.book.skill.dao;
import com.pcloud.book.skill.entity.PcloudSubReply;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
public interface PcloudSubReplyDao extends BaseDao<PcloudSubReply> {
Integer batchInsert(List<PcloudSubReply> list);
void deleteByPcloudSkillId(Long pcloudSkillId);
List<PcloudSubReply> getListByPcloudSkillId(Long pcloudSkillId);
List<PcloudSubReply> getListByPcloudSkillIds(List<Long> pcloudSkillIds);
List<PcloudSubReply> getBySkillIdAndType(Long skillId, Integer subType);
}
package com.pcloud.book.skill.dao.impl;
import com.pcloud.book.skill.dao.PcloudGroupActivityDao;
import com.pcloud.book.skill.entity.PcloudGroupActivity;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
@Component
public class PcloudGroupActivityDaoImpl extends BaseDaoImpl<PcloudGroupActivity> implements PcloudGroupActivityDao {
@Override
public Map<Long, PcloudGroupActivity> mayByIds(List<Long> ids) {
return super.getSqlSession().selectMap(getStatement("mayByIds"), ids,"id");
}
@Override
public void updateByPrimaryKeySelective(PcloudGroupActivity entity) {
this.getSqlSession().update("com.pcloud.book.skill.dao.impl.PcloudGroupActivityDaoImpl.updateByPrimaryKeySelective", entity);
}
}
package com.pcloud.book.skill.dao.impl;
import com.pcloud.book.skill.dao.PcloudResourceDao;
import com.pcloud.book.skill.entity.PcloudResource;
import com.pcloud.book.skill.facade.response.QueryPcloudResponseVO;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
@Repository("pcloudResourceDao")
public class PcloudResourceDaoImpl extends BaseDaoImpl<PcloudResource> implements PcloudResourceDao {
@Override
public int deletePcloudResource(Long id) {
return super.getSqlSession().update(getStatement("deletePcloudResource"), id);
}
@Override
public QueryPcloudResponseVO getPcloudResource(Long id) {
return super.getSqlSession().selectOne(getStatement("getPcloudResource"), id);
}
@Override
public Map<Long, PcloudResource> mayByIds(List<Long> ids) {
return super.getSqlSession().selectMap(getStatement("mayByIds"), ids,"id");
}
}
package com.pcloud.book.skill.dao.impl;
import com.pcloud.book.keywords.entity.RobotSkill4H5;
import com.pcloud.book.skill.dao.PcloudSkillDao;
import com.pcloud.book.skill.entity.PcloudSkill;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Component("pcloudSkillDao")
public class PcloudSkillDaoImpl extends BaseDaoImpl<PcloudSkill> implements PcloudSkillDao {
@Override
public void updateSeqNum(Long id, Integer seqNum) {
Map<String,Object> map=new HashMap<>();
map.put("id",id);
map.put("seqNum",seqNum);
super.getSqlSession().selectList(getStatement("updateSeqNum"), map);
}
@Override
public Integer getMaxSeqNum() {
return super.getSqlSession().selectOne(getStatement("getMaxSeqNum"));
}
@Override
public PcloudSkill getByRelSkillId(Integer relSkillId) {
return super.getSqlSession().selectOne(getStatement("getByRelSkillId"),relSkillId);
}
@Override
public List<RobotSkill4H5> getSkillList4TimeController(Integer type, Long labelId, String wxUserId) {
Map<String,Object> map=new HashMap<>();
map.put("type",type);
map.put("labelId",labelId);
map.put("wxUserId",wxUserId);
return super.getSqlSession().selectList(getStatement("getSkillList4TimeController"), map);
}
@Override
public List<RobotSkill4H5> getSkillList4Activity(Integer type, Long labelId) {
Map<String,Object> map=new HashMap<>();
map.put("type",type);
map.put("labelId",labelId);
return super.getSqlSession().selectList(getStatement("getSkillList4Activity"), map);
}
@Override
public List<RobotSkill4H5> getSkillList4Resource(Integer type, Long labelId) {
Map<String,Object> map=new HashMap<>();
map.put("type",type);
map.put("labelId",labelId);
return super.getSqlSession().selectList(getStatement("getSkillList4Resource"), map);
}
@Override
public List<Long> getLabelList4Activity(Integer type) {
return super.getSqlSession().selectList(getStatement("getLabelList4Activity"), type);
}
@Override
public List<Long> getLabelList4TimeController(Integer type) {
return super.getSqlSession().selectList(getStatement("getLabelList4TimeController"), type);
}
@Override
public List<Long> getLabelList4Resource(Integer type) {
return super.getSqlSession().selectList(getStatement("getLabelList4Resource"), type);
}
@Override
public PcloudSkill getByRelId(Integer relSkillId, Integer type) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("relSkillId", relSkillId);
paramMap.put("type", type);
return getSqlSession().selectOne(getStatement("getByRelId"), paramMap);
}
}
package com.pcloud.book.skill.dao.impl;
import com.pcloud.book.skill.dao.PcloudSkillGuideDao;
import com.pcloud.book.skill.entity.PcloudSkillGuide;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Component("pcloudSkillGuideDao")
public class PcloudSkillGuideDaoImpl extends BaseDaoImpl<PcloudSkillGuide> implements PcloudSkillGuideDao {
@Override
public Integer batchInsert(List<PcloudSkillGuide> list) {
return super.getSqlSession().insert(getStatement("batchInsert"), list);
}
@Override
public void deleteByPcloudSkillId(Long pcloudSkillId) {
super.getSqlSession().delete(getStatement("deleteByPcloudSkillId"), pcloudSkillId);
}
@Override
public List<PcloudSkillGuide> getListByPcloudSkillId(Long pcloudSkillId) {
return super.getSqlSession().selectList(getStatement("getListByPcloudSkillId"), pcloudSkillId);
}
@Override
public List<PcloudSkillGuide> getListByPcloudSkillIds(List<Long> pcloudSkillIds) {
Map<String,Object> map=new HashMap<>();
map.put("pcloudSkillIds",pcloudSkillIds);
return super.getSqlSession().selectList(getStatement("getListByPcloudSkillIds"), map);
}
}
package com.pcloud.book.skill.dao.impl;
import com.pcloud.book.skill.dao.PcloudSubReplyDao;
import com.pcloud.book.skill.entity.PcloudSubReply;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Component("pcloudSubReplyDao")
public class PcloudSubReplyDaoImpl extends BaseDaoImpl<PcloudSubReply> implements PcloudSubReplyDao {
@Override
public Integer batchInsert(List<PcloudSubReply> list) {
return super.getSqlSession().insert(getStatement("batchInsert"), list);
}
@Override
public void deleteByPcloudSkillId(Long pcloudSkillId) {
super.getSqlSession().delete(getStatement("deleteByPcloudSkillId"), pcloudSkillId);
}
@Override
public List<PcloudSubReply> getListByPcloudSkillId(Long pcloudSkillId) {
return super.getSqlSession().selectList(getStatement("getListByPcloudSkillId"), pcloudSkillId);
}
@Override
public List<PcloudSubReply> getListByPcloudSkillIds(List<Long> pcloudSkillIds) {
Map<String,Object> map=new HashMap<>();
map.put("pcloudSkillIds",pcloudSkillIds);
return super.getSqlSession().selectList(getStatement("getListByPcloudSkillIds"), map);
}
@Override
public List<PcloudSubReply> getBySkillIdAndType(Long skillId, Integer subType) {
Map<String,Object> map = new HashMap<>();
map.put("skillId", skillId);
map.put("subType", subType);
return getSqlSession().selectList(getStatement("getBySkillIdAndType"), map);
}
}
package com.pcloud.book.skill.entity;
import com.pcloud.common.entity.BaseEntity;
import java.util.Date;
public class PcloudGroupActivity extends BaseEntity {
private static final long serialVersionUID = -2579070770051745966L;
private String name;
private String desc;
private String groupPic;
private Integer joinType;
private Long proLabelId;
private Long depLabelId;
private Long purLabelId;
private Long bookGroupQrcodeId;
private String groupName;
private Long createUser;
private Long updateUser;
private Integer isDelete;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getGroupPic() {
return groupPic;
}
public void setGroupPic(String groupPic) {
this.groupPic = groupPic;
}
public Integer getJoinType() {
return joinType;
}
public void setJoinType(Integer joinType) {
this.joinType = joinType;
}
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 Long getBookGroupQrcodeId() {
return bookGroupQrcodeId;
}
public void setBookGroupQrcodeId(Long bookGroupQrcodeId) {
this.bookGroupQrcodeId = bookGroupQrcodeId;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
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 Integer getIsDelete() {
return isDelete;
}
public void setIsDelete(Integer isDelete) {
this.isDelete = isDelete;
}
}
\ No newline at end of file
package com.pcloud.book.skill.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@ApiModel("配置资源")
@Data
public class PcloudResource extends BaseEntity {
private static final long serialVersionUID = 4051799074529645657L;
@ApiModelProperty("资源名称")
private String name;
@ApiModelProperty("资源介绍")
private String description;
@ApiModelProperty("专业")
private Long proLabelId;
@ApiModelProperty("深度")
private Long depLabelId;
@ApiModelProperty("目的")
private Long purLabelId;
@ApiModelProperty("创建人")
private Long createUser;
private Integer isDelete;
}
package com.pcloud.book.skill.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("配置资源")
@Data
public class PcloudResourceItem extends BaseEntity {
private static final long serialVersionUID = 4051799074529645657L;
@ApiModelProperty("资源名称")
private String name;
@ApiModelProperty("资源介绍")
private String desc;
@ApiModelProperty("创建人")
private Long createUser;
private Integer isDelete;
}
package com.pcloud.book.skill.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@ApiModel("平台端技能")
@Data
public class PcloudSkill extends BaseEntity {
@ApiModelProperty("技能类型:1时间管理,2共读活动,3配套资料,4教辅书单,5配套老师,6音乐")
private Integer skillType;
@ApiModelProperty("具体关联技能id")
private Long relSkillId;
@ApiModelProperty("成功订阅回复集合")
private List<PcloudSubReply> successSubReplies;
@ApiModelProperty("取消订阅回复集合")
private List<PcloudSubReply> cancelSubReplies;
@ApiModelProperty("技能融合页回复")
private String skillFuseReply;
@ApiModelProperty("排序值")
private Integer seqNum;
@ApiModelProperty("技能标题")
private String title;
@ApiModelProperty("技能简介")
private String detail;
}
package com.pcloud.book.skill.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("技能关联引导语")
@Data
public class PcloudSkillGuide extends BaseEntity {
@ApiModelProperty("技能id")
private Long pcloudSkillId;
@ApiModelProperty("引导语id")
private Long guideId;
@ApiModelProperty("导语名称")
private String guideName;
}
package com.pcloud.book.skill.entity;
import com.pcloud.common.entity.BaseEntity;
import com.pcloud.contentcenter.resource.dto.ResourceOfficeItemDTO;
import com.pcloud.contentcenter.resource.dto.ResourcePdfItemDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel("订阅回复")
public class PcloudSubReply extends BaseEntity {
@ApiModelProperty("技能id")
private Long pcloudSkillId;
@ApiModelProperty("订阅回复类型:1成功,2取消")
private Integer subType;
@ApiModelProperty("类型 1 文字 2 图片 3 链接 4应用 5素材")
private Integer type;
@ApiModelProperty("内容")
private String content;
@ApiModelProperty("描述")
private String description;
@ApiModelProperty("链接地址")
private String linkUrl;
@ApiModelProperty("图片地址")
private String picUrl;
@ApiModelProperty("应用或作品id")
private Long serveId;
@ApiModelProperty("应用或作品类型")
private String serveType;
@ApiModelProperty("资源id")
private Long resourceId;
@ApiModelProperty("创建人")
private Long createUser;
@ApiModelProperty("应用或作品图片")
private String servePic;
@ApiModelProperty("应用或作品名称")
private String serveName;
@ApiModelProperty("应用或作品类型名称")
private String serveTypeName;
@ApiModelProperty("应用或作品类型编码")
private String serveTypeCode;
@ApiModelProperty("资源链接")
private String resourceUrl;
@ApiModelProperty("资源名称")
private String resourceName;
@ApiModelProperty("资源类型编码")
private String resourceTypeCode;
@ApiModelProperty("资源类型名称")
private String resourceTypeName;
@ApiModelProperty("文件类型")
private String fileType;
@ApiModelProperty("文件大小")
private Long fileSize;
@ApiModelProperty("pdf转码后的单张图片集合")
private List<ResourcePdfItemDTO> resourcePdfItems;
@ApiModelProperty("文件转码后的单张图片集合")
private List<ResourceOfficeItemDTO> resourceOfficeItemDTOs;
}
package com.pcloud.book.skill.enums;
public enum SkillTypeEnum {
/**
* 1时间管理
*/
TIME_MANAGE(1),
/**
* 2共读活动
*/
READING(2),
/**
* 3配套资料
*/
RESOURCE(3),
/**
* 4教辅书单
*/
TEACH_BOOK(4),
/**
* 5配套老师
*/
TEACHER(5),
/**
* 6音乐
*/
MUSIC(6);
/**
* 值
*/
public final Integer value;
SkillTypeEnum(Integer value) {
this.value = value;
}
}
package com.pcloud.book.skill.enums;
public enum SubTypeEnum {
/**
* 成功订阅
*/
SUCCESS(1),
/**
* 取消订阅
*/
CANCEL(2);
/**
* 值
*/
public final Integer value;
SubTypeEnum(Integer value) {
this.value = value;
}
}
package com.pcloud.book.skill.facade;
import com.pcloud.book.skill.biz.PcloudGroupActivityBiz;
import com.pcloud.book.skill.facade.request.QueryGroupActivityRequestVO;
import com.pcloud.book.skill.facade.request.SaveGroupActivityRequestVO;
import com.pcloud.book.skill.facade.request.UpdateGroupActivityRequestVO;
import com.pcloud.book.skill.facade.response.QueryGroupActivityResponseVO;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.SessionUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import io.swagger.annotations.ApiModelProperty;
@RestController
@RequestMapping("groupActivity")
public class PcloudGroupActivityFacade {
@Resource
private PcloudGroupActivityBiz pcloudGroupActivityBiz;
@PostMapping("saveGroupActivity")
public ResponseDto<Void> saveGroupActivity(@RequestHeader("token") String token, @RequestBody SaveGroupActivityRequestVO vo) throws PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
vo.setUserId(partyId);
pcloudGroupActivityBiz.saveGroupActivity(vo);
return new ResponseDto<>();
}
@PostMapping("updateGroupActivity")
public ResponseDto<Void> updateGroupActivity(@RequestHeader("token") String token, @RequestBody UpdateGroupActivityRequestVO vo) throws PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
vo.setUserId(partyId);
pcloudGroupActivityBiz.updateGroupActivity(vo);
return new ResponseDto<>();
}
@GetMapping("deleteGroupActivity")
public ResponseDto<Void> queryGroupActivity(@RequestHeader("token") String token, @RequestParam(value = "id") Long id) throws PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
pcloudGroupActivityBiz.deleteGroupActivity(id, partyId);
return new ResponseDto<>();
}
@GetMapping("queryGroupActivity")
public ResponseDto<PageBeanNew<QueryGroupActivityResponseVO>> queryGroupActivity(@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "proLabelId", required = false) Long proLabelId,
@RequestParam(value = "purLabelId", required = false) Long purLabelId,
@RequestParam(value = "depLabelId", required = false) Long depLabelId,
@RequestParam("numPerPage") Integer numPerPage,
@RequestParam("currentPage") Integer currentPage){
return new ResponseDto<>(pcloudGroupActivityBiz.queryGroupActivity(name, proLabelId, purLabelId, depLabelId, numPerPage, currentPage));
}
}
package com.pcloud.book.skill.facade;
import com.pcloud.book.skill.biz.PcloudResourceBiz;
import com.pcloud.book.skill.entity.PcloudResource;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.SessionUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@Api("技能-配置资源")
@RestController("pcloudResourceFacade")
@RequestMapping("pcloudResource")
public class PcloudResourceFacade {
@Resource
private PcloudResourceBiz pcloudResourceBiz;
@ApiOperation("新增资源")
@PostMapping("saveResource")
public ResponseDto<Void> savePcloudResource(@RequestHeader("token") String token, @RequestBody PcloudResource pcloudResource) throws BizException, PermissionException {
pcloudResourceBiz.savePcloudResource(pcloudResource);
return new ResponseDto<>();
}
@ApiOperation("更新资源")
@PostMapping("updatePcloudResource")
public ResponseDto<Void> updatePcloudResource(@RequestHeader("token") String token, @RequestBody PcloudResource pcloudResource) throws BizException, PermissionException {
pcloudResourceBiz.updatePcloudResource(pcloudResource);
return new ResponseDto<>();
}
@ApiOperation("删除资源")
@GetMapping("/deletePcloudResource")
public ResponseDto<?> deletePcloudResource(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("id") @ApiParam("资源id") Long id
) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
pcloudResourceBiz.deletePcloudResource(id);
return new ResponseDto<>();
}
@ApiOperation("获取资源")
@GetMapping("/getPcloudResource")
public ResponseDto<?> getPcloudResource(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("id") @ApiParam("资源id") Long id
) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(pcloudResourceBiz.getPcloudResource(id));
}
@ApiOperation("获取资源列表")
@GetMapping("/getPcloudResourceList")
public ResponseDto<?> getPcloudResourceList(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "name",required = false) @ApiParam("资源名称") String name,
@RequestParam(value = "proLabelId",required = false) @ApiParam("专业") Long proLabelId,
@RequestParam(value = "depLabelId",required = false) @ApiParam("深度") Long depLabelId,
@RequestParam(value = "purLabelId", required = false) @ApiParam("目的") Long purLabelId,
@RequestParam(value = "currentPage", defaultValue = "0") @ApiParam("当前页") Integer currentPage,
@RequestParam(value = "numPerPage", defaultValue = "10") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(pcloudResourceBiz.getPcloudResourceList(name, proLabelId, depLabelId, purLabelId, currentPage,numPerPage));
}
}
package com.pcloud.book.skill.facade;
import com.pcloud.book.skill.biz.PcloudSkillBiz;
import com.pcloud.book.skill.entity.PcloudSkill;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.SessionUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@Api("技能")
@RestController("pcloudSkillFacade")
@RequestMapping("pcloudSkill")
public class PcloudSkillFacade {
@Autowired
private PcloudSkillBiz pcloudSkillBiz;
@ApiOperation("新增技能")
@PostMapping("/createPcloudSkill")
public ResponseDto<?> createPcloudSkill(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestBody @ApiParam("技能模型") PcloudSkill pcloudSkill
) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
pcloudSkillBiz.createPcloudSkill(pcloudSkill);
return new ResponseDto<>();
}
@ApiOperation("修改技能")
@PostMapping("/updatePcloudSkill")
public ResponseDto<?> updatePcloudSkill(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestBody @ApiParam("技能模型") PcloudSkill pcloudSkill
) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
pcloudSkillBiz.updatePcloudSkill(pcloudSkill);
return new ResponseDto<>();
}
@ApiOperation("获取技能")
@GetMapping("/getPcloudSkill")
public ResponseDto<?> getPcloudSkill(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("id") @ApiParam("技能模型") Long id
) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(pcloudSkillBiz.getPcloudSkill(id));
}
@ApiOperation("获取技能列表")
@GetMapping("/getPcloudSkillList")
public ResponseDto<?> getPcloudSkillList(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam(value = "skillType", required = false) @ApiParam("技能类型:1时间管理,2共读活动,3配套资料,4教辅书单,5配套老师,6音乐") Integer skillType,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(pcloudSkillBiz.getPcloudSkillList(skillType,currentPage,numPerPage));
}
@ApiOperation("删除技能")
@GetMapping("/deletePcloudSkill")
public ResponseDto<?> deletePcloudSkill(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("id") @ApiParam("技能模型") Long id
) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
pcloudSkillBiz.deletePcloudSkill(id);
return new ResponseDto<>();
}
@ApiOperation(value = "订阅回复-H5", httpMethod = "GET")
@GetMapping("/subscribePlan")
public ResponseDto<?> subscribePlan( @RequestParam(value = "skillId", required = false) Long skillId,
@RequestParam(value = "taskId", required = false) Integer taskId,
@RequestParam(value = "robotWxId", required = false) String robotWxId,
@RequestParam(value = "userWxId", required = false) String userWxId)
throws BizException {
return new ResponseDto<>(pcloudSkillBiz.setSubscribeState(skillId, taskId, robotWxId, userWxId, true));
}
@ApiOperation("修改技能")
@PostMapping("/updateSeqNum")
public ResponseDto<?> updateSeqNum(
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestBody @ApiParam("技能模型") PcloudSkill pcloudSkill
) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
pcloudSkillBiz.updateSeqNum(pcloudSkill);
return new ResponseDto<>();
}
}
package com.pcloud.book.skill.facade.request;
import com.pcloud.common.entity.BasePageRequestVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
public class QueryGroupActivityRequestVO extends BasePageRequestVO {
private static final long serialVersionUID = -8791894022020799857L;
@ApiModelProperty("活动名称")
private String name;
}
package com.pcloud.book.skill.facade.request;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.skill.entity.PcloudGroupActivity;
import com.pcloud.common.entity.BaseRequestVO;
import com.pcloud.common.utils.string.StringUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;
import java.util.List;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 保存共读活动
*/
@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel("新增共读活动")
public class SaveGroupActivityRequestVO extends BaseRequestVO {
private static final long serialVersionUID = -5370056714391879364L;
@ApiModelProperty("共度名称")
private String name;
@ApiModelProperty("描述")
private String desc;
@ApiModelProperty("群图片,加群方式为图片时有效")
private String groupPic;
@ApiModelProperty("加群类型(0:邀请 1:图片)")
private Integer joinType;
@ApiModelProperty("专业标签")
private Long proLabelId;
@ApiModelProperty("深度标签")
private Long depLabelId;
@ApiModelProperty("目的标签")
private Long purLabelId;
@ApiModelProperty("社群码id")
private Long bookGroupQrcodeId;
public void checkParam() {
if (StringUtil.isBlank(this.getName())
|| null == this.getProLabelId() || null == this.getDepLabelId()
|| null == this.getJoinType() || (this.getJoinType() == 1 && StringUtil.isBlank(this.getGroupPic()))
|| null == this.getPurLabelId() || null == this.getBookGroupQrcodeId()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "请求参数缺失");
}
}
/**
* 转换实体映射
*/
public PcloudGroupActivity getEntity() {
PcloudGroupActivity pcloudGroupActivity = new PcloudGroupActivity();
BeanUtils.copyProperties(this, pcloudGroupActivity);
return pcloudGroupActivity;
}
}
package com.pcloud.book.skill.facade.request;
import com.pcloud.common.entity.BaseRequestVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
public class SaveResourceRequestVO extends BaseRequestVO {
private static final long serialVersionUID = -5318135618854061242L;
@ApiModelProperty("资源名称")
private String name;
@ApiModelProperty("资源介绍")
private String desc;
@ApiModelProperty("专业")
private Integer proLabelId;
@ApiModelProperty("深度")
private Integer depLabelId;
@ApiModelProperty("目的")
private Integer purLabelId;
@ApiModelProperty("创建人")
private Long createUser;
private Integer isDelete;
}
package com.pcloud.book.skill.facade.request;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.skill.entity.PcloudGroupActivity;
import com.pcloud.common.entity.BaseRequestVO;
import com.pcloud.common.utils.string.StringUtil;
import org.springframework.beans.BeanUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 修改共读活动
*/
@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel("修改共读活动")
public class UpdateGroupActivityRequestVO extends BaseRequestVO {
private static final long serialVersionUID = 3642060073527485455L;
@ApiModelProperty("主键")
private Long id;
@ApiModelProperty("共度名称")
private String name;
@ApiModelProperty("描述")
private String desc;
@ApiModelProperty("群图片,加群方式为图片时有效")
private String groupPic;
@ApiModelProperty("加群类型(0:邀请 1:图片)")
private Integer joinType;
@ApiModelProperty("专业标签")
private Long proLabelId;
@ApiModelProperty("深度标签")
private Long depLabelId;
@ApiModelProperty("目的标签")
private Long purLabelId;
@ApiModelProperty("社群码id")
private Long bookGroupQrcodeId;
public void checkParam() {
if (null == id || StringUtil.isBlank(this.getName())
|| null == this.getProLabelId() || null == this.getDepLabelId()
|| null == this.getJoinType() || (this.getJoinType() == 1 && StringUtil.isBlank(this.getGroupPic()))
|| null == this.getPurLabelId() || null == this.getBookGroupQrcodeId()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "请求参数缺失");
}
}
/**
* 转换实体映射
*/
public PcloudGroupActivity getEntity() {
PcloudGroupActivity pcloudGroupActivity = new PcloudGroupActivity();
BeanUtils.copyProperties(this, pcloudGroupActivity);
return pcloudGroupActivity;
}
}
package com.pcloud.book.skill.facade.response;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class QueryGroupActivityResponseVO {
@ApiModelProperty("主键")
private Integer id;
@ApiModelProperty("共度名称")
private String name;
@ApiModelProperty("描述")
private String desc;
@ApiModelProperty("群图片,加群方式为图片时有效")
private String groupPic;
@ApiModelProperty("加群类型(0:邀请 1:图片)")
private Integer joinType;
@ApiModelProperty("社群码id")
private Long bookGroupQrcodeId;
@ApiModelProperty("社群码名称")
private String groupName;
@ApiModelProperty("专业标签id")
private Long proLabelId;
@ApiModelProperty("专业标签")
private String proLabelName;
@ApiModelProperty("深度标签id")
private Long depLabelId;
@ApiModelProperty("深度标签")
private String depLabelName;
@ApiModelProperty("目的标签id")
private Long purLabelId;
@ApiModelProperty("目的标签")
private String purLabelName;
}
package com.pcloud.book.skill.facade.response;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
public class QueryPcloudResponseVO implements Serializable {
private static final long serialVersionUID = 1258875813607055164L;
private Long id;
@ApiModelProperty("资源名称")
private String name;
@ApiModelProperty("资源介绍")
private String description;
@ApiModelProperty("专业标签id")
private Long proLabelId;
@ApiModelProperty("专业标签")
private String proLabelName;
@ApiModelProperty("深度标签id")
private Long depLabelId;
@ApiModelProperty("深度标签")
private String depLabelName;
@ApiModelProperty("目的标签id")
private Long purLabelId;
@ApiModelProperty("目的标签")
private String purLabelName;
}
package com.pcloud.book.timecontrol.biz;
import com.pcloud.book.timecontrol.vo.BookTaskBindingAddVO;
import com.pcloud.book.timecontrol.vo.BookTaskBindingVO;
import com.pcloud.common.page.PageBeanNew;
import java.util.List;
/**
* @author Gui_q
* @since 2020年1月30日 17点25分
*/
public interface BookTaskBindingBiz {
/**
* 创建任务关联书刊
*
* @param bookTaskBindingAddVO
*/
void create(BookTaskBindingAddVO bookTaskBindingAddVO);
/**
* 平台获取任务配置发布列表
*
* @return BookTaskBindingVO
*/
PageBeanNew<BookTaskBindingVO> listBookTaskBinding4Pcloud(String book, Integer proLabelId, Integer depLabelId, Integer purLabelId, Integer currentPage, Integer numPerPage);
/**
* 批量更新任务配置发布状态
*/
void batchUpdateBookTaskState(List<Integer> ids, Integer state);
/**
* 批量删除任务配置发布状态
*/
void batchDeleteBookTask(List<Integer> ids);
}
package com.pcloud.book.timecontrol.biz;
import com.pcloud.book.timecontrol.dto.BookTaskBindingDto;
import com.pcloud.book.timecontrol.dto.CreateTaskDto;
import com.pcloud.book.timecontrol.dto.CreateTaskItemDto;
import com.pcloud.book.timecontrol.dto.LabelDto;
import com.pcloud.book.timecontrol.dto.ReplyMessageBaseDto;
import com.pcloud.book.timecontrol.dto.TaskDto;
import com.pcloud.book.timecontrol.dto.TaskItemDto;
import com.pcloud.book.timecontrol.dto.UpdateTaskDto;
import com.pcloud.book.timecontrol.dto.UpdateTaskItemDto;
import com.pcloud.book.timecontrol.vo.KeyWordTaskVO;
import com.pcloud.common.page.PageBeanNew;
import java.util.List;
/**
* @Description:TODO
* @Author:zcy
* @Date:2020-01-30
* @Version:1.0
*/
public interface TaskBiz {
Integer createTask(CreateTaskDto createTaskDto);
void deleteTask(Integer taskId);
void updateTask(UpdateTaskDto updateTaskDto);
TaskDto getTaskById(Integer taskId);
PageBeanNew<TaskDto> listTask4Pcloud(Integer currentPage, Integer numPerPage, String search);
Integer createTaskItem(CreateTaskItemDto createTaskItemDto);
void deleteTaskItem(Integer id);
void updateTaskItem(UpdateTaskItemDto updateTaskItemDto);
TaskItemDto getTaskItem(Integer id);
List<ReplyMessageBaseDto> listTaskItemDay(Integer taskId);
List<BookTaskBindingDto> listTask(String search);
List<KeyWordTaskVO> listKeyWordTask();
TaskDto getTaskByKey(String search, String wxUserId);
List<LabelDto> listMaxDepLabel(Integer num);
List<TaskDto> listTaskByKey4User(String wxUserId, String search);
List<TaskDto> listTaskByIds4User(String wxUserId, List<Integer> taskIds);
List<TaskDto> listTaskByLabelIds4User(String wxUserId, Long labelId);
void finishTaskSend(Integer taskSendId);
TaskDto getTaskByIdAndWxUserId(Integer relSkillId, String wxUserId);
}
package com.pcloud.book.timecontrol.biz;
import com.pcloud.book.timecontrol.entity.TimeControlTaskSubscribe;
/**
* @date: 2020年01月31日 20:11
* @Author: Zcy
* @Descprition
*/
public interface TaskSubscribeBiz {
/**
* 订阅任务
*/
void subscribeTask(String wxUserId, Long bookId, Integer taskId, String robotWxId);
/**
* 取消订阅任务
*/
void unSubscribeTask(String wxUserId, Long bookId, Integer taskId);
/**
* 获取今日需要发送任务列表
*/
void listTodayTask();
/**
* 定时发送任务消息
*/
void sendTimeTaskMessage();
TimeControlTaskSubscribe getSubscribeState(String wxUserId, Integer taskId);
}
package com.pcloud.book.timecontrol.biz.impl;
import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.book.service.BookService;
import com.pcloud.book.timecontrol.biz.BookTaskBindingBiz;
import com.pcloud.book.timecontrol.entity.TimeControlTask;
import com.pcloud.book.timecontrol.mapper.BookTaskBindingMapper;
import com.pcloud.book.timecontrol.mapper.TimeControlTaskMapper;
import com.pcloud.book.timecontrol.mapper.TimeControlTaskSendMapper;
import com.pcloud.book.timecontrol.mapper.TimeControlTaskSubscribeMapper;
import com.pcloud.book.timecontrol.vo.BookTaskBindingAddVO;
import com.pcloud.book.timecontrol.vo.BookTaskBindingVO;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.utils.DateUtils;
import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.labelcenter.label.service.LabelService;
import com.pcloud.wechatgroup.base.exception.WechatGroupBizException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @author Gui_q
* @since 2020年1月30日 17点27分
*/
@Component("bookTaskBindingBiz")
@Slf4j
public class BookTaskBindingBizImpl implements BookTaskBindingBiz {
@Autowired
private BookTaskBindingMapper bookTaskBindingMapper;
@Autowired
private BookService bookService;
@Autowired
private TimeControlTaskMapper timeControlTaskMapper;
@Autowired
private LabelService labelService;
@Autowired
private TimeControlTaskSendMapper timeControlTaskSendMapper;
@Autowired
private TimeControlTaskSubscribeMapper timeControlTaskSubscribeMapper;
@Override
public void create(BookTaskBindingAddVO bookTaskBindingAddVO) {
// 查询图书是否与任务模板有过关联
if (bookTaskBindingMapper.checkHasBinding(bookTaskBindingAddVO.getBookIds(), bookTaskBindingAddVO.getTaskId()) > 0) {
throw new WechatGroupBizException(WechatGroupBizException.PARAM_IS_EXIST, "该书刊与任务已存在关联!");
}
TimeControlTask timeControlTask = timeControlTaskMapper.selectByPrimaryKey(bookTaskBindingAddVO.getTaskId());
// 批量查询图书信息
List<Integer> bookIds = bookTaskBindingAddVO.getBookIds();
final List<Long> ids = bookIds.stream().map(Long::valueOf).collect(Collectors.toList());
try {
ResponseEntity<ResponseDto<Map<Long, BookDto>>> response = bookService.getListByIds(ids);
Map<Long, BookDto> bookMap = ResponseHandleUtil.parseMap(response, Long.class, BookDto.class);
// 批量插入
bookTaskBindingMapper.batchInsert(new ArrayList<>(bookMap.values()), timeControlTask);
} catch (Exception e) {
log.error("bookService.getListByIds 批量获取书籍信息失败" + e.getMessage());
throw new WechatGroupBizException(WechatGroupBizException.RESULT_NULL, "系统繁忙");
}
}
@Override
public PageBeanNew<BookTaskBindingVO> listBookTaskBinding4Pcloud(String book, Integer proLabelId, Integer depLabelId, Integer purLabelId, Integer currentPage, Integer numPerPage) {
List<BookTaskBindingVO> list = new ArrayList<>();
List<Integer> bookIds = null;
// TODO 1. 根据社群码名称/书刊名称/ISBN/编号查询书籍ID列表
try {
ResponseEntity<ResponseDto<List<Long>>> response = bookService.getIdsByName(book);
List<Long> ids = ResponseHandleUtil.parseList(response, Long.class);
bookIds = ids.stream().map(item -> Integer.valueOf(item.intValue())).collect(Collectors.toList());
} catch (Exception e) {
log.error("bookService.getListByIds 批量获取书籍信息失败" + e.getMessage());
}
Integer count = bookTaskBindingMapper.getBookTaskBindingCount(bookIds, proLabelId, depLabelId, purLabelId);
if (count <= 0) {
return new PageBeanNew<>(currentPage, numPerPage, count, list);
}
list = bookTaskBindingMapper.selectBookTaskBinding4Pcloud(bookIds, proLabelId, depLabelId, purLabelId, currentPage * numPerPage, numPerPage);
String sendDay = DateUtils.getReqDate(new Date());
// 补充统计数据
list.forEach(item -> {
item.setTaskCount(timeControlTaskSubscribeMapper.countTaskSubscribe(item.getTaskId(), item.getBookId()));
item.setPreSendCount(timeControlTaskSendMapper.countTodayNotSend(item.getTaskId(), item.getBookId(), sendDay));
item.setHasSentCount(timeControlTaskSendMapper.countMsgSend(item.getTaskId(), item.getBookId()));
});
// 封装标签 统计数据
Set<Long> labelSet = new HashSet<>();
// 获取所有标签 统一获取标签名称
list.forEach(item -> {
labelSet.add(item.getProLabelId());
labelSet.add(item.getDepLabelId());
labelSet.add(item.getPurLabelId());
});
labelSet.remove(null);
if (labelSet.size() > 0) {
try {
// 批量获取标签名称
ResponseEntity<ResponseDto<Map<Long, String>>> response = labelService.getLabelName(new ArrayList<>(labelSet));
Map<Long, String> labelMap = ResponseHandleUtil.parseMap(response, Long.class, String.class);
// 补充标签名称
list.forEach(item -> {
item.setProLabelName(labelMap.get(item.getProLabelId()));
item.setDepLabelName(labelMap.get(item.getDepLabelId()));
item.setPurLabelName(labelMap.get(item.getPurLabelId()));
});
} catch (Exception e) {
log.error("labelService.getLabelName 批量获取标签名称失败" + e.getMessage());
}
}
return new PageBeanNew<>(currentPage, numPerPage, count, list);
}
@Override
public void batchUpdateBookTaskState(List<Integer> ids, Integer state) {
bookTaskBindingMapper.batchUpdateBookTaskState(ids, state);
}
@Override
public void batchDeleteBookTask(List<Integer> ids) {
bookTaskBindingMapper.batchDeleteBookTask(ids);
}
}
package com.pcloud.book.timecontrol.entity;
import lombok.Builder;
import lombok.Data;
import lombok.ToString;
import java.util.Date;
@Builder
@Data
@ToString
public class BookTaskBinding {
private Integer id;
private Integer taskId;
private String taskName;
private Integer bookId;
private String bookName;
private String isbn;
private Integer state;
private Integer delete;
private Date createTime;
private Date updateTime;
}
\ No newline at end of file
package com.pcloud.book.timecontrol.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.Date;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class TimeControlReplyMessage {
private Integer id;
private Integer taskId;
private Integer taskItemId;
private Integer replyType;
private String messageType;
private String text;
private Integer appId;
private Integer productId;
private String imgUrl;
private String fileName;
private String fileUrl;
private Date createTime;
private Date updateTime;
private String linkUrl;
private String fileId;
private String fileType;
private BigDecimal size;
}
\ No newline at end of file
package com.pcloud.book.timecontrol.entity;
import lombok.Data;
import java.util.Date;
@Data
public class TimeControlTask {
private Integer taskId;
private String taskName;
private String taskIntroduce;
private String taskKeyWord;
private String subscribeWord;
private Integer advancedSetting;
private Date createTime;
private Date updateTime;
private Long depLabelId;
private Long purLabelId;
private Long proLabelId;
private String successSubscribeWord;
private String successUnSubscribeWord;
}
\ No newline at end of file
package com.pcloud.book.timecontrol.entity;
import java.util.Date;
public class TimeControlTaskItem {
private Integer id;
private Integer taskId;
private Integer startDay;
private Integer finishConfirm;
private String finishKeyWord;
private Date createTime;
private Date updateTime;
private Integer tdConfirm;
private String finishLinkIntroduce;
private String finishLinkUrl;
public Integer getTdConfirm() {
return tdConfirm;
}
public void setTdConfirm(Integer tdConfirm) {
this.tdConfirm = tdConfirm;
}
public String getFinishLinkIntroduce() {
return finishLinkIntroduce;
}
public void setFinishLinkIntroduce(String finishLinkIntroduce) {
this.finishLinkIntroduce = finishLinkIntroduce;
}
public String getFinishLinkUrl() {
return finishLinkUrl;
}
public void setFinishLinkUrl(String finishLinkUrl) {
this.finishLinkUrl = finishLinkUrl;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getTaskId() {
return taskId;
}
public void setTaskId(Integer taskId) {
this.taskId = taskId;
}
public Integer getStartDay() {
return startDay;
}
public void setStartDay(Integer startDay) {
this.startDay = startDay;
}
public Integer getFinishConfirm() {
return finishConfirm;
}
public void setFinishConfirm(Integer finishConfirm) {
this.finishConfirm = finishConfirm;
}
public String getFinishKeyWord() {
return finishKeyWord;
}
public void setFinishKeyWord(String finishKeyWord) {
this.finishKeyWord = finishKeyWord == null ? null : finishKeyWord.trim();
}
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;
}
}
\ No newline at end of file
package com.pcloud.book.timecontrol.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @date: 2020年02月01日 11:04
* @Author: Zcy
* @Descprition
*/
@Data
public class TimeControlTaskSend implements Serializable {
private Integer id;
private String wxUserId;
private Long bookId;
private Integer taskId;
private Integer taskItemId;
private Integer subscribeId;
private String sendDay;
private Date createTime;
private Integer sendState;
private Integer completeState;
}
package com.pcloud.book.timecontrol.entity;
import lombok.Data;
import java.util.Date;
/**
* @date: 2020年01月31日 20:02
* @Author: Zcy
* @Descprition
*/
@Data
public class TimeControlTaskSubscribe {
private Integer id;
private String wxUserId;
private Long bookId;
private Integer taskId;
private Integer state;
private Date createTime;
private Date updateTime;
private String robotWxId;
}
package com.pcloud.book.timecontrol.facade.impl;
import com.pcloud.book.timecontrol.biz.BookTaskBindingBiz;
import com.pcloud.book.timecontrol.vo.BookTaskBindingAddVO;
import com.pcloud.book.timecontrol.vo.BookTaskBindingVO;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.SessionUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 书刊与任务模板绑定关联关系 外部接口
*
* @author Gui_q
* @since 2020年1月30日 14点36分
*/
@Api(tags = "任务配置发布 外部接口")
@RequestMapping(value = "/bookTaskBinding")
@RestController("bookTaskBindingFacadeImpl")
public class BookTaskBindingFacade {
@Autowired
private BookTaskBindingBiz bookTaskBindingBiz;
@ApiOperation(value = "获取任务配置发布列表", httpMethod = "GET")
@RequestMapping(value = "/listBookTaskBinding4Pcloud", method = RequestMethod.GET)
ResponseDto<PageBeanNew<BookTaskBindingVO>> listBookTaskBinding4Pcloud(@RequestHeader("token") String token,
@RequestParam(value = "book", required = false) String book,
@RequestParam(value = "proLabelId", required = false) Integer proLabelId,
@RequestParam(value = "depLabelId", required = false) Integer depLabelId,
@RequestParam(value = "purLabelId", required = false) Integer purLabelId,
@RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage) throws PermissionException {
SessionUtil.getToken4Redis(token);
PageBeanNew<BookTaskBindingVO> result = bookTaskBindingBiz.listBookTaskBinding4Pcloud(book, proLabelId, depLabelId, purLabelId, currentPage, numPerPage);
return new ResponseDto<>(result);
}
@ApiOperation(value = "批量开启任务", httpMethod = "POST")
@RequestMapping(value = "/batchStartTask", method = RequestMethod.POST)
ResponseDto<?> batchStartTask(@RequestHeader("token") String token,
@RequestBody List<Integer> ids) throws PermissionException {
SessionUtil.getToken4Redis(token);
bookTaskBindingBiz.batchUpdateBookTaskState(ids, 1);
return new ResponseDto<>(null);
}
@ApiOperation(value = "批量关闭任务", httpMethod = "POST")
@RequestMapping(value = "/batchCloseTask", method = RequestMethod.POST)
ResponseDto<?> batchCloseTask(@RequestHeader("token") String token,
@RequestBody List<Integer> ids) throws PermissionException {
SessionUtil.getToken4Redis(token);
bookTaskBindingBiz.batchUpdateBookTaskState(ids, 0);
return new ResponseDto<>(null);
}
@ApiOperation(value = "批量删除任务", httpMethod = "POST")
@RequestMapping(value = "/batchDeleteTask", method = RequestMethod.POST)
ResponseDto<?> batchDeleteTask(@RequestHeader("token") String token,
@RequestBody List<Integer> ids) throws PermissionException {
SessionUtil.getToken4Redis(token);
bookTaskBindingBiz.batchDeleteBookTask(ids);
return new ResponseDto<>(null);
}
@ApiOperation(value = "创建任务关联书刊", httpMethod = "POST")
@RequestMapping(value = "/create", method = RequestMethod.POST)
ResponseDto<?> create(@RequestHeader("token") String token,
@RequestBody BookTaskBindingAddVO bookTaskBindingAddVO) throws PermissionException {
SessionUtil.getToken4Redis(token);
bookTaskBindingBiz.create(bookTaskBindingAddVO);
return new ResponseDto<>(null);
}
}
package com.pcloud.book.timecontrol.facade.impl;
import com.pcloud.book.timecontrol.biz.TaskBiz;
import com.pcloud.book.timecontrol.biz.TaskSubscribeBiz;
import com.pcloud.book.timecontrol.entity.TimeControlTaskSubscribe;
import com.pcloud.book.timecontrol.vo.KeyWordTaskVO;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.SessionUtil;
import com.pcloud.book.timecontrol.dto.CreateTaskDto;
import com.pcloud.book.timecontrol.dto.CreateTaskItemDto;
import com.pcloud.book.timecontrol.dto.ReplyMessageBaseDto;
import com.pcloud.book.timecontrol.dto.TaskDto;
import com.pcloud.book.timecontrol.dto.UpdateTaskDto;
import com.pcloud.book.timecontrol.dto.UpdateTaskItemDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @date: 2020年01月30日 11:29
* @Author: Zcy
* @Descprition
*/
@Api(value = "时间管理任务模板配置")
@RequestMapping(value = "/task")
@RestController("taskFacade")
public class TimeControlTaskFacadeImpl {
@Autowired
private TaskBiz taskBiz;
@Autowired
private TaskSubscribeBiz taskSubscribeBiz;
@PostMapping("createTask")
@ApiOperation(value = "创建任务模板", httpMethod = "POST")
ResponseDto<Integer> createTask(@RequestHeader("token") String token, @RequestBody CreateTaskDto createTaskDto) throws PermissionException {
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(taskBiz.createTask(createTaskDto));
}
@ApiOperation(value = "删除任务模板", httpMethod = "GET")
@GetMapping("deleteTask")
ResponseDto<?> deleteTask(@RequestHeader("token") String token, @RequestParam(value = "taskId") Integer taskId) throws PermissionException {
SessionUtil.getToken4Redis(token);
taskBiz.deleteTask(taskId);
return new ResponseDto<>(taskId);
}
@PostMapping("updateTask")
@ApiOperation(value = "修改任务模板", httpMethod = "POST")
ResponseDto<?> updateTask(@RequestHeader("token") String token, @RequestBody @Validated UpdateTaskDto updateTaskDto) throws PermissionException {
SessionUtil.getToken4Redis(token);
taskBiz.updateTask(updateTaskDto);
return new ResponseDto<>();
}
@GetMapping("getTask")
@ApiOperation(value = "获取任务信息", httpMethod = "GET")
ResponseDto<TaskDto> getTask(@RequestHeader("token") String token, @RequestParam("taskId") Integer taskId) throws PermissionException {
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(taskBiz.getTaskById(taskId));
}
@GetMapping("listTask4Pcloud")
@ApiOperation(value = "平台端查询任务列表", httpMethod = "GET")
ResponseDto<PageBeanNew<TaskDto>> listTask4Pcloud(@RequestHeader("token") String token, @RequestParam Integer currentPage, @RequestParam Integer numPerPage,
@RequestParam(value = "search", required = false) String search) throws PermissionException {
SessionUtil.getToken4Redis(token);
PageBeanNew<TaskDto> pageResult = taskBiz.listTask4Pcloud(currentPage, numPerPage, search);
return new ResponseDto<>(pageResult);
}
@PostMapping("createTaskItem")
@ApiOperation(value = "创建消息配置", httpMethod = "POST")
ResponseDto<?> createTaskItem(@RequestHeader("token") String token, @RequestBody @Validated CreateTaskItemDto createTaskItemDto) throws PermissionException {
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(taskBiz.createTaskItem(createTaskItemDto));
}
@GetMapping("deleteTaskItem")
@ApiOperation(value = "删除消息配置", httpMethod = "GET")
ResponseDto<?> deleteTaskItem(@RequestHeader("token") String token, @RequestParam Integer id) throws PermissionException {
SessionUtil.getToken4Redis(token);
taskBiz.deleteTaskItem(id);
return new ResponseDto<>();
}
@PostMapping("updateTaskItem")
@ApiOperation(value = "修改消息配置", httpMethod = "POST")
ResponseDto<?> updateTaskItem(@RequestHeader("token") String token, @RequestBody @Validated UpdateTaskItemDto updateTaskItemDto) throws PermissionException {
SessionUtil.getToken4Redis(token);
taskBiz.updateTaskItem(updateTaskItemDto);
return new ResponseDto<>();
}
@ApiOperation(value = "获取一条消息配置", httpMethod = "GET")
@GetMapping("getOneTaskItem")
ResponseDto<?> getOneTaskItem(@RequestHeader("token") String token, @RequestParam Integer id) throws PermissionException {
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(taskBiz.getTaskItem(id));
}
@ApiOperation(value = "获取任务模板下所有消息配置天数", httpMethod = "GET")
@GetMapping("listTaskItemDay")
ResponseDto<?> listTaskItemDay(@RequestHeader("token") String token, @RequestParam Integer taskId) throws PermissionException {
SessionUtil.getToken4Redis(token);
List<ReplyMessageBaseDto> resultList = taskBiz.listTaskItemDay(taskId);
return new ResponseDto<>(resultList);
}
@ApiOperation(value = "客户端订阅任务", httpMethod = "GET")
@GetMapping("subscribeTask")
ResponseDto<?> subscribeTask(@RequestParam String wxUserId, @RequestParam Integer taskId, @RequestParam String robotWxId) {
taskSubscribeBiz.subscribeTask(wxUserId, null, taskId, robotWxId);
return new ResponseDto<>();
}
@ApiOperation(value = "取消订阅任务", httpMethod = "GET")
@GetMapping("unsubscribeTask")
ResponseDto<?> unsubscribeTask(@RequestParam String wxUserId, @RequestParam Integer taskId) {
taskSubscribeBiz.unSubscribeTask(wxUserId, null, taskId);
return new ResponseDto<>();
}
@ApiOperation(value = "temp-接口H5技能聚合页面获取读书计划", httpMethod = "GET")
@GetMapping("listKeyWordTask")
ResponseDto<List<KeyWordTaskVO>> listKeyWordTask(){
List<KeyWordTaskVO> resultList = taskBiz.listKeyWordTask();
return new ResponseDto<>(resultList);
}
@ApiOperation(value = "H5聚合页通过关键词获取任务", httpMethod = "GET")
@GetMapping("getTaskByKey")
ResponseDto<?> getTaskByKey(@RequestParam("search") String search, @RequestParam("wxUserId") String wxUserId){
TaskDto taskDto = taskBiz.getTaskByKey(search, wxUserId);
return new ResponseDto<>(taskDto);
}
@ApiOperation(value = "查询订阅状态", httpMethod = "GET")
@GetMapping("getSubscribeState")
ResponseDto<?> getSubscribeState(@RequestParam String wxUserId, @RequestParam Integer taskId){
TimeControlTaskSubscribe timeControlTaskSubscribe = taskSubscribeBiz.getSubscribeState(wxUserId, taskId);
return new ResponseDto<>(timeControlTaskSubscribe);
}
@ApiOperation(value = "客户端点击链接完成任务", httpMethod = "GET")
@GetMapping("finishTaskSend")
ResponseDto<?> finishTaskSend(@RequestParam("taskSendId") Integer taskSendId){
taskBiz.finishTaskSend(taskSendId);
return new ResponseDto<>();
}
}
\ No newline at end of file
package com.pcloud.book.timecontrol.mapper;
import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.timecontrol.entity.BookTaskBinding;
import com.pcloud.book.timecontrol.entity.TimeControlTask;
import com.pcloud.book.timecontrol.vo.BookTaskBindingVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public interface BookTaskBindingMapper {
int deleteByPrimaryKey(Integer id);
int insert(BookTaskBinding record);
int insertSelective(BookTaskBinding record);
BookTaskBinding selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(BookTaskBinding record);
int updateByPrimaryKey(BookTaskBinding record);
/**
* 批量新增任务配置发布
*/
int batchInsert(@Param("bookDtos") List<BookDto> bookDtos, @Param("timeControlTask") TimeControlTask timeControlTask);
/**
* 获取任务配置发布数量
*/
Integer getBookTaskBindingCount(@Param("bookIds") List<Integer> bookIds, @Param("proLabelId") Integer proLabelId, @Param("depLabelId") Integer depLabelId, @Param("purLabelId") Integer purLabelId);
/**
* 分页查询分页配置发布
*/
List<BookTaskBindingVO> selectBookTaskBinding4Pcloud(@Param("bookIds") List<Integer> bookIds, @Param("proLabelId") Integer proLabelId, @Param("depLabelId") Integer depLabelId, @Param("purLabelId") Integer purLabelId, @Param("pageNum") Integer pageNum, @Param("numPerPage") Integer numPerPage);
/**
* 批量更新任务配置发布状态
*/
int batchUpdateBookTaskState(@Param("ids") List<Integer> ids, @Param("state") Integer state);
/**
* 批量删除任务配置发布
*/
int batchDeleteBookTask(@Param("ids") List<Integer> ids);
void deleteByTask(Integer taskId);
void updateTaskName(@Param("taskId") Integer taskId, @Param("taskName") String taskName);
/**
* 查询图书是否与任务模板有过关联
*/
int checkHasBinding(@Param("bookIds") List<Integer> bookIds, @Param("taskId") Integer taskId);
}
\ No newline at end of file
package com.pcloud.book.timecontrol.mapper;
import com.pcloud.book.timecontrol.entity.TimeControlReplyMessage;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
@Component("replyMessageMapper")
public interface TimeControlReplyMessageMapper {
int deleteByPrimaryKey(Integer id);
int insert(TimeControlReplyMessage record);
int insertSelective(TimeControlReplyMessage record);
TimeControlReplyMessage selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(TimeControlReplyMessage record);
int updateByPrimaryKey(TimeControlReplyMessage record);
void batchInsert(@Param("list") List<TimeControlReplyMessage> list);
void deleteByItemId(Integer taskItemId);
List<TimeControlReplyMessage> list4TaskItem(@Param("taskItemId") Integer taskItemId, @Param("replyType") Integer replyType);
List<TimeControlReplyMessage> getByTaskItemId(Integer taskItemId);
}
\ No newline at end of file
package com.pcloud.book.timecontrol.mapper;
import com.pcloud.book.timecontrol.entity.TimeControlTaskItem;
import com.pcloud.book.timecontrol.dto.ReplyMessageBaseDto;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
@Component("taskItemMapper")
public interface TimeControlTaskItemMapper {
int deleteByPrimaryKey(Integer id);
int insert(TimeControlTaskItem record);
TimeControlTaskItem selectByPrimaryKey(Integer id);
TimeControlTaskItem getByTaskIdAndDay(@Param("taskId") Integer taskId, @Param("startDay") Integer startDay);
void updateTtaskItem(TimeControlTaskItem timeControlTaskItem);
List<ReplyMessageBaseDto> listTaskItemDay(Integer taskId);
}
\ No newline at end of file
package com.pcloud.book.timecontrol.mapper;
import com.pcloud.book.timecontrol.entity.TimeControlTask;
import com.pcloud.book.timecontrol.vo.KeyWordTaskVO;
import com.pcloud.book.timecontrol.dto.BookTaskBindingDto;
import com.pcloud.book.timecontrol.dto.TaskDto;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
@Component("taskMapper")
public interface TimeControlTaskMapper {
int deleteByPrimaryKey(Integer taskId);
int insert(TimeControlTask record);
TimeControlTask selectByPrimaryKey(Integer taskId);
void updateTask(TimeControlTask timeControlTask);
Integer getTaskCount(@Param("search") String search);
List<TaskDto> listTask4Pcloud(@Param("pageNum") Integer pageNum, @Param("numPerPage") Integer numPerPage, @Param("search") String search);
/**
* 根据 专业/深度/目的 标签查询任务模板集合
*/
List<Integer> listIdByLabelId(@Param("proLabelId") Integer proLabelId, @Param("depLabelId") Integer depLabelId, @Param("purLabelId") Integer purLabelId);
List<BookTaskBindingDto> listTask(@Param("search") String search);
@MapKey("taskId")
Map<Integer, TaskDto> mapByIds(@Param("taskIds") List<Integer> taskIds);
List<KeyWordTaskVO> listKeyWordTask();
TaskDto getTaskByKey(String search);
List<Long> listMaxDepLabel(Integer num);
List<TaskDto> listTaskByKey4User(@Param("search") String search, @Param("taskIds") List<Long> taskIds);
List<TaskDto> listTaskByIds(@Param("taskIds") List<Integer> taskIds);
List<TaskDto> listTaskByLabelId(Long labelId);
TaskDto getTaskByIdAndWxUserId(@Param("relSkillId")Integer relSkillId, @Param("wxUserId")String wxUserId);
Integer getSubscribeState(@Param("relSkillId")Integer relSkillId, @Param("wxUserId")String wxUserId);
}
\ No newline at end of file
package com.pcloud.book.timecontrol.mapper;
import com.pcloud.book.timecontrol.entity.TimeControlTaskSend;
import com.pcloud.book.timecontrol.dto.TaskSendDto;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @date: 2020年01月31日 20:05
* @Author: Zcy
* @Descprition
*/
@Component
public interface TimeControlTaskSendMapper {
void batchInsert(List<TimeControlTaskSend> taskSendList);
List<TaskSendDto> listTodayTask();
void cancelSend(@Param("subscribeId") Integer subscribeId, @Param("sendState") Integer sendState);
void cancelSendByTaskId(Integer taskId);
void cancelSendByItemId(Integer taskItemId);
/**
* 查询已发送消息数
*/
Integer countMsgSend(@Param("taskId") Integer taskId, @Param("bookId") Integer bookId);
/**
* 查询今日未发送消息数
*/
Integer countTodayNotSend(@Param("taskId") Integer taskId, @Param("bookId") Integer bookId, @Param("sendDay") String sendDay);
void updateSendState(@Param("sendId") Integer sendId, @Param("sendState") Integer sendState, @Param("completeState") Integer completeState);
TimeControlTaskSend getById(Integer taskSendId);
Integer getNoCompletedItem(Integer taskId);
}
package com.pcloud.book.timecontrol.mapper;
import com.pcloud.book.timecontrol.entity.TimeControlTaskSubscribe;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
/**
* @date: 2020年01月31日 20:05
* @Author: Zcy
* @Descprition
*/
@Component("taskSubscribeMapper")
public interface TimeControlTaskSubscribeMapper {
void subscribeTask(TimeControlTaskSubscribe timeControlTaskSubscribe);
TimeControlTaskSubscribe getSubscribe(@Param("wxUserId") String wxUserId, @Param("bookId") Long bookId, @Param("taskId") Integer taskId);
void subscribeTaskExist(TimeControlTaskSubscribe taskSubscribe);
void unSubscribeTask(TimeControlTaskSubscribe taskSubscribe);
void unSubscribeTaskByTaskId(Integer taskId);
/**
* 查询任务订阅人数
*/
Integer countTaskSubscribe(@Param("taskId") Integer taskId, @Param("bookId") Integer bookId);
TimeControlTaskSubscribe getById(Integer subscribeId);
void completedTaskById(Integer subscribeId);
}
package com.pcloud.book.timecontrol.service.impl;
import com.pcloud.book.timecontrol.biz.TaskBiz;
import com.pcloud.book.timecontrol.biz.TaskSubscribeBiz;
import com.pcloud.book.timecontrol.dto.BookTaskBindingDto;
import com.pcloud.book.timecontrol.dto.LabelDto;
import com.pcloud.book.timecontrol.dto.TaskDto;
import com.pcloud.book.timecontrol.mapper.TimeControlTaskMapper;
import com.pcloud.book.timecontrol.service.TimeControlTaskService;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.utils.ResponseHandleUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
@RestController("timeControlTaskService")
@RequestMapping("timeControlTaskService")
public class TimeControlTaskServiceImpl implements TimeControlTaskService {
@Autowired
private TaskSubscribeBiz taskSubscribeBiz;
@Autowired
private TaskBiz taskBiz;
@Autowired
private TimeControlTaskMapper taskMapper;
@Override
@GetMapping("sendTimeTaskMessage")
public void sendTimeTaskMessage() {
new Thread(() -> {
taskSubscribeBiz.sendTimeTaskMessage();
}).start();
}
@Override
@GetMapping("getTaskById")
public ResponseEntity<ResponseDto<TaskDto>> getTaskById(@RequestParam(value = "taskId") Integer taskId) {
return ResponseHandleUtil.toResponse(taskBiz.getTaskById(taskId));
}
@Override
@GetMapping("listTask")
public ResponseEntity<ResponseDto<List<BookTaskBindingDto>>> listTask(@RequestParam(value = "search", required = false) String search) {
List<BookTaskBindingDto> list = taskBiz.listTask(search);
return ResponseHandleUtil.toResponse(list);
}
@Override
@PostMapping("getTaskBatch")
public ResponseEntity<ResponseDto<Map<Integer, TaskDto>>> getTaskBatch(@RequestBody List<Integer> taskIds) {
return ResponseHandleUtil.toResponse(taskMapper.mapByIds(taskIds));
}
@Override
@GetMapping("listMaxDepLabel")
public ResponseEntity<ResponseDto<List<LabelDto>>> listMaxDepLabel(@RequestParam(value = "num", required = false) Integer num) {
List<LabelDto> list = taskBiz.listMaxDepLabel(num);
return ResponseHandleUtil.toResponse(list);
}
@Override
@GetMapping("listTaskByKey4User")
public ResponseEntity<ResponseDto<List<TaskDto>>> listTaskByKey4User(@RequestParam("wxUserId") String wxUserId, @RequestParam("search") String search) {
List<TaskDto> list = taskBiz.listTaskByKey4User(wxUserId, search);
return ResponseHandleUtil.toResponse(list);
}
@Override
@PostMapping("listTaskByIds4User")
public ResponseEntity<ResponseDto<List<TaskDto>>> listTaskByIds4User(@RequestParam("wxUserId") String wxUserId, @RequestBody List<Integer> taskIds) {
List<TaskDto> list = taskBiz.listTaskByIds4User(wxUserId, taskIds);
return ResponseHandleUtil.toResponse(list);
}
@Override
@GetMapping("listTaskByLabelIds4User")
public ResponseEntity<ResponseDto<List<TaskDto>>> listTaskByLabelIds4User(@RequestParam("wxUserId") String wxUserId, @RequestParam("labelId") Long labelId) {
List<TaskDto> list = taskBiz.listTaskByLabelIds4User(wxUserId, labelId);
return ResponseHandleUtil.toResponse(list);
}
@Override
@GetMapping("unSubscribeTask")
public void unSubscribeTask(@RequestParam("wxId") String wxId, @RequestParam("taskId") Integer taskId) {
taskSubscribeBiz.unSubscribeTask(wxId, null, taskId);
}
}
package com.pcloud.book.timecontrol.vo;
import lombok.Data;
import java.util.List;
@Data
public class BookTaskBindingAddVO {
List<Integer> bookIds;
Integer taskId;
}
package com.pcloud.book.timecontrol.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class BookTaskBindingVO implements Serializable {
private static final long serialVersionUID = -7515841010418305282L;
private Integer id;
private Integer taskId;
private String taskName;
private Integer bookId;
private String bookName;
private String isbn;
private String serialNumber;
private Integer state;
private Long proLabelId;
private String proLabelName;
private Long depLabelId;
private String depLabelName;
private Long purLabelId;
private String purLabelName;
private Integer taskCount;
private Integer preSendCount;
private Integer hasSentCount;
}
package com.pcloud.book.timecontrol.vo;
import lombok.Data;
import java.io.Serializable;
/**
* @date: 2020年02月03日 12:35
* @Author: Zcy
* @Descprition
*/
@Data
public class KeyWordTaskVO implements Serializable {
private Integer id;
private String keyWord;
private String guideWord;
private Integer taskId;
private String taskName;
private String taskIntroduce;
private String taskKeyWord;
private String subscribeWord;
private Integer advancedSetting;
}
...@@ -48,6 +48,9 @@ ...@@ -48,6 +48,9 @@
a.create_user AS adviserId, a.create_user AS adviserId,
a.group_name AS groupName, a.group_name AS groupName,
a.qrcode_url AS groupQrcode, a.qrcode_url AS groupQrcode,
a.user_number as userNumber,
d.dep_label_id as depLabelId,
d.pro_label_id as proLabelId,
c.BOOK_NAME AS bookName c.BOOK_NAME AS bookName
FROM FROM
book_group_qrcode a book_group_qrcode a
...@@ -58,6 +61,12 @@ ...@@ -58,6 +61,12 @@
a.is_delete = 0 a.is_delete = 0
AND b.is_delete = 0 AND b.is_delete = 0
AND c.IS_DELETE = 0 AND c.IS_DELETE = 0
<if test="depLabelId != null" >
AND d.dep_label_id = #{depLabelId}
</if>
<if test="proLabelId != null" >
AND d.pro_label_id = #{proLabelId}
</if>
<if test="groupName != null and groupName != '' "> <if test="groupName != null and groupName != '' ">
AND ( AND (
a.group_name LIKE CONCAT('%', #{groupName},'%') a.group_name LIKE CONCAT('%', #{groupName},'%')
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.skill.dao.impl.PcloudGroupActivityDaoImpl" >
<resultMap id="BaseResultMap" type="com.pcloud.book.skill.entity.PcloudGroupActivity" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="name" property="name" jdbcType="VARCHAR" />
<result column="description" property="desc" jdbcType="VARCHAR" />
<result column="join_type" property="joinType" jdbcType="INTEGER" />
<result column="group_pic" property="groupPic" jdbcType="VARCHAR" />
<result column="pro_label_id" property="proLabelId" jdbcType="INTEGER" />
<result column="dep_label_id" property="depLabelId" jdbcType="INTEGER" />
<result column="pur_label_id" property="purLabelId" jdbcType="INTEGER" />
<result column="book_group_qrcode_id" property="bookGroupQrcodeId" jdbcType="INTEGER" />
<result column="group_name" property="groupName" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="create_user" property="createUser" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="update_user" property="updateUser" jdbcType="INTEGER" />
<result column="is_delete" property="isDelete" jdbcType="BIT" />
</resultMap>
<sql id="Base_Column_List" >
id, name, description, join_type, group_pic, pro_label_id, dep_label_id,
pur_label_id, book_group_qrcode_id,
create_time, create_user, update_time, update_user, is_delete
</sql>
<update id="deleteById" parameterType="long">
update pcloud_group_activity set is_delete = 1 where id = #{id}
</update>
<select id="queryGroupActivity" resultType="com.pcloud.book.skill.facade.response.QueryGroupActivityResponseVO" parameterType="map" >
SELECT
a.id,
a.NAME,
a.description,
a.join_type AS joinType,
a.group_pic AS groupPic,
a.book_group_qrcode_id AS bookGroupQrcodeId,
a.pro_label_id AS proLabelId,
a.dep_label_id AS depLabelId,
a.pur_label_id AS purLabelId,
b.group_name AS groupName
FROM
pcloud_group_activity a left join book_group_qrcode b on a.book_group_qrcode_id = b.id
WHERE
a.is_delete = 0
<if test="proLabelId != null">
and a.pro_label_id = #{proLabelId}
</if>
<if test="depLabelId != null">
and a.dep_label_id = #{depLabelId}
</if>
<if test="purLabelId != null">
and a.pur_label_id = #{purLabelId}
</if>
<if test="name != null">
and a.name like CONCAT('%', #{name},'%')
</if>
</select>
<select id="getById" resultMap="BaseResultMap" parameterType="long" >
select
a.id, a.name, a.description, a.join_type, a.group_pic, a.pro_label_id, a.dep_label_id,
a.pur_label_id, a.book_group_qrcode_id,
a.create_time, a.create_user, a.update_time, a.update_user, a.is_delete, b.group_name
from pcloud_group_activity a left join book_group_qrcode b on a.book_group_qrcode_id = b.id
where a.id = #{id,jdbcType=INTEGER}
</select>
<insert id="insert" parameterType="com.pcloud.book.skill.entity.PcloudGroupActivity" >
insert into pcloud_group_activity (id, name,
description, join_type, group_pic, pro_label_id, dep_label_id,
pur_label_id, book_group_qrcode_id, create_time,
create_user, update_time, update_user,
is_delete)
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
#{desc,jdbcType=VARCHAR}, #{joinType,jdbcType=INTEGER}, #{groupPic,jdbcType=VARCHAR}, #{proLabelId,jdbcType=INTEGER}, #{depLabelId,jdbcType=INTEGER},
#{purLabelId,jdbcType=INTEGER}, #{bookGroupQrcodeId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{createUser,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER},
#{isDelete,jdbcType=BIT})
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.skill.entity.PcloudGroupActivity" >
update pcloud_group_activity
<set >
<if test="name != null" >
name = #{name,jdbcType=VARCHAR},
</if>
<if test="desc != null" >
description = #{desc,jdbcType=VARCHAR},
</if>
<if test="joinType != null" >
join_type = #{joinType,jdbcType=INTEGER},
</if>
<if test="groupPic != null" >
group_pic = #{groupPic,jdbcType=VARCHAR},
</if>
<if test="proLabelId != null" >
pro_label_id = #{proLabelId,jdbcType=INTEGER},
</if>
<if test="depLabelId != null" >
dep_label_id = #{depLabelId,jdbcType=INTEGER},
</if>
<if test="purLabelId != null" >
pur_label_id = #{purLabelId,jdbcType=INTEGER},
</if>
<if test="bookGroupQrcodeId != null" >
book_group_qrcode_id = #{bookGroupQrcodeId,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="createUser != null" >
create_user = #{createUser,jdbcType=INTEGER},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="updateUser != null" >
update_user = #{updateUser,jdbcType=INTEGER},
</if>
<if test="isDelete != null" >
is_delete = #{isDelete,jdbcType=BIT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="update" parameterType="com.pcloud.book.skill.entity.PcloudGroupActivity" >
update pcloud_group_activity
set name = #{name,jdbcType=VARCHAR},
description = #{desc,jdbcType=VARCHAR},
join_type = #{joinType,jdbcType=INTEGER},
group_pic = #{groupPic,jdbcType=VARCHAR},
pro_label_id = #{proLabelId,jdbcType=INTEGER},
dep_label_id = #{depLabelId,jdbcType=INTEGER},
pur_label_id = #{purLabelId,jdbcType=INTEGER},
book_group_qrcode_id = #{bookGroupQrcodeId,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
create_user = #{createUser,jdbcType=INTEGER},
update_time = #{updateTime,jdbcType=TIMESTAMP},
update_user = #{updateUser,jdbcType=INTEGER},
is_delete = #{isDelete,jdbcType=BIT}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="mayByIds" parameterType="long" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from pcloud_group_activity
where id in
<foreach collection="list" index="i" 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" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.skill.dao.impl.PcloudResourceDaoImpl" >
<resultMap id="BaseResultMap" type="com.pcloud.book.skill.entity.PcloudResource" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="name" property="name" jdbcType="VARCHAR" />
<result column="description" property="description" jdbcType="VARCHAR" />
<result column="pro_label_id" property="proLabelId" jdbcType="BIGINT" />
<result column="dep_label_id" property="depLabelId" jdbcType="BIGINT" />
<result column="pur_label_id" property="purLabelId" jdbcType="BIGINT" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="is_delete" property="isDelete" jdbcType="BIT" />
</resultMap>
<sql id="Base_Column_List" >
id, name, description, pro_label_id, dep_label_id, pur_label_id,
create_time, update_time, is_delete
</sql>
<select id="getPcloudResourceList" resultType="com.pcloud.book.skill.facade.response.QueryPcloudResponseVO" parameterType="map" >
SELECT
id,
NAME,
description,
pro_label_id proLabelId,
dep_label_id depLabelId,
pur_label_id purLabelId
FROM
`pcloud_resource`
WHERE is_delete = 0
<if test="name != null">
AND name like CONCAT('%',#{name},'%')
</if>
<if test="proLabelId != null">
AND pro_label_id = #{proLabelId}
</if>
<if test="depLabelId != null">
AND dep_label_id = #{depLabelId}
</if>
<if test="purLabelId != null">
AND pur_label_id = #{purLabelId}
</if>
ORDER BY id DESC
</select>
<select id="getPcloudResource" resultType="com.pcloud.book.skill.facade.response.QueryPcloudResponseVO" parameterType="long">
SELECT
id,
NAME,
description,
pro_label_id proLabelId,
dep_label_id depLabelId,
pur_label_id purLabelId
FROM pcloud_resource
WHERE id=#{id} AND is_delete = 0
</select>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from pcloud_resource
where id = #{id,jdbcType=INTEGER}
</select>
<insert id="insert" parameterType="com.pcloud.book.skill.entity.PcloudResource" keyProperty="id" useGeneratedKeys="true">
insert into pcloud_resource (name, description, pro_label_id, dep_label_id, pur_label_id,
create_time, update_time, is_delete)
values (#{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{proLabelId,jdbcType=INTEGER}, #{depLabelId,jdbcType=INTEGER}, #{purLabelId,jdbcType=INTEGER},
NOW(), NOW(), 0)
</insert>
<update id="update" parameterType="com.pcloud.book.skill.entity.PcloudResource" >
update pcloud_resource
<set >
<if test="name != null" >
name = #{name,jdbcType=VARCHAR},
</if>
<if test="description != null" >
description = #{description,jdbcType=VARCHAR},
</if>
<if test="proLabelId != null" >
pro_label_id = #{proLabelId,jdbcType=INTEGER},
</if>
<if test="depLabelId != null" >
dep_label_id = #{depLabelId,jdbcType=INTEGER},
</if>
<if test="purLabelId != null" >
pur_label_id = #{purLabelId,jdbcType=INTEGER},
</if>
<if test="isDelete != null" >
is_delete = #{isDelete,jdbcType=BIT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="deletePcloudResource" parameterType="long">
update pcloud_resource
set is_delete = 1
where id = #{id,jdbcType=BIGINT}
</update>
<select id="mayByIds" parameterType="long" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from pcloud_resource
where id in
<foreach collection="list" index="i" 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.skill.dao.impl.PcloudSkillDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.skill.entity.PcloudSkill">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="skill_type" property="skillType" jdbcType="INTEGER"/>
<result column="rel_skill_id" property="relSkillId" jdbcType="BIGINT"/>
<result column="skill_fuse_reply" property="skillFuseReply" jdbcType="VARCHAR"/>
<result column="seq_num" property="seqNum" jdbcType="INTEGER"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, skill_type, rel_skill_id, skill_fuse_reply, seq_num, create_time
</sql>
<sql id="Column_List_Skill">
id, skill_type, rel_skill_id, skill_fuse_reply, seq_num,
</sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
select
<include refid="Base_Column_List"/>
from pcloud_skill
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteById" parameterType="long">
delete from pcloud_skill
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.pcloud.book.skill.entity.PcloudSkill" useGeneratedKeys="true" keyProperty="id">
insert into pcloud_skill
<trim prefix="(" suffix=")" suffixOverrides=",">
skill_type,
rel_skill_id,
skill_fuse_reply,
seq_num,
create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{skillType,jdbcType=INTEGER},
#{relSkillId,jdbcType=BIGINT},
#{skillFuseReply,jdbcType=VARCHAR},
#{seqNum,jdbcType=INTEGER},
NOW()
</trim>
</insert>
<update id="update" parameterType="com.pcloud.book.push.entity.Push">
update pcloud_skill
<set>
<if test="skillType != null">
skill_type = #{skillType,jdbcType=INTEGER},
</if>
<if test="relSkillId != null">
rel_skill_id = #{relSkillId,jdbcType=BIGINT},
</if>
<if test="skillFuseReply != null">
skill_fuse_reply = #{skillFuseReply,jdbcType=VARCHAR},
</if>
<if test="seqNum != null">
seq_num = #{seqNum,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<select id="getPcloudSkillList" parameterType="map" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from pcloud_skill
where 1=1
<if test="skillType!=null">
and skill_type = #{skillType}
</if>
order by seq_num
</select>
<update id="updateSeqNum" parameterType="map">
update pcloud_skill
set seq_num=#{seqNum}
where id=#{id}
</update>
<select id="getSkillList4TimeController" parameterType="map" resultType="com.pcloud.book.keywords.entity.RobotSkill4H5">
select
p.id,
p.skill_type type,
p.rel_skill_id relSkillId,
t.task_name relSkillName,
t.task_introduce relSkillIntroduce
from pcloud_skill p
left join time_control_task t
on p.rel_skill_id = t.task_id
where
skill_type = 1
<if test="labelId != null">
and t.dep_label_id = #{labelId}
</if>
order by p.seq_num
</select>
<select id="getSkillList4Activity" parameterType="map" resultType="com.pcloud.book.keywords.entity.RobotSkill4H5">
select
p.id,
p.skill_type type,
p.rel_skill_id relSkillId,
pa.name relSkillName,
pa.description relSkillIntroduce
from pcloud_skill p
left join pcloud_group_activity pa
on p.rel_skill_id = pa.id
where
skill_type = 2
<if test="labelId != null">
and pa.dep_label_id = #{labelId}
</if>
order by p.seq_num
</select>
<select id="getSkillList4Resource" parameterType="map" resultType="com.pcloud.book.keywords.entity.RobotSkill4H5">
select
p.id,
p.skill_type type,
p.rel_skill_id relSkillId,
pr.name relSkillName,
pr.description relSkillIntroduce
from pcloud_skill p
left join pcloud_resource pr
on p.rel_skill_id = pr.id
where
skill_type = 3 and pr.is_delete = 0
<if test="labelId != null">
and pr.dep_label_id = #{labelId}
</if>
order by p.seq_num
</select>
<select id="getLabelList4Activity" parameterType="integer" resultType="long">
select
DISTINCT pa.dep_label_id
from pcloud_skill p
left join pcloud_group_activity pa
on p.rel_skill_id = pa.id
where
skill_type = 2
and
pa.dep_label_id is not null
</select>
<select id="getLabelList4TimeController" parameterType="integer" resultType="long">
select
DISTINCT t.dep_label_id
from pcloud_skill p
left join time_control_task t
on p.rel_skill_id = t.task_id
where
skill_type = 1
and
t.dep_label_id is not null
</select>
<select id="getLabelList4Resource" parameterType="integer" resultType="long">
select
DISTINCT pr.dep_label_id
from pcloud_skill p
left join pcloud_resource pr
on p.rel_skill_id = pr.id
where
skill_type = 3 and pr.is_delete = 0
and
pr.dep_label_id is not null
</select>
<select id="getMaxSeqNum" resultType="integer">
select ifnull(max(seq_num),0) from pcloud_skill
</select>
<select id="getByRelSkillId" parameterType="integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
pcloud_skill
where
rel_skill_id = #{relSkillId}
</select>
<select id="getByRelId" resultMap="BaseResultMap">
select id, skill_type, rel_skill_id, skill_fuse_reply, seq_num
from pcloud_skill where rel_skill_id = #{relSkillId} and skill_type = #{type}
limit 1
</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.skill.dao.impl.PcloudSkillGuideDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.skill.entity.PcloudSkillGuide">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="pcloud_skill_id" property="pcloudSkillId" jdbcType="BIGINT"/>
<result column="guide_id" property="guideId" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, pcloud_skill_id, guide_id, create_time
</sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
select
<include refid="Base_Column_List"/>
from pcloud_skill_guide
where id = #{id,jdbcType=BIGINT}
</select>
<insert id="insert" parameterType="com.pcloud.book.skill.entity.PcloudSkillGuide" useGeneratedKeys="true" keyProperty="id">
insert into pcloud_skill_guide
<trim prefix="(" suffix=")" suffixOverrides=",">
pcloud_skill_id,
guide_id,
create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{pcloudSkillId,jdbcType=BIGINT},
#{guideId,jdbcType=BIGINT},
NOW()
</trim>
</insert>
<insert id="batchInsert" parameterType="com.pcloud.book.skill.entity.PcloudSkillGuide" useGeneratedKeys="true" keyProperty="id">
insert into pcloud_skill_guide (
pcloud_skill_id,
guide_id,
create_time
) values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.pcloudSkillId,jdbcType=BIGINT},
#{item.guideId,jdbcType=BIGINT},
NOW()
)
</foreach>
</insert>
<delete id="deleteByPcloudSkillId" parameterType="long">
delete from pcloud_skill_guide
where pcloud_skill_id=#{pcloudSkillId}
</delete>
<select id="getListByPcloudSkillId" parameterType="long" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from pcloud_skill_guide
where pcloud_skill_id=#{pcloudSkillId}
</select>
<select id="getListByPcloudSkillIds" parameterType="map" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from pcloud_skill_guide
where pcloud_skill_id in
<foreach collection="pcloudSkillIds" 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.skill.dao.impl.PcloudSubReplyDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.skill.entity.PcloudSubReply">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="pcloud_skill_id" property="pcloudSkillId" jdbcType="BIGINT"/>
<result column="sub_type" property="subType" jdbcType="BIGINT"/>
<result column="type" property="type" jdbcType="BIGINT"/>
<result column="content" property="content" jdbcType="BIGINT"/>
<result column="description" property="description" jdbcType="BIGINT"/>
<result column="link_url" property="linkUrl" jdbcType="BIGINT"/>
<result column="pic_url" property="picUrl" jdbcType="BIGINT"/>
<result column="serve_id" property="serveId" jdbcType="BIGINT"/>
<result column="serve_type" property="serveType" jdbcType="BIGINT"/>
<result column="resource_id" property="resourceId" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id ,pcloud_skill_id ,sub_type ,type ,content ,description ,link_url ,pic_url ,serve_id ,serve_type ,resource_id ,create_time
</sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
select
<include refid="Base_Column_List"/>
from pcloud_sub_reply
where id = #{id,jdbcType=BIGINT}
</select>
<insert id="insert" parameterType="com.pcloud.book.skill.entity.PcloudSubReply" useGeneratedKeys="true" keyProperty="id">
insert into pcloud_sub_reply
<trim prefix="(" suffix=")" suffixOverrides=",">
pcloud_skill_id ,
sub_type ,
type ,
content ,
description ,
link_url ,
pic_url ,
serve_id ,
serve_type ,
resource_id ,
create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{pcloudSkillId,jdbcType=BIGINT},
#{subType,jdbcType=INTEGER},
#{type,jdbcType=INTEGER},
#{content,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR},
#{linkUrl,jdbcType=VARCHAR},
#{picUrl,jdbcType=VARCHAR},
#{serveId,jdbcType=BIGINT},
#{serveType,jdbcType=VARCHAR},
#{resourceId,jdbcType=BIGINT},
NOW()
</trim>
</insert>
<insert id="batchInsert" parameterType="com.pcloud.book.skill.entity.PcloudSubReply" useGeneratedKeys="true" keyProperty="id">
insert into pcloud_sub_reply (
pcloud_skill_id ,
sub_type ,
type ,
content ,
description ,
link_url ,
pic_url ,
serve_id ,
serve_type ,
resource_id ,
create_time
) values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.pcloudSkillId,jdbcType=BIGINT},
#{item.subType,jdbcType=INTEGER},
#{item.type,jdbcType=INTEGER},
#{item.content,jdbcType=VARCHAR},
#{item.description,jdbcType=VARCHAR},
#{item.linkUrl,jdbcType=VARCHAR},
#{item.picUrl,jdbcType=VARCHAR},
#{item.serveId,jdbcType=BIGINT},
#{item.serveType,jdbcType=VARCHAR},
#{item.resourceId,jdbcType=BIGINT},
NOW()
)
</foreach>
</insert>
<delete id="deleteByPcloudSkillId" parameterType="long">
delete from pcloud_sub_reply
where pcloud_skill_id=#{pcloudSkillId}
</delete>
<select id="getListByPcloudSkillId" parameterType="long" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from pcloud_sub_reply
where pcloud_skill_id=#{pcloudSkillId}
</select>
<select id="getListByPcloudSkillIds" parameterType="map" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from pcloud_sub_reply
where pcloud_skill_id in
<foreach collection="pcloudSkillIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</select>
<select id="getBySkillIdAndType" parameterType="map" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from pcloud_sub_reply
where pcloud_skill_id=#{skillId} and sub_type = #{subType}
</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" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.timecontrol.mapper.BookTaskBindingMapper" >
<resultMap id="BaseResultMap" type="com.pcloud.book.timecontrol.entity.BookTaskBinding" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="task_id" property="taskId" jdbcType="INTEGER" />
<result column="task_name" property="taskName" jdbcType="VARCHAR" />
<result column="book_id" property="bookId" jdbcType="INTEGER" />
<result column="book_name" property="bookName" jdbcType="VARCHAR" />
<result column="isbn" property="isbn" jdbcType="VARCHAR" />
<result column="state" property="state" jdbcType="BIT" />
<result column="delete" property="delete" jdbcType="BIT" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
id, task_id, task_name, book_id, book_name, isbn, state, delete, create_time, update_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from book_task_binding
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from book_task_binding
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByTask">
delete from book_task_binding where task_id = #{taskId}
</delete>
<insert id="insert" parameterType="com.pcloud.book.timecontrol.entity.BookTaskBinding" >
insert into book_task_binding (id, task_id, task_name,
book_id, book_name, isbn,
state, delete, create_time,
update_time)
values (#{id,jdbcType=INTEGER}, #{taskId,jdbcType=INTEGER}, #{taskName,jdbcType=VARCHAR},
#{bookId,jdbcType=INTEGER}, #{bookName,jdbcType=VARCHAR}, #{isbn,jdbcType=VARCHAR},
#{state,jdbcType=BIT}, #{delete,jdbcType=BIT}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.pcloud.book.timecontrol.entity.BookTaskBinding" >
insert into book_task_binding
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="taskId != null" >
task_id,
</if>
<if test="taskName != null" >
task_name,
</if>
<if test="bookId != null" >
book_id,
</if>
<if test="bookName != null" >
book_name,
</if>
<if test="isbn != null" >
isbn,
</if>
<if test="state != null" >
state,
</if>
<if test="delete != null" >
delete,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="updateTime != null" >
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="taskId != null" >
#{taskId,jdbcType=INTEGER},
</if>
<if test="taskName != null" >
#{taskName,jdbcType=VARCHAR},
</if>
<if test="bookId != null" >
#{bookId,jdbcType=INTEGER},
</if>
<if test="bookName != null" >
#{bookName,jdbcType=VARCHAR},
</if>
<if test="isbn != null" >
#{isbn,jdbcType=VARCHAR},
</if>
<if test="state != null" >
#{state,jdbcType=BIT},
</if>
<if test="delete != null" >
#{delete,jdbcType=BIT},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.timecontrol.entity.BookTaskBinding" >
update book_task_binding
<set >
<if test="taskId != null" >
task_id = #{taskId,jdbcType=INTEGER},
</if>
<if test="taskName != null" >
task_name = #{taskName,jdbcType=VARCHAR},
</if>
<if test="bookId != null" >
book_id = #{bookId,jdbcType=INTEGER},
</if>
<if test="bookName != null" >
book_name = #{bookName,jdbcType=VARCHAR},
</if>
<if test="isbn != null" >
isbn = #{isbn,jdbcType=VARCHAR},
</if>
<if test="state != null" >
state = #{state,jdbcType=BIT},
</if>
<if test="delete != null" >
delete = #{delete,jdbcType=BIT},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.pcloud.book.timecontrol.entity.BookTaskBinding" >
update book_task_binding
set task_id = #{taskId,jdbcType=INTEGER},
task_name = #{taskName,jdbcType=VARCHAR},
book_id = #{bookId,jdbcType=INTEGER},
book_name = #{bookName,jdbcType=VARCHAR},
isbn = #{isbn,jdbcType=VARCHAR},
state = #{state,jdbcType=BIT},
delete = #{delete,jdbcType=BIT},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<!--批量新增任务配置发布-->
<insert id="batchInsert">
INSERT INTO book_task_binding (
task_id, task_name, book_id, book_name, isbn, state, `delete`, create_time
) VALUES
<foreach collection="bookDtos" item="book" separator=",">
( #{timeControlTask.taskId}, #{timeControlTask.taskName}, #{book.bookId}, #{book.bookName}, #{book.isbn}, 0, 0, NOW())
</foreach>
</insert>
<!--获取任务配置发布数量-->
<select id="getBookTaskBindingCount" resultType="java.lang.Integer">
SELECT count(1) FROM book_task_binding a LEFT JOIN time_control_task b ON a.task_id = b.task_id
WHERE a.`delete` = 0
<if test="proLabelId != null">
AND b.pro_label_id = #{proLabelId}
</if>
<if test="depLabelId != null">
AND b.dep_label_id = #{depLabelId}
</if>
<if test="purLabelId != null">
AND b.pur_label_id = #{purLabelId}
</if>
<if test="bookIds!=null">
AND book_id IN
<foreach collection="bookIds" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</if>
</select>
<!--分页查询分页配置发布-->
<select id="selectBookTaskBinding4Pcloud"
resultType="com.pcloud.book.timecontrol.vo.BookTaskBindingVO">
SELECT
a.id,
a.task_id taskId,
a.task_name taskName,
a.book_id bookId,
a.book_name bookName,
a.isbn,
CONCAT( 'BK', a.book_id ) serialNumber,
a.state,
b.pro_label_id proLabelId,
b.dep_label_id depLabelId,
b.pur_label_id purLabelId
FROM book_task_binding a LEFT JOIN time_control_task b ON a.task_id = b.task_id
WHERE a.`delete` = 0
<if test="proLabelId != null">
AND b.pro_label_id = #{proLabelId}
</if>
<if test="depLabelId != null">
AND b.dep_label_id = #{depLabelId}
</if>
<if test="purLabelId != null">
AND b.pur_label_id = #{purLabelId}
</if>
<if test="bookIds!=null">
AND a.book_id IN
<foreach collection="bookIds" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</if>
LIMIT #{pageNum}, #{numPerPage}
</select>
<select id="checkHasBinding" resultType="java.lang.Integer">
SELECT count(1) FROM book_task_binding
WHERE
<foreach collection="bookIds" item="bookId" open="(" close=") OR ">
book_id = #{bookId} AND task_id = #{taskId}
</foreach>
0
</select>
<!--批量更新任务配置发布状态-->
<update id="batchUpdateBookTaskState">
UPDATE book_task_binding SET state = #{state} WHERE id IN
<foreach collection="ids" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</update>
<!--批量删除任务配置发布-->
<update id="batchDeleteBookTask">
UPDATE book_task_binding SET `delete` = 1 WHERE id IN
<foreach collection="ids" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</update>
<update id="updateTaskName">
UPDATE book_task_binding set task_name = #{taskName}
where task_id = #{taskId}
</update>
</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