Commit c50cb1a1 by tc
parents 06e23bd2 35c48465
package com.pcloud.book.custom.biz;
import com.pcloud.book.custom.entity.CustomPlan;
import com.pcloud.book.custom.vo.AddCustomPlan4UserVO;
import com.pcloud.book.custom.vo.AddSuggestionVO;
import com.pcloud.book.custom.vo.CustomPlanModuleVO;
import com.pcloud.book.custom.vo.CustomPlanPaperVO;
import com.pcloud.book.custom.vo.EditCustomPlanModuleVO;
import com.pcloud.book.custom.vo.ModuleSuggestionVO;
import com.pcloud.book.custom.vo.SuggestionListVO;
import com.pcloud.common.page.PageBeanNew;
import java.util.List;
......@@ -30,4 +34,12 @@ public interface CustomPlanBiz {
PageBeanNew<CustomPlanPaperVO> listPlanPaperByPage(Integer currentPage, Integer numPerPage, Integer paperState, String content);
Map<String, Object> getShortLinkUrl(Long appId, Long productId, String linkUrl);
PageBeanNew<SuggestionListVO> listSuggestion4Plan(Integer currentPage, Integer numPerPage, String startTime, String endTime, String search, Integer planId);
List<ModuleSuggestionVO> getSuggestionInfo(Integer batchId, Integer planId);
Integer addSuggestion4Module(AddSuggestionVO addSuggestionVO);
Integer addCustomPlan4User(AddCustomPlan4UserVO addCustomPlan4UserVO);
}
......@@ -7,29 +7,43 @@ import com.pcloud.book.consumer.app.AppConsr;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.feedback.FeedbackConsr;
import com.pcloud.book.consumer.shareimage.ShareImageConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.custom.biz.CustomPlanBiz;
import com.pcloud.book.custom.entity.CustomPlan;
import com.pcloud.book.custom.entity.CustomPlanModule;
import com.pcloud.book.custom.entity.CustomPlanModuleSuggestion;
import com.pcloud.book.custom.enums.PlanModuleTypeEnum;
import com.pcloud.book.custom.enums.PlanUseStateEnum;
import com.pcloud.book.custom.mapper.CustomPlanMapper;
import com.pcloud.book.custom.mapper.CustomPlanModuleMapper;
import com.pcloud.book.custom.mapper.CustomPlanModuleSuggestionMapper;
import com.pcloud.book.custom.vo.AddCustomPlan4UserVO;
import com.pcloud.book.custom.vo.AddSuggestionListVO;
import com.pcloud.book.custom.vo.AddSuggestionVO;
import com.pcloud.book.custom.vo.CustomPlanModuleVO;
import com.pcloud.book.custom.vo.CustomPlanPaperVO;
import com.pcloud.book.custom.vo.EditCustomPlanModuleVO;
import com.pcloud.book.custom.vo.ModuleSuggestionVO;
import com.pcloud.book.custom.vo.SuggestionListVO;
import com.pcloud.book.custom.vo.ToPdfVO;
import com.pcloud.book.group.biz.WeixinQrcodeBiz;
import com.pcloud.book.group.tools.Kit;
import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.channelcenter.wechat.dto.AccountSettingDto;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.utils.BeanUtils;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.QrcodeUtils;
import com.pcloud.common.utils.UUIDUitl;
import com.pcloud.common.utils.httpclient.UrlUtils;
import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.feedback.paper.dto.PaperDto;
import com.sdk.wxgroup.GroupInfoVO;
import com.pcloud.wechatgroup.group.dto.GroupRobotDTO;
import com.pcloud.wechatgroup.group.dto.GroupUserDTO;
import com.sdk.wxgroup.SendMessageTypeEnum;
import com.sdk.wxgroup.SendTextMessageVO;
import com.sdk.wxgroup.WxGroupSDK;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -42,6 +56,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Component
public class CustomPlanBizImpl implements CustomPlanBiz {
......@@ -62,6 +77,12 @@ public class CustomPlanBizImpl implements CustomPlanBiz {
private AppConsr appConsr;
@Autowired
private QrcodeSceneConsr qrcodeSceneConsr;
@Autowired
private CustomPlanModuleSuggestionMapper customPlanModuleSuggestionMapper;
@Autowired
private WechatGroupConsr wechatGroupConsr;
@Autowired
private WeixinQrcodeBiz weixinQrcodeBiz;
@Override
@Transactional(rollbackFor = Exception.class)
......@@ -260,4 +281,83 @@ public class CustomPlanBizImpl implements CustomPlanBiz {
}
return resultMap;
}
@Override
public PageBeanNew<SuggestionListVO> listSuggestion4Plan(Integer currentPage, Integer numPerPage, String startTime,
String endTime, String search, Integer planId) {
List<SuggestionListVO> list = new ArrayList<>();
List<String> wxIdList = null;
if (!StringUtil.isEmpty(search)) {
wxIdList = wechatGroupConsr.getByUserQuery(search);
if (ListUtils.isEmpty(wxIdList)) {
return new PageBeanNew<>(currentPage, numPerPage, list);
}
}
Integer count = customPlanModuleSuggestionMapper.getSuggestionCount(startTime, endTime, wxIdList, planId);
if (count <= 0) {
return new PageBeanNew<>(currentPage, numPerPage, list);
}
list = customPlanModuleSuggestionMapper.listSuggestion4Plan(currentPage * numPerPage, numPerPage, startTime, endTime, wxIdList, planId);
List<String> userIds = list.stream().map(SuggestionListVO::getWxId).distinct().collect(Collectors.toList());
Map<String, GroupUserDTO> userDTOMap = wechatGroupConsr.mapWxUserInfoByWxIdList(userIds);
list.forEach(suggestionListVO -> {
//封装用户信息
String wxId = suggestionListVO.getWxId();
if (userDTOMap != null && userDTOMap.get(wxId) != null) {
GroupUserDTO groupUserDTO = userDTOMap.get(wxId);
suggestionListVO.setNickName(groupUserDTO.getNickName());
suggestionListVO.setHeadUrl(groupUserDTO.getHeadPic());
suggestionListVO.setSex(groupUserDTO.getSex());
}
});
return new PageBeanNew<>(currentPage, numPerPage, count, list);
}
@Override
public List<ModuleSuggestionVO> getSuggestionInfo(Integer batchId, Integer planId) {
return customPlanModuleSuggestionMapper.getSuggestionInfo(batchId, planId);
}
@Override
public Integer addSuggestion4Module(AddSuggestionVO addSuggestionVO) {
String wxId = addSuggestionVO.getWxId();
Integer planId = addSuggestionVO.getPlanId();
int maxBatchId = customPlanModuleSuggestionMapper.getMaxBatchId();
List<AddSuggestionListVO> suggestionList = addSuggestionVO.getSuggestionList();
List<CustomPlanModuleSuggestion> list = new ArrayList<>();
suggestionList.forEach(addSuggestionListVO -> {
if (null == addSuggestionListVO.getSuggestionLevel()) {
addSuggestionListVO.setSuggestionLevel(0);
addSuggestionListVO.setSuggestion(null);
}
CustomPlanModuleSuggestion suggestion = CustomPlanModuleSuggestion.builder().wxId(wxId).planId(planId)
.suggestionLevel(addSuggestionListVO.getSuggestionLevel()).suggestion(addSuggestionListVO.getSuggestion())
.batchId(maxBatchId + 1).moduleId(addSuggestionListVO.getModuleId()).build();
list.add(suggestion);
});
customPlanModuleSuggestionMapper.batchInsert(list);
ThreadPoolUtils.OTHER_THREAD_POOL.execute(() -> {
CustomPlan customPlan = customPlanMapper.getById(planId);
if (!StringUtil.isEmpty(customPlan.getConfirmFeedbackReply()) && addSuggestionVO.getRobotWxId() != null) {
//发送return消息
String robotWxId = addSuggestionVO.getRobotWxId();
GroupRobotDTO groupRobotDTO = wechatGroupConsr.getGroupRobotByWxId(robotWxId);
String ip = weixinQrcodeBiz.getRobotIpByGeneration(groupRobotDTO.getVersion());
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
sendTextMessageVO.setContent(customPlan.getConfirmFeedbackReply());
sendTextMessageVO.setCode(SendMessageTypeEnum.SELF.getCode());
sendTextMessageVO.setWxId(robotWxId);
sendTextMessageVO.setAltId(robotWxId);
sendTextMessageVO.setWxGroupId(wxId);
sendTextMessageVO.setIp(ip);
WxGroupSDK.sendTextMessage(sendTextMessageVO);
}
});
return maxBatchId + 1;
}
@Override
public Integer addCustomPlan4User(AddCustomPlan4UserVO addCustomPlan4UserVO) {
return customPlanModuleSuggestionMapper.addCustomPlan4User(addCustomPlan4UserVO);
}
}
......@@ -39,4 +39,8 @@ public class CustomPlan {
private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
private Integer suggestionCount;
private String confirmFeedbackReply;
}
\ No newline at end of file
......@@ -44,4 +44,6 @@ public class CustomPlanModule {
private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
private Integer openFeedback;
}
\ No newline at end of file
package com.pcloud.book.custom.entity;
import lombok.Builder;
import lombok.Data;
import java.util.Date;
@Data
@Builder
public class CustomPlanModuleSuggestion {
private Integer id;
private Integer batchId;
private Integer planId;
private Integer moduleId;
private String wxId;
private Integer suggestionLevel;
private String suggestion;
private Date createTime;
}
\ No newline at end of file
......@@ -4,17 +4,26 @@ import com.pcloud.book.custom.biz.CustomPlanBiz;
import com.pcloud.book.custom.biz.CustomPlanEmailBiz;
import com.pcloud.book.custom.dto.CustomPlanEmailDto;
import com.pcloud.book.custom.entity.CustomPlan;
import com.pcloud.book.custom.vo.CustomPlanModuleVO;
import com.pcloud.book.custom.vo.AddCustomPlan4UserVO;
import com.pcloud.book.custom.vo.AddSuggestionVO;
import com.pcloud.book.custom.vo.EditCustomPlanModuleVO;
import com.pcloud.book.timecontrol.vo.CreateSelfPlanVO;
import com.pcloud.book.custom.vo.ModuleSuggestionVO;
import com.pcloud.book.custom.vo.SuggestionListVO;
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 com.pcloud.common.page.PageBeanNew;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
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;
......@@ -124,4 +133,34 @@ public class CustomPlanFacade {
return new ResponseDto<>(customPlanEmailBiz.getCustomPlanEmailByPlanId(customPlanId));
}
@GetMapping("listSuggestion4Plan")
@ApiOperation(value = "获取方案满意度记录", httpMethod = "GET")
ResponseDto<?> listSuggestion4Plan(@RequestHeader String token, @RequestParam Integer currentPage, @RequestParam Integer numPerPage,
@RequestParam(value = "startTime", required = false) String startTime, @RequestParam(value = "endTime", required = false) String endTime,
@RequestParam(value = "search", required = false) String search, @RequestParam Integer planId) {
PageBeanNew<SuggestionListVO> page = customPlanBiz.listSuggestion4Plan(currentPage, numPerPage, startTime, endTime, search, planId);
return new ResponseDto<>(page);
}
@ApiOperation("查看评价详情")
@GetMapping("getSuggestionInfo")
ResponseDto<?> getSuggestionInfo(@RequestHeader String token, @RequestParam Integer batchId, @RequestParam Integer planId){
List<ModuleSuggestionVO> resultList = customPlanBiz.getSuggestionInfo(batchId, planId);
return new ResponseDto<>(resultList);
}
@ApiOperation(value = "客户端提交方案的意见反馈", httpMethod = "POST")
@PostMapping("addSuggestion4Module")
ResponseDto<?> addSuggestion4Module(@RequestBody @Validated AddSuggestionVO addSuggestionVO){
Integer batchId = customPlanBiz.addSuggestion4Module(addSuggestionVO);
return new ResponseDto<>(batchId);
}
@ApiOperation(value = "给用户发送方案后的埋点", httpMethod = "POST")
@PostMapping("addCustomPlan4User")
ResponseDto<?> addCustomPlan4User(@RequestBody @Validated AddCustomPlan4UserVO addCustomPlan4UserVO){
Integer id = customPlanBiz.addCustomPlan4User(addCustomPlan4UserVO);
return new ResponseDto<>(id);
}
}
package com.pcloud.book.custom.mapper;
import com.pcloud.book.custom.entity.CustomPlanModuleSuggestion;
import com.pcloud.book.custom.vo.AddCustomPlan4UserVO;
import com.pcloud.book.custom.vo.ModuleSuggestionVO;
import com.pcloud.book.custom.vo.SuggestionListVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public interface CustomPlanModuleSuggestionMapper {
Integer getSuggestionCount(@Param("startTime") String startTime, @Param("endTime") String endTime,
@Param("wxIdList") List<String> wxIdList, @Param("planId") Integer planId);
List<SuggestionListVO> listSuggestion4Plan(@Param("pageNum") int pageNum, @Param("numPerPage") int numPerPage,
@Param("startTime") String startTime, @Param("endTime") String endTime,
@Param("wxIdList") List<String> wxIdList, @Param("planId") Integer planId);
List<ModuleSuggestionVO> getSuggestionInfo(@Param("batchId") Integer batchId, @Param("planId") Integer planId);
Integer getMaxBatchId();
void batchInsert(@Param("list") List<CustomPlanModuleSuggestion> list);
Integer addCustomPlan4User(AddCustomPlan4UserVO addCustomPlan4UserVO);
Integer getLatestPlanId(String wxId);
}
\ No newline at end of file
package com.pcloud.book.custom.vo;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Data
public class AddCustomPlan4UserVO {
@NotNull
private String wxId;
@NotNull
private Integer planId;
}
package com.pcloud.book.custom.vo;
import lombok.Data;
@Data
public class AddSuggestionListVO {
private Integer moduleId;
private Integer suggestionLevel;
private String suggestion;
}
package com.pcloud.book.custom.vo;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
public class AddSuggestionVO {
@NotNull
private String wxId;
@NotNull
private Integer planId;
private String robotWxId;
private List<AddSuggestionListVO> suggestionList;
}
......@@ -42,4 +42,6 @@ public class CustomPlanModuleVO {
private String linkUrl;
private List<CustomPlanModuleVO> customPlanModuleVOList;
private Integer openFeedback;
}
\ No newline at end of file
package com.pcloud.book.custom.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class ModuleSuggestionVO implements Serializable {
private Integer moduleId;
private Integer openFeedback;
private Integer moduleType;
private Integer suggestionLevel;
private String suggestion;
}
package com.pcloud.book.custom.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class SuggestionListVO implements Serializable {
private Integer planId;
private Integer batchId;
private String wxId;
private String nickName;
private Integer sex;
private String headUrl;
private Integer goodCount;
private Integer badCount;
private Integer defaultCount;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
}
......@@ -59,7 +59,7 @@ public interface PersonalStageBiz {
void dealDelayFusingFinish(DelayQueueDTO dto);
PersonalStageProgressDTO getPersonalProgress(String wxUserId, Long personalStageUserId);
PersonalStageProgressDTO getPersonalProgress(String wxUserId, Long personalStageUserId, Long progressId);
/**
* 增加进度值
......
......@@ -9,7 +9,6 @@ import com.pcloud.book.personalstage.vo.request.UpdateStageJumpRequestVO;
import com.pcloud.common.core.mq.DelayQueueDTO;
import com.pcloud.common.page.PageBeanNew;
import java.util.List;
import java.util.Map;
public interface PersonalStageJumpBiz {
......@@ -65,7 +64,7 @@ public interface PersonalStageJumpBiz {
/**
* 进度单发送时添加未点链接回复延迟
*/
public void addProgressDelay(String userWxId, String robotWxId, String ip);
public void addProgressDelay(String userWxId, String robotWxId, String ip, Integer personalStageProgress1);
/**
* 添加点击记录
......
package com.pcloud.book.personalstage.biz;
import com.pcloud.book.personalstage.dto.PersonalStageProgressDTO;
import com.pcloud.book.personalstage.entity.PersonalStageProgressMessage;
import com.pcloud.common.page.PageBeanNew;
import java.util.List;
......@@ -23,7 +24,7 @@ public interface PersonalStageProgressMessageBiz {
/**
* 分页查询
*/
List<PersonalStageProgressMessage> getProgressMessageList();
List<PersonalStageProgressMessage> getProgressMessageList(Integer progressId);
/**
* 新增数据
......@@ -41,4 +42,9 @@ public interface PersonalStageProgressMessageBiz {
*/
void deleteById(Long id);
/**
* 获取进度单列表
* @return
*/
List<PersonalStageProgressDTO> getProgressList();
}
\ No newline at end of file
package com.pcloud.book.personalstage.biz.impl;
import com.google.common.collect.Lists;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.consumer.content.ResourceConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.custom.mapper.CustomPlanModuleSuggestionMapper;
import com.pcloud.book.keywords.enums.ReplyTypeEnum;
import com.pcloud.book.mq.delay.DelayMessageSender;
import com.pcloud.book.pcloudkeyword.dao.PcloudRobotClassifyDao;
......@@ -15,7 +15,15 @@ import com.pcloud.book.personalstage.biz.PersonalStageBiz;
import com.pcloud.book.personalstage.biz.PersonalStageJumpBiz;
import com.pcloud.book.personalstage.check.PersonalStageCheck;
import com.pcloud.book.personalstage.constant.PersonalStageConstant;
import com.pcloud.book.personalstage.dao.*;
import com.pcloud.book.personalstage.dao.PersonalStageDao;
import com.pcloud.book.personalstage.dao.PersonalStageJumpDao;
import com.pcloud.book.personalstage.dao.PersonalStageJumpKeywordDao;
import com.pcloud.book.personalstage.dao.PersonalStageJumpLinkupDao;
import com.pcloud.book.personalstage.dao.PersonalStageProgressMessageDao;
import com.pcloud.book.personalstage.dao.PersonalStageReplyDao;
import com.pcloud.book.personalstage.dao.PersonalStageReplyItemDao;
import com.pcloud.book.personalstage.dao.PersonalStageUserDao;
import com.pcloud.book.personalstage.dao.PersonalStageWakeupDao;
import com.pcloud.book.personalstage.dto.FusingFinishDelayDTO;
import com.pcloud.book.personalstage.dto.PersonalStageDTO;
import com.pcloud.book.personalstage.dto.PersonalStageJumpKeywordDto;
......@@ -35,6 +43,9 @@ import com.pcloud.book.personalstage.utils.CacheUtils;
import com.pcloud.book.personalstage.vo.request.AddScoreRequestVO;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.core.mq.DelayQueueDTO;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBean;
import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.DateUtils;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
......@@ -54,9 +65,6 @@ import org.apache.commons.collections.MapUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBean;
import com.pcloud.common.page.PageParam;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
......@@ -64,9 +72,8 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.stream.Collectors;
......@@ -108,6 +115,8 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
private PersonalStageJumpLinkupDao personalStageJumpLinkupDao;
@Autowired
private ResourceConsr resourceConsr;
@Autowired
private CustomPlanModuleSuggestionMapper customPlanModuleSuggestionMapper;
@Value("${wechat.group.link.prefix}")
private String wechatLinkPrefix;
......@@ -698,19 +707,45 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
@ParamLog("尝试插入单号")
private void tryInsertNumber(Long personalStageUserId) {
PersonalStageUser personalStageUser = personalStageUserDao.getById(personalStageUserId);
if (StringUtil.isEmpty(personalStageUser.getRequireNumber())){
String requireNumber = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss").concat(String.valueOf((int)((Math.random()*9+1)*100000)));
personalStageUserDao.updateRequireNumber(personalStageUserId, requireNumber);
}
}
@Override
@ParamLog("替换进度链接")
public String replaceProjectProgressUrl(String content, String robotId, String userWxId, Long personalStageUserId, String ip) {
if(content.indexOf(PersonalStageConstant.PERSONAL_STAGE_PROJECT_PROGRESS_TEMPLATE) > -1){
if(content.indexOf(PersonalStageConstant.PERSONAL_STAGE_PROJECT_PROGRESS_TEMPLATE_1) > -1){
tryInsertNumber(personalStageUserId);
String longUrl = wechatLinkPrefix.concat(PersonalStageConstant.PERSONAL_STAGE_PROJECT_PROGRESS).concat("?wxUserId=" + userWxId +
"&robotId=" + robotId + "&personalStageUserId=" + personalStageUserId + "&progressId=" + PersonalStageConstant.PERSONAL_STAGE_PROGRESS_1);
content = content.replace(PersonalStageConstant.PERSONAL_STAGE_PROJECT_PROGRESS_TEMPLATE_1, UrlUtils.getShortUrl4Own(longUrl));
//添加进度单回复延迟队列
personalStageJumpBiz.addProgressDelay(userWxId, robotId, ip,PersonalStageConstant.PERSONAL_STAGE_PROGRESS_1);
}else if (content.indexOf(PersonalStageConstant.PERSONAL_STAGE_PROJECT_PROGRESS_TEMPLATE_2) > -1){
tryInsertNumber(personalStageUserId);
String longUrl = wechatLinkPrefix.concat(PersonalStageConstant.PERSONAL_STAGE_PROJECT_PROGRESS).concat("?wxUserId=" + userWxId + "&robotId=" + robotId + "&personalStageUserId=" + personalStageUserId);
content = content.replace(PersonalStageConstant.PERSONAL_STAGE_PROJECT_PROGRESS_TEMPLATE, UrlUtils.getShortUrl4Own(longUrl));
String longUrl = wechatLinkPrefix.concat(PersonalStageConstant.PERSONAL_STAGE_PROJECT_PROGRESS).concat("?wxUserId=" + userWxId +
"&robotId=" + robotId + "&personalStageUserId=" + personalStageUserId + "&progressId=" + PersonalStageConstant.PERSONAL_STAGE_PROGRESS_2);
content = content.replace(PersonalStageConstant.PERSONAL_STAGE_PROJECT_PROGRESS_TEMPLATE_2, UrlUtils.getShortUrl4Own(longUrl));
//添加进度单回复延迟队列
personalStageJumpBiz.addProgressDelay(userWxId, robotId, ip);
personalStageJumpBiz.addProgressDelay(userWxId, robotId, ip, PersonalStageConstant.PERSONAL_STAGE_PROGRESS_2);
}else if (content.indexOf(PersonalStageConstant.PERSONAL_STAGE_PROJECT_PROGRESS_TEMPLATE_3) > -1){
tryInsertNumber(personalStageUserId);
String longUrl = wechatLinkPrefix.concat(PersonalStageConstant.PERSONAL_STAGE_PROJECT_PROGRESS).concat("?wxUserId=" + userWxId +
"&robotId=" + robotId + "&personalStageUserId=" + personalStageUserId + "&progressId=" +PersonalStageConstant.PERSONAL_STAGE_PROGRESS_3);
content = content.replace(PersonalStageConstant.PERSONAL_STAGE_PROJECT_PROGRESS_TEMPLATE_3, UrlUtils.getShortUrl4Own(longUrl));
//添加进度单回复延迟队列
personalStageJumpBiz.addProgressDelay(userWxId, robotId, ip, PersonalStageConstant.PERSONAL_STAGE_PROGRESS_3);
}
if (content.indexOf(PersonalStageConstant.CUSTOM_PLAN) > -1) {
String url = wechatLinkPrefix + "/personalCenter/madeProject?";
Integer planId = customPlanModuleSuggestionMapper.getLatestPlanId(userWxId);
if (null != planId) {
String longUrl = url + "planId=" + planId + "&wxId=" + userWxId + "&robotWxId=" + robotId;
content = content.replace(PersonalStageConstant.CUSTOM_PLAN, UrlUtils.getShortUrl4Own(longUrl));
}
}
content = replaceUserSendContent(content, robotId, userWxId);
content = replaceReadingStyle(content, robotId, userWxId);
......@@ -926,7 +961,7 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
}
@Override
public PersonalStageProgressDTO getPersonalProgress(String wxUserId, Long personalStageUserId) {
public PersonalStageProgressDTO getPersonalProgress(String wxUserId, Long personalStageUserId, Long progressId) {
PersonalStageProgressDTO personalStageProgressDTO = new PersonalStageProgressDTO();
PersonalStageUser personalStageUser = personalStageUserDao.getById(personalStageUserId);
if(personalStageUser == null){
......@@ -940,8 +975,9 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
personalStageProgressDTO.setSex(groupUserDTO.getSex());
personalStageProgressDTO.setRequireNumber(personalStageUser.getRequireNumber());
personalStageProgressDTO.setScore(personalStageUser.getScore());
List<PersonalStageProgressMessage> personalStageProgressMessages = personalStageProgressMessageDao.selectAllProgressMessage();
Integer totalProgress = personalStageProgressMessageDao.countProgressMessage();
List<PersonalStageProgressMessage> personalStageProgressMessages =
personalStageProgressMessageDao.getPersonalProgress(startTime,progressId);
Integer totalProgress = personalStageProgressMessageDao.countProgressMessage(progressId);
personalStageProgressDTO.setTotalProgress(totalProgress == null ? 0 : totalProgress);
if (!ListUtils.isEmpty(personalStageProgressMessages)){
List<PersonalStageProgressMessage> newList = this.setProgressTime(personalStageProgressMessages,startTime);
......
......@@ -826,8 +826,8 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
@Override
@ParamLog("添加进度单延时")
public void addProgressDelay(String userWxId, String robotWxId, String ip){
PersonalStageProgressMessage progressMessage = personalStageProgressMessageDao.getWaitClickProgress();
public void addProgressDelay(String userWxId, String robotWxId, String ip, Integer progressId){
PersonalStageProgressMessage progressMessage = personalStageProgressMessageDao.getWaitClickProgress(progressId);
if (null==progressMessage || null == progressMessage.getMinutes()){
return;
}
......@@ -842,6 +842,7 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
progressDelayDTO.setRobotId(robotWxId);
progressDelayDTO.setWxId(userWxId);
progressDelayDTO.setPersonalStageId(personalStageId);
progressDelayDTO.setProgressId(progressId);
DelayQueueDTO delayQueueDTONew = DelayQueueDTO.builder().key(userWxId).type(PersonalStageConstant.PERSONALSTAGE_DELAY_PROGRESS).msg(progressDelayDTO).timeout(time).build();
delayMessageSender.send(delayQueueDTONew);
String key = "BOOK:LINK_PROGRESS:"+ userWxId + "-" +robotWxId;
......@@ -856,7 +857,7 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
String userWxId = linkClickRecordDTO.getWxId();
String robotId = linkClickRecordDTO.getRobotId();
if (linkType == 1){
String key = "BOOK:LINK_PROGRESS:"+ userWxId + "-" +robotId;
String key = "BOOK:LINK_PROGRESS:"+ userWxId + "-" +robotId +"-"+linkClickRecordDTO.getProgressId();
JedisClusterUtils.setJson(key, userWxId, 5*3600);
}else if (linkType == 2){
String key = "BOOK:LINK_PAPER:"+ userWxId + "-" +robotId+"-"+linkClickRecordDTO.getPaperId();
......@@ -867,17 +868,18 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
@Override
@ParamLog("进度单延迟处理")
public void delayProgress(DelayQueueDTO dto) {
PersonalStageProgressMessage progressMessage = personalStageProgressMessageDao.getWaitClickProgress();
ProgressDelayDTO progressDelayDTO=(ProgressDelayDTO) dto.getMsg();
Integer progressId = progressDelayDTO.getProgressId();
PersonalStageProgressMessage progressMessage = personalStageProgressMessageDao.getWaitClickProgress(progressId);
if (null==progressMessage || StringUtil.isEmpty(progressMessage.getContent())){
return;
}
String userWxId=dto.getKey();
ProgressDelayDTO progressDelayDTO=(ProgressDelayDTO) dto.getMsg();
String robotId = progressDelayDTO.getRobotId();
Long personalStageId = progressDelayDTO.getPersonalStageId();
String ip = progressDelayDTO.getIp();
//是否点击过进度单链接
String key = "BOOK:LINK_PROGRESS:"+ userWxId + "-" +robotId;
String key = "BOOK:LINK_PROGRESS:"+ userWxId + "-" +robotId + "-"+progressId;
String value = JedisClusterUtils.getJson(key, String.class);
if (!StringUtil.isEmpty(value)){
log.info("用户已点击进度单链接");
......
package com.pcloud.book.personalstage.biz.impl;
import com.google.common.collect.Lists;
import com.pcloud.book.personalstage.dto.PersonalStageProgressDTO;
import com.pcloud.book.personalstage.entity.PersonalStageProgressMessage;
import com.pcloud.book.personalstage.dao.PersonalStageProgressMessageDao;
import com.pcloud.book.personalstage.biz.PersonalStageProgressMessageBiz;
......@@ -41,8 +43,8 @@ public class PersonalStageProgressMessageBizImpl implements PersonalStageProgres
@Override
@ParamLog("查询多条数据")
public List<PersonalStageProgressMessage> getProgressMessageList() {
List<PersonalStageProgressMessage> progressMessageList = personalStageProgressMessageDao.getProgressMessageList();
public List<PersonalStageProgressMessage> getProgressMessageList(Integer progressId) {
List<PersonalStageProgressMessage> progressMessageList = personalStageProgressMessageDao.getProgressMessageList(progressId);
if (ListUtils.isEmpty(progressMessageList)){
return Lists.newArrayList();
}
......@@ -64,9 +66,9 @@ public class PersonalStageProgressMessageBizImpl implements PersonalStageProgres
if(personalStageProgressMessage.stream().filter(x-> StringUtil.isEmpty(x.getContent())).count() > 0){
throw BizException.PARAM_IS_NULL;
}
Integer progressId = personalStageProgressMessage.get(0).getProgressId();
// 删除所有旧数据
personalStageProgressMessageDao.deleteAll();
personalStageProgressMessageDao.deleteByProgressId(progressId);
personalStageProgressMessage.stream().forEach(x->{
if(x.getType() == null || x.getType() == 0){
x.setType(1);
......@@ -81,4 +83,9 @@ public class PersonalStageProgressMessageBizImpl implements PersonalStageProgres
public void deleteById(Long id) {
personalStageProgressMessageDao.deleteById(id);
}
@Override
public List<PersonalStageProgressDTO> getProgressList() {
return personalStageProgressMessageDao.getProgressList();
}
}
\ No newline at end of file
......@@ -75,6 +75,7 @@ public class PersonalStageCheck {
@ParamLog("校验回复")
private Long checkReplies(List<PersonalStageReply> list) {
Long paperId = null;
Long progressId = null;
for (PersonalStageReply reply:list){
if (reply==null){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"回复不能为空!");
......@@ -91,6 +92,15 @@ public class PersonalStageCheck {
paperId = reply.getPaperId();
}
}
if (null != reply.getProgressId()){
if (null != progressId){
if (!reply.getProgressId().equals(progressId)){
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "非关键词回复存在不一样的进度单");
}
}else{
progressId = reply.getProgressId();
}
}
checkReplayItems(reply.getPersonalStageReplyItems());
}
return paperId;
......
......@@ -12,6 +12,12 @@ public class PersonalStageConstant {
public static final String PERSONALSTAGE_DELAY_LINKUP="PERSONALSTAGE_DELAY_LINKUP";
// 进度模板字符串
public static final String PERSONAL_STAGE_PROJECT_PROGRESS_TEMPLATE = "${PROGRESS_URL}";
public static final String PERSONAL_STAGE_PROJECT_PROGRESS_TEMPLATE_1 = "${PROGRESS_URL_1}";
public static final String PERSONAL_STAGE_PROJECT_PROGRESS_TEMPLATE_2 = "${PROGRESS_URL_2}";
public static final String PERSONAL_STAGE_PROJECT_PROGRESS_TEMPLATE_3 = "${PROGRESS_URL_3}";
public static final Integer PERSONAL_STAGE_PROGRESS_1 = 1;
public static final Integer PERSONAL_STAGE_PROGRESS_2 = 2;
public static final Integer PERSONAL_STAGE_PROGRESS_3 = 3;
// 项目进度页面路由
public static final String PERSONAL_STAGE_PROJECT_PROGRESS = "/personalCenter/projectProgress";
......@@ -25,5 +31,9 @@ public class PersonalStageConstant {
* 需求定制单延迟
*/
public static final String PERSONALSTAGE_DELAY_PAPER="PERSONALSTAGE_DELAY_PAPER";
//定制方案占位符
public static final String CUSTOM_PLAN = "${CUSTOM_PLAN}";
}
package com.pcloud.book.personalstage.dao;
import com.pcloud.book.personalstage.dto.PersonalStageProgressDTO;
import com.pcloud.book.personalstage.entity.PersonalStageProgressMessage;
import com.pcloud.common.core.dao.BaseDao;
......@@ -14,19 +15,27 @@ import java.util.List;
*/
public interface PersonalStageProgressMessageDao extends BaseDao<PersonalStageProgressMessage> {
List<PersonalStageProgressMessage> getPersonalProgress(Date startTime);
List<PersonalStageProgressMessage> getPersonalProgress(Date startTime, Long progressId);
List<PersonalStageProgressMessage> selectAllProgressMessage();
List<PersonalStageProgressMessage> getProgressMessageList();
List<PersonalStageProgressMessage> getProgressMessageList(Integer progressId);
void deleteAll();
/**
* 获取进度总数
* @return
* @param progressId
*/
Integer countProgressMessage();
Integer countProgressMessage(Long progressId);
PersonalStageProgressMessage getWaitClickProgress(Integer progressId);
List<PersonalStageProgressDTO> getProgressList();
PersonalStageProgressMessage getWaitClickProgress();
void deleteByProgressId(Integer progressId);
}
\ No newline at end of file
package com.pcloud.book.personalstage.dao.impl;
import com.pcloud.book.personalstage.dto.PersonalStageProgressDTO;
import com.pcloud.book.personalstage.entity.PersonalStageProgressMessage;
import com.pcloud.book.personalstage.dao.PersonalStageProgressMessageDao;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.*;
/**
* (PersonalStageProgressMessage)表数据库访问层
......@@ -19,8 +18,11 @@ import java.util.List;
public class PersonalStageProgressMessageDaoImpl extends BaseDaoImpl<PersonalStageProgressMessage> implements PersonalStageProgressMessageDao {
@Override
public List<PersonalStageProgressMessage> getPersonalProgress(Date startTime) {
return getSessionTemplate().selectList(getStatement("getPersonalProgress"),startTime);
public List<PersonalStageProgressMessage> getPersonalProgress(Date startTime, Long progressId) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("startTime",startTime);
paramMap.put("progressId",progressId);
return getSessionTemplate().selectList(getStatement("getPersonalProgress"),paramMap);
}
public List<PersonalStageProgressMessage> selectAllProgressMessage(){
......@@ -28,8 +30,8 @@ public class PersonalStageProgressMessageDaoImpl extends BaseDaoImpl<PersonalSta
}
@Override
public List<PersonalStageProgressMessage> getProgressMessageList() {
return getSessionTemplate().selectList(getStatement("getProgressMessageList"));
public List<PersonalStageProgressMessage> getProgressMessageList(Integer progressId) {
return getSessionTemplate().selectList(getStatement("getProgressMessageList"),progressId);
}
@Override
......@@ -38,12 +40,22 @@ public class PersonalStageProgressMessageDaoImpl extends BaseDaoImpl<PersonalSta
}
@Override
public Integer countProgressMessage() {
return super.sqlSessionTemplate.selectOne(getStatement("countProgressMessage"));
public Integer countProgressMessage(Long progressId) {
return super.sqlSessionTemplate.selectOne(getStatement("countProgressMessage"),progressId);
}
@Override
public PersonalStageProgressMessage getWaitClickProgress() {
return getSessionTemplate().selectOne(getStatement("getWaitClickProgress"));
public PersonalStageProgressMessage getWaitClickProgress(Integer progressId) {
return getSessionTemplate().selectOne(getStatement("getWaitClickProgress"),progressId);
}
@Override
public List<PersonalStageProgressDTO> getProgressList() {
return getSessionTemplate().selectList(getStatement("getProgressList"));
}
@Override
public void deleteByProgressId(Integer progressId) {
super.getSessionTemplate().delete(getStatement("deleteByProgressId"),progressId);
}
}
\ No newline at end of file
......@@ -17,4 +17,6 @@ public class LinkClickRecordDTO extends BaseDto {
private String wxId;
@ApiModelProperty("需求定制单id")
private Long paperId;
@ApiModelProperty("进度单id")
private Integer progressId;
}
......@@ -48,4 +48,39 @@ public class PersonalStageProgressDTO {
* 进度总数
*/
private Integer totalProgress;
/**
* 进度单id
*/
private Integer progressId;
/**
* 进度单名称
*/
private String progressName;
/**
* 开始文案
*/
private String startText;
/**
* 开始进度内容id
*/
private Integer startMessageId;
/**
* 结束文案
*/
private String endText;
/**
* 结束进度内容id
*/
private Integer endMessageId;
/**
* 特殊符号
*/
private String specialSymbol;
}
......@@ -18,5 +18,7 @@ public class ProgressDelayDTO implements Serializable {
private String wxId;
@ApiModelProperty("ip地址")
private String ip;
@ApiModelProperty("进度id")
private Integer progressId;
}
......@@ -18,6 +18,7 @@ public class PersonalStageProgressMessage extends BaseEntity {
private static final long serialVersionUID = 783203450632034209L;
private Integer progressId;
private String content;
private Integer minutes;
......
......@@ -35,4 +35,10 @@ public class PersonalStageReply extends BaseEntity {
@ApiModelProperty("回复项集合")
private List<PersonalStageReplyItem> personalStageReplyItems;
@ApiModelProperty("进度单id")
private Long progressId;
@ApiModelProperty("进度单id")
private String progressName;
}
\ No newline at end of file
......@@ -198,16 +198,18 @@ public class PersonalStageFacade {
@ApiOperation("获取进度")
@GetMapping("getPersonalProgress")
public ResponseDto<?> getPersonalProgress(@RequestParam("wxUserId") String wxUserId,@RequestParam("personalStageUserId") Long personalStageUserId) throws PermissionException, BizException{
PersonalStageProgressDTO personalStageProgressDTO = personalStageBiz.getPersonalProgress(wxUserId, personalStageUserId);
public ResponseDto<?> getPersonalProgress(@RequestParam("wxUserId") String wxUserId,
@RequestParam("personalStageUserId") Long personalStageUserId,
@RequestParam("progressId") Long progressId) throws PermissionException, BizException{
PersonalStageProgressDTO personalStageProgressDTO = personalStageBiz.getPersonalProgress(wxUserId, personalStageUserId,progressId);
return new ResponseDto<>(personalStageProgressDTO);
}
@ApiOperation("查询所有的进度消息")
@GetMapping("getProgressMessageList")
public ResponseDto<?> getProgressMessageList()
public ResponseDto<?> getProgressMessageList(@RequestParam("progressId") Integer progressId)
throws BizException, PermissionException {
return new ResponseDto<>(personalStageProgressMessageBiz.getProgressMessageList());
return new ResponseDto<>(personalStageProgressMessageBiz.getProgressMessageList(progressId));
}
@ApiOperation("保存进度消息")
......@@ -289,4 +291,13 @@ public class PersonalStageFacade {
personalStageJumpBiz.endServiceJumpNext(endServiceJumpNextDTO);
return new ResponseDto<>();
}
@ApiOperation("获取进度单列表")
@GetMapping("getProgressList")
public ResponseDto<?> getProgressList(@RequestHeader("token") @ApiParam("token信息") String token) throws PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
List<PersonalStageProgressDTO> personalStageProgressDTOS = personalStageProgressMessageBiz.getProgressList();
return new ResponseDto<>(personalStageProgressDTOS);
}
}
......@@ -17,12 +17,14 @@
<result column="preview_qrcode_url" jdbcType="VARCHAR" property="previewQrcodeUrl" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="suggestion_count" jdbcType="INTEGER" property="suggestionCount" />
<result column="confirm_feedback_reply" jdbcType="VARCHAR" property="confirmFeedbackReply" />
</resultMap>
<sql id="Base_Column_List">
id, plan_number, plan_name, create_user_name, description, open_feedback, paper_id,
paper_title, paper_desc, use_state, pdf_url, h5_url, preview_qrcode_url, create_time,
update_time
update_time, confirm_feedback_reply
</sql>
<insert id="insert" parameterType="CustomPlan" useGeneratedKeys="true" keyProperty="id">
......@@ -30,12 +32,12 @@
description, open_feedback, paper_id,
paper_title, paper_desc, use_state,
pdf_url, h5_url, preview_qrcode_url,
create_time, update_time)
create_time, update_time, confirm_feedback_reply)
values (#{planNumber,jdbcType=VARCHAR}, #{planName,jdbcType=VARCHAR}, #{createUserName,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{openFeedback,jdbcType=INTEGER}, #{paperId,jdbcType=INTEGER},
#{paperTitle,jdbcType=VARCHAR}, #{paperDesc,jdbcType=VARCHAR}, #{useState,jdbcType=INTEGER},
#{pdfUrl,jdbcType=VARCHAR}, #{h5Url,jdbcType=VARCHAR}, #{previewQrcodeUrl,jdbcType=VARCHAR},
NOW(), NOW())
NOW(), NOW(), #{confirmFeedbackReply})
</insert>
<update id="update" parameterType="CustomPlan">
......@@ -77,7 +79,7 @@
<if test="previewQrcodeUrl != null">
preview_qrcode_url = #{previewQrcodeUrl,jdbcType=VARCHAR},
</if>
update_time = NOW(),
update_time = NOW(),confirm_feedback_reply = #{confirmFeedbackReply}
</set>
where id = #{id,jdbcType=INTEGER}
</update>
......@@ -111,8 +113,10 @@
<select id="listCustomPlanByPage" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from custom_plan
a.id, plan_number, plan_name, create_user_name, description, open_feedback,
use_state, pdf_url, h5_url, preview_qrcode_url, a.create_time, COUNT(DISTINCT b.batch_id) suggestion_count
from custom_plan a left join custom_plan_module_suggestion b
on a.id = b.plan_id
where 1= 1
<if test="content != null">
and (plan_number like concat('%', #{content}, '%')
......@@ -122,6 +126,7 @@
<if test="useState != null">
and use_state = #{useState}
</if>
GROUP BY a.id
ORDER BY update_time DESC
LIMIT #{pageNum}, #{numPerPage}
</select>
......
......@@ -18,11 +18,12 @@
<result column="merchant_name" jdbcType="VARCHAR" property="merchantName" />
<result column="product_unique_number" jdbcType="VARCHAR" property="productUniqueNumber" />
<result column="link_url" jdbcType="VARCHAR" property="linkUrl" />
<result column="open_feedback" jdbcType="INTEGER" property="openFeedback" />
</resultMap>
<sql id="Base_Column_List">
id, plan_id, parent_id, module_type, pic_url, type_name, title, content, skill_id, skill_cover,
app_id, agent_name, product_id, merchant_name, product_unique_number, link_url, create_time, update_time
app_id, agent_name, product_id, merchant_name, product_unique_number, link_url, create_time, update_time, open_feedback
</sql>
<insert id="insert" parameterType="CustomPlanModule" useGeneratedKeys="true" keyProperty="id">
......@@ -30,12 +31,12 @@
type_name, title, content,
skill_id, skill_cover, app_id, agent_name,
product_id, merchant_name, product_unique_number, link_url, create_time,
update_time)
update_time, open_feedback)
values (#{planId,jdbcType=INTEGER}, #{parentId,jdbcType=INTEGER}, #{moduleType,jdbcType=INTEGER}, #{picUrl,jdbcType=VARCHAR},
#{typeName,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR},
#{skillId,jdbcType=INTEGER}, #{skillCover,jdbcType=VARCHAR}, #{appId,jdbcType=BIGINT}, #{agentName,jdbcType=VARCHAR},
#{productId,jdbcType=BIGINT}, #{merchantName,jdbcType=VARCHAR}, #{productUniqueNumber,jdbcType=VARCHAR}, #{linkUrl,jdbcType=VARCHAR},
NOW(), NOW())
NOW(), NOW(), #{openFeedback})
</insert>
<update id="update" parameterType="CustomPlanModule">
......
<?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.custom.mapper.CustomPlanModuleSuggestionMapper" >
<resultMap id="BaseResultMap" type="com.pcloud.book.custom.entity.CustomPlanModuleSuggestion" >
<id column="id" jdbcType="INTEGER" property="id" />
<result column="batch_id" jdbcType="INTEGER" property="batchId" />
<result column="wx_id" jdbcType="VARCHAR" property="wx_id" />
<result column="plan_id" jdbcType="INTEGER" property="planId" />
<result column="module_id" jdbcType="INTEGER" property="moduleId" />
<result column="suggestion_level" jdbcType="INTEGER" property="suggestionLevel" />
<result column="suggestion" jdbcType="VARCHAR" property="suggestion" />
<result column="create_time" jdbcType="TIMESTAMP" property="planId" />
</resultMap>
<select id="getSuggestionCount" resultType="int">
SELECT
COUNT(DISTINCT batch_id)
FROM
custom_plan_module_suggestion a
LEFT JOIN custom_plan b ON a.plan_id = b.id
WHERE
plan_id = #{planId}
<if test="startTime != null and endTime != null">
and a.create_time between #{startTime} and #{endTime}
</if>
<if test="wxIdList != null">
and wx_id in
<foreach collection="wxIdList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</if>
</select>
<select id="listSuggestion4Plan" resultType="com.pcloud.book.custom.vo.SuggestionListVO">
SELECT
batch_id batchId,
wx_id wxId,
SUM(suggestion_level = 0) defaultCount,
SUM(suggestion_level = 1) goodCount,
SUM(suggestion_level = 2) badCount,
a.create_time createTime,
a.plan_id planId
FROM
custom_plan_module_suggestion a
LEFT JOIN custom_plan b ON a.plan_id = b.id
WHERE
plan_id = #{planId}
<if test="startTime != null and endTime != null">
and a.create_time between #{startTime} and #{endTime}
</if>
<if test="wxIdList != null">
and wx_id in
<foreach collection="wxIdList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</if>
GROUP BY batch_id
order by batchId desc
limit #{pageNum}, #{numPerPage}
</select>
<select id="getSuggestionInfo" resultType="com.pcloud.book.custom.vo.ModuleSuggestionVO">
SELECT
e.id moduleId,
e.module_type moduleType,
e.open_feedback openFeedback,
s.suggestion_level suggestionLevel,
s.suggestion
FROM
custom_plan_module e
LEFT JOIN (
SELECT
a.id,
suggestion_level,
suggestion
FROM
custom_plan_module a
LEFT JOIN custom_plan_module_suggestion b ON a.id = b.module_id
WHERE
batch_id = #{batchId}
) s ON e.id = s.id
WHERE
e.plan_id = #{planId}
</select>
<select id="getMaxBatchId" resultType="Integer">
select ifnull(max(batch_id), 0) from custom_plan_module_suggestion
</select>
<insert id="batchInsert" parameterType="com.pcloud.book.custom.entity.CustomPlanModuleSuggestion">
insert into custom_plan_module_suggestion(batch_id, wx_id, plan_id, module_Id, suggestion_Level, suggestion, create_time)
values
<foreach collection="list" separator="," item="item">
(#{item.batchId}, #{item.wxId}, #{item.planId}, #{item.moduleId}, #{item.suggestionLevel}, #{item.suggestion}, now())
</foreach>
</insert>
<insert id="addCustomPlan4User" parameterType="com.pcloud.book.custom.vo.AddCustomPlan4UserVO">
insert into custom_plan_user(wx_id, plan_id, create_time)
values (#{wxId}, #{planId}, now())
</insert>
<select id="getLatestPlanId" resultType="Integer">
select plan_id from custom_plan_user
where wx_id =#{wxId}
order by create_time desc
limit 1
</select>
</mapper>
\ No newline at end of file
......@@ -4,6 +4,7 @@
<resultMap id="BaseResultMap" type="com.pcloud.book.personalstage.entity.PersonalStageProgressMessage">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="progress_id" property="progressId" jdbcType="INTEGER"/>
<result column="content" property="content" jdbcType="VARCHAR"/>
<result column="minutes" property="minutes" jdbcType="INTEGER"/>
<result column="type" property="type" jdbcType="INTEGER"/>
......@@ -11,8 +12,13 @@
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
</resultMap>
<resultMap id="ProgressDTOMap" type="com.pcloud.book.personalstage.dto.PersonalStageProgressDTO">
<association property="startText" column="startMessageId" javaType="string" select="getContentById"/>
<association property="endText" column="endMessageId" javaType="string" select="getContentById"/>
</resultMap>
<sql id="Base_Column_List">
id, content, minutes, type, create_time, update_time
id, progress_id,content, minutes, create_time, update_time,type
</sql>
<select id="getById" resultMap="BaseResultMap">
......@@ -26,17 +32,20 @@
SELECT
<include refid="Base_Column_List"/>
FROM personal_stage_progress_message
where progress_id=#{progressId}
ORDER BY type
</select>
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
INSERT INTO personal_stage_progress_message(
progress_id,
content,
minutes,
type,
create_time,
update_time
) VALUES (
#{progressId, jdbcType=INTEGER},
#{content, jdbcType=VARCHAR},
#{minutes, jdbcType=INTEGER},
#{type, jdbcType=INTEGER},
......@@ -47,6 +56,7 @@
<insert id="batchInsert" keyProperty="id" useGeneratedKeys="true">
INSERT INTO personal_stage_progress_message (
progress_id,
content,
minutes,
type,
......@@ -55,6 +65,7 @@
) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.progressId, jdbcType=INTEGER},
#{item.content, jdbcType=VARCHAR},
#{item.minutes, jdbcType=INTEGER},
#{item.type, jdbcType=INTEGER},
......@@ -68,6 +79,9 @@
<update id="update">
UPDATE personal_stage_progress_message
<set>
<if test="progressId != null">
progress_id = #{progressId},
</if>
<if test="content != null and content != ''">
content = #{content},
</if>
......@@ -96,26 +110,28 @@
DELETE FROM personal_stage_progress_message
</delete>
<select id="getPersonalProgress" parameterType="date" resultType="com.pcloud.book.personalstage.entity.PersonalStageProgressMessage">
<select id="getPersonalProgress" parameterType="map" resultType="com.pcloud.book.personalstage.entity.PersonalStageProgressMessage">
select
id,
progress_id,
content,
minutes,
type
from
personal_stage_progress_message
where
TIMESTAMPDIFF(MINUTE,#{startTime}, now()) &gt;= minutes
and type = 1
type = 1
and progress_id = #{progressId}
order by id asc
</select>
<select id="getWaitClickProgress" resultMap="BaseResultMap">
<select id="getWaitClickProgress" resultMap="BaseResultMap" parameterType="integer">
select
<include refid="Base_Column_List"/>
from
personal_stage_progress_message
where type = 2
and progress_id = #{progressId}
limit 1
</select>
......@@ -129,7 +145,53 @@
order by id asc
</select>
<select id="countProgressMessage" resultType="int">
<select id="countProgressMessage" resultType="int" parameterType="long">
select count(id) from personal_stage_progress_message
where
type = 1
and progress_id = #{progressId}
</select>
<select id="getProgressList" resultMap="ProgressDTOMap">
select
p.id progressId,
p.NAME progressName,
min(pm.id) startMessageId,
max(pm.id) endMessageId,
p.special_symbol specialSymbol
from
personal_stage_progress p
left join personal_stage_progress_message pm
on p.id = pm.progress_id
where type = 1
GROUP BY p.id
</select>
<select id="getContentById" resultType="string">
select
content
from
personal_stage_progress_message
where
id = #{_parameter}
</select>
<select id="getNameById" resultType="string">
select
name
from
personal_stage_progress
where
id = #{_parameter}
</select>
<delete id="deleteByProgressId" parameterType="integer">
delete
from
personal_stage_progress_message
where
progress_id = #{progressId}
</delete>
</mapper>
\ No newline at end of file
......@@ -11,10 +11,16 @@
<result property="paperId" column="paper_id" jdbcType="BIGINT"/>
<result property="paperTitle" column="paper_title" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="progressId" column="progress_id" jdbcType="TIMESTAMP"/>
</resultMap>
<resultMap id="PersonalStageReplyMap" extends="BaseResultMap" type="com.pcloud.book.personalstage.entity.PersonalStageReply">
<association property="progressName" column="progress_id" javaType="string"
select="com.pcloud.book.personalstage.dao.impl.PersonalStageProgressMessageDaoImpl.getNameById"/>
</resultMap>
<sql id="Base_Column_List">
id, name, personal_stage_id, relevance_id, relevance_type, paper_id, paper_title, create_time
id, name, personal_stage_id, relevance_id, relevance_type, paper_id, paper_title, create_time,progress_id
</sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
......@@ -59,7 +65,8 @@
relevance_type,
paper_id,
paper_title,
create_time
create_time,
progress_id
) values
<foreach collection="list" item="item" index="index" separator=",">
(
......@@ -69,7 +76,8 @@
#{item.relevanceType,jdbcType=INTEGER},
#{item.paperId},
#{item.paperTitle},
NOW()
NOW(),
#{item.progressId}
)
</foreach>
</insert>
......@@ -87,7 +95,7 @@
</foreach>
</delete>
<select id="getListByPersonalStageId" parameterType="long" resultMap="BaseResultMap">
<select id="getListByPersonalStageId" parameterType="long" resultMap="PersonalStageReplyMap">
select <include refid="Base_Column_List"/>
from personal_stage_reply
where personal_stage_id=#{personalStageId}
......
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