Commit d40fb232 by 裴大威

Merge branch 'feat-1002612' into 'master'

1002612客服系统优化

See merge request rays/pcloud-book!561
parents fd1c11a4 a51084b6
...@@ -28,7 +28,8 @@ public interface CustomPlanBiz { ...@@ -28,7 +28,8 @@ public interface CustomPlanBiz {
void deleteCustomPlanById(Integer planId); void deleteCustomPlanById(Integer planId);
PageBeanNew<CustomPlan> listCustomPlanByPage(Integer currentPage, Integer numPerPage, String content, Integer useState, Integer hasPdf); PageBeanNew<CustomPlan> listCustomPlanByPage(Integer currentPage, Integer numPerPage, String content, Integer useState,
Integer hasPdf,Integer robotType, Integer readType);
void editCustomPlanModule(EditCustomPlanModuleVO editCustomPlanModuleVO); void editCustomPlanModule(EditCustomPlanModuleVO editCustomPlanModuleVO);
......
...@@ -139,12 +139,14 @@ public class CustomPlanBizImpl implements CustomPlanBiz { ...@@ -139,12 +139,14 @@ public class CustomPlanBizImpl implements CustomPlanBiz {
} }
@Override @Override
public PageBeanNew<CustomPlan> listCustomPlanByPage(Integer currentPage, Integer numPerPage, String content, Integer useState, Integer hasPdf) { public PageBeanNew<CustomPlan> listCustomPlanByPage(Integer currentPage, Integer numPerPage, String content, Integer useState,
int count = customPlanMapper.getCustomPlanCount(content, useState, hasPdf); Integer hasPdf, Integer robotType, Integer readType) {
int count = customPlanMapper.getCustomPlanCount(content, useState, hasPdf,robotType, readType);
if(count <= 0) { if(count <= 0) {
return new PageBeanNew<>(currentPage, numPerPage, new ArrayList<>()); return new PageBeanNew<>(currentPage, numPerPage, new ArrayList<>());
} }
List<CustomPlan> customPlanList = customPlanMapper.listCustomPlanByPage(currentPage * numPerPage, numPerPage, content, useState, hasPdf); List<CustomPlan> customPlanList = customPlanMapper.listCustomPlanByPage(currentPage * numPerPage,
numPerPage, content, useState, hasPdf, robotType, readType);
return new PageBeanNew<>(currentPage, numPerPage, count, customPlanList); return new PageBeanNew<>(currentPage, numPerPage, count, customPlanList);
} }
......
...@@ -51,4 +51,7 @@ public class CustomPlan { ...@@ -51,4 +51,7 @@ public class CustomPlan {
@ApiModelProperty("个人号类型名称") @ApiModelProperty("个人号类型名称")
private String robotTypeName; private String robotTypeName;
@ApiModelProperty("阅读类型1轻松2高效3深度")
private Integer readType;
} }
\ No newline at end of file
...@@ -82,8 +82,10 @@ public class CustomPlanFacade { ...@@ -82,8 +82,10 @@ public class CustomPlanFacade {
@GetMapping("listCustomPlanByPage") @GetMapping("listCustomPlanByPage")
ResponseDto<?> listCustomPlanByPage(@RequestHeader String token, @RequestParam Integer currentPage, @RequestParam Integer numPerPage, ResponseDto<?> listCustomPlanByPage(@RequestHeader String token, @RequestParam Integer currentPage, @RequestParam Integer numPerPage,
@RequestParam(value = "content", required = false) String content, @RequestParam(value = "useState", required = false) Integer useState, @RequestParam(value = "content", required = false) String content, @RequestParam(value = "useState", required = false) Integer useState,
@RequestParam(value = "hasPdf", required = false) Integer hasPdf) { @RequestParam(value = "hasPdf", required = false) Integer hasPdf,
return new ResponseDto<>(customPlanBiz.listCustomPlanByPage(currentPage, numPerPage, content, useState, hasPdf)); @RequestParam(value = "robotType", required = false) Integer robotType,
@RequestParam(value = "readType", required = false) Integer readType) {
return new ResponseDto<>(customPlanBiz.listCustomPlanByPage(currentPage, numPerPage, content, useState, hasPdf,robotType, readType));
} }
@ApiOperation("编辑方案模块") @ApiOperation("编辑方案模块")
......
...@@ -20,10 +20,12 @@ public interface CustomPlanMapper { ...@@ -20,10 +20,12 @@ public interface CustomPlanMapper {
void deleteById(@Param("id") Integer id); void deleteById(@Param("id") Integer id);
int getCustomPlanCount(@Param("content") String content, @Param("useState") Integer useState, @Param("hasPdf") Integer hasPdf); int getCustomPlanCount(@Param("content") String content, @Param("useState") Integer useState, @Param("hasPdf") Integer hasPdf,
@Param("robotType") Integer robotType, @Param("readType") Integer readType);
List<CustomPlan> listCustomPlanByPage(@Param("pageNum") Integer pageNum, @Param("numPerPage") Integer numPerPage, @Param("content") String content, @Param("useState") Integer useState, List<CustomPlan> listCustomPlanByPage(@Param("pageNum") Integer pageNum, @Param("numPerPage") Integer numPerPage, @Param("content") String content, @Param("useState") Integer useState,
@Param("hasPdf") Integer hasPdf); @Param("hasPdf") Integer hasPdf, @Param("robotType") Integer robotType,
@Param("readType") Integer readType);
int getPlanPaperCount(Map<String, Object> paramMap); int getPlanPaperCount(Map<String, Object> paramMap);
......
...@@ -2,6 +2,7 @@ package com.pcloud.book.personalstage.biz; ...@@ -2,6 +2,7 @@ package com.pcloud.book.personalstage.biz;
import com.pcloud.book.personalstage.dto.PersonalStageDTO; import com.pcloud.book.personalstage.dto.PersonalStageDTO;
import com.pcloud.book.personalstage.dto.PersonalStageProgressDTO; import com.pcloud.book.personalstage.dto.PersonalStageProgressDTO;
import com.pcloud.book.personalstage.dto.ReplaceCodeDTO4CustomerService;
import com.pcloud.book.personalstage.entity.PersonalStage; import com.pcloud.book.personalstage.entity.PersonalStage;
import com.pcloud.book.personalstage.entity.PersonalStageUser; import com.pcloud.book.personalstage.entity.PersonalStageUser;
...@@ -87,4 +88,6 @@ public interface PersonalStageBiz { ...@@ -87,4 +88,6 @@ public interface PersonalStageBiz {
void createUserReplaceCode(UserReplaceCodeDTO userReplaceCodeDTO); void createUserReplaceCode(UserReplaceCodeDTO userReplaceCodeDTO);
Map<String,String> getUserReplaceMap(String wxId, String robotId); Map<String,String> getUserReplaceMap(String wxId, String robotId);
ReplaceCodeDTO4CustomerService getUserReplaceMap4CustomerService(String wxId, String robotId);
} }
...@@ -1188,4 +1188,46 @@ public class PersonalStageBizImpl implements PersonalStageBiz { ...@@ -1188,4 +1188,46 @@ public class PersonalStageBizImpl implements PersonalStageBiz {
newList.get(newList.size()-1).setState(0); newList.get(newList.size()-1).setState(0);
return newList; return newList;
} }
@Override
public ReplaceCodeDTO4CustomerService getUserReplaceMap4CustomerService(String wxId, String robotId) {
ReplaceCodeDTO4CustomerService dto4CustomerService = new ReplaceCodeDTO4CustomerService();
if (StringUtil.isEmpty(wxId)||StringUtil.isEmpty(robotId)){
return dto4CustomerService;
}
List<ReplaceCode> all = replaceCodeDao.getAll();
Long bookCodeId = null;
Long serviceCodeId = null;
for (ReplaceCode replaceCode:all){
if ("${bookName}".equals(replaceCode.getReplaceCode())){
bookCodeId = replaceCode.getId();
} else if ("${serviceType}".equals(replaceCode.getReplaceCode())){
serviceCodeId = replaceCode.getId();
}
}
//书刊分类,目前取小号分类
PcloudRobot pcloudRobot = pcloudRobotDao.getByWxId(robotId);
if (null!= pcloudRobot && null !=pcloudRobot.getRobotType()){
PcloudRobotClassify robotClassify = pcloudRobotClassifyDao.getById(pcloudRobot.getRobotType());
String classifyName = robotClassify==null?"":robotClassify.getClassifyName();
dto4CustomerService.setBookClassify(classifyName);
dto4CustomerService.setBookClassifyList(Arrays.asList(classifyName));
}
//历史记录
if (null!=bookCodeId){
List<String> bookNameList = userReplaceCodeDao.getUserReplaceRecordByCodeId(wxId,robotId,bookCodeId);
if (!ListUtils.isEmpty(bookNameList)){
dto4CustomerService.setBookNameList(bookNameList);
dto4CustomerService.setBookName(bookNameList.get(0));
}
}
if (null!=serviceCodeId){
List<String> serviceTypeList = userReplaceCodeDao.getUserReplaceRecordByCodeId(wxId,robotId,serviceCodeId);
if (!ListUtils.isEmpty(serviceTypeList)){
dto4CustomerService.setServiceTypeList(serviceTypeList);
dto4CustomerService.setServiceType(serviceTypeList.get(0));
}
}
return dto4CustomerService;
}
} }
...@@ -8,4 +8,6 @@ import java.util.List; ...@@ -8,4 +8,6 @@ import java.util.List;
public interface UserReplaceCodeDao extends BaseDao<UserReplaceCode> { public interface UserReplaceCodeDao extends BaseDao<UserReplaceCode> {
List<UserReplaceCode> getLastUserReplace(String wxId, String robotId); List<UserReplaceCode> getLastUserReplace(String wxId, String robotId);
List<String> getUserReplaceRecordByCodeId(String wxId, String robotId, Long codeId);
} }
\ No newline at end of file
...@@ -19,4 +19,13 @@ public class UserReplaceCodeDaoImpl extends BaseDaoImpl<UserReplaceCode> impleme ...@@ -19,4 +19,13 @@ public class UserReplaceCodeDaoImpl extends BaseDaoImpl<UserReplaceCode> impleme
map.put("robotId",robotId); map.put("robotId",robotId);
return super.getSqlSession().selectList(getStatement("getLastUserReplace"),map); return super.getSqlSession().selectList(getStatement("getLastUserReplace"),map);
} }
@Override
public List<String> getUserReplaceRecordByCodeId(String wxId, String robotId, Long codeId) {
Map<String,Object> map=new HashMap<>();
map.put("wxId",wxId);
map.put("robotId",robotId);
map.put("replaceCodeId",codeId);
return super.getSqlSession().selectList(getStatement("getUserReplaceRecordByCodeId"),map);
}
} }
package com.pcloud.book.personalstage.dto;
import com.pcloud.common.dto.BaseDto;
import lombok.Data;
import java.util.List;
/**
* 人工客服读者信息
*/
@Data
public class ReplaceCodeDTO4CustomerService extends BaseDto {
/**
* 当前图书名称
*/
private String bookName;
/**
* 当前阅读类型
*/
private String serviceType;
/**
* 当前书刊分类
*/
private String bookClassify;
/**
* 历史图书名称
*/
private List<String> bookNameList;
/**
* 历史阅读类型
*/
private List<String> serviceTypeList;
/**
* 历史书刊分类
*/
private List<String> bookClassifyList;
}
...@@ -325,4 +325,10 @@ public class PersonalStageFacade { ...@@ -325,4 +325,10 @@ public class PersonalStageFacade {
return new ResponseDto<>(personalStageBiz.getUserReplaceMap(wxId,robotId)); return new ResponseDto<>(personalStageBiz.getUserReplaceMap(wxId,robotId));
} }
@ApiOperation("人工客服获取用户替换map")
@GetMapping("getUserReplaceMap4CustomerService")
public ResponseDto<?> getUserReplaceMap4CustomerService(@RequestParam("wxId") @ApiParam("用户id") String wxId, @RequestParam("robotId") @ApiParam("机器人id") String robotId){
return new ResponseDto<>(personalStageBiz.getUserReplaceMap4CustomerService(wxId,robotId));
}
} }
...@@ -103,7 +103,8 @@ ...@@ -103,7 +103,8 @@
<select id="getCustomPlanCount" resultType="int"> <select id="getCustomPlanCount" resultType="int">
select select
count(1) count(1)
from custom_plan from custom_plan a
LEFT JOIN custom_plan_module m ON a.id=m.plan_id AND m.module_type=6
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}, '%')
...@@ -116,16 +117,23 @@ ...@@ -116,16 +117,23 @@
<if test="hasPdf == 1"> <if test="hasPdf == 1">
and pdf_url is not null and pdf_url is not null
</if> </if>
<if test="robotType != null">
AND a.robot_type = #{robotType}
</if>
<if test="readType != null">
AND m.read_type = #{readType}
</if>
</select> </select>
<select id="listCustomPlanByPage" resultMap="BaseResultMap"> <select id="listCustomPlanByPage" resultMap="BaseResultMap">
select select
a.id, plan_number, plan_name, create_user_name, description, a.open_feedback, a.id, plan_number, plan_name, create_user_name, description, a.open_feedback,
use_state, pdf_url, h5_url, preview_qrcode_url, a.create_time, COUNT(DISTINCT b.batch_id) suggestion_count, use_state, pdf_url, h5_url, preview_qrcode_url, a.create_time, COUNT(DISTINCT b.batch_id) suggestion_count,
a.robot_type,t.classify_name robotTypeName a.robot_type,t.classify_name robotTypeName, m.read_type readType
from custom_plan a left join custom_plan_module_suggestion b from custom_plan a left join custom_plan_module_suggestion b
on a.id = b.plan_id on a.id = b.plan_id
left join pcloud_robot_classify t on a.robot_type = t.id left join pcloud_robot_classify t on a.robot_type = t.id
LEFT JOIN custom_plan_module m ON a.id=m.plan_id AND m.module_type=6
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}, '%')
...@@ -138,8 +146,14 @@ ...@@ -138,8 +146,14 @@
<if test="hasPdf == 1"> <if test="hasPdf == 1">
and pdf_url is not null and pdf_url is not null
</if> </if>
<if test="robotType != null">
AND a.robot_type = #{robotType}
</if>
<if test="readType != null">
AND m.read_type = #{readType}
</if>
GROUP BY a.id GROUP BY a.id
ORDER BY update_time DESC ORDER BY a.update_time DESC
LIMIT #{pageNum}, #{numPerPage} LIMIT #{pageNum}, #{numPerPage}
</select> </select>
......
...@@ -71,4 +71,16 @@ ...@@ -71,4 +71,16 @@
) )
</select> </select>
<select id="getUserReplaceRecordByCodeId" parameterType="map" resultType="string">
SELECT
content
FROM
user_replace_code
WHERE robot_id = #{robotId}
AND wx_id = #{wxId}
AND replace_code_id = #{replaceCodeId}
ORDER BY
create_time DESC
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment