|
@@ -8,6 +8,7 @@ import com.lqkj.link.module.bulletin.domain.NoticeInfo;
|
8
|
8
|
import com.lqkj.link.module.bulletin.repository.NoticeInfoRepository;
|
9
|
9
|
import com.lqkj.link.module.zone.domain.*;
|
10
|
10
|
import com.lqkj.link.module.zone.repository.*;
|
|
11
|
+import com.lqkj.link.util.PhoneUtils;
|
11
|
12
|
import com.lqkj.link.util.Unzipper;
|
12
|
13
|
import org.apache.commons.lang3.StringUtils;
|
13
|
14
|
import org.apache.commons.lang3.SystemUtils;
|
|
@@ -27,6 +28,8 @@ import org.springframework.transaction.annotation.Transactional;
|
27
|
28
|
import java.io.File;
|
28
|
29
|
import java.nio.file.Files;
|
29
|
30
|
import java.nio.file.Paths;
|
|
31
|
+import java.sql.Timestamp;
|
|
32
|
+import java.text.SimpleDateFormat;
|
30
|
33
|
import java.util.*;
|
31
|
34
|
import java.util.stream.Collectors;
|
32
|
35
|
|
|
@@ -293,8 +296,8 @@ public class ZoneInfoService {
|
293
|
296
|
NoticeInfo noticeInfo = new NoticeInfo();
|
294
|
297
|
noticeInfo.setUserId(shareUserInfo.getUserId());
|
295
|
298
|
noticeInfo.setType(4);
|
296
|
|
- noticeInfo.setContent(userInfo.getUserCode().replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2") + "邀请你参加作品协作,与他(她)共建场景。");
|
297
|
|
- noticeInfo.setHasView(true);
|
|
299
|
+ noticeInfo.setContent(PhoneUtils.encryptPhoneNumber(userInfo.getUserCode()) + "邀请你参加作品协作,与他(她)共建场景。");
|
|
300
|
+ noticeInfo.setHasView(false);
|
298
|
301
|
noticeInfo.setCreateTime(new Date());
|
299
|
302
|
noticeInfo.setZoneId(zoneId);
|
300
|
303
|
noticeInfoRepository.save(noticeInfo);
|
|
@@ -315,6 +318,7 @@ public class ZoneInfoService {
|
315
|
318
|
return null;
|
316
|
319
|
}
|
317
|
320
|
|
|
321
|
+ @Transactional
|
318
|
322
|
public String deleteWork(Integer zoneId, String userCode) {
|
319
|
323
|
if(!zoneInfoRepository.existsById(zoneId)){
|
320
|
324
|
return "该作品不存在!";
|
|
@@ -325,10 +329,33 @@ public class ZoneInfoService {
|
325
|
329
|
if (!zoneInfoRepository.canBeDeleteWithAuthStatus(zoneId)) {
|
326
|
330
|
return "不能删除正在审核的作品!";
|
327
|
331
|
}
|
|
332
|
+ notifySharer(zoneId);
|
|
333
|
+ shareInfoRepository.deleteByZoneId(zoneId);
|
328
|
334
|
zoneInfoRepository.deleteById(zoneId);
|
329
|
335
|
return null;
|
330
|
336
|
}
|
331
|
337
|
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+ /**
|
|
341
|
+ * 通知分享者
|
|
342
|
+ * @param zoneId
|
|
343
|
+ */
|
|
344
|
+ private void notifySharer(Integer zoneId) {
|
|
345
|
+ List<NoticeInfo> noticeInfos = new ArrayList<>();
|
|
346
|
+ shareInfoRepository.findByZoneId(zoneId).forEach(shareInfo -> {
|
|
347
|
+ NoticeInfo noticeInfo = new NoticeInfo();
|
|
348
|
+ noticeInfo.setUserId(shareInfo.getSharedUserId());
|
|
349
|
+ noticeInfo.setType(6);
|
|
350
|
+ noticeInfo.setContent("经决定对团队进行调整。很遗憾地通知您,您将不再作为该项目的协作者。我们感谢您到目前为止的贡献。");
|
|
351
|
+ noticeInfo.setHasView(false);
|
|
352
|
+ noticeInfo.setCreateTime(new Date());
|
|
353
|
+ noticeInfo.setZoneId(zoneId);
|
|
354
|
+ noticeInfos.add(noticeInfo);
|
|
355
|
+ });
|
|
356
|
+ noticeInfoRepository.saveAll(noticeInfos);
|
|
357
|
+ }
|
|
358
|
+
|
332
|
359
|
@Transactional
|
333
|
360
|
public Map<String, Object> create(String name, Integer templateId, String userCode) {
|
334
|
361
|
Map<String, Object> result = new HashMap<>();
|
|
@@ -413,7 +440,15 @@ public class ZoneInfoService {
|
413
|
440
|
*/
|
414
|
441
|
public Page<Map<String, Object>> shareCenter(String name, Integer userId, Integer page, Integer pageSize) {
|
415
|
442
|
Pageable pageable = PageRequest.of(page, pageSize);
|
416
|
|
- return zoneInfoRepository.pageQueryshareCenter(name, userId, pageable);
|
|
443
|
+ Page<Map<String, Object>> maps = zoneInfoRepository.pageQueryshareCenter(name, userId, pageable);
|
|
444
|
+ List<Map<String, Object>> result = new ArrayList<>();
|
|
445
|
+ maps.getContent().forEach(map -> {
|
|
446
|
+ String update_time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(map.get("update_time"));
|
|
447
|
+ HashMap<String, Object> resultMap = new HashMap<>(map);
|
|
448
|
+ resultMap.put("update_time", update_time);
|
|
449
|
+ result.add(resultMap);
|
|
450
|
+ });
|
|
451
|
+ return new PageImpl<>(result, PageRequest.of(page, pageSize), maps.getTotalElements());
|
417
|
452
|
}
|
418
|
453
|
|
419
|
454
|
|
|
@@ -435,5 +470,20 @@ public class ZoneInfoService {
|
435
|
470
|
@Transactional
|
436
|
471
|
public void acceptShare(Integer zoneId, Integer userId, Boolean acceptStatus) {
|
437
|
472
|
zoneInfoRepository.acceptShare(zoneId, userId, acceptStatus);
|
|
473
|
+ if (!acceptStatus) {
|
|
474
|
+ UserInfo userInfo = userInfoRepository.findById(userId).get();
|
|
475
|
+ ShareInfo shareInfo = shareInfoRepository.findByZoneIdAndSharedUserId(zoneId, userId).get(0);
|
|
476
|
+ NoticeInfo noticeInfo = new NoticeInfo();
|
|
477
|
+ noticeInfo.setAcceptStatus(false);
|
|
478
|
+ noticeInfo.setCreateTime(new Date());
|
|
479
|
+ noticeInfo.setHasView(false);
|
|
480
|
+ noticeInfo.setUserId(shareInfo.getUserId());
|
|
481
|
+ noticeInfo.setType(5);
|
|
482
|
+ noticeInfo.setContent("手机号为" + PhoneUtils.encryptPhoneNumber(userInfo.getUserCode()) + "的用户拒绝参加您的作品协作!");
|
|
483
|
+ noticeInfo.setZoneId(zoneId);
|
|
484
|
+ noticeInfoRepository.save(noticeInfo);
|
|
485
|
+ }
|
|
486
|
+
|
|
487
|
+
|
438
|
488
|
}
|
439
|
489
|
}
|