|
|
@@ -6,6 +6,7 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
|
|
import com.tzld.piaoquan.api.component.VideoApiService;
|
|
|
import com.tzld.piaoquan.api.dao.mapper.contentplatform.ext.ContentPlatformPlanMapperExt;
|
|
|
import com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ThirdPartWeComMsgMapper;
|
|
|
+import com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ThirdPartWeComRoomMapper;
|
|
|
import com.tzld.piaoquan.api.model.param.wecom.thirdpart.CdnUploadImgLinkRequest;
|
|
|
import com.tzld.piaoquan.api.model.param.wecom.thirdpart.CdnUploadImgLinkResponse;
|
|
|
import com.tzld.piaoquan.api.model.param.wecom.thirdpart.SendAppMsgRequest;
|
|
|
@@ -54,7 +55,9 @@ public class WeComSendMsgJob {
|
|
|
@Autowired
|
|
|
ContentPlatformPlanMapperExt planMapperExt;
|
|
|
@Autowired
|
|
|
- ThirdPartWeComMsgMapper thirdPartWeComMsgMapper;
|
|
|
+ ThirdPartWeComRoomMapper roomMapper;
|
|
|
+ @Autowired
|
|
|
+ ThirdPartWeComMsgMapper msgMapper;
|
|
|
|
|
|
@Value("${send.room.msg.video.min.score:3}")
|
|
|
private Double videoMinScore;
|
|
|
@@ -66,9 +69,13 @@ public class WeComSendMsgJob {
|
|
|
private List<String> testRoomList;
|
|
|
@ApolloJsonValue("${send.room.msg.video.source.staff.config:{}}")
|
|
|
private Map<Long, JSONObject> videoSourceStaffConfig;
|
|
|
+ @ApolloJsonValue("${send.room.msg.staff.put.scene.config:{}}")
|
|
|
+ private Map<Long, String> staffPutSceneConfig;
|
|
|
+ @ApolloJsonValue("${send.room.msg.auto.open.staff:[]}")
|
|
|
+ private List<Long> autoOpenStaffList;
|
|
|
|
|
|
private final static ExecutorService pool = new ThreadPoolExecutor(5, 5, 0L, TimeUnit.SECONDS,
|
|
|
- new LinkedBlockingQueue<>(1000),
|
|
|
+ new LinkedBlockingQueue<>(),
|
|
|
new ThreadFactoryBuilder().setNameFormat("WeComSendMsgJob-%d").build(),
|
|
|
new ThreadPoolExecutor.AbortPolicy());
|
|
|
|
|
|
@@ -171,7 +178,8 @@ public class WeComSendMsgJob {
|
|
|
Staff staff = new Staff();
|
|
|
staff.setCarrierId(String.valueOf(thirdPartWeComStaff.getThirdStaffId()));
|
|
|
staff.setRemark(thirdPartWeComStaff.getName());
|
|
|
- String page = messageAttachmentService.getPageNoCache(staff, video.getVideoId(), "企微", "社群");
|
|
|
+ String putScene = staffPutSceneConfig.getOrDefault(thirdPartWeComStaff.getThirdStaffId(), "touliu");
|
|
|
+ String page = messageAttachmentService.getPageNoCache(putScene, staff, video.getVideoId(), "企微", "社群");
|
|
|
|
|
|
CgiReplyBucketData cgiReplyBucketData = new CgiReplyBucketData();
|
|
|
cgiReplyBucketData.setMiniVideoId(video.getVideoId());
|
|
|
@@ -246,7 +254,7 @@ public class WeComSendMsgJob {
|
|
|
ThirdPartWeComMsgExample msgExample = new ThirdPartWeComMsgExample();
|
|
|
msgExample.createCriteria().andSendUseridEqualTo(roomId)
|
|
|
.andCreateTimeGreaterThan(DateUtil.getDaysAgoDate(duplicateDays));
|
|
|
- List<ThirdPartWeComMsg> msgList = thirdPartWeComMsgMapper.selectByExample(msgExample);
|
|
|
+ List<ThirdPartWeComMsg> msgList = msgMapper.selectByExample(msgExample);
|
|
|
return msgList.stream().map(ThirdPartWeComMsg::getVideoId).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
@@ -269,6 +277,28 @@ public class WeComSendMsgJob {
|
|
|
msg.setMd5(request.getMd5());
|
|
|
msg.setAeskey(request.getAeskey());
|
|
|
msg.setFilesize(request.getFileSize());
|
|
|
- thirdPartWeComMsgMapper.insertSelective(msg);
|
|
|
+ msgMapper.insertSelective(msg);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @XxlJob("autoOpenSendStatusJob")
|
|
|
+ public ReturnT<String> autoOpenSendStatusJob(String param) {
|
|
|
+ List<ThirdPartWeComStaff> activeStaffList = weComThirdPartyService.getActiveStaffList();
|
|
|
+ for (ThirdPartWeComStaff staff : activeStaffList) {
|
|
|
+ if (!autoOpenStaffList.contains(staff.getThirdStaffId())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ List<ThirdPartWeComRoom> roomList = weComThirdPartyService.getStaffRoomList(staff.getId());
|
|
|
+ for (ThirdPartWeComRoom room : roomList) {
|
|
|
+ if (room.getSendStatus() == 1) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (room.getMemberCount() > 20) {
|
|
|
+ room.setSendStatus(1);
|
|
|
+ roomMapper.updateByPrimaryKeySelective(room);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ReturnT.SUCCESS;
|
|
|
}
|
|
|
}
|