Commit 8a85c970 by zhangdongwei-intern

打卡旧数据出来

parent a60a1072
......@@ -28,5 +28,7 @@ public interface BookClockInfoService {
@RequestMapping(value = "/dealOldData4WeixinClock", method = RequestMethod.GET)
void dealOldData4WeixinClock();
@ApiOperation(value = "处理关联作品的打卡的旧数据", httpMethod = "GET")
@RequestMapping(value = "/dealOldData4WeixinAtt", method = RequestMethod.GET)
void dealOldData4WeixinAtt();
}
......@@ -71,4 +71,9 @@ public interface BookClockBiz {
* 处理关联应用的打卡的旧数据
*/
void dealOldData4WeixinClock();
/**
* 处理关联作品的打卡的旧数据
*/
void dealOldData4WeixinAtt();
}
......@@ -11,6 +11,8 @@ import com.pcloud.book.clock.dto.BookClockInfoDTO;
import com.pcloud.book.clock.dto.BookClockKeywordDTO;
import com.pcloud.book.clock.dto.BookClockListDTO;
import com.pcloud.book.clock.dto.BookGroupClockDTO;
import com.pcloud.book.clock.dto.BookGroupClockKeywordDTO;
import com.pcloud.book.clock.dto.PushBookClockKeywordDTO;
import com.pcloud.book.clock.entity.BookClockInfo;
import com.pcloud.book.clock.entity.BookClockKeyword;
import com.pcloud.book.clock.entity.BookGroupClock;
......@@ -28,6 +30,11 @@ import com.pcloud.book.group.dao.WeixinQrcodeDao;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.BookWxQrcodeDTO;
import com.pcloud.book.group.dto.ClassifyDTO;
import com.pcloud.book.group.entity.BookGroupClassify;
import com.pcloud.book.group.entity.GroupQrcode;
import com.pcloud.book.group.vo.ClassifyVO;
import com.pcloud.book.keywords.biz.BookKeywordBiz;
import com.pcloud.book.keywords.vo.SetKeywordVO;
import com.pcloud.book.weixinclock.biz.WeixinClockBiz;
import com.pcloud.book.weixinclock.dto.WeixinClockDto;
import com.pcloud.common.core.aspect.ParamLog;
......@@ -90,7 +97,9 @@ public class BookClockBizImpl implements BookClockBiz {
private WeixinQrcodeDao weixinQrcodeDao;
@Autowired
private WeixinClockBiz weixinClockBiz;
@Autowired
private BookKeywordBiz bookKeywordBiz;
private ExecutorService timedTask = Executors.newFixedThreadPool(5);
/**
* 关联作品/应用及微信群
......@@ -432,13 +441,13 @@ public class BookClockBizImpl implements BookClockBiz {
weixinClockDto.setClockIntroduction("欢迎加入打卡,每天一次,养成良好习惯");
weixinClockDto.setClockKeyword("每日打卡");
List<BookClockInfoDTO> clockInfoIds = bookClockInfoDao.getAllClockInfoIds();
if(!ListUtils.isEmpty(clockInfoIds)){
for(BookClockInfoDTO bookClockInfoDTO: clockInfoIds){
if (!ListUtils.isEmpty(clockInfoIds)) {
for (BookClockInfoDTO bookClockInfoDTO : clockInfoIds) {
List<Long> list1 = bookGroupClockDao.getClassifyIdsByBookGroupId(bookClockInfoDTO.getBookClockInfoId());
List<Long> list2 = bookGroupClockDao.getClassifyIdsByClassfyId(bookClockInfoDTO.getBookClockInfoId());
list1.addAll(list2);
List<Long> resultList = list1.stream().distinct().collect(Collectors.toList());
if(!ListUtils.isEmpty(resultList)) {
if (!ListUtils.isEmpty(resultList)) {
weixinClockDto.setCreateUser(bookClockInfoDTO.getCreateUser());
weixinClockDto.setLastModifiedUser(bookClockInfoDTO.getCreateUser());
weixinClockDto.setGroupClassifyIds(resultList);
......@@ -448,4 +457,48 @@ public class BookClockBizImpl implements BookClockBiz {
}
}).start();
}
@Override
public void dealOldData4WeixinAtt() {
timedTask.execute(()->{
SetKeywordVO setKeywordVO = new SetKeywordVO();
List<BookClockInfoDTO> clockInfoIds = bookClockInfoDao.getAllAttInfoIds();
if(!ListUtils.isEmpty(clockInfoIds)){
for(BookClockInfoDTO bookClockInfoDTO: clockInfoIds){
List<Long> list1 = bookGroupClockDao.getClassifyIdsByBookGroupId(bookClockInfoDTO.getBookClockInfoId());
List<Long> list2 = bookGroupClockDao.getClassifyIdsByClassfyId(bookClockInfoDTO.getBookClockInfoId());
//关联的关键词
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("bookClockInfoId",bookClockInfoDTO.getBookClockInfoId());
List<BookClockKeywordDTO> bookClockKeywordDTOS = bookClockKeywordDao.getKeywordsByInfoId(paramMap);
if (bookClockKeywordDTOS.size() != 1){
continue;
}
list1.addAll(list2);
List<Long> resultList = list1.stream().distinct().collect(Collectors.toList());
if(!ListUtils.isEmpty(resultList)) {
for (Long id : resultList) {
ClassifyVO classifyVO = bookGroupClassifyDao.getClassify(id);
setKeywordVO.setGuide(bookClockKeywordDTOS.get(0).getGuide());
setKeywordVO.setChannelId(classifyVO.getChannelId());
setKeywordVO.setKeywords(bookClockKeywordDTOS.get(0).getKeyword());
setKeywordVO.setPicUrl(bookClockInfoDTO.getOriginImg());
setKeywordVO.setLinkUrl("/C" + classifyVO.getChannelId() + "/product/display/" + bookClockInfoDTO.getOriginId() + "?adviserId=" + bookClockInfoDTO.getCreateUser() + "&source_type=QRCODE");
setKeywordVO.setDescription("签到打卡");
setKeywordVO.setAddWarehouse(0);
setKeywordVO.setClassifyId(id);
setKeywordVO.setReplyType(1);
setKeywordVO.setReplyType(4);
setKeywordVO.setMatchingRule(0);
setKeywordVO.setBookGroupId(classifyVO.getBookGroupId());
setKeywordVO.setContent(bookClockInfoDTO.getOriginTitle());
setKeywordVO.setServeId(bookClockInfoDTO.getOriginId());
setKeywordVO.setServeType(bookClockInfoDTO.getOriginType());
bookKeywordBiz.insertKeyword(setKeywordVO);
}
}
}
}
});
}
}
......@@ -88,4 +88,5 @@ public interface BookClockInfoDao extends BaseDao<BookClockInfo> {
void deleteBookClockInfo(Map<String, Object> paramMap);
List<BookClockInfoDTO> getAllClockInfoIds();
List<BookClockInfoDTO> getAllAttInfoIds();
}
......@@ -141,5 +141,9 @@ public class BookClockInfoDaoImpl extends BaseDaoImpl<BookClockInfo> implements
return super.sqlSessionTemplate.selectList(getStatement("getAllClockInfoIds"),paramMap);
}
@Override
public List<BookClockInfoDTO> getAllAttInfoIds() {
Map<String,Object> paramMap = new HashMap<>();
return super.sqlSessionTemplate.selectList(getStatement("getAllAttInfoIds"),paramMap);
}
}
......@@ -76,5 +76,10 @@ public class BookClockInfoServiceImpl implements BookClockInfoService {
bookClockBiz.dealOldData4WeixinClock();
}
@Override
@RequestMapping(value = "/dealOldData4WeixinAtt", method = RequestMethod.GET)
public void dealOldData4WeixinAtt() {
bookClockBiz.dealOldData4WeixinAtt();
}
}
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