| | |
| | | "integrity": "sha1-/q7SVZc9LndVW4PbwIhRpsY1IPo=", |
| | | "dev": true |
| | | }, |
| | | "ansi-styles": { |
| | | "version": "4.3.0", |
| | | "resolved": "https://registry.npmjs.org/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.npmjs.org/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.npmjs.org/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.npmjs.org/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.npmjs.org/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.npmjs.org/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.npmjs.org/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.npmjs.org/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" |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | }, |
| | | "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" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "vue-router": { |
| | | "version": "3.5.1", |
| | | "resolved": "https://registry.nlark.com/vue-router/download/vue-router-3.5.1.tgz?cache=0&sync_timestamp=1620899536020&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fvue-router%2Fdownload%2Fvue-router-3.5.1.tgz", |
| | |
| | | # å¼åç¯å¢é
ç½® |
| | | NODE_ENV = 'development' |
| | | |
| | | VUE_APP_CONTEXT_PATH = '/' |
| | | VUE_APP_API_PREFIX = '/api' |
| | | |
| | | # 任康 |
| | | # VUE_APP_API = 'http://192.168.0.15:10017/' |
| | | # ç¦æ¾ |
| | | VUE_APP_API = 'http://192.168.0.36:10011' |
| | | # æ±è |
| | | VUE_APP_API = 'http://192.168.0.35:10011' |
| | | |
| | | #æµè¯æå¡å¨ |
| | | # VUE_APP_API = 'https://dmtest.ahapp.net/preselect_admin_interface' |
| | |
| | | # æµè¯ç¯å¢é
ç½® |
| | | NODE_ENV = 'production' |
| | | |
| | | VUE_APP_CONTEXT_PATH = '/preselect_admin' |
| | | VUE_APP_API_PREFIX = '/preselect_admin_interface' |
| | | |
| | | |
| | | # https://dmtest.ahapp.net/preselect_admin_interface/doc.html |
| | | VUE_APP_API = 'https://dmtest.ahapp.net/preselect_admin_interface' |
| | |
| | | "scripts": { |
| | | "serve": "vue-cli-service serve", |
| | | "build": "vue-cli-service build", |
| | | "build:staging": "vue-cli-service build --mode staging", |
| | | "build:dev": "vue-cli-service build --mode staging", |
| | | "lint": "vue-cli-service lint", |
| | | "fix": "eslint --ext .js,.vue src --fix" |
| | | }, |
| | |
| | | |
| | | // ä¿®æ¹ |
| | | export function updateById (data) { |
| | | return request.post('/business/baseGoods/updateById', data) |
| | | return request.post('/business/baseGoods/update', data) |
| | | } |
| | | |
| | | // å é¤ |
| | |
| | | |
| | | // æ ¹æ®IDæ¥è¯¢ |
| | | export function queryById (id) { |
| | | return request.get(`business/baseGoods/${id}`) |
| | | return request.get(`/business/baseGoods/${id}`) |
| | | } |
| | |
| | | <template> |
| | | <GlobalWindow |
| | | :title="title" |
| | | :visible.sync="visible" |
| | | :confirm-working="isWorking" |
| | | @confirm="confirm" |
| | | width="800px" |
| | | > |
| | | <GlobalWindow :title="title" :visible.sync="visible" :confirm-working="isWorking" @confirm="confirm" width="800px" |
| | | v-loading="isUploading"> |
| | | <el-form :model="form" ref="form" label-width="120px" :rules="rules"> |
| | | <div style="font-size: 18px;font-weight: bold;">åºæ¬ä¿¡æ¯</div> |
| | | <el-form-item label="åååç§°" prop="name"> |
| | | <el-input v-model="form.name" maxlength="50" placeholder="请è¾å
¥åååç§°ï¼ä¸è¶
è¿50个å" v-trim/> |
| | | <el-input v-model="form.name" maxlength="50" placeholder="请è¾å
¥åååç§°ï¼ä¸è¶
è¿50个å" v-trim /> |
| | | </el-form-item> |
| | | <el-form-item label="åååç" prop="brandId"> |
| | | <el-select v-model="form.brandId" placeholder="è¯·éæ©ï¼åé"> |
| | | <el-option |
| | | v-for="item in brandList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id"> |
| | | <el-option v-for="item in brandList()" :key="item.id" :label="item.name" :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ååç±»å«" prop="categoryId"> |
| | | <!-- @change="changeCategory(form.categoryId)" --> |
| | | <el-select v-model="form.categoryId" placeholder="è¯·éæ©ï¼åé"> |
| | | <el-option |
| | | v-for="item in categoryList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id"> |
| | | <el-select v-model="form.categoryId" placeholder="è¯·éæ©ï¼åé" @change="categorySelect"> |
| | | <el-option v-for="item in categoryList()" :key="item.id" :label="item.name" :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <!-- <el-form-item :label="name1" prop="attrFirstIds" v-if="name1"> |
| | | <el-select v-model="form.attrFirstIds" multiple placeholder="è¯·éæ©ï¼æ¯æå¤é"> |
| | | <el-option |
| | | v-for="item in form.attrFirstList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item :label="name2" prop="attrSecodIds" v-if="name2"> |
| | | <el-select v-model="form.attrSecodIds" multiple placeholder="è¯·éæ©ï¼æ¯æå¤é"> |
| | | <el-option |
| | | v-for="item in form.attrSecodList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> --> |
| | | <el-form-item label="æå¯¼ä»·ï¼å
ï¼" prop="zdPrice"> |
| | | <el-input v-model="form.zdPrice" @input="priceCHANEG(form.zdPrice, 1)" type="number" placeholder="建议å½å
¥æ´æ°ï¼åä½å
" v-trim/> |
| | | <el-input v-model="form.zdPrice" @input="priceCHANEG(form.zdPrice, 1)" type="number" placeholder="建议å½å
¥æ´æ°ï¼åä½å
" |
| | | v-trim /> |
| | | </el-form-item> |
| | | <el-form-item label="å
¥æä»·ï¼å
ï¼" prop="price"> |
| | | <el-input v-model="form.price" @input="priceCHANEG(form.price, 2)" type="number" placeholder="建议å½å
¥æ´æ°ï¼åä½å
" v-trim/> |
| | | <el-input v-model="form.price" @input="priceCHANEG(form.price, 2)" type="number" placeholder="建议å½å
¥æ´æ°ï¼åä½å
" |
| | | v-trim /> |
| | | </el-form-item> |
| | | <el-form-item label="åå主å¾"> |
| | | <el-upload |
| | | :action="action" |
| | | :file-list="form.ztList" |
| | | :data="{ folder: 'goods_img' }" |
| | | list-type="picture-card" |
| | | :limit="1" |
| | | :on-success="fileSuccess" |
| | | :on-exceed="exceed" |
| | | :on-remove="handleRemove"> |
| | | <i class="el-icon-plus"></i> |
| | | <div slot="tip" class="el-upload__tip">åªè½ä¸ä¼ å¾çæ ¼å¼ï¼pngæ ¼å¼ï¼å»ºè®®å°ºå¯¸140*140px</div> |
| | | </el-upload> |
| | | <UploadAvatarImage :file="{ 'imgurlfull': form.imgfullurl, 'imgurl': form.imgurl }" :uploadData="uploadData" |
| | | tipsLabel="" @uploadSuccess="uploadReverseSuccess" @uploadEnd="isUploading = false" |
| | | @uploadBegin="isUploading = true" /> |
| | | åªè½ä¸ä¼ å¾çæ ¼å¼ï¼pngæ ¼å¼ï¼å»ºè®®å°ºå¯¸140px*140px |
| | | </el-form-item> |
| | | <el-form-item label="ååå¾ç"> |
| | | <el-upload |
| | | :action="action" |
| | | :file-list="form.files" |
| | | :multiple="true" |
| | | :data="{ folder: 'goods_img' }" |
| | | list-type="picture-card" |
| | | :on-success="fileSuccess1" |
| | | :on-remove="handleRemove1"> |
| | | <i class="el-icon-plus"></i> |
| | | <div slot="tip" class="el-upload__tip">åªè½ä¸ä¼ å¾çæ ¼å¼ï¼pngæ ¼å¼ï¼å»ºè®®å°ºå¯¸600*600px</div> |
| | | </el-upload> |
| | | <el-form-item label="ååå¾ç"> |
| | | <UploadImage :fileList="form.multifileList" :uploadData="uploadData" @beginUpload="isUploading = true" @endUpload="isUploading = false" /> |
| | | åªè½ä¸ä¼ å¾çæ ¼å¼ï¼pngæ ¼å¼ï¼å»ºè®®å°ºå¯¸600*600px |
| | | </el-form-item> |
| | | <template v-if="form.goodsParamList && form.goodsParamList.length > 0"> |
| | | <div style="font-size: 18px;font-weight: bold;">忰屿§å¼é
ç½® <span style="font-size: 13px; font-weight: 500;">æéé
ç½®å½åååç产ååæ°å¼ï¼åä¸ªåæ°å¼ä¸è¶
è¿30个å</span></div> |
| | | <el-form-item :label="item.name" v-for="(item, index) in form.goodsParamList" :key="index"> |
| | | <el-input v-model="item.val" maxlength="30" type="text" placeholder="请è¾å
¥" v-trim/> |
| | | <template v-if="form.baseGoodsParamList && form.baseGoodsParamList.length > 0"> |
| | | <div style="font-size: 18px;font-weight: bold;">忰屿§å¼é
ç½® <span |
| | | style="font-size: 13px; font-weight: 500;">æéé
ç½®å½åååç产ååæ°å¼ï¼åä¸ªåæ°å¼ä¸è¶
è¿30个å</span></div> |
| | | <el-form-item :label="item.name" v-for="(item, index) in form.baseGoodsParamList" :key="index"> |
| | | <el-input v-model="item.val" maxlength="30" type="text" placeholder="请è¾å
¥" v-trim /> |
| | | </el-form-item> |
| | | </template> |
| | | </el-form> |
| | |
| | | <script> |
| | | import BaseOpera from '@/components/base/BaseOpera' |
| | | import GlobalWindow from '@/components/common/GlobalWindow' |
| | | import { baseCategory,brand } from '@/api/system/common.js' |
| | | import { create, updateById, companyCreate, companyUpdateById } from '@/api/business/goods.js' |
| | | import UploadAvatarImage from '@/components/common/UploadAvatarImage.vue' |
| | | import UploadImage from '@/components/common/UploadImage.vue' |
| | | import { baseCategory, brand } from '@/api/system/common.js' |
| | | import { companyCreate, companyUpdateById } from '@/api/business/goods.js' |
| | | export default { |
| | | name: 'OperaGoodsWindow', |
| | | extends: BaseOpera, |
| | | components: { GlobalWindow }, |
| | | data () { |
| | | components: { GlobalWindow, UploadAvatarImage, UploadImage }, |
| | | data() { |
| | | return { |
| | | action: process.env.VUE_APP_API_PREFIX + '/public/upload', |
| | | name1: '', |
| | | name2: '', |
| | | // è¡¨åæ°æ® |
| | | isUploading: false, |
| | | form: { |
| | | id: null, |
| | | name: '', |
| | |
| | | brandId: '', |
| | | zdPrice: '', |
| | | price: '', |
| | | attrFirstIds: [], |
| | | attrFirstNames: '', |
| | | attrSecodIds: [], |
| | | attrSecodNames: '', |
| | | imgurl: '', |
| | | imgfullurl: '', |
| | | multifileList: [], |
| | | files: [], |
| | | ztList: [], |
| | | goodsParamList: [], |
| | | attrFirstList: [], |
| | | attrSecodList: [] |
| | | baseGoodsParamList: [], |
| | | }, |
| | | uploadData: { |
| | | folder: 'goods_img' |
| | | }, |
| | | // éªè¯è§å |
| | | rules: { |
| | |
| | | { required: true, message: 'ä¸è½ä¸ºç©º', trigger: 'blur' } |
| | | ] |
| | | }, |
| | | options: [], |
| | | categoryList: [], |
| | | brandList: [] |
| | | options: [] |
| | | } |
| | | }, |
| | | created () { |
| | | inject: ['categoryList', 'brandList'], |
| | | created() { |
| | | this.config({ |
| | | api: '/business/goods', |
| | | 'field.id': 'id' |
| | | }) |
| | | this.getbrand() |
| | | this.getcategory() |
| | | }, |
| | | watch: { |
| | | 'form.categoryId': { |
| | | immediate: true, |
| | | handler(news, old) { |
| | | if (news) { |
| | | this.name1 = '' |
| | | this.name2 = '' |
| | | if (old) { |
| | | this.form.attrFirstIds = [] |
| | | this.form.attrSecodIds = [] |
| | | this.form.goodsParamList = [] |
| | | } |
| | | this.categoryList.forEach(item => { |
| | | if (item.id === news) { |
| | | this.name1 = item.attrFirst |
| | | this.name2 = item.attrSecond |
| | | this.form.attrFirstList = item.attrFirstList.length > 0 ? item.attrFirstList : [] |
| | | this.form.attrSecodList = item.attrSecondList.length > 0 ? item.attrSecondList : [] |
| | | this.form.goodsParamList = JSON.parse(JSON.stringify(item.paramList)) |
| | | this.form.goodsParamList.forEach(item => { |
| | | item.pramaId = item.id |
| | | }) |
| | | console.log(this.form.goodsParamList) |
| | | } |
| | | }) |
| | | this.getcategory(1) |
| | | } |
| | | } |
| | | }, |
| | | visible: { |
| | | handler(news, old) { |
| | | if (!news) { |
| | | this.name1 = '' |
| | | this.name2 = '' |
| | | this.form = { |
| | | id: null, |
| | | name: '', |
| | | categoryId: '', |
| | | brandId: '', |
| | | zdPrice: '', |
| | | price: '', |
| | | attrFirstIds: [], |
| | | attrFirstNames: '', |
| | | attrSecodIds: [], |
| | | attrSecodNames: '', |
| | | imgurl: '', |
| | | multifileList: [], |
| | | files: [], |
| | | ztList: [], |
| | | goodsParamList: [], |
| | | attrFirstList: [], |
| | | attrSecodList: [] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // this.getbrand() |
| | | // this.getcategory() |
| | | }, |
| | | methods: { |
| | | open(title, target) { |
| | | this.title = title |
| | | this.visible = true |
| | | // æ°å»º |
| | | if (target == null) { |
| | | this.$nextTick(() => { |
| | | this.$refs.form.resetFields() |
| | | this.form.imgurl = '' |
| | | this.form.imgfullurl = '' |
| | | this.form.multifileList = [] |
| | | this.form.baseGoodsParamList = [] |
| | | this.form[this.configData['field.id']] = null |
| | | }) |
| | | return |
| | | } |
| | | // ç¼è¾ |
| | | this.$nextTick(() => { |
| | | for (const key in this.form) { |
| | | this.form[key] = target[key] |
| | | } |
| | | this.form.multifileList.forEach(item => { |
| | | item.url = item.filefullurl |
| | | }) |
| | | }) |
| | | }, |
| | | priceCHANEG(val, type) { |
| | | if (!/^[1-9]+[0-9]*$/.test(val)) { |
| | | this.$message.warning('åªè½è¾å
¥æ£æ´æ°') |
| | |
| | | } |
| | | } |
| | | }, |
| | | confirm() { |
| | | this.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | if (this.form.attrFirstIds.length > 0) { |
| | | let arr = [] |
| | | this.form.attrFirstIds.forEach(element => { |
| | | this.form.attrFirstList.forEach(item => { |
| | | if (element === item.id) { |
| | | arr.push(item.name) |
| | | } |
| | | }) |
| | | }) |
| | | this.form.attrFirstNames = arr.join(',') |
| | | this.form.attrFirstIds = this.form.attrFirstIds.join(',') |
| | | } else { |
| | | this.form.attrFirstNames = '' |
| | | this.form.attrFirstIds = '' |
| | | } |
| | | if (this.form.attrSecodIds.length > 0) { |
| | | let arr = [] |
| | | this.form.attrSecodIds.forEach(element => { |
| | | this.form.attrSecodList.forEach(item => { |
| | | if (element === item.id) { |
| | | arr.push(item.name) |
| | | } |
| | | }) |
| | | }) |
| | | this.form.attrSecodNames = arr.join(',') |
| | | this.form.attrSecodIds = this.form.attrSecodIds.join(',') |
| | | } else { |
| | | this.form.attrSecodNames = '' |
| | | this.form.attrSecodIds = '' |
| | | } |
| | | if (!this.form.id) { |
| | | companyCreate({...this.form, type: 0}) |
| | | .then(() => { |
| | | this.visible = false |
| | | this.$tip.apiSuccess('æ°å»ºæå') |
| | | this.$emit('success') |
| | | }) |
| | | .catch(e => { |
| | | this.$tip.apiFailed(e) |
| | | }) |
| | | .finally(() => { |
| | | this.isWorking = false |
| | | }) |
| | | } else { |
| | | companyUpdateById({...this.form, type: 0}) |
| | | .then(() => { |
| | | this.visible = false |
| | | this.$tip.apiSuccess('ç¼è¾æå') |
| | | this.$emit('success') |
| | | }) |
| | | .catch(e => { |
| | | this.$tip.apiFailed(e) |
| | | }) |
| | | .finally(() => { |
| | | this.isWorking = false |
| | | }) |
| | | } |
| | | } else { |
| | | return false; |
| | | categorySelect(v) { |
| | | this.categoryList().forEach(item => { |
| | | if (item.id === v) { |
| | | this.form.baseGoodsParamList = JSON.parse(JSON.stringify(item.baseCateParamList)) |
| | | this.form.baseGoodsParamList.forEach(item => { |
| | | item.pramaId = item.id |
| | | }) |
| | | } |
| | | }); |
| | | }, |
| | | exceed() { |
| | | this.$message.warning({ |
| | | message: 'åªè½ä¸ä¼ ä¸ä¸ªå¾æ ' |
| | | }) |
| | | }, |
| | | fileSuccess1(response, file, fileList) { |
| | | this.form.files = fileList |
| | | this.form.multifileList.push({ fileurl: response.data.imgaddr, name: response.data.imgname, url: response.data.url }) |
| | | }, |
| | | handleRemove1(file, fileList) { |
| | | this.form.files = fileList |
| | | this.form.multifileList = fileList |
| | | }, |
| | | fileSuccess(response) { |
| | | this.form.ztList.push({ imgaddr: response.data.imgaddr, url: response.data.url }) |
| | | this.form.imgurl = response.data.imgaddr |
| | | }, |
| | | handleRemove() { |
| | | this.form.ztList = [] |
| | | this.form.imgurl = '' |
| | | }, |
| | | getbrand() { |
| | | brand({status:0}) |
| | | .then(res => { |
| | | this.brandList = res |
| | | }) |
| | | }, |
| | | getcategory(type) { |
| | | baseCategory({status:0 , type:1}) |
| | | .then(res => { |
| | | this.categoryList = res |
| | | if (type === 1) { |
| | | this.categoryList.forEach(item => { |
| | | if (item.id === this.form.categoryId) { |
| | | this.form.goodsParamList = JSON.parse(JSON.stringify(item.paramList)) |
| | | this.form.goodsParamList.forEach(item => { |
| | | item.pramaId = item.id |
| | | }) |
| | | console.log(this.form.goodsParamList) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | uploadReverseSuccess(file) { |
| | | this.form.imgurl = file.imgurl; |
| | | this.form.imgfullurl = file.imgurlfull; |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | |
| | | }, |
| | | created() { |
| | | this.config({ |
| | | api: '/business/anchor', |
| | | api: '/business/goods', |
| | | 'field.id': 'id' |
| | | }) |
| | | }, |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template>
|
| | | <div class="import-button">
|
| | | <el-button type="primary" @click="$refs.importWindow.open(text)">{{text}}</el-button>
|
| | | <ImportWindow :action="action" :template-path="templatePath" :template-name="templateName" ref="importWindow" @success="handleSuccess"/>
|
| | | </div>
|
| | | </template>
|
| | |
|
| | | <script>
|
| | | import ImportWindow from './ImportWindow'
|
| | | export default {
|
| | | name: 'ImportButton',
|
| | | components: { ImportWindow },
|
| | | props: {
|
| | | // æé®ææ¡
|
| | | text: {
|
| | | default: '导å
¥'
|
| | | },
|
| | | // 模çå°å
|
| | | templatePath: {
|
| | | required: true
|
| | | },
|
| | | // ä¸è½½åçæ¨¡çæä»¶åç§°
|
| | | templateName: {
|
| | | required: true
|
| | | },
|
| | | // 导å
¥æ¥å£å°å
|
| | | action: {
|
| | | required: true
|
| | | }
|
| | | },
|
| | | methods: {
|
| | | handleSuccess () {
|
| | | this.$emit('success')
|
| | | }
|
| | | }
|
| | | }
|
| | | </script>
|
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template>
|
| | | <el-dialog
|
| | | width="500px"
|
| | | :title="title"
|
| | | :visible.sync="visible"
|
| | | append-to-body
|
| | | custom-class="eva-dialog import-window"
|
| | | :close-on-click-modal="false"
|
| | | :close-on-press-escape="false"
|
| | | :show-close="false"
|
| | | >
|
| | | <el-form>
|
| | | <el-form-item>
|
| | | <el-upload
|
| | | drag
|
| | | :show-file-list="false"
|
| | | action="none"
|
| | | accept=".xlsx, .xls"
|
| | | :before-upload="handleBeforeUpload"
|
| | | >
|
| | | <template v-if="form.file == null">
|
| | | <i class="el-icon-upload"></i>
|
| | | <div class="el-upload__text">å°æä»¶æå°æ¤å¤ï¼æ<em>ç¹å»ä¸ä¼ </em></div>
|
| | | </template>
|
| | | <template v-else>
|
| | | <i class="el-icon-files"></i>
|
| | | <div class="el-upload__text">{{form.file.name}}<em></em></div>
|
| | | </template>
|
| | | </el-upload>
|
| | | </el-form-item>
|
| | | </el-form>
|
| | | |
| | | <div slot="footer" class="import-window__footer">
|
| | | <!-- <div class="sync-exists">
|
| | | <el-checkbox v-model="form.sync"/><span>忥已åå¨çæ°æ®</span>
|
| | | </div> -->
|
| | | <div class="opera">
|
| | | <a href=""></a>
|
| | | <el-button type="text" icon="el-icon-download" @click="downloadTemplate">ä¸è½½æ¨¡ç</el-button>
|
| | | <el-button @click="cancel">{{cancelText}}</el-button>
|
| | | <el-button type="primary" @click="confirm" :loading="isWorking">{{confirmText}}</el-button>
|
| | | </div>
|
| | | </div>
|
| | | </el-dialog>
|
| | | </template>
|
| | |
|
| | | <script>
|
| | | import request from '@/utils/request'
|
| | | export default {
|
| | | name: 'ImportWindow',
|
| | | props: {
|
| | | // 导å
¥æ¥å£å°å
|
| | | action: {
|
| | | required: true
|
| | | },
|
| | | // 确认æé®ææ¡
|
| | | confirmText: {
|
| | | type: String,
|
| | | default: '导å
¥'
|
| | | },
|
| | | |
| | | // åæ¶æé®ææ¡
|
| | | cancelText: {
|
| | | type: String,
|
| | | default: 'åæ¶'
|
| | | },
|
| | | // 模çå°å
|
| | | templatePath: {
|
| | | required: true
|
| | | },
|
| | | // ä¸è½½åçæ¨¡çæä»¶åç§°
|
| | | templateName: {
|
| | | required: true
|
| | | }
|
| | | },
|
| | | data () {
|
| | | return {
|
| | | visible: false,
|
| | | isWorking: false,
|
| | | title: '导å
¥æ°æ®',
|
| | | form: {
|
| | | sync: false,
|
| | | file: false,
|
| | | categoryId: ''
|
| | | }
|
| | | }
|
| | | },
|
| | | methods: {
|
| | | /**
|
| | | * æå¼çªå£
|
| | | *
|
| | | * @param title çªå£æ é¢
|
| | | */
|
| | | open (title) {
|
| | | this.visible = true
|
| | | this.title = title
|
| | | this.form.sync = false
|
| | | this.form.file = null
|
| | | },
|
| | | /**
|
| | | * ç¡®å®å¯¼å
¥
|
| | | */
|
| | | confirm () {
|
| | | if (this.form.file == null) {
|
| | | this.$message.warning('è¯·éæ©æä»¶')
|
| | | return
|
| | | }
|
| | | this.isWorking = true
|
| | | const param = new FormData()
|
| | | param.set('file', this.form.file)
|
| | | request.post(this.action, param, {
|
| | | headers: {
|
| | | 'Content-Type': 'multipart/form-data;charset=UTF-8'
|
| | | }
|
| | | })
|
| | | .then(() => {
|
| | | this.$message.success('导å
¥æå')
|
| | | this.visible = false
|
| | | this.$emit('success')
|
| | | })
|
| | | .catch(e => {
|
| | | this.$message.error(e)
|
| | | })
|
| | | .finally(() => {
|
| | | this.isWorking = false
|
| | | })
|
| | | },
|
| | | /**
|
| | | * åæ¶
|
| | | */
|
| | | cancel () {
|
| | | this.visible = false
|
| | | },
|
| | | /**
|
| | | * ä¸è½½æ¨¡ç
|
| | | */
|
| | | downloadTemplate () {
|
| | | const link = document.createElement('a')
|
| | | link.setAttribute('download', this.templateName) //ä¸è½½çæä»¶å
|
| | | // console.log(`window.location.origin`, window.location.origin);
|
| | | // console.log(`process.env.VUE_APP_CONTEXT_PATH`, process.env.VUE_APP_CONTEXT_PATH);
|
| | | // console.log(`this.templatePath`, this.templatePath);
|
| | | link.href = `${window.location.origin}${process.env.VUE_APP_CONTEXT_PATH}${this.templatePath}` //æä»¶url
|
| | | link.click()
|
| | | },
|
| | | /**
|
| | | * æä»¶ä¸ä¼ ååå¨ä¸ä¼ çæä»¶
|
| | | *
|
| | | * @param file é导å
¥çæä»¶
|
| | | */
|
| | | handleBeforeUpload (file) {
|
| | | this.form.file = file
|
| | | return false
|
| | | }
|
| | | }
|
| | | }
|
| | | </script>
|
| | |
|
| | | <style lang="scss">
|
| | | @import "../../assets/style/variables";
|
| | | .import-window {
|
| | | .el-upload {
|
| | | width: 100%;
|
| | | .el-upload-dragger {
|
| | | width: 100%;
|
| | | .el-icon-upload, .el-icon-files {
|
| | | font-size: 67px;
|
| | | color: #C0C4CC;
|
| | | margin: 40px 0 16px;
|
| | | line-height: 50px;
|
| | | }
|
| | | }
|
| | | }
|
| | | .import-window__footer {
|
| | | display: flex;
|
| | | .sync-exists {
|
| | | width: 200px;
|
| | | flex-shrink: 0;
|
| | | text-align: left;
|
| | | font-size: 13px;
|
| | | display: flex;
|
| | | align-items: center;
|
| | | .el-checkbox {
|
| | | margin-right: 10px;
|
| | | }
|
| | | & > * {
|
| | | vertical-align: middle;
|
| | | }
|
| | | }
|
| | | .opera {
|
| | | flex-grow: 1;
|
| | | a {
|
| | | font-size: 12px;
|
| | | margin-right: 10px;
|
| | | text-decoration: none;
|
| | | .el-icon-download {
|
| | | font-size: 15px;
|
| | | position: relative;
|
| | | top: 2px;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | </style>
|
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/public/uploadLocal', |
| | | uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/public/upload', |
| | | |
| | | realList: [], |
| | | srcList: [], |
| | |
| | | </el-form-item> |
| | | <section> |
| | | <el-button type="primary" @click="search">æç´¢</el-button> |
| | | <!-- |
| | | <el-button type="primary" :loading="isWorking.export" v-permissions="['business:basedata:exportExcel']" @click="exportExcel">导åº</el-button> |
| | | --> |
| | | <el-button @click="reset">éç½®</el-button> |
| | | </section> |
| | | </el-form> |
| | | <!-- è¡¨æ ¼åå页 --> |
| | | <template v-slot:table-wrap> |
| | | <ul class="toolbar" v-permissions="['business:basedata:create', 'business:basedata:delete']"> |
| | | <!-- |
| | | <li><el-button type="primary" @click="$refs.operaBaseDataWindow.open('æ°å»ºååæºæ°æ®ä¿¡æ¯è¡¨')" icon="el-icon-plus" v-permissions="['business:basedata:create']">æ°å»º</el-button></li> |
| | | --> |
| | | <li><el-button @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['business:basedata:delete']">æ¹éå é¤</el-button></li> |
| | | <li><el-button @click="deleteByIdInBatch" icon="el-icon-delete" |
| | | v-permissions="['business:basedata:delete']">æ¹éå é¤</el-button></li> |
| | | </ul> |
| | | <el-table |
| | | v-loading="isWorking.search" |
| | | :data="tableData.list" |
| | | stripe |
| | | @selection-change="handleSelectionChange" |
| | | > |
| | | <el-table v-loading="isWorking.search" :data="tableData.list" border stripe @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55"></el-table-column> |
| | | <el-table-column prop="id" label="主é®" min-width="100px"></el-table-column> |
| | | <el-table-column prop="createDate" label="å建æ¶é´" min-width="100px"></el-table-column> |
| | | <el-table-column prop="name" label="åå主å¾" min-width="80px"> |
| | | <template slot-scope="{row}"> |
| | | <a :href="`${row.url}`" target="_blank"> |
| | | <div style="display: flex; align-items: center;"> |
| | | <div style="width: 70px; height: 70px; flex-shrink: 0;"> |
| | | <el-image v-if="row.imgurl" style="width: 70px; height: 70px" :src="row.imgurl" |
| | | :preview-src-list="[row.imgurl]" fit="cover"></el-image> |
| | | </div> |
| | | </div> </a> |
| | | <div style="display: flex; align-items: center;"> |
| | | <div style="width: 70px; height: 70px; flex-shrink: 0;"> |
| | | <el-image v-if="row.imgurl" style="width: 70px; height: 70px" :src="row.imgurl" |
| | | :preview-src-list="[row.imgurl]" fit="cover"></el-image> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="name" label="åååç§°" min-width="150px"> |
| | | <template slot-scope="{row}"> |
| | | <a :href="`${row.url}`" target="_blank">{{row.name}}</a> |
| | | <a :href="`${row.url}`" target="_blank">{{ row.name }}</a> |
| | | </template> |
| | | </el-table-column> |
| | | <!-- <el-table-column prop="title" label="æ é¢" min-width="100px"></el-table-column>--> |
| | | <!-- <el-table-column prop="title" label="æ é¢" min-width="100px"></el-table-column>--> |
| | | <el-table-column prop="sku" label="京ä¸sku" min-width="100px"></el-table-column> |
| | | <el-table-column prop="brand" label="åç" min-width="120px"></el-table-column> |
| | | <el-table-column prop="category" label="ç±»å«" min-width="100px"></el-table-column> |
| | | <el-table-column prop="price" label="ä»·æ ¼ï¼å
ï¼" min-width="100px"></el-table-column> |
| | | <el-table-column prop="saleprice" label="éè´ä»·æ ¼ï¼å
ï¼" min-width="100px"></el-table-column> |
| | | <el-table-column prop="haveStock" label="åºåæ
åµ" min-width="100px"></el-table-column> |
| | | <el-table-column prop="bgImg" label="大å¾1" min-width="80px"> |
| | | <el-table-column prop="bgImgs" label="大å¾" min-width="80px"> |
| | | <template slot-scope="{row}"> |
| | | <div style="display: flex; align-items: center;"> |
| | | <el-button type="text" @click="showImage(row.bgImgs)">æ¥ç大å¾</el-button> |
| | | <!-- <div style="display: flex; align-items: center;"> |
| | | <div style="width: 70px; height: 70px; flex-shrink: 0;"> |
| | | <el-image v-if="row.bgImg" style="width: 70px; height: 70px" :src="row.bgImg" |
| | | :preview-src-list="[row.bgImg]" fit="cover"></el-image> |
| | | <el-image v-if="row.bgImgs" style="width: 70px; height: 70px" :src="row.bgImgs" |
| | | :preview-src-list="row.bgImgs" fit="cover"></el-image> |
| | | </div> |
| | | </div> |
| | | </div> --> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="bgImg2" label="大å¾2" min-width="80px"> |
| | | <el-table-column prop="status" label="å¤çç¶æ" min-width="100px"> |
| | | <template slot-scope="{row}"> |
| | | <div style="display: flex; align-items: center;"> |
| | | <div style="width: 70px; height: 70px; flex-shrink: 0;"> |
| | | <el-image v-if="row.bgImg2" style="width: 70px; height: 70px" :src="row.bgImg2" |
| | | :preview-src-list="[row.bgImg2]" fit="cover"></el-image> |
| | | </div> |
| | | </div> |
| | | {{ row.status == 1 ? "å·²å¤ç" : "æªå¤ç" }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="bgImg3" label="大å¾3" min-width="80px"> |
| | | <el-table-column v-if="containPermissions(['business:basedata:update', 'business:basedata:delete'])" label="æä½" |
| | | min-width="80" fixed="right"> |
| | | <template slot-scope="{row}"> |
| | | <div style="display: flex; align-items: center;"> |
| | | <div style="width: 70px; height: 70px; flex-shrink: 0;"> |
| | | <el-image v-if="row.bgImg3" style="width: 70px; height: 70px" :src="row.bgImg3" |
| | | :preview-src-list="[row.bgImg3]" fit="cover"></el-image> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <!-- <el-table-column prop="attr1" label="屿§1" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr2" label="屿§2" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr3" label="屿§3" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr4" label="屿§4" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr5" label="屿§5" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr6" label="屿§6" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr7" label="屿§7" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr8" label="屿§8" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr9" label="屿§9" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr10" label="屿§10" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr11" label="屿§11" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr12" label="屿§12" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr13" label="屿§13" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr14" label="屿§14" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr15" label="屿§15" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr16" label="屿§16" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr17" label="屿§17" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr18" label="屿§18" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr19" label="屿§19" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr20" label="屿§20" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr21" label="屿§21" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr22" label="屿§22" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr23" label="屿§23" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr24" label="屿§24" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr25" label="屿§25" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr26" label="屿§26" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr27" label="屿§27" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr28" label="屿§28" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr29" label="屿§29" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr30" label="屿§30" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr31" label="屿§31" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr32" label="屿§32" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr33" label="屿§33" min-width="100px"></el-table-column> |
| | | <el-table-column prop="attr34" label="屿§34" min-width="100px"></el-table-column> |
| | | --><el-table-column prop="status" label="å¤çç¶æ" min-width="100px"> |
| | | <template slot-scope="{row}"> |
| | | {{row.status==1?"å·²å¤ç":"æªå¤ç"}} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | v-if="containPermissions(['business:basedata:update', 'business:basedata:delete'])" |
| | | label="æä½" |
| | | min-width="80" |
| | | fixed="right" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <!-- |
| | | <!-- |
| | | <el-button type="text" @click="$refs.operaBaseDataWindow.open('ç¼è¾ååæºæ°æ®ä¿¡æ¯è¡¨', row)" icon="el-icon-edit" v-permissions="['business:basedata:update']">ç¼è¾</el-button> |
| | | --> |
| | | <el-button type="text" @click="deleteById(row)" icon="el-icon-delete" v-permissions="['business:basedata:delete']">å é¤</el-button> |
| | | <el-button type="text" @click="deleteById(row)" icon="el-icon-delete" |
| | | v-permissions="['business:basedata:delete']">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination |
| | | @size-change="handleSizeChange" |
| | | @current-change="handlePageChange" |
| | | :pagination="tableData.pagination" |
| | | > |
| | | <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination"> |
| | | </pagination> |
| | | </template> |
| | | <!-- æ°å»º/ä¿®æ¹ --> |
| | | <OperaBaseDataWindow ref="operaBaseDataWindow" @success="handlePageChange"/> |
| | | <OperaBaseDataWindow ref="operaBaseDataWindow" @success="handlePageChange" /> |
| | | <el-image-viewer |
| | | v-if="showViewer" |
| | | :on-close="closeViewer" |
| | | :initialIndex="0" |
| | | :url-list="srcList" |
| | | :z-index="3000" |
| | | /> |
| | | </TableLayout> |
| | | </template> |
| | | |
| | |
| | | import TableLayout from '@/layouts/TableLayout' |
| | | import Pagination from '@/components/common/Pagination' |
| | | import OperaBaseDataWindow from '@/components/business/OperaBaseDataWindow' |
| | | import ElImageViewer from 'element-ui/packages/image/src/image-viewer' |
| | | export default { |
| | | name: 'BaseData', |
| | | extends: BaseTable, |
| | | components: { TableLayout, Pagination, OperaBaseDataWindow }, |
| | | data () { |
| | | components: { TableLayout, Pagination, OperaBaseDataWindow, ElImageViewer }, |
| | | data() { |
| | | return { |
| | | showViewer: false, |
| | | srcList: [], |
| | | // æç´¢ |
| | | searchForm: { |
| | | name: '', |
| | |
| | | ] |
| | | } |
| | | }, |
| | | created () { |
| | | created() { |
| | | this.config({ |
| | | module: 'ååæºæ°æ®ä¿¡æ¯è¡¨', |
| | | api: '/business/baseData', |
| | |
| | | 'field.main': 'id' |
| | | }) |
| | | this.search() |
| | | } |
| | | }, |
| | | methods: { |
| | | showImage(imgs) { |
| | | this.srcList = [] |
| | | this.srcList = imgs |
| | | this.showViewer = true |
| | | }, |
| | | closeViewer() { |
| | | this.showViewer = false |
| | | } |
| | | |
| | | }, |
| | | } |
| | | </script> |
| | |
| | | <el-table v-loading="isWorking.search" :data="tableData.list" border stripe |
| | | @selection-change="handleSelectionChange"> |
| | | <!-- <el-table-column type="selection" width="55" align="center"></el-table-column> --> |
| | | <el-table-column prop="id" label="ä¼ä¸ç¼å·" min-width="80px" align="center"></el-table-column> |
| | | <el-table-column prop="name" label="ä¼ä¸åç§°" min-width="100px" align="center"></el-table-column> |
| | | <el-table-column prop="managerUserName" label="管çåè´¦å·" min-width="100px" align="center"></el-table-column> |
| | | <el-table-column prop="linkname" label="è系人" min-width="100px" align="center"></el-table-column> |
| | |
| | | |
| | | <template> |
| | | <TableLayout :permissions="['business:goods:query']"> |
| | | <TableLayout :permissions="['business:basegoods:query']"> |
| | | <!-- æç´¢è¡¨å --> |
| | | <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline> |
| | | <el-form-item label="åååç§°" prop="name"> |
| | |
| | | </el-form> |
| | | <!-- è¡¨æ ¼åå页 --> |
| | | <template v-slot:table-wrap> |
| | | <ul class="toolbar" v-permissions="['business:goods:create', 'business:goods:delete']"> |
| | | <li><el-button type="primary" @click="$refs.operaGoodsWindow.open('æ°å»ºåå')" icon="el-icon-plus" |
| | | v-permissions="['business:goods:create']">æ°å»º</el-button></li> |
| | | <ul class="toolbar" v-permissions="['business:basegoods:create', 'business:basegoods:delete']"> |
| | | <li v-permissions="['business:basegoods:create']"> |
| | | <el-button type="primary" @click="$refs.operaGoodsWindow.open('æ°å»ºåå')" icon="el-icon-plus">æ°å»º</el-button> |
| | | </li> |
| | | <!-- <el-button type="primary" :loading="isWorking.export" |
| | | @click="$refs.selectProduct.open('鿩平å°åå')">鿩平å°åå</el-button> --> |
| | | <el-button type="primary" :loading="isWorking.export" v-permissions="['business:goods:exportExcel']" |
| | | @click="importFile">导å
¥</el-button> |
| | | <el-button type="primary" :loading="isWorking.export" @click="downloadFile">ä¸è½½æ¨¡æ¿</el-button> |
| | | |
| | | <li v-permissions="['business:basegoods:exportExcel']"> |
| | | <ImportButton text="导å
¥" template-name="goods_import_modle.xlsx" |
| | | template-path="/template/goods_import_modle.xlsx" action="/business/baseGoods/importExcel" |
| | | @success="search" /> |
| | | </li> |
| | | <el-button type="primary" :loading="isWorking.export" @click="bulkOperation(0)">æ¹é䏿¶</el-button> |
| | | <el-button type="primary" :loading="isWorking.export" @click="bulkOperation(1)">æ¹é䏿¶</el-button> |
| | | <!-- <li><el-button @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['business:goods:delete']">å é¤</el-button></li> --> |
| | |
| | | </el-switch> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="containPermissions(['business:goods:update', 'business:goods:delete'])" label="æä½" |
| | | <el-table-column v-if="containPermissions(['business:basegoods:update', 'business:basegoods:delete'])" label="æä½" |
| | | min-width="120" fixed="right"> |
| | | <template slot-scope="{row}"> |
| | | <el-button type="text" @click="edit(row.id)" icon="el-icon-edit" |
| | | v-permissions="['business:goods:update']">ç¼è¾</el-button> |
| | | v-permissions="['business:basegoods:update']">ç¼è¾</el-button> |
| | | <el-button type="text" @click="deleteById(row)" icon="el-icon-delete" |
| | | v-permissions="['business:goods:delete']">å é¤</el-button> |
| | | v-permissions="['business:basegoods:delete']">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <input type="file" ref="upload" style="display: none;" @change="uplaodFile" /> |
| | | <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination"> |
| | | </pagination> |
| | | </template> |
| | |
| | | import Pagination from '@/components/common/Pagination' |
| | | import OperaGoodsWindow from '@/components/business/OperaGoodsWindow' |
| | | import selectProduct from '@/components/business/selectProduct' |
| | | import ImportButton from '@/components/common/ImportButton' |
| | | import { brand, baseCategory, importExcel } from '@/api/system/common.js' |
| | | import { updateStatus, queryById, exportDoc } from '@/api/business/goods.js' |
| | | export default { |
| | | name: 'Goods', |
| | | extends: BaseTable, |
| | | components: { TableLayout, Pagination, OperaGoodsWindow, selectProduct }, |
| | | components: { TableLayout, Pagination, OperaGoodsWindow, selectProduct, ImportButton }, |
| | | data() { |
| | | return { |
| | | // æç´¢ |
| | |
| | | ] |
| | | } |
| | | }, |
| | | provide() { |
| | | return { |
| | | brandList: () => this.brandList, |
| | | categoryList: () => this.categoryList |
| | | } |
| | | }, |
| | | created() { |
| | | this.config({ |
| | | module: 'åå', |
| | |
| | | let arr = e.map(item => item.id) |
| | | this.ids = arr.join(',') |
| | | this.idList = arr; |
| | | console.log(this.ids) |
| | | }, |
| | | // æ¹éä¸ä¸æ¶ |
| | | bulkOperation(type) { |
| | |
| | | rowStyle() { |
| | | return "text-align:center"; |
| | | }, |
| | | importFile() { |
| | | this.$refs.upload.click() |
| | | }, |
| | | uplaodFile(e) { |
| | | const FORMDATE = new FormData() |
| | | FORMDATE.append('file', e.target.files[0]) |
| | | // è¯·æ±æ¥å£ |
| | | importExcel(FORMDATE) |
| | | .then(res => { |
| | | console.log(res) |
| | | this.search() |
| | | }) |
| | | .catch((err) => { |
| | | this.$message.error(err.message) |
| | | }) |
| | | this.$refs.upload.value = null |
| | | }, |
| | | edit(id) { |
| | | queryById(id) |
| | | .then(res => { |
| | | let obj = { |
| | | id: res.id, |
| | | name: res.name, |
| | | categoryId: res.categoryId, |
| | | brandId: res.brandId, |
| | | zdPrice: res.zdPrice, |
| | | price: res.price, |
| | | attrFirstIds: res.attrFirstIds ? this.turnNum(res.attrFirstIds.split(',')) : [], |
| | | attrFirstNames: res.attrFirstNames, |
| | | attrSecodIds: res.attrSecodIds ? this.turnNum(res.attrSecodIds.split(',')) : [], |
| | | attrSecodNames: res.attrSecodNames, |
| | | imgurl: res.imgurl, |
| | | multifileList: [], |
| | | files: [], |
| | | ztList: res.imgurl ? [{ url: res.prefixUrl + res.imgurl }] : [], |
| | | pzList: [], |
| | | attrFirstList: [], |
| | | attrSecodList: [] |
| | | } |
| | | if (res.multifileList.length > 0) { |
| | | res.multifileList.forEach(item => { |
| | | obj.multifileList.push({ fileurl: item.fileurl, name: item.name, url: res.prefixUrl + item.fileurl }) |
| | | obj.files.push({ fileurl: item.fileurl, name: item.name, url: res.prefixUrl + item.fileurl }) |
| | | }) |
| | | } |
| | | this.$refs.operaGoodsWindow.open('ç¼è¾åå', obj) |
| | | this.$refs.operaGoodsWindow.open('ç¼è¾åå', res) |
| | | }) |
| | | }, |
| | | changeStatus(item) { |
| | |
| | | // this.search() |
| | | }) |
| | | }, |
| | | turnNum(nums) { |
| | | for (let i = 0; i < nums.length; i++) { |
| | | nums[i] = parseInt(nums[i]) |
| | | } |
| | | return nums; |
| | | }, |
| | | getbrand() { |
| | | brand({type:1}) |
| | | brand({ type: 1 }) |
| | | .then(res => { |
| | | this.brandList = res |
| | | }) |
| | |
| | | // 详ç»é
置请åèhttps://cli.vuejs.org/zh/config/#vue-config-js |
| | | // const outputDir = process.env.VUE_APP_CONTEXT_PATH.substring(1, process.env.VUE_APP_CONTEXT_PATH.length - 1) |
| | | // outputDir === '/' ? 'dist' : outputDir |
| | | |
| | | const outputDir = process.env.VUE_APP_CONTEXT_PATH.substring(1, process.env.VUE_APP_CONTEXT_PATH.length) |
| | | module.exports = { |
| | | publicPath: process.env.VUE_APP_CONTEXT_PATH, |
| | | outputDir: 'dist', |
| | | publicPath: './', |
| | | outputDir: outputDir || 'web', |
| | | assetsDir: 'static', |
| | | lintOnSave: false, |
| | | devServer: { |
| | |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.scheduling.annotation.EnableAsync; |
| | | |
| | | /** |
| | | * å¯å¨ç±» |
| | |
| | | @Slf4j |
| | | @SpringBootApplication |
| | | @MapperScan("com.doumee.dao") |
| | | @EnableAsync |
| | | public class CompanyApplication { |
| | | public static void main(String[] args) { |
| | | ApplicationContext context = SpringApplication.run(CompanyApplication.class); |
| | |
| | | import com.doumee.dao.business.model.BaseCateParam; |
| | | import com.doumee.dao.business.model.BaseCategory; |
| | | import com.doumee.dao.business.model.Category; |
| | | import com.doumee.service.CateParamSelectService; |
| | | import com.doumee.service.business.BaseCateParamService; |
| | | import com.doumee.service.business.BaseCategoryService; |
| | | import com.doumee.service.business.CategoryService; |
| | |
| | | |
| | | @Autowired |
| | | private BaseCateParamService baseCateParamService; |
| | | @Autowired |
| | | private CateParamSelectService cateParamSelectService; |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("æ°å»º") |
| | |
| | | @RequiresPermissions("business:category:update") |
| | | public ApiResponse companyUpdateById(@RequestBody Category category) { |
| | | categoryService.companyUpdateById(category); |
| | | cateParamSelectService.dealCateParamSelect(); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | |
| | | BaseCategory baseCategory = new BaseCategory(); |
| | | baseCategory.setIsdeleted(Constants.ZERO); |
| | | baseCategory.setStatus(Constants.ZERO); |
| | | baseCategoryService.findList(baseCategory); |
| | | List list = baseCategoryService.findList(baseCategory); |
| | | return ApiResponse.success(list); |
| | | } |
| | |
| | | import com.doumee.dao.business.model.dto.BatchDisableDTO; |
| | | import com.doumee.dao.business.model.dto.GoodCreatePlatRequest; |
| | | import com.doumee.dao.business.model.dto.GoodsRequest; |
| | | import com.doumee.service.CateParamSelectService; |
| | | import com.doumee.service.business.GoodsService; |
| | | import io.swagger.annotations.*; |
| | | import lombok.extern.java.Log; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | @Autowired |
| | | private GoodsService goodsService; |
| | | @Autowired |
| | | private CateParamSelectService cateParamSelectService; |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("æ°å»º") |
| | |
| | | @PostMapping("/companyCreate") |
| | | // @RequiresPermissions("business:goods:create") |
| | | public ApiResponse companyCreate(@RequestBody Goods goods) { |
| | | return ApiResponse.success(goodsService.companyCreate(goods)); |
| | | goodsService.companyCreate(goods); |
| | | cateParamSelectService.dealCateParamSelect(); |
| | | return ApiResponse.success("æä½æå"); |
| | | } |
| | | |
| | | @PreventRepeat |
| | |
| | | @PostMapping("/createPlat") |
| | | @RequiresPermissions("business:goods:create") |
| | | public ApiResponse createPlat(@RequestBody GoodCreatePlatRequest param) { |
| | | return ApiResponse.success(goodsService.createPlat(param)); |
| | | goodsService.createPlat(param); |
| | | cateParamSelectService.dealCateParamSelect(); |
| | | return ApiResponse.success("æä½æå"); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDå é¤") |
| | |
| | | @RequiresPermissions("business:goods:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id) { |
| | | goodsService.deleteById(id); |
| | | cateParamSelectService.dealCateParamSelect(); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | |
| | | idList.add(Integer.valueOf(id)); |
| | | } |
| | | goodsService.deleteByIdInBatch(idList); |
| | | cateParamSelectService.dealCateParamSelect(); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | |
| | | @RequiresPermissions("business:goods:update") |
| | | public ApiResponse companyUpdateById(@RequestBody Goods goods) { |
| | | goodsService.companyUpdateById(goods); |
| | | cateParamSelectService.dealCateParamSelect(); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | |
| | | }) |
| | | // @RequiresPermissions("business:goods:create") |
| | | public ApiResponse<Integer> importExcel (@ApiParam(value = "file") MultipartFile file) { |
| | | return ApiResponse.success(goodsService.importBatch(file)); |
| | | Integer val = goodsService.importBatch(file); |
| | | cateParamSelectService.dealCateParamSelect(); |
| | | return ApiResponse.success(val); |
| | | } |
| | | |
| | | |
| | |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.dao.business.model.Company; |
| | | import com.doumee.dao.system.model.SystemPermission; |
| | | import com.doumee.dao.system.model.SystemRole; |
| | | import com.doumee.dao.system.model.SystemUser; |
| | | import com.doumee.service.business.CompanyService; |
| | | import com.doumee.service.system.SystemDataPermissionService; |
| | | import com.doumee.service.system.SystemPermissionService; |
| | | import com.doumee.service.system.SystemRoleService; |
| | |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private SystemPermissionService systemPermissionService; |
| | | |
| | | @Lazy |
| | | @Autowired |
| | | private CompanyService companyService; |
| | | |
| | | /** |
| | | * æéå¤ç |
| | | * @author Eva.Caesar Liu |
| | |
| | | * @date 2022/03/15 09:54 |
| | | */ |
| | | @Override |
| | | protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException { |
| | | protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException{ |
| | | // è·åç¨æ·å |
| | | String username = authenticationToken.getPrincipal().toString(); |
| | | // æ ¹æ®ç¨æ·åæ¥è¯¢ç¨æ·å¯¹è±¡ |
| | |
| | | if(!Constants.equalsInteger(user.getStatus(),Constants.ZERO)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对ä¸èµ·ï¼è´¦å·ä¿¡æ¯å·²è¢«ç¦ç¨ï¼å¦æçé®è¯·è系系ç»ç®¡çåï¼"); |
| | | } |
| | | if(!user.getType().equals(Constants.UserType.SYSTEM)){ |
| | | Company company = companyService.findById(user.getCompanyId()); |
| | | if(company.getStatus().equals(Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对ä¸èµ·ï¼ä¼ä¸ä¿¡æ¯å·²è¢«ç¦ç¨ï¼å¦æçé®è¯·è系系ç»ç®¡çåï¼"); |
| | | } |
| | | if(DateUtil.compareDate(new Date(),DateUtil.addDaysToDate(company.getOepnValidDate(),1))<=Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对ä¸èµ·ï¼ä¼ä¸ä¿¡æ¯å·²è¿æï¼å¦æçé®è¯·è系系ç»ç®¡çåï¼"); |
| | | } |
| | | } |
| | | |
| | | // è·åç»å½ç¨æ·ä¿¡æ¯ |
| | | List<SystemRole> roles = systemRoleService.findByUserId(user.getId()); |
| | |
| | | </execution> |
| | | </executions> |
| | | </plugin> |
| | | <!--<plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-war-plugin</artifactId> |
| | | <version>2.6</version> |
| | | </plugin>--> |
| | | |
| | | </plugins> |
| | | </build> |
| | |
| | | @Component |
| | | public class ShiroSessionDAO implements SessionDAO { |
| | | |
| | | private static final String KEY_PREFIX = "shiro:session:"; |
| | | private static final String KEY_PREFIX = "shiro:session:admin:"; |
| | | |
| | | @Autowired |
| | | private ShiroCache shiroCache; |
| | |
| | | * 宿¶å¤çç¬è«æºæ°æ®ï¼çæç´ æåºæ°æ® |
| | | * @throws Exception |
| | | */ |
| | | @Scheduled(fixedDelay=10*60*1000) |
| | | @Scheduled(fixedDelay=30*60*1000) |
| | | public void dealBaseData() throws Exception { |
| | | baseDataService.dealBaseData(); |
| | | } |
| | |
| | | <packaging>pom</packaging> |
| | | <name>preselect</name> |
| | | <description></description> |
| | | <modules> |
| | | <module>platform</module> |
| | | <module>service</module> |
| | | <module>company</module> |
| | | </modules> |
| | | <modules> |
| | | <module>platform</module> |
| | | <module>service</module> |
| | | <module>company</module> |
| | | </modules> |
| | | |
| | | <parent> |
| | | <parent> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-parent</artifactId> |
| | | <version>2.2.5.RELEASE</version> |
| | |
| | | <oshi.version>5.7.0</oshi.version> |
| | | <jna.version>5.7.0</jna.version> |
| | | <poi.version>5.0.0</poi.version> |
| | | <maven.build.timestamp.format>yyyy-MM-dd-HH-mm</maven.build.timestamp.format> |
| | | </properties> |
| | | |
| | | <dependencies> |
| | |
| | | <artifactId>jxl</artifactId> |
| | | <version>2.6.12</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | <profiles> |
| | | <profile> |
| | | <id>dev</id> |
| | | <properties> |
| | | <evn>dev</evn> |
| | | </properties> |
| | | <activation> |
| | | <activeByDefault>true</activeByDefault> |
| | | </activation> |
| | | </profile> |
| | | <profile> |
| | | <id>test</id> |
| | | <properties> |
| | | <evn>test</evn> |
| | | </properties> |
| | | </profile> |
| | | </profiles> |
| | | <build> |
| | | <plugins> |
| | | <plugin> |
| | |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | |
| | | |
| | | |
| | | <!--<build> |
| | | |
| | | <finalName>${project.artifactId}</finalName> |
| | | |
| | | <resources> |
| | | <resource> |
| | | <directory>service/src/main/resources</directory> |
| | | <!– <filtering>true</filtering>–> |
| | | </resource> |
| | | </resources> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | <configuration> |
| | | <mainClass>com.doumee.Application</mainClass> |
| | | </configuration> |
| | | </plugin> |
| | | </plugins> |
| | | </build>--> |
| | | |
| | | </project> |
| | |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.model.Company; |
| | | import com.doumee.dao.system.dto.*; |
| | | import com.doumee.dao.system.model.SystemDepartment; |
| | | import com.doumee.dao.system.model.SystemDepartmentUser; |
| | | import com.doumee.dao.system.model.SystemUser; |
| | | import com.doumee.dao.system.model.SystemUserRole; |
| | | import com.doumee.service.business.CompanyService; |
| | | import com.doumee.service.system.*; |
| | | import org.apache.commons.lang3.RandomStringUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | |
| | | @Autowired |
| | | private SystemUserService systemUserService; |
| | | |
| | | @Autowired |
| | | private CompanyService companyService; |
| | | |
| | | @Autowired |
| | | private SystemUserRoleService systemUserRoleService; |
| | |
| | | if (user != null) { |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "ç¨æ·åå·²åå¨"); |
| | | } |
| | | if(createCompanyUserDTO.getType().equals(Constants.UserType.ZHUBO.getKey())){ |
| | | Company company = companyService.findById(loginUserInfo.getCompanyId()); |
| | | SystemUser zbUserNum = new SystemUser(); |
| | | zbUserNum.setCompanyId(loginUserInfo.getCompanyId()); |
| | | zbUserNum.setDeleted(Boolean.FALSE); |
| | | zbUserNum.setType(Constants.UserType.ZHUBO.getKey()); |
| | | if(systemUserService.findList(zbUserNum).size()>=company.getUserNum()){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对ä¸èµ·ï¼å·²è¶
åºä¼ä¸å¯åé
ä¸»ææ°éï¼å¦æçé®è¯·è系系ç»ç®¡çåï¼"); |
| | | } |
| | | } |
| | | SystemUser systemUser = new SystemUser(); |
| | | BeanUtils.copyProperties(createCompanyUserDTO,systemUser); |
| | | systemUser.setCompanyId(loginUserInfo.getCompanyId()); |
| | |
| | | public static final String TOP_IMG = "TOP_IMG"; |
| | | public static final String PK_IMG = "PK_IMG"; |
| | | public static final String RANGE_SIZE = "RANGE_SIZE"; |
| | | public static final String CATE_PARAM_OPEN = "_CATE_PARAM_OPEN"; |
| | | |
| | | |
| | | public static final String SYSTEM ="SYSTEM"; |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.doumee.dao.business.model.CateParamSelect; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author æ±è¹è¹ |
| | | * @date 2023/09/11 14:45 |
| | | */ |
| | | public interface CateParamSelectMapper extends BaseMapper<CateParamSelect> { |
| | | |
| | | void insertBatch(Integer companyId,Integer userId); |
| | | |
| | | } |
| | |
| | | package com.doumee.dao.business.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.doumee.core.annotation.excel.ExcelColumn; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | @ExcelColumn(name="å¤çç¶æ 0å¾
å¤ç 1å·²å¤ç") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "æµç¨") |
| | | @TableField(exist = false) |
| | | private String[] bgImgs; |
| | | |
| | | |
| | | } |
| | |
| | | package com.doumee.service; |
| | | |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.dao.business.model.CateParamSelect; |
| | |
| | | * @return long |
| | | */ |
| | | long count(CateParamSelect cateParamSelect); |
| | | |
| | | void dealCateParamSelect(); |
| | | } |
| | |
| | | */ |
| | | PageData<BaseGoods> findPage(PageWrap<BaseGoods> pageWrap); |
| | | |
| | | |
| | | |
| | | /** |
| | | * å
¬å¸æ¥è¯¢å¹³å°åå |
| | | * |
| | | * @param pageWrap å页对象 |
| | | * @return PageData<BaseGoods> |
| | | */ |
| | | PageData<BaseGoods> findCompanyPage(PageWrap<BaseGoods> pageWrap,Integer companyId); |
| | | |
| | | /** |
| | | * æ¡ä»¶ç»è®¡ |
| | | * |
| | |
| | | |
| | | @Override |
| | | public List<BaseCategory> findList(BaseCategory baseCategory) { |
| | | baseCategory.setIsdeleted(Constants.ZERO); |
| | | QueryWrapper<BaseCategory> wrapper = new QueryWrapper<>(baseCategory); |
| | | wrapper.eq("ISDELETED",Constants.ZERO); |
| | | wrapper.eq("STATUS",Constants.ZERO); |
| | | List<BaseCategory> list = baseCategoryMapper.selectList(wrapper); |
| | | list.forEach(i->{ |
| | | if(StringUtils.isNotBlank(i.getImgurl())){ |
| | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Isolation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | } |
| | | } |
| | | return PageData.from(baseDataMapper.selectPage(page, queryWrapper)); |
| | | IPage<BaseData> result =baseDataMapper.selectPage(page, queryWrapper); |
| | | if(result!=null && result.getRecords()!=null){ |
| | | for(BaseData data :result.getRecords()){ |
| | | //å¤å¾ï¼è±æéå·éå¼ |
| | | if(StringUtils.isNotBlank(data.getBgImg())){ |
| | | String tImg = data.getBgImg().replace("ï¼", ",").replace(".avif", ""); |
| | | String[] imgs =tImg.split(","); |
| | | data.setBgImgs(imgs); |
| | | |
| | | } |
| | | } |
| | | } |
| | | return PageData.from(result); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | public static boolean IS_RUNNING = false; |
| | | @Override |
| | | @Transactional |
| | | @Async |
| | | public void dealBaseData() { |
| | | if(IS_RUNNING){ |
| | | return; |
| | |
| | | OssModel ossModel = initOssModel(); |
| | | Date date = new Date(); |
| | | for(BaseData data : allLis){ |
| | | BaseGoods goods = new BaseGoods(); |
| | | goods.setBaseDataId(data.getId()); |
| | | goods.setIsdeleted(Constants.ZERO); |
| | | if(baseGoodsMapper.selectCount(new QueryWrapper<>(goods)) >0){ |
| | | //妿已ç»åå¨ï¼é»è¾å 餿§çååæ°æ® |
| | | UpdateWrapper<BaseGoods> updateModel = new UpdateWrapper<>(); |
| | | updateModel.lambda().set(BaseGoods::getIsdeleted,Constants.ONE); |
| | | updateModel.lambda().set(BaseGoods::getEditDate, new Date()); |
| | | updateModel.lambda().eq(BaseGoods::getBaseDataId, data.getId()); |
| | | baseGoodsMapper.update(null, updateModel); |
| | | } |
| | | goods.setCreateDate(date); |
| | | goods.setName(StringUtils.defaultString(data.getName(),data.getTitle())); |
| | | goods.setRemark(data.getTitle()); |
| | | goods.setContent(data.getTitle()); |
| | | goods.setStatus(Constants.ZERO); |
| | | goods.setShortPinyin(PinYinUtil.getFirstSpell(goods.getName())); |
| | | goods.setPinyin(PinYinUtil.getFullSpell(goods.getName())); |
| | | goods.setZdPrice(data.getPrice()); |
| | | //å¤çåçæ°æ® |
| | | Brand bModel = getBrandModelFromList(data.getBrand(),brandList); |
| | | if(bModel!= null){ |
| | | goods.setBrandId(bModel.getId()); |
| | | } |
| | | //å¤çåè¡¨æ°æ® |
| | | BaseCategory cModel = getCateModelFromList(rate,data.getCategory(),ossModel,data.getCategoryImg(), cateList); |
| | | if(cModel!= null){ |
| | | goods.setCategoryId(cModel.getId()); |
| | | } |
| | | goods.setImgurl(getOssImgurl(ossModel,ossModel.getGoodsFolder(), data.getImgurl())); |
| | | goods.setPrice(Constants.formatBigdecimal(data.getSaleprice()).multiply(Constants.formatBigdecimal(cModel.getPriceRate()))); |
| | | //æå
¥æ°ååæ°æ® |
| | | baseGoodsMapper.insert(goods); |
| | | //å¤çåç±»å±æ§ |
| | | dealCateParamAll(cModel.getId(),goods.getId(),data,paramList); |
| | | //å¤çèæ¯å¾ |
| | | dealBgImgAll(ossModel,goods.getId(),data); |
| | | |
| | | data.setEditDate(new Date()); |
| | | data.setStatus(Constants.ONE); |
| | | //æ´æ°æ°æ®å¤çç¶æ |
| | | baseDataMapper.updateById(data); |
| | | dealPerData(ossModel,rate,date,data,cateList,brandList,paramList); |
| | | } |
| | | log.info("å¼å§å¤çæºæ°æ®=================success================å¤çæ°æ®å
±ï¼"+allLis.size()+"ï¼ä¸ª==="); |
| | | }catch (Exception e){ |
| | |
| | | } |
| | | } |
| | | |
| | | @Transactional(isolation = Isolation.READ_UNCOMMITTED) |
| | | private void dealPerData(OssModel ossModel, BigDecimal rate, Date date, BaseData data, List<BaseCategory> cateList, List<Brand> brandList, List<BaseCateParam> paramList) { |
| | | BaseGoods goods = new BaseGoods(); |
| | | goods.setBaseDataId(data.getId()); |
| | | goods.setIsdeleted(Constants.ZERO); |
| | | //æ¥è¯¢æ¯å¦åå¨åå |
| | | BaseGoods model = baseGoodsMapper.selectOne(new QueryWrapper<>(goods).last(" limit 1")); |
| | | goods.setName(StringUtils.defaultString(data.getName(),data.getTitle())); |
| | | goods.setRemark(data.getTitle()); |
| | | goods.setContent(data.getTitle()); |
| | | goods.setStatus(Constants.ZERO); |
| | | goods.setShortPinyin(PinYinUtil.getFirstSpell(goods.getName())); |
| | | goods.setPinyin(PinYinUtil.getFullSpell(goods.getName())); |
| | | goods.setZdPrice(data.getPrice()); |
| | | //å¤çåçæ°æ® |
| | | Brand bModel = getBrandModelFromList(data.getBrand(),brandList); |
| | | if(bModel!= null){ |
| | | goods.setBrandId(bModel.getId()); |
| | | } |
| | | //å¤çåè¡¨æ°æ® |
| | | BaseCategory cModel = getCateModelFromList(rate,data.getCategory(),ossModel,data.getCategoryImg(), cateList); |
| | | if(cModel!= null){ |
| | | goods.setCategoryId(cModel.getId()); |
| | | } |
| | | goods.setImgurl(getOssImgurl(ossModel,ossModel.getGoodsFolder(), data.getImgurl())); |
| | | goods.setPrice(Constants.formatBigdecimal(data.getSaleprice()).multiply(Constants.formatBigdecimal(cModel.getPriceRate()))); |
| | | if(model!=null){ |
| | | //妿已ç»åå¨ï¼é»è¾å 餿§çååæ°æ® |
| | | // UpdateWrapper<BaseGoods> updateModel = new UpdateWrapper<>(); |
| | | // updateModel.lambda().set(BaseGoods::getIsdeleted,Constants.ONE); |
| | | // updateModel.lambda().set(BaseGoods::getEditDate, new Date()); |
| | | // updateModel.lambda().eq(BaseGoods::getBaseDataId, data.getId()); |
| | | // baseGoodsMapper.update(null, updateModel); |
| | | goods.setEditDate(date); |
| | | goods.setId(model.getId()); |
| | | baseGoodsMapper.updateById(goods); |
| | | //å é¤åæéä»¶å¤§å¾ |
| | | UpdateWrapper<Multifile> updateModel = new UpdateWrapper<>(); |
| | | updateModel.lambda().set(Multifile::getIsdeleted,Constants.ONE); |
| | | updateModel.lambda().set(Multifile::getEditDate, new Date()); |
| | | updateModel.lambda().eq(Multifile::getObjId, goods.getId()); |
| | | updateModel.lambda().eq(Multifile::getObjType, Constants.ZERO); |
| | | multifileMapper.delete(updateModel); |
| | | //å é¤åæåå屿§ |
| | | UpdateWrapper<BaseGoodsParam> bgModel = new UpdateWrapper<>(); |
| | | bgModel.lambda().set(BaseGoodsParam::getIsdeleted,Constants.ONE); |
| | | bgModel.lambda().set(BaseGoodsParam::getEditDate, new Date()); |
| | | bgModel.lambda().eq(BaseGoodsParam::getGoodsId, goods.getId()); |
| | | baseGoodsParamMapper.delete(bgModel); |
| | | }else{ |
| | | //æå
¥æ°ååæ°æ® |
| | | goods.setCreateDate(date); |
| | | baseGoodsMapper.insert(goods); |
| | | } |
| | | //å¤çåç±»å±æ§ |
| | | dealCateParamAll(cModel.getId(),goods.getId(),data,paramList); |
| | | //å¤çèæ¯å¾ |
| | | dealBgImgAll(ossModel,goods.getId(),data); |
| | | |
| | | data.setEditDate(new Date()); |
| | | data.setStatus(Constants.ONE); |
| | | //æ´æ°æ°æ®å¤çç¶æ |
| | | baseDataMapper.updateById(data); |
| | | } |
| | | |
| | | |
| | | private void dealBgImgAll(OssModel ossModel, Integer id, BaseData data) { |
| | | int i =0; |
| | | //å¤å¾ï¼è±æéå·éå¼ |
| | | if(StringUtils.isNotBlank(data.getBgImg())){ |
| | | String tImg = data.getBgImg().replace("ï¼", ","); |
| | | String tImg = data.getBgImg().replace("ï¼", ",").replace(".avif", ""); |
| | | String[] imgs =tImg.split(","); |
| | | for (int j = 0; j < imgs.length; j++) { |
| | | if(StringUtils.isNotBlank(imgs[j])){ |
| | |
| | | insert.setIsdeleted(Constants.ZERO); |
| | | insert.setRemark(baseGoods.getRemark()); |
| | | insert.setName(baseGoods.getName()); |
| | | insert.setStatus(Constants.ZERO); |
| | | //é»è®¤ä¸æ¶ |
| | | insert.setStatus(Constants.ONE); |
| | | insert.setSortnum(integer+Constants.ONE); |
| | | insert.setImgurl(baseGoods.getImgurl()); |
| | | insert.setCategoryId(baseGoods.getCategoryId()); |
| | |
| | | return pageData; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public PageData<BaseGoods> findCompanyPage(PageWrap<BaseGoods> pageWrap ,Integer companyId) { |
| | | |
| | | //æ¥è¯¢ä¼ä¸å·²ç»åå¨çåå |
| | | List<Integer> collect = new ArrayList<>(); |
| | | if(Objects.nonNull(companyId)){ |
| | | QueryWrapper<Goods> goodsQuery = new QueryWrapper<>(); |
| | | goodsQuery.lambda().eq(Goods::getIsdeleted,Constants.ZERO) |
| | | .eq(Goods::getCompanyId,companyId) |
| | | .isNotNull(Goods::getGoodsId); |
| | | List<Goods> goods = goodsMapper.selectList(goodsQuery); |
| | | if (CollectionUtils.isEmpty(goods)){ |
| | | collect = goods.stream().map(s -> s.getGoodsId()).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | |
| | | pageWrap.getModel().setIsdeleted(Constants.ZERO); |
| | | IPage<BaseGoods> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | MPJLambdaWrapper<BaseGoods> queryWrapper = new MPJLambdaWrapper<>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | queryWrapper.leftJoin(Brand.class,Brand::getId,BaseGoods::getBrandId) |
| | | .leftJoin(BaseCategory.class,BaseCategory::getId,BaseGoods::getCategoryId) |
| | | .selectAll(BaseGoods.class) |
| | | .selectAs(Brand::getName,BaseGoods::getBrandName) |
| | | .selectAs(BaseCategory::getName,BaseGoods::getCategoryName) |
| | | .eq(BaseGoods::getStatus, Constants.ZERO) |
| | | .eq(BaseGoods::getIsdeleted, Constants.ZERO) |
| | | .like(StringUtils.isNotBlank(pageWrap.getModel().getName()), BaseGoods::getName,pageWrap.getModel().getName()) |
| | | .like(pageWrap.getModel().getId()!=null,BaseGoods::getId, pageWrap.getModel().getId()) |
| | | .eq(pageWrap.getModel().getCategoryId()!=null,BaseGoods::getCategoryId, pageWrap.getModel().getCategoryId()) |
| | | .eq(pageWrap.getModel().getBrandId()!=null,BaseGoods::getBrandId, pageWrap.getModel().getBrandId()) |
| | | .eq(pageWrap.getModel().getStatus()!=null,BaseGoods::getStatus, pageWrap.getModel().getStatus()) |
| | | .notIn(!CollectionUtils.isEmpty(collect),BaseGoods::getId, collect); |
| | | |
| | | queryWrapper.orderByDesc(Goods::getId); |
| | | PageData<BaseGoods> pageData =PageData.from(baseGoodsJoinMapper.selectJoinPage(page,BaseGoods.class,queryWrapper)); |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode() |
| | | + systemDictDataBiz.queryByCode(Constants.OSS, Constants.GOODS_IMG).getCode(); |
| | | pageData.getRecords().forEach(i->{ |
| | | i.setFullImgUrl(prefixUrl + i.getImgurl()); |
| | | }); |
| | | return pageData; |
| | | } |
| | | |
| | | @Override |
| | | public long count(BaseGoods baseGoods) { |
| | | QueryWrapper<BaseGoods> wrapper = new QueryWrapper<>(baseGoods); |
| | |
| | | wrapper.lambda().eq(Brand::getType,Constants.ONE); |
| | | }else { |
| | | wrapper.lambda().and(i->i.eq(Brand::getCompanyId,user.getCompanyId()) |
| | | .or().eq(Brand::getType,Constants.ZERO) |
| | | .or().eq(Brand::getType,Constants.ONE) |
| | | ); |
| | | } |
| | | List<Brand> list = brandMapper.selectList(wrapper); |
| | |
| | | if (pageWrap.getModel().getStatus() != null) { |
| | | queryWrapper.lambda().eq(Brand::getStatus, pageWrap.getModel().getStatus()); |
| | | } |
| | | if (pageWrap.getModel().getType() != null) { |
| | | queryWrapper.lambda().eq(Brand::getType, pageWrap.getModel().getType()); |
| | | } |
| | | // ç±»å 0ä¼ä¸ 1å¹³å° |
| | | if (Objects.isNull(user.getCompanyId())) { |
| | | queryWrapper.lambda().eq(Brand::getType,Constants.ONE); |
| | |
| | | @Override |
| | | public void companyUpdateById(Category category) { |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(categoryMapper.selectCount(new QueryWrapper<Category>().eq("ISDELETED",Constants.ZERO).ne("id",category.getId()).eq("name",category.getName()))>0){ |
| | | if(categoryMapper.selectCount(new QueryWrapper<Category>().eq("ISDELETED",Constants.ZERO).eq("COMPANY_ID",user.getCompanyId()) |
| | | .ne("id",category.getId()).eq("name",category.getName()))>0){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"ã"+category.getName()+"ãå·²åå¨"); |
| | | }; |
| | | category.setStatus(Constants.ZERO); |
| | |
| | | |
| | | @Override |
| | | public List<Category> findListForGoods(Integer goodsId) { |
| | | LoginUserInfo loginUserInfo = (LoginUserInfo)SecurityUtils.getSubject().getPrincipal(); |
| | | QueryWrapper<Category> wrapper = new QueryWrapper<Category>() |
| | | .eq("STATUS",Constants.ZERO) |
| | | .eq("ISDELETED",Constants.ZERO) |
| | | .eq("COMPANY_ID",loginUserInfo.getCompanyId()) |
| | | .orderByAsc(" SORTNUM "); |
| | | List<Category> list = categoryMapper.selectList(wrapper); |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode() |
| | |
| | | if (pageWrap.getModel().getStatus() != null) { |
| | | queryWrapper.lambda().eq(Category::getStatus, pageWrap.getModel().getStatus()); |
| | | } |
| | | if (pageWrap.getModel().getType() != null) { |
| | | queryWrapper.lambda().eq(Category::getType, pageWrap.getModel().getType()); |
| | | } |
| | | if (pageWrap.getModel().getCompanyId() != null) { |
| | | queryWrapper.lambda().eq(Category::getCompanyId, pageWrap.getModel().getCompanyId()); |
| | | } |
| | |
| | | goodsParamMapper.insert(goodsParam); |
| | | |
| | | //åå¨ cate_param_select æ¥è¯¢æ¯å¦å·²åå¨ |
| | | if(cateParamSelectMapper.selectCount(new QueryWrapper<CateParamSelect>() |
| | | .eq("PARAM_ID",goodsParam.getPramaId()).eq("NAME",goodsParam.getName()))<=Constants.ZERO){ |
| | | CateParamSelect cateParamSelect = new CateParamSelect(); |
| | | cateParamSelect.setCreator(user.getId()); |
| | | cateParamSelect.setCreateDate(new Date()); |
| | | cateParamSelect.setName(goodsParam.getVal()); |
| | | cateParamSelect.setIsdeleted(Constants.ZERO); |
| | | cateParamSelect.setStatus(Constants.ZERO); |
| | | cateParamSelect.setParamId(goodsParam.getPramaId()); |
| | | cateParamSelect.setCategoryId(goods.getCategoryId()); |
| | | cateParamSelect.setStatus(Constants.ZERO); |
| | | cateParamSelectMapper.insert(cateParamSelect); |
| | | }; |
| | | // if(cateParamSelectMapper.selectCount(new QueryWrapper<CateParamSelect>() |
| | | // .eq("PARAM_ID",goodsParam.getPramaId()).eq("NAME",goodsParam.getName()))<=Constants.ZERO){ |
| | | // CateParamSelect cateParamSelect = new CateParamSelect(); |
| | | // cateParamSelect.setCreator(user.getId()); |
| | | // cateParamSelect.setCreateDate(new Date()); |
| | | // cateParamSelect.setName(goodsParam.getVal()); |
| | | // cateParamSelect.setIsdeleted(Constants.ZERO); |
| | | // cateParamSelect.setStatus(Constants.ZERO); |
| | | // cateParamSelect.setParamId(goodsParam.getPramaId()); |
| | | // cateParamSelect.setCategoryId(goods.getCategoryId()); |
| | | // cateParamSelect.setStatus(Constants.ZERO); |
| | | // cateParamSelectMapper.insert(cateParamSelect); |
| | | // }; |
| | | |
| | | } |
| | | } |
| | |
| | | goodsParam.setGoodsId(goods.getId()); |
| | | goodsParamMapper.insert(goodsParam); |
| | | //åå¨ cate_param_select æ¥è¯¢æ¯å¦å·²åå¨ |
| | | if(cateParamSelectMapper.selectCount(new QueryWrapper<CateParamSelect>() |
| | | .eq("PARAM_ID",goodsParam.getPramaId()).eq("NAME",goodsParam.getName()))<=Constants.ZERO){ |
| | | CateParamSelect cateParamSelect = new CateParamSelect(); |
| | | cateParamSelect.setCreator(user.getId()); |
| | | cateParamSelect.setCreateDate(new Date()); |
| | | cateParamSelect.setName(goodsParam.getVal()); |
| | | cateParamSelect.setIsdeleted(Constants.ZERO); |
| | | cateParamSelect.setStatus(Constants.ZERO); |
| | | cateParamSelect.setParamId(goodsParam.getPramaId()); |
| | | cateParamSelect.setCategoryId(goods.getCategoryId()); |
| | | cateParamSelect.setStatus(Constants.ZERO); |
| | | cateParamSelectMapper.insert(cateParamSelect); |
| | | }; |
| | | // if(cateParamSelectMapper.selectCount(new QueryWrapper<CateParamSelect>() |
| | | // .eq("PARAM_ID",goodsParam.getPramaId()).eq("NAME",goodsParam.getName()))<=Constants.ZERO){ |
| | | // CateParamSelect cateParamSelect = new CateParamSelect(); |
| | | // cateParamSelect.setCreator(user.getId()); |
| | | // cateParamSelect.setCreateDate(new Date()); |
| | | // cateParamSelect.setName(goodsParam.getVal()); |
| | | // cateParamSelect.setIsdeleted(Constants.ZERO); |
| | | // cateParamSelect.setStatus(Constants.ZERO); |
| | | // cateParamSelect.setParamId(goodsParam.getPramaId()); |
| | | // cateParamSelect.setCategoryId(goods.getCategoryId()); |
| | | // cateParamSelect.setStatus(Constants.ZERO); |
| | | // cateParamSelectMapper.insert(cateParamSelect); |
| | | // }; |
| | | } |
| | | } |
| | | return goods.getId(); |
| | |
| | | goods.setShortPinyin(PinYinUtil.getFirstSpell(goods.getName())); |
| | | goodsMapper.updateById(goods); |
| | | |
| | | multifileMapper.delete(new QueryWrapper<Multifile>().eq("OBJ_ID",goods.getId())); |
| | | multifileMapper.delete(new QueryWrapper<Multifile>().eq("OBJ_ID",goods.getId()) |
| | | .eq("OBJ_TYPE",0).eq("COMPANY_ID",user.getCompanyId())); |
| | | List<Multifile> multifileList = goods.getMultifileList(); |
| | | if(!Objects.isNull(multifileList)&&multifileList.size()>Constants.ZERO){ |
| | | for (int i = 0; i < multifileList.size(); i++) { |
| | |
| | | goodsParam.setGoodsId(goods.getId()); |
| | | goodsParamMapper.insert(goodsParam); |
| | | //åå¨ cate_param_select æ¥è¯¢æ¯å¦å·²åå¨ |
| | | if(cateParamSelectMapper.selectCount(new QueryWrapper<CateParamSelect>() |
| | | .eq("PARAM_ID",goodsParam.getPramaId()).eq("NAME",goodsParam.getName()))<=Constants.ZERO){ |
| | | CateParamSelect cateParamSelect = new CateParamSelect(); |
| | | cateParamSelect.setCreator(user.getId()); |
| | | cateParamSelect.setCreateDate(new Date()); |
| | | cateParamSelect.setName(goodsParam.getVal()); |
| | | cateParamSelect.setIsdeleted(Constants.ZERO); |
| | | cateParamSelect.setStatus(Constants.ZERO); |
| | | cateParamSelect.setParamId(goodsParam.getPramaId()); |
| | | cateParamSelect.setCategoryId(goods.getCategoryId()); |
| | | cateParamSelect.setStatus(Constants.ZERO); |
| | | cateParamSelectMapper.insert(cateParamSelect); |
| | | }; |
| | | // if(cateParamSelectMapper.selectCount(new QueryWrapper<CateParamSelect>() |
| | | // .eq("PARAM_ID",goodsParam.getPramaId()).eq("NAME",goodsParam.getName()))<=Constants.ZERO){ |
| | | // CateParamSelect cateParamSelect = new CateParamSelect(); |
| | | // cateParamSelect.setCreator(user.getId()); |
| | | // cateParamSelect.setCreateDate(new Date()); |
| | | // cateParamSelect.setName(goodsParam.getVal()); |
| | | // cateParamSelect.setIsdeleted(Constants.ZERO); |
| | | // cateParamSelect.setStatus(Constants.ZERO); |
| | | // cateParamSelect.setParamId(goodsParam.getPramaId()); |
| | | // cateParamSelect.setCategoryId(goods.getCategoryId()); |
| | | // cateParamSelect.setStatus(Constants.ZERO); |
| | | // cateParamSelectMapper.insert(cateParamSelect); |
| | | // }; |
| | | } |
| | | } |
| | | } |
| | |
| | | if (pageWrap.getModel().getStatus() != null) { |
| | | queryWrapper.eq(Goods::getStatus, pageWrap.getModel().getStatus()); |
| | | } |
| | | |
| | | if (pageWrap.getModel().getType() != null) { |
| | | queryWrapper.eq(Goods::getType, pageWrap.getModel().getType()); |
| | | } |
| | | if (pageWrap.getModel().getCategoryId() != null) { |
| | | queryWrapper.eq(Goods::getCategoryId, pageWrap.getModel().getCategoryId()); |
| | | } |
| | |
| | | + systemDictDataBiz.queryByCode(Constants.OSS, Constants.GOODS_IMG).getCode(); |
| | | goodsIPage.getRecords().forEach(i->{ |
| | | i.setPrefixUrl(prefixUrl); |
| | | if(i.getType().equals(Constants.ONE)){ |
| | | i.setBasePrice(i.getBasePrice().multiply(i.getBasePriceRate())); |
| | | } |
| | | |
| | | }); |
| | | return PageData.from(goodsIPage); |
| | | } |
| | |
| | | //æå
¥äº§ååæ°å
³è表 |
| | | goodsParamMapper.insert(gp); |
| | | //åå¨ cate_param_select æ¥è¯¢æ¯å¦å·²åå¨ |
| | | if(cateParamSelectMapper.selectCount(new QueryWrapper<CateParamSelect>() |
| | | .eq("PARAM_ID",gp.getPramaId()).eq("NAME",gp.getName()))<=Constants.ZERO){ |
| | | CateParamSelect cateParamSelect = new CateParamSelect(); |
| | | cateParamSelect.setCreator(user.getId()); |
| | | cateParamSelect.setCreateDate(new Date()); |
| | | cateParamSelect.setName(gp.getVal()); |
| | | cateParamSelect.setIsdeleted(Constants.ZERO); |
| | | cateParamSelect.setStatus(Constants.ZERO); |
| | | cateParamSelect.setParamId(gp.getPramaId()); |
| | | cateParamSelect.setCategoryId(newModel.getCategoryId()); |
| | | cateParamSelect.setStatus(Constants.ZERO); |
| | | cateParamSelectMapper.insert(cateParamSelect); |
| | | }; |
| | | // if(cateParamSelectMapper.selectCount(new QueryWrapper<CateParamSelect>() |
| | | // .eq("PARAM_ID",gp.getPramaId()).eq("NAME",gp.getName()))<=Constants.ZERO){ |
| | | // CateParamSelect cateParamSelect = new CateParamSelect(); |
| | | // cateParamSelect.setCreator(user.getId()); |
| | | // cateParamSelect.setCreateDate(new Date()); |
| | | // cateParamSelect.setName(gp.getVal()); |
| | | // cateParamSelect.setIsdeleted(Constants.ZERO); |
| | | // cateParamSelect.setStatus(Constants.ZERO); |
| | | // cateParamSelect.setParamId(gp.getPramaId()); |
| | | // cateParamSelect.setCategoryId(newModel.getCategoryId()); |
| | | // cateParamSelect.setStatus(Constants.ZERO); |
| | | // cateParamSelectMapper.insert(cateParamSelect); |
| | | // }; |
| | | } |
| | | } |
| | | if(mulFiles !=null && mulFiles.size()>0){ |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.CateParamSelectMapper; |
| | | import com.doumee.dao.business.model.CateParamSelect; |
| | | import com.doumee.service.CateParamSelectService; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | |
| | | */ |
| | | @Service |
| | | public class CateParamSelectServiceImpl implements CateParamSelectService { |
| | | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Autowired |
| | | private CateParamSelectMapper cateParamSelectMapper; |
| | |
| | | QueryWrapper<CateParamSelect> wrapper = new QueryWrapper<>(cateParamSelect); |
| | | return cateParamSelectMapper.selectCount(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Async |
| | | public void dealCateParamSelect() { |
| | | LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | Boolean isGrouping = (Boolean)redisTemplate.opsForValue().get(loginUserInfo.getCompanyId()+Constants.CATE_PARAM_OPEN); |
| | | if(isGrouping!=null && isGrouping ){ |
| | | return; |
| | | } |
| | | redisTemplate.opsForValue().set(loginUserInfo.getCompanyId()+Constants.CATE_PARAM_OPEN,true); |
| | | try { |
| | | //å é¤ä¼ä¸ä¸å岿°æ® |
| | | cateParamSelectMapper.delete(new QueryWrapper<CateParamSelect>().exists(" select 1 from category c where c.id = cate_param_select.category_id and c.company_id = "+loginUserInfo.getCompanyId()+" ")); |
| | | //æ°å¢å½åä¼ä¸å¯ä»¥ä½¿ç¨çæ°æ® |
| | | cateParamSelectMapper.insertBatch(loginUserInfo.getCompanyId(),loginUserInfo.getId()); |
| | | }catch (Exception e){ |
| | | |
| | | }finally { |
| | | redisTemplate.opsForValue().set(loginUserInfo.getCompanyId()+Constants.CATE_PARAM_OPEN,false); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.doumee.service.system.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.api.R; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.Date; |
| | | import java.util.Objects; |
| | | |
| | | @Slf4j |
| | | @Service |
| | |
| | | loginLog.setReason(e.getMessage().length() > 200 ? (e.getMessage().substring(0, 190) + "...") : e.getMessage()); |
| | | loginLog.setSuccess(Boolean.FALSE); |
| | | systemLoginLogService.create(loginLog); |
| | | throw new BusinessException(ResponseStatus.ACCOUNT_INCORRECT); |
| | | throw new BusinessException(ResponseStatus.ACCOUNT_INCORRECT.getCode(), Objects.isNull(e.getCause())?ResponseStatus.ACCOUNT_INCORRECT.getMessage():e.getCause().getMessage()); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.doumee.dao.business.CateParamSelectMapper"> |
| | | |
| | | |
| | | <insert id="insertBatch" > |
| | | INSERT INTO `cate_param_select` |
| | | (`CREATOR`, `CREATE_DATE`, `EDITOR`, `EDIT_DATE`, `ISDELETED`, `REMARK`, `NAME`, `PARAM_ID`, `CATEGORY_ID`, |
| | | `STATUS`, `SORTNUM`) |
| | | select #{userId} , now(),null , null , 0 , null , a.VAL , a.PRAMA_ID , b.CATEGORY_ID , 0 , null from goods_param a inner join goods b on a.GOODS_ID = b.ID |
| | | and a.PRAMA_ID is not null AND a.VAL is not null |
| | | and a.ISDELETED = 0 |
| | | and a.`STATUS` = 0 |
| | | and b.`STATUS` = 0 |
| | | and b.ISDELETED = 0 |
| | | AND b.company_id = #{companyId} |
| | | </insert> |
| | | |
| | | </mapper> |