Browse Source

Merge branch 'master' of https://gitea.anxinyun.cn/free-sun/ReportCenter

# Conflicts:
#	api/sequelize-automate.config.js
解决冲突
master
zmh 2 years ago
parent
commit
0dc10cc477
  1. 20
      api/app/lib/controllers/report/achievement.js
  2. 380
      api/app/lib/models/invoice_detail.js
  3. 84
      api/app/lib/models/receivable_detail.js
  4. 4
      api/app/lib/routes/report/index.js
  5. 4
      api/sequelize-automate.config.js

20
api/app/lib/controllers/report/achievement.js

@ -0,0 +1,20 @@
'use strict';
const fs = require('fs');
const moment = require('moment');
//业绩报表相关
async function getReceivedDetail(ctx) {
let rslt = null;
try {
ctx.status = 200
ctx.body = rslt
} catch (error) {
ctx.fs.logger.error(`path:${ctx.path},error:${error}`)
ctx.status = 400;
ctx.body = { name: 'FindAllError', message: '获取失败' }
}
}
module.exports = {
getReceivedDetail
}

380
api/app/lib/models/invoice_detail.js

@ -3,194 +3,194 @@
'use strict'; 'use strict';
module.exports = dc => { module.exports = dc => {
const DataTypes = dc.ORM; const DataTypes = dc.ORM;
const sequelize = dc.orm; const sequelize = dc.orm;
const InvoiceDetail = sequelize.define("invoiceDetail", { const InvoiceDetail = sequelize.define("invoiceDetail", {
id: { id: {
type: DataTypes.INTEGER, type: DataTypes.INTEGER,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
comment: null, comment: null,
primaryKey: true, primaryKey: true,
field: "id", field: "id",
autoIncrement: false autoIncrement: false
}, },
year: { year: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "年度:【申请日期】-年份", comment: "年度:【申请日期】-年份",
primaryKey: false, primaryKey: false,
field: "year", field: "year",
autoIncrement: false autoIncrement: false
}, },
serialNo: { serialNo: {
type: DataTypes.INTEGER, type: DataTypes.INTEGER,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "序号:自动生成\n(自动升序),每一年自动从1开始", comment: "序号:自动生成\n(自动升序),每一年自动从1开始",
primaryKey: false, primaryKey: false,
field: "serial_no", field: "serial_no",
autoIncrement: false autoIncrement: false
}, },
number: { number: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "编号:年份+序号 如2022年1", comment: "编号:年份+序号 如2022年1",
primaryKey: false, primaryKey: false,
field: "number", field: "number",
autoIncrement: false autoIncrement: false
}, },
department: { department: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "部门:申请部门", comment: "部门:申请部门",
primaryKey: false, primaryKey: false,
field: "department", field: "department",
autoIncrement: false autoIncrement: false
}, },
sale: { sale: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "销售人员:申请人", comment: "销售人员:申请人",
primaryKey: false, primaryKey: false,
field: "sale", field: "sale",
autoIncrement: false autoIncrement: false
}, },
contractNo: { contractNo: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "合同编号", comment: "合同编号",
primaryKey: false, primaryKey: false,
field: "contract_no", field: "contract_no",
autoIncrement: false autoIncrement: false
}, },
customer: { customer: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "客户名称:【甲方名称】", comment: "客户名称:【甲方名称】",
primaryKey: false, primaryKey: false,
field: "customer", field: "customer",
autoIncrement: false autoIncrement: false
}, },
item: { item: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "项目名称", comment: "项目名称",
primaryKey: false, primaryKey: false,
field: "item", field: "item",
autoIncrement: false autoIncrement: false
}, },
amount: { amount: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "合同金额:【合同金额\n(元)】", comment: "合同金额:【合同金额\n(元)】",
primaryKey: false, primaryKey: false,
field: "amount", field: "amount",
autoIncrement: false autoIncrement: false
}, },
changeAmount: { changeAmount: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "变更后合同金额", comment: "变更后合同金额",
primaryKey: false, primaryKey: false,
field: "change_amount", field: "change_amount",
autoIncrement: false autoIncrement: false
}, },
invoiceNo: { invoiceNo: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "发票号码:《发票申请单》【发票号】一个发票号码一个行数据", comment: "发票号码:《发票申请单》【发票号】一个发票号码一个行数据",
primaryKey: false, primaryKey: false,
field: "invoice_no", field: "invoice_no",
autoIncrement: false autoIncrement: false
}, },
invoiceType: { invoiceType: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "开票类型:《发票申请单》\n【发票类型】", comment: "开票类型:《发票申请单》\n【发票类型】",
primaryKey: false, primaryKey: false,
field: "invoice_type", field: "invoice_type",
autoIncrement: false autoIncrement: false
}, },
invoiceDate: { invoiceDate: {
type: DataTypes.DATEONLY, type: DataTypes.DATEONLY,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "开票日期:《发票申请单》\n【开票日期】", comment: "开票日期:《发票申请单》\n【开票日期】",
primaryKey: false, primaryKey: false,
field: "invoice_date", field: "invoice_date",
autoIncrement: false autoIncrement: false
}, },
invoiceAmount: { invoiceAmount: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "开票金额:《发票申请单》【发票金额】取财务填写数据", comment: "开票金额:《发票申请单》【发票金额】取财务填写数据",
primaryKey: false, primaryKey: false,
field: "invoice_amount", field: "invoice_amount",
autoIncrement: false autoIncrement: false
}, },
outputTax: { outputTax: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "销项税额:《发票申请单》-销项税额", comment: "销项税额:《发票申请单》-销项税额",
primaryKey: false, primaryKey: false,
field: "output_tax", field: "output_tax",
autoIncrement: false autoIncrement: false
}, },
total: { total: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: false, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "合计:自动算出\n(开票金额+销项税额)", comment: "合计:自动算出\n(开票金额+销项税额)",
primaryKey: false, primaryKey: false,
field: "total", field: "total",
autoIncrement: false autoIncrement: false
}, },
taxRate13: { taxRate13: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "税率13%:《发票申请单》", comment: "税率13%:《发票申请单》",
primaryKey: false, primaryKey: false,
field: "tax_rate13", field: "tax_rate13",
autoIncrement: false autoIncrement: false
}, },
taxRate9: { taxRate9: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "税率9%:《发票申请单》", comment: "税率9%:《发票申请单》",
primaryKey: false, primaryKey: false,
field: "tax_rate9", field: "tax_rate9",
autoIncrement: false autoIncrement: false
}, },
taxRate6: { taxRate6: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "税率6%:《发票申请单》", comment: "税率6%:《发票申请单》",
primaryKey: false, primaryKey: false,
field: "tax_rate6", field: "tax_rate6",
autoIncrement: false autoIncrement: false
} }
}, { }, {
tableName: "invoice_detail", tableName: "invoice_detail",
comment: "", comment: "",
indexes: [] indexes: []
}); });
dc.models.InvoiceDetail = InvoiceDetail; dc.models.InvoiceDetail = InvoiceDetail;
return InvoiceDetail; return InvoiceDetail;
}; };

84
api/app/lib/models/back_detile.js → api/app/lib/models/receivable_detail.js

@ -5,7 +5,7 @@
module.exports = dc => { module.exports = dc => {
const DataTypes = dc.ORM; const DataTypes = dc.ORM;
const sequelize = dc.orm; const sequelize = dc.orm;
const BackDetile = sequelize.define("backDetile", { const ReceivableDetail = sequelize.define("receivableDetail", {
id: { id: {
type: DataTypes.INTEGER, type: DataTypes.INTEGER,
allowNull: false, allowNull: false,
@ -17,52 +17,52 @@ module.exports = dc => {
}, },
year: { year: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "年度", comment: "年度:【申请日期】-年份",
primaryKey: false, primaryKey: false,
field: "year", field: "year",
autoIncrement: false autoIncrement: false
}, },
serialNo: { serialNo: {
type: DataTypes.INTEGER, type: DataTypes.INTEGER,
allowNull: true, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "序号", comment: "序号:自动生成\n(自动升序),每一年自动从1开始",
primaryKey: false, primaryKey: false,
field: "serial_no", field: "serial_no",
autoIncrement: false autoIncrement: false
}, },
number: { number: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "编号", comment: "编号:年份+序号 如2022年1",
primaryKey: false, primaryKey: false,
field: "number", field: "number",
autoIncrement: false autoIncrement: false
}, },
department: { department: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "部门", comment: "部门:申请部门",
primaryKey: false, primaryKey: false,
field: "department", field: "department",
autoIncrement: false autoIncrement: false
}, },
sale: { sale: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "销售人员", comment: "销售人员:申请人",
primaryKey: false, primaryKey: false,
field: "sale", field: "sale",
autoIncrement: false autoIncrement: false
}, },
contractNo: { contractNo: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "合同编号", comment: "合同编号",
primaryKey: false, primaryKey: false,
@ -71,16 +71,16 @@ module.exports = dc => {
}, },
customer: { customer: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "客户名称", comment: "客户名称:【甲方名称】",
primaryKey: false, primaryKey: false,
field: "customer", field: "customer",
autoIncrement: false autoIncrement: false
}, },
item: { item: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "项目名称", comment: "项目名称",
primaryKey: false, primaryKey: false,
@ -89,99 +89,99 @@ module.exports = dc => {
}, },
amount: { amount: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "合同金额", comment: "合同金额:【合同金额\n(元)】",
primaryKey: false, primaryKey: false,
field: "amount", field: "amount",
autoIncrement: false autoIncrement: false
}, },
changeAmount: { changeAmount: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "变更后合同金额", comment: "变更后合同金额",
primaryKey: false, primaryKey: false,
field: "change_amount", field: "change_amount",
autoIncrement: false autoIncrement: false
}, },
backYear: { receivableYear: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "回款年份", comment: "回款年份",
primaryKey: false, primaryKey: false,
field: "back_year", field: "receivable_year",
autoIncrement: false autoIncrement: false
}, },
backDate: { receivableDate: {
type: DataTypes.DATEONLY, type: DataTypes.DATEONLY,
allowNull: true, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "回款日期", comment: "回款日期",
primaryKey: false, primaryKey: false,
field: "back_date", field: "receivable_date",
autoIncrement: false autoIncrement: false
}, },
backAmount: { receivableAmount: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "回款金额", comment: "回款金额",
primaryKey: false, primaryKey: false,
field: "back_amount", field: "receivable_amount",
autoIncrement: false autoIncrement: false
}, },
inBack: { invoicedBack: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "开票-回款", comment: "开票-回款",
primaryKey: false, primaryKey: false,
field: "in_back", field: "invoiced_back ",
autoIncrement: false autoIncrement: false
}, },
remainConAmount: { remainConAmount: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "剩余合同金额", comment: "剩余合同金额",
primaryKey: false, primaryKey: false,
field: "remain_con_amount", field: "remain_con_amount",
autoIncrement: false autoIncrement: false
}, },
backConfirmDate: { incomeConfirmdate: {
type: DataTypes.DATEONLY, type: DataTypes.DATEONLY,
allowNull: true, allowNull: false,
defaultValue: null, defaultValue: null,
comment: "收入确认时间", comment: "收入确认时间",
primaryKey: false, primaryKey: false,
field: "back_confirm_date", field: "income_confirmdate",
autoIncrement: false autoIncrement: false
}, },
payCompany: { thirdPayment: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "第三方付款单位", comment: "第三方付款单位",
primaryKey: false, primaryKey: false,
field: "pay_company", field: "third_payment",
autoIncrement: false autoIncrement: false
}, },
text: { remark: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: null,
comment: "备注", comment: "备注:回款流程》-备注",
primaryKey: false, primaryKey: false,
field: "text", field: "remark",
autoIncrement: false autoIncrement: false
} }
}, { }, {
tableName: "back_detile", tableName: "receivable_detail",
comment: "", comment: "",
indexes: [] indexes: []
}); });
dc.models.BackDetile = BackDetile; dc.models.ReceivableDetail = ReceivableDetail;
return BackDetile; return ReceivableDetail;
}; };

4
api/app/lib/routes/report/index.js

@ -1,6 +1,7 @@
'use strict'; 'use strict';
const report = require('../../controllers/report'); const report = require('../../controllers/report');
const achieve = require('../../controllers/report/achievement');
module.exports = function (app, router, opts) { module.exports = function (app, router, opts) {
app.fs.api.logAttr['GET/reserveItem/report/:type'] = { content: '查询储备项目统计表', visible: false }; app.fs.api.logAttr['GET/reserveItem/report/:type'] = { content: '查询储备项目统计表', visible: false };
@ -8,4 +9,7 @@ module.exports = function (app, router, opts) {
app.fs.api.logAttr['GET/sales/member/list'] = { content: '查询销售人员分布明细表', visible: false }; app.fs.api.logAttr['GET/sales/member/list'] = { content: '查询销售人员分布明细表', visible: false };
router.get('/sales/member/list', report.getSalersReport); router.get('/sales/member/list', report.getSalersReport);
app.fs.api.logAttr['GET/received/detail'] = { content: '查询回款明细表', visible: false };
router.get('/received/detail', achieve.getReceivedDetail);
}; };

4
api/sequelize-automate.config.js

@ -26,10 +26,10 @@ module.exports = {
dir: './app/lib/models', // 指定输出 models 文件的目录 dir: './app/lib/models', // 指定输出 models 文件的目录
typesDir: 'models', // 指定输出 TypeScript 类型定义的文件目录,只有 TypeScript / Midway 等会有类型定义 typesDir: 'models', // 指定输出 TypeScript 类型定义的文件目录,只有 TypeScript / Midway 等会有类型定义
emptyDir: false, // !!! 谨慎操作 生成 models 之前是否清空 `dir` 以及 `typesDir` emptyDir: false, // !!! 谨慎操作 生成 models 之前是否清空 `dir` 以及 `typesDir`
tables: ['contract_detail', 'invoice_detail'], // 指定生成哪些表的 models,如 ['user', 'user_post'];如果为 null,则忽略改属性 tables: ['contract_detail', 'invoice_detail', 'receivable_detail'], // 指定生成哪些表的 models,如 ['user', 'user_post'];如果为 null,则忽略改属性
skipTables: [], // 指定跳过哪些表的 models,如 ['user'];如果为 null,则忽略改属性 skipTables: [], // 指定跳过哪些表的 models,如 ['user'];如果为 null,则忽略改属性
tsNoCheck: false, // 是否添加 `@ts-nocheck` 注释到 models 文件中 tsNoCheck: false, // 是否添加 `@ts-nocheck` 注释到 models 文件中
ignorePrefix: [], // 生成的模型名称忽略的前缀,因为 项目中有以下表名是以 t_ 开头的,在实际模型中不需要, 可以添加多个 [ 't_data_', 't_',] ,长度较长的 前缀放前面 ignorePrefix: [], // 生成的模型名称忽略的前缀,因为 项目中有以下表名是以 t_ 开头的,在实际模型中不需要, 可以添加多个 [ 't_data_', 't_',] ,长度较长的 前缀放前面
attrLength: false, // 在生成模型的字段中 是否生成 如 var(128)这种格式,公司一般使用 String ,则配置为 false attrLength: false, // 在生成模型的字段中 是否生成 如 var(128)这种格式,公司一般使用 String ,则配置为 false
}, }
} }
Loading…
Cancel
Save