From 116a6402761f10feb2b469613f420d9df29f07aa Mon Sep 17 00:00:00 2001 From: liupopo Date: Sun, 6 Aug 2023 14:27:24 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=9B=91=E7=AE=A1=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data_modify/data_modify-crm2system().sql | 2 + .../table_create_report_project_daily.sql | 4 +- docs/databases/table_modify.sql | 4 + .../src/api/project/projectDaily.js | 27 +- .../src/router/modules/codemenu.js | 2 +- .../src/views/project/projectDaily.vue | 535 ++++++++++++++---- .../report/biz/projectdaily/ProjectDaily.java | 3 + .../ProjectDailyFilesService.java | 9 + .../biz/projectdaily/ProjectDailyQuery.java | 3 + .../biz/projectdaily/ProjectDailyRest.java | 53 +- .../biz/projectdaily/ProjectDailyService.java | 72 ++- 11 files changed, 564 insertions(+), 150 deletions(-) create mode 100644 docs/databases/data_modify/data_modify-crm2system().sql diff --git a/docs/databases/data_modify/data_modify-crm2system().sql b/docs/databases/data_modify/data_modify-crm2system().sql new file mode 100644 index 00000000..a55899e6 --- /dev/null +++ b/docs/databases/data_modify/data_modify-crm2system().sql @@ -0,0 +1,2 @@ +insert into yxt_portal.sys_user(sid, userName, password,staffSid,mobile,userType) +select uuid(),bm.name,'8ee032c2f0b2db72c45ac82007c8dac3',bm.sid,bm.telephone,3 from supervise_crm.bank_manager bm; \ No newline at end of file diff --git a/docs/databases/report/table_create_report_project_daily.sql b/docs/databases/report/table_create_report_project_daily.sql index 59ea1984..ac808b75 100644 --- a/docs/databases/report/table_create_report_project_daily.sql +++ b/docs/databases/report/table_create_report_project_daily.sql @@ -18,7 +18,9 @@ CREATE TABLE `project_daily` ( `transitAmount` DOUBLE(12,2) DEFAULT 0 COMMENT '在途货值', `advancePayment` DOUBLE(12,2) DEFAULT 0 COMMENT '预付款', `pledgeRate` DOUBLE(12,2) DEFAULT 0 COMMENT '质押率=(贷款金额-帐户余额)/(库存总价值+应收帐款+在途商品+预付款)', - + + `messState` int(11) DEFAULT 0 COMMENT '消息发送状态: 0=未发送;1=已发送', + `messNum` int(11) DEFAULT 0 COMMENT '消息发送次数', PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB COMMENT='项目监管报表'; diff --git a/docs/databases/table_modify.sql b/docs/databases/table_modify.sql index 9d5b993d..7332f279 100644 --- a/docs/databases/table_modify.sql +++ b/docs/databases/table_modify.sql @@ -36,3 +36,7 @@ ALTER TABLE yxt_portal.sys_staffinfo ADD openId varchar(100) DEFAULT NULL COMMEN ALTER TABLE supervise_supplychain.purchase_requisition_pro MODIFY COLUMN packageTotalPrice double(12,2) NULL COMMENT '包合计(元)(对应采购订单中的送货金额)'; ALTER TABLE supervise_supplychain.supplier_index ADD sid varchar(100) NULL; + + +ALTER TABLE yxt_portal.sys_user ADD openid varchar(100) NULL COMMENT '微信公众号OpenID'; +ALTER TABLE yxt_portal.sys_user ADD appletOpenid varchar(100) NULL COMMENT '小程序OpenID'; diff --git a/supervise-report-ui/src/api/project/projectDaily.js b/supervise-report-ui/src/api/project/projectDaily.js index bd1aeaa1..1d1f7e6b 100644 --- a/supervise-report-ui/src/api/project/projectDaily.js +++ b/supervise-report-ui/src/api/project/projectDaily.js @@ -12,5 +12,28 @@ export default { data: params }) }, - -} + // 所有项目信息列表 + projectListAll: function() { + return request({ + baseURL: '/api', + url: '/crm/v1/projectinformation/listAll' + }) + }, + // 保存项目监管数据 + saveDaily: function(params) { + return request({ + baseURL: '/api', + url: '/report/projectdaily/saveDaily', + method: 'post', + data: params + }) + }, + // 发送通知 + sendMess: function(projectSid, orderDate) { + return request({ + baseURL: '/api', + url: '/report/projectdaily/sendMess/' + projectSid + "/" + orderDate + }) + } + +} \ No newline at end of file diff --git a/supervise-report-ui/src/router/modules/codemenu.js b/supervise-report-ui/src/router/modules/codemenu.js index 42a87b3e..2ccff711 100644 --- a/supervise-report-ui/src/router/modules/codemenu.js +++ b/supervise-report-ui/src/router/modules/codemenu.js @@ -106,7 +106,7 @@ const codemenu = [{ children: [{ path: '/projectDaily/index', component: () => import('@/views/project/projectDaily.vue'), - name: 'inventorySummary', + name: 'projectDailyIndex', meta: { title: '项目监管报表', noCache: true, diff --git a/supervise-report-ui/src/views/project/projectDaily.vue b/supervise-report-ui/src/views/project/projectDaily.vue index 776f06b5..19ff1929 100644 --- a/supervise-report-ui/src/views/project/projectDaily.vue +++ b/supervise-report-ui/src/views/project/projectDaily.vue @@ -1,7 +1,7 @@ @@ -100,6 +213,9 @@ import Pagination from '@/components/pagination' import pageye from '@/components/pagination/pageye' import req from '@/api/project/projectDaily' + import { + parseTime + } from '@/utils/index' export default { name: 'DaydatauploadCash', components: { @@ -108,6 +224,23 @@ pageye }, data() { + var checkIsNumber = (rule, value, callback) => { + if (!value) { // 当使用时没有定义text则非空验证默认提示请输入 + callback(new Error(rule.text ? rule.text : '请输入')) + } else { + // const reg = /^[0-9]*$/ + const reg = /^[+-]?\d+(?:\.\d{1,4})?$/ + if (reg.test(value) && value >= 0) { + callback() + } else { + if (!String(value).indexOf('.') + 1) { + callback(new Error('请输入数字!')) + } else { + callback(new Error('仅支持小数点后4位!')) + } + } + } + } return { btndisabled: false, viewState: 1, // 1、列表 2、添加 3、修改 4、查看 @@ -119,7 +252,8 @@ total: 0, params: { dataDateStart: '', - dataDateEnd: '' + dataDateEnd: '', + projectSid: '' } }, tableLoading: false, @@ -129,7 +263,7 @@ size: 'small', icon: 'upload', btnKey: 'showUploadXlsx', - btnLabel: '上传按日汇总对账报表' + btnLabel: '填报当日数据' }, { type: 'info', @@ -139,23 +273,92 @@ btnLabel: '关闭' } ], - fullscreenloading: null, dialogVisible: false, - updateAction: '/api/customer' + '/csmcash/uploadGdData', - fileList: [], - uploadResultMesssage: '', + updateAction: '/api/report' + '/projectdaily/uploadfile', showSelectButton: false, currentLogSid: '', - ychzFilePath: '' + ychzFilePath: '', + projectDaily: { + sid: '', + remarks: '', // 备注说明', + orderDate: parseTime(new Date(), '{y}-{m}-{d}'), // 单据日期', + projectSid: '', // 项目Sid', + projectName: '', // 项目名称', + totalLoan: 0, // 贷款总额', + accountsBalance: 0, // 帐户余额', + accountsReceivable: 0, // 应收账款', + stockAmount: 0, // 库存货值', + transitAmount: 0, // 在途货值', + advancePayment: 0, // 预付款', + fileList: [] + // fileList:[{ + + // fileTypeId: '', // 文件类型: 1=帐户余额;2=应收账款;3=库存货值;4=在途货值;5=预付款;', + // fileTypeName` VARCHAR(100) DEFAULT NULL COMMENT '文件类型名: 1=帐户余额;2=应收账款;3=库存货值;4=在途货值;5=预付款', + // fileSrcName` VARCHAR(100) DEFAULT NULL COMMENT '原文件名', + // filePath` VARCHAR(1024) DEFAULT NULL COMMENT '文件的相对路径', + // fullUrl` VARCHAR(2048) DEFAULT NULL COMMENT '文件完整的访问URL', + // }] + }, + rules: { + projectSid: [{ + required: true, + message: '请选择回监管项目', + trigger: 'blur' + }], + orderDate: [{ + required: true, + message: '请选择填报日期', + trigger: 'blur' + }], + totalLoan: [{ + validator: checkIsNumber, + trigger: 'blur' + }], + accountsBalance: [{ + validator: checkIsNumber, + trigger: 'blur' + }], + accountsReceivable: [{ + validator: checkIsNumber, + trigger: 'blur' + }], + stockAmount: [{ + validator: checkIsNumber, + trigger: 'blur' + }], + transitAmount: [{ + validator: checkIsNumber, + trigger: 'blur' + }], + advancePayment: [{ + validator: checkIsNumber, + trigger: 'blur' + }] + }, + projectList: [], + reportFileList: [] } }, mounted() { this.$refs['btnbar'].setButtonList(this.btnList) }, created() { + this.initData() this.loadList() }, methods: { + initData() { + req.projectListAll().then(res => { + this.projectList = res.data + this.projectDaily.projectSid = this.projectList[0].sid + this.projectDaily.projectName = this.projectList[0].entryName + this.projectDaily.totalLoan = Number(this.projectList[0].creditLimit) + console.log('projectList:', res) + }).catch(e => { + console.log('projectListAll--ee:', e) + }) + }, // 搜索条件效果 clicksearchShow() { this.isSearchShow = !this.isSearchShow @@ -188,7 +391,8 @@ total: 0, params: { dataDateStart: '', - dataDateEnd: '' + dataDateEnd: '', + projectSid: '' } } this.loadList() @@ -214,87 +418,188 @@ showUploadXlsx() { this.dialogVisible = true }, - dialogClose() { - this.clearLog() - this.fileList = [] - this.showSelectButton = false - this.currentLogSid = '' - this.uploadResultMesssage = '' + projectSelectChange() { + for (const i in this.projectList) { + if (this.projectDaily.projectSid === this.projectList[i].sid) { + this.projectDaily.totalLoan = Number(this.projectList[i].creditLimit) + this.projectDaily.projectName = this.projectList[i].entryName + } + } + }, + projectDailyClose() { + this.projectDaily.sid = '' + this.projectDaily.remarks = '' // 备注说明', + this.projectDaily.orderDate = parseTime(new Date(), '{y}-{m}-{d}') // 单据日期', + this.projectDaily.projectSid = this.projectList[0].sid // 项目Sid', + this.projectDaily.projectName = this.projectList[0].entryName // 项目名称', + this.projectDaily.totalLoan = Number(this.projectList[0].creditLimit) // 贷款总额', + this.projectDaily.accountsBalance = 0 // 帐户余额', + this.projectDaily.accountsReceivable = 0 // 应收账款', + this.projectDaily.stockAmount = 0 // 库存货值', + this.projectDaily.transitAmount = 0 // 在途货值', + this.projectDaily.advancePayment = 0 // 预付款', + this.projectDaily.fileList = [] + + this.reportFileList = [] + this.$refs['form_daily'].resetFields() this.dialogVisible = false }, - submitUpload() { - this.$refs.upload.submit() + projectDailySave() { + this.$refs['form_daily'].validate((valid) => { + if (valid) { + this.projectDaily.fileList = this.reportFileList + req.saveDaily(this.projectDaily).then(resp => { + this.loadList() + this.projectDailyClose() + }).catch(e => { + console.log('projectDailySave--e:', e) + }) + } else { + console.log('error submit!!') + return false + } + }) }, - handleProgress(event, file, fileList) { - const _this = this - this.fullscreenloading = this.$loading({ - lock: true, - text: '文件正在上传', - spinner: 'el-icon-loading', - background: 'rgba(0, 0, 0, 0.7)' + sendMess(row) { + req.sendMess(row.projectSid, row.orderDate).then(res => { + this.$message({ + showClose: true, + type: 'success', + message: '消息已经送出' + }) + }).catch(e => { + console.log('sendMess--e: ', e) }) - console.log('111', event.percent) - if (event.percent >= 100) { - _this.fullscreenloading.text = '上传完成,正在导入数据库' + }, + handleSuccess1(resp, file, fileList) { + console.log('111', resp) + const _this = this + let noHasFile = true + for (const i in _this.reportFileList) { + if (_this.reportFileList[i].fileTypeId === 1) { + noHasFile = false + _this.reportFileList[i].fileTypeId = 1 // '文件类型: 1=帐户余额;2=应收账款;3=库存货值;4=在途货值;5=预付款;', + _this.reportFileList[i].fileTypeName = '帐户余额' // '文件类型名: 1=帐户余额;2=应收账款;3=库存货值;4=在途货值;5=预付款', + _this.reportFileList[i].fileSrcName = resp.data.sourceFileName // '原文件名', + _this.reportFileList[i].filePath = resp.data.sourceFileName // '文件的相对路径', + _this.reportFileList[i].fullUrl = resp.data.sourceFileName // '文件完整的访问URL', + break + } + } + if (noHasFile) { + const upfile = { + fileTypeId: 1, // '文件类型: 1=帐户余额;2=应收账款;3=库存货值;4=在途货值;5=预付款;', + fileTypeName: '帐户余额', // '文件类型名: 1=帐户余额;2=应收账款;3=库存货值;4=在途货值;5=预付款', + fileSrcName: resp.data.sourceFileName, // '原文件名', + filePath: resp.data.sourceFileName, // '文件的相对路径', + fullUrl: resp.data.sourceFileName // '文件完整的访问URL', + } + _this.reportFileList.push(upfile) } }, - handleSuccess(resp, file, fileList) { + handleSuccess2(resp, file, fileList) { console.log('222', resp) const _this = this - if (this.fullscreenloading) this.fullscreenloading.close() - this.fullscreenloading = null - if (resp.success) { - _this.uploadResultMesssage = '按日汇总对账报表数据已经导入,可进行回款数据比对~' - _this.loadList() - setTimeout(function() { - _this.dialogClose() - }, 3000) - } else { - _this.fileList = [] - if (resp.code === 'cash_5001') { - _this.uploadResultMesssage = '没有进行数据导入,异常信息为:' + resp.msg - } else if (resp.code === 'cash_5002') { - _this.uploadResultMesssage = resp.msg - _this.showSelectButton = true - _this.currentLogSid = resp.data.sid - } else { - _this.uploadResultMesssage = '上传数据文件异常,请选择正确的汇总对账报表文件上传,异常信息为:' + resp.msg + let noHasFile = true + for (const i in _this.reportFileList) { + if (_this.reportFileList[i].fileTypeId === 2) { + noHasFile = false + _this.reportFileList[i].fileTypeId = 2 // '文件类型: 1=帐户余额;2=应收账款;3=库存货值;4=在途货值;5=预付款;', + _this.reportFileList[i].fileTypeName = '应收账款' // '文件类型名: 1=帐户余额;2=应收账款;3=库存货值;4=在途货值;5=预付款', + _this.reportFileList[i].fileSrcName = resp.data.sourceFileName // '原文件名', + _this.reportFileList[i].filePath = resp.data.sourceFileName // '文件的相对路径', + _this.reportFileList[i].fullUrl = resp.data.sourceFileName // '文件完整的访问URL', + break } } - }, - clearLog() { - if (this.currentLogSid) { - req.clearLog({ - logsid: this.currentLogSid - }).then(res => { - console.log('临时数据已经清除:', this.currentLogSid) - this.currentLogSid = '' - }).catch(e => { - console.log('CsmCashLog-clearLog-ee:', e) - }) + if (noHasFile) { + const upfile = { + fileTypeId: 2, // '文件类型: 1=帐户余额;2=应收账款;3=库存货值;4=在途货值;5=预付款;', + fileTypeName: '应收账款', // '文件类型名: 1=帐户余额;2=应收账款;3=库存货值;4=在途货值;5=预付款', + fileSrcName: resp.data.sourceFileName, // '原文件名', + filePath: resp.data.sourceFileName, // '文件的相对路径', + fullUrl: resp.data.sourceFileName // '文件完整的访问URL', + } + _this.reportFileList.push(upfile) } }, - coverLog() { - if (this.currentLogSid) { - req.coverLog({ - logsid: this.currentLogSid - }).then(res => { - this.loadList() - this.showSelectButton = false - this.currentLogSid = '' - this.dialogVisible = false - this.uploadResultMesssage = '' - }).catch(e => { - console.log('CsmCashLog-coverLog-ee:', e) - }) + handleSuccess3(resp, file, fileList) { + console.log('333', resp) + const _this = this + let noHasFile = true + for (const i in _this.reportFileList) { + if (_this.reportFileList[i].fileTypeId === 3) { + noHasFile = false + _this.reportFileList[i].fileTypeId = 3 // '文件类型: 1=帐户余额;2=应收账款;3=库存货值;4=在途货值;5=预付款;', + _this.reportFileList[i].fileTypeName = '库存货值' // '文件类型名: 1=帐户余额;2=应收账款;3=库存货值;4=在途货值;5=预付款', + _this.reportFileList[i].fileSrcName = resp.data.sourceFileName // '原文件名', + _this.reportFileList[i].filePath = resp.data.sourceFileName // '文件的相对路径', + _this.reportFileList[i].fullUrl = resp.data.sourceFileName // '文件完整的访问URL', + break + } + } + if (noHasFile) { + const upfile = { + fileTypeId: 3, // '文件类型: 1=帐户余额;2=应收账款;3=库存货值;4=在途货值;5=预付款;', + fileTypeName: '库存货值', // '文件类型名: 1=帐户余额;2=应收账款;3=库存货值;4=在途货值;5=预付款', + fileSrcName: resp.data.sourceFileName, // '原文件名', + filePath: resp.data.sourceFileName, // '文件的相对路径', + fullUrl: resp.data.sourceFileName // '文件完整的访问URL', + } + _this.reportFileList.push(upfile) } }, - toEdit(row) { - this.viewState = 3 - this.$refs['divcashedit'].showEdit(row) + handleSuccess4(resp, file, fileList) { + console.log('444', resp) + const _this = this + let noHasFile = true + for (const i in _this.reportFileList) { + if (_this.reportFileList[i].fileTypeId === 4) { + noHasFile = false + _this.reportFileList[i].fileTypeId = 4 // '文件类型: 1=帐户余额;2=应收账款;3=库存货值;4=在途货值;5=预付款;', + _this.reportFileList[i].fileTypeName = '在途货值' // '文件类型名: 1=帐户余额;2=应收账款;3=库存货值;4=在途货值;5=预付款', + _this.reportFileList[i].fileSrcName = resp.data.sourceFileName // '原文件名', + _this.reportFileList[i].filePath = resp.data.sourceFileName // '文件的相对路径', + _this.reportFileList[i].fullUrl = resp.data.sourceFileName // '文件完整的访问URL', + break + } + } + if (noHasFile) { + const upfile = { + fileTypeId: 4, // '文件类型: 1=帐户余额;2=应收账款;3=库存货值;4=在途货值;5=预付款;', + fileTypeName: '在途货值', // '文件类型名: 1=帐户余额;2=应收账款;3=库存货值;4=在途货值;5=预付款', + fileSrcName: resp.data.sourceFileName, // '原文件名', + filePath: resp.data.sourceFileName, // '文件的相对路径', + fullUrl: resp.data.sourceFileName // '文件完整的访问URL', + } + _this.reportFileList.push(upfile) + } }, - resetState() { - this.viewState = 1 + handleSuccess5(resp, file, fileList) { + console.log('555', resp) + const _this = this + let noHasFile = true + for (const i in _this.reportFileList) { + if (_this.reportFileList[i].fileTypeId === 5) { + noHasFile = false + _this.reportFileList[i].fileTypeId = 5 // '文件类型: 1=帐户余额;2=应收账款;3=库存货值;4=在途货值;5=预付款;', + _this.reportFileList[i].fileTypeName = '预付款' // '文件类型名: 1=帐户余额;2=应收账款;3=库存货值;4=在途货值;5=预付款', + _this.reportFileList[i].fileSrcName = resp.data.sourceFileName // '原文件名', + _this.reportFileList[i].filePath = resp.data.sourceFileName // '文件的相对路径', + _this.reportFileList[i].fullUrl = resp.data.sourceFileName // '文件完整的访问URL', + break + } + } + if (noHasFile) { + const upfile = { + fileTypeId: 5, // '文件类型: 1=帐户余额;2=应收账款;3=库存货值;4=在途货值;5=预付款;', + fileTypeName: '预付款', // '文件类型名: 1=帐户余额;2=应收账款;3=库存货值;4=在途货值;5=预付款', + fileSrcName: resp.data.sourceFileName, // '原文件名', + filePath: resp.data.sourceFileName, // '文件的相对路径', + fullUrl: resp.data.sourceFileName // '文件完整的访问URL', + } + _this.reportFileList.push(upfile) + } } } } diff --git a/yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/projectdaily/ProjectDaily.java b/yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/projectdaily/ProjectDaily.java index ca312e7b..97ad0434 100644 --- a/yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/projectdaily/ProjectDaily.java +++ b/yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/projectdaily/ProjectDaily.java @@ -34,6 +34,9 @@ public class ProjectDaily extends EntityWithId { private double advancePayment = 0; // 预付款', private double pledgeRate = 0; // 质押率=(贷款金额-帐户余额)/(库存总价值+应收帐款+在途商品+预付款)', + private int messState = 0; // 消息发送状态: 0=未发送;1=已发送', + private int messNum = 0; // 消息发送次数', + /** * 计算出的质押率 * diff --git a/yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/projectdaily/ProjectDailyFilesService.java b/yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/projectdaily/ProjectDailyFilesService.java index 4490c5b3..771aaa64 100644 --- a/yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/projectdaily/ProjectDailyFilesService.java +++ b/yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/projectdaily/ProjectDailyFilesService.java @@ -1,8 +1,17 @@ package com.yxt.supervise.report.biz.projectdaily; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; +import java.util.List; + @Service public class ProjectDailyFilesService extends ServiceImpl { + public List listByProjectAndDay(String projectSid, String orderDate) { + QueryWrapper qw = new QueryWrapper<>(); + qw.eq("projectSid", projectSid); + qw.eq("orderDate", orderDate); + return baseMapper.selectList(qw); + } } diff --git a/yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/projectdaily/ProjectDailyQuery.java b/yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/projectdaily/ProjectDailyQuery.java index 975fb6b9..b90953c9 100644 --- a/yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/projectdaily/ProjectDailyQuery.java +++ b/yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/projectdaily/ProjectDailyQuery.java @@ -24,4 +24,7 @@ public class ProjectDailyQuery implements Query { private double transitAmount = 0; // 在途货值', private double advancePayment = 0; // 预付款', private double pledgeRate = 0; // 质押率=(贷款金额-帐户余额)/(库存总价值+应收帐款+在途商品+预付款)', + + private String dataDateStart; // 数据日期 + private String dataDateEnd; // 数据日期 } diff --git a/yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/projectdaily/ProjectDailyRest.java b/yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/projectdaily/ProjectDailyRest.java index 052d157c..84f9f974 100644 --- a/yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/projectdaily/ProjectDailyRest.java +++ b/yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/projectdaily/ProjectDailyRest.java @@ -1,8 +1,13 @@ package com.yxt.supervise.report.biz.projectdaily; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.yxt.common.base.config.component.FileUploadComponent; import com.yxt.common.core.query.PagerQuery; +import com.yxt.common.core.result.FileUploadResult; import com.yxt.common.core.result.ResultBean; import com.yxt.common.core.vo.PagerVo; +import com.yxt.supervise.report.biz.stock.ReportStockDay; +import com.yxt.supervise.report.biz.stock.ReportStockDayStore; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -15,20 +20,58 @@ import java.util.List; @RequestMapping("/projectdaily") public class ProjectDailyRest { + @Autowired + private FileUploadComponent fileUploadComponent; @Autowired private ProjectDailyService projectDailyService; + @Autowired + private ProjectDailyFilesService projectDailyFilesService; @ApiOperation("查询项目监管报表信息") @PostMapping("/listPage") - public ResultBean selectListPage(@RequestBody PagerQuery pq){ + public ResultBean> selectListPage(@RequestBody PagerQuery pq) { ResultBean rb = ResultBean.fireFail(); - PagerVo projectDailyVoPagerVo = projectDailyService.selectListPage(pq); - return rb.success().setData(projectDailyVoPagerVo); +// PagerVo projectDailyVoPagerVo = projectDailyService.selectListPage(pq); + IPage iPage = projectDailyService.listPage(pq); + return rb.success().setData(iPage); } @ApiOperation("添加项目监管报表信息") - @PostMapping("/save") - public ResultBean save(@RequestBody ProjectDailyDto dto){ + @PostMapping("/saveDaily") + public ResultBean saveDaily(@RequestBody ProjectDailyDto dto) { return projectDailyService.save(dto); } + + @PostMapping("/uploadfile") + public ResultBean uploadImage(@RequestParam(value = "file") MultipartFile file) { + ResultBean rb = ResultBean.fireFail(); + if (file == null || file.isEmpty()) { + return rb.setMsg("文件为空"); + } + + rb = fileUploadComponent.uploadFile(file, "reportprojectdaily"); + return rb; + } + + + @GetMapping("/getProjectDaily/{projectSid}/{orderDate}") + public ResultBean getProjectDaily(@PathVariable("projectSid") String projectSid, @PathVariable("orderDate") String orderDate) { + ResultBean rb = ResultBean.fireFail(); + ProjectDaily pv = projectDailyService.fetchByProjectAndDay(projectSid, orderDate); + return rb.success().setData(pv); + } + + @GetMapping("/getProjectDailyFiles/{projectSid}/{orderDate}") + public ResultBean> getProjectDailyFiles(@PathVariable("projectSid") String projectSid, @PathVariable("orderDate") String orderDate) { + ResultBean rb = ResultBean.fireFail(); + List pv = projectDailyFilesService.listByProjectAndDay(projectSid, orderDate); + return rb.success().setData(pv); + } + + @GetMapping("/sendMess/{projectSid}/{orderDate}") + public ResultBean sendMess(@PathVariable("projectSid") String projectSid, @PathVariable("orderDate") String orderDate) { + ResultBean rb = ResultBean.fireFail(); + projectDailyService.sendMess(projectSid, orderDate); + return rb.success(); + } } diff --git a/yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/projectdaily/ProjectDailyService.java b/yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/projectdaily/ProjectDailyService.java index e73cf056..83addaca 100644 --- a/yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/projectdaily/ProjectDailyService.java +++ b/yxt_supervise/supervise-report/supervise-report-biz/src/main/java/com/yxt/supervise/report/biz/projectdaily/ProjectDailyService.java @@ -3,6 +3,7 @@ package com.yxt.supervise.report.biz.projectdaily; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.io.unit.DataUnit; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -32,10 +33,10 @@ public class ProjectDailyService extends ServiceImpl selectListPage(PagerQuery pq){ + public PagerVo selectListPage(PagerQuery pq) { ProjectDailyQuery params = pq.getParams(); QueryWrapper wq = new QueryWrapper<>(); - if (params != null){ + if (params != null) { } IPage page = PagerUtil.queryToPage(pq); @@ -43,17 +44,39 @@ public class ProjectDailyService extends ServiceImpl objectPagerVo = PagerUtil.pageToVo(projectDailyVoIPage, null); return objectPagerVo; } - public ResultBean save(ProjectDailyDto dto){ + + public IPage listPage(PagerQuery pq) { + ProjectDailyQuery params = pq.getParams(); + QueryWrapper qw = new QueryWrapper<>(); + qw.gt("id", 0); + if (StrUtil.isNotBlank(params.getDataDateStart())) { + qw.ge("orderDate", params.getDataDateStart()); + } + if (StrUtil.isNotBlank(params.getDataDateEnd())) { + qw.le("orderDate", params.getDataDateEnd()); + } + if (StrUtil.isNotBlank(params.getProjectSid())) { + qw.eq("projectSid", params.getProjectSid()); + } + qw.orderByDesc("orderDate", "createTime"); + + IPage iPage = PagerUtil.queryToPage(pq); + IPage page = baseMapper.selectPage(iPage, qw); + return page; + } + + public ResultBean save(ProjectDailyDto dto) { ResultBean rb = ResultBean.fireFail(); ProjectDaily projectDaily = new ProjectDaily(); - BeanUtil.copyProperties(dto,projectDaily); + BeanUtil.copyProperties(dto, projectDaily); String pledgeRateNormal = projectDaily.getPledgeRateNormal(); projectDaily.setPledgeRate(Double.parseDouble(pledgeRateNormal)); - baseMapper.delete(new QueryWrapper().eq("orderDate", DateUtil.format(new Date(), "yyyy-MM-dd"))); + projectDaily.setReportTime(projectDaily.getOrderDate() + " " + DateUtil.format(new Date(), "HH:mm")); + baseMapper.delete(new QueryWrapper().eq("projectSid", dto.getProjectSid()).eq("orderDate", dto.getOrderDate())); baseMapper.insert(projectDaily); List fileList = dto.getFileList(); - if (fileList != null){ - projectDailyFilesService.remove(new QueryWrapper().eq("orderDate", DateUtil.format(new Date(), "yyyy-MM-dd"))); + if (fileList != null && !fileList.isEmpty()) { + projectDailyFilesService.remove(new QueryWrapper().eq("projectSid", dto.getProjectSid()).eq("orderDate", dto.getOrderDate())); for (ProjectDailyFiles s : fileList) { ProjectDailyFiles projectDailyFiles = new ProjectDailyFiles(); projectDailyFiles.setOrderDate(dto.getOrderDate()); @@ -68,25 +91,22 @@ public class ProjectDailyService extends ServiceImpl qw = new QueryWrapper<>(); + qw.eq("projectSid", projectSid) + .eq("orderDate", orderDate); + return baseMapper.selectOne(qw); + } + + public void sendMess(String projectSid, String orderDate) { + ProjectDaily projectDaily = this.fetchByProjectAndDay(projectSid, orderDate); + projectDaily.setMessState(1); + projectDaily.setMessNum(projectDaily.getMessNum() + 1); + baseMapper.updateById(projectDaily); + + // TODO: 发送微信模板消息 + } }