通知修订
This commit is contained in:
@@ -70,12 +70,4 @@ public class DictController {
|
|||||||
public void sort(@RequestParam("ids") String ids) {
|
public void sort(@RequestParam("ids") String ids) {
|
||||||
dictService.ordbyDicIds(ids);
|
dictService.ordbyDicIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 发文单位同步。
|
|
||||||
*/
|
|
||||||
@GetMapping("Sync")
|
|
||||||
public void sync() {
|
|
||||||
dictService.getDeptSync();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,9 @@ public class NoticeVo {
|
|||||||
/** 接收人列表(JSON) */
|
/** 接收人列表(JSON) */
|
||||||
private String receiveList;
|
private String receiveList;
|
||||||
|
|
||||||
|
/** 附件ID串("1,2,3",列表页下载入口使用;对齐旧 .NET UpFile 字段) */
|
||||||
|
private String UpFile;
|
||||||
|
|
||||||
private String createBy;
|
private String createBy;
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
private String updateBy;
|
private String updateBy;
|
||||||
|
|||||||
@@ -56,11 +56,6 @@ public interface IDictService {
|
|||||||
*/
|
*/
|
||||||
void ordbyDicIds(String ids);
|
void ordbyDicIds(String ids);
|
||||||
|
|
||||||
/**
|
|
||||||
* 发文单位同步(从用户中心组织架构同步部门到字典)。
|
|
||||||
*/
|
|
||||||
void getDeptSync();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否发送短信(查询当前学校模块短信开关)。
|
* 是否发送短信(查询当前学校模块短信开关)。
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -201,17 +201,6 @@ public class DictService implements IDictService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================ GetDeptSync ============================
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public void getDeptSync() {
|
|
||||||
// C# 从用户中心 OpenAPI 获取学校部门树并同步到字典。
|
|
||||||
// Java 版暂不接入外部 OpenAPI,预留空实现。
|
|
||||||
// 后续接入平台用户中心 API 后补全同步逻辑。
|
|
||||||
log.info("[getDeptSync] 部门同步暂未接入用户中心API,跳过");
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============================ GetSchModuleIsSms ============================
|
// ============================ GetSchModuleIsSms ============================
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -333,6 +333,15 @@ entity.setIsPulled(0);
|
|||||||
List<NoticeVo> content = page.getContent().stream()
|
List<NoticeVo> content = page.getContent().stream()
|
||||||
.map(n -> toVo(n, false))
|
.map(n -> toVo(n, false))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
// 批量填充附件ID串("1,2,3"):列表页"附件下载"入口依赖 UpFile 字段
|
||||||
|
if (!content.isEmpty()) {
|
||||||
|
Map<Integer, List<Integer>> fileMap = batchFileIds(
|
||||||
|
content.stream().map(NoticeVo::getId).collect(Collectors.toList()));
|
||||||
|
for (NoticeVo vo : content) {
|
||||||
|
List<Integer> fids = fileMap.getOrDefault(vo.getId(), Collections.emptyList());
|
||||||
|
vo.setUpFile(fids.stream().map(String::valueOf).collect(Collectors.joining(",")));
|
||||||
|
}
|
||||||
|
}
|
||||||
return PageUtils.toResult(new PageImpl<>(content, pageable, page.getTotalElements()));
|
return PageUtils.toResult(new PageImpl<>(content, pageable, page.getTotalElements()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -578,31 +587,43 @@ entity.setIsPulled(0);
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 逐账号查用户中心(姓名+组织链)。量级为校内接收人(几十),串行可接受
|
// 逐接收人查用户中心(姓名+组织链)。接收明细可能存登录名,也可能存历史数字ID
|
||||||
|
// (如 10012):先按登录名查,查不到且为纯数字再按 userId 查,保证未读人也能取到组
|
||||||
Map<String, BoaUser> userMap = new LinkedHashMap<>();
|
Map<String, BoaUser> userMap = new LinkedHashMap<>();
|
||||||
|
Map<String, String> canonicalAccount = new HashMap<>(); // 原始串 -> 规范登录名
|
||||||
for (String account : receivers) {
|
for (String account : receivers) {
|
||||||
|
BoaUser user = null;
|
||||||
try {
|
try {
|
||||||
BoaUser user = YschBaseOpenApi.getUserInfo(account);
|
user = YschBaseOpenApi.getUserInfo(account);
|
||||||
if (user != null) {
|
if (user == null && account.chars().allMatch(Character::isDigit)) {
|
||||||
userMap.put(account, user);
|
user = YschBaseOpenApi.getUserInfo(Integer.parseInt(account));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("[readDetailGrouped] 查询用户中心失败, account={}", account, e);
|
log.warn("[readDetailGrouped] 查询用户中心失败, account={}", account, e);
|
||||||
}
|
}
|
||||||
|
if (user != null) {
|
||||||
|
userMap.put(account, user);
|
||||||
|
if (StringUtils.hasText(user.getAccount())) {
|
||||||
|
canonicalAccount.put(account, user.getAccount());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 组名=用户组织链最近端(主组),跨校/查不到归「其他」(对齐旧版逻辑)
|
// 组名=用户组织链最近端(主组),跨校/查不到归「其他」(对齐旧版逻辑)
|
||||||
Map<String, List<Map<String, Object>>> groupUsers = new LinkedHashMap<>();
|
Map<String, List<Map<String, Object>>> groupUsers = new LinkedHashMap<>();
|
||||||
for (String account : receivers) {
|
for (String account : receivers) {
|
||||||
BoaUser user = userMap.get(account);
|
BoaUser user = userMap.get(account);
|
||||||
|
// 已读比对/姓名兜底统一使用规范登录名(接收明细可能存的是历史数字ID)
|
||||||
|
String canonical = canonicalAccount.getOrDefault(account, account);
|
||||||
|
boolean read = readAccounts.contains(canonical) || readAccounts.contains(account);
|
||||||
String groupName = resolveReadGroupName(user, notice.getSchId());
|
String groupName = resolveReadGroupName(user, notice.getSchId());
|
||||||
String teaName = user != null && StringUtils.hasText(user.getName())
|
String teaName = user != null && StringUtils.hasText(user.getName())
|
||||||
? user.getName()
|
? user.getName()
|
||||||
: readNameMap.getOrDefault(account, account);
|
: readNameMap.getOrDefault(canonical, canonical);
|
||||||
Map<String, Object> item = new LinkedHashMap<>();
|
Map<String, Object> item = new LinkedHashMap<>();
|
||||||
item.put("account", account);
|
item.put("account", canonical);
|
||||||
item.put("teaname", teaName);
|
item.put("teaname", teaName);
|
||||||
item.put("states", readAccounts.contains(account) ? "read" : "unread");
|
item.put("states", read ? "read" : "unread");
|
||||||
groupUsers.computeIfAbsent(groupName, k -> new ArrayList<>()).add(item);
|
groupUsers.computeIfAbsent(groupName, k -> new ArrayList<>()).add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -262,19 +262,7 @@ public class UserCenterService implements IUserCenterService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 全树按 orderNumber 排序
|
// 保持 SDK(用户中心)返回顺序,不再按 orderNumber 重排
|
||||||
sortTree(roots);
|
|
||||||
return roots;
|
return roots;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private void sortTree(List<Map<String, Object>> nodes) {
|
|
||||||
nodes.sort(Comparator.comparingInt(n -> (Integer) n.get("orderNumber")));
|
|
||||||
for (Map<String, Object> node : nodes) {
|
|
||||||
List<Map<String, Object>> children = (List<Map<String, Object>>) node.get("children");
|
|
||||||
if (!children.isEmpty()) {
|
|
||||||
sortTree(children);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
server:
|
server:
|
||||||
port: 8070
|
port: 8101
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
mvc:
|
mvc:
|
||||||
@@ -9,7 +9,7 @@ spring:
|
|||||||
date-format: yyyy-MM-dd HH:mm:ss
|
date-format: yyyy-MM-dd HH:mm:ss
|
||||||
|
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:mysql://localhost:3306/bsch_notice?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
url: jdbc:mysql://localhost:3306/bsch_notice?useUnicode=true&characterEncoding=UTF-8&connectionCollation=utf8mb4_general_ci&serverTimezone=Asia/Shanghai
|
||||||
username: root
|
username: root
|
||||||
password: 123456
|
password: 123456
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
@@ -54,7 +54,7 @@ sms:
|
|||||||
yh:
|
yh:
|
||||||
sso:
|
sso:
|
||||||
server-url-prefix: http://sso.yunhaixingtong.com/cas/
|
server-url-prefix: http://sso.yunhaixingtong.com/cas/
|
||||||
client-host-url: http://localhost:8070
|
client-host-url: http://localhost:8101
|
||||||
allow-headers: all
|
allow-headers: all
|
||||||
allow-origins: all
|
allow-origins: all
|
||||||
url-pattern: /api/*
|
url-pattern: /api/*
|
||||||
|
|||||||
@@ -1,72 +0,0 @@
|
|||||||
server:
|
|
||||||
port: 8070
|
|
||||||
|
|
||||||
spring:
|
|
||||||
mvc:
|
|
||||||
date-format: yyyy-MM-dd HH:mm:ss
|
|
||||||
jackson:
|
|
||||||
time-zone: GMT+8
|
|
||||||
date-format: yyyy-MM-dd HH:mm:ss
|
|
||||||
|
|
||||||
datasource:
|
|
||||||
url: jdbc:mysql://localhost:3306/bsch_notice?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
|
||||||
username: root
|
|
||||||
password: 123456
|
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
|
||||||
min-idle: 10
|
|
||||||
max-active: 30
|
|
||||||
#jpa
|
|
||||||
jpa:
|
|
||||||
database: MySQL
|
|
||||||
show-sql: true
|
|
||||||
hibernate:
|
|
||||||
# 开发期使用 update 自动建表;生产环境设置成 none
|
|
||||||
ddl-auto: update
|
|
||||||
database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
|
|
||||||
properties:
|
|
||||||
hibernate.order_by.default_null_ordering: last
|
|
||||||
open-in-view: true
|
|
||||||
|
|
||||||
#文件上传
|
|
||||||
servlet:
|
|
||||||
multipart:
|
|
||||||
max-file-size: 100MB
|
|
||||||
max-request-size: 100MB
|
|
||||||
|
|
||||||
#本地关闭 rabbit
|
|
||||||
rabbitmq:
|
|
||||||
listener:
|
|
||||||
direct:
|
|
||||||
auto-startup: false
|
|
||||||
simple:
|
|
||||||
auto-startup: false
|
|
||||||
|
|
||||||
# 文件上传存储路径(Docker 部署时与 volume 挂载一致)
|
|
||||||
file:
|
|
||||||
upload-path: D:/data/upload
|
|
||||||
|
|
||||||
# 短信模块配置
|
|
||||||
sms:
|
|
||||||
enabled: true
|
|
||||||
module-id: notice
|
|
||||||
|
|
||||||
# 单点登录 / 应用间签名鉴权(基础平台 yh-auth / yh-app-auth)
|
|
||||||
yh:
|
|
||||||
sso:
|
|
||||||
server-url-prefix: http://sso.yunhaixingtong.com/cas/
|
|
||||||
client-host-url: http://localhost:8070
|
|
||||||
allow-headers: all
|
|
||||||
allow-origins: all
|
|
||||||
url-pattern: /api/*
|
|
||||||
mobi-api-pattern: /mobiapi/*
|
|
||||||
app-auth:
|
|
||||||
enabled: true
|
|
||||||
# 本应用自身身份(客户端签名用)
|
|
||||||
app-key: 100001
|
|
||||||
app-secret: ec4e860206374c80938719fff8e14a86
|
|
||||||
open:
|
|
||||||
enabled: true
|
|
||||||
base-host: http://base.yunhaixingtong.com
|
|
||||||
user-center-url: http://base.yunhaixingtong.com/userbase
|
|
||||||
# 班级管理(bschclass)服务基址
|
|
||||||
bschclass: http://base.yunhaixingtong.com/bschclass
|
|
||||||
Reference in New Issue
Block a user