Browse Source

批量处理脚本

warrior 4 months ago
parent
commit
6af22b81ea

+ 1 - 1
projects/textbook/src/modules/common/textbook-details/textbook-details.component.html

@@ -170,7 +170,7 @@
                 </div>
                 <div class="row">
                   <div class="label">初版以来合计印数</div>
-                  <div class="value">{{ volume?.printSum }}</div>
+                  <div class="value">{{ volume?.printSum }}万册</div>
                 </div>
                 <div class="row">
                   <div class="label">初版以来是否曾列为重点项目</div>

+ 24 - 0
projects/textbook/src/services/importDept.ts

@@ -2521,4 +2521,28 @@ export const updateDept = {
     { code: '202409268853a', title: '农业气象学(第3版)' },
     { code: '202409268853b', title: ' 动物营养学(第四版)' },
   ],
+  list6: [
+    { code: '202409130644', isbn: '暂无', type: '纸质教材附带数字资源' },
+    { code: '202409181349', isbn: '暂无', type: '纸质教材附带数字资源' },
+    { code: '202409225565', isbn: '暂无', type: '纸质教材附带数字资源' },
+    { code: '202409028193', isbn: '暂无', type: '纸质教材附带数字资源' },
+    { code: '202409124123', isbn: '暂无', type: '纸质教材' },
+    { code: '202409093173', isbn: '暂无', type: '纸质教材附带数字资源' },
+    { code: '202409178376', isbn: '暂无', type: '纸质教材附带数字资源' },
+    { code: '202409156693', isbn: '暂无', type: '纸质教材附带数字资源' },
+    { code: '202409193746', isbn: '暂无', type: '纸质教材附带数字资源' },
+    { code: '202409069059', isbn: '暂无', type: '纸质教材附带数字资源' },
+    { code: '202409125214', isbn: '暂无', type: '纸质教材附带数字资源' },
+    { code: '202409203478', isbn: '暂无', type: '纸质教材附带数字资源' },
+    { code: '202409082588', isbn: '暂无', type: '纸质教材附带数字资源' },
+    { code: '202409140405', isbn: '暂无', type: '纸质教材附带数字资源' },
+    {
+      code: '202409148424',
+      isbn: '9787040632668',
+      type: '纸质教材附带数字资源',
+    },
+    { code: '202409145156', isbn: '暂无', type: '纸质教材附带数字资源' },
+    { code: '202408290958', isbn: '暂无', type: '纸质教材附带数字资源' },
+    { code: '202409085021', isbn: '暂无', type: '纸质教材附带数字资源' },
+  ],
 };

+ 20 - 24
projects/textbook/src/services/shell.ts

@@ -326,7 +326,7 @@ export class shellServer {
   }
   //导出表格
   async exportEduTextbook() {
-    let unitName = '科学出版社';
+    let unitName = '未提交';
     try {
       let queryParams: any = {
         where: {
@@ -335,7 +335,8 @@ export class shellServer {
               childrens: {
                 $inQuery: {
                   where: {
-                    editionUnit: unitName,
+                    // editionUnit: unitName,
+                    collectStatus:{$ne: '200'}
                   },
                   className: 'EduTextbookVolume',
                 },
@@ -378,7 +379,7 @@ export class shellServer {
       let table = `<table border="1px" cellspacing="0" cellpadding="0">
         <thead>
           <tr>
-            <th>号</th>
+            <th>申报编号</th>
             <th>申报教材名称</th>
             <th>第一主编/作者</th>
             <th>ISBN</th>
@@ -393,9 +394,8 @@ export class shellServer {
       // let table = `<table border="1px" cellspacing="0" cellpadding="0">
       // <thead>
       //   <tr>
-      //     <th>号</th>
+      //     <th>申报编号</th>
       //     <th>申报教材名称</th>
-      //     <th>code</th>
       //     <th>所属单位</th>
       //     <th>单位联系人</th>
       //     <th>联系人电话</th>
@@ -420,17 +420,13 @@ export class shellServer {
         }
         _body += '<tr>';
         _body += '<td>';
-        _body += `${row}`;
+        _body += `&nbsp;${data[row].get('code') || ''}`;
         _body += '</td>';
 
         _body += '<td>';
         _body += ` &nbsp;${data[row].get('title') || '-'}`;
         _body += '</td>';
 
-        // _body += '<td>';
-        // _body += `&nbsp;${data[row].get('code') || ''}`;
-        // _body += '</td>';
-
         // _body += '<td>';
         // _body += `&nbsp;${data[row].get('inviteUnit') || ''}`;
         // _body += '</td>';
@@ -642,28 +638,28 @@ export class shellServer {
   /* 更新教材个别字段 */
   async updateTextbook() {
     let arr = []
-    let list = updateDept.list5
+    let list = updateDept.list6
     for (let index = 0; index < list.length; index++) {
       const item = list[index];
-      let oldc=item.code.substring(0,item.code.length-1)
-      console.log(oldc);
+      // let oldc=item.code.substring(0,item.code.length-1)
+      // console.log(oldc);
       let query = new Parse.Query('EduTextbook')
-      query.equalTo('code',oldc)
-      query.equalTo('title',item.title)
+      query.equalTo('code',item.code)
       query.notEqualTo('isDeleted',true)
-      // query.include('childrens')
-      // query.select('childrens')
+      // query.equalTo('title',item.title)
+      query.include('childrens')
+      query.select('childrens')
       let r = await query.find()
-      // if(r.length <1 || r.length > 1 || r[0]?.get('childrens').length > 1){
-      if(r.length !== 1){
+      if(r.length <1 || r.length > 1 || r[0]?.get('childrens').length > 1){
+      // if(r.length !== 1){
         arr.push(item.code)
         continue
       }
-      // let eduTextbookVolume = r[0]?.get('childrens')[0]
-      // item.type.trim() != '暂无' && eduTextbookVolume?.set('carrierShape',item.type.trim())
-      // item.isbn.trim() != '暂无' && eduTextbookVolume?.set('ISBN',item.isbn.trim())
-      // await eduTextbookVolume?.save()
-      r[0]?.set('code',item.code)
+      let eduTextbookVolume = r[0]?.get('childrens')[0]
+      item.type.trim() != '暂无' && eduTextbookVolume?.set('carrierShape',item.type.trim())
+      item.isbn.trim() != '暂无' && eduTextbookVolume?.set('ISBN',item.isbn.trim())
+      await eduTextbookVolume?.save()
+      // r[0]?.set('code',item.code)
       r[0]?.set('exportPDF',null)
       await r[0]?.save()
       console.log('update=>',item);