|
|
@@ -25,7 +25,8 @@ module.exports={
|
|
|
isFirst: isFirst,
|
|
|
getShareInfo: getShareInfo,
|
|
|
prepareInitialData: prepareInitialData,
|
|
|
- changeFile:changeFile
|
|
|
+ changeFile:changeFile,
|
|
|
+ copyForSectionError: copyForSectionError,
|
|
|
};
|
|
|
|
|
|
|
|
|
@@ -903,6 +904,23 @@ async function updateUsedList(userId, compilation) {
|
|
|
async function copyCompleRationSection(userId, compilationId) {
|
|
|
await sectionTreeDao.copyDataFromTemplate(userId, compilationId);
|
|
|
}
|
|
|
+
|
|
|
+/*
|
|
|
+ * 解决问题:
|
|
|
+ * 发布了编办之后,才设置了人材机库模板,导致已登录的用户不存在人材机库的分类树
|
|
|
+ * 为该编办下,人材机分类模板为空的用户,拷贝模板数据
|
|
|
+ * */
|
|
|
+async function copyForSectionError(compilation) {
|
|
|
+ let users = await userModel.find({}, '_id');
|
|
|
+ for (let user of users) {
|
|
|
+ let userId = user._id.toString();
|
|
|
+ let existCount = await compleGljSectionModel.find({userId}).count();
|
|
|
+ if (existCount === 0) {
|
|
|
+ await copyCompleGljSection(userId, compilation);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
//拷贝补充人材机分类树
|
|
|
async function copyCompleGljSection(userId, compilationId) {
|
|
|
let templateData = await compleGljSectionTModel.find({compilationId: compilationId});
|