Commit 31771618 by 郑永强

feat: [1003038]时间管理模板订阅任务消息添加选群,模板拷贝,订阅反馈功能

parent feddcdad
...@@ -63,6 +63,19 @@ public class ErpConsr { ...@@ -63,6 +63,19 @@ public class ErpConsr {
} }
} }
@ParamLog("通过书名获取ERP端的bookId【模糊匹配】")
public List<Long> getIdsByBookName(String bookName) throws BizException {
if(StringUtil.isEmpty(bookName)){
return null;
}
try {
return ResponseHandleUtil.parseListResponse(projectService.getIdsByBookName(bookName), Long.class);
} catch (Exception e) {
LOGGER.error("通过书名获取ERP端的bookId[projectService.getIdByBookName]:" + e.getMessage(), e);
throw new BookBizException(BookBizException.INVOKE_CONTENT_ERROR, "通过书名获取ERP端的bookId错误");
}
}
@ParamLog("通过项目id获取bookId") @ParamLog("通过项目id获取bookId")
public Long getProjectIdByBookId(Long bookId,Long adviserId,Long channelId){ public Long getProjectIdByBookId(Long bookId,Long adviserId,Long channelId){
if(!NumberUtil.isNumber(bookId)){ if(!NumberUtil.isNumber(bookId)){
......
...@@ -21,7 +21,7 @@ public interface CustomPlanBiz { ...@@ -21,7 +21,7 @@ public interface CustomPlanBiz {
void deleteCustomPlanById(Integer planId); void deleteCustomPlanById(Integer planId);
PageBeanNew<CustomPlan> listCustomPlanByPage(Integer currentPage, Integer numPerPage, String content, Integer useState, PageBeanNew<CustomPlan> listCustomPlanByPage(Integer currentPage, Integer numPerPage, String content, Integer useState,
Integer hasPdf,Integer robotType, Integer readType); Integer hasPdf,Integer robotType, Integer readType, String erpBookName);
void editCustomPlanModule(EditCustomPlanModuleVO editCustomPlanModuleVO); void editCustomPlanModule(EditCustomPlanModuleVO editCustomPlanModuleVO);
......
...@@ -50,6 +50,14 @@ import com.pcloud.book.group.tools.SendWeixinRequestTools; ...@@ -50,6 +50,14 @@ import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.pcloudkeyword.enums.PcloudGroupRobotTypeEnum; import com.pcloud.book.pcloudkeyword.enums.PcloudGroupRobotTypeEnum;
import com.pcloud.book.rightsSetting.dao.RightsSettingItemDao; import com.pcloud.book.rightsSetting.dao.RightsSettingItemDao;
import com.pcloud.book.rightsSetting.entity.RightsSettingClassify; import com.pcloud.book.rightsSetting.entity.RightsSettingClassify;
import com.pcloud.book.skill.dao.PcloudGroupActivityDao;
import com.pcloud.book.skill.dao.PcloudResourceDao;
import com.pcloud.book.skill.dao.PcloudSkillDao;
import com.pcloud.book.skill.entity.PcloudGroupActivity;
import com.pcloud.book.skill.entity.PcloudResource;
import com.pcloud.book.skill.entity.PcloudSkill;
import com.pcloud.book.skill.enums.SkillTypeEnum;
import com.pcloud.book.timecontrol.dto.TaskDto;
import com.pcloud.book.timecontrol.entity.TimeControlTask; import com.pcloud.book.timecontrol.entity.TimeControlTask;
import com.pcloud.book.timecontrol.mapper.TimeControlTaskMapper; import com.pcloud.book.timecontrol.mapper.TimeControlTaskMapper;
import com.pcloud.book.util.common.ThreadPoolUtils; import com.pcloud.book.util.common.ThreadPoolUtils;
...@@ -59,6 +67,7 @@ import com.pcloud.common.exceptions.BizException; ...@@ -59,6 +67,7 @@ import com.pcloud.common.exceptions.BizException;
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.ListUtils;
import com.pcloud.common.utils.NumberUtil;
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.cache.redis.JedisClusterUtils; import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
...@@ -130,6 +139,14 @@ public class CustomPlanBizImpl implements CustomPlanBiz { ...@@ -130,6 +139,14 @@ public class CustomPlanBizImpl implements CustomPlanBiz {
private CustomRightsItemDescriptionMapper customRightsItemDescriptionMapper; private CustomRightsItemDescriptionMapper customRightsItemDescriptionMapper;
@Autowired @Autowired
private RightsSettingItemDao rightsSettingItemDao; private RightsSettingItemDao rightsSettingItemDao;
@Autowired
private PcloudSkillDao pcloudSkillDao;
@Autowired
private TimeControlTaskMapper taskMapper;
@Autowired
private PcloudResourceDao pcloudResourceDao;
@Autowired
private PcloudGroupActivityDao pcloudGroupActivityDao;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -181,6 +198,9 @@ public class CustomPlanBizImpl implements CustomPlanBiz { ...@@ -181,6 +198,9 @@ public class CustomPlanBizImpl implements CustomPlanBiz {
if(MapUtils.isNotEmpty(bookNames) && bookNames.containsKey(customPlan.getBookId())) if(MapUtils.isNotEmpty(bookNames) && bookNames.containsKey(customPlan.getBookId()))
customPlan.setBookName(bookNames.get(customPlan.getBookId())); customPlan.setBookName(bookNames.get(customPlan.getBookId()));
} }
// 设置标题
this.setTitle(customPlan);
/*
if (null!=customPlan.getCustomTimeControlId()){ if (null!=customPlan.getCustomTimeControlId()){
CustomTimeControlDTO control = customTimeControlDao.getCustomTimeControlById(customPlan.getCustomTimeControlId()); CustomTimeControlDTO control = customTimeControlDao.getCustomTimeControlById(customPlan.getCustomTimeControlId());
if (control!=null){ if (control!=null){
...@@ -191,9 +211,46 @@ public class CustomPlanBizImpl implements CustomPlanBiz { ...@@ -191,9 +211,46 @@ public class CustomPlanBizImpl implements CustomPlanBiz {
} }
} }
*/
return customPlan; return customPlan;
} }
/**
* 设置标题
* @param customPlan
*/
private void setTitle(CustomPlan customPlan) {
if(!NumberUtil.isNumber(customPlan.getPcloudSkillId())){
return;
}
PcloudSkill pcloudSkill = pcloudSkillDao.getById(customPlan.getPcloudSkillId());
if (pcloudSkill==null){
return;
}
if (SkillTypeEnum.TIME_MANAGE.value.equals(pcloudSkill.getSkillType())){
Map<Integer, TaskDto> taskDtoMap = taskMapper.mapByIds(Arrays.asList(pcloudSkill.getRelSkillId().intValue()));
TaskDto taskDto=taskDtoMap.get(pcloudSkill.getRelSkillId().intValue());
if (taskDto!=null){
customPlan.setTaskName(taskDto.getTaskName());
}
}
if (SkillTypeEnum.READING.value.equals(pcloudSkill.getSkillType())){
Map<Long, PcloudGroupActivity> activityMap = pcloudGroupActivityDao.mayByIds(Arrays.asList(pcloudSkill.getRelSkillId()));
PcloudGroupActivity groupActivity = activityMap.get(pcloudSkill.getRelSkillId());
if (groupActivity!=null){
customPlan.setTaskName(groupActivity.getName());
}
}
if (SkillTypeEnum.RESOURCE.value.equals(pcloudSkill.getSkillType())){
Map<Long, PcloudResource> resourceMap = pcloudResourceDao.mayByIds(Arrays.asList(pcloudSkill.getRelSkillId()));
PcloudResource pcloudResource=resourceMap.get(pcloudSkill.getRelSkillId());
if (pcloudResource!=null){
customPlan.setTaskName(pcloudResource.getName());
}
}
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void deleteCustomPlanById(Integer planId) { public void deleteCustomPlanById(Integer planId) {
...@@ -202,13 +259,14 @@ public class CustomPlanBizImpl implements CustomPlanBiz { ...@@ -202,13 +259,14 @@ public class CustomPlanBizImpl implements CustomPlanBiz {
@Override @Override
public PageBeanNew<CustomPlan> listCustomPlanByPage(Integer currentPage, Integer numPerPage, String content, Integer useState, public PageBeanNew<CustomPlan> listCustomPlanByPage(Integer currentPage, Integer numPerPage, String content, Integer useState,
Integer hasPdf, Integer robotType, Integer readType) { Integer hasPdf, Integer robotType, Integer readType, String erpBookName) {
int count = customPlanMapper.getCustomPlanCount(content, useState, hasPdf,robotType, readType); List<Long> projectIds = erpConsr.getIdsByBookName(erpBookName);
int count = customPlanMapper.getCustomPlanCount(content, useState, hasPdf,robotType, readType, projectIds);
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, List<CustomPlan> customPlanList = customPlanMapper.listCustomPlanByPage(currentPage * numPerPage,
numPerPage, content, useState, hasPdf, robotType, readType); numPerPage, content, useState, hasPdf, robotType, readType, projectIds);
List<Long> bookIds = customPlanList.stream().filter(a -> null != a.getBookId()).map(a -> a.getBookId()).distinct().collect(Collectors.toList()); List<Long> bookIds = customPlanList.stream().filter(a -> null != a.getBookId()).map(a -> a.getBookId()).distinct().collect(Collectors.toList());
Map<Long, String> bookNameMap = new HashMap<>(); Map<Long, String> bookNameMap = new HashMap<>();
if(!ListUtils.isEmpty(bookIds)){ if(!ListUtils.isEmpty(bookIds)){
......
...@@ -72,4 +72,7 @@ public class CustomPlan { ...@@ -72,4 +72,7 @@ public class CustomPlan {
@ApiModelProperty("计划名称") @ApiModelProperty("计划名称")
private String taskName; private String taskName;
@ApiModelProperty("读书计划id")
private Integer pcloudSkillId;
} }
...@@ -91,8 +91,9 @@ public class CustomPlanFacade { ...@@ -91,8 +91,9 @@ public class CustomPlanFacade {
@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,
@RequestParam(value = "robotType", required = false) Integer robotType, @RequestParam(value = "robotType", required = false) Integer robotType,
@RequestParam(value = "readType", required = false) Integer readType) { @RequestParam(value = "readType", required = false) Integer readType,
return new ResponseDto<>(customPlanBiz.listCustomPlanByPage(currentPage, numPerPage, content, useState, hasPdf,robotType, readType)); @RequestParam(value = "erpBookName", required = false) String erpBookName) {
return new ResponseDto<>(customPlanBiz.listCustomPlanByPage(currentPage, numPerPage, content, useState, hasPdf,robotType, readType, erpBookName));
} }
@ApiOperation("编辑方案模块") @ApiOperation("编辑方案模块")
......
...@@ -22,11 +22,11 @@ public interface CustomPlanMapper { ...@@ -22,11 +22,11 @@ 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); @Param("robotType") Integer robotType, @Param("readType") Integer readType,@Param("projectIds") List<Long> projectIds);
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("robotType") Integer robotType, @Param("hasPdf") Integer hasPdf, @Param("robotType") Integer robotType,
@Param("readType") Integer readType); @Param("readType") Integer readType,@Param("projectIds") List<Long> projectIds);
int getPlanPaperCount(Map<String, Object> paramMap); int getPlanPaperCount(Map<String, Object> paramMap);
......
...@@ -49,6 +49,8 @@ public interface SelfRobotKeywordBiz { ...@@ -49,6 +49,8 @@ public interface SelfRobotKeywordBiz {
SelfRobotKeyword getById(Long id); SelfRobotKeyword getById(Long id);
RobotSkillDetail getSubscribeState(Integer skillId, String wxUserId,String robotWxId);
RobotSkillDetail getSkillDetail(Integer type, Integer relSkillId, String wxUserId,String robotWxId,Integer skillId ); RobotSkillDetail getSkillDetail(Integer type, Integer relSkillId, String wxUserId,String robotWxId,Integer skillId );
String confirmSkill(Integer id, Integer type, Integer relSkillId, String robotId, String wxUserId, Integer state); String confirmSkill(Integer id, Integer type, Integer relSkillId, String robotId, String wxUserId, Integer state);
......
...@@ -664,6 +664,15 @@ wechatGroupConsr.sendMessage(JSON.toJSONString(sendFileVO)); ...@@ -664,6 +664,15 @@ wechatGroupConsr.sendMessage(JSON.toJSONString(sendFileVO));
} }
@Override @Override
public RobotSkillDetail getSubscribeState(Integer skillId, String wxUserId,String robotWxId){
PcloudSkill pcloudSkill = pcloudSkillDao.getById(skillId);
if(pcloudSkill == null){
throw new BizException(BizException.DB_LIST_IS_NULL.getCode(),"订阅消息不存在");
}
return getSkillDetail(SkillTypeEnum.TIME_MANAGE.value, pcloudSkill.getRelSkillId().intValue(), wxUserId, robotWxId, skillId);
}
@Override
public RobotSkillDetail getSkillDetail(Integer type, Integer relSkillId, String wxUserId,String robotWxId,Integer skillId) { public RobotSkillDetail getSkillDetail(Integer type, Integer relSkillId, String wxUserId,String robotWxId,Integer skillId) {
if (null == type || null == relSkillId){ if (null == type || null == relSkillId){
throw new BizException(BizException.PARAM_IS_NULL.getCode(),"type为空或者relSkillId为空"); throw new BizException(BizException.PARAM_IS_NULL.getCode(),"type为空或者relSkillId为空");
......
...@@ -35,7 +35,12 @@ public enum ReplyTypeEnum { ...@@ -35,7 +35,12 @@ public enum ReplyTypeEnum {
/** /**
* 小程序 * 小程序
*/ */
PERSONALAPPLETS(7); PERSONALAPPLETS(7),
/**
* 群分类
*/
GROUP(8);
/** /**
* 值 * 值
*/ */
......
...@@ -113,6 +113,10 @@ public interface SelfRobotKeywordFacade { ...@@ -113,6 +113,10 @@ public interface SelfRobotKeywordFacade {
ResponseDto<?> getReplyByGuide(Integer type, Integer id, String robotId, String wxUserId); ResponseDto<?> getReplyByGuide(Integer type, Integer id, String robotId, String wxUserId);
@ApiOperation(value = "根据任务id获取任务详情", httpMethod = "GET") @ApiOperation(value = "根据任务id获取任务详情", httpMethod = "GET")
@GetMapping("getSubscribeState")
ResponseDto<?> getSubscribeState(Integer skillId,String wxUserId,String robotWxId);
@ApiOperation(value = "根据任务id获取任务详情", httpMethod = "GET")
@GetMapping("getSkillDetail") @GetMapping("getSkillDetail")
ResponseDto<?> getSkillDetail(Integer type, Integer relSkillId,String wxUserId,String robotWxId,Integer skillId); ResponseDto<?> getSkillDetail(Integer type, Integer relSkillId,String wxUserId,String robotWxId,Integer skillId);
......
...@@ -169,6 +169,13 @@ public class SelfRobotKeywordFacadeImpl implements SelfRobotKeywordFacade { ...@@ -169,6 +169,13 @@ public class SelfRobotKeywordFacadeImpl implements SelfRobotKeywordFacade {
} }
@Override @Override
@GetMapping("getSubscribeState")
public ResponseDto<?> getSubscribeState(@RequestParam Integer skillId,@RequestParam String wxUserId,@RequestParam String robotWxId) {
RobotSkillDetail robotSkillDetail = selfRobotKeywordBiz.getSubscribeState(skillId,wxUserId,robotWxId);
return new ResponseDto<>(robotSkillDetail);
}
@Override
@GetMapping("getSkillDetail") @GetMapping("getSkillDetail")
public ResponseDto<?> getSkillDetail(@RequestParam Integer type, @RequestParam Integer relSkillId,@RequestParam String wxUserId,@RequestParam String robotWxId,@RequestParam Integer skillId) { public ResponseDto<?> getSkillDetail(@RequestParam Integer type, @RequestParam Integer relSkillId,@RequestParam String wxUserId,@RequestParam String robotWxId,@RequestParam Integer skillId) {
RobotSkillDetail robotSkillDetail = selfRobotKeywordBiz.getSkillDetail(type, relSkillId,wxUserId,robotWxId,skillId); RobotSkillDetail robotSkillDetail = selfRobotKeywordBiz.getSkillDetail(type, relSkillId,wxUserId,robotWxId,skillId);
......
...@@ -7,6 +7,7 @@ import com.pcloud.book.skill.dto.UpdateActivityShowStateDTO; ...@@ -7,6 +7,7 @@ import com.pcloud.book.skill.dto.UpdateActivityShowStateDTO;
import com.pcloud.book.skill.entity.PcloudGroupActivity; import com.pcloud.book.skill.entity.PcloudGroupActivity;
import com.pcloud.book.skill.facade.request.SaveGroupActivityRequestVO; import com.pcloud.book.skill.facade.request.SaveGroupActivityRequestVO;
import com.pcloud.book.skill.facade.request.UpdateGroupActivityRequestVO; import com.pcloud.book.skill.facade.request.UpdateGroupActivityRequestVO;
import com.pcloud.book.skill.facade.response.ListGroupActivityResponseVO;
import com.pcloud.book.skill.facade.response.QueryGroupActivityResponseVO; import com.pcloud.book.skill.facade.response.QueryGroupActivityResponseVO;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
...@@ -45,6 +46,15 @@ public interface PcloudGroupActivityBiz { ...@@ -45,6 +46,15 @@ public interface PcloudGroupActivityBiz {
Long subjectLabelId ,Integer numPerPage, Integer currentPage); Long subjectLabelId ,Integer numPerPage, Integer currentPage);
/** /**
* 获取共读活动列表(弹窗)
* @param name
* @param joinType
* @param numPerPage
* @param currentPage
* @return
*/
PageBeanNew<ListGroupActivityResponseVO> listGroupActivity(String name, Integer joinType, Integer numPerPage, Integer currentPage);
/**
* 根据分类获取社群共读 * 根据分类获取社群共读
* @return * @return
*/ */
......
...@@ -10,7 +10,7 @@ public interface PcloudSkillBiz { ...@@ -10,7 +10,7 @@ public interface PcloudSkillBiz {
PcloudSkill getPcloudSkill(Long id); PcloudSkill getPcloudSkill(Long id);
PageBeanNew<PcloudSkill> getPcloudSkillList(Integer skillType, Integer currentPage, Integer numPerPage, String name); PageBeanNew<PcloudSkill> getPcloudSkillList(Integer skillType, Integer currentPage, Integer numPerPage, String name, String taskName);
void deletePcloudSkill(Long id); void deletePcloudSkill(Long id);
......
...@@ -42,12 +42,15 @@ import com.pcloud.book.skill.facade.request.GroupActivityClassifyVO; ...@@ -42,12 +42,15 @@ import com.pcloud.book.skill.facade.request.GroupActivityClassifyVO;
import com.pcloud.book.skill.facade.request.GroupActivityShowStateVO; import com.pcloud.book.skill.facade.request.GroupActivityShowStateVO;
import com.pcloud.book.skill.facade.request.SaveGroupActivityRequestVO; import com.pcloud.book.skill.facade.request.SaveGroupActivityRequestVO;
import com.pcloud.book.skill.facade.request.UpdateGroupActivityRequestVO; import com.pcloud.book.skill.facade.request.UpdateGroupActivityRequestVO;
import com.pcloud.book.skill.facade.response.ListGroupActivityResponseVO;
import com.pcloud.book.skill.facade.response.QueryGroupActivityResponseVO; import com.pcloud.book.skill.facade.response.QueryGroupActivityResponseVO;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam; import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.httpclient.UrlUtils;
import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.common.utils.ResponseHandleUtil; import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.common.utils.string.StringUtilParent; import com.pcloud.common.utils.string.StringUtilParent;
import com.pcloud.usercenter.party.adviser.entity.Adviser; import com.pcloud.usercenter.party.adviser.entity.Adviser;
...@@ -104,6 +107,10 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz { ...@@ -104,6 +107,10 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
private RightsSettingTitleMapper rightsSettingTitleMapper; private RightsSettingTitleMapper rightsSettingTitleMapper;
@Autowired @Autowired
private AppletGroupSearchRecordBiz appletGroupSearchRecordBiz; private AppletGroupSearchRecordBiz appletGroupSearchRecordBiz;
@Value("${wechat.group.link.prefix}")
private String wechatGroupLinkPrefix;
@Autowired
private BookDao bookDao;
@Autowired @Autowired
private BookClassifyBuyRecordDao bookClassifyBuyRecordDao; private BookClassifyBuyRecordDao bookClassifyBuyRecordDao;
private BookQrcodeUserDao bookQrcodeUserDao; private BookQrcodeUserDao bookQrcodeUserDao;
...@@ -262,8 +269,9 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz { ...@@ -262,8 +269,9 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
} }
//设置分类名称 //设置分类名称
setLabelContent(queryGroupActivity.getRecordList()); setLabelContent(queryGroupActivity.getRecordList());
// 截取字符串 // 处理属性值
for(QueryGroupActivityResponseVO vo : queryGroupActivity.getRecordList()){ for(QueryGroupActivityResponseVO vo : queryGroupActivity.getRecordList()){
// 截取字符串
String filterStr = StringUtilParent.replaceHtml(vo.getDesc()); String filterStr = StringUtilParent.replaceHtml(vo.getDesc());
String subStr = filterStr.length() > 60 ? filterStr.substring(0, 60) + "..." : filterStr; String subStr = filterStr.length() > 60 ? filterStr.substring(0, 60) + "..." : filterStr;
vo.setCutDesc(subStr); vo.setCutDesc(subStr);
...@@ -325,6 +333,36 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz { ...@@ -325,6 +333,36 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
} }
@Override @Override
public PageBeanNew<ListGroupActivityResponseVO> listGroupActivity(String name, Integer joinType, Integer numPerPage, Integer currentPage) {
PageParam pageParam = new PageParam(currentPage, numPerPage);
// 根据数命查bookid
List<Long> bookIds = new ArrayList<>();
if (!StringUtil.isEmpty(name)){
bookIds = bookDao.getBookIdsByBookName(name);
}
Map<String, Object> paraMap = Maps.newHashMap();
paraMap.put("name", StringUtil.isEmpty(name) ? null : name);
paraMap.put("bookIds", bookIds);
paraMap.put("joinType", joinType);
PageBeanNew<ListGroupActivityResponseVO> listGroupActivity = pcloudGroupActivityDao.listPageNew(pageParam, paraMap, "listGroupActivity");
if (null == listGroupActivity || CollectionUtils.isEmpty(listGroupActivity.getRecordList())) {
return listGroupActivity;
}
for(ListGroupActivityResponseVO vo : listGroupActivity.getRecordList()){
if(vo.getGroupType() != null && vo.getGroupType() == 0){
// 处理群分类短连接
String groupClassifyUrl = wechatGroupLinkPrefix + "/group/info2?classify_id=" + vo.getClassifyId() + "&book_group_id=" + vo.getBookGroupId();
vo.setGroupClassifyUrl(UrlUtils.getShortUrl4Own(groupClassifyUrl));
}
if(!StringUtil.isEmpty(vo.getDescription())){
String filterStr = StringUtilParent.replaceHtml(vo.getDescription());
vo.setCutDescription(filterStr.length() > 60 ? filterStr.substring(0, 60) + "..." : filterStr);
}
}
return listGroupActivity;
}
@Override
public GroupActivity4AppletDTO getGroupActivity4Applet(Long rightSettingId, Long adviserId, Long bookId, Long channelId, Integer readType) { public GroupActivity4AppletDTO getGroupActivity4Applet(Long rightSettingId, Long adviserId, Long bookId, Long channelId, Integer readType) {
BookDto adviserBook = bookBiz.getAdviserBook(bookId, adviserId, channelId); BookDto adviserBook = bookBiz.getAdviserBook(bookId, adviserId, channelId);
BookDto dto = Optional.ofNullable(adviserBook).orElseThrow(() -> new BookBizException(BookBizException.ID_NOT_EXIST, "未找到相关书刊")); BookDto dto = Optional.ofNullable(adviserBook).orElseThrow(() -> new BookBizException(BookBizException.ID_NOT_EXIST, "未找到相关书刊"));
...@@ -369,6 +407,7 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz { ...@@ -369,6 +407,7 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
if (ListUtils.isEmpty(ids)) { if (ListUtils.isEmpty(ids)) {
return new HashMap<>(); return new HashMap<>();
} }
Map<Long, GroupActivity4AppletDTO> mapDto = pcloudGroupActivityDao.getByIds(ids, 1);
List<Long> activityGroupIds = new ArrayList<>(); List<Long> activityGroupIds = new ArrayList<>();
List<Long> adviserGroupIds = rightsSettingItemDetailDao.getAdviserGroupIds(ids); List<Long> adviserGroupIds = rightsSettingItemDetailDao.getAdviserGroupIds(ids);
if (!ListUtils.isEmpty(adviserGroupIds)) { if (!ListUtils.isEmpty(adviserGroupIds)) {
...@@ -388,7 +427,7 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz { ...@@ -388,7 +427,7 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
editDtoThree = pcloudGroupActivityDao.getGroupClassifyByIds(adviserGroupIds); //查询第编辑端群 editDtoThree = pcloudGroupActivityDao.getGroupClassifyByIds(adviserGroupIds); //查询第编辑端群
} }
if (!ListUtils.isEmpty(activityGroupIds)) { if (!ListUtils.isEmpty(activityGroupIds)) {
localMap = pcloudGroupActivityDao.getByIds(activityGroupIds); localMap = pcloudGroupActivityDao.getByIds(activityGroupIds, 1);
} }
if (MapUtils.isNotEmpty(localMap)) { if (MapUtils.isNotEmpty(localMap)) {
mapDto.putAll(localMap); mapDto.putAll(localMap);
......
...@@ -124,7 +124,7 @@ public class PcloudSkillBizImpl implements PcloudSkillBiz { ...@@ -124,7 +124,7 @@ public class PcloudSkillBizImpl implements PcloudSkillBiz {
@ParamLog("获取技能列表") @ParamLog("获取技能列表")
@Override @Override
public PageBeanNew<PcloudSkill> getPcloudSkillList(Integer skillType, Integer currentPage, Integer numPerPage, String name) { public PageBeanNew<PcloudSkill> getPcloudSkillList(Integer skillType, Integer currentPage, Integer numPerPage, String name, String taskName) {
if (currentPage == null || currentPage < 0) { if (currentPage == null || currentPage < 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "当前页不能为空且不能小于0!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "当前页不能为空且不能小于0!");
} }
...@@ -134,6 +134,7 @@ public class PcloudSkillBizImpl implements PcloudSkillBiz { ...@@ -134,6 +134,7 @@ public class PcloudSkillBizImpl implements PcloudSkillBiz {
Map<String ,Object> map=new HashMap<>(); Map<String ,Object> map=new HashMap<>();
map.put("skillType",skillType); map.put("skillType",skillType);
map.put("name", name); map.put("name", name);
map.put("taskName", taskName);
PageBeanNew<PcloudSkill> page = pcloudSkillDao.listPageNew(new PageParam(currentPage, numPerPage), map, "getPcloudSkillList"); PageBeanNew<PcloudSkill> page = pcloudSkillDao.listPageNew(new PageParam(currentPage, numPerPage), map, "getPcloudSkillList");
if (ListUtils.isEmpty(page.getRecordList())){ if (ListUtils.isEmpty(page.getRecordList())){
return page; return page;
......
...@@ -28,7 +28,7 @@ public interface PcloudGroupActivityDao extends BaseDao<PcloudGroupActivity> { ...@@ -28,7 +28,7 @@ public interface PcloudGroupActivityDao extends BaseDao<PcloudGroupActivity> {
List<GroupActivity4AppletDTO> getTishBookSchoolList(BaseTempletClassify baseTempletClassify, Integer limit); List<GroupActivity4AppletDTO> getTishBookSchoolList(BaseTempletClassify baseTempletClassify, Integer limit);
Map<Long, GroupActivity4AppletDTO> getByIds(List<Long> ids); Map<Long, GroupActivity4AppletDTO> getByIds(List<Long> ids, Integer isShow);
Map<Long, GroupActivity4AppletDTO> getGroupClassifyByIds(List<Long> ids); Map<Long, GroupActivity4AppletDTO> getGroupClassifyByIds(List<Long> ids);
......
...@@ -78,8 +78,11 @@ public class PcloudGroupActivityDaoImpl extends BaseDaoImpl<PcloudGroupActivity> ...@@ -78,8 +78,11 @@ public class PcloudGroupActivityDaoImpl extends BaseDaoImpl<PcloudGroupActivity>
} }
@Override @Override
public Map<Long, GroupActivity4AppletDTO> getByIds(List<Long> list) { public Map<Long, GroupActivity4AppletDTO> getByIds(List<Long> list, Integer isShow) {
return super.getSqlSession().selectMap(getStatement("getByIds"), list,"id"); Map<String, Object> map = new HashMap<>();
map.put("list", list);
map.put("isShow", isShow);
return super.getSqlSession().selectMap(getStatement("getByIds"), map,"id");
} }
@Override @Override
......
...@@ -6,6 +6,7 @@ import com.pcloud.book.skill.facade.request.GroupActivityClassifyVO; ...@@ -6,6 +6,7 @@ import com.pcloud.book.skill.facade.request.GroupActivityClassifyVO;
import com.pcloud.book.skill.facade.request.GroupActivityShowStateVO; import com.pcloud.book.skill.facade.request.GroupActivityShowStateVO;
import com.pcloud.book.skill.facade.request.SaveGroupActivityRequestVO; import com.pcloud.book.skill.facade.request.SaveGroupActivityRequestVO;
import com.pcloud.book.skill.facade.request.UpdateGroupActivityRequestVO; import com.pcloud.book.skill.facade.request.UpdateGroupActivityRequestVO;
import com.pcloud.book.skill.facade.response.ListGroupActivityResponseVO;
import com.pcloud.book.skill.facade.response.QueryGroupActivityResponseVO; import com.pcloud.book.skill.facade.response.QueryGroupActivityResponseVO;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
...@@ -69,6 +70,15 @@ public class PcloudGroupActivityFacade { ...@@ -69,6 +70,15 @@ public class PcloudGroupActivityFacade {
return new ResponseDto<>(pcloudGroupActivityBiz.queryGroupActivity(name, proLabelId, purLabelId, depLabelId, joinType,firstClassify,secondClassify, gradeLabelId,subjectLabelId,numPerPage, currentPage)); return new ResponseDto<>(pcloudGroupActivityBiz.queryGroupActivity(name, proLabelId, purLabelId, depLabelId, joinType,firstClassify,secondClassify, gradeLabelId,subjectLabelId,numPerPage, currentPage));
} }
@ApiOperation("获取共读活动列表(弹窗)")
@GetMapping("listGroupActivity")
public ResponseDto<PageBeanNew<ListGroupActivityResponseVO>> listGroupActivity(@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "joinType", required = false) Integer joinType,
@RequestParam("numPerPage") Integer numPerPage,
@RequestParam("currentPage") Integer currentPage){
return new ResponseDto<>(pcloudGroupActivityBiz.listGroupActivity(name, joinType, numPerPage, currentPage));
}
@PostMapping("updateActivityShowState") @PostMapping("updateActivityShowState")
public ResponseDto<Void> updateActivityShowState(@RequestHeader("token") String token, @RequestBody UpdateActivityShowStateDTO showStateDTO) throws PermissionException { public ResponseDto<Void> updateActivityShowState(@RequestHeader("token") String token, @RequestBody UpdateActivityShowStateDTO showStateDTO) throws PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID); SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
......
...@@ -59,10 +59,11 @@ public class PcloudSkillFacade { ...@@ -59,10 +59,11 @@ public class PcloudSkillFacade {
@RequestParam(value = "skillType", required = false) @ApiParam("技能类型:1时间管理,2共读活动,3配套资料,4教辅书单,5配套老师,6音乐") Integer skillType, @RequestParam(value = "skillType", required = false) @ApiParam("技能类型:1时间管理,2共读活动,3配套资料,4教辅书单,5配套老师,6音乐") Integer skillType,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage, @RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage, @RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage,
@RequestParam(value = "name", required = false) @ApiParam("名称搜索")String name @RequestParam(value = "name", required = false) @ApiParam("名称搜索")String name,
@RequestParam(value = "taskName", required = false) @ApiParam("任务名搜索")String taskName
) throws BizException, PermissionException { ) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID); SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(pcloudSkillBiz.getPcloudSkillList(skillType,currentPage,numPerPage,name)); return new ResponseDto<>(pcloudSkillBiz.getPcloudSkillList(skillType,currentPage,numPerPage,name, taskName));
} }
@ApiOperation("获取技能列表-关联关键词选择") @ApiOperation("获取技能列表-关联关键词选择")
......
...@@ -40,4 +40,14 @@ public class ListGroupActivityResponseVO implements Serializable { ...@@ -40,4 +40,14 @@ public class ListGroupActivityResponseVO implements Serializable {
@ApiModelProperty("共读群分类描述") @ApiModelProperty("共读群分类描述")
private String cutDescription; private String cutDescription;
@ApiModelProperty("编号")
private String number;
@ApiModelProperty("第三方群类型")
private Integer groupType;
@ApiModelProperty("第三方群链接")
private String groupExtLink;
} }
...@@ -71,4 +71,6 @@ public interface TaskBiz { ...@@ -71,4 +71,6 @@ public interface TaskBiz {
void updateSendState4Week(); void updateSendState4Week();
void updateTaskSendType(TimeControlTask taskDto); void updateTaskSendType(TimeControlTask taskDto);
void copyTimeControlTask(Integer taskId);
} }
...@@ -3,6 +3,8 @@ package com.pcloud.book.timecontrol.biz.impl; ...@@ -3,6 +3,8 @@ package com.pcloud.book.timecontrol.biz.impl;
import static com.pcloud.book.guide.constant.PcloudGuideRedisConstant.PCLOUD_WAKE_UP_CRON_JOB; import static com.pcloud.book.guide.constant.PcloudGuideRedisConstant.PCLOUD_WAKE_UP_CRON_JOB;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.dcg.util.MapUtils;
import com.google.common.collect.Lists;
import com.pcloud.appcenter.app.dto.AppDto; import com.pcloud.appcenter.app.dto.AppDto;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.constant.BookConstant; import com.pcloud.book.book.constant.BookConstant;
...@@ -15,7 +17,9 @@ import com.pcloud.book.group.biz.WeixinQrcodeBiz; ...@@ -15,7 +17,9 @@ import com.pcloud.book.group.biz.WeixinQrcodeBiz;
import com.pcloud.book.group.enums.AppAndProductTypeEnum; import com.pcloud.book.group.enums.AppAndProductTypeEnum;
import com.pcloud.book.group.tools.SendWeixinRequestTools; import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.keywords.enums.ReplyTypeEnum; import com.pcloud.book.keywords.enums.ReplyTypeEnum;
import com.pcloud.book.skill.dao.PcloudGroupActivityDao;
import com.pcloud.book.skill.dao.PcloudSkillDao; import com.pcloud.book.skill.dao.PcloudSkillDao;
import com.pcloud.book.skill.dto.GroupActivity4AppletDTO;
import com.pcloud.book.skill.entity.PcloudSkill; import com.pcloud.book.skill.entity.PcloudSkill;
import com.pcloud.book.skill.enums.SkillTypeEnum; import com.pcloud.book.skill.enums.SkillTypeEnum;
import com.pcloud.book.timecontrol.biz.TaskBiz; import com.pcloud.book.timecontrol.biz.TaskBiz;
...@@ -77,6 +81,7 @@ import org.slf4j.Logger; ...@@ -77,6 +81,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -147,6 +152,11 @@ public class TaskBizImpl implements TaskBiz { ...@@ -147,6 +152,11 @@ public class TaskBizImpl implements TaskBiz {
private ScheduleService scheduleService; private ScheduleService scheduleService;
@Autowired @Autowired
private TimeControlTaskItemWeekMapper timeControlTaskItemWeekMapper; private TimeControlTaskItemWeekMapper timeControlTaskItemWeekMapper;
@Value("${wechat.group.link.prefix}")
private String wechatGroupLinkPrefix;
@Autowired
private PcloudGroupActivityDao pcloudGroupActivityDao;
@Override @Override
public Integer createTask(CreateTaskDto createTaskDto) { public Integer createTask(CreateTaskDto createTaskDto) {
...@@ -812,7 +822,7 @@ public class TaskBizImpl implements TaskBiz { ...@@ -812,7 +822,7 @@ public class TaskBizImpl implements TaskBiz {
sendTextMessageVO.setCounts(counts); sendTextMessageVO.setCounts(counts);
sendTextMessageVO.setMessageGroupId(groupId); sendTextMessageVO.setMessageGroupId(groupId);
sendTextMessageVO.setRobotProcessType(RobotProcessTypeEnum.TIME_CONTROL); sendTextMessageVO.setRobotProcessType(RobotProcessTypeEnum.TIME_CONTROL);
wechatGroupConsr.sendMessage(JSON.toJSONString(sendTextMessageVO));; wechatGroupConsr.sendMessage(JSON.toJSONString(sendTextMessageVO));
} else if (ReplyTypeEnum.IMAGE.value.equals(replyType)) { } else if (ReplyTypeEnum.IMAGE.value.equals(replyType)) {
// 发送图片 // 发送图片
SendPicMessageVO sendPicMessageVO = new SendPicMessageVO(); SendPicMessageVO sendPicMessageVO = new SendPicMessageVO();
...@@ -895,6 +905,31 @@ public class TaskBizImpl implements TaskBiz { ...@@ -895,6 +905,31 @@ public class TaskBizImpl implements TaskBiz {
sendArticleMessageVO.setMessageGroupId(groupId); sendArticleMessageVO.setMessageGroupId(groupId);
sendArticleMessageVO.setRobotProcessType(RobotProcessTypeEnum.TIME_CONTROL); sendArticleMessageVO.setRobotProcessType(RobotProcessTypeEnum.TIME_CONTROL);
wechatGroupConsr.sendMessage(JSON.toJSONString(sendArticleMessageVO)); wechatGroupConsr.sendMessage(JSON.toJSONString(sendArticleMessageVO));
} else if (ReplyTypeEnum.GROUP.value.equals(replyType)){
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
Map<Long, GroupActivity4AppletDTO> mapGroupActivity = pcloudGroupActivityDao.getByIds(Lists.newArrayList(replyMessage.getServeId()), null);
if(MapUtils.isEmpty(mapGroupActivity)) {
continue;
}
GroupActivity4AppletDTO groupActivity4AppletDTO = mapGroupActivity.values().stream().findFirst().get();
if(groupActivity4AppletDTO.getGroupType() == 0){
String groupClassifyUrl = wechatGroupLinkPrefix + "/group/info2?classify_id=" + groupActivity4AppletDTO.getClassifyId() + "&book_group_id=" + groupActivity4AppletDTO.getBookGroupId();
sendTextMessageVO.setContent(groupActivity4AppletDTO.getName() + ":"+ UrlUtils.getShortUrl4Own(groupClassifyUrl));
} else if (groupActivity4AppletDTO.getGroupType() == 1) {
sendTextMessageVO.setContent(groupActivity4AppletDTO.getName() + ":"+ UrlUtils.getShortUrl4Own(groupActivity4AppletDTO.getGroupLink()));
} else {
continue;
}
sendTextMessageVO.setCode(SendMessageTypeEnum.SELF.getCode());
sendTextMessageVO.setWxId(robotWxId);
sendTextMessageVO.setAltId(robotWxId);
sendTextMessageVO.setWxGroupId(wxUserId);
sendTextMessageVO.setIp(ip);
sendTextMessageVO.setIndex(i);
sendTextMessageVO.setCounts(counts);
sendTextMessageVO.setMessageGroupId(groupId);
sendTextMessageVO.setRobotProcessType(RobotProcessTypeEnum.TIME_CONTROL);
wechatGroupConsr.sendMessage(JSON.toJSONString(sendTextMessageVO));;
} }
} }
} }
...@@ -987,4 +1022,132 @@ public class TaskBizImpl implements TaskBiz { ...@@ -987,4 +1022,132 @@ public class TaskBizImpl implements TaskBiz {
}); });
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void copyTimeControlTask(Integer taskId) {
// 复制基本信息
TimeControlTask timeControlTask = taskMapper.selectByPrimaryKey(taskId);
taskMapper.insert(timeControlTask);
Integer newTaskId = timeControlTask.getTaskId();
// 复制消息配置
this.copyTimeControlTaskItem(taskId, newTaskId);
}
/**
* 复制消息配置
* @param oldTaskId
* @param newTaskId
*/
private void copyTimeControlTaskItem(Integer oldTaskId, Integer newTaskId) {
List<TimeControlTaskItem> taskItems = taskItemMapper.getByTaskId(oldTaskId);
if(ListUtils.isEmpty(taskItems)){
return;
}
List<Integer> taskItemIds = taskItems.stream().map(x -> x.getId()).collect(Collectors.toList());
// 查询所有的回复、奖励(累计)、奖励(单次)、奖励详情
List<TimeControlWeekDay> allTaskItemList = taskItemWeekMapper.getByTaskItemIds(taskItemIds);
List<TimeControlReplyMessage> allReplyMessageList = replyMessageMapper.getByTaskId(oldTaskId);
TimeControlTaskPrize totalTaskPrize = taskPrizeMapper.getByTaskId(oldTaskId, TaskPrizeTypeEnum.GRAND_TOTAL.key);
List<TimeControlTaskPrize> allTaskPrizeList = taskPrizeMapper.listByTaskId(oldTaskId, TaskPrizeTypeEnum.SINGLE.key);
List<TimeControlPrizeItem> allTaskPrizeItemList = taskPrizeItemMapper.getByTaskId(oldTaskId);
Integer oldTaskItemId;
Integer newTaskItemId;
for (TimeControlTaskItem taskItem : taskItems) {
oldTaskItemId = taskItem.getId();
taskItem.setTaskId(newTaskId);
taskItemMapper.insert(taskItem);
newTaskItemId = taskItem.getId();
// 复制周
this.copyTimeControlTaskItemWeek(oldTaskItemId, newTaskItemId, allTaskItemList);
// 复制回复
this.copyTimeControlReplyMessage(oldTaskItemId, newTaskItemId, newTaskId, allReplyMessageList);
// 复制奖励(单次奖励)
this.copyTimeControlTaskPrize(oldTaskItemId, newTaskItemId, newTaskId, allTaskPrizeList, allTaskPrizeItemList);
}
if(totalTaskPrize!=null){
// 复制奖励(累计)
totalTaskPrize.setTaskId(newTaskId);
taskPrizeMapper.insert(totalTaskPrize);
}
}
/**
* 复制奖励配置
* @param oldTaskItemId
* @param newTaskItemId
*/
private void copyTimeControlTaskItemWeek(Integer oldTaskItemId, Integer newTaskItemId, List<TimeControlWeekDay> allTaskItemList) {
List<TimeControlWeekDay> timeControlWeekDays = allTaskItemList.stream().filter(x-> oldTaskItemId.equals(x.getTaskItemId())).collect(Collectors.toList());
if (!ListUtils.isEmpty(timeControlWeekDays)) {
timeControlWeekDays.forEach(x -> {
x.setTaskItemId(newTaskItemId);
});
taskItemWeekMapper.batchInsert(timeControlWeekDays);
}
}
/**
* 复制回复消息
* @param oldTaskItemId
* @param newTaskId
* @param newTaskItemId
*/
private void copyTimeControlReplyMessage(Integer oldTaskItemId, Integer newTaskItemId, Integer newTaskId,
List<TimeControlReplyMessage> allReplyMessageList) {
List<TimeControlReplyMessage> replyMessages = allReplyMessageList.stream().filter(x-> oldTaskItemId.equals(x.getTaskItemId())).collect(Collectors.toList());
if (!ListUtils.isEmpty(replyMessages)) {
for (TimeControlReplyMessage replyMessage : replyMessages) {
replyMessage.setTaskId(newTaskId);
replyMessage.setTaskItemId(newTaskItemId);
}
replyMessageMapper.batchInsert(replyMessages);
}
}
/**
* 复制奖励设置
* @param oldTaskItemId
* @param newTaskItemId
* @param newTaskId
* @param allTaskPrizeList
* @param allTaskPrizeItemList
*/
private void copyTimeControlTaskPrize(Integer oldTaskItemId, Integer newTaskItemId, Integer newTaskId,
List<TimeControlTaskPrize> allTaskPrizeList,
List<TimeControlPrizeItem> allTaskPrizeItemList) {
List<TimeControlTaskPrize> taskPrizeList = allTaskPrizeList.stream().filter(x -> oldTaskItemId.equals(x.getTaskItemId())).collect(Collectors.toList());
if (!ListUtils.isEmpty(taskPrizeList)) {
for (TimeControlTaskPrize taskPrize : taskPrizeList) {
Integer oldPrizeId = taskPrize.getId();
taskPrize.setTaskId(newTaskId);
taskPrize.setTaskItemId(newTaskItemId);
taskPrizeMapper.insert(taskPrize);
Integer newPrizeId = taskPrize.getId();
// 复制子项
this.copyTimeControlTaskPrizeItem( newTaskItemId, newTaskId, oldPrizeId, newPrizeId, allTaskPrizeItemList);
}
}
}
/**
* 复制奖励详情
* @param newTaskItemId
* @param newTaskId
* @param oldPrizeId
* @param newPrizeId
* @param allTaskPrizeItemList
*/
private void copyTimeControlTaskPrizeItem(Integer newTaskItemId, Integer newTaskId, Integer oldPrizeId, Integer newPrizeId,
List<TimeControlPrizeItem> allTaskPrizeItemList) {
List<TimeControlPrizeItem> prizeItemList = allTaskPrizeItemList.stream().filter(x-> oldPrizeId.equals(x.getPrizeId())).collect(Collectors.toList());
if (!ListUtils.isEmpty(prizeItemList)) {
for (TimeControlPrizeItem prizeItem : prizeItemList) {
prizeItem.setTaskId(newTaskId);
prizeItem.setTaskItemId(newTaskItemId);
prizeItem.setPrizeId(newPrizeId);
}
taskPrizeItemMapper.batchInsert(prizeItemList);
}
}
} }
...@@ -187,4 +187,12 @@ public class TimeControlTaskFacadeImpl { ...@@ -187,4 +187,12 @@ public class TimeControlTaskFacadeImpl {
taskBiz.updateTaskSendType(timeControlTask); taskBiz.updateTaskSendType(timeControlTask);
return new ResponseDto<>(); return new ResponseDto<>();
} }
@GetMapping("copyTimeControlTask")
@ApiOperation(value = "复制", httpMethod = "GET")
ResponseDto<?> copyTimeControlTask(@RequestHeader("token") String token, @RequestParam("taskId") Integer taskId){
SessionUtil.getToken4Redis(token);
taskBiz.copyTimeControlTask(taskId);
return new ResponseDto<>();
}
} }
...@@ -46,4 +46,6 @@ public interface TaskPrizeItemMapper { ...@@ -46,4 +46,6 @@ public interface TaskPrizeItemMapper {
* @param deleteTypes * @param deleteTypes
*/ */
void deleteByTaskItemId(@Param("taskItemId") Integer taskItemId, @Param("deleteTypes") List<Integer> deleteTypes); void deleteByTaskItemId(@Param("taskItemId") Integer taskItemId, @Param("deleteTypes") List<Integer> deleteTypes);
List<TimeControlPrizeItem> getByTaskId(Integer taskId);
} }
...@@ -26,6 +26,8 @@ public interface TaskPrizeMapper { ...@@ -26,6 +26,8 @@ public interface TaskPrizeMapper {
*/ */
TimeControlTaskPrize getByTaskId(@Param("taskId") Integer taskId, @Param("type") Integer type); TimeControlTaskPrize getByTaskId(@Param("taskId") Integer taskId, @Param("type") Integer type);
List<TimeControlTaskPrize> listByTaskId(@Param("taskId") Integer taskId, @Param("type") Integer type);
int updateByPrimaryKeySelective(TimeControlTaskPrize model); int updateByPrimaryKeySelective(TimeControlTaskPrize model);
/** /**
...@@ -63,4 +65,5 @@ public interface TaskPrizeMapper { ...@@ -63,4 +65,5 @@ public interface TaskPrizeMapper {
TimeControlTaskPrize getByTaskItemId(Integer taskItemId); TimeControlTaskPrize getByTaskItemId(Integer taskItemId);
TimeControlTaskPrize getByType(@Param("id") Integer id, @Param("type") Integer type); TimeControlTaskPrize getByType(@Param("id") Integer id, @Param("type") Integer type);
} }
...@@ -30,5 +30,7 @@ public interface TimeControlReplyMessageMapper { ...@@ -30,5 +30,7 @@ public interface TimeControlReplyMessageMapper {
List<TimeControlReplyMessage> getByTaskItemId(Integer taskItemId); List<TimeControlReplyMessage> getByTaskItemId(Integer taskItemId);
List<TimeControlReplyMessage> getByTaskId(Integer taskId);
List<ReplyMessageDto> list4TaskItemList(@Param("taskItemIds") List<Integer> taskItemIds, @Param("type") Integer type); List<ReplyMessageDto> list4TaskItemList(@Param("taskItemIds") List<Integer> taskItemIds, @Param("type") Integer type);
} }
...@@ -32,6 +32,8 @@ public interface TimeControlTaskItemMapper { ...@@ -32,6 +32,8 @@ public interface TimeControlTaskItemMapper {
List<TimeControlTaskItem> listByTaskId(Integer taskId); List<TimeControlTaskItem> listByTaskId(Integer taskId);
List<TimeControlTaskItem> getByTaskId(Integer taskId);
Date getMaxEndTime(Integer taskId); Date getMaxEndTime(Integer taskId);
void deleteByTaskId(Integer taskId); void deleteByTaskId(Integer taskId);
......
...@@ -21,4 +21,6 @@ public interface TimeControlTaskItemWeekMapper { ...@@ -21,4 +21,6 @@ public interface TimeControlTaskItemWeekMapper {
Integer getMaxWeekDay(Integer taskItemId); Integer getMaxWeekDay(Integer taskItemId);
void batchDelete(List<Integer> taskItemIds); void batchDelete(List<Integer> taskItemIds);
List<TimeControlWeekDay> getByTaskItemIds(@Param("taskItemIds") List<Integer> taskItemIds);
} }
...@@ -25,13 +25,14 @@ ...@@ -25,13 +25,14 @@
<result column="rights_pic" jdbcType="VARCHAR" property="rightsPic" /> <result column="rights_pic" jdbcType="VARCHAR" property="rightsPic" />
<result column="button_name" jdbcType="VARCHAR" property="buttonName" /> <result column="button_name" jdbcType="VARCHAR" property="buttonName" />
<result column="custom_time_control_id" jdbcType="INTEGER" property="customTimeControlId" /> <result column="custom_time_control_id" jdbcType="INTEGER" property="customTimeControlId" />
<result column="pcloud_skill_id" property="pcloudSkillId" jdbcType="BIGINT"/>
</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, confirm_feedback_reply,robot_type,book_id,read_type,rights_pic,button_name, update_time, confirm_feedback_reply,robot_type,book_id,read_type,rights_pic,button_name,
custom_time_control_id custom_time_control_id,pcloud_skill_id
</sql> </sql>
<insert id="insert" parameterType="CustomPlan" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" parameterType="CustomPlan" useGeneratedKeys="true" keyProperty="id">
...@@ -40,12 +41,12 @@ ...@@ -40,12 +41,12 @@
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, confirm_feedback_reply,robot_type, create_time, update_time, confirm_feedback_reply,robot_type,
book_id,read_type,rights_pic,button_name,custom_time_control_id) book_id,read_type,rights_pic,button_name,custom_time_control_id,pcloud_skill_id)
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(), #{confirmFeedbackReply},#{robotType},#{bookId},#{readType},#{rightsPic},#{buttonName},#{customTimeControlId}) NOW(), NOW(), #{confirmFeedbackReply},#{robotType},#{bookId},#{readType},#{rightsPic},#{buttonName},#{customTimeControlId},#{pcloudSkillId})
</insert> </insert>
<update id="update" parameterType="CustomPlan"> <update id="update" parameterType="CustomPlan">
...@@ -108,6 +109,9 @@ ...@@ -108,6 +109,9 @@
<if test="customTimeControlId != null"> <if test="customTimeControlId != null">
custom_time_control_id = #{customTimeControlId}, custom_time_control_id = #{customTimeControlId},
</if> </if>
<if test="pcloudSkillId != null">
pcloud_skill_id = #{pcloudSkillId},
</if>
update_time = NOW() update_time = NOW()
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
...@@ -148,6 +152,12 @@ ...@@ -148,6 +152,12 @@
<if test="readType != null"> <if test="readType != null">
AND a.read_type = #{readType} AND a.read_type = #{readType}
</if> </if>
<if test="projectIds != null and projectIds.size() > 0">
AND a.book_id IN
<foreach collection="projectIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</if>
</select> </select>
<select id="listCustomPlanByPage" resultMap="BaseResultMap"> <select id="listCustomPlanByPage" resultMap="BaseResultMap">
...@@ -176,6 +186,12 @@ ...@@ -176,6 +186,12 @@
<if test="readType != null"> <if test="readType != null">
AND a.read_type = #{readType} AND a.read_type = #{readType}
</if> </if>
<if test="projectIds != null and projectIds.size() > 0">
AND a.book_id IN
<foreach collection="projectIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</if>
GROUP BY a.id GROUP BY a.id
ORDER BY a.update_time DESC ORDER BY a.update_time DESC
LIMIT #{pageNum}, #{numPerPage} LIMIT #{pageNum}, #{numPerPage}
......
...@@ -241,8 +241,6 @@ ...@@ -241,8 +241,6 @@
LIMIT #{limit} LIMIT #{limit}
</select> </select>
<select id="getById" resultMap="BaseResultMap" parameterType="long" > <select id="getById" resultMap="BaseResultMap" parameterType="long" >
SELECT SELECT
a.id, a.id,
......
...@@ -94,7 +94,10 @@ ...@@ -94,7 +94,10 @@
r.`name` like concat('%', #{name}, '%') r.`name` like concat('%', #{name}, '%')
) )
</if> </if>
order by s.seq_num <if test="taskName != null">
and t.task_name like concat('%', #{taskName}, '%')
</if>
order by s.seq_num DESC,s.create_time DESC
</select> </select>
<update id="updateSeqNum" parameterType="map"> <update id="updateSeqNum" parameterType="map">
......
...@@ -274,6 +274,12 @@ ...@@ -274,6 +274,12 @@
from time_control_task_prize_item where prize_id = #{prizeId} from time_control_task_prize_item where prize_id = #{prizeId}
</select> </select>
<select id="getByTaskId" parameterType="int" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from time_control_task_prize_item
where task_id = #{taskId}
</select>
<delete id="deleteByTaskItemId" parameterType="map"> <delete id="deleteByTaskItemId" parameterType="map">
delete from time_control_task_prize_item where task_item_id = #{taskItemId} delete from time_control_task_prize_item where task_item_id = #{taskItemId}
<if test="deleteTypes != null and deleteTypes.size > 0"> <if test="deleteTypes != null and deleteTypes.size > 0">
......
...@@ -32,6 +32,13 @@ ...@@ -32,6 +32,13 @@
where task_id = #{taskId,jdbcType=INTEGER} AND type = #{type,jdbcType=INTEGER} where task_id = #{taskId,jdbcType=INTEGER} AND type = #{type,jdbcType=INTEGER}
</select> </select>
<select id="listByTaskId" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from time_control_task_prize
where task_id = #{taskId,jdbcType=INTEGER} AND type = #{type,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from time_control_task_prize delete from time_control_task_prize
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
values (#{id,jdbcType=INTEGER}, #{taskItemId,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, values (#{id,jdbcType=INTEGER}, #{taskItemId,jdbcType=INTEGER}, #{type,jdbcType=INTEGER},
#{replyType,jdbcType=VARCHAR}, #{serveId,jdbcType=INTEGER}, #{resourceId,jdbcType=INTEGER}, #{replyType,jdbcType=VARCHAR}, #{serveId,jdbcType=INTEGER}, #{resourceId,jdbcType=INTEGER},
#{picUrl,jdbcType=VARCHAR}, #{serveType,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{picUrl,jdbcType=VARCHAR}, #{serveType,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}) NOW(), NOW())
</insert> </insert>
<insert id="batchInsert"> <insert id="batchInsert">
...@@ -75,6 +75,13 @@ ...@@ -75,6 +75,13 @@
where task_item_id = #{taskItemId,jdbcType=INTEGER} where task_item_id = #{taskItemId,jdbcType=INTEGER}
</select> </select>
<select id="getByTaskId" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from time_control_reply_message
where task_id = #{taskId,jdbcType=INTEGER}
</select>
<select id="list4TaskItemList" resultType="com.pcloud.book.timecontrol.dto.ReplyMessageDto"> <select id="list4TaskItemList" resultType="com.pcloud.book.timecontrol.dto.ReplyMessageDto">
select select
task_item_id taskItemId, task_item_id taskItemId,
......
...@@ -135,6 +135,14 @@ ...@@ -135,6 +135,14 @@
task_id = #{taskId} task_id = #{taskId}
</select> </select>
<select id="getByTaskId" parameterType="Integer" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM
time_control_task_item
WHERE
task_id = #{taskId}
</select>
<select id="getMaxEndTime" parameterType="Integer" resultType="date"> <select id="getMaxEndTime" parameterType="Integer" resultType="date">
select select
max(end_time) max(end_time)
......
...@@ -45,6 +45,16 @@ ...@@ -45,6 +45,16 @@
where task_item_id = #{taskItemId} where task_item_id = #{taskItemId}
</select> </select>
<select id="getByTaskItemIds" resultMap="BaseResultMap" parameterType="list" >
select
<include refid="Base_Column_List" />
from time_control_task_item_week
where task_item_id IN
<foreach collection="taskItemIds" item="taskItemId" open="(" close=")" separator=",">
#{taskItemId}
</foreach>
</select>
<select id="getMaxWeekDay" parameterType="integer" resultType="integer"> <select id="getMaxWeekDay" parameterType="integer" resultType="integer">
select select
max(week_day) max(week_day)
......
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