Commit 87257c4f7f523cdc5bf1346773200d171f71ffe7

Authored by chenjunyu_1481036421
1 parent 50724188

fix:修改组织同步用户bug

... ... @@ -16,7 +16,7 @@ import java.util.List;
16 16 @Slf4j
17 17 public class EnterpriseWeChatSmsSender extends AbstractMessageSender {
18 18
19   - /** 钉钉参数配置 */
  19 + /** 企业微信参数配置 */
20 20 private final EnterpriseWeChatConfiguration config;
21 21
22 22 private String accessToken;
... ... @@ -24,33 +24,14 @@ public class EnterpriseWeChatSmsSender extends AbstractMessageSender {
24 24 private String url = "https://qyapi.weixin.qq.com/cgi-bin";
25 25
26 26 private Long expirationTime;
27   -//
28   -// private static final String smsText="{\n" +
29   -// " \"touser\": \"%s\",\n" +
30   -// " \"msgtype\": \"textcard\",\n" +
31   -// " \"agentid\": %s,\n" +
32   -// " \"textcard\": {\n" +
33   -// "\"title\": \"平台告警通知\",\n" +
34   -// "\"description\": \"<div class=\\\"normal\\\">设备所属组织:%s</div>" +
35   -// "<div class=\\\"normal\\\">设备名称:%s</div>" +
36   -// "<div class=\\\"normal\\\">告警等级:%s</div>" +
37   -// "<div class=\\\"normal\\\">告警类型:%s</div>" +
38   -// "<div class=\\\"normal\\\">触发值:%s</div>" +
39   -// "<div class=\\\"normal\\\">告警时间:%s</div>\",\n" +
40   -// " \"url\": \" \",\n" +
41   -// " \"btntxt\": \"详情\"\n" +
42   -// " },\n" +
43   -// " \"enable_id_trans\": 0,\n" +
44   -// " \"enable_duplicate_check\": 0,\n" +
45   -// " \"duplicate_check_interval\": 1800\n" +
46   -// "}";
  27 +
47 28
48 29 private static final String smsText="{\n" +
49 30 " \"touser\" : \"%s\",\n" +
50 31 " \"msgtype\" : \"text\",\n" +
51 32 " \"agentid\" : %s,\n" +
52 33 " \"text\" : {\n" +
53   - " \"content\" : \"平台告警通知\n设备所属组织:%s\n设备名称:%s\n告警等级:%s\n告警类型:%s\n触发值:%s\n告警时间:%s\n\"\n" +
  34 + " \"content\" : \"平台告警通知\n设备所属组织:%s\n设备名称:%s\n告警等级:%s\n告警类型:%s\n触发值:%s\n告警时间:%s\n\"" +
54 35 " },\n" +
55 36 " \"safe\":0,\n" +
56 37 " \"enable_id_trans\": 0,\n" +
... ...
... ... @@ -209,11 +209,13 @@ public class TkOrganizationServiceImpl extends AbstractBaseService<OrganizationM
209 209 List<Map<String,String>> userOrgList = getUserOrgMap(getUserByOrganizationIds(parentId),getUserByOrganizationIds(sourceParentOrganizationId));
210 210 baseMapper.updateById(organization);
211 211 //组织修改过后更新原上级与目标上级用户绑定的组织
212   - for (Map<String,String> userOrg:userOrgList){
213   - String user = userOrg.get("userId");
214   - String org = userOrg.get("orgId");
215   - List<String>orgIds = organizationAllIds(tenantId, org);
216   - addOrUpdateUserOrganizationMapping(user,orgIds);
  212 + if(null!=userOrgList){
  213 + for (Map<String,String> userOrg:userOrgList){
  214 + String user = userOrg.get("userId");
  215 + String org = userOrg.get("orgId");
  216 + List<String>orgIds = organizationAllIds(tenantId, org);
  217 + addOrUpdateUserOrganizationMapping(user,orgIds);
  218 + }
217 219 }
218 220 return organizationDTO;
219 221 }
... ... @@ -240,17 +242,21 @@ public class TkOrganizationServiceImpl extends AbstractBaseService<OrganizationM
240 242 //目标上级原本绑定的用户 newUserIds
241 243 //原上级原本绑定的用户 oldUserIds
242 244 List<Map<String,String>> userOrgList = new ArrayList<>();
243   - for (String oldUserId:oldUserIds) {
244   - Map<String,String> map = new HashMap<>();
245   - map.put("userId",oldUserId);
246   - map.put("orgId", getOrganizationIdsByUser(oldUserId).get(0));
247   - userOrgList.add(map);
  245 + if(null!=newUserIds){
  246 + for (String newUserId:newUserIds) {
  247 + Map<String,String> map = new HashMap<>();
  248 + map.put("userId",newUserId);
  249 + map.put("orgId", getOrganizationIdsByUser(newUserId).get(0));
  250 + userOrgList.add(map);
  251 + }
248 252 }
249   - for (String newUserId:newUserIds) {
250   - Map<String,String> map = new HashMap<>();
251   - map.put("userId",newUserId);
252   - map.put("orgId", getOrganizationIdsByUser(newUserId).get(0));
253   - userOrgList.add(map);
  253 + if(null!=oldUserIds){
  254 + for (String oldUserId:oldUserIds) {
  255 + Map<String,String> map = new HashMap<>();
  256 + map.put("userId",oldUserId);
  257 + map.put("orgId", getOrganizationIdsByUser(oldUserId).get(0));
  258 + userOrgList.add(map);
  259 + }
254 260 }
255 261 return userOrgList;
256 262 }
... ...