Browse Source

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

TonyKang 4 years ago
parent
commit
347e39eb08
5 changed files with 87 additions and 78 deletions
  1. 10 10
      app/service/material_audit.js
  2. 8 0
      app/service/tender.js
  3. 0 1
      app/view/material/index.ejs
  4. 0 67
      sql/update.sql
  5. 69 0
      sql/update20200923.sql

+ 10 - 10
app/service/material_audit.js

@@ -252,8 +252,8 @@ module.exports = app => {
                     status: wxConst.status.check,
                     status: wxConst.status.check,
                     tips: wxConst.tips.check,
                     tips: wxConst.tips.check,
                     begin_time: Date.parse(new Date()),
                     begin_time: Date.parse(new Date()),
-                    m_tp: this.ctx.helper.round(materialInfo.m_tp, 2),
-                    hs_m_tp: this.ctx.helper.round(this.ctx.helper.mul(materialInfo.m_tp, 1+materialInfo.rate/100), 2),
+                    m_tp: this.ctx.helper.add(this.ctx.helper.round(materialInfo.m_tp, 2), this.ctx.helper.round(materialInfo.ex_tp, 2)),
+                    hs_m_tp: this.ctx.helper.add(this.ctx.helper.round(this.ctx.helper.mul(materialInfo.m_tp, 1+materialInfo.rate/100), 2), this.ctx.helper.round(this.ctx.helper.mul(materialInfo.ex_tp, 1+materialInfo.rate/100), 2)),
                 };
                 };
                 await this.ctx.helper.sendWechat(audit.aid, smsTypeConst.const.TC, smsTypeConst.judge.approval.toString(), wxConst.template.material, wechatData);
                 await this.ctx.helper.sendWechat(audit.aid, smsTypeConst.const.TC, smsTypeConst.judge.approval.toString(), wxConst.template.material, wechatData);
 
 
@@ -334,8 +334,8 @@ module.exports = app => {
                         status: wxConst.status.check,
                         status: wxConst.status.check,
                         tips: wxConst.tips.check,
                         tips: wxConst.tips.check,
                         begin_time: Date.parse(begin_audit.begin_time),
                         begin_time: Date.parse(begin_audit.begin_time),
-                        m_tp: this.ctx.helper.round(materialInfo.m_tp, 2),
-                        hs_m_tp: this.ctx.helper.round(this.ctx.helper.mul(materialInfo.m_tp, 1+materialInfo.rate/100), 2),
+                        m_tp: this.ctx.helper.add(this.ctx.helper.round(materialInfo.m_tp, 2), this.ctx.helper.round(materialInfo.ex_tp, 2)),
+                        hs_m_tp: this.ctx.helper.add(this.ctx.helper.round(this.ctx.helper.mul(materialInfo.m_tp, 1+materialInfo.rate/100), 2), this.ctx.helper.round(this.ctx.helper.mul(materialInfo.ex_tp, 1+materialInfo.rate/100), 2)),
                     };
                     };
                     await this.ctx.helper.sendWechat(nextAudit.aid, smsTypeConst.const.TC, smsTypeConst.judge.approval.toString(), wxConst.template.material, wechatData);
                     await this.ctx.helper.sendWechat(nextAudit.aid, smsTypeConst.const.TC, smsTypeConst.judge.approval.toString(), wxConst.template.material, wechatData);
 
 
@@ -372,8 +372,8 @@ module.exports = app => {
                         status: wxConst.status.success,
                         status: wxConst.status.success,
                         tips: wxConst.tips.success,
                         tips: wxConst.tips.success,
                         begin_time: Date.parse(begin_audit.begin_time),
                         begin_time: Date.parse(begin_audit.begin_time),
-                        m_tp: this.ctx.helper.round(materialInfo.m_tp, 2),
-                        hs_m_tp: this.ctx.helper.round(this.ctx.helper.mul(materialInfo.m_tp, 1+materialInfo.rate/100), 2),
+                        m_tp: this.ctx.helper.add(this.ctx.helper.round(materialInfo.m_tp, 2), this.ctx.helper.round(materialInfo.ex_tp, 2)),
+                        hs_m_tp: this.ctx.helper.add(this.ctx.helper.round(this.ctx.helper.mul(materialInfo.m_tp, 1+materialInfo.rate/100), 2), this.ctx.helper.round(this.ctx.helper.mul(materialInfo.ex_tp, 1+materialInfo.rate/100), 2)),
                     };
                     };
                     await this.ctx.helper.sendWechat(users, smsTypeConst.const.TC, smsTypeConst.judge.result.toString(), wxConst.template.material, wechatData);
                     await this.ctx.helper.sendWechat(users, smsTypeConst.const.TC, smsTypeConst.judge.result.toString(), wxConst.template.material, wechatData);
 
 
@@ -469,8 +469,8 @@ module.exports = app => {
                     status: wxConst.status.back,
                     status: wxConst.status.back,
                     tips: wxConst.tips.back,
                     tips: wxConst.tips.back,
                     begin_time: Date.parse(begin_audit.begin_time),
                     begin_time: Date.parse(begin_audit.begin_time),
-                    m_tp: this.ctx.helper.round(materialInfo.m_tp, 2),
-                    hs_m_tp: this.ctx.helper.round(this.ctx.helper.mul(materialInfo.m_tp, 1+materialInfo.rate/100), 2),
+                    m_tp: this.ctx.helper.add(this.ctx.helper.round(materialInfo.m_tp, 2), this.ctx.helper.round(materialInfo.ex_tp, 2)),
+                    hs_m_tp: this.ctx.helper.add(this.ctx.helper.round(this.ctx.helper.mul(materialInfo.m_tp, 1+materialInfo.rate/100), 2), this.ctx.helper.round(this.ctx.helper.mul(materialInfo.ex_tp, 1+materialInfo.rate/100), 2)),
                 };
                 };
                 await this.ctx.helper.sendWechat(users, smsTypeConst.const.TC, smsTypeConst.judge.result.toString(), wxConst.template.material, wechatData);
                 await this.ctx.helper.sendWechat(users, smsTypeConst.const.TC, smsTypeConst.judge.result.toString(), wxConst.template.material, wechatData);
 
 
@@ -566,8 +566,8 @@ module.exports = app => {
                     status: wxConst.status.check,
                     status: wxConst.status.check,
                     tips: wxConst.tips.check,
                     tips: wxConst.tips.check,
                     begin_time: Date.parse(begin_audit.begin_time),
                     begin_time: Date.parse(begin_audit.begin_time),
-                    m_tp: this.ctx.helper.round(materialInfo.m_tp, 2),
-                    hs_m_tp: this.ctx.helper.round(this.ctx.helper.mul(materialInfo.m_tp, 1+materialInfo.rate/100), 2),
+                    m_tp: this.ctx.helper.add(this.ctx.helper.round(materialInfo.m_tp, 2), this.ctx.helper.round(materialInfo.ex_tp, 2)),
+                    hs_m_tp: this.ctx.helper.add(this.ctx.helper.round(this.ctx.helper.mul(materialInfo.m_tp, 1+materialInfo.rate/100), 2), this.ctx.helper.round(this.ctx.helper.mul(materialInfo.ex_tp, 1+materialInfo.rate/100), 2)),
                 };
                 };
                 await this.ctx.helper.sendWechat(preAuditor.aid, smsTypeConst.const.TC, smsTypeConst.judge.approval.toString(), wxConst.template.material, wechatData);
                 await this.ctx.helper.sendWechat(preAuditor.aid, smsTypeConst.const.TC, smsTypeConst.judge.approval.toString(), wxConst.template.material, wechatData);
 
 

+ 8 - 0
app/service/tender.js

@@ -285,8 +285,16 @@ module.exports = app => {
                 await transaction.delete(this.ctx.service.stageAudit.tableName, { tid: id });
                 await transaction.delete(this.ctx.service.stageAudit.tableName, { tid: id });
                 await transaction.delete(this.ctx.service.stageBills.tableName, { tid: id });
                 await transaction.delete(this.ctx.service.stageBills.tableName, { tid: id });
                 await transaction.delete(this.ctx.service.stagePos.tableName, { tid: id });
                 await transaction.delete(this.ctx.service.stagePos.tableName, { tid: id });
+                await transaction.delete(this.ctx.service.stageBillsDgn.tableName, {tid: id});
+                await transaction.delete(this.ctx.service.stageBillsFinal.tableName, {tid: id});
+                await transaction.delete(this.ctx.service.stagePosFinal.tableName, {tid: id});
                 await transaction.delete(this.ctx.service.stageDetail.tableName, { tid: id });
                 await transaction.delete(this.ctx.service.stageDetail.tableName, { tid: id });
                 await transaction.delete(this.ctx.service.stagePay.tableName, { tid: id });
                 await transaction.delete(this.ctx.service.stagePay.tableName, { tid: id });
+                await transaction.delete(this.ctx.service.stageChange.tableName, { tid: id });
+
+                await transaction.delete(this.ctx.service.stageJgcl.tableName, {tid: id});
+                await transaction.delete(this.ctx.service.stageBonus.tableName, {tid: id});
+                await transaction.delete(this.ctx.service.stageOther.tableName, {tid: id});
 
 
                 await transaction.delete(this.ctx.service.change.tableName, { tid: id });
                 await transaction.delete(this.ctx.service.change.tableName, { tid: id });
                 await transaction.delete(this.ctx.service.changeAudit.tableName, { tid: id });
                 await transaction.delete(this.ctx.service.changeAudit.tableName, { tid: id });

+ 0 - 1
app/view/material/index.ejs

@@ -44,7 +44,6 @@
                             <td>
                             <td>
                                 <a href="<%- '/tender/' + ctx.tender.id + '/measure/material/' + m.order %>">第 <%- m.order %> 期</a>
                                 <a href="<%- '/tender/' + ctx.tender.id + '/measure/material/' + m.order %>">第 <%- m.order %> 期</a>
                             </td>
                             </td>
-                            <% console.log(ctx.helper.add(ctx.helper.round(ctx.helper.mul(m.ex_tp, 1+m.rate/100), 2), ctx.helper.round(ctx.helper.mul(m.m_tp, 1+m.rate/100), 2))) %>
                             <td class="text-center"><%= moment(m.in_time).format('YYYY-MM-DD') %></td>
                             <td class="text-center"><%= moment(m.in_time).format('YYYY-MM-DD') %></td>
                             <td class="text-center">第 <%= m.s_order %> 期</td>
                             <td class="text-center">第 <%= m.s_order %> 期</td>
                             <td class="text-right"><%= m.m_tp !== null ? ctx.helper.round(m.m_tp, 2) : null %></td>
                             <td class="text-right"><%= m.m_tp !== null ? ctx.helper.round(m.m_tp, 2) : null %></td>

+ 0 - 67
sql/update.sql

@@ -1,69 +0,0 @@
-ALTER TABLE `zh_project` CHANGE `page_show` `page_show` VARCHAR(5000) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT '{\"bwtz\":\"1\"}' COMMENT '前台页面或功能展示与隐藏';
-
-ALTER TABLE `zh_change_audit_list` ADD `xmj_code` VARCHAR(500) NULL DEFAULT NULL COMMENT '项目节编号' AFTER `detail`, ADD `xmj_jldy` VARCHAR(500) NULL DEFAULT NULL COMMENT '细目' AFTER `xmj_code`;
-
-CREATE TABLE `zh_login_logging` (
-  `id` int(11) NOT NULL AUTO_INCREMENT,
-  `browser` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '浏览器信息',
-  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '登录时间',
-  `ip` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '登录ip',
-  `os` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '操作系统',
-  `address` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '登录地址',
-  `uid` int(11) NOT NULL COMMENT '用户id',
-  `pid` int(11) NOT NULL COMMENT '项目id',
-  `type` int(1) NOT NULL COMMENT '登录类型:1(sso登录) | 2(正常或副密码登录) | 3(接口登录或微信登录)',
-  `show` int(1) NOT NULL COMMENT '是否显示: 0-显示,1-不显示',
-  PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=382 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='登录日志';
-
-ALTER TABLE `zh_material_bills` ADD `is_summary` TINYINT(1) NOT NULL DEFAULT '1' COMMENT '是否汇总' AFTER `remark`;
-
-ALTER TABLE `zh_material_bills_history` ADD `is_summary` TINYINT(1) NOT NULL DEFAULT '1' COMMENT '是否汇总' AFTER `pre_tp`;
-
-ALTER TABLE `zh_deal_bills`
-MODIFY COLUMN `id`  varchar(50) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL COMMENT '主键(uuid)' FIRST ,
-CHANGE COLUMN `deal_id` `order`  int(11) NOT NULL AFTER `tender_id`;
-
-ALTER TABLE `zh_stage_jgcl`
-ADD COLUMN `tid`  int(11) NULL COMMENT '标段id' AFTER `add_sid`;
-
-Update zh_stage_jgcl LEFT JOIN zh_stage ON zh_stage_jgcl.sid = zh_stage.id Set zh_stage_jgcl.tid = zh_stage.tid
-
-ALTER TABLE `zh_material` ADD `ex_tp` DECIMAL(30,8) NULL DEFAULT NULL COMMENT '指数本期金额' AFTER `pre_tp`, ADD `ex_pre_tp` DECIMAL(30,8) NULL DEFAULT NULL COMMENT '指数截止上期金额' AFTER `ex_tp`, ADD `ex_expr` VARCHAR(5000) NULL DEFAULT NULL COMMENT '指数调差结果公式' AFTER `ex_pre_tp`, ADD `ex_calc` VARCHAR(1000) NULL DEFAULT NULL COMMENT '调差基数值json' AFTER `ex_expr`;
-
-CREATE TABLE `zh_material_exponent` (
-  `id` int(11) NOT NULL AUTO_INCREMENT,
-  `tid` int(11) NOT NULL COMMENT '标段id',
-  `mid` int(11) NOT NULL COMMENT '调差期id',
-  `type` tinyint(1) NOT NULL DEFAULT '2' COMMENT '类型(1定值或2变值)',
-  `symbol` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '符号',
-  `symbol_desc` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '符号说明',
-  `code` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '编号',
-  `weight_num` decimal(30,8) DEFAULT NULL COMMENT '加权系数',
-  `basic_price` decimal(30,8) DEFAULT NULL COMMENT '基本价格',
-  `basic_times` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '基准时间',
-  `m_price` decimal(30,8) DEFAULT NULL COMMENT '现行价格指数',
-  `calc_num` decimal(30,8) DEFAULT NULL COMMENT '计算值',
-  `remark` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '备注',
-  `is_summary` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否汇总,默认为1是',
-  `in_time` datetime NOT NULL COMMENT '添加时间',
-  PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='指数调差表';
-
-CREATE TABLE `zh_material_exponent_history` (
-  `id` int(11) NOT NULL AUTO_INCREMENT,
-  `tid` int(11) NOT NULL COMMENT '所属标段id',
-  `mid` int(11) NOT NULL COMMENT '调差期id',
-  `order` tinyint(4) NOT NULL COMMENT '调差期期数',
-  `me_id` int(11) NOT NULL COMMENT '指数id',
-  `type` tinyint(1) NOT NULL DEFAULT '2' COMMENT '类型(1定值或2变值)',
-  `weight_num` decimal(30,8) DEFAULT NULL COMMENT '本期加权系数',
-  `basic_price` decimal(30,8) DEFAULT NULL COMMENT '本期基本价格指数',
-  `basic_times` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '本期基准时间',
-  `m_price` decimal(30,8) DEFAULT NULL COMMENT '本期现行价格指数',
-  `calc_num` decimal(30,8) DEFAULT NULL COMMENT '计算值',
-  `is_summary` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否汇总',
-  PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='指数调差清单历史表';

+ 69 - 0
sql/update20200923.sql

@@ -0,0 +1,69 @@
+ALTER TABLE `zh_project` CHANGE `page_show` `page_show` VARCHAR(5000) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT '{\"bwtz\":\"1\"}' COMMENT '前台页面或功能展示与隐藏';
+
+ALTER TABLE `zh_change_audit_list` ADD `xmj_code` VARCHAR(500) NULL DEFAULT NULL COMMENT '项目节编号' AFTER `detail`, ADD `xmj_jldy` VARCHAR(500) NULL DEFAULT NULL COMMENT '细目' AFTER `xmj_code`;
+
+CREATE TABLE `zh_login_logging` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `browser` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '浏览器信息',
+  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '登录时间',
+  `ip` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '登录ip',
+  `os` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '操作系统',
+  `address` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '登录地址',
+  `uid` int(11) NOT NULL COMMENT '用户id',
+  `pid` int(11) NOT NULL COMMENT '项目id',
+  `type` int(1) NOT NULL COMMENT '登录类型:1(sso登录) | 2(正常或副密码登录) | 3(接口登录或微信登录)',
+  `show` int(1) NOT NULL COMMENT '是否显示: 0-显示,1-不显示',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=382 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='登录日志';
+
+ALTER TABLE `zh_material_bills` ADD `is_summary` TINYINT(1) NOT NULL DEFAULT '1' COMMENT '是否汇总' AFTER `remark`;
+
+ALTER TABLE `zh_material_bills_history` ADD `is_summary` TINYINT(1) NOT NULL DEFAULT '1' COMMENT '是否汇总' AFTER `pre_tp`;
+
+ALTER TABLE `zh_deal_bills`
+MODIFY COLUMN `id`  varchar(50) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL COMMENT '主键(uuid)' FIRST ,
+CHANGE COLUMN `deal_id` `order`  int(11) NOT NULL AFTER `tender_id`;
+
+-- 2020-9-21
+ALTER TABLE `zh_stage_jgcl`
+ADD COLUMN `tid`  int(11) NULL COMMENT '标段id' AFTER `add_sid`;
+
+Update zh_stage_jgcl LEFT JOIN zh_stage ON zh_stage_jgcl.sid = zh_stage.id Set zh_stage_jgcl.tid = zh_stage.tid;
+
+-- 指数调差
+ALTER TABLE `zh_material` ADD `ex_tp` DECIMAL(30,8) NULL DEFAULT NULL COMMENT '指数本期金额' AFTER `pre_tp`, ADD `ex_pre_tp` DECIMAL(30,8) NULL DEFAULT NULL COMMENT '指数截止上期金额' AFTER `ex_tp`, ADD `ex_expr` VARCHAR(5000) NULL DEFAULT NULL COMMENT '指数调差结果公式' AFTER `ex_pre_tp`, ADD `ex_calc` VARCHAR(1000) NULL DEFAULT NULL COMMENT '调差基数值json' AFTER `ex_expr`;
+
+CREATE TABLE `zh_material_exponent` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `tid` int(11) NOT NULL COMMENT '标段id',
+  `mid` int(11) NOT NULL COMMENT '调差期id',
+  `type` tinyint(1) NOT NULL DEFAULT '2' COMMENT '类型(1定值或2变值)',
+  `symbol` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '符号',
+  `symbol_desc` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '符号说明',
+  `code` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '编号',
+  `weight_num` decimal(30,8) DEFAULT NULL COMMENT '加权系数',
+  `basic_price` decimal(30,8) DEFAULT NULL COMMENT '基本价格',
+  `basic_times` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '基准时间',
+  `m_price` decimal(30,8) DEFAULT NULL COMMENT '现行价格指数',
+  `calc_num` decimal(30,8) DEFAULT NULL COMMENT '计算值',
+  `remark` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '备注',
+  `is_summary` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否汇总,默认为1是',
+  `in_time` datetime NOT NULL COMMENT '添加时间',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='指数调差表';
+
+CREATE TABLE `zh_material_exponent_history` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `tid` int(11) NOT NULL COMMENT '所属标段id',
+  `mid` int(11) NOT NULL COMMENT '调差期id',
+  `order` tinyint(4) NOT NULL COMMENT '调差期期数',
+  `me_id` int(11) NOT NULL COMMENT '指数id',
+  `type` tinyint(1) NOT NULL DEFAULT '2' COMMENT '类型(1定值或2变值)',
+  `weight_num` decimal(30,8) DEFAULT NULL COMMENT '本期加权系数',
+  `basic_price` decimal(30,8) DEFAULT NULL COMMENT '本期基本价格指数',
+  `basic_times` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '本期基准时间',
+  `m_price` decimal(30,8) DEFAULT NULL COMMENT '本期现行价格指数',
+  `calc_num` decimal(30,8) DEFAULT NULL COMMENT '计算值',
+  `is_summary` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否汇总',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='指数调差清单历史表';