12345678910111213141516171819202122232425262728293031323334353637383940 |
- // 计算变更令,正负变更数
- const defaultInfo = require('../app/const/tender_info');
- const BaseUtil = require('./baseUtils');
- const querySql = BaseUtil.querySql;
- const ZhCalc = BaseUtil.ZhCalc;
- const saveJSON = async function(obj, file) {
- let defineStr = JSON.stringify(obj, '', '\t');
- await BaseUtil.saveBufferFile(defineStr, file);
- };
- const loadReportArchiveData = async function() {
- //const tid = 4417, sOrder = 2;
- const tid = 3698, sOrder = 7;
- const stage = await querySql('SELECT * FROM zh_stage where tid = ? and `order` = ?', [tid, sOrder]);
- const rptArchive = await querySql('SELECT * FROM zh_rpt_archive where stage_id = ?', [stage[0].id]);
- for (const ra of rptArchive) {
- ra.content = ra.content ? JSON.parse(ra.content) : [];
- console.log(BaseUtil.getFileName('rptArchive.json'));
- await saveJSON(ra, BaseUtil.getFileName('rptArchive.json'));
- }
- const rptSign = await querySql('SELECT* FROM zh_rpt_archive_encryption where stage_id = ?', [stage[0].id]);
- for (const rs of rptSign) {
- rs.content = rs.content ? JSON.parse(rs.content) : [];
- console.log(BaseUtil.getFileName('rptSign.json'));
- await saveJSON(rs, BaseUtil.getFileName('rptSign.json'));
- }
- };
- const doCompleteTest = async function() {
- try {
- await loadReportArchiveData();
- } catch (err) {
- console.log(err);
- }
- BaseUtil.closePool();
- };
- doCompleteTest();
|