1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- // 计算变更令,正负变更数
- 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 roleContent = [];
- for (const c of ra.content) {
- console.log(c.rpt_id, stage[0].id);
- const rptRole = await querySql('SELECT * FROM zh_role_rpt_rel WHERE sid = ? and rpt_id = ?', [stage[0].id, c.rpt_id]);
- if (rptRole.length > 0) {
- if (rptRole[0].rel_content) roleContent.push(JSON.stringify(rptRole[0].rel_content));
- }
- }
- await saveJSON(roleContent, BaseUtil.getFileName('roleContent.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();
|