|
@@ -234,80 +234,88 @@ export class textbookServer {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
- /* 批量预设(临时) */
|
|
|
|
- async saveProcess() {
|
|
|
|
- let count = 0;
|
|
|
|
- /* 批量关联流程管理员 */
|
|
|
|
- // let queryEdupro = new Parse.Query('EduProcess')
|
|
|
|
- // queryEdupro.select('department','name')
|
|
|
|
- // queryEdupro.equalTo('profileSubmitted',null)
|
|
|
|
- // queryEdupro.limit(1000)
|
|
|
|
- // let res = await queryEdupro.find()
|
|
|
|
- // console.log(res);
|
|
|
|
- // for (let index = 0; index < res.length; index++) {
|
|
|
|
- // const item = res[index];
|
|
|
|
- // let queryParams: any = {
|
|
|
|
- // where: {
|
|
|
|
- // $or: [
|
|
|
|
- // {
|
|
|
|
- // user: {
|
|
|
|
- // $inQuery: {
|
|
|
|
- // where: {
|
|
|
|
- // "department":item?.get('department')?.id,
|
|
|
|
- // "accountState":'已认证',
|
|
|
|
- // },
|
|
|
|
- // className: '_User',
|
|
|
|
- // },
|
|
|
|
- // },
|
|
|
|
- // },
|
|
|
|
- // ],
|
|
|
|
- // },
|
|
|
|
- // };
|
|
|
|
- // let query = Parse.Query.fromJSON('Profile', queryParams);
|
|
|
|
- // query.equalTo('identity','工作联系人')
|
|
|
|
- // query.select('objectId')
|
|
|
|
- // let p = await query.first()
|
|
|
|
- // if(p?.id){
|
|
|
|
- // item.set('profileSubmitted',p.toPointer())
|
|
|
|
- // await item.save()
|
|
|
|
- // console.log('绑定成功'+p.id+':'+item?.get('name'));
|
|
|
|
- // count++
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // let arr = [];
|
|
|
|
- // let query = new Parse.Query('EduTextbook');
|
|
|
|
- // query.notEqualTo('isDeleted', true);
|
|
|
|
- // query.notEqualTo('discard', true);
|
|
|
|
- // query.equalTo('render', true);
|
|
|
|
- // query.select(
|
|
|
|
- // 'title',
|
|
|
|
- // 'childrens.ISBN',
|
|
|
|
- // 'childrens.author',
|
|
|
|
- // 'childrens.editionUnit',
|
|
|
|
- // 'inviteUnit'
|
|
|
|
- // );
|
|
|
|
- // query.limit(3000);
|
|
|
|
- // query.containedIn('status', ['400']);
|
|
|
|
- // let eduTextbook = await query.find();
|
|
|
|
- // for (let index = 0; index < eduTextbook.length; index++) {
|
|
|
|
- // const item = eduTextbook[index];
|
|
|
|
- // let ISBN = '',
|
|
|
|
- // author = '',
|
|
|
|
- // editionUnit = '';
|
|
|
|
- // item?.get('childrens').forEach((children: any) => {
|
|
|
|
- // ISBN = children?.get('ISBN') + ' ' + ISBN;
|
|
|
|
- // author = children?.get('author') + ' ' + author;
|
|
|
|
- // editionUnit = children?.get('editionUnit') + ' ' + editionUnit;
|
|
|
|
- // });
|
|
|
|
- // arr.push({
|
|
|
|
- // 教材名称: item?.get('title'),
|
|
|
|
- // ISBN: ISBN,
|
|
|
|
- // 作者: author,
|
|
|
|
- // 出版社: editionUnit,
|
|
|
|
- // 所属院校: item?.get('inviteUnit'),
|
|
|
|
- // });
|
|
|
|
- // }
|
|
|
|
- // console.log(arr);
|
|
|
|
|
|
+ /* 获取已有联系人出版单位、未注册联系人出版单位 */
|
|
|
|
+ async getUnitList() {
|
|
|
|
+ let unitList = new Set<string>(); //单位出版社
|
|
|
|
+ let query = new Parse.Query('EduTextbook');
|
|
|
|
+ query.equalTo('status', '400');
|
|
|
|
+ query.notEqualTo('isDeleted', true);
|
|
|
|
+ query.notEqualTo('discard', true);
|
|
|
|
+ query.include('user.phone', 'childrens.editionUnit');
|
|
|
|
+ query.select('user.phone', 'childrens.editionUnit')
|
|
|
|
+ query.limit(1000);
|
|
|
|
+ let r = await query.find();
|
|
|
|
+ r.forEach((item) => {
|
|
|
|
+ item
|
|
|
|
+ .get('childrens')
|
|
|
|
+ ?.forEach((child: any) => unitList.add(child?.get('editionUnit')));
|
|
|
|
+ });
|
|
|
|
+ let unitArr = Array.from(unitList);
|
|
|
|
+ console.log('已被选择的申报单位:',unitArr);
|
|
|
|
+ let queryParams: any = {
|
|
|
|
+ where: {
|
|
|
|
+ $or: [
|
|
|
|
+ {
|
|
|
|
+ department: {
|
|
|
|
+ $inQuery: {
|
|
|
|
+ where: {
|
|
|
|
+ name: { $in: unitArr },
|
|
|
|
+ },
|
|
|
|
+ className: 'Department',
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ };
|
|
|
|
+ let queryEduProcess = Parse.Query.fromJSON('EduProcess', queryParams);
|
|
|
|
+ queryEduProcess.include('profileSubmitted.user');
|
|
|
|
+ queryEduProcess.select('profileSubmitted.user.phone','name')
|
|
|
|
+ query.limit(1000)
|
|
|
|
+ let list = await queryEduProcess.find();
|
|
|
|
+ // console.log(list);
|
|
|
|
+ let unitPhoneList = new Set<string>(); //出版单位联系人
|
|
|
|
+ let notUnitPhoneList = new Set<string>(); //出版单位联系人
|
|
|
|
+ list.map(item=> {
|
|
|
|
+ if(item?.get('profileSubmitted')?.get('user')?.get('phone')){
|
|
|
|
+ // unitPhoneList.add(item?.get('profileSubmitted')?.get('user')?.get('phone'))
|
|
|
|
+ unitPhoneList.add(item?.get('name'))
|
|
|
|
+ }else{
|
|
|
|
+ notUnitPhoneList.add(item?.get('name'))
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ let a = Array.from(unitPhoneList), b = Array.from(notUnitPhoneList)
|
|
|
|
+ console.log('已注册联系:', Array.from(unitPhoneList));
|
|
|
|
+ console.log('未注册联系:',Array.from(notUnitPhoneList));
|
|
|
|
+ let len = a.length > b.length ? a.length : b.length
|
|
|
|
+ let table = `<table border="1px" cellspacing="0" cellpadding="0">
|
|
|
|
+ <thead>
|
|
|
|
+ <tr>
|
|
|
|
+ <th>已注册</th>
|
|
|
|
+ <th>未注册</th>
|
|
|
|
+ </tr>
|
|
|
|
+ </thead>
|
|
|
|
+ <tbody>
|
|
|
|
+ `;
|
|
|
|
+
|
|
|
|
+ let _body = '';
|
|
|
|
+ for (var row = 0; row < len; row++) {
|
|
|
|
+ _body += '<tr>';
|
|
|
|
+ _body += '<td>';
|
|
|
|
+ _body += `${a[row] || ''}`;
|
|
|
|
+ _body += '</td>';
|
|
|
|
+
|
|
|
|
+ _body += '<td>';
|
|
|
|
+ _body += ` ${b[row] || ''}`;
|
|
|
|
+ _body += '</td>';
|
|
|
|
+
|
|
|
|
+ _body += '</tr>';
|
|
|
|
+ }
|
|
|
|
+ table += _body;
|
|
|
|
+ table += '</tbody>';
|
|
|
|
+ table += '</table>';
|
|
|
|
+ let title = '出版社';
|
|
|
|
+ this.excel(table, `${title}.xls`);
|
|
}
|
|
}
|
|
/* 格式化拓展表字段 */
|
|
/* 格式化拓展表字段 */
|
|
fromatFiled(list: Array<Parse.Object>, filed: string): string {
|
|
fromatFiled(list: Array<Parse.Object>, filed: string): string {
|