Commit a3a3ec22 by 徐高华

活码批量更新

parent d364f6b8
package com.gic.haoban.manage.service.task.hm;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.DealParamMqDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmQrcodeQDTO;
import com.gic.haoban.manage.api.enums.PreDealTypeEnum;
import com.gic.haoban.manage.api.enums.SyncTaskStatusEnum;
import com.gic.haoban.manage.api.service.hm.HmQrcodeApiService;
import com.gic.haoban.manage.service.entity.TabHaobanPreDealLog;
import com.gic.haoban.manage.service.entity.TabHaobanSyncTask;
import com.gic.haoban.manage.service.service.PreDealService;
import com.gic.haoban.manage.service.service.SyncTaskService;
import com.gic.haoban.manage.service.task.BaseSyncOperation;
@Service
public class QwHmOperation implements BaseSyncOperation {
private static final Logger logger = LoggerFactory.getLogger(QwHmOperation.class);
@Autowired
private HmQrcodeApiService hmQrcodeApiService;
@Autowired
private PreDealService preDealService;
@Autowired
private SyncTaskService syncTaskService;
@Override
public void dealSingleByMq(DealParamMqDTO dealParamMqDTO, TabHaobanPreDealLog dataPre) {
String taskId = dealParamMqDTO.getTaskId();
Long hmId = Long.valueOf(dataPre.getDataId());
String clerkIds = dataPre.getDataContent();
String wxEnterpriseId = dataPre.getWxEnterpriseId();
String enterpriseId = dataPre.getEnterpriseId();
List<String> clerkIdList = JSONArray.parseArray(clerkIds, String.class);
// 删除
ServiceResponse resp = null ;
if (clerkIdList.size() == 0) {
resp = this.hmQrcodeApiService.delById(hmId, 1, null);
} else {
HmQrcodeQDTO qdto = new HmQrcodeQDTO();
qdto.setWxEnterpriseId(wxEnterpriseId);
qdto.setHmId(hmId);
qdto.setEnterpriseId(enterpriseId);
qdto.setClerkIdList(clerkIdList);
resp = this.hmQrcodeApiService.batchUpdateHm(qdto);
}
logger.info("批量修改活码={},{}",hmId,JSON.toJSONString(resp));
if(resp.isSuccess()) {
this.preDealService.updateStatusByDataId(taskId, dataPre.getDataId(), 2, null);
}else {
this.preDealService.updateStatusByDataId(taskId, dataPre.getDataId(), 2, resp.getMessage());
}
this.dealSuccess(taskId, dataPre.getDataId(), enterpriseId, wxEnterpriseId);
}
@Override
public void dealException(String taskId, String dataId, String enterpriseId, String reason) {
}
@Override
public void dealSuccess(String taskId, String dataId, String enterpriseId, String wxEnterpriseId) {
boolean b = preDealService.checkFriendTask(taskId, PreDealTypeEnum.modify_hm.getVal());
if (!b) {
return;
}
logger.info("批量修改活码完成={}", taskId);
TabHaobanSyncTask syncTask = syncTaskService.getSyncTask(taskId);
if (syncTask.getStatusFlag() == SyncTaskStatusEnum.compute.getVal()) {
return;
}
logger.info("批量修改活码完成,status={}", taskId);
this.syncTaskService.updateTaskStatus(taskId, SyncTaskStatusEnum.compute.getVal());
}
@Override
public void checkDepartmentTask(String taskId) {
}
}
...@@ -116,8 +116,6 @@ public class GroupMessageServiceTest { ...@@ -116,8 +116,6 @@ public class GroupMessageServiceTest {
qywxMomentInfoQDTO.setEndTime(1681906519L); qywxMomentInfoQDTO.setEndTime(1681906519L);
qywxMomentInfoQDTO.setCreatorId("wo59NLDQAAbjSBA575NouC1pUYQgCOtw"); qywxMomentInfoQDTO.setCreatorId("wo59NLDQAAbjSBA575NouC1pUYQgCOtw");
qywxMomentInfoQDTO.setPageSize(20); qywxMomentInfoQDTO.setPageSize(20);
ServiceResponse<QywxMomentRespDTO> serviceResponse = qywxSuiteApiService.queryQywxMomentList(qywxMomentInfoQDTO);
System.out.println(JSON.toJSONString(serviceResponse));
} }
@Test @Test
......
...@@ -2,6 +2,7 @@ import java.io.IOException; ...@@ -2,6 +2,7 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
...@@ -10,15 +11,19 @@ import org.springframework.test.context.ContextConfiguration; ...@@ -10,15 +11,19 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.BasePageInfo; import com.gic.api.base.commons.BasePageInfo;
import com.gic.haoban.manage.api.dto.ContentMaterialDTO; import com.gic.haoban.manage.api.dto.DealParamMqDTO;
import com.gic.haoban.manage.api.dto.hm.HmLinkDTO; import com.gic.haoban.manage.api.dto.hm.HmLinkDTO;
import com.gic.haoban.manage.api.dto.hm.HmLinkStoreDTO; import com.gic.haoban.manage.api.dto.hm.HmLinkStoreDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmBatchModifyQDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmLinkSearchQDTO; import com.gic.haoban.manage.api.dto.qdto.hm.HmLinkSearchQDTO;
import com.gic.haoban.manage.api.enums.SyncTaskStatusEnum;
import com.gic.haoban.manage.api.service.DealSyncOperationApiService;
import com.gic.haoban.manage.api.service.KeyDataApiService; import com.gic.haoban.manage.api.service.KeyDataApiService;
import com.gic.haoban.manage.api.service.hm.HmLinkApiService; import com.gic.haoban.manage.api.service.hm.HmLinkApiService;
import com.gic.haoban.manage.api.service.hm.HmLinkVisitLogApiService;
import com.gic.haoban.manage.service.service.QywxSendService; import com.gic.haoban.manage.service.service.QywxSendService;
import com.gic.haoban.manage.service.service.hm.HmClerkRelationService;
import com.gic.haoban.manage.service.service.hm.HmLinkStoreService; import com.gic.haoban.manage.service.service.hm.HmLinkStoreService;
import com.gic.haoban.manage.service.util.QwFriendLimitCountUtil; import com.gic.haoban.manage.service.util.QwFriendLimitCountUtil;
...@@ -29,7 +34,7 @@ public class HmLinkTest { ...@@ -29,7 +34,7 @@ public class HmLinkTest {
private HmLinkApiService hmLinkApiService; private HmLinkApiService hmLinkApiService;
@Autowired @Autowired
private HmLinkVisitLogApiService hmLinkVisitLogApiService; private HmClerkRelationService hmClerkRelationService;
@Autowired @Autowired
private KeyDataApiService keyDataApiService; private KeyDataApiService keyDataApiService;
...@@ -39,20 +44,33 @@ public class HmLinkTest { ...@@ -39,20 +44,33 @@ public class HmLinkTest {
@Autowired @Autowired
private QywxSendService qywxSendService ; private QywxSendService qywxSendService ;
@Autowired
private DealSyncOperationApiService dealSyncOperationApiService ;
volatile int x = 0 ; volatile int x = 0 ;
@Test @Test
public void test() throws IOException, InterruptedException { public void test() throws IOException, InterruptedException {
String taskId = "c7e319c16ba942eea8a3b91d6a763518" ;
DealParamMqDTO dealParamMqDTO = new DealParamMqDTO();
dealParamMqDTO.setTaskId(taskId);
dealParamMqDTO.setData(517064205447217236l+"");
dealParamMqDTO.setType(SyncTaskStatusEnum.modify_hm.getVal());
List<ContentMaterialDTO> imageList = new ArrayList<>();
ContentMaterialDTO d = new ContentMaterialDTO() ;
d.setImgUrl("https://p.qlogo.cn/bizmail/hxlMR3pdsfnslruRxMXebKiabKrgOOpdmJ7shD0jUFbcUMoOh9I7AXw/0");
d.setMaterialType(2);
imageList.add(d) ;
this.qywxSendService.share("ca66a01b79474c40b3e7c7f93daf1a3b", Arrays.asList("c6420c17febe426a9fb197dbd90bdc7b","4f2ae2fbfe594ad2a8ccdf9ab7b28713","fce45ed485e94d619b0124f2daf4b083"), "test", imageList);
this.dealSyncOperationApiService.departmentDealMq(JSON.toJSONString(dealParamMqDTO)) ;
if(true) {
return ;
}
HmBatchModifyQDTO qdto = new HmBatchModifyQDTO();
qdto.setHmIdList(Arrays.asList(517064205447217236L,457922550308036636L));
qdto.setWxEnterpriseId("ca66a01b79474c40b3e7c7f93daf1a3b");
qdto.setOptStaffId("fefd1c81641711e69d0818c58a146fd2");
qdto.setOptName("达摩管理员");
qdto.setOptType(1);
qdto.setClerkIdList(Arrays.asList("4a566818111a45bbae9f962580df82c0"));
this.hmClerkRelationService.batchModify(qdto);
......
...@@ -124,8 +124,6 @@ public class NotityTest { ...@@ -124,8 +124,6 @@ public class NotityTest {
articleInfo.setPicurl("https://platform-1251519181.cos.ap-shanghai.myqcloud.com/image/newdmwltest/enterprise_common-e1e8b3d46fdb4486ad545aae6cba67a1.png"); articleInfo.setPicurl("https://platform-1251519181.cos.ap-shanghai.myqcloud.com/image/newdmwltest/enterprise_common-e1e8b3d46fdb4486ad545aae6cba67a1.png");
messageDTO.setArticleMessages(Arrays.asList(articleInfo)); messageDTO.setArticleMessages(Arrays.asList(articleInfo));
boolean b = qywxSuiteApiService.sendMessage(corpid, config.getWxSuiteid(), messageDTO);
System.out.println(b);
} }
@Test @Test
...@@ -138,7 +136,6 @@ public class NotityTest { ...@@ -138,7 +136,6 @@ public class NotityTest {
search.setSuiteid(config.getWxSuiteid()); search.setSuiteid(config.getWxSuiteid());
search.setChatType("single"); search.setChatType("single");
Date date = DateUtils.addDays(new Date(), -1); Date date = DateUtils.addDays(new Date(), -1);
ServiceResponse<QywxGroupMsgResp> serviceResponse = qywxSuiteApiService.queryQywxGroupMessageList(search);
} }
......
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