| | |
| | | #VUE_APP_API = 'https://www.yyb.red/yyb_admin_api/' |
| | | |
| | | # 任康 |
| | | VUE_APP_API = 'http://192.168.0.132:10030/' |
| | | VUE_APP_API = 'http://localhost:10030/' |
| | | |
| | | # VUE_APP_API = 'http://192.168.0.131:10031/' |
| | |
| | | "integrity": "sha1-/q7SVZc9LndVW4PbwIhRpsY1IPo=", |
| | | "dev": true |
| | | }, |
| | | "ansi-styles": { |
| | | "version": "4.3.0", |
| | | "resolved": "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-4.3.0.tgz", |
| | | "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", |
| | | "dev": true, |
| | | "optional": true, |
| | | "requires": { |
| | | "color-convert": "^2.0.1" |
| | | } |
| | | }, |
| | | "chalk": { |
| | | "version": "4.1.2", |
| | | "resolved": "https://registry.npmmirror.com/chalk/-/chalk-4.1.2.tgz", |
| | | "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", |
| | | "dev": true, |
| | | "optional": true, |
| | | "requires": { |
| | | "ansi-styles": "^4.1.0", |
| | | "supports-color": "^7.1.0" |
| | | } |
| | | }, |
| | | "color-convert": { |
| | | "version": "2.0.1", |
| | | "resolved": "https://registry.npmmirror.com/color-convert/-/color-convert-2.0.1.tgz", |
| | | "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", |
| | | "dev": true, |
| | | "optional": true, |
| | | "requires": { |
| | | "color-name": "~1.1.4" |
| | | } |
| | | }, |
| | | "color-name": { |
| | | "version": "1.1.4", |
| | | "resolved": "https://registry.npmmirror.com/color-name/-/color-name-1.1.4.tgz", |
| | | "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", |
| | | "dev": true, |
| | | "optional": true |
| | | }, |
| | | "has-flag": { |
| | | "version": "4.0.0", |
| | | "resolved": "https://registry.npmmirror.com/has-flag/-/has-flag-4.0.0.tgz", |
| | | "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", |
| | | "dev": true, |
| | | "optional": true |
| | | }, |
| | | "loader-utils": { |
| | | "version": "2.0.4", |
| | | "resolved": "https://registry.npmmirror.com/loader-utils/-/loader-utils-2.0.4.tgz", |
| | | "integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==", |
| | | "dev": true, |
| | | "optional": true, |
| | | "requires": { |
| | | "big.js": "^5.2.2", |
| | | "emojis-list": "^3.0.0", |
| | | "json5": "^2.1.2" |
| | | } |
| | | }, |
| | | "ssri": { |
| | | "version": "8.0.1", |
| | | "resolved": "https://registry.npm.taobao.org/ssri/download/ssri-8.0.1.tgz?cache=0&sync_timestamp=1617826515595&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fssri%2Fdownload%2Fssri-8.0.1.tgz", |
| | |
| | | "dev": true, |
| | | "requires": { |
| | | "minipass": "^3.1.1" |
| | | } |
| | | }, |
| | | "supports-color": { |
| | | "version": "7.2.0", |
| | | "resolved": "https://registry.npmmirror.com/supports-color/-/supports-color-7.2.0.tgz", |
| | | "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", |
| | | "dev": true, |
| | | "optional": true, |
| | | "requires": { |
| | | "has-flag": "^4.0.0" |
| | | } |
| | | }, |
| | | "vue-loader-v16": { |
| | | "version": "npm:vue-loader@16.8.3", |
| | | "resolved": "https://registry.npmmirror.com/vue-loader/-/vue-loader-16.8.3.tgz", |
| | | "integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==", |
| | | "dev": true, |
| | | "optional": true, |
| | | "requires": { |
| | | "chalk": "^4.1.0", |
| | | "hash-sum": "^2.0.0", |
| | | "loader-utils": "^2.0.0" |
| | | } |
| | | } |
| | | } |
| | |
| | | "tough-cookie": "~2.5.0", |
| | | "tunnel-agent": "^0.6.0", |
| | | "uuid": "^3.3.2" |
| | | }, |
| | | "dependencies": { |
| | | "uuid": { |
| | | "version": "3.4.0", |
| | | "resolved": "https://registry.npmmirror.com/uuid/-/uuid-3.4.0.tgz", |
| | | "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", |
| | | "dev": true |
| | | } |
| | | } |
| | | }, |
| | | "require-directory": { |
| | |
| | | "faye-websocket": "^0.11.3", |
| | | "uuid": "^3.4.0", |
| | | "websocket-driver": "^0.7.4" |
| | | }, |
| | | "dependencies": { |
| | | "uuid": { |
| | | "version": "3.4.0", |
| | | "resolved": "https://registry.npmmirror.com/uuid/-/uuid-3.4.0.tgz", |
| | | "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", |
| | | "dev": true |
| | | } |
| | | } |
| | | }, |
| | | "sockjs-client": { |
| | |
| | | "dev": true |
| | | }, |
| | | "uuid": { |
| | | "version": "3.4.0", |
| | | "resolved": "https://registry.npm.taobao.org/uuid/download/uuid-3.4.0.tgz?cache=0&sync_timestamp=1607460081656&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fuuid%2Fdownload%2Fuuid-3.4.0.tgz", |
| | | "integrity": "sha1-sj5DWK+oogL+ehAK8fX4g/AgB+4=", |
| | | "dev": true |
| | | "version": "11.1.0", |
| | | "resolved": "https://registry.npmmirror.com/uuid/-/uuid-11.1.0.tgz", |
| | | "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==" |
| | | }, |
| | | "v8-compile-cache": { |
| | | "version": "2.3.0", |
| | |
| | | "resolved": "https://registry.npm.taobao.org/hash-sum/download/hash-sum-1.0.2.tgz", |
| | | "integrity": "sha1-M7QHd3VMZDJXPBIMw4CLvRDUfwQ=", |
| | | "dev": true |
| | | } |
| | | } |
| | | }, |
| | | "vue-loader-v16": { |
| | | "version": "npm:vue-loader@16.8.3", |
| | | "resolved": "https://registry.npmmirror.com/vue-loader/-/vue-loader-16.8.3.tgz", |
| | | "integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==", |
| | | "dev": true, |
| | | "optional": true, |
| | | "requires": { |
| | | "chalk": "^4.1.0", |
| | | "hash-sum": "^2.0.0", |
| | | "loader-utils": "^2.0.0" |
| | | }, |
| | | "dependencies": { |
| | | "ansi-styles": { |
| | | "version": "4.3.0", |
| | | "resolved": "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-4.3.0.tgz", |
| | | "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", |
| | | "dev": true, |
| | | "optional": true, |
| | | "requires": { |
| | | "color-convert": "^2.0.1" |
| | | } |
| | | }, |
| | | "chalk": { |
| | | "version": "4.1.2", |
| | | "resolved": "https://registry.npmmirror.com/chalk/-/chalk-4.1.2.tgz", |
| | | "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", |
| | | "dev": true, |
| | | "optional": true, |
| | | "requires": { |
| | | "ansi-styles": "^4.1.0", |
| | | "supports-color": "^7.1.0" |
| | | } |
| | | }, |
| | | "color-convert": { |
| | | "version": "2.0.1", |
| | | "resolved": "https://registry.npmmirror.com/color-convert/-/color-convert-2.0.1.tgz", |
| | | "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", |
| | | "dev": true, |
| | | "optional": true, |
| | | "requires": { |
| | | "color-name": "~1.1.4" |
| | | } |
| | | }, |
| | | "color-name": { |
| | | "version": "1.1.4", |
| | | "resolved": "https://registry.npmmirror.com/color-name/-/color-name-1.1.4.tgz", |
| | | "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", |
| | | "dev": true, |
| | | "optional": true |
| | | }, |
| | | "has-flag": { |
| | | "version": "4.0.0", |
| | | "resolved": "https://registry.npmmirror.com/has-flag/-/has-flag-4.0.0.tgz", |
| | | "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", |
| | | "dev": true, |
| | | "optional": true |
| | | }, |
| | | "loader-utils": { |
| | | "version": "2.0.4", |
| | | "resolved": "https://registry.npmmirror.com/loader-utils/-/loader-utils-2.0.4.tgz", |
| | | "integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==", |
| | | "dev": true, |
| | | "optional": true, |
| | | "requires": { |
| | | "big.js": "^5.2.2", |
| | | "emojis-list": "^3.0.0", |
| | | "json5": "^2.1.2" |
| | | } |
| | | }, |
| | | "supports-color": { |
| | | "version": "7.2.0", |
| | | "resolved": "https://registry.npmmirror.com/supports-color/-/supports-color-7.2.0.tgz", |
| | | "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", |
| | | "dev": true, |
| | | "optional": true, |
| | | "requires": { |
| | | "has-flag": "^4.0.0" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | |
| | | "requires": { |
| | | "ansi-colors": "^3.0.0", |
| | | "uuid": "^3.3.2" |
| | | }, |
| | | "dependencies": { |
| | | "uuid": { |
| | | "version": "3.4.0", |
| | | "resolved": "https://registry.npmmirror.com/uuid/-/uuid-3.4.0.tgz", |
| | | "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", |
| | | "dev": true |
| | | } |
| | | } |
| | | }, |
| | | "webpack-merge": { |
| | |
| | | "js-cookie": "^2.2.1", |
| | | "js-file-download": "^0.4.12", |
| | | "umy-ui": "^1.1.6", |
| | | "uuid": "^11.1.0", |
| | | "vue": "^2.6.11", |
| | | "vue-clipboard2": "^0.3.1", |
| | | "vue-pdf": "^4.3.0", |
| | |
| | | <span>{{ item.name }}</span> |
| | | </div> |
| | | </div> |
| | | <upload width="100px" height="100px" :list="[]" accept=".png,.jpg,.jpeg,.mp4,.word,.xlsx,.xls,.pdf,.excel" folder="settle" @success="claimsUploadFile($event, 5)" /> |
| | | <uploadProgress width="100px" height="100px" :list="[]" accept=".png,.jpg,.jpeg,.mp4,.word,.xlsx,.xls,.pdf,.excel,.zip,.war" folder="settle" @success="claimsUploadFile($event, 5)" /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | <script> |
| | | import BaseOpera from '@/components/base/BaseOpera' |
| | | import GlobalWindow from '@/components/common/GlobalWindow' |
| | | import uploadProgress from '@/components/common/uploadProgress' |
| | | import upload from '@/components/common/upload' |
| | | import { getCompensation } from '@/api/business/settleRisk' |
| | | import { createSys } from '@/api/business/settleClaims' |
| | |
| | | export default { |
| | | name: 'OpearaCaseEntryWindow', |
| | | extends: BaseOpera, |
| | | components: { GlobalWindow, upload }, |
| | | components: { GlobalWindow, upload, uploadProgress }, |
| | | data () { |
| | | return { |
| | | ruleForm: { |
| | |
| | | getCompensations () { |
| | | getCompensation({ type: 1 }) |
| | | .then(res => { |
| | | console.log(res) |
| | | // console.log(res) |
| | | this.list1 = res.filter(item => item.type === 0) |
| | | this.list2 = res.filter(item => item.type === 1) |
| | | this.list3 = res.filter(item => item.type === 2) |
| | |
| | | </div> |
| | | <div style="display: block;"> |
| | | <input type="file" ref="file" :accept="accept" @change="getFile" /> |
| | | <progress id="progressBar" value="0" max="100"></progress> |
| | | <span id="status">0%</span> |
| | | </div> |
| | | </div> |
| | | </template> |
| | |
| | | }, |
| | | getFile (e) { |
| | | if (e.target && e.target.files.length > 0) { |
| | | const config = { |
| | | onUploadProgress: function(progressEvent) { |
| | | console.log(progressEvent) |
| | | const percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total); |
| | | document.getElementById('progressBar').value = percentCompleted; |
| | | document.getElementById('status').textContent = percentCompleted + '%'; |
| | | }, |
| | | headers: { |
| | | 'Content-Type': 'multipart/form-data' |
| | | } |
| | | } |
| | | |
| | | const loading = this.$loading({ |
| | | lock: true, |
| | | text: 'ä¸ä¼ ä¸ï¼è¯·çå¾
', |
| | | spinner: 'el-icon-loading', |
| | | background: 'rgba(0, 0, 0, 0.7)' |
| | | }); |
| | | }) |
| | | this.$emit('loading') |
| | | const formdate = new FormData() |
| | | formdate.append('file', e.target.files[0]) |
| | | formdate.append('folder', this.folder) |
| | | axios.post(this.uploadImgUrl, formdate,config) |
| | | axios.post(this.uploadImgUrl, formdate) |
| | | .then(res => { |
| | | this.$emit('success', res.data.data) |
| | | }) |
| | |
| | | this.$message.error(e) |
| | | }) |
| | | .finally(() => { |
| | | loading.close(); |
| | | loading.close() |
| | | this.$refs.file.value = null |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="file"> |
| | | <div class="file_list"> |
| | | <div class="file_list_item" :style="{width: width, height: height}" v-for="(item, index) in list" :key="index"> |
| | | <div class="dele" @click="deleItem(index)"> |
| | | <i class="el-icon-close"></i> |
| | | </div> |
| | | <img :src="item.url" v-if="fileType(item.url) === 'img'" /> |
| | | <video controls autoplay :src="item.url" v-else></video> |
| | | </div> |
| | | <div class="file_list_item" :style="{width: width, height: height, cursor: 'pointer'}" @click="$refs.file.click()"> |
| | | <i class="el-icon-plus"></i> |
| | | </div> |
| | | </div> |
| | | <div style="display: block;"> |
| | | <input type="file" ref="file" :accept="accept" @change="getFile" /> |
| | | <progress id="progressBar" value="0" max="100" ></progress> |
| | | <span id="status">0%</span> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import axios from 'axios' |
| | | export default { |
| | | props: { |
| | | width: { |
| | | type: String, |
| | | default: '90px' |
| | | }, |
| | | height: { |
| | | type: String, |
| | | default: '90px' |
| | | }, |
| | | list: { |
| | | type: Array, |
| | | // eslint-disable-next-line vue/require-valid-default-prop |
| | | default: [] |
| | | }, |
| | | accept: { |
| | | type: String, |
| | | default: '' |
| | | }, |
| | | folder: { |
| | | type: String, |
| | | default: '' |
| | | } |
| | | }, |
| | | data () { |
| | | return { |
| | | uuid: null, |
| | | uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/public/upload', |
| | | uploadProgressUrl: process.env.VUE_APP_API_PREFIX + '/public' |
| | | } |
| | | }, |
| | | |
| | | methods: { |
| | | fileType (url) { |
| | | if (url.indexOf('.mp4') !== -1) { |
| | | return 'video' |
| | | } else { |
| | | return 'img' |
| | | } |
| | | }, |
| | | getFile (e) { |
| | | if (e.target && e.target.files.length > 0) { |
| | | const config = { |
| | | onUploadProgress: function (progressEvent) { |
| | | console.log(progressEvent) |
| | | const percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total) |
| | | document.getElementById('progressBar').value = percentCompleted |
| | | document.getElementById('status').textContent = 'åå¤' + percentCompleted + '%' |
| | | }, |
| | | headers: { |
| | | 'Content-Type': 'multipart/form-data' |
| | | } |
| | | } |
| | | // const loading = this.$loading({ |
| | | // lock: true, |
| | | // text: 'ä¸ä¼ ä¸ï¼è¯·çå¾
', |
| | | // spinner: 'el-icon-loading', |
| | | // background: 'rgba(0, 0, 0, 0.7)' |
| | | // }) |
| | | // this.$emit('loading') |
| | | const formdate = new FormData() |
| | | this.uuid = this.generateUUID().replaceAll('-', '') |
| | | formdate.append('file', e.target.files[0]) |
| | | formdate.append('folder', this.folder) |
| | | formdate.append('uuid', this.uuid) |
| | | axios.post(this.uploadImgUrl, formdate, config) |
| | | .then(res => { |
| | | this.$emit('success', res.data.data) |
| | | }) |
| | | .catch(e => { |
| | | this.$message.error(e) |
| | | }) |
| | | .finally(() => { |
| | | // loading.close() |
| | | this.$refs.file.value = null |
| | | }) |
| | | this.startProgress() |
| | | } |
| | | }, |
| | | startProgress () { |
| | | var that = this |
| | | var timer = setInterval(function () { |
| | | axios.get(that.uploadProgressUrl + '/' + that.uuid) |
| | | .then(res => { |
| | | if (res != null && res.data && res.data.data) { |
| | | if (res.data.data.status === 1) { |
| | | const percentCompleted = Math.round(res.data.data.rate || 0) |
| | | document.getElementById('progressBar').value = percentCompleted |
| | | document.getElementById('status').textContent = 'ä¸ä¼ ä¸' + percentCompleted + '%' |
| | | } else if (res.data.data.status === 2){ |
| | | document.getElementById('progressBar').value = 100 |
| | | document.getElementById('status').textContent = '已宿' + 100 + '%' |
| | | clearInterval(timer) |
| | | } else if (res.data.data.status === 3){ |
| | | const percentCompleted = Math.round(res.data.data.rate || 0) |
| | | document.getElementById('progressBar').value = percentCompleted |
| | | document.getElementById('status').textContent = 'ä¸ä¼ 失败' + percentCompleted + '%' |
| | | clearInterval(timer) |
| | | } |
| | | } |
| | | }) |
| | | }, 2000) |
| | | }, |
| | | generateUUID () { |
| | | return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { |
| | | const r = (Math.random() * 16) | 0 |
| | | const v = c === 'x' ? r : (r & 0x3) | 0x8 |
| | | return v.toString(16) |
| | | }) |
| | | }, |
| | | deleItem (index) { |
| | | this.$emit('dele', index) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .file { |
| | | /*width: 100%;*/ |
| | | /*height: 90px;*/ |
| | | padding: 10px; |
| | | box-sizing: border-box; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | position: relative; |
| | | margin-bottom: 10px; |
| | | /* margin-right: 20px; */ |
| | | /* margin: 10px 0;*/ |
| | | input { |
| | | opacity: 0; |
| | | } |
| | | .file_list { |
| | | width: 100%; |
| | | height: 100%; |
| | | display: flex; |
| | | align-items: center; |
| | | flex-wrap: wrap; |
| | | .file_list_item { |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | justify-content: center; |
| | | overflow: hidden; |
| | | border-radius: 5px; |
| | | border: 1px solid #d5d5d5; |
| | | margin-left: 15px; |
| | | position: relative; |
| | | &:first-child { |
| | | margin: 0 !important; |
| | | } |
| | | .dele { |
| | | position: absolute; |
| | | right: 0; |
| | | top: 0; |
| | | width: 20px; |
| | | height: 20px; |
| | | background: red; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | cursor: pointer; |
| | | .el-icon-close { |
| | | color: #ffffff; |
| | | font-size: 19px; |
| | | } |
| | | } |
| | | .el-icon-plus { |
| | | font-size: 30px; |
| | | color: black; |
| | | } |
| | | img { |
| | | width: 100%; |
| | | } |
| | | video { |
| | | width: 100%; |
| | | height: 100%; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </style> |
| | |
| | | * @date 2021-10-10 14:40:35 |
| | | * https://www.bejson.com/othertools/cron/ cron 表达å¼çæå°å |
| | | */ |
| | | @Component |
| | | @EnableScheduling |
| | | //@Component |
| | | //@EnableScheduling |
| | | @Slf4j |
| | | public class ScheduleTool { |
| | | @Autowired |
| | |
| | | # application: |
| | | # name: doumeemes |
| | | profiles: |
| | | active: pro |
| | | active: dev |
| | | |
| | | # JSONè¿åé
ç½® |
| | | jackson: |
| | |
| | | <dependency> |
| | | <groupId>com.aliyun.oss</groupId> |
| | | <artifactId>aliyun-sdk-oss</artifactId> |
| | | <version>2.2.1</version> |
| | | <version>3.17.4</version> |
| | | </dependency> |
| | | <!-- <dependency> |
| | | <groupId>com.aliyun.oss</groupId> |
| | | <artifactId>aliyun-sdk-oss</artifactId> |
| | | <version>2.2.1</version> |
| | | </dependency>--> |
| | | <!-- https://mvnrepository.com/artifact/com.github.yulichang/mybatis-plus-join --> |
| | | <dependency> |
| | | <groupId>com.github.yulichang</groupId> |
| | |
| | | || StringUtils.endsWith(key,".JPEG")){ |
| | | type =0; |
| | | } |
| | | if (obs.uploadOnlineObject(file.getInputStream(),bucketName, key,uuid,null)) { |
| | | if (obs.uploadOnlineObject(file.getInputStream(),bucketName, key,uuid,file.getSize(),null)) { |
| | | // ç§»å¨æå,è¿åæä»¶å |
| | | // sendSuccessMessage(response, resourcePath+key); |
| | | context.put("success", true); |
| | |
| | | package com.doumee.core.utils.aliyun; |
| | | |
| | | import com.aliyun.auth.credentials.Credential; |
| | | import com.aliyun.auth.credentials.provider.StaticCredentialProvider; |
| | | import com.aliyun.oss.ClientException; |
| | | import com.aliyun.oss.OSSClient; |
| | | import com.aliyun.oss.OSSException; |
| | | import com.aliyun.oss.event.ProgressEvent; |
| | | import com.aliyun.oss.event.ProgressEventType; |
| | | import com.aliyun.oss.event.ProgressListener; |
| | | import com.aliyun.oss.model.*; |
| | | import com.aliyun.sdk.service.cloudauth20190307.AsyncClient; |
| | | import com.aliyun.sdk.service.cloudauth20190307.models.Id2MetaVerifyRequest; |
| | | import com.aliyun.sdk.service.cloudauth20190307.models.Id2MetaVerifyResponse; |
| | | import com.doumee.core.utils.FileDigest; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.CompletableFuture; |
| | | |
| | | import com.google.gson.Gson; |
| | | import darabonba.core.client.ClientOverrideConfiguration; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | |
| | | return PutObjectProgressListenerBiz.queryProgressModel(id); |
| | | } |
| | | public boolean uploadOnlineObject(InputStream inputStream, String bucketName, String key,String tempId, |
| | | String mime) throws OSSException, ClientException, IOException { |
| | | long size,String mime) throws OSSException, ClientException, IOException { |
| | | try { |
| | | isExistBucket(bucketName); |
| | | ObjectMetadata objectMeta = new ObjectMetadata(); |
| | | objectMeta.setContentLength(inputStream.available()); |
| | | objectMeta.setContentLength(size>0?size:inputStream.available()); |
| | | // å¯ä»¥å¨metadata䏿 è®°æä»¶ç±»å |
| | | if (StringUtils.isNotBlank(mime)) { |
| | | objectMeta.setContentType(mime); |
| | |
| | | ProgressModel pmodel = new ProgressModel(); |
| | | pmodel.setKey(key); |
| | | pmodel.setId(tempId); |
| | | pmodel.setStatus(0); |
| | | pmodel.setStartDate(new Date()); |
| | | putObjectRequest = new PutObjectRequest(bucketName, key, |
| | | inputStream).withProgressListener(new PutObjectProgressListenerBiz(pmodel)); |
| | | pmodel.setTotalBytes(size>0?size:objectMeta.getContentLength()); |
| | | putObjectRequest = new PutObjectRequest(bucketName, key, inputStream,objectMeta) |
| | | .withProgressListener(new PutObjectProgressListenerBiz(pmodel)); |
| | | // putObjectRequest.setProgressListener(); |
| | | }else{ |
| | | putObjectRequest = new PutObjectRequest(bucketName, key, |
| | | inputStream); |
| | | } |
| | | PutObjectResult putObjectResult = client.putObject(putObjectRequest); |
| | | |
| | | return true; |
| | | // ä¸è½½æä»¶çåæ¶æå®è¿åº¦æ¡åæ°ãæ¤å¤GetObjectProgressListenerDemo为è°ç¨ç±»çç±»åï¼è¯·å¨å®é
ä½¿ç¨æ¶æ¿æ¢ä¸ºç¸åºçç±»åã |
| | | // ossClient.getObject(new GetObjectRequest(bucketName,objectName). |
| | | // <GetObjectRequest>withProgressListener(new GetObjectProgressListenerDemo())); |
| | |
| | | } |
| | | return r; |
| | | } |
| | | private int tempNum; |
| | | @Override |
| | | public void progressChanged(ProgressEvent progressEvent) { |
| | | long bytes = progressEvent.getBytes(); |
| | | ProgressEventType eventType = progressEvent.getEventType(); |
| | | switch (eventType) { |
| | | case TRANSFER_STARTED_EVENT: |
| | | this.model.setDoneDate(new Date()); |
| | | this.model.setStartDate(new Date()); |
| | | System.out.println("Start to upload......"); |
| | | break; |
| | | case REQUEST_CONTENT_LENGTH_EVENT: |
| | |
| | | System.out.println( this.model.getTotalBytes() + " bytes in total will be uploaded to OSS"); |
| | | break; |
| | | case REQUEST_BYTE_TRANSFER_EVENT: |
| | | if (bytes >0) { |
| | | this.model.setStatus(1); |
| | | this.model.setBytesWritten(this.getModel().getBytesWritten()+bytes); |
| | | if (this.model.getTotalBytes() >0) { |
| | | int percent = (int)(this.getModel().getBytesWritten() * 100.0 / this.model.getTotalBytes()); |
| | | this.model.setBytesWritten(this.getModel().getBytesWritten()+bytes); |
| | | System.out.println(bytes + " bytes have been written at this time, upload progress: " + percent + "%(" + this.getModel().getBytesWritten() + "/" + this.model.getTotalBytes()+ ")"); |
| | | this.model.setBytesWritten(this.model.getBytesWritten()+bytes); |
| | | int percent = (int)(this.model.getBytesWritten() * 100 / this.model.getTotalBytes()); |
| | | this.model.setRate(percent); |
| | | // System.out.println(bytes + " bytes have been written at this time, upload progress: " + percent + "%(" + this.getModel().getBytesWritten() + "/" + this.model.getTotalBytes()+ ")"); |
| | | } else { |
| | | System.out.println(bytes + " bytes have been written at this time, upload ratio: unknown" + "(" + this.model.getBytesWritten() + "/...)"); |
| | | // System.out.println(bytes+ " bytes have been written at this time, upload ratio: unknown" + "(" + this.model.getBytesWritten() + "/...)"); |
| | | } |
| | | break; |
| | | case TRANSFER_COMPLETED_EVENT: |
| | | this.model.setRate(100); |
| | | this.model.setStatus(2); |
| | | this.model.setDoneDate(new Date()); |
| | | System.out.println("Succeed to upload, " + this.getModel().getBytesWritten() + " bytes have been transferred in total"); |
| | |
| | | spring: |
| | | # æ°æ®æºé
ç½® |
| | | datasource: |
| | | url: jdbc:mysql://112.26.66.25:3306/yyb?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: Doumee@168&QWERT |
| | | url: jdbc:mysql://rm-bp12tny4ir5b7l65xno.mysql.rds.aliyuncs.com:3306/yyb?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8 |
| | | username: yyb |
| | | password: Yyb123456 |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | # url: jdbc:mysql://112.26.66.25:3306/yyb?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8 |
| | | # username: root |
| | | # password: Doumee@168&QWERT |
| | | # driver-class-name: com.mysql.cj.jdbc.Driver |
| | | # type: com.alibaba.druid.pool.DruidDataSource |
| | | # mail: |
| | | # host: smtp.exmail.qq.com |
| | | # username: jp@doumee.com |