Commit c50cb1a1 by tc
parents 06e23bd2 35c48465
package com.pcloud.book.custom.biz; package com.pcloud.book.custom.biz;
import com.pcloud.book.custom.entity.CustomPlan; 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.CustomPlanModuleVO;
import com.pcloud.book.custom.vo.CustomPlanPaperVO; import com.pcloud.book.custom.vo.CustomPlanPaperVO;
import com.pcloud.book.custom.vo.EditCustomPlanModuleVO; 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 com.pcloud.common.page.PageBeanNew;
import java.util.List; import java.util.List;
...@@ -30,4 +34,12 @@ public interface CustomPlanBiz { ...@@ -30,4 +34,12 @@ public interface CustomPlanBiz {
PageBeanNew<CustomPlanPaperVO> listPlanPaperByPage(Integer currentPage, Integer numPerPage, Integer paperState, String content); PageBeanNew<CustomPlanPaperVO> listPlanPaperByPage(Integer currentPage, Integer numPerPage, Integer paperState, String content);
Map<String, Object> getShortLinkUrl(Long appId, Long productId, String linkUrl); 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; ...@@ -7,29 +7,43 @@ import com.pcloud.book.consumer.app.AppConsr;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr; import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.feedback.FeedbackConsr; import com.pcloud.book.consumer.feedback.FeedbackConsr;
import com.pcloud.book.consumer.shareimage.ShareImageConsr; 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.biz.CustomPlanBiz;
import com.pcloud.book.custom.entity.CustomPlan; import com.pcloud.book.custom.entity.CustomPlan;
import com.pcloud.book.custom.entity.CustomPlanModule; 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.PlanModuleTypeEnum;
import com.pcloud.book.custom.enums.PlanUseStateEnum; import com.pcloud.book.custom.enums.PlanUseStateEnum;
import com.pcloud.book.custom.mapper.CustomPlanMapper; import com.pcloud.book.custom.mapper.CustomPlanMapper;
import com.pcloud.book.custom.mapper.CustomPlanModuleMapper; 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.CustomPlanModuleVO;
import com.pcloud.book.custom.vo.CustomPlanPaperVO; import com.pcloud.book.custom.vo.CustomPlanPaperVO;
import com.pcloud.book.custom.vo.EditCustomPlanModuleVO; 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.custom.vo.ToPdfVO;
import com.pcloud.book.group.biz.WeixinQrcodeBiz;
import com.pcloud.book.group.tools.Kit; import com.pcloud.book.group.tools.Kit;
import com.pcloud.book.group.tools.SendWeixinRequestTools; import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.util.common.ThreadPoolUtils; import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.channelcenter.wechat.dto.AccountSettingDto; import com.pcloud.channelcenter.wechat.dto.AccountSettingDto;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.utils.BeanUtils; import com.pcloud.common.utils.BeanUtils;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.QrcodeUtils; import com.pcloud.common.utils.QrcodeUtils;
import com.pcloud.common.utils.UUIDUitl; import com.pcloud.common.utils.UUIDUitl;
import com.pcloud.common.utils.httpclient.UrlUtils; import com.pcloud.common.utils.httpclient.UrlUtils;
import com.pcloud.common.utils.string.StringUtil; import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.feedback.paper.dto.PaperDto; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -42,6 +56,7 @@ import java.util.ArrayList; ...@@ -42,6 +56,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
@Component @Component
public class CustomPlanBizImpl implements CustomPlanBiz { public class CustomPlanBizImpl implements CustomPlanBiz {
...@@ -62,6 +77,12 @@ public class CustomPlanBizImpl implements CustomPlanBiz { ...@@ -62,6 +77,12 @@ public class CustomPlanBizImpl implements CustomPlanBiz {
private AppConsr appConsr; private AppConsr appConsr;
@Autowired @Autowired
private QrcodeSceneConsr qrcodeSceneConsr; private QrcodeSceneConsr qrcodeSceneConsr;
@Autowired
private CustomPlanModuleSuggestionMapper customPlanModuleSuggestionMapper;
@Autowired
private WechatGroupConsr wechatGroupConsr;
@Autowired
private WeixinQrcodeBiz weixinQrcodeBiz;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -260,4 +281,83 @@ public class CustomPlanBizImpl implements CustomPlanBiz { ...@@ -260,4 +281,83 @@ public class CustomPlanBizImpl implements CustomPlanBiz {
} }
return resultMap; 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 { ...@@ -39,4 +39,8 @@ public class CustomPlan {
private Date createTime; private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime; private Date updateTime;
private Integer suggestionCount;
private String confirmFeedbackReply;
} }
\ No newline at end of file
...@@ -44,4 +44,6 @@ public class CustomPlanModule { ...@@ -44,4 +44,6 @@ public class CustomPlanModule {
private Date createTime; private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime; 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; ...@@ -4,17 +4,26 @@ import com.pcloud.book.custom.biz.CustomPlanBiz;
import com.pcloud.book.custom.biz.CustomPlanEmailBiz; import com.pcloud.book.custom.biz.CustomPlanEmailBiz;
import com.pcloud.book.custom.dto.CustomPlanEmailDto; import com.pcloud.book.custom.dto.CustomPlanEmailDto;
import com.pcloud.book.custom.entity.CustomPlan; 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.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.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.permission.PermissionException; import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.SessionUtil; import com.pcloud.common.utils.SessionUtil;
import com.pcloud.common.page.PageBeanNew;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; 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; import java.util.List;
...@@ -124,4 +133,34 @@ public class CustomPlanFacade { ...@@ -124,4 +133,34 @@ public class CustomPlanFacade {
return new ResponseDto<>(customPlanEmailBiz.getCustomPlanEmailByPlanId(customPlanId)); 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 { ...@@ -42,4 +42,6 @@ public class CustomPlanModuleVO {
private String linkUrl; private String linkUrl;
private List<CustomPlanModuleVO> customPlanModuleVOList; 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 { ...@@ -59,7 +59,7 @@ public interface PersonalStageBiz {
void dealDelayFusingFinish(DelayQueueDTO dto); 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; ...@@ -9,7 +9,6 @@ import com.pcloud.book.personalstage.vo.request.UpdateStageJumpRequestVO;
import com.pcloud.common.core.mq.DelayQueueDTO; import com.pcloud.common.core.mq.DelayQueueDTO;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import java.util.List;
import java.util.Map; import java.util.Map;
public interface PersonalStageJumpBiz { public interface PersonalStageJumpBiz {
...@@ -65,7 +64,7 @@ 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; package com.pcloud.book.personalstage.biz;
import com.pcloud.book.personalstage.dto.PersonalStageProgressDTO;
import com.pcloud.book.personalstage.entity.PersonalStageProgressMessage; import com.pcloud.book.personalstage.entity.PersonalStageProgressMessage;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import java.util.List; import java.util.List;
...@@ -23,7 +24,7 @@ public interface PersonalStageProgressMessageBiz { ...@@ -23,7 +24,7 @@ public interface PersonalStageProgressMessageBiz {
/** /**
* 分页查询 * 分页查询
*/ */
List<PersonalStageProgressMessage> getProgressMessageList(); List<PersonalStageProgressMessage> getProgressMessageList(Integer progressId);
/** /**
* 新增数据 * 新增数据
...@@ -41,4 +42,9 @@ public interface PersonalStageProgressMessageBiz { ...@@ -41,4 +42,9 @@ public interface PersonalStageProgressMessageBiz {
*/ */
void deleteById(Long id); void deleteById(Long id);
/**
* 获取进度单列表
* @return
*/
List<PersonalStageProgressDTO> getProgressList();
} }
\ No newline at end of file
package com.pcloud.book.personalstage.biz.impl; package com.pcloud.book.personalstage.biz.impl;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.consumer.content.ResourceConsr; import com.pcloud.book.consumer.content.ResourceConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr; 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.keywords.enums.ReplyTypeEnum;
import com.pcloud.book.mq.delay.DelayMessageSender; import com.pcloud.book.mq.delay.DelayMessageSender;
import com.pcloud.book.pcloudkeyword.dao.PcloudRobotClassifyDao; import com.pcloud.book.pcloudkeyword.dao.PcloudRobotClassifyDao;
...@@ -15,7 +15,15 @@ import com.pcloud.book.personalstage.biz.PersonalStageBiz; ...@@ -15,7 +15,15 @@ import com.pcloud.book.personalstage.biz.PersonalStageBiz;
import com.pcloud.book.personalstage.biz.PersonalStageJumpBiz; import com.pcloud.book.personalstage.biz.PersonalStageJumpBiz;
import com.pcloud.book.personalstage.check.PersonalStageCheck; import com.pcloud.book.personalstage.check.PersonalStageCheck;
import com.pcloud.book.personalstage.constant.PersonalStageConstant; 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.FusingFinishDelayDTO;
import com.pcloud.book.personalstage.dto.PersonalStageDTO; import com.pcloud.book.personalstage.dto.PersonalStageDTO;
import com.pcloud.book.personalstage.dto.PersonalStageJumpKeywordDto; import com.pcloud.book.personalstage.dto.PersonalStageJumpKeywordDto;
...@@ -35,6 +43,9 @@ import com.pcloud.book.personalstage.utils.CacheUtils; ...@@ -35,6 +43,9 @@ import com.pcloud.book.personalstage.utils.CacheUtils;
import com.pcloud.book.personalstage.vo.request.AddScoreRequestVO; import com.pcloud.book.personalstage.vo.request.AddScoreRequestVO;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.core.mq.DelayQueueDTO; 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.DateUtils;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.cache.redis.JedisClusterUtils; import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
...@@ -54,9 +65,6 @@ import org.apache.commons.collections.MapUtils; ...@@ -54,9 +65,6 @@ import org.apache.commons.collections.MapUtils;
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 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.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -64,9 +72,8 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -64,9 +72,8 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random; import java.util.Random;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -108,6 +115,8 @@ public class PersonalStageBizImpl implements PersonalStageBiz { ...@@ -108,6 +115,8 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
private PersonalStageJumpLinkupDao personalStageJumpLinkupDao; private PersonalStageJumpLinkupDao personalStageJumpLinkupDao;
@Autowired @Autowired
private ResourceConsr resourceConsr; private ResourceConsr resourceConsr;
@Autowired
private CustomPlanModuleSuggestionMapper customPlanModuleSuggestionMapper;
@Value("${wechat.group.link.prefix}") @Value("${wechat.group.link.prefix}")
private String wechatLinkPrefix; private String wechatLinkPrefix;
...@@ -698,19 +707,45 @@ public class PersonalStageBizImpl implements PersonalStageBiz { ...@@ -698,19 +707,45 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
@ParamLog("尝试插入单号") @ParamLog("尝试插入单号")
private void tryInsertNumber(Long personalStageUserId) { private void tryInsertNumber(Long personalStageUserId) {
String requireNumber = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss").concat(String.valueOf((int)((Math.random()*9+1)*100000))); PersonalStageUser personalStageUser = personalStageUserDao.getById(personalStageUserId);
personalStageUserDao.updateRequireNumber(personalStageUserId, requireNumber); 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 @Override
@ParamLog("替换进度链接") @ParamLog("替换进度链接")
public String replaceProjectProgressUrl(String content, String robotId, String userWxId, Long personalStageUserId, String ip) { 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 + "&progressId=" + PersonalStageConstant.PERSONAL_STAGE_PROGRESS_2);
content = content.replace(PersonalStageConstant.PERSONAL_STAGE_PROJECT_PROGRESS_TEMPLATE_2, UrlUtils.getShortUrl4Own(longUrl));
//添加进度单回复延迟队列
personalStageJumpBiz.addProgressDelay(userWxId, robotId, ip, PersonalStageConstant.PERSONAL_STAGE_PROGRESS_2);
}else if (content.indexOf(PersonalStageConstant.PERSONAL_STAGE_PROJECT_PROGRESS_TEMPLATE_3) > -1){
tryInsertNumber(personalStageUserId); tryInsertNumber(personalStageUserId);
String longUrl = wechatLinkPrefix.concat(PersonalStageConstant.PERSONAL_STAGE_PROJECT_PROGRESS).concat("?wxUserId=" + userWxId + "&robotId=" + robotId + "&personalStageUserId=" + personalStageUserId); String longUrl = wechatLinkPrefix.concat(PersonalStageConstant.PERSONAL_STAGE_PROJECT_PROGRESS).concat("?wxUserId=" + userWxId +
content = content.replace(PersonalStageConstant.PERSONAL_STAGE_PROJECT_PROGRESS_TEMPLATE, UrlUtils.getShortUrl4Own(longUrl)); "&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); 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 = replaceUserSendContent(content, robotId, userWxId);
content = replaceReadingStyle(content, robotId, userWxId); content = replaceReadingStyle(content, robotId, userWxId);
...@@ -926,7 +961,7 @@ public class PersonalStageBizImpl implements PersonalStageBiz { ...@@ -926,7 +961,7 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
} }
@Override @Override
public PersonalStageProgressDTO getPersonalProgress(String wxUserId, Long personalStageUserId) { public PersonalStageProgressDTO getPersonalProgress(String wxUserId, Long personalStageUserId, Long progressId) {
PersonalStageProgressDTO personalStageProgressDTO = new PersonalStageProgressDTO(); PersonalStageProgressDTO personalStageProgressDTO = new PersonalStageProgressDTO();
PersonalStageUser personalStageUser = personalStageUserDao.getById(personalStageUserId); PersonalStageUser personalStageUser = personalStageUserDao.getById(personalStageUserId);
if(personalStageUser == null){ if(personalStageUser == null){
...@@ -940,8 +975,9 @@ public class PersonalStageBizImpl implements PersonalStageBiz { ...@@ -940,8 +975,9 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
personalStageProgressDTO.setSex(groupUserDTO.getSex()); personalStageProgressDTO.setSex(groupUserDTO.getSex());
personalStageProgressDTO.setRequireNumber(personalStageUser.getRequireNumber()); personalStageProgressDTO.setRequireNumber(personalStageUser.getRequireNumber());
personalStageProgressDTO.setScore(personalStageUser.getScore()); personalStageProgressDTO.setScore(personalStageUser.getScore());
List<PersonalStageProgressMessage> personalStageProgressMessages = personalStageProgressMessageDao.selectAllProgressMessage(); List<PersonalStageProgressMessage> personalStageProgressMessages =
Integer totalProgress = personalStageProgressMessageDao.countProgressMessage(); personalStageProgressMessageDao.getPersonalProgress(startTime,progressId);
Integer totalProgress = personalStageProgressMessageDao.countProgressMessage(progressId);
personalStageProgressDTO.setTotalProgress(totalProgress == null ? 0 : totalProgress); personalStageProgressDTO.setTotalProgress(totalProgress == null ? 0 : totalProgress);
if (!ListUtils.isEmpty(personalStageProgressMessages)){ if (!ListUtils.isEmpty(personalStageProgressMessages)){
List<PersonalStageProgressMessage> newList = this.setProgressTime(personalStageProgressMessages,startTime); List<PersonalStageProgressMessage> newList = this.setProgressTime(personalStageProgressMessages,startTime);
......
...@@ -826,8 +826,8 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz { ...@@ -826,8 +826,8 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
@Override @Override
@ParamLog("添加进度单延时") @ParamLog("添加进度单延时")
public void addProgressDelay(String userWxId, String robotWxId, String ip){ public void addProgressDelay(String userWxId, String robotWxId, String ip, Integer progressId){
PersonalStageProgressMessage progressMessage = personalStageProgressMessageDao.getWaitClickProgress(); PersonalStageProgressMessage progressMessage = personalStageProgressMessageDao.getWaitClickProgress(progressId);
if (null==progressMessage || null == progressMessage.getMinutes()){ if (null==progressMessage || null == progressMessage.getMinutes()){
return; return;
} }
...@@ -842,6 +842,7 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz { ...@@ -842,6 +842,7 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
progressDelayDTO.setRobotId(robotWxId); progressDelayDTO.setRobotId(robotWxId);
progressDelayDTO.setWxId(userWxId); progressDelayDTO.setWxId(userWxId);
progressDelayDTO.setPersonalStageId(personalStageId); progressDelayDTO.setPersonalStageId(personalStageId);
progressDelayDTO.setProgressId(progressId);
DelayQueueDTO delayQueueDTONew = DelayQueueDTO.builder().key(userWxId).type(PersonalStageConstant.PERSONALSTAGE_DELAY_PROGRESS).msg(progressDelayDTO).timeout(time).build(); DelayQueueDTO delayQueueDTONew = DelayQueueDTO.builder().key(userWxId).type(PersonalStageConstant.PERSONALSTAGE_DELAY_PROGRESS).msg(progressDelayDTO).timeout(time).build();
delayMessageSender.send(delayQueueDTONew); delayMessageSender.send(delayQueueDTONew);
String key = "BOOK:LINK_PROGRESS:"+ userWxId + "-" +robotWxId; String key = "BOOK:LINK_PROGRESS:"+ userWxId + "-" +robotWxId;
...@@ -856,7 +857,7 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz { ...@@ -856,7 +857,7 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
String userWxId = linkClickRecordDTO.getWxId(); String userWxId = linkClickRecordDTO.getWxId();
String robotId = linkClickRecordDTO.getRobotId(); String robotId = linkClickRecordDTO.getRobotId();
if (linkType == 1){ 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); JedisClusterUtils.setJson(key, userWxId, 5*3600);
}else if (linkType == 2){ }else if (linkType == 2){
String key = "BOOK:LINK_PAPER:"+ userWxId + "-" +robotId+"-"+linkClickRecordDTO.getPaperId(); String key = "BOOK:LINK_PAPER:"+ userWxId + "-" +robotId+"-"+linkClickRecordDTO.getPaperId();
...@@ -867,17 +868,18 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz { ...@@ -867,17 +868,18 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
@Override @Override
@ParamLog("进度单延迟处理") @ParamLog("进度单延迟处理")
public void delayProgress(DelayQueueDTO dto) { 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())){ if (null==progressMessage || StringUtil.isEmpty(progressMessage.getContent())){
return; return;
} }
String userWxId=dto.getKey(); String userWxId=dto.getKey();
ProgressDelayDTO progressDelayDTO=(ProgressDelayDTO) dto.getMsg();
String robotId = progressDelayDTO.getRobotId(); String robotId = progressDelayDTO.getRobotId();
Long personalStageId = progressDelayDTO.getPersonalStageId(); Long personalStageId = progressDelayDTO.getPersonalStageId();
String ip = progressDelayDTO.getIp(); 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); String value = JedisClusterUtils.getJson(key, String.class);
if (!StringUtil.isEmpty(value)){ if (!StringUtil.isEmpty(value)){
log.info("用户已点击进度单链接"); log.info("用户已点击进度单链接");
......
package com.pcloud.book.personalstage.biz.impl; package com.pcloud.book.personalstage.biz.impl;
import com.google.common.collect.Lists; 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.entity.PersonalStageProgressMessage;
import com.pcloud.book.personalstage.dao.PersonalStageProgressMessageDao; import com.pcloud.book.personalstage.dao.PersonalStageProgressMessageDao;
import com.pcloud.book.personalstage.biz.PersonalStageProgressMessageBiz; import com.pcloud.book.personalstage.biz.PersonalStageProgressMessageBiz;
...@@ -41,8 +43,8 @@ public class PersonalStageProgressMessageBizImpl implements PersonalStageProgres ...@@ -41,8 +43,8 @@ public class PersonalStageProgressMessageBizImpl implements PersonalStageProgres
@Override @Override
@ParamLog("查询多条数据") @ParamLog("查询多条数据")
public List<PersonalStageProgressMessage> getProgressMessageList() { public List<PersonalStageProgressMessage> getProgressMessageList(Integer progressId) {
List<PersonalStageProgressMessage> progressMessageList = personalStageProgressMessageDao.getProgressMessageList(); List<PersonalStageProgressMessage> progressMessageList = personalStageProgressMessageDao.getProgressMessageList(progressId);
if (ListUtils.isEmpty(progressMessageList)){ if (ListUtils.isEmpty(progressMessageList)){
return Lists.newArrayList(); return Lists.newArrayList();
} }
...@@ -64,9 +66,9 @@ public class PersonalStageProgressMessageBizImpl implements PersonalStageProgres ...@@ -64,9 +66,9 @@ public class PersonalStageProgressMessageBizImpl implements PersonalStageProgres
if(personalStageProgressMessage.stream().filter(x-> StringUtil.isEmpty(x.getContent())).count() > 0){ if(personalStageProgressMessage.stream().filter(x-> StringUtil.isEmpty(x.getContent())).count() > 0){
throw BizException.PARAM_IS_NULL; throw BizException.PARAM_IS_NULL;
} }
Integer progressId = personalStageProgressMessage.get(0).getProgressId();
// 删除所有旧数据 // 删除所有旧数据
personalStageProgressMessageDao.deleteAll(); personalStageProgressMessageDao.deleteByProgressId(progressId);
personalStageProgressMessage.stream().forEach(x->{ personalStageProgressMessage.stream().forEach(x->{
if(x.getType() == null || x.getType() == 0){ if(x.getType() == null || x.getType() == 0){
x.setType(1); x.setType(1);
...@@ -81,4 +83,9 @@ public class PersonalStageProgressMessageBizImpl implements PersonalStageProgres ...@@ -81,4 +83,9 @@ public class PersonalStageProgressMessageBizImpl implements PersonalStageProgres
public void deleteById(Long id) { public void deleteById(Long id) {
personalStageProgressMessageDao.deleteById(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 { ...@@ -75,6 +75,7 @@ public class PersonalStageCheck {
@ParamLog("校验回复") @ParamLog("校验回复")
private Long checkReplies(List<PersonalStageReply> list) { private Long checkReplies(List<PersonalStageReply> list) {
Long paperId = null; Long paperId = null;
Long progressId = null;
for (PersonalStageReply reply:list){ for (PersonalStageReply reply:list){
if (reply==null){ if (reply==null){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"回复不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR,"回复不能为空!");
...@@ -91,6 +92,15 @@ public class PersonalStageCheck { ...@@ -91,6 +92,15 @@ public class PersonalStageCheck {
paperId = reply.getPaperId(); 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()); checkReplayItems(reply.getPersonalStageReplyItems());
} }
return paperId; return paperId;
......
...@@ -12,6 +12,12 @@ public class PersonalStageConstant { ...@@ -12,6 +12,12 @@ public class PersonalStageConstant {
public static final String PERSONALSTAGE_DELAY_LINKUP="PERSONALSTAGE_DELAY_LINKUP"; 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 = "${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"; public static final String PERSONAL_STAGE_PROJECT_PROGRESS = "/personalCenter/projectProgress";
...@@ -25,5 +31,9 @@ public class PersonalStageConstant { ...@@ -25,5 +31,9 @@ public class PersonalStageConstant {
* 需求定制单延迟 * 需求定制单延迟
*/ */
public static final String PERSONALSTAGE_DELAY_PAPER="PERSONALSTAGE_DELAY_PAPER"; public static final String PERSONALSTAGE_DELAY_PAPER="PERSONALSTAGE_DELAY_PAPER";
//定制方案占位符
public static final String CUSTOM_PLAN = "${CUSTOM_PLAN}";
} }
package com.pcloud.book.personalstage.dao; package com.pcloud.book.personalstage.dao;
import com.pcloud.book.personalstage.dto.PersonalStageProgressDTO;
import com.pcloud.book.personalstage.entity.PersonalStageProgressMessage; import com.pcloud.book.personalstage.entity.PersonalStageProgressMessage;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
...@@ -14,19 +15,27 @@ import java.util.List; ...@@ -14,19 +15,27 @@ import java.util.List;
*/ */
public interface PersonalStageProgressMessageDao extends BaseDao<PersonalStageProgressMessage> { public interface PersonalStageProgressMessageDao extends BaseDao<PersonalStageProgressMessage> {
List<PersonalStageProgressMessage> getPersonalProgress(Date startTime); List<PersonalStageProgressMessage> getPersonalProgress(Date startTime, Long progressId);
List<PersonalStageProgressMessage> selectAllProgressMessage(); List<PersonalStageProgressMessage> selectAllProgressMessage();
List<PersonalStageProgressMessage> getProgressMessageList(); List<PersonalStageProgressMessage> getProgressMessageList(Integer progressId);
void deleteAll(); void deleteAll();
/** /**
* 获取进度总数 * 获取进度总数
* @return * @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; 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.entity.PersonalStageProgressMessage;
import com.pcloud.book.personalstage.dao.PersonalStageProgressMessageDao; import com.pcloud.book.personalstage.dao.PersonalStageProgressMessageDao;
import com.pcloud.common.core.dao.BaseDaoImpl; import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.apache.ibatis.annotations.Param;
import java.util.Date; import java.util.*;
import java.util.List;
/** /**
* (PersonalStageProgressMessage)表数据库访问层 * (PersonalStageProgressMessage)表数据库访问层
...@@ -19,8 +18,11 @@ import java.util.List; ...@@ -19,8 +18,11 @@ import java.util.List;
public class PersonalStageProgressMessageDaoImpl extends BaseDaoImpl<PersonalStageProgressMessage> implements PersonalStageProgressMessageDao { public class PersonalStageProgressMessageDaoImpl extends BaseDaoImpl<PersonalStageProgressMessage> implements PersonalStageProgressMessageDao {
@Override @Override
public List<PersonalStageProgressMessage> getPersonalProgress(Date startTime) { public List<PersonalStageProgressMessage> getPersonalProgress(Date startTime, Long progressId) {
return getSessionTemplate().selectList(getStatement("getPersonalProgress"),startTime); Map<String,Object> paramMap = new HashMap<>();
paramMap.put("startTime",startTime);
paramMap.put("progressId",progressId);
return getSessionTemplate().selectList(getStatement("getPersonalProgress"),paramMap);
} }
public List<PersonalStageProgressMessage> selectAllProgressMessage(){ public List<PersonalStageProgressMessage> selectAllProgressMessage(){
...@@ -28,8 +30,8 @@ public class PersonalStageProgressMessageDaoImpl extends BaseDaoImpl<PersonalSta ...@@ -28,8 +30,8 @@ public class PersonalStageProgressMessageDaoImpl extends BaseDaoImpl<PersonalSta
} }
@Override @Override
public List<PersonalStageProgressMessage> getProgressMessageList() { public List<PersonalStageProgressMessage> getProgressMessageList(Integer progressId) {
return getSessionTemplate().selectList(getStatement("getProgressMessageList")); return getSessionTemplate().selectList(getStatement("getProgressMessageList"),progressId);
} }
@Override @Override
...@@ -38,12 +40,22 @@ public class PersonalStageProgressMessageDaoImpl extends BaseDaoImpl<PersonalSta ...@@ -38,12 +40,22 @@ public class PersonalStageProgressMessageDaoImpl extends BaseDaoImpl<PersonalSta
} }
@Override @Override
public Integer countProgressMessage() { public Integer countProgressMessage(Long progressId) {
return super.sqlSessionTemplate.selectOne(getStatement("countProgressMessage")); return super.sqlSessionTemplate.selectOne(getStatement("countProgressMessage"),progressId);
} }
@Override @Override
public PersonalStageProgressMessage getWaitClickProgress() { public PersonalStageProgressMessage getWaitClickProgress(Integer progressId) {
return getSessionTemplate().selectOne(getStatement("getWaitClickProgress")); 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 { ...@@ -17,4 +17,6 @@ public class LinkClickRecordDTO extends BaseDto {
private String wxId; private String wxId;
@ApiModelProperty("需求定制单id") @ApiModelProperty("需求定制单id")
private Long paperId; private Long paperId;
@ApiModelProperty("进度单id")
private Integer progressId;
} }
...@@ -48,4 +48,39 @@ public class PersonalStageProgressDTO { ...@@ -48,4 +48,39 @@ public class PersonalStageProgressDTO {
* 进度总数 * 进度总数
*/ */
private Integer totalProgress; 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 { ...@@ -18,5 +18,7 @@ public class ProgressDelayDTO implements Serializable {
private String wxId; private String wxId;
@ApiModelProperty("ip地址") @ApiModelProperty("ip地址")
private String ip; private String ip;
@ApiModelProperty("进度id")
private Integer progressId;
} }
...@@ -17,7 +17,8 @@ import lombok.Data; ...@@ -17,7 +17,8 @@ import lombok.Data;
public class PersonalStageProgressMessage extends BaseEntity { public class PersonalStageProgressMessage extends BaseEntity {
private static final long serialVersionUID = 783203450632034209L; private static final long serialVersionUID = 783203450632034209L;
private Integer progressId;
private String content; private String content;
private Integer minutes; private Integer minutes;
......
...@@ -35,4 +35,10 @@ public class PersonalStageReply extends BaseEntity { ...@@ -35,4 +35,10 @@ public class PersonalStageReply extends BaseEntity {
@ApiModelProperty("回复项集合") @ApiModelProperty("回复项集合")
private List<PersonalStageReplyItem> personalStageReplyItems; 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 { ...@@ -198,16 +198,18 @@ public class PersonalStageFacade {
@ApiOperation("获取进度") @ApiOperation("获取进度")
@GetMapping("getPersonalProgress") @GetMapping("getPersonalProgress")
public ResponseDto<?> getPersonalProgress(@RequestParam("wxUserId") String wxUserId,@RequestParam("personalStageUserId") Long personalStageUserId) throws PermissionException, BizException{ public ResponseDto<?> getPersonalProgress(@RequestParam("wxUserId") String wxUserId,
PersonalStageProgressDTO personalStageProgressDTO = personalStageBiz.getPersonalProgress(wxUserId, personalStageUserId); @RequestParam("personalStageUserId") Long personalStageUserId,
@RequestParam("progressId") Long progressId) throws PermissionException, BizException{
PersonalStageProgressDTO personalStageProgressDTO = personalStageBiz.getPersonalProgress(wxUserId, personalStageUserId,progressId);
return new ResponseDto<>(personalStageProgressDTO); return new ResponseDto<>(personalStageProgressDTO);
} }
@ApiOperation("查询所有的进度消息") @ApiOperation("查询所有的进度消息")
@GetMapping("getProgressMessageList") @GetMapping("getProgressMessageList")
public ResponseDto<?> getProgressMessageList() public ResponseDto<?> getProgressMessageList(@RequestParam("progressId") Integer progressId)
throws BizException, PermissionException { throws BizException, PermissionException {
return new ResponseDto<>(personalStageProgressMessageBiz.getProgressMessageList()); return new ResponseDto<>(personalStageProgressMessageBiz.getProgressMessageList(progressId));
} }
@ApiOperation("保存进度消息") @ApiOperation("保存进度消息")
...@@ -289,4 +291,13 @@ public class PersonalStageFacade { ...@@ -289,4 +291,13 @@ public class PersonalStageFacade {
personalStageJumpBiz.endServiceJumpNext(endServiceJumpNextDTO); personalStageJumpBiz.endServiceJumpNext(endServiceJumpNextDTO);
return new ResponseDto<>(); 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 @@ ...@@ -17,12 +17,14 @@
<result column="preview_qrcode_url" jdbcType="VARCHAR" property="previewQrcodeUrl" /> <result column="preview_qrcode_url" jdbcType="VARCHAR" property="previewQrcodeUrl" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> <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> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, plan_number, plan_name, create_user_name, description, open_feedback, paper_id, 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, paper_title, paper_desc, use_state, pdf_url, h5_url, preview_qrcode_url, create_time,
update_time update_time, confirm_feedback_reply
</sql> </sql>
<insert id="insert" parameterType="CustomPlan" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" parameterType="CustomPlan" useGeneratedKeys="true" keyProperty="id">
...@@ -30,12 +32,12 @@ ...@@ -30,12 +32,12 @@
description, open_feedback, paper_id, description, open_feedback, paper_id,
paper_title, paper_desc, use_state, paper_title, paper_desc, use_state,
pdf_url, h5_url, preview_qrcode_url, 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}, values (#{planNumber,jdbcType=VARCHAR}, #{planName,jdbcType=VARCHAR}, #{createUserName,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{openFeedback,jdbcType=INTEGER}, #{paperId,jdbcType=INTEGER}, #{description,jdbcType=VARCHAR}, #{openFeedback,jdbcType=INTEGER}, #{paperId,jdbcType=INTEGER},
#{paperTitle,jdbcType=VARCHAR}, #{paperDesc,jdbcType=VARCHAR}, #{useState,jdbcType=INTEGER}, #{paperTitle,jdbcType=VARCHAR}, #{paperDesc,jdbcType=VARCHAR}, #{useState,jdbcType=INTEGER},
#{pdfUrl,jdbcType=VARCHAR}, #{h5Url,jdbcType=VARCHAR}, #{previewQrcodeUrl,jdbcType=VARCHAR}, #{pdfUrl,jdbcType=VARCHAR}, #{h5Url,jdbcType=VARCHAR}, #{previewQrcodeUrl,jdbcType=VARCHAR},
NOW(), NOW()) NOW(), NOW(), #{confirmFeedbackReply})
</insert> </insert>
<update id="update" parameterType="CustomPlan"> <update id="update" parameterType="CustomPlan">
...@@ -77,7 +79,7 @@ ...@@ -77,7 +79,7 @@
<if test="previewQrcodeUrl != null"> <if test="previewQrcodeUrl != null">
preview_qrcode_url = #{previewQrcodeUrl,jdbcType=VARCHAR}, preview_qrcode_url = #{previewQrcodeUrl,jdbcType=VARCHAR},
</if> </if>
update_time = NOW(), update_time = NOW(),confirm_feedback_reply = #{confirmFeedbackReply}
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
...@@ -111,8 +113,10 @@ ...@@ -111,8 +113,10 @@
<select id="listCustomPlanByPage" resultMap="BaseResultMap"> <select id="listCustomPlanByPage" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List" /> a.id, plan_number, plan_name, create_user_name, description, open_feedback,
from custom_plan 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 where 1= 1
<if test="content != null"> <if test="content != null">
and (plan_number like concat('%', #{content}, '%') and (plan_number like concat('%', #{content}, '%')
...@@ -122,6 +126,7 @@ ...@@ -122,6 +126,7 @@
<if test="useState != null"> <if test="useState != null">
and use_state = #{useState} and use_state = #{useState}
</if> </if>
GROUP BY a.id
ORDER BY update_time DESC ORDER BY update_time DESC
LIMIT #{pageNum}, #{numPerPage} LIMIT #{pageNum}, #{numPerPage}
</select> </select>
......
...@@ -18,11 +18,12 @@ ...@@ -18,11 +18,12 @@
<result column="merchant_name" jdbcType="VARCHAR" property="merchantName" /> <result column="merchant_name" jdbcType="VARCHAR" property="merchantName" />
<result column="product_unique_number" jdbcType="VARCHAR" property="productUniqueNumber" /> <result column="product_unique_number" jdbcType="VARCHAR" property="productUniqueNumber" />
<result column="link_url" jdbcType="VARCHAR" property="linkUrl" /> <result column="link_url" jdbcType="VARCHAR" property="linkUrl" />
<result column="open_feedback" jdbcType="INTEGER" property="openFeedback" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, plan_id, parent_id, module_type, pic_url, type_name, title, content, skill_id, skill_cover, 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> </sql>
<insert id="insert" parameterType="CustomPlanModule" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" parameterType="CustomPlanModule" useGeneratedKeys="true" keyProperty="id">
...@@ -30,12 +31,12 @@ ...@@ -30,12 +31,12 @@
type_name, title, content, type_name, title, content,
skill_id, skill_cover, app_id, agent_name, skill_id, skill_cover, app_id, agent_name,
product_id, merchant_name, product_unique_number, link_url, create_time, 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}, values (#{planId,jdbcType=INTEGER}, #{parentId,jdbcType=INTEGER}, #{moduleType,jdbcType=INTEGER}, #{picUrl,jdbcType=VARCHAR},
#{typeName,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, #{typeName,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR},
#{skillId,jdbcType=INTEGER}, #{skillCover,jdbcType=VARCHAR}, #{appId,jdbcType=BIGINT}, #{agentName,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}, #{productId,jdbcType=BIGINT}, #{merchantName,jdbcType=VARCHAR}, #{productUniqueNumber,jdbcType=VARCHAR}, #{linkUrl,jdbcType=VARCHAR},
NOW(), NOW()) NOW(), NOW(), #{openFeedback})
</insert> </insert>
<update id="update" parameterType="CustomPlanModule"> <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,15 +4,21 @@ ...@@ -4,15 +4,21 @@
<resultMap id="BaseResultMap" type="com.pcloud.book.personalstage.entity.PersonalStageProgressMessage"> <resultMap id="BaseResultMap" type="com.pcloud.book.personalstage.entity.PersonalStageProgressMessage">
<id column="id" property="id" jdbcType="BIGINT"/> <id column="id" property="id" jdbcType="BIGINT"/>
<result column="progress_id" property="progressId" jdbcType="INTEGER"/>
<result column="content" property="content" jdbcType="VARCHAR"/> <result column="content" property="content" jdbcType="VARCHAR"/>
<result column="minutes" property="minutes" jdbcType="INTEGER"/> <result column="minutes" property="minutes" jdbcType="INTEGER"/>
<result column="type" property="type" jdbcType="INTEGER"/> <result column="type" property="type" jdbcType="INTEGER"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/> <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
</resultMap> </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"> <sql id="Base_Column_List">
id, content, minutes, type, create_time, update_time id, progress_id,content, minutes, create_time, update_time,type
</sql> </sql>
<select id="getById" resultMap="BaseResultMap"> <select id="getById" resultMap="BaseResultMap">
...@@ -26,17 +32,20 @@ ...@@ -26,17 +32,20 @@
SELECT SELECT
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
FROM personal_stage_progress_message FROM personal_stage_progress_message
where progress_id=#{progressId}
ORDER BY type ORDER BY type
</select> </select>
<insert id="insert" keyProperty="id" useGeneratedKeys="true"> <insert id="insert" keyProperty="id" useGeneratedKeys="true">
INSERT INTO personal_stage_progress_message( INSERT INTO personal_stage_progress_message(
progress_id,
content, content,
minutes, minutes,
type, type,
create_time, create_time,
update_time update_time
) VALUES ( ) VALUES (
#{progressId, jdbcType=INTEGER},
#{content, jdbcType=VARCHAR}, #{content, jdbcType=VARCHAR},
#{minutes, jdbcType=INTEGER}, #{minutes, jdbcType=INTEGER},
#{type, jdbcType=INTEGER}, #{type, jdbcType=INTEGER},
...@@ -47,6 +56,7 @@ ...@@ -47,6 +56,7 @@
<insert id="batchInsert" keyProperty="id" useGeneratedKeys="true"> <insert id="batchInsert" keyProperty="id" useGeneratedKeys="true">
INSERT INTO personal_stage_progress_message ( INSERT INTO personal_stage_progress_message (
progress_id,
content, content,
minutes, minutes,
type, type,
...@@ -55,6 +65,7 @@ ...@@ -55,6 +65,7 @@
) VALUES ) VALUES
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
( (
#{item.progressId, jdbcType=INTEGER},
#{item.content, jdbcType=VARCHAR}, #{item.content, jdbcType=VARCHAR},
#{item.minutes, jdbcType=INTEGER}, #{item.minutes, jdbcType=INTEGER},
#{item.type, jdbcType=INTEGER}, #{item.type, jdbcType=INTEGER},
...@@ -68,6 +79,9 @@ ...@@ -68,6 +79,9 @@
<update id="update"> <update id="update">
UPDATE personal_stage_progress_message UPDATE personal_stage_progress_message
<set> <set>
<if test="progressId != null">
progress_id = #{progressId},
</if>
<if test="content != null and content != ''"> <if test="content != null and content != ''">
content = #{content}, content = #{content},
</if> </if>
...@@ -96,26 +110,28 @@ ...@@ -96,26 +110,28 @@
DELETE FROM personal_stage_progress_message DELETE FROM personal_stage_progress_message
</delete> </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 select
id, id,
progress_id,
content, content,
minutes, minutes,
type type
from from
personal_stage_progress_message personal_stage_progress_message
where where
TIMESTAMPDIFF(MINUTE,#{startTime}, now()) &gt;= minutes type = 1
and type = 1 and progress_id = #{progressId}
order by id asc order by id asc
</select> </select>
<select id="getWaitClickProgress" resultMap="BaseResultMap"> <select id="getWaitClickProgress" resultMap="BaseResultMap" parameterType="integer">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from from
personal_stage_progress_message personal_stage_progress_message
where type = 2 where type = 2
and progress_id = #{progressId}
limit 1 limit 1
</select> </select>
...@@ -129,7 +145,53 @@ ...@@ -129,7 +145,53 @@
order by id asc order by id asc
</select> </select>
<select id="countProgressMessage" resultType="int"> <select id="countProgressMessage" resultType="int" parameterType="long">
select count(id) from personal_stage_progress_message 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>
<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> </mapper>
\ No newline at end of file
...@@ -11,10 +11,16 @@ ...@@ -11,10 +11,16 @@
<result property="paperId" column="paper_id" jdbcType="BIGINT"/> <result property="paperId" column="paper_id" jdbcType="BIGINT"/>
<result property="paperTitle" column="paper_title" jdbcType="VARCHAR"/> <result property="paperTitle" column="paper_title" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> <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> </resultMap>
<sql id="Base_Column_List"> <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> </sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long"> <select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
...@@ -59,7 +65,8 @@ ...@@ -59,7 +65,8 @@
relevance_type, relevance_type,
paper_id, paper_id,
paper_title, paper_title,
create_time create_time,
progress_id
) values ) values
<foreach collection="list" item="item" index="index" separator=","> <foreach collection="list" item="item" index="index" separator=",">
( (
...@@ -69,7 +76,8 @@ ...@@ -69,7 +76,8 @@
#{item.relevanceType,jdbcType=INTEGER}, #{item.relevanceType,jdbcType=INTEGER},
#{item.paperId}, #{item.paperId},
#{item.paperTitle}, #{item.paperTitle},
NOW() NOW(),
#{item.progressId}
) )
</foreach> </foreach>
</insert> </insert>
...@@ -87,7 +95,7 @@ ...@@ -87,7 +95,7 @@
</foreach> </foreach>
</delete> </delete>
<select id="getListByPersonalStageId" parameterType="long" resultMap="BaseResultMap"> <select id="getListByPersonalStageId" parameterType="long" resultMap="PersonalStageReplyMap">
select <include refid="Base_Column_List"/> select <include refid="Base_Column_List"/>
from personal_stage_reply from personal_stage_reply
where personal_stage_id=#{personalStageId} 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