|
@@ -58,6 +58,7 @@ import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.scheduling.annotation.EnableAsync;
|
|
import org.springframework.scheduling.annotation.EnableAsync;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import java.io.*;
|
|
import java.io.*;
|
|
|
import java.net.URL;
|
|
import java.net.URL;
|
|
@@ -1569,6 +1570,57 @@ public class QwUserServiceImpl implements IQwUserService
|
|
|
return qwUserMapper.selectQwUserListByCompanyUserIdS(userIds);
|
|
return qwUserMapper.selectQwUserListByCompanyUserIdS(userIds);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional
|
|
|
|
|
+ public R unbindQwUserByServerIds(List<String> serverIds) {
|
|
|
|
|
+ if (serverIds!= null && !serverIds.isEmpty()) {
|
|
|
|
|
+ serverIds = serverIds.stream().distinct().collect(Collectors.toList()); //去重
|
|
|
|
|
+ //查询所有状态为 绑定了AI主机的
|
|
|
|
|
+ List<QwUser> list = qwUserMapper.selectQwUserByServerIds(serverIds);
|
|
|
|
|
+ if (list != null && !list.isEmpty()) {
|
|
|
|
|
+ for (QwUser qwUser : list) {
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ QwIpadServerLog qwIpadServerLog = new QwIpadServerLog();
|
|
|
|
|
+ qwIpadServerLog.setType(2);
|
|
|
|
|
+ qwIpadServerLog.setTilie("退订解绑");
|
|
|
|
|
+ qwIpadServerLog.setServerId(qwUser.getServerId());
|
|
|
|
|
+ qwIpadServerLog.setQwUserId(qwUser.getId());
|
|
|
|
|
+ qwIpadServerLog.setCompanyUserId(qwUser.getCompanyUserId());
|
|
|
|
|
+ qwIpadServerLog.setCompanyId(qwUser.getCompanyId());
|
|
|
|
|
+ qwIpadServerLog.setCreateTime(new Date());
|
|
|
|
|
+ qwIpadServerLogService.insertQwIpadServerLog(qwIpadServerLog);
|
|
|
|
|
+// WxWorkGetQrCodeDTO wxWorkGetQrCodeDTO = new WxWorkGetQrCodeDTO();
|
|
|
|
|
+// wxWorkGetQrCodeDTO.setUuid(qwUser.getUid());
|
|
|
|
|
+// wxWorkService.LoginOut(wxWorkGetQrCodeDTO,qwUser.getServerId());
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("企微用户:{},解绑ipad报错:{}", JSON.toJSONString(qwUser), e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ List<Long> ids = list.stream().map(QwUser::getId).collect(Collectors.toList());
|
|
|
|
|
+ qwUserMapper.batchUpdateUnbind(ids); //修改qwUser的serverId和绑定状态
|
|
|
|
|
+// ipadServerService.addServers(serverIds); // ipad数量退订归100
|
|
|
|
|
+ qwIpadServerUserService.deleteQwIpadServerUserByQwUserIds(ids); //删除 qwIpadServerUser
|
|
|
|
|
+ Long[] array = serverIds.stream()
|
|
|
|
|
+ .map(str -> {
|
|
|
|
|
+ if (str != null && !str.trim().isEmpty()) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ return Long.valueOf(str.trim());
|
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
|
+ return null; // 或抛出异常
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+ })
|
|
|
|
|
+ .toArray(Long[]::new);
|
|
|
|
|
+ ipadServerService.deleteQwIpadServerByIds(array); // 删除ipad
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ return R.ok();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 根据销售公司和企微ID查询企微用户
|
|
* 根据销售公司和企微ID查询企微用户
|
|
|
*/
|
|
*/
|