Browse Source

Merge branch 'master' of http://192.168.1.220:10080/Amoy2/guns-separation

兵兵 4 năm trước cách đây
mục cha
commit
ebd7f37ae1
45 tập tin đã thay đổi với 1933 bổ sung248 xóa
  1. 1 1
      _web/.env
  2. 2 2
      _web/.env.development
  3. 24 15
      _web/src/api/homeApi.js
  4. 56 29
      _web/src/components/upLoad.vue
  5. 1 1
      _web/src/utils/img.js
  6. 51 32
      _web/src/views/homeManager/addBannerForm.vue
  7. 32 23
      _web/src/views/homeManager/addCompanyCaseForm.vue
  8. 7 10
      _web/src/views/homeManager/addPartnerForm.vue
  9. 62 36
      _web/src/views/homeManager/editBannerForm.vue
  10. 270 0
      _web/src/views/homeManager/editCompanyCaseForm.vue
  11. 175 0
      _web/src/views/homeManager/editPartnerForm.vue
  12. 24 14
      _web/src/views/homeManager/indexBanner.vue
  13. 47 28
      _web/src/views/homeManager/indexCompanyCase.vue
  14. 33 21
      _web/src/views/homeManager/indexPartner.vue
  15. 8 0
      guns-main/pom.xml
  16. 6 0
      guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/GcFileUploadController.java
  17. 110 0
      guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/ZjxlArticleContentController.java
  18. 112 8
      guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/ZjxlBannerCnotroller.java
  19. 19 0
      guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/ZjxlBasicInfoController.java
  20. 95 3
      guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/ZjxlCompanyCaseController.java
  21. 51 0
      guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/ZjxlNewsCenterController.java
  22. 48 0
      guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/ZjxlPartnerController.java
  23. 28 0
      guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/ZjxlSystemDictController.java
  24. 4 0
      guns-main/src/main/java/cn/stylefeng/guns/zjxl/dao/ZjxlBasicInfoDao.java
  25. 17 0
      guns-main/src/main/java/cn/stylefeng/guns/zjxl/dao/ZjxlNewsCenterDao.java
  26. 18 0
      guns-main/src/main/java/cn/stylefeng/guns/zjxl/model/ZjxlArticleContent.java
  27. 10 0
      guns-main/src/main/java/cn/stylefeng/guns/zjxl/model/ZjxlBanner.java
  28. 9 0
      guns-main/src/main/java/cn/stylefeng/guns/zjxl/model/ZjxlBasicInfo.java
  29. 16 6
      guns-main/src/main/java/cn/stylefeng/guns/zjxl/model/ZjxlCompanyCase.java
  30. 89 0
      guns-main/src/main/java/cn/stylefeng/guns/zjxl/model/ZjxlNewsCenter.java
  31. 9 0
      guns-main/src/main/java/cn/stylefeng/guns/zjxl/model/ZjxlPartner.java
  32. 9 0
      guns-main/src/main/java/cn/stylefeng/guns/zjxl/model/ZjxlSystemDict.java
  33. 70 1
      guns-main/src/main/java/cn/stylefeng/guns/zjxl/service/ZjxlArticleContentService.java
  34. 43 1
      guns-main/src/main/java/cn/stylefeng/guns/zjxl/service/ZjxlBannerService.java
  35. 5 0
      guns-main/src/main/java/cn/stylefeng/guns/zjxl/service/ZjxlBasicInfoService.java
  36. 38 2
      guns-main/src/main/java/cn/stylefeng/guns/zjxl/service/ZjxlCompanyCaseService.java
  37. 47 0
      guns-main/src/main/java/cn/stylefeng/guns/zjxl/service/ZjxlNewsCenterService.java
  38. 26 1
      guns-main/src/main/java/cn/stylefeng/guns/zjxl/service/ZjxlPartnerService.java
  39. 26 1
      guns-main/src/main/java/cn/stylefeng/guns/zjxl/service/ZjxlSystemDictService.java
  40. 150 0
      guns-main/src/main/java/cn/stylefeng/guns/zjxlUtil/DesUtil.java
  41. 68 9
      guns-main/src/main/java/cn/stylefeng/guns/zjxlUtil/FastDFSClientPool.java
  42. 4 1
      guns-main/src/main/java/cn/stylefeng/guns/zjxlUtil/FastDFSUtil.java
  43. 4 1
      guns-main/src/main/resources/application-dev.yml
  44. 5 1
      guns-main/src/main/resources/application-prod.yml
  45. 4 1
      guns-main/src/main/resources/application-test.yml

+ 1 - 1
_web/.env

@ -2,4 +2,4 @@ NODE_ENV=production
VUE_APP_PREVIEW=true
VUE_APP_API_BASE_URL=http://127.0.0.1:82
VUE_APP_IMG_UPLOAD_URL=http://120.41.253.95:3000
imgServer=http://www.xmtyw.cn/
VUE_APP_IMG_SERVICE_URL=http://www.xmtyw.cn/

+ 2 - 2
_web/.env.development

@ -1,5 +1,5 @@
NODE_ENV=development
VUE_APP_PREVIEW=true
VUE_APP_API_BASE_URL=http://172.26.0.30:8080/
VUE_APP_API_BASE_URL=http://172.26.0.30:8080
VUE_APP_IMG_UPLOAD_URL=http://120.41.253.95:3000
imgServer=http://172.26.0.110:8888/
VUE_APP_IMG_SERVICE_URL=http://172.26.0.110:8888/

+ 24 - 15
_web/src/api/homeApi.js

@ -1,4 +1,5 @@
import { axios } from '@/utils/request'
import Qs from 'qs'
const homeApi = {
  // 查看banner(列表)
@ -14,15 +15,15 @@ const homeApi = {
    return axios({
      url: '/zjxl/banner/addBanner',
      method: 'post',
      data: data
      data: Qs.stringify(data)
    })
  },
  // 更新banner
  updateBanner (data) {
    return axios({
      url: '/zjxl/banner/updateBanner',
      url: '/zjxl/banner/updataBanner',
      method: 'post',
      data: data
      data: Qs.stringify(data)
    })
  },
  // 修改banner上下线状态
@ -30,7 +31,7 @@ const homeApi = {
    return axios({
      url: '/zjxl/banner/updateIsLine',
      method: 'post',
      data: data
      data: Qs.stringify(data)
    })
  },
  // 删除banner
@ -38,7 +39,7 @@ const homeApi = {
    return axios({
      url: '/zjxl/banner/deleteBannerById',
      method: 'post',
      data: data
      data: Qs.stringify(data)
    })
  },
  // 添加公司案例
@ -46,7 +47,7 @@ const homeApi = {
    return axios({
      url: '/zjxl/CompanyCase/addCompanyCase',
      method: 'post',
      data: data
      data: Qs.stringify(data)
    })
  },
  // 更新公司案例
@ -54,7 +55,7 @@ const homeApi = {
    return axios({
      url: '/zjxl/CompanyCase/updateCompanyCase',
      method: 'post',
      data: data
      data: Qs.stringify(data)
    })
  },
  // 查看公司案例(列表)
@ -70,7 +71,7 @@ const homeApi = {
    return axios({
      url: '/zjxl/CompanyCase/updateIsLine',
      method: 'post',
      data: data
      data: Qs.stringify(data)
    })
  },
  // 删除公司案例
@ -78,7 +79,7 @@ const homeApi = {
    return axios({
      url: '/zjxl/CompanyCase/deleteCompanyCase',
      method: 'post',
      data: data
      data: Qs.stringify(data)
    })
  },
  // 添加合作伙伴
@ -86,7 +87,7 @@ const homeApi = {
    return axios({
      url: '/zjxl/partner/addPartenr',
      method: 'post',
      data: data
      data: Qs.stringify(data)
    })
  },
  // 查看合作伙伴(列表)
@ -102,7 +103,7 @@ const homeApi = {
    return axios({
      url: '/zjxl/partner/updatePartner',
      method: 'post',
      data: data
      data: Qs.stringify(data)
    })
  },
  // 修改合作伙伴上下线状态
@ -110,7 +111,7 @@ const homeApi = {
    return axios({
      url: '/zjxl/partner/updateIsLine',
      method: 'post',
      data: data
      data: Qs.stringify(data)
    })
  },
  // 删除合作伙伴
@ -118,10 +119,10 @@ const homeApi = {
    return axios({
      url: '/zjxl/partner/deletePartner',
      method: 'post',
      data: data
      data: Qs.stringify(data)
    })
  },
  // 获取文章列表
  // 获取文章列表(分页)
  findArticleContentById (parameter) {
    return axios({
      url: '/zjxl/zjxlArticleContent/findArticleContentById',
@ -129,13 +130,21 @@ const homeApi = {
      params: parameter
    })
  },
  // 获取文章列表(不分页)
  findArticleAll (parameter) {
    return axios({
      url: '/zjxl/zjxlArticleContent/findArticleAll',
      method: 'get',
      params: parameter
    })
  },
  // 文件上传
  fileUpload (data, token) {
    return axios({
      url: '/zjxl/banner/file',
      method: 'post',
      headers: {
        'Authorization': token
        // 'Authorization': token
      },
      data: data
    })

+ 56 - 29
_web/src/components/upLoad.vue

@ -2,15 +2,16 @@
  <div>
    <div class="flex flex-wrap">
      <a-upload
        class="flex f_wrap"
        :action="UploadUrl()"
        list-type="picture-card"
        :file-list="fileList"
        @preview="handlePreview"
        :before-upload="beforeUpload"
        @change="handleChange"
        :headers="headers"
        :customRequest="fileUpload"
        :remove="handleFileRemove"
      >
        <div v-if="fileList.length < fileListLength">
        <div v-if="fileList.length < fileListLength" >
          <a-icon type="plus" />
        </div>
      </a-upload>
@ -18,23 +19,18 @@
        {{ remarkTxt }}
      </div>
    </div>
    <a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel">
    <a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel" title="预览">
      <img alt="example" style="width: 100%" :src="previewImage" />
    </a-modal>
  </div>
</template>
<script>
// import homeApi from '@/api/homeApi'
import homeApi from '@/api/homeApi'
import { setImgUrl } from '@/utils/img'
import { setTimeout } from 'timers'
const _ = require('lodash')
function getBase64 (file) {
  return new Promise((resolve, reject) => {
    const reader = new FileReader()
    reader.readAsDataURL(file)
    reader.onload = () => resolve(reader.result)
    reader.onerror = error => reject(error)
  })
}
export default {
  props: {
    remarkTxt: {
@ -61,8 +57,15 @@ export default {
    initData (imglist) {
      if (imglist && imglist.length) {
        this.fileList = imglist.map((item, index) => {
          return { url: setImgUrl(item) }
          return {
            uid: '-' + (index + 1),
            name: 'image.png',
            status: 'done',
            url: setImgUrl(item)
          }
        })
      } else {
        this.fileList = []
      }
    },
    UploadUrl () {
@ -70,27 +73,45 @@ export default {
         process.env.VUE_APP_API_BASE_URL + '/zjxl/banner/file'
      )
    },
    fileUpload (file) {
      const formData = new FormData()
      formData.append('file', file.file)
      homeApi.fileUpload(formData).then(res => {
        if (res.status === 10000) {
          var length = this.fileList.length
          const citem = {
            uid: '-' + (length + 1),
            name: res.result.fileName,
            status: 'done',
            uri: res.result.fullUri,
            url: res.result.fullUrl
          }
          this.fileList.push(citem)
          this.$emit('uploadSuccess', { fileList: this.fileList })
        } else {
          this.$message.error(res.message)
        }
      })
    },
    handleChange ({ file, fileList }) {
      // this.handleAvatarSuccess (file)
      this.fileList = fileList
      // this.$emit('uploadSuccess', { fileList: this.fileList })
      setTimeout(() => {
        this.fileList = []
        fileList.forEach((item) => {
          if (item.response.status === 10000) {
            const citem = item.response.result
            citem.url = citem.fullUrl
            this.fileList.push(citem)
          } else {
            this.$message.error(item.message)
          }
        })
        this.$emit('uploadSuccess', { fileList: this.fileList })
      }, 3000)
    },
    async handlePreview (file) {
      if (!file.url && !file.preview) {
        file.preview = await getBase64(file.originFileObj)
      }
      this.previewImage = file.url || file.preview
      this.previewVisible = true
    },
    handleAvatarSuccess (res) {
      if (res.status === 200) {
        var imageUrl = process.env.imgServer + res.data
        this.currentImage = imageUrl
        this.$emit('imageUrlGet', res.data)
      } else {
        this.$message.error(res.msg)
      }
    },
    beforeUpload (file) {
      var $uptypes = ['image/jpg', 'image/png', 'image/jpeg']
      const isJPG = $uptypes.indexOf(file.type) > -1
@ -106,6 +127,12 @@ export default {
    },
    handleCancel () {
      this.previewVisible = false
    },
    handleFileRemove (file) {
      const hasIndex = _.indexOf(this.fileList, file)
      if (hasIndex > -1) {
        this.fileList.splice(hasIndex, 1)
      }
    }
  }
}

+ 1 - 1
_web/src/utils/img.js

@ -1,6 +1,6 @@
const imgUrlDomain = process.env.imgServer
const imgUploadUrl = process.env.VUE_APP_IMG_UPLOAD_URL
const imgUrlDomain = process.env.VUE_APP_IMG_SERVICE_URL
// 头像图片路径通配
export function setImgUrl (str) {

+ 51 - 32
_web/src/views/homeManager/addBannerForm.vue

@ -19,15 +19,15 @@
          />
        </a-form-item>
        <a-form-item label="跳转方式" :labelCol="labelCol" :wrapperCol="wrapperCol" :required="true">
          <a-radio-group name="bannerType" v-decorator="['bannerType', { initialValue: 1 }]">
            <a-radio :value="1">无</a-radio>
            <a-radio :value="2">站内文章</a-radio>
            <a-radio :value="3">外部链接</a-radio>
          <a-radio-group name="bannerType" v-decorator="['bannerType', { initialValue: 0 }]" @change="changeType">
            <a-radio :value="0">无</a-radio>
            <a-radio :value="1">站内文章</a-radio>
            <a-radio :value="2">外部链接</a-radio>
          </a-radio-group>
        </a-form-item>
        <a-form-item
          :required="true"
          v-if="bannerType==2"
          v-show="bannerType==1"
          label="选择文章"
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
@ -36,18 +36,18 @@
          <a-select
            style="width: 100%"
            placeholder="请选择文章"
            v-decorator="['bannerTypeUrl', {rules: [{ required: true, message: '请选择文章!' }]}]"
            v-decorator="['bannerTypeUrl', {rules: [{validator: checkUrl}]}]"
          >
            <a-select-option
              v-for="(item,index) in actionClassData"
              :key="index"
              :value="item"
            >{{ item }}</a-select-option>
              :value="item.articleContentId"
            >{{ item.articleContentTitle }}</a-select-option>
          </a-select>
        </a-form-item>
        <a-form-item
          :required="true"
          v-if="bannerType==3"
          v-show="bannerType==2"
          label="跳转链接Url"
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
@ -123,7 +123,7 @@ export default {
      visible: false,
      confirmLoading: false,
      actionClassData: [],
      bannerType: 3,
      bannerType: 0,
      formLoading: false,
      form: this.$form.createForm(this),
      remarkTxt: '请上传1920×712规格图像'
@ -135,20 +135,23 @@ export default {
    // 初始化方法
    add (record) {
      this.visible = true
      // this.formLoading = true
      // this.getActionClass()
      this.$nextTick(() => {
        this.$refs.upLoadRef.initData()
      })
      this.formLoading = true
      this.getActionClass()
    },
    /**
     * 获取选择器下拉框数据
     */
    getActionClass () {
      homeApi.findArticleContentById().then(res => {
      homeApi.findArticleAll().then(res => {
        this.formLoading = false
        if (res.success) {
        if (res.status === 200) {
          this.actionClassData = res.data
        } else {
          this.$message.error('获取选择器下拉框数据')
          this.$message.error('获取文章列表数据失败')
        }
      })
    },
@ -161,7 +164,6 @@ export default {
      validateFields((errors, values) => {
        if (!errors) {
          values.bannerSort = parseInt(values.bannerSort)
          values.bannerImage = 'group1/M00/00/4C/rBoAbl-iDrOAdZTxAAk_Z73wLB8030.jpg'
          homeApi.addBanner(values)
            .then(res => {
              if (res.status === 200) {
@ -187,33 +189,50 @@ export default {
      this.visible = false
    },
    changeType (val) {
      this.bannerType = this.form.getFieldValue('bannerType')
      this.$nextTick(() => {
        this.bannerType = this.form.getFieldValue('bannerType')
        this.form.resetFields('bannerTypeUrl')
        if (this.bannerType === 2) {
          this.form.setFieldsValue({ 'bannerTypeUrl': 'http://' })
        } else {
          this.form.setFieldsValue({ 'bannerTypeUrl': '' })
        }
      })
    },
    uploadSuccess (avg) {
      if (avg.fileList[0]) {
        this.form.setFieldsValue({ 'bannerImage': avg.fileList[0].name })
        this.form.resetFields('bannerImage')
        this.form.setFieldsValue({ 'bannerImage': avg.fileList[0].uri })
      }
    },
    checkimageUrl (rule, value, callback) {
      callback()
      // return false
      // if (value && value.length > 0) {
      //   callback()
      //   return
      // }
      // var text = '请上传图片'
      // callback(text)
      if (value && value.length > 0) {
        callback()
        return
      }
      var text = '请上传图片'
      callback(text)
    },
    checkUrl (rule, value, callback) {
      var text = '请输入跳转链接!'
      if (!value) {
        callback(text)
      } else if (checkUrl(value)) {
        callback()
      if (this.bannerType === 1) {
        text = '请选择文章!'
        if (!value) {
          callback(text)
        } else {
          callback()
        }
      } else if (this.bannerType === 2) {
        if (!value) {
          callback(text)
        } else if (checkUrl(value)) {
          callback()
        } else {
          text = '请输入正确的url地址'
          callback(text)
        }
      } else {
        text = '请输入正确的url地址'
        callback(text)
        callback()
      }
    },
    checkSortIndex (rule, value, callback) {

+ 32 - 23
_web/src/views/homeManager/addCompanyCaseForm.vue

@ -24,9 +24,9 @@
          :wrapperCol="wrapperCol"
          has-feedback
        >
          <a-textarea :rows="4" :maxLength="30" placeholder="请输入描述" v-decorator="['companyDescribe']">
            <div slot="suffix">ddd</div>
          <a-textarea :rows="4" :maxLength="30" placeholder="请输入描述" @input="companyDescribeInput" v-decorator="['companyDescribe', {rules: [{required: true, message: '请输入描述!'}]}]">
          </a-textarea>
          <div class="companyDescribeCount">({{ companyDescribe.length }}/30)</div>
        </a-form-item>
        <a-form-item
          :required="true"
@ -43,8 +43,8 @@
            <a-select-option
              v-for="(item,index) in actionClassData"
              :key="index"
              :value="item"
            >{{ item }}</a-select-option>
              :value="item.articleContentId"
            >{{ item.articleContentTitle }}</a-select-option>
          </a-select>
        </a-form-item>
        <a-form-item
@ -133,7 +133,7 @@ export default {
      visible: false,
      confirmLoading: false,
      actionClassData: [],
      bannerType: 3,
      companyDescribe: '',
      formLoading: false,
      form: this.$form.createForm(this),
      remarkTxt: '请上传320×400规格图像'
@ -145,24 +145,28 @@ export default {
    // 初始化方法
    add (record) {
      this.visible = true
      // this.formLoading = true
      // this.getActionClass()
      this.formLoading = true
      this.getActionClass()
    },
    /**
     * 获取选择器下拉框数据
     */
    getActionClass () {
      homeApi.findArticleContentById().then(res => {
      homeApi.findArticleAll().then((res) => {
        this.formLoading = false
        if (res.success) {
        if (res.status === 200) {
          this.actionClassData = res.data
        } else {
          this.$message.error('获取选择器下拉框数据')
          this.$message.error('获取文章列表数据失败')
        }
      })
    },
    companyDescribeInput () {
      this.$nextTick(() => {
        this.companyDescribe = this.form.getFieldValue('companyDescribe')
      })
    },
    handleSubmit () {
      const {
        form: { validateFields }
@ -171,8 +175,7 @@ export default {
      validateFields((errors, values) => {
        if (!errors) {
          values.companySort = parseInt(values.companySort)
          values.companyDefaultImg = 'group1/M00/00/4C/rBoAbl-iDrOAdZTxAAk_Z73wLB8030.jpg'
          values.companyExchangeImg = 'group1/M00/00/4C/rBoAbl-iDrOAdZTxAAk_Z73wLB8030.jpg'
          values.companyJumpUrl = values.companyAssociatedCase
          homeApi.addCompanyCase(values)
            .then(res => {
              if (res.status === 200) {
@ -199,25 +202,23 @@ export default {
    },
    uploadSuccessDefault (avg) {
      if (avg.fileList[0]) {
        this.form.setFieldsValue({ 'companyDefaultImg': avg.fileList[0].name })
        this.form.resetFields('companyDefaultImg')
        this.form.setFieldsValue({ 'companyDefaultImg': avg.fileList[0].uri })
      }
    },
    uploadSuccessExchange (avg) {
      if (avg.fileList[0]) {
        this.form.setFieldsValue({ 'companyExchangeImg': avg.fileList[0].name })
        this.form.resetFields('companyExchangeImg')
        this.form.setFieldsValue({ 'companyExchangeImg': avg.fileList[0].uri })
      }
    },
    checkimageUrl (rule, value, callback) {
      callback()
      // return false
      // if (value && value.length > 0) {
      //   callback()
      //   return
      // }
      // var text = '请上传图片'
      // callback(text)
      if (value && value.length > 0) {
        callback()
        return
      }
      var text = '请上传图片'
      callback(text)
    },
    checkSortIndex (rule, value, callback) {
      var text = '请输入排序号!'
@ -233,3 +234,11 @@ export default {
  }
}
</script>
<style lang="less">
  .companyDescribeCount{
    position: absolute;
    right: 30px;
    bottom: -10px;
    color: #999;
  }
</style>

+ 7 - 10
_web/src/views/homeManager/addPartnerForm.vue

@ -102,7 +102,6 @@ export default {
      validateFields((errors, values) => {
        if (!errors) {
          values.partnerSort = parseInt(values.partnerSort)
          values.partnerImg = 'group1/M00/00/4C/rBoAbl-iDrOAdZTxAAk_Z73wLB8030.jpg'
          homeApi.addPartenr(values)
            .then(res => {
              if (res.status === 200) {
@ -129,19 +128,17 @@ export default {
    },
    uploadSuccess (avg) {
      if (avg.fileList[0]) {
        this.form.setFieldsValue({ 'partnerImg': avg.fileList[0].name })
        this.form.resetFields('partnerImg')
        this.form.setFieldsValue({ 'partnerImg': avg.fileList[0].uri })
      }
    },
    checkimageUrl (rule, value, callback) {
      callback()
      // return false
      // if (value && value.length > 0) {
      //   callback()
      //   return
      // }
      // var text = '请上传图片'
      // callback(text)
      if (value && value.length > 0) {
        callback()
        return
      }
      var text = '请上传图片'
      callback(text)
    },
    checkSortIndex (rule, value, callback) {
      var text = '请输入排序号!'

+ 62 - 36
_web/src/views/homeManager/editBannerForm.vue

@ -1,6 +1,6 @@
<template>
  <a-modal
    title="编辑定时任务"
    title="编辑banner"
    :width="900"
    :visible="visible"
    :confirmLoading="confirmLoading"
@ -12,7 +12,7 @@
        <a-form-item
          style="display: none;"
        >
          <a-input v-decorator="['id']" />
          <a-input v-decorator="['bannerId']" />
        </a-form-item>
        <a-form-item label="名称" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input
@ -21,15 +21,15 @@
          />
        </a-form-item>
        <a-form-item label="跳转方式" :labelCol="labelCol" :wrapperCol="wrapperCol" :required="true">
          <a-radio-group name="bannerType" v-decorator="['bannerType', { initialValue: 1 }]">
            <a-radio :value="1">无</a-radio>
            <a-radio :value="2">站内文章</a-radio>
            <a-radio :value="3">外部链接</a-radio>
          <a-radio-group name="bannerType" v-decorator="['bannerType']" @change="changeType">
            <a-radio :value="0">无</a-radio>
            <a-radio :value="1">站内文章</a-radio>
            <a-radio :value="2">外部链接</a-radio>
          </a-radio-group>
        </a-form-item>
        <a-form-item
          :required="true"
          v-if="bannerType==2"
          v-show="bannerType==1"
          label="选择文章"
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
@ -38,18 +38,18 @@
          <a-select
            style="width: 100%"
            placeholder="请选择文章"
            v-decorator="['bannerTypeUrl', {rules: [{ required: true, message: '请选择文章!' }]}]"
            v-decorator="['bannerTypeUrl', {rules: [{validator: checkUrl}]}]"
          >
            <a-select-option
              v-for="(item,index) in actionClassData"
              :key="index"
              :value="item"
            >{{ item }}</a-select-option>
              :value="item.articleContentId"
            >{{ item.articleContentTitle }}</a-select-option>
          </a-select>
        </a-form-item>
        <a-form-item
          :required="true"
          v-if="bannerType==3"
          v-show="bannerType==2"
          label="跳转链接Url"
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
@ -95,7 +95,7 @@
          />
        </a-form-item>
        <a-form-item label="是否上线" :labelCol="labelCol" :wrapperCol="wrapperCol" :required="true">
          <a-radio-group name="bannerIsLine" v-decorator="['bannerIsLine',{ initialValue: 1 }]">
          <a-radio-group name="bannerIsLine" v-decorator="['bannerIsLine']">
            <a-radio :value="1">上线</a-radio>
            <a-radio :value="0">下线</a-radio>
          </a-radio-group>
@ -127,7 +127,7 @@ import { checkUrl } from '@/utils/util'
        actionClassData: [],
        formLoading: false,
        form: this.$form.createForm(this),
        bannerType: 3,
        bannerType: 0,
        remarkTxt: '请上传1920×712规格图像'
      }
    },
@ -136,11 +136,14 @@ import { checkUrl } from '@/utils/util'
      edit (record) {
        this.visible = true
        this.formLoading = true
        // this.getActionClass()
        this.getActionClass()
        setTimeout(() => {
          if (record.bannerType === 1) {
            record.bannerTypeUrl = JSON.parse(record.bannerTypeUrl).articleContentId
          }
          this.form.setFieldsValue(
            {
              id: record.id,
              bannerId: record.bannerId,
              bannerName: record.bannerName,
              bannerImage: record.bannerImage,
              bannerIsLine: record.bannerIsLine,
@ -150,19 +153,21 @@ import { checkUrl } from '@/utils/util'
            }
          )
          this.bannerType = record.bannerType
          this.$refs.upLoadRef.initData([record.bannerImage])
          this.$nextTick(() => {
            this.$refs.upLoadRef.initData([record.bannerImage])
          })
        }, 100)
      },
      /**
       * 获取选择器下拉框数据
       */
      getActionClass () {
        homeApi.findArticleContentById().then((res) => {
        homeApi.findArticleAll().then((res) => {
          this.formLoading = false
          if (res.success) {
          if (res.status === 200) {
            this.actionClassData = res.data
          } else {
            this.$message.error('获取选择器下拉框数据')
            this.$message.error('获取文章列表数据失败')
          }
        })
      },
@ -171,8 +176,12 @@ import { checkUrl } from '@/utils/util'
        this.confirmLoading = true
        validateFields((errors, values) => {
          if (!errors) {
            values.bannerSort = parseInt(values.bannerSort)
            if (!values.bannerTypeUrl) {
              values.bannerTypeUrl = ''
            }
            homeApi.updateBanner(values).then((res) => {
              if (res.success) {
              if (res.status === 200) {
                this.$message.success('编辑成功')
                this.visible = false
                this.confirmLoading = false
@ -194,33 +203,50 @@ import { checkUrl } from '@/utils/util'
        this.visible = false
      },
      changeType (val) {
        this.bannerType = this.form.getFieldValue('bannerType')
        this.$nextTick(() => {
          this.bannerType = this.form.getFieldValue('bannerType')
          this.form.resetFields('bannerTypeUrl')
          if (this.bannerType === 2) {
            this.form.setFieldsValue({ 'bannerTypeUrl': 'http://' })
          } else {
            this.form.setFieldsValue({ 'bannerTypeUrl': '' })
          }
        })
      },
      uploadSuccess (avg) {
        if (avg.fileList[0]) {
          this.form.setFieldsValue({ 'bannerImage': avg.fileList[0].url })
          this.form.resetFields('bannerImage')
          this.form.setFieldsValue({ 'bannerImage': avg.fileList[0].uri })
        }
      },
      checkimageUrl (rule, value, callback) {
        callback()
        // return false
        // if (value && value.length > 0) {
        //   callback()
        //   return
        // }
        // var text = '请上传图片'
        // callback(text)
        if (value && value.length > 0) {
          callback()
          return
        }
        var text = '请上传图片'
        callback(text)
      },
      checkUrl (rule, value, callback) {
        var text = '请输入跳转链接!'
        if (!value) {
          callback(text)
        } else if (checkUrl(value)) {
          callback()
        if (this.bannerType === 1) {
          text = '请选择文章!'
          if (!value) {
            callback(text)
          } else {
            callback()
          }
        } else if (this.bannerType === 2) {
          if (!value) {
            callback(text)
          } else if (checkUrl(value)) {
            callback()
          } else {
            text = '请输入正确的url地址'
            callback(text)
          }
        } else {
          text = '请输入正确的url地址'
          callback(text)
          callback()
        }
      },
      checkSortIndex (rule, value, callback) {

+ 270 - 0
_web/src/views/homeManager/editCompanyCaseForm.vue

@ -0,0 +1,270 @@
<template>
  <a-modal
    title="编辑公司案例"
    :width="900"
    :visible="visible"
    :confirmLoading="confirmLoading"
    ok-text="保存"
    cancel-text="关闭"
    @ok="handleSubmit"
    @cancel="handleCancel"
    :maskClosable="false"
  >
    <a-spin :spinning="formLoading">
      <a-form :form="form">
        <a-form-item
          style="display: none;"
        >
          <a-input v-decorator="['companyId']" />
        </a-form-item>
        <a-form-item label="标题名称" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input
            placeholder="请输入标题名称"
            v-decorator="['companyName', {rules: [{required: true, message: '请输入标题名称!'}]}]"
          />
        </a-form-item>
        <a-form-item
          label="描述"
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
          has-feedback
        >
          <a-textarea :rows="4" :maxLength="30" placeholder="请输入描述" @input="companyDescribeInput" v-decorator="['companyDescribe', {rules: [{required: true, message: '请输入描述!'}]}]">
          </a-textarea>
          <div class="companyDescribeCount">({{ companyDescribe.length }}/30)</div>
        </a-form-item>
        <a-form-item
          :required="true"
          label="关联案例"
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
          has-feedback
        >
          <a-select
            style="width: 100%"
            placeholder="请选择产品"
            v-decorator="['companyAssociatedCase', {rules: [{ required: true, message: '请选择产品!' }]}]"
          >
            <a-select-option
              v-for="(item,index) in actionClassData"
              :key="index"
              :value="item.articleContentId"
            >{{ item.articleContentTitle }}</a-select-option>
          </a-select>
        </a-form-item>
        <a-form-item
          label="默认图片"
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
          has-feedback
          :required="true"
        >
          <div>
            <upload-component
              ref="upLoadDefaultRef"
              :remarkTxt="remarkTxt"
              @uploadSuccess="uploadSuccessDefault"
              v-decorator="[
                'companyDefaultImg',
                {
                  trigger: 'change',
                  rules: [{ validator: checkimageUrl }]
                },
              ]"
            ></upload-component>
          </div>
        </a-form-item>
        <a-form-item
          label="交互图像"
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
          has-feedback
          :required="true"
        >
          <div>
            <upload-component
              ref="upLoadExchangeRef"
              :remarkTxt="remarkTxt"
              @uploadSuccess="uploadSuccessExchange"
              v-decorator="[
                'companyExchangeImg',
                {
                  trigger: 'change',
                  rules: [{ validator: checkimageUrl }]
                },
              ]"
            ></upload-component>
          </div>
        </a-form-item>
        <a-form-item
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
          label="排序"
          :hasFeedback="true"
          :required="true"
        >
          <a-input
            placeholder="请输入排序号"
            v-decorator="['companySort', {rules: [{validator: checkSortIndex}]}]"
          />
        </a-form-item>
        <a-form-item label="是否上线" :labelCol="labelCol" :wrapperCol="wrapperCol" :required="true">
          <a-radio-group name="companyIsLine" v-decorator="['companyIsLine',{ initialValue: 1 }]">
            <a-radio :value="1">上线</a-radio>
            <a-radio :value="0">下线</a-radio>
          </a-radio-group>
        </a-form-item>
      </a-form>
    </a-spin>
  </a-modal>
</template>
<script>
import homeApi from '@/api/homeApi'
import uploadComponent from '@/components/upLoad'
export default {
  components: { uploadComponent },
  data () {
    return {
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 15 }
      },
      visible: false,
      confirmLoading: false,
      actionClassData: [],
      companyDescribe: '',
      formLoading: false,
      form: this.$form.createForm(this),
      remarkTxt: '请上传320×400规格图像'
    }
  },
  mounted () {
  },
  methods: {
    // 初始化方法
    edit (record) {
      this.visible = true
      this.formLoading = true
      this.getActionClass()
      setTimeout(() => {
        record.companyAssociatedCase = JSON.parse(record.companyAssociatedCase).articleContentId
        this.form.setFieldsValue(
          {
            companyId: record.companyId,
            companyName: record.companyName,
            companyAssociatedCase: record.companyAssociatedCase,
            companyJumpUrl: record.companyJumpUrl,
            companyDefaultImg: record.companyDefaultImg,
            companyExchangeImg: record.companyExchangeImg,
            companyDescribe: record.companyDescribe,
            companyIsLine: record.companyIsLine,
            companySort: record.companySort
          }
        )
        this.$nextTick(() => {
          this.companyDescribeInput()
          this.$refs.upLoadDefaultRef.initData([record.companyDefaultImg])
          this.$refs.upLoadExchangeRef.initData([record.companyExchangeImg])
        })
      }, 100)
    },
    /**
     * 获取选择器下拉框数据
     */
    getActionClass () {
      homeApi.findArticleAll().then((res) => {
        this.formLoading = false
        if (res.status === 200) {
          this.actionClassData = res.data
        } else {
          this.$message.error('获取文章列表数据失败')
        }
      })
    },
    companyDescribeInput () {
      this.$nextTick(() => {
        this.companyDescribe = this.form.getFieldValue('companyDescribe')
      })
    },
    handleSubmit () {
      const {
        form: { validateFields }
      } = this
      this.confirmLoading = true
      validateFields((errors, values) => {
        if (!errors) {
          values.companySort = parseInt(values.companySort)
          values.companyJumpUrl = values.companyAssociatedCase
          homeApi.updateCompanyCase(values)
            .then(res => {
              if (res.status === 200) {
                this.$message.success('编辑成功')
                this.visible = false
                this.confirmLoading = false
                this.$emit('ok', values)
                this.form.resetFields()
              } else {
                this.$message.error('编辑失败:' + res.message)
              }
            })
            .finally(res => {
              this.confirmLoading = false
            })
        } else {
          this.confirmLoading = false
        }
      })
    },
    handleCancel () {
      this.form.resetFields()
      this.visible = false
    },
    uploadSuccessDefault (avg) {
      if (avg.fileList[0]) {
        this.form.resetFields('companyDefaultImg')
        this.form.setFieldsValue({ 'companyDefaultImg': avg.fileList[0].uri })
      }
    },
    uploadSuccessExchange (avg) {
      if (avg.fileList[0]) {
        this.form.resetFields('companyExchangeImg')
        this.form.setFieldsValue({ 'companyExchangeImg': avg.fileList[0].uri })
      }
    },
    checkimageUrl (rule, value, callback) {
      if (value && value.length > 0) {
        callback()
        return
      }
      var text = '请上传图片'
      callback(text)
    },
    checkSortIndex (rule, value, callback) {
      var text = '请输入排序号!'
      if (!value) {
        callback(text)
      } else if (/(^[1-9]\d*$)/.test(value)) {
        callback()
      } else {
        text = '请输入数字'
        callback(text)
      }
    }
  }
}
</script>
<style lang="less">
  .companyDescribeCount{
    position: absolute;
    right: 30px;
    bottom: -10px;
    color: #999;
  }
</style>

+ 175 - 0
_web/src/views/homeManager/editPartnerForm.vue

@ -0,0 +1,175 @@
<template>
  <a-modal
    title="编辑合作伙伴"
    :width="900"
    :visible="visible"
    :confirmLoading="confirmLoading"
    ok-text="保存"
    cancel-text="关闭"
    @ok="handleSubmit"
    @cancel="handleCancel"
    :maskClosable="false"
  >
    <a-spin :spinning="formLoading">
      <a-form :form="form">
        <a-form-item
          style="display: none;"
        >
          <a-input v-decorator="['partnerId']" />
        </a-form-item>
        <a-form-item label="标题名称" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
          <a-input
            placeholder="请输入标题名称"
            v-decorator="['partnerName', {rules: [{required: true, message: '请输入标题名称!'}]}]"
          />
        </a-form-item>
        <a-form-item
          label="默认图片"
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
          has-feedback
          :required="true"
        >
          <div>
            <upload-component
              ref="upLoadRef"
              :remarkTxt="remarkTxt"
              @uploadSuccess="uploadSuccess"
              v-decorator="[
                'partnerImg',
                {
                  trigger: 'change',
                  rules: [{ validator: checkimageUrl }]
                },
              ]"
            ></upload-component>
          </div>
        </a-form-item>
        <a-form-item
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
          label="排序"
          :hasFeedback="true"
          :required="true"
        >
          <a-input
            placeholder="请输入排序号"
            v-decorator="['partnerSort', {rules: [{validator: checkSortIndex}]}]"
          />
        </a-form-item>
        <a-form-item label="是否上线" :labelCol="labelCol" :wrapperCol="wrapperCol" :required="true">
          <a-radio-group name="partnerIsLine" v-decorator="['partnerIsLine',{ initialValue: 1 }]">
            <a-radio :value="1">上线</a-radio>
            <a-radio :value="0">下线</a-radio>
          </a-radio-group>
        </a-form-item>
      </a-form>
    </a-spin>
  </a-modal>
</template>
<script>
import homeApi from '@/api/homeApi'
import uploadComponent from '@/components/upLoad'
export default {
  components: { uploadComponent },
  data () {
    return {
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 15 }
      },
      visible: false,
      confirmLoading: false,
      formLoading: false,
      form: this.$form.createForm(this),
      remarkTxt: '请上传174×54规格图像'
    }
  },
  mounted () {
  },
  methods: {
    // 初始化方法
    edit (record) {
      this.visible = true
      // this.formLoading = true
      setTimeout(() => {
        this.form.setFieldsValue(
          {
            partnerId: record.partnerId,
            partnerName: record.partnerName,
            partnerImg: record.partnerImg,
            partnerIsLine: record.partnerIsLine,
            partnerSort: record.partnerSort
          }
        )
        this.$nextTick(() => {
          this.$refs.upLoadRef.initData([record.partnerImg])
        })
      }, 100)
    },
    handleSubmit () {
      const {
        form: { validateFields }
      } = this
      this.confirmLoading = true
      validateFields((errors, values) => {
        if (!errors) {
          values.partnerSort = parseInt(values.partnerSort)
          homeApi.updatePartner(values)
            .then(res => {
              if (res.status === 200) {
                this.$message.success('编辑成功')
                this.visible = false
                this.confirmLoading = false
                this.$emit('ok', values)
                this.form.resetFields()
              } else {
                this.$message.error('编辑失败:' + res.message)
              }
            })
            .finally(res => {
              this.confirmLoading = false
            })
        } else {
          this.confirmLoading = false
        }
      })
    },
    handleCancel () {
      this.form.resetFields()
      this.visible = false
    },
    uploadSuccess (avg) {
      if (avg.fileList[0]) {
        this.form.resetFields('partnerImg')
        this.form.setFieldsValue({ 'partnerImg': avg.fileList[0].uri })
      }
    },
    checkimageUrl (rule, value, callback) {
      if (value && value.length > 0) {
        callback()
        return
      }
      var text = '请上传图片'
      callback(text)
    },
    checkSortIndex (rule, value, callback) {
      var text = '请输入排序号!'
      if (!value) {
        callback(text)
      } else if (/(^[1-9]\d*$)/.test(value)) {
        callback()
      } else {
        text = '请输入数字'
        callback(text)
      }
    }
  }
}
</script>

+ 24 - 14
_web/src/views/homeManager/indexBanner.vue

@ -21,13 +21,13 @@
      :columns="columns"
      :data="loadData"
      :alert="true"
      :rowKey="(record) => record.id"
      :rowKey="(record) => record.bannerId"
    >
      <span slot="bannerName" slot-scope="text">
        <ellipsis :length="30" tooltip>{{ text }}</ellipsis>
      </span>
      <span slot="bannerImage" slot-scope="src">
        <img :src="src | getImgUrl" width="60" height="45" @click="showPreviewImg(src)"/>
        <img :src="src | getImgUrl" width="60" height="45" @click="showPreviewImg(src)" style="cursor: pointer;"/>
      </span>
      <span slot="bannerType" slot-scope="text">
        {{ typeFilter(text) }}
@ -46,7 +46,7 @@
    </s-table>
    <add-form ref="addForm" @ok="handleOk" />
    <edit-form ref="editForm" @ok="handleOk" />
    <a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel">
    <a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel" title="预览">
      <img alt="example" style="width: 100%" :src="previewImage" />
    </a-modal>
  </a-card>
@ -57,6 +57,8 @@
  import { setImgUrl } from '@/utils/img'
  import addForm from './addBannerForm'
  import editForm from './editBannerForm'
  const _ = require('lodash')
  // import { sysDictTypeDropDown } from '@/api/modular/system/dictManage'
  export default {
    name: 'BannerIndex',
@ -84,7 +86,8 @@
          {
            title: '名称',
            dataIndex: 'bannerName',
            scopedSlots: { customRender: 'bannerName' }
            scopedSlots: { customRender: 'bannerName' },
            width: '260px'
          },
          {
            title: '图片',
@ -102,8 +105,8 @@
          },
          {
            title: '跳转链接',
            dataIndex: 'bannerTypeUrl',
            scopedSlots: { customRender: 'bannerTypeUrl' }
            dataIndex: 'bannerTypeUrlShow',
            scopedSlots: { customRender: 'bannerTypeUrlShow' }
          },
          {
            title: '排序',
@ -115,13 +118,21 @@
        // 加载数据方法 必须为 Promise 对象
        loadData: parameter => {
          return homeApi.findBannerById(Object.assign(parameter, this.queryParam)).then((res) => {
            return res.data
            var data = res.data
            _.each(data.rows, (item, index) => {
              if (item.bannerType === 1) {
                item.bannerTypeUrlShow = JSON.parse(item.bannerTypeUrl).articleContentTitle || JSON.parse(item.bannerTypeUrl).articleContentClassify
              } else {
                item.bannerTypeUrlShow = item.bannerTypeUrl
              }
            })
            return data
          })
        },
        selectedRowKeys: [],
        selectedRows: [],
        statusDictTypeDropDown: [{ code: 0, name: '下线' }, { code: 1, name: '上线' }],
        typeDictTypeDropDown: [{ code: 1, name: '无' }, { code: 2, name: '站内文章' }, { code: 3, name: '外部链接' }],
        typeDictTypeDropDown: [{ code: 0, name: '无' }, { code: 1, name: '站内文章' }, { code: 2, name: '外部链接' }],
        previewVisible: false,
        previewImage: ''
      }
@ -130,7 +141,7 @@
      if (this.hasPerm('bannerIndex:edit') || this.hasPerm('bannerIndex:delete') || hasPerm('bannerIndex:start') || hasPerm('bannerIndex:stop')) {
        this.columns.push({
          title: '操作',
          width: '150px',
          width: '300px',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' }
@ -145,7 +156,6 @@
    methods: {
      statusFilter (status) {
        const values = this.statusDictTypeDropDown.filter(item => item.code === status)
        debugger
        if (values.length > 0) {
          return values[0].name
        } else {
@ -170,7 +180,7 @@
              if (res.data) {
                this.$message.success('下线成功')
                this.$refs.table.refresh()
              }else{
              } else {
                this.$message.error('下线失败')
              }
            } else {
@ -183,7 +193,7 @@
              if (res.data) {
                this.$message.success('上线成功')
                this.$refs.table.refresh()
              }else{
              } else {
                this.$message.error('上线失败')
              }
            } else {
@ -198,11 +208,11 @@
            if (res.data) {
              this.$message.success('删除成功')
              this.$refs.table.refresh()
            }else{
            } else {
              this.$message.error('删除失败')
            }
          } else {
            this.$message.error('删除失败:' + res.message)
            this.$message.error('删除失败')
          }
        }).catch((err) => {
          this.$message.error('删除错误:' + err.message)

+ 47 - 28
_web/src/views/homeManager/indexCompanyCase.vue

@ -21,30 +21,31 @@
      :columns="columns"
      :data="loadData"
      :alert="true"
      :rowKey="(record) => record.id"
      :rowKey="(record) => record.companyId"
    >
      <span slot="companyName" slot-scope="text">
        <ellipsis :length="10" tooltip>{{ text }}</ellipsis>
        <ellipsis :length="30" tooltip>{{ text }}</ellipsis>
      </span>
      <span slot="companyDescribe" slot-scope="text">
        <ellipsis :length="10" tooltip>{{ text }}</ellipsis>
        <ellipsis :length="50" tooltip>{{ text }}</ellipsis>
      </span>
      <span slot="companyDefaultImg" slot-scope="src">
        <img :src="src | getImgUrl" width="60" height="45" @click="showPreviewImg(src)"/>
        <img :src="src | getImgUrl" width="60" height="45" @click="showPreviewImg(src)" style="cursor: pointer;"/>
      </span>
      <span slot="companyExchangeImg" slot-scope="src">
        <img :src="src | getImgUrl" width="60" height="45" @click="showPreviewImg(src)"/>
        <img :src="src | getImgUrl" width="60" height="45" @click="showPreviewImg(src)" style="cursor: pointer;"/>
      </span>
      <span slot="companyAssociatedCase" slot-scope="text">
        <ellipsis :length="10" tooltip>{{ text }}</ellipsis>
        <ellipsis :length="20" tooltip>{{ text }}</ellipsis>
      </span>
      <span slot="companyJumpUrl" slot-scope="text">
        <ellipsis :length="10" tooltip>{{ text }}</ellipsis>
        <ellipsis :length="80" tooltip>{{ text }}</ellipsis>
      </span>
      <span slot="action" slot-scope="text, record">
        <a-popconfirm placement="top" :title="record.companyIsLine===1? '是否确认下线该条目?':'是否确认上线该条目?'" @confirm="() => editjobStatusStatus(record.companyIsLine,record)">
          <a>{{ statusFilter(record.companyIsLine) }}</a>
        </a-popconfirm>
        <a-divider type="vertical"/>
        <a v-if="hasPerm('companyCaseIndex:edit')" @click="$refs.editForm.edit(record)">编辑</a>
        <a-divider type="vertical" v-if="hasPerm('companyCaseIndex:edit') && hasPerm('companyCaseIndex:delete')"/>
        <a-popconfirm v-if="hasPerm('companyCaseIndex:delete')" placement="topRight" title="是否确认删除该条目?" @confirm="() => companyCaseIndexDelete(record)">
@ -54,7 +55,7 @@
    </s-table>
    <add-form ref="addForm" @ok="handleOk" />
    <edit-form ref="editForm" @ok="handleOk" />
    <a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel">
    <a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel" title="预览">
      <img alt="example" style="width: 100%" :src="previewImage" />
    </a-modal>
  </a-card>
@ -64,8 +65,10 @@
  import homeApi from '@/api/homeApi'
  import { setImgUrl } from '@/utils/img'
  import addForm from './addCompanyCaseForm'
  import editForm from './editBannerForm'
  // import { sysDictTypeDropDown } from '@/api/modular/system/dictManage'
  import editForm from './editCompanyCaseForm'
  const _ = require('lodash')
  export default {
    name: 'CompanyCaseIndex',
    components: {
@ -115,8 +118,8 @@
          },
          {
            title: '关联案例',
            dataIndex: 'companyAssociatedCase',
            scopedSlots: { customRender: 'companyAssociatedCase' }
            dataIndex: 'companyAssociatedCaseShow',
            scopedSlots: { customRender: 'companyAssociatedCaseShow' }
          },
          {
            title: '跳转链接',
@ -133,7 +136,11 @@
        // 加载数据方法 必须为 Promise 对象
        loadData: parameter => {
          return homeApi.findCompanyCaseById(Object.assign(parameter, this.queryParam)).then((res) => {
            return res.data
            var data = res.data
            _.each(data.rows, (item, index) => {
                item.companyAssociatedCaseShow = JSON.parse(item.companyAssociatedCase).articleContentTitle || JSON.parse(item.companyAssociatedCase).articleContentClassify
            })
            return data
          })
        },
        selectedRowKeys: [],
@ -162,9 +169,9 @@
      statusFilter (status) {
        const values = this.statusDictTypeDropDown.filter(item => item.code === status)
        if (values.length > 0) {
          return values[0].value
          return values[0].name
        } else {
          return 'ddd'
          return '上线'
        }
      },
      /**
@ -172,19 +179,27 @@
       */
      editjobStatusStatus (code, record) {
        if (code === 1) {
          homeApi.updateIsLineCompanyCase({ id: record.id, isLine: false }).then(res => {
            if (res.success) {
              this.$message.success('下线成功')
              this.$refs.table.refresh()
          homeApi.updateIsLineCompanyCase({ id: record.companyId, isLine: 0 }).then(res => {
            if (res.status === 200) {
              if (res.data) {
                this.$message.success('下线成功')
                this.$refs.table.refresh()
              } else {
                this.$message.error('下线失败')
              }
            } else {
              this.$message.error('下线失败:' + res.message)
            }
          })
        } else if (code === 2) {
          homeApi.updateIsLineCompanyCase({ id: record.id, isLine: true }).then(res => {
            if (res.success) {
              this.$message.success('上线成功')
              this.$refs.table.refresh()
        } else {
          homeApi.updateIsLineCompanyCase({ id: record.companyId, isLine: 1 }).then(res => {
            if (res.status === 200) {
              if (res.data) {
                this.$message.success('上线成功')
                this.$refs.table.refresh()
              } else {
                this.$message.error('上线失败')
              }
            } else {
              this.$message.error('上线失败:' + res.message)
            }
@ -192,10 +207,14 @@
        }
      },
      companyCaseIndexDelete (record) {
        homeApi.deleteCompanyCase({ id: record.id }).then((res) => {
          if (res.success) {
            this.$message.success('删除成功')
            this.$refs.table.refresh()
        homeApi.deleteCompanyCase({ id: record.companyId }).then((res) => {
          if (res.status === 200) {
            if (res.data) {
              this.$message.success('删除成功')
              this.$refs.table.refresh()
            } else {
              this.$message.error('删除失败')
            }
          } else {
            this.$message.error('删除失败:' + res.message)
          }

+ 33 - 21
_web/src/views/homeManager/indexPartner.vue

@ -21,13 +21,13 @@
      :columns="columns"
      :data="loadData"
      :alert="true"
      :rowKey="(record) => record.id"
      :rowKey="(record) => record.partnerId"
    >
      <span slot="partnerName" slot-scope="text">
        <ellipsis :length="30" tooltip>{{ text }}</ellipsis>
      </span>
      <span slot="partnerImage" slot-scope="src">
        <img :src="src | getImgUrl" width="60" height="45" @click="showPreviewImg(src)"/>
      <span slot="partnerImg" slot-scope="src">
        <img :src="src | getImgUrl" width="60" height="45" @click="showPreviewImg(src)" style="cursor: pointer;"/>
      </span>
      <span slot="action" slot-scope="text, record">
        <a-popconfirm placement="top" :title="record.partnerIsLine===1? '是否确认下线该条目?':'是否确认上线该条目?'" @confirm="() => editjobStatusStatus(record.partnerIsLine,record)">
@ -43,7 +43,7 @@
    </s-table>
    <add-form ref="addForm" @ok="handleOk" />
    <edit-form ref="editForm" @ok="handleOk" />
    <a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel">
    <a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel" title="预览">
      <img alt="example" style="width: 100%" :src="previewImage" />
    </a-modal>
  </a-card>
@ -53,8 +53,8 @@
  import homeApi from '@/api/homeApi'
  import { setImgUrl } from '@/utils/img'
  import addForm from './addPartnerForm'
  import editForm from './editBannerForm'
  // import { sysDictTypeDropDown } from '@/api/modular/system/dictManage'
  import editForm from './editPartnerForm'
  export default {
    name: 'PartnerIndex',
    components: {
@ -85,8 +85,8 @@
          },
          {
            title: '图片',
            dataIndex: 'partnerImage',
            scopedSlots: { customRender: 'partnerImage' },
            dataIndex: 'partnerImg',
            scopedSlots: { customRender: 'partnerImg' },
            align: 'center'
          },
          {
@ -127,7 +127,7 @@
      statusFilter (status) {
        const values = this.statusDictTypeDropDown.filter(item => item.code === status)
        if (values.length > 0) {
          return values[0].value
          return values[0].name
        } else {
          return '上线'
        }
@ -137,19 +137,27 @@
       */
      editjobStatusStatus (code, record) {
        if (code === 1) {
          homeApi.updateIsLinePartner({ id: record.id, isLine: false }).then(res => {
            if (res.success) {
              this.$message.success('下线成功')
              this.$refs.table.refresh()
          homeApi.updateIsLinePartner({ id: record.partnerId, isLine: false }).then(res => {
            if (res.status === 200) {
              if (res.data) {
                this.$message.success('下线成功')
                this.$refs.table.refresh()
              } else {
                this.$message.error('下线失败')
              }
            } else {
              this.$message.error('下线失败:' + res.message)
            }
          })
        } else if (code === 2) {
          homeApi.updateIsLinePartner({ id: record.id, isLine: true }).then(res => {
            if (res.success) {
              this.$message.success('上线成功')
              this.$refs.table.refresh()
          homeApi.updateIsLinePartner({ id: record.partnerId, isLine: true }).then(res => {
            if (res.status === 200) {
              if (res.data) {
                this.$message.success('上线成功')
                this.$refs.table.refresh()
              } else {
                this.$message.error('上线失败')
              }
            } else {
              this.$message.error('上线失败:' + res.message)
            }
@ -157,10 +165,14 @@
        }
      },
      partnerIndexDelete (record) {
        homeApi.deletePartner({ id: record.id }).then((res) => {
          if (res.success) {
            this.$message.success('删除成功')
            this.$refs.table.refresh()
        homeApi.deletePartner({ id: record.partnerId }).then((res) => {
          if (res.status === 200) {
            if (res.data) {
              this.$message.success('删除成功')
              this.$refs.table.refresh()
            } else {
              this.$message.error('删除失败')
            }
          } else {
            this.$message.error('删除失败:' + res.message)
          }

+ 8 - 0
guns-main/pom.xml

@ -58,6 +58,14 @@
             <version>1.5.21</version>
         </dependency>
        <!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.5</version>
        </dependency>
        <!--fastdfs start-->
        <dependency>
            <groupId>org.csource</groupId>

+ 6 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/GcFileUploadController.java

@ -9,6 +9,8 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
@ -33,6 +35,8 @@ import java.io.IOException;
@Api(description = "文件上传")
public class GcFileUploadController {
    private Logger logger = (Logger) LoggerFactory.getLogger(GcFileUploadController.class);
    @Autowired
    FastDFSUtil fastDFSUtil;
    @Value("${fastDFS.fastdfs_file_url}")
@ -51,6 +55,7 @@ public class GcFileUploadController {
            @ApiParam(value = "文件", required = true) @RequestParam(value = "file", required = true) MultipartFile file
    ) {
        try {
            logger.info("单文件上传file:"+file);
            UploadModel uploadModel = fileUpload(file);
            return new ResultOneModel<UploadModel>(uploadModel);
        } catch (Exception e) {
@ -72,6 +77,7 @@ public class GcFileUploadController {
        String fileType = fullName.substring(fullName.lastIndexOf(".") + 1).toLowerCase();
        String fileName = fullName.substring(0, fullName.lastIndexOf("."));
        //上传到fastdfs
        logger.info("GcFileUploadController→mf==="+mf);
        ObjectNode objectNode = fastDFSUtil.upload(mf.getInputStream(), fileType, "");
        //解析返回的objectNode
        uploadModel.setFileName(fileName);

+ 110 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/ZjxlArticleContentController.java

@ -7,6 +7,7 @@ import cn.stylefeng.guns.zjxlUtil.PageUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -15,6 +16,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
/***
@ -55,6 +59,7 @@ public class ZjxlArticleContentController extends BaseController {
            @ApiParam(name = "articleContentTitle", value = "文章标题", required = false) @RequestParam(value = "articleContentTitle", required = false)String articleContentTitle,
            @ApiParam(name = "articleContentCover", value = "封面", required = false) @RequestParam(value = "articleContentCover", required = false)String articleContentCover,
            @ApiParam(name = "articleContentAbstract", value = "摘要", required = false) @RequestParam(value = "articleContentAbstract", required = false) String articleContentAbstract,
            @ApiParam(name = "articleContentContent", value = "内容", required = false) @RequestParam(value = "articleContentContent", required = false) String articleContentContent,
            @ApiParam(name = "articleContentType", value = "内容类型 1-产品与服务  2-公司案例  3-新闻中心  4-关于我们", required = false) @RequestParam(value = "articleContentType", required = false)Integer articleContentType,
            @ApiParam(name = "articleContentClassify", value = "分类", required = false) @RequestParam(value = "articleContentClassify", required = false)String articleContentClassify,
            @ApiParam(name = "articleContentSubclassify", value = "子分类", required = false) @RequestParam(value = "articleContentSubclassify", required = false)String articleContentSubclassify,
@ -62,6 +67,16 @@ public class ZjxlArticleContentController extends BaseController {
            @ApiParam(name = "articleContentIsLine", value = "是否上线", required = false, defaultValue = "0") @RequestParam(value = "articleContentIsLine", required = false)Integer articleContentIsLine){
        try {
            ZjxlArticleContent articleContent = new ZjxlArticleContent();
            List<ZjxlArticleContent> list = articleContentService.findArticleAll(null);
            if (list.size() > 0){
                Iterator<ZjxlArticleContent> iterator = list.iterator();
                while (iterator.hasNext()){
                    if (articleContentTitle.equals(iterator.next()));
                    return write(-1,"改文章已存在");
                }
            }
            articleContent.setArticleContentTitle(articleContentTitle);
            articleContent.setArticleContentCover(articleContentCover);
            articleContent.setArticleContentAbstract(articleContentAbstract);
@ -70,6 +85,11 @@ public class ZjxlArticleContentController extends BaseController {
            articleContent.setArticleContentSubclassify(articleContentSubclassify);
            articleContent.setArticleContentSort(articleContentSort);
            articleContent.setArticleContentIsLine(articleContentIsLine);
            articleContent.setArticleContentContent(articleContentContent);
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
            articleContent.setArticleContentCreateTime(df.format(new Date()));// new Date()为获取当前系统时间
            return write(200,"添加成功","data",articleContentService.addArticleContent(articleContent));
        }catch (Exception e){
            e.printStackTrace();
@ -77,6 +97,8 @@ public class ZjxlArticleContentController extends BaseController {
        }
    }
    @RequestMapping(value = "/deleteArticleContent", method = RequestMethod.POST)
    @ApiOperation(value = "删除文章管理")
    public String deleteArticleContent(@ApiParam(name = "id", value = "文章id") @RequestParam(value = "id") String id){
@ -85,6 +107,7 @@ public class ZjxlArticleContentController extends BaseController {
                logger.info("修改是否上线:id====="+id);
                return write(-1,"获取参数失败");
            }
            logger.info("修改是否上线:id====="+id);
            return write(200,"删除成功","data",articleContentService.deleteArticleContent(id));
        }catch (Exception e){
            e.printStackTrace();
@ -101,10 +124,97 @@ public class ZjxlArticleContentController extends BaseController {
                logger.info("修改是否上线:id====="+id+",isLine===="+isLine);
                return write(-1,"获取参数失败");
            }
            logger.info("修改是否上线:id====="+id+",isLine===="+isLine);
            return write(200,"修改上线成功","data",articleContentService.updateArticleContent(id,isLine));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"修改上线失败");
        }
    }
    @RequestMapping(value = "/getLeftTabs", method = RequestMethod.GET)
    @ApiOperation(value = "根据每个内容类型获取对应的分类")
    public String getLeftTabs(@ApiParam(name = "articleContentType", value = "内容类型 1-产品与服务  2-公司案例  3-新闻中心  4-关于我们") @RequestParam(value = "articleContentType") String articleContentType){
        try {
            if (StringUtils.isEmpty(articleContentType)){
                logger.info("内容类型:articleContentType====="+articleContentType);
                return write(-1,"获取参数失败");
            }
            logger.info("内容类型:articleContentType====="+articleContentType);
            return write(200,"操作成功","data",articleContentService.getLeftTabs(articleContentType));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"操作失败");
        }
    }
    @RequestMapping(value = "/getArticleContentSubclassify", method = RequestMethod.GET)
    @ApiOperation(value = "根据每个分类获取对应的子分类")
    public String getArticleContentSubclassify(@ApiParam(name = "articleContentType", value = "内容类型 1-产品与服务  2-公司案例  3-新闻中心  4-关于我们") @RequestParam(value = "articleContentType") String articleContentType,
                                               @ApiParam(name = "articleContentClassify", value = "分类") @RequestParam(value = "articleContentClassify") String articleContentClassify){
        try {
            if (StringUtils.isEmpty(articleContentType) || StringUtils.isEmpty(articleContentClassify)){
                logger.info("内容类型:articleContentType====="+articleContentType);
                logger.info("分类:articleContentClassify====="+articleContentClassify);
                return write(-1,"获取参数失败");
            }
            logger.info("内容类型:articleContentType====="+articleContentType);
            logger.info("分类:articleContentClassify====="+articleContentClassify);
            return write(200,"操作成功","data",articleContentService.getArticleContentSubclassify(articleContentType,articleContentClassify));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"操作失败");
        }
    }
    @RequestMapping(value = "/getArticleContent", method = RequestMethod.GET)
    @ApiOperation(value = "根据子分类获取对应的文章(排序最高的文章)")
    public String getArticleContent(@ApiParam(name = "articleContentType", value = "内容类型 1-产品与服务  2-公司案例  3-新闻中心  4-关于我们") @RequestParam(value = "articleContentType") String articleContentType,
                                    @ApiParam(name = "articleContentClassify", value = "分类") @RequestParam(value = "articleContentClassify") String articleContentClassify,
                                    @ApiParam(name = "articleContentSubclassify", value = "子分类") @RequestParam(value = "articleContentSubclassify") String articleContentSubclassify){
        try {
            if (StringUtils.isEmpty(articleContentType) || StringUtils.isEmpty(articleContentClassify) || StringUtils.isEmpty(articleContentSubclassify)){
                logger.info("内容类型:articleContentType====="+articleContentType);
                logger.info("分类:articleContentClassify====="+articleContentClassify);
                logger.info("子分类:articleContentSubclassify====="+articleContentSubclassify);
                return write(-1,"获取参数失败");
            }
            logger.info("内容类型:articleContentType====="+articleContentType);
            logger.info("分类:articleContentClassify====="+articleContentClassify);
            logger.info("子分类:articleContentSubclassify====="+articleContentSubclassify);
            return write(200,"操作成功","data",articleContentService.getArticleContent(articleContentType,articleContentClassify,articleContentSubclassify));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"操作失败");
        }
    }
    @RequestMapping(value = "/findNewsList", method = RequestMethod.GET)
    @ApiOperation(value = "查询新闻中心列表")
    public String findNewsList(@ApiParam(name = "id", value = "文章id", required = false) @RequestParam(value = "id", required = false)String id,
                                        // @ApiParam(name = "articleContentTitle", value = "文章标题", required = false) @RequestParam(value = "articleContentTitle", required = false)String articleContentTitle,
                                        // @ApiParam(name = "systemDictType", value = "内容类型 1-产品与服务  2-公司案例  3-新闻中心  4-关于我们", required = false, defaultValue = "3") @RequestParam(value = "systemDictType", required = false)Integer systemDictType,
                               @ApiParam(name = "articleContentClassify", value = "分类: 公司动态  媒体报道  参观交流", defaultValue = "公司动态") @RequestParam(value = "articleContentClassify") String articleContentClassify,
                               @ApiParam(name = "articleContentSubclassify", value = "子分类") @RequestParam(value = "articleContentSubclassify", required = false) String articleContentSubclassify,
                               @ApiParam(name = "pageNo", value = "第几页", defaultValue = "1") @RequestParam(value = "pageNo", required = false) Integer pageNo,
                               @ApiParam(name = "pageSize", value = "分页大小", defaultValue = "10") @RequestParam(value = "pageSize", required = false) Integer pageSize){
        try {
            List<ZjxlArticleContent> articleContentList = articleContentService.findNewsList(id,articleContentClassify,articleContentSubclassify,3,pageNo-1,pageSize);
            return write(200,"查询成功","data", PageUtil.getPage(articleContentList,pageNo,pageSize,articleContentService.allNewsCount(articleContentClassify,articleContentSubclassify)));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"查询失败");
        }
    }
    @RequestMapping(value = "/findArticleAll", method = RequestMethod.GET)
    @ApiOperation(value = "获取所有文章")
    public String findArticleAll(@ApiParam(name = "articleContentType", value = "子分类") @RequestParam(value = "articleContentType", required = false) String articleContentType){
        try {
            return write(200,"查询成功","data", articleContentService.findArticleAll(articleContentType));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"查询失败");
        }
    }
}

+ 112 - 8
guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/ZjxlBannerCnotroller.java

@ -1,33 +1,40 @@
package cn.stylefeng.guns.zjxl.cnotroller;
import cn.stylefeng.guns.config.FastDFSConfig;
import cn.stylefeng.guns.sys.modular.user.param.SysUserParam;
import cn.stylefeng.guns.zjxl.model.UploadModel;
import cn.stylefeng.guns.zjxl.model.ZjxlArticleContent;
import cn.stylefeng.guns.zjxl.model.ZjxlBanner;
import cn.stylefeng.guns.zjxl.model.ret.BannerCompanyCaseRet;
import cn.stylefeng.guns.zjxl.model.ret.BaseResultModel;
import cn.stylefeng.guns.zjxl.model.ret.ResultOneModel;
import cn.stylefeng.guns.zjxl.service.ZjxlArticleContentService;
import cn.stylefeng.guns.zjxl.service.ZjxlBannerService;
import cn.stylefeng.guns.zjxlUtil.BaseController;
import cn.stylefeng.guns.zjxlUtil.FastDFSUtil;
import cn.stylefeng.guns.zjxlUtil.PageUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
@ -46,6 +53,8 @@ public class ZjxlBannerCnotroller extends BaseController {
    @Autowired
    private ZjxlBannerService bannerService;
    @Autowired
    private ZjxlArticleContentService articleContentService;
    @Autowired
    FastDFSConfig fastDFSConfig;
@ -73,17 +82,41 @@ public class ZjxlBannerCnotroller extends BaseController {
    @ApiOperation(value = "添加banner")
    public String addBanner(@ApiParam(name = "bannerName", value = "bannerName", required = false) @RequestParam(value = "bannerName", required = false)String bannerName,
                            @ApiParam(name = "bannerImage", value = "图片", required = false) @RequestParam(value = "bannerImage", required = false)String bannerImage,
                            @ApiParam(name = "bannerType", value = "跳转方式", required = false) @RequestParam(value = "bannerType", required = false)Integer bannerType,
                            @ApiParam(name = "bannerTypeUrl", value = "跳转链接", required = false) @RequestParam(value = "bannerTypeUrl", required = false)String bannerTypeUrl,
                            @ApiParam(name = "bannerType", value = "跳转方式: 0-无  1-站内文章  2-外部链接", required = false) @RequestParam(value = "bannerType", required = false)Integer bannerType,
                            @ApiParam(name = "bannerTypeUrl", value = "跳转链接(如果是站内文章,传文章id)", required = false) @RequestParam(value = "bannerTypeUrl", required = false)String bannerTypeUrl,
                            @ApiParam(name = "bannerSort", value = "排序", required = false) @RequestParam(value = "bannerSort", required = false)Integer bannerSort,
                            @ApiParam(name = "bannerIsLine", value = "是否上线", required = false,defaultValue = "0") @RequestParam(value = "bannerIsLine", required = false)Integer bannerIsLine){
        ZjxlBanner banner = new ZjxlBanner();
        banner.setBannerImage(bannerImage);//String
        banner.setBannerIsLine(bannerIsLine);//integer
        List<ZjxlBanner> bannerList = bannerService.findBannerAll();
        if (bannerList.size() > 0){
            Iterator<ZjxlBanner> bannerIterator = bannerList.iterator();
            while (bannerIterator.hasNext()){
                if (bannerIterator.next().getBannerName().equals(bannerName)){
                    return write(-1,"该名称已存在");
                }
            }
        }
        banner.setBannerName(bannerName);//string
        banner.setBannerSort(bannerSort);
        banner.setBannerType(bannerType);
        banner.setBannerTypeUrl(bannerTypeUrl);
        if (bannerType == 1){
            List<ZjxlArticleContent> articleContentList = articleContentService.findArticleContentById(bannerTypeUrl);
            JSONObject object = new JSONObject();
            object.put("articleContentId",articleContentList.get(0).getArticleContentId());
            object.put("articleContentType",articleContentList.get(0).getArticleContentType());
            object.put("articleContentClassify",articleContentList.get(0).getArticleContentClassify());
            object.put("articleContentSubclassify",articleContentList.get(0).getArticleContentSubclassify());
            object.put("articleContentTitle",articleContentList.get(0).getArticleContentTitle());
            banner.setBannerTypeUrl(object.toString());
        }else {
            banner.setBannerTypeUrl(bannerTypeUrl);
        }
        //设置日期格式
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        // new Date()为获取当前系统时间
        banner.setBannerCreateTime(df.format(new Date()));
        try {
            logger.info("执行banner添加,参数:"+banner);
            return write(200,"添加成功","data",bannerService.addBanner(banner));
@ -109,7 +142,8 @@ public class ZjxlBannerCnotroller extends BaseController {
    @RequestMapping(value = "/updateIsLine", method = RequestMethod.POST)
    @ApiOperation(value = "修改是否上线")
    public String updateIsLine(String id,Integer isLine){
    public String updateIsLine(String id,
                               Integer isLine){
        try {
            logger.info("修改是否上线:id====="+id+",isLine===="+isLine);
            if (id == null || isLine == null){
@ -122,6 +156,63 @@ public class ZjxlBannerCnotroller extends BaseController {
        }
    }
    @RequestMapping(value = "/updataBanner", method = RequestMethod.POST)
    @ApiOperation(value = "编辑banner")
    public String updataBanner(@ApiParam(name = "bannerId", value = "bannerId", required = false) @RequestParam(value = "bannerId", required = true)String bannerId,
                               @ApiParam(name = "bannerName", value = "bannerName", required = false) @RequestParam(value = "bannerName", required = false)String bannerName,
                               @ApiParam(name = "bannerImage", value = "图片", required = false) @RequestParam(value = "bannerImage", required = false)String bannerImage,
                               @ApiParam(name = "bannerType", value = "跳转方式: 0-无  1-站内文章  2-外部链接", required = false) @RequestParam(value = "bannerType", required = false)Integer bannerType,
                               @ApiParam(name = "bannerTypeUrl", value = "跳转链接(如果是站内文章,传文章id)", required = false) @RequestParam(value = "bannerTypeUrl", required = false)String bannerTypeUrl,
                               @ApiParam(name = "bannerSort", value = "排序", required = false) @RequestParam(value = "bannerSort", required = false)Integer bannerSort,
                               @ApiParam(name = "bannerIsLine", value = "是否上线", required = false,defaultValue = "0") @RequestParam(value = "bannerIsLine", required = false)Integer bannerIsLine){
        ZjxlBanner banner = new ZjxlBanner();
        banner.setBannerId(bannerId);
        if (bannerType != null){
            banner.setBannerType(bannerType);
        }
        if (bannerType != null){
            if (bannerType == 1){
                List<ZjxlArticleContent> articleContentList = articleContentService.findArticleContentById(bannerTypeUrl);
                JSONObject object = new JSONObject();
                object.put("articleContentId",articleContentList.get(0).getArticleContentId());
                object.put("articleContentType",articleContentList.get(0).getArticleContentType());
                object.put("articleContentClassify",articleContentList.get(0).getArticleContentClassify());
                object.put("articleContentSubclassify",articleContentList.get(0).getArticleContentSubclassify());
                object.put("articleContentTitle",articleContentList.get(0).getArticleContentTitle());
                banner.setBannerTypeUrl(object.toString());
            }else {
                banner.setBannerTypeUrl(bannerTypeUrl);
            }
        }
        if (bannerSort != null){
            banner.setBannerSort(bannerSort);
        }
        List<ZjxlBanner> bannerList = bannerService.findBannerAll();
        if (bannerList.size() > 0){
            Iterator<ZjxlBanner> bannerIterator = bannerList.iterator();
            while (bannerIterator.hasNext()){
                if (bannerIterator.next().getBannerName().equals(bannerName)){
                    return write(-1,"该名称已存在");
                }
            }
        }
        if (bannerName != null){
            banner.setBannerName(bannerName);
        }
        if (bannerImage != null){
            banner.setBannerImage(bannerImage);
        }
        if (bannerIsLine != null){
            banner.setBannerIsLine(bannerIsLine);
        }
        try {
            return write(200,"修改成功","data",bannerService.updateBanner(banner));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"修改失败");
        }
    }
    /**
     * 聊天附件上传
     *
@ -171,4 +262,17 @@ public class ZjxlBannerCnotroller extends BaseController {
        uploadModel.setFullUrl(fastdfs_file_url + objectNode.get("fid").toString().replaceAll("\"", ""));
        return uploadModel;
    }
    @RequestMapping(value = "/findBannerByIsOnLine", method = RequestMethod.GET)
    @ApiOperation(value = "查看banner列表,仅显示已上线的")
    public String findBannerByIsOnLine(
                                 @ApiParam(name = "pageNo", value = "第几页", defaultValue = "1") @RequestParam(value = "pageNo", required = false) Integer pageNo,
                                 @ApiParam(name = "pageSize", value = "分页大小", defaultValue = "1") @RequestParam(value = "pageSize", required = false) Integer pageSize){
        try {
            return write(200,"查询成功","data",bannerService.findBannerByIsOnLine(pageNo-1,pageSize));
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败");
        }
    }
}

+ 19 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/ZjxlBasicInfoController.java

@ -6,12 +6,16 @@ import cn.stylefeng.guns.zjxlUtil.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.Date;
/***
 * @ClassName: ZjxlBasicInfoController
 * @Description: 公司基本信息
@ -40,10 +44,25 @@ public class ZjxlBasicInfoController extends BaseController {
            basicInfo.setBasicInfoEmail(basicInfoEmail);
            basicInfo.setBasicInfoRecord(basicInfoRecord);
            basicInfo.setBasicInfoQrcode(basicInfoQrcode);
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
            basicInfo.setBasicInfoCreateTime(df.format(new Date()));// new Date()为获取当前系统时间
            return write(200,"编辑成功","data",basicInfoService.addBasicInfo(basicInfo));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"编辑失败");
        }
    }
    @RequestMapping(value = "/findBasicInfo", method = RequestMethod.GET)
    @ApiOperation(value = "查看 基本信息")
    public String findBasicInfo(String basicInfoId){
        try {
            return write(200,"查看成功","data",basicInfoService.findBasicInfo(basicInfoId));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"查看失败");
        }
    }
}

+ 95 - 3
guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/ZjxlCompanyCaseController.java

@ -1,20 +1,27 @@
package cn.stylefeng.guns.zjxl.cnotroller;
import cn.stylefeng.guns.zjxl.model.ZjxlArticleContent;
import cn.stylefeng.guns.zjxl.model.ZjxlCompanyCase;
import cn.stylefeng.guns.zjxl.service.ZjxlArticleContentService;
import cn.stylefeng.guns.zjxl.service.ZjxlCompanyCaseService;
import cn.stylefeng.guns.zjxlUtil.BaseController;
import cn.stylefeng.guns.zjxlUtil.PageUtil;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
/***
@ -32,6 +39,10 @@ public class ZjxlCompanyCaseController extends BaseController {
    @Autowired
    private ZjxlCompanyCaseService companyCaseService;
    @Autowired
    private ZjxlArticleContentService articleContentService;
    @Value("${article.id_url}")
    private String idUrl;
    @RequestMapping(value = "/findCompanyCaseById", method = RequestMethod.GET)
    @ApiOperation(value = "查看CompanyCase")
@ -55,22 +66,48 @@ public class ZjxlCompanyCaseController extends BaseController {
            @ApiParam(name = "companyDescribe", value = "案例描述", required = false) @RequestParam(value = "companyDescribe", required = false)String companyDescribe,
            @ApiParam(name = "companyDefaultImg", value = "默认图片", required = false) @RequestParam(value = "companyDefaultImg", required = false)String companyDefaultImg,
            @ApiParam(name = "companyExchangeImg", value = "交互图片", required = false) @RequestParam(value = "companyExchangeImg", required = false)String companyExchangeImg,
            @ApiParam(name = "companyAssociatedCase", value = "关联案例", required = false) @RequestParam(value = "companyAssociatedCase", required = false)String companyAssociatedCase,
            @ApiParam(name = "companyAssociatedCase", value = "关联案例(对应的文章id)", required = false) @RequestParam(value = "companyAssociatedCase", required = false)String companyAssociatedCase,
            @ApiParam(name = "companyJumpUrl", value = "跳转链接", required = false) @RequestParam(value = "companyJumpUrl", required = false)String companyJumpUrl,
            @ApiParam(name = "companySort", value = "排序", required = false) @RequestParam(value = "companySort", required = false)Integer companySort,
            @ApiParam(name = "companyIsLine", value = "是否上线", required = false, defaultValue = "0") @RequestParam(value = "companyIsLine", required = false)Integer companyIsLine,
            @ApiParam(name = "companyTestBannerId", value = "测试用字段", required = false, defaultValue = "1") @RequestParam(value = "companyTestBannerId", required = false)String companyTestBannerId){
        try {
            ZjxlCompanyCase companyCase = new ZjxlCompanyCase();
            List<ZjxlCompanyCase> companyCases = companyCaseService.findAll();
            Iterator iterator = companyCases.iterator();
            while (iterator.hasNext()){
                if (companyName.equals(iterator.next())){
                    return write(-1,"该案例名称已存在");
                }
            }
            companyCase.setCompanyName(companyName);
            companyCase.setCompanyDescribe(companyDescribe);
            companyCase.setCompanyDefaultImg(companyDefaultImg);
            companyCase.setCompanyExchangeImg(companyExchangeImg);
            companyCase.setCompanyAssociatedCase(companyAssociatedCase);
            companyCase.setCompanyJumpUrl(companyJumpUrl);
            //http://172.26.0.30:8080/zjxl/zjxlArticleContent/findArticleContentById?articleContentTitle=&id=1&pageNo=1&pageSize=10&systemDictType=
            companyCase.setCompanyJumpUrl(idUrl+"id="+companyJumpUrl+"");
            companyCase.setCompanySort(companySort);
            companyCase.setCompanyIsLine(companyIsLine);
            companyCase.setCompanyTestBannerId(companyTestBannerId);
            List<ZjxlArticleContent> caseA = articleContentService.findArticleContentById(companyAssociatedCase);
            if (caseA.size()>0){
                JSONObject object = new JSONObject();
                object.put("articleContentId",caseA.get(0).getArticleContentId());
                object.put("articleContentType",caseA.get(0).getArticleContentType());
                object.put("articleContentClassify",caseA.get(0).getArticleContentClassify());
                object.put("articleContentSubclassify",caseA.get(0).getArticleContentSubclassify());
                object.put("articleContentTitle",caseA.get(0).getArticleContentTitle());
                companyCase.setCompanyAssociatedCase(object.toString());
            }else {
                return write(-1,"添加案例不存在");
            }
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
            companyCase.setCompanyCreateTime(df.format(new Date()));// new Date()为获取当前系统时间
            return write(200,"添加成功","data",companyCaseService.addCompanyCase(companyCase));
        }catch (Exception e){
            e.printStackTrace();
@ -107,4 +144,59 @@ public class ZjxlCompanyCaseController extends BaseController {
            return write(-1,"修改失败");
        }
    }
    @RequestMapping(value = "/updateCompanyCase", method = RequestMethod.POST)
    @ApiOperation(value = "编辑公司案例")
    public String updateCompanyCase(
            @ApiParam(name = "companyId", value = "案例id", required = false) @RequestParam(value = "companyId", required = false)String companyId,
            @ApiParam(name = "companyName", value = "案例名称", required = false) @RequestParam(value = "companyName", required = false)String companyName,
            @ApiParam(name = "companyDescribe", value = "案例描述", required = false) @RequestParam(value = "companyDescribe", required = false)String companyDescribe,
            @ApiParam(name = "companyDefaultImg", value = "默认图片", required = false) @RequestParam(value = "companyDefaultImg", required = false)String companyDefaultImg,
            @ApiParam(name = "companyExchangeImg", value = "交互图片", required = false) @RequestParam(value = "companyExchangeImg", required = false)String companyExchangeImg,
            @ApiParam(name = "companyAssociatedCase", value = "关联案例(对应的文章id)", required = false) @RequestParam(value = "companyAssociatedCase", required = false)String companyAssociatedCase,
            @ApiParam(name = "companyJumpUrl", value = "跳转链接", required = false) @RequestParam(value = "companyJumpUrl", required = false)String companyJumpUrl,
            @ApiParam(name = "companySort", value = "排序", required = false) @RequestParam(value = "companySort", required = false)Integer companySort,
            @ApiParam(name = "companyIsLine", value = "是否上线", required = false, defaultValue = "0") @RequestParam(value = "companyIsLine", required = false)Integer companyIsLine,
            @ApiParam(name = "companyTestBannerId", value = "测试用字段", required = false, defaultValue = "1") @RequestParam(value = "companyTestBannerId", required = false)String companyTestBannerId){
        try {
            ZjxlCompanyCase companyCase = new ZjxlCompanyCase();
            companyCase.setCompanyId(companyId);
            List<ZjxlCompanyCase> companyCases = companyCaseService.findAll();
            Iterator iterator = companyCases.iterator();
            while (iterator.hasNext()){
                if (companyName.equals(iterator.next())){
                    return write(-1,"该案例名称已存在");
                }
            }
            companyCase.setCompanyName(companyName);
            companyCase.setCompanyDescribe(companyDescribe);
            companyCase.setCompanyDefaultImg(companyDefaultImg);
            companyCase.setCompanyExchangeImg(companyExchangeImg);
            //http://172.26.0.30:8080/zjxl/zjxlArticleContent/findArticleContentById?articleContentTitle=&id=1&pageNo=1&pageSize=10&systemDictType=
            companyCase.setCompanyJumpUrl(idUrl+"id="+companyJumpUrl+"");
            companyCase.setCompanySort(companySort);
            companyCase.setCompanyIsLine(companyIsLine);
            companyCase.setCompanyTestBannerId(companyTestBannerId);
            List<ZjxlArticleContent> caseA = articleContentService.findArticleContentById(companyAssociatedCase);
            if (caseA.size()>0){
                JSONObject object = new JSONObject();
                object.put("articleContentId",caseA.get(0).getArticleContentId());
                object.put("articleContentType",caseA.get(0).getArticleContentType());
                object.put("articleContentClassify",caseA.get(0).getArticleContentClassify());
                object.put("articleContentSubclassify",caseA.get(0).getArticleContentSubclassify());
                object.put("articleContentTitle",caseA.get(0).getArticleContentTitle());
                companyCase.setCompanyAssociatedCase(object.toString());
            }else {
                return write(-1,"添加案例不存在");
            }
            return write(200,"编辑成功","data",companyCaseService.updateCompanyCase(companyCase));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"编辑失败");
        }
    }
}

+ 51 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/ZjxlNewsCenterController.java

@ -0,0 +1,51 @@
package cn.stylefeng.guns.zjxl.cnotroller;
import cn.stylefeng.guns.zjxl.model.ZjxlCompanyCase;
import cn.stylefeng.guns.zjxl.model.ZjxlNewsCenter;
import cn.stylefeng.guns.zjxl.service.ZjxlNewsCenterService;
import cn.stylefeng.guns.zjxlUtil.BaseController;
import cn.stylefeng.guns.zjxlUtil.PageUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/***
 * @ClassName: ZjxlNewsCenterController
 * @Description:
 * @Auther: shi kejing
 * @Date: 2020/11/17 14:22
 */
@RestController
@Api(description = "公司官网主页-新闻中心列表页")
@RequestMapping(value = "/zjxl/newsCenter")
public class ZjxlNewsCenterController extends BaseController {
    private Logger logger = (Logger) LoggerFactory.getLogger(ZjxlCompanyCaseController.class);
    @Autowired
    private ZjxlNewsCenterService newsCenterService;
    @RequestMapping(value = "/findNewsCenterById", method = RequestMethod.GET)
    @ApiOperation(value = "查看CompanyCase")
    public String findNewsCenterById(@ApiParam(name = "id", value = "companyId", required = false) @RequestParam(value = "id", required = false)String id,
                                      @ApiParam(name = "name", value = "companyName", required = false) @RequestParam(value = "name", required = false)String name,
                                      @ApiParam(name = "pageNo", value = "第几页", defaultValue = "1") @RequestParam(value = "pageNo", required = false) Integer pageNo,
                                      @ApiParam(name = "pageSize", value = "分页大小", defaultValue = "10") @RequestParam(value = "pageSize", required = false) Integer pageSize){
        try {
            List<ZjxlNewsCenter> newsCenterList = newsCenterService.findById(id,pageNo-1,pageSize);
            return write(200,"查询成功","data", PageUtil.getPage(newsCenterList,pageNo,pageSize,newsCenterService.allCount()));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"查询失败");
        }
    }
}

+ 48 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/ZjxlPartnerController.java

@ -15,6 +15,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
/***
@ -57,10 +60,23 @@ public class ZjxlPartnerController extends BaseController {
                             @ApiParam(name = "partnerIsLine", value = "是否上线", required = false, defaultValue = "0") @RequestParam(value = "partnerIsLine", required = false)Integer partnerIsLine){
        try {
            ZjxlPartner partner = new ZjxlPartner();
            List<ZjxlPartner> partners = partnerService.findAll();
            Iterator iterator = partners.iterator();
            while (iterator.hasNext()){
                if (partnerName.equals(iterator.next())){
                    return write(-1,"该合作伙伴已存在");
                }
            }
            partner.setPartnerName(partnerName);
            partner.setPartnerImg(partnerImg);
            partner.setPartnerSort(partnerSort);
            partner.setPartnerIsLine(partnerIsLine);
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
            partner.setPartnerCreateTime(df.format(new Date()));// new Date()为获取当前系统时间
            return write(200,"添加成功","data",partnerService.addPartenr(partner));
        }catch (Exception e){
            e.printStackTrace();
@ -97,4 +113,36 @@ public class ZjxlPartnerController extends BaseController {
            return write(-1,"删除失败");
        }
    }
    @RequestMapping(value = "/updatePartenr", method = RequestMethod.POST)
    @ApiOperation(value = "编辑合作伙伴")
    public String updatePartenr(@ApiParam(name = "partnerId", value = "合作伙伴id", required = false) @RequestParam(value = "partnerId", required = false)String partnerId,
                                @ApiParam(name = "partnerName", value = "合作伙伴名称", required = false) @RequestParam(value = "partnerName", required = false)String partnerName,
                                @ApiParam(name = "partnerImg", value = "合作伙伴图片", required = false) @RequestParam(value = "partnerImg", required = false)String partnerImg,
                                @ApiParam(name = "partnerSort", value = "排序", required = false) @RequestParam(value = "partnerSort", required = false)Integer partnerSort,
                                @ApiParam(name = "partnerIsLine", value = "是否上线", required = false, defaultValue = "0") @RequestParam(value = "partnerIsLine", required = false)Integer partnerIsLine){
        try {
            ZjxlPartner partner = new ZjxlPartner();
            partner.setPartnerId(partnerId);
            List<ZjxlPartner> partners = partnerService.findAll();
            Iterator iterator = partners.iterator();
            while (iterator.hasNext()){
                if (partnerName.equals(iterator.next())){
                    return write(-1,"该合作伙伴已存在");
                }
            }
            partner.setPartnerName(partnerName);
            partner.setPartnerImg(partnerImg);
            partner.setPartnerSort(partnerSort);
            partner.setPartnerIsLine(partnerIsLine);
            return write(200,"添加成功","data",partnerService.updatePartenr(partner));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"添加失败");
        }
    }
}

+ 28 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/cnotroller/ZjxlSystemDictController.java

@ -15,6 +15,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/***
@ -60,10 +62,23 @@ public class ZjxlSystemDictController extends BaseController {
        try {
            ZjxlSystemDict systemDict = new ZjxlSystemDict();
            systemDict.setSystemDictType(systemDictType);
            //查询分类是否存在
            int systemDictClassifyList = systemDictService.findSystemDictClassify(systemDictClassify);
            //查询子分类是否存在
            int systemDictSubclassifyList = systemDictService.findSystemDictSubclassify(systemDictSubclassify);
            if (systemDictClassifyList>0){
                return write(-1,"该分类已存在,请勿重复添加");
            }
            if (systemDictSubclassifyList>0){
                return write(-1,"该子分类已存在,请勿重复添加");
            }
            systemDict.setSystemDictClassify(systemDictClassify);
            systemDict.setSystemDictSubclassify(systemDictSubclassify);
            systemDict.setSystemDictSort(systemDictSort);
            systemDict.setSystemDictIsLine(systemDictIsLine);
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
            systemDict.setSystemDictCreateTime(df.format(new Date()));// new Date()为获取当前系统时间
            return write(200,"添加成功","data",systemDictService.addSystemDict(systemDict));
        }catch (Exception e){
            e.printStackTrace();
@ -101,4 +116,17 @@ public class ZjxlSystemDictController extends BaseController {
            return write(-1,"修改上线失败");
        }
    }
    @RequestMapping(value = "/findNewsType", method = RequestMethod.GET)
    @ApiOperation("查询新闻中心分类")
    public String findNewsType( @ApiParam(name = "systemDictType", value = "类型 1-产品与服务  2-公司案例  3-新闻中心  4-关于我们", required = false) @RequestParam(value = "systemDictType", required = false)Integer systemDictType){
        try {
            List<ZjxlSystemDict> systemDictList = systemDictService.findNewsType(systemDictType);
            return write(200,"查询成功","data", systemDictList);
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"查询失败");
        }
    }
}

+ 4 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/dao/ZjxlBasicInfoDao.java

@ -1,5 +1,6 @@
package cn.stylefeng.guns.zjxl.dao;
import cn.stylefeng.guns.zjxl.model.ZjxlBanner;
import cn.stylefeng.guns.zjxl.model.ZjxlBasicInfo;
import cn.stylefeng.guns.zjxl.model.ZjxlPartner;
import org.hibernate.metamodel.model.convert.spi.JpaAttributeConverter;
@ -24,4 +25,7 @@ public interface ZjxlBasicInfoDao extends PagingAndSortingRepository<ZjxlBasicIn
    @Query("delete from ZjxlBasicInfo p where p.basicInfoId = ?1")
    int deleteById(String id);
    @Query("select p from ZjxlBasicInfo p where p.basicInfoId = ?1")
    ZjxlBasicInfo findById(String id);
}

+ 17 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/dao/ZjxlNewsCenterDao.java

@ -0,0 +1,17 @@
package cn.stylefeng.guns.zjxl.dao;
import cn.stylefeng.guns.zjxl.model.ZjxlNewsCenter;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/***
 * @ClassName: ZjxlNewsCenterDao
 * @Description:
 * @Auther: shi kejing
 * @Date: 2020/11/17 14:17
 */
public interface ZjxlNewsCenterDao extends PagingAndSortingRepository<ZjxlNewsCenter, Long>, JpaSpecificationExecutor<ZjxlNewsCenter> {
}

+ 18 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/model/ZjxlArticleContent.java

@ -22,6 +22,8 @@ public class ZjxlArticleContent {
    private String articleContentSubclassify;
    private Integer articleContentSort;
    private Integer articleContentIsLine;
    private String articleContentCreateTime;
    private String articleContentContent;
    @Id
    public String getArticleContentId() {
@ -95,4 +97,20 @@ public class ZjxlArticleContent {
    public void setArticleContentIsLine(Integer articleContentIsLine) {
        this.articleContentIsLine = articleContentIsLine;
    }
    public String getArticleContentCreateTime() {
        return articleContentCreateTime;
    }
    public void setArticleContentCreateTime(String articleContentCreateTime) {
        this.articleContentCreateTime = articleContentCreateTime;
    }
    public String getArticleContentContent() {
        return articleContentContent;
    }
    public void setArticleContentContent(String articleContentContent) {
        this.articleContentContent = articleContentContent;
    }
}

+ 10 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/model/ZjxlBanner.java

@ -30,6 +30,8 @@ public class ZjxlBanner {
    private Integer bannerIsLine;
    private String bannerCreateTime;
    @Id
    public String getBannerId() {
        return bannerId;
@ -86,4 +88,12 @@ public class ZjxlBanner {
    public void setBannerIsLine(Integer bannerIsLine) {
        this.bannerIsLine = bannerIsLine;
    }
    public String getBannerCreateTime() {
        return bannerCreateTime;
    }
    public void setBannerCreateTime(String bannerCreateTime) {
        this.bannerCreateTime = bannerCreateTime;
    }
}

+ 9 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/model/ZjxlBasicInfo.java

@ -19,6 +19,7 @@ public class ZjxlBasicInfo {
    private String basicInfoEmail;
    private String basicInfoRecord;//备案信息
    private String basicInfoQrcode;//二维码
    private String basicInfoCreateTime;
    @Id
    public String getBasicInfoId() {
@ -68,4 +69,12 @@ public class ZjxlBasicInfo {
    public void setBasicInfoQrcode(String basicInfoQrcode) {
        this.basicInfoQrcode = basicInfoQrcode;
    }
    public String getBasicInfoCreateTime() {
        return basicInfoCreateTime;
    }
    public void setBasicInfoCreateTime(String basicInfoCreateTime) {
        this.basicInfoCreateTime = basicInfoCreateTime;
    }
}

+ 16 - 6
guns-main/src/main/java/cn/stylefeng/guns/zjxl/model/ZjxlCompanyCase.java

@ -28,12 +28,14 @@ public class ZjxlCompanyCase {
    private String companyJumpUrl;
    private int companySort;
    private Integer companySort;
    private int companyIsLine;
    private Integer companyIsLine;
    private String companyTestBannerId;
    private String companyCreateTime;
    @Id
    public String getCompanyId() {
        return companyId;
@ -91,19 +93,19 @@ public class ZjxlCompanyCase {
        this.companyJumpUrl = companyJumpUrl;
    }
    public int getCompanySort() {
    public Integer getCompanySort() {
        return companySort;
    }
    public void setCompanySort(int companySort) {
    public void setCompanySort(Integer companySort) {
        this.companySort = companySort;
    }
    public int getCompanyIsLine() {
    public Integer getCompanyIsLine() {
        return companyIsLine;
    }
    public void setCompanyIsLine(int companyIsLine) {
    public void setCompanyIsLine(Integer companyIsLine) {
        this.companyIsLine = companyIsLine;
    }
@ -114,4 +116,12 @@ public class ZjxlCompanyCase {
    public void setCompanyTestBannerId(String companyTestBannerId) {
        this.companyTestBannerId = companyTestBannerId;
    }
    public String getCompanyCreateTime() {
        return companyCreateTime;
    }
    public void setCompanyCreateTime(String companyCreateTime) {
        this.companyCreateTime = companyCreateTime;
    }
}

+ 89 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/model/ZjxlNewsCenter.java

@ -0,0 +1,89 @@
package cn.stylefeng.guns.zjxl.model;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/***
 * @ClassName: ZjxlNewsCenter
 * @Description: 官网主页新闻中心
 * @Auther: shi kejing
 * @Date: 2020/11/17 14:13
 */
@Entity
@Table(name = "zjxl_news_center")
public class ZjxlNewsCenter {
    private String newsCenterId;
    private String newsCenterTitle;
    private String newsCenterAbstract;
    private String newsCenterContent;
    private String newsCenterImage;
    private String newsCenterUrl;
    private String newsCenterCreateTime;
    private String newsCenterSort;
    @Id
    public String getNewsCenterId() {
        return newsCenterId;
    }
    public void setNewsCenterId(String newsCenterId) {
        this.newsCenterId = newsCenterId;
    }
    public String getNewsCenterTitle() {
        return newsCenterTitle;
    }
    public void setNewsCenterTitle(String newsCenterTitle) {
        this.newsCenterTitle = newsCenterTitle;
    }
    public String getNewsCenterAbstract() {
        return newsCenterAbstract;
    }
    public void setNewsCenterAbstract(String newsCenterAbstract) {
        this.newsCenterAbstract = newsCenterAbstract;
    }
    public String getNewsCenterContent() {
        return newsCenterContent;
    }
    public void setNewsCenterContent(String newsCenterContent) {
        this.newsCenterContent = newsCenterContent;
    }
    public String getNewsCenterImage() {
        return newsCenterImage;
    }
    public void setNewsCenterImage(String newsCenterImage) {
        this.newsCenterImage = newsCenterImage;
    }
    public String getNewsCenterUrl() {
        return newsCenterUrl;
    }
    public void setNewsCenterUrl(String newsCenterUrl) {
        this.newsCenterUrl = newsCenterUrl;
    }
    public String getNewsCenterCreateTime() {
        return newsCenterCreateTime;
    }
    public void setNewsCenterCreateTime(String newsCenterCreateTime) {
        this.newsCenterCreateTime = newsCenterCreateTime;
    }
    public String getNewsCenterSort() {
        return newsCenterSort;
    }
    public void setNewsCenterSort(String newsCenterSort) {
        this.newsCenterSort = newsCenterSort;
    }
}

+ 9 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/model/ZjxlPartner.java

@ -18,6 +18,7 @@ public class ZjxlPartner {
    private String partnerImg;
    private Integer partnerSort;
    private Integer partnerIsLine;
    private String partnerCreateTime;
    @Id
    public String getPartnerId() {
@ -59,4 +60,12 @@ public class ZjxlPartner {
    public void setPartnerIsLine(Integer partnerIsLine) {
        this.partnerIsLine = partnerIsLine;
    }
    public String getPartnerCreateTime() {
        return partnerCreateTime;
    }
    public void setPartnerCreateTime(String partnerCreateTime) {
        this.partnerCreateTime = partnerCreateTime;
    }
}

+ 9 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/model/ZjxlSystemDict.java

@ -19,6 +19,7 @@ public class ZjxlSystemDict {
    private String systemDictSubclassify;
    private Integer systemDictSort;
    private Integer systemDictIsLine;
    private String systemDictCreateTime;
    @Id
    public String getSystemDictId() {
@ -68,4 +69,12 @@ public class ZjxlSystemDict {
    public void setSystemDictIsLine(Integer systemDictIsLine) {
        this.systemDictIsLine = systemDictIsLine;
    }
    public String getSystemDictCreateTime() {
        return systemDictCreateTime;
    }
    public void setSystemDictCreateTime(String systemDictCreateTime) {
        this.systemDictCreateTime = systemDictCreateTime;
    }
}

+ 70 - 1
guns-main/src/main/java/cn/stylefeng/guns/zjxl/service/ZjxlArticleContentService.java

@ -3,12 +3,14 @@ package cn.stylefeng.guns.zjxl.service;
import cn.stylefeng.guns.zjxl.dao.ZjxlArticleContentDao;
import cn.stylefeng.guns.zjxl.model.ZjxlArticleContent;
import cn.stylefeng.guns.zjxlUtil.BaseService;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@ -39,7 +41,7 @@ public class ZjxlArticleContentService extends BaseService {
        if (systemDictType != null && systemDictType > 0){
            sql += " and article_content_type = "+systemDictType+"";
        }
        sql += " order by article_content_sort desc limit "+page+" , "+pagesiz+"";
        sql += " order by concat(article_content_sort,article_content_create_time) desc limit "+page+" , "+pagesiz+"";
        List<ZjxlArticleContent> articleContentList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ZjxlArticleContent.class));
        return articleContentList;
    }
@ -65,4 +67,71 @@ public class ZjxlArticleContentService extends BaseService {
        articleContentDao.updateByArticleContentId(id, isLine);
        return 1;
    }
    public List<ZjxlArticleContent> getLeftTabs(String articleContentType){
        String sql = "select * from zjxl_article_content where article_content_type = "+articleContentType+" group by article_content_classify,article_content_subclassify";
        List<ZjxlArticleContent> articleContentList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ZjxlArticleContent.class));
        return articleContentList;
    }
    public List<ZjxlArticleContent> getArticleContentSubclassify(String articleContentType,String articleContentClassify){
        String sql = "select * from zjxl_article_content where article_content_type = "+articleContentType+" and article_content_classify = '"+articleContentClassify+"' group by article_content_subclassify";
        List<ZjxlArticleContent> articleContentList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ZjxlArticleContent.class));
        return articleContentList;
    }
    public List<ZjxlArticleContent> getArticleContent(String articleContentType,String articleContentClassify,String articleContentSubclassify){
        String sql = "select * from zjxl_article_content where article_content_type = "+articleContentType+" and article_content_classify = '"+articleContentClassify+"' and article_content_subclassify = '"+articleContentSubclassify+"' order by concat(article_content_sort,article_content_create_time) desc limit 1";
        List<ZjxlArticleContent> articleContentList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ZjxlArticleContent.class));
        return articleContentList;
    }
    public List<ZjxlArticleContent> findNewsList(String id,String articleContentClassify,String articleContentSubclassify,Integer systemDictType,Integer page,Integer pagesiz){
        String sql = "select * from zjxl_article_content where 1=1 ";
        if (StringUtils.isNotEmpty(id)){
            sql += " and article_content_id = '"+id+"'";
        }
        if (StringUtils.isNotEmpty(articleContentClassify)){
            sql += " and article_content_classify = '"+articleContentClassify+"'";
        }
        if (StringUtils.isNotEmpty(articleContentSubclassify)){
            sql += " and article_content_subclassify = '"+articleContentSubclassify+"'";
        }
        if (systemDictType != null && systemDictType > 0){
            sql += " and article_content_type = "+systemDictType+"";
        }
        sql += " order by article_content_sort,article_content_create_time desc limit "+page+" , "+pagesiz+"";
        List<ZjxlArticleContent> articleContentList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ZjxlArticleContent.class));
        return articleContentList;
    }
    public int allNewsCount(String articleContentClassify,String articleContentSubclassify){
        String sql = "select count(*) from zjxl_article_content where article_content_type = 3 ";
        if (StringUtils.isNotEmpty(articleContentClassify)){
            sql += " and article_content_classify = '"+articleContentClassify+"'";
        }
        if (StringUtils.isNotEmpty(articleContentSubclassify)){
            sql += " and article_content_subclassify = '"+articleContentSubclassify+"'";
        }
        Integer allCount = jdbcTemplate.queryForObject(sql, Integer.class);;
        return allCount;
    }
    public List<ZjxlArticleContent> findArticleContentById(String id){
        String sql = "select * from zjxl_article_content where article_content_id = '"+id+"'";
        List<ZjxlArticleContent> articleContentList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ZjxlArticleContent.class));
        return articleContentList;
    }
    public List<ZjxlArticleContent> findArticleAll(String articleContentType){
        String sql = "select * from zjxl_article_content where article_content_is_line = 1";
        if (StringUtils.isNotEmpty(articleContentType)){
            sql += " and article_content_type = '"+articleContentType+"'";
        }
        sql += " order by concat(article_content_sort,article_content_create_time) desc ";
        List<ZjxlArticleContent> articleContentList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ZjxlArticleContent.class));
        return articleContentList;
    }
}

+ 43 - 1
guns-main/src/main/java/cn/stylefeng/guns/zjxl/service/ZjxlBannerService.java

@ -1,9 +1,11 @@
package cn.stylefeng.guns.zjxl.service;
import cn.stylefeng.guns.zjxl.dao.ZjxlBannerDao;
import cn.stylefeng.guns.zjxl.model.ZjxlArticleContent;
import cn.stylefeng.guns.zjxl.model.ZjxlBanner;
import cn.stylefeng.guns.zjxl.model.ret.BannerCompanyCaseRet;
import cn.stylefeng.guns.zjxlUtil.BaseService;
import com.alibaba.fastjson.JSONObject;
import io.swagger.models.auth.In;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -41,7 +43,7 @@ public class ZjxlBannerService extends BaseService {
        if (StringUtils.isNotEmpty(name)){
            sql += " AND banner_name LIKE '%"+name+"%'";
        }
        sql += " ORDER BY banner_sort DESC LIMIT "+page+" , "+pagesize+" ";
        sql += " ORDER BY concat(banner_sort,banner_create_time) DESC LIMIT "+page+" , "+pagesize+" ";
        List<ZjxlBanner> bannerList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(ZjxlBanner.class));
       return bannerList;
    }
@ -66,10 +68,50 @@ public class ZjxlBannerService extends BaseService {
        return bannerDao.updateIsLine(id,isLine);
    }
    public int updateBanner(ZjxlBanner banner){
        String sql = "update zjxl_banner SET banner_id = '"+banner.getBannerId()+"'";
        if (StringUtils.isNotEmpty(banner.getBannerImage())){
            sql += ",banner_image = '"+banner.getBannerImage()+"'";
        }
        if (banner.getBannerType() != null){
            sql += ",banner_type = "+banner.getBannerType()+"";
        }
        if (banner.getBannerSort() != null){
            sql += ",banner_sort = "+banner.getBannerSort()+"";
        }
        if (StringUtils.isNotEmpty(banner.getBannerName())){
            sql += ",banner_name = '"+banner.getBannerName()+"'";
        }
        if (banner.getBannerIsLine() != null){
            sql += ",banner_is_line = "+banner.getBannerIsLine()+"";
        }
        sql += " where banner_id = '"+banner.getBannerId()+"'";
        int update = jdbcTemplate.update(sql);
        return update;
    }
    public List<BannerCompanyCaseRet> finfBannerCompanyCaseById(String id){
        String sql = "SELECT * FROM zjxl_banner b, zjxl_company_case cc WHERE b.banner_id = '"+id+"' AND b.banner_id = cc.test_banner_id";
        List<BannerCompanyCaseRet> caseRet = jdbcTemplate.query(sql, new BeanPropertyRowMapper(BannerCompanyCaseRet.class));
        return caseRet;
    }
    public List<ZjxlBanner> findBannerByIsOnLine(Integer page,Integer pagesize){
        String sql = "SELECT * FROM `guns-separation`.zjxl_banner WHERE banner_is_line=1";
        sql += " ORDER BY concat(banner_sort,banner_create_time) DESC  ";
        List<ZjxlBanner> bannerList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(ZjxlBanner.class));
        return bannerList;
    }
    public int getIsOnLineCount(){
        String sql = "select count(*) from zjxl_banner WHERE banner_is_line=1";
        Integer allCount = jdbcTemplate.queryForObject(sql, Integer.class);;
        return allCount;
    }
    public List<ZjxlBanner> findBannerAll(){
        String sql = "SELECT * FROM `guns-separation`.zjxl_banner WHERE banner_is_line=1";
        List<ZjxlBanner> bannerList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(ZjxlBanner.class));
        return bannerList;
    }
}

+ 5 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/service/ZjxlBasicInfoService.java

@ -30,4 +30,9 @@ public class ZjxlBasicInfoService extends BaseService {
        ZjxlBasicInfo info = basicInfoDao.save(basicInfo);
        return info.getBasicInfoId();
    }
    public ZjxlBasicInfo findBasicInfo(String basicInfoId){
        ZjxlBasicInfo info = basicInfoDao.findById(basicInfoId);
        return info;
    }
}

+ 38 - 2
guns-main/src/main/java/cn/stylefeng/guns/zjxl/service/ZjxlCompanyCaseService.java

@ -35,9 +35,9 @@ public class ZjxlCompanyCaseService extends BaseService {
            sql += " and company_id = '"+id+"'";
        }
        if (StringUtils.isNotEmpty(name)){
            sql += " and company_name = '"+name+"'";
            sql += " and company_name like '%"+name+"%'";
        }
        sql += " order by company_sort desc limit "+page+" , "+pagesize+"";
        sql += " order by concat(company_sort,company_create_time) desc limit "+page+" , "+pagesize+"";
        List<ZjxlCompanyCase> companyCaseList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ZjxlCompanyCase.class));
        return companyCaseList;
    }
@ -48,12 +48,48 @@ public class ZjxlCompanyCaseService extends BaseService {
        return allCount;
    }
    public List<ZjxlCompanyCase> findAll(){
        String sql = "select * from zjxl_company_case where company_is_line = 1";
        List<ZjxlCompanyCase> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(ZjxlCompanyCase.class));
        return list;
    }
    public String addCompanyCase(ZjxlCompanyCase companyCase){
        companyCase.setCompanyId(getCode());
        ZjxlCompanyCase companyCase1 = companyCaseDao.save(companyCase);
        return companyCase1.getCompanyId();
    }
    public int updateCompanyCase(ZjxlCompanyCase cc){
        String sql = "update zjxl_company_case SET company_id = '"+cc.getCompanyId()+"'";
        if (StringUtils.isNotEmpty(cc.getCompanyName())){
            sql += " , set company_name = "+cc.getCompanyName()+" ";
        }
        if (StringUtils.isNotEmpty(cc.getCompanyDescribe())){
            sql += " , set company_describe = "+cc.getCompanyDescribe()+" ";
        }
        if (StringUtils.isNotEmpty(cc.getCompanyDefaultImg())){
            sql += " , set company_default_img = "+cc.getCompanyDefaultImg()+" ";
        }
        if (StringUtils.isNotEmpty(cc.getCompanyExchangeImg())){
            sql += " , set company_exchange_img = "+cc.getCompanyExchangeImg()+" ";
        }
        if (StringUtils.isNotEmpty(cc.getCompanyAssociatedCase())){
            sql += " , set company_associated_case = "+cc.getCompanyAssociatedCase()+" ";
        }
        if (StringUtils.isNotEmpty(cc.getCompanyJumpUrl())){
            sql += " , set company_jump_url = "+cc.getCompanyJumpUrl()+" ";
        }
        if (cc.getCompanySort() != null){
            sql += " , set company_sort = "+cc.getCompanySort()+" ";
        }
        if (cc.getCompanyIsLine() != null){
            sql += " , set company_is_line = "+cc.getCompanyIsLine()+" ";
        }
        int update = jdbcTemplate.update(sql);
        return update;
    }
    public int deleteCompanyCase(String id){
        companyCaseDao.deleteById(id);
        return 1;

+ 47 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxl/service/ZjxlNewsCenterService.java

@ -0,0 +1,47 @@
package cn.stylefeng.guns.zjxl.service;
import cn.stylefeng.guns.zjxl.dao.ZjxlNewsCenterDao;
import cn.stylefeng.guns.zjxl.model.ZjxlCompanyCase;
import cn.stylefeng.guns.zjxl.model.ZjxlNewsCenter;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/***
 * @ClassName: ZjxlNewsCenterService
 * @Description:
 * @Auther: shi kejing
 * @Date: 2020/11/17 14:18
 */
@Component
@Transactional(rollbackFor = Exception.class)
public class ZjxlNewsCenterService {
    @Autowired
    JdbcTemplate jdbcTemplate;
    @Autowired
    private ZjxlNewsCenterDao newsCenterDao;
    public List<ZjxlNewsCenter> findById(String id, Integer page, Integer pagesize){
        String sql = "select a.* from zjxl_news_center a where 1=1";
        if (StringUtils.isNotEmpty(id)){
            sql += " and news_center_id = '"+id+"'";
        }
        sql += " order by news_center_sort desc limit "+page+" , "+pagesize+"";
        List<ZjxlNewsCenter> companyCaseList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ZjxlNewsCenter.class));
        return companyCaseList;
    }
    public int allCount(){
        String sql = "select count(*) from zjxl_news_center ";
        Integer allCount = jdbcTemplate.queryForObject(sql, Integer.class);;
        return allCount;
    }
}

+ 26 - 1
guns-main/src/main/java/cn/stylefeng/guns/zjxl/service/ZjxlPartnerService.java

@ -1,6 +1,7 @@
package cn.stylefeng.guns.zjxl.service;
import cn.stylefeng.guns.zjxl.dao.ZjxlPartnerDao;
import cn.stylefeng.guns.zjxl.model.ZjxlBanner;
import cn.stylefeng.guns.zjxl.model.ZjxlPartner;
import cn.stylefeng.guns.zjxlUtil.BaseService;
import org.apache.commons.lang3.StringUtils;
@ -36,7 +37,7 @@ public class ZjxlPartnerService extends BaseService {
        if (StringUtils.isNotEmpty(name)){
            sql += " and partner_name like '%"+name+"%'";
        }
        sql += " order by partner_sort desc limit "+page+" , "+pagesize+"";
        sql += " order by concat(partner_sort,partner_create_time) desc limit "+page+" , "+pagesize+"";
        List<ZjxlPartner> partnerList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ZjxlPartner.class));
        return partnerList;
    }
@ -53,6 +54,30 @@ public class ZjxlPartnerService extends BaseService {
        return p.getPartnerId();
    }
    public int updatePartenr(ZjxlPartner partner){
        String sql = "update zjxl_partner SET partner_id = '"+partner.getPartnerId()+"'";
        if (StringUtils.isNotEmpty(partner.getPartnerName())){
            sql += " , set partner_name = "+partner.getPartnerName()+" ";
        }
        if (StringUtils.isNotEmpty(partner.getPartnerImg())){
            sql += " , set partner_img = "+partner.getPartnerImg()+" ";
        }
        if (partner.getPartnerSort() != null){
            sql += " , set partner_sort = "+partner.getPartnerSort()+" ";
        }
        if (partner.getPartnerIsLine() != null){
            sql += " , set partner_is_line = "+partner.getPartnerIsLine()+" ";
        }
        int update = jdbcTemplate.update(sql);
        return update;
    }
    public List<ZjxlPartner> findAll(){
        String sql = "select * from zjxl_partner where partner_is_line = 1";
        List<ZjxlPartner> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(ZjxlPartner.class));
        return list;
    }
    public int updatePartner(String id, Integer isLine){
        partnerDao.updatePartner(id,isLine);
        return 1;

+ 26 - 1
guns-main/src/main/java/cn/stylefeng/guns/zjxl/service/ZjxlSystemDictService.java

@ -1,6 +1,7 @@
package cn.stylefeng.guns.zjxl.service;
import cn.stylefeng.guns.zjxl.dao.ZjxlSystemDictDao;
import cn.stylefeng.guns.zjxl.model.ZjxlArticleContent;
import cn.stylefeng.guns.zjxl.model.ZjxlSystemDict;
import cn.stylefeng.guns.zjxlUtil.BaseService;
import org.apache.commons.lang3.StringUtils;
@ -33,6 +34,19 @@ public class ZjxlSystemDictService extends BaseService {
        return dict.getSystemDictId();
    }
    public int findSystemDictClassify(String systemDictClassify){
        String sql = "select count(1) from zjxl_system_dict where system_dict_classify = '"+systemDictClassify+"' ";
        Integer articleContentList = jdbcTemplate.queryForObject(sql, Integer.class);
        return articleContentList;
    }
    public int findSystemDictSubclassify(String systemDictSubclassify){
        String sql = "select count(1) from zjxl_system_dict where system_dict_subclassify = '"+systemDictSubclassify+"' ";
        Integer articleContentList = jdbcTemplate.queryForObject(sql, Integer.class);
        return articleContentList;
    }
    public List<ZjxlSystemDict> findSystemDictById(String id,Integer systemDictType,Integer page,Integer pagesize){
        String sql = "select * from zjxl_system_dict where 1=1 ";
        if (StringUtils.isNotEmpty(id)){
@ -41,7 +55,7 @@ public class ZjxlSystemDictService extends BaseService {
        if (systemDictType != null && systemDictType > 0){
            sql += " and system_dict_type = "+systemDictType+"";
        }
        sql += " order by system_dict_sort desc limit "+page+" , "+pagesize+"";
        sql += " order by concat(system_dict_sort,system_dict_create_time) desc limit "+page+" , "+pagesize+"";
        List<ZjxlSystemDict> systemDictList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ZjxlSystemDict.class));
        return systemDictList;
    }
@ -61,4 +75,15 @@ public class ZjxlSystemDictService extends BaseService {
        systemDictDao.deleteBySystemDictId(id);
        return 1;
    }
    public List<ZjxlSystemDict> findNewsType(Integer systemDictType){
        String sql = "select * from zjxl_system_dict where 1=1 ";
        if (systemDictType != null && systemDictType > 0){
            sql += " and system_dict_type = "+systemDictType+"";
        }
        sql += " group by system_dict_classify ";
        List<ZjxlSystemDict> systemDictList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ZjxlSystemDict.class));
        return systemDictList;
    }
}

+ 150 - 0
guns-main/src/main/java/cn/stylefeng/guns/zjxlUtil/DesUtil.java

@ -0,0 +1,150 @@
package cn.stylefeng.guns.zjxlUtil;
import java.io.IOException;
import java.security.SecureRandom;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
/***
 * @ClassName: DesUtil
 * @Description: des加密解密方法
 * @Auther: shi kejing
 * @Date: 2020/11/20 11:37
 */
public class DesUtil {
    private final static String DES = "DES";
    private final static String ENCODE = "GBK";
    private final static String defaultKey = "abcdefghijklmnopqrstuvwxyz0123456789";
    public static void main(String[] args) throws Exception {
        String data = "123456";
        System.out.println(encrypt(data));
        System.out.println(decrypt(encrypt(data)));
    }
    /**
     * 使用 默认key 加密
     * @return String
     */
    public static String encrypt(String data) throws Exception {
        byte[] bt = encrypt(data.getBytes(ENCODE), defaultKey.getBytes(ENCODE));
        String strs = new BASE64Encoder().encode(bt);
        return strs;
    }
    /**
     * 使用 默认key 解密
     * @return String
     */
    public static String decrypt(String data) throws IOException, Exception {
        if (data == null) {
            return null;
        }
        BASE64Decoder decoder = new BASE64Decoder();
        byte[] buf = decoder.decodeBuffer(data);
        byte[] bt = decrypt(buf, defaultKey.getBytes(ENCODE));
        return new String(bt, ENCODE);
    }
    /**
     * Description 根据键值进行加密
     *
     * @param data
     * @param key
     *            加密键byte数组
     * @return
     * @throws Exception
     */
    public static String encrypt(String data, String key) throws Exception {
        byte[] bt = encrypt(data.getBytes(ENCODE), defaultKey.getBytes(ENCODE));
        String strs = new BASE64Encoder().encode(bt);
        return strs;
    }
    /**
     * Description 根据键值进行解密
     *
     * @param data
     * @param key
     *            加密键byte数组
     * @return
     * @throws IOException
     * @throws Exception
     */
    public static String decrypt(String data, String key) throws IOException,
            Exception {
        if (data == null) {
            return null;
        }
        BASE64Decoder decoder = new BASE64Decoder();
        byte[] buf = decoder.decodeBuffer(data);
        byte[] bt = decrypt(buf, key.getBytes(ENCODE));
        return new String(bt, ENCODE);
    }
    /**
     * Description 根据键值进行加密
     *
     * @param data
     * @param key
     *            加密键byte数组
     * @return
     * @throws Exception
     */
    private static byte[] encrypt(byte[] data, byte[] key) throws Exception {
        // 生成一个可信任的随机数源
        SecureRandom sr = new SecureRandom();
        // 从原始密钥数据创建DESKeySpec对象
        DESKeySpec dks = new DESKeySpec(key);
        // 创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象
        SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
        SecretKey securekey = keyFactory.generateSecret(dks);
        // Cipher对象实际完成加密操作
        Cipher cipher = Cipher.getInstance(DES);
        // 用密钥初始化Cipher对象
        cipher.init(Cipher.ENCRYPT_MODE, securekey, sr);
        return cipher.doFinal(data);
    }
    /**
     * Description 根据键值进行解密
     *
     * @param data
     * @param key
     *            加密键byte数组
     * @return
     * @throws Exception
     */
    private static byte[] decrypt(byte[] data, byte[] key) throws Exception {
        // 生成一个可信任的随机数源
        SecureRandom sr = new SecureRandom();
        // 从原始密钥数据创建DESKeySpec对象
        DESKeySpec dks = new DESKeySpec(key);
        // 创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象
        SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
        SecretKey securekey = keyFactory.generateSecret(dks);
        // Cipher对象实际完成解密操作
        Cipher cipher = Cipher.getInstance(DES);
        // 用密钥初始化Cipher对象
        cipher.init(Cipher.DECRYPT_MODE, securekey, sr);
        return cipher.doFinal(data);
    }
}

+ 68 - 9
guns-main/src/main/java/cn/stylefeng/guns/zjxlUtil/FastDFSClientPool.java

@ -1,11 +1,16 @@
package cn.stylefeng.guns.zjxlUtil;
import org.apache.commons.io.FileUtils;
import org.csource.fastdfs.ClientGlobal;
import org.csource.fastdfs.StorageClient;
import org.csource.fastdfs.TrackerClient;
import org.csource.fastdfs.TrackerServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
@ -15,26 +20,79 @@ import java.util.Map.Entry;
 */
public class FastDFSClientPool {
    private static volatile FastDFSClientPool pool;
    private Logger logger = (Logger) LoggerFactory.getLogger(FastDFSClientPool.class);
    private Map<StorageClient, Boolean> map;
    private int maxPoolSize = 20;
    private int waitTime = 500;
    private int initPoolSize = 5;
    static {
    {
        try {
            
            String basePath = FastDFSClientPool.class.getResource("/").getPath();
           
            ClientGlobal.init(FastDFSUtil.class.getResource("/config/fdfs_client.conf").getPath());
            String basePath = FastDFSClientPool.class.getResource("/").getPath();
    //        ClientGlobal.init("/data/guns-separation/config/fdfs_client.conf");//测试环境固定使用
            Resource resource = new ClassPathResource("/config/fdfs_client.conf");
            InputStream inputStream = resource.getInputStream();
            long time = System.currentTimeMillis();
            String pathName = time + "fdfs_client.conf";
            File file = new File(pathName);
            try {
                //将读取到的类容存储到临时文件中,后面就可以用这个临时文件访问了
                FileUtils.copyInputStreamToFile(inputStream,file);
            } catch (IOException e) {
                e.printStackTrace();
            }
            System.out.println("********************************************************"+file.getName());
            ClientGlobal.init(file.getName());//
            deleteFolder(file);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    public static void deleteFolder(File folder){
        File[] files  = folder.listFiles();
        if (files != null){
            for(File f: files){
                if (f.isDirectory()){
                    deleteFolder(f);
                }else {
                    f.delete();
                }
            }
        }
        folder.delete();
    }
    public  String readfile(String file){
        InputStream stream = this.getClass().getResourceAsStream(file);
        StringBuffer sb = new StringBuffer() ;
        BufferedReader br = null ;
        try {
            br = new BufferedReader(new InputStreamReader(stream,"UTF-8")) ;
            String s=null ;
            while((s=br.readLine()) !=null){
                sb.append(s) ;
            }
            br.close();
        } catch (FileNotFoundException e) {
            logger.error("FileNotFoundException:"+e);
        } catch (IOException e) {
            logger.error("IOException :"+e);
        } finally {
            if(br !=null){
                try {
                    br.close();
                } catch (IOException e) {
                    logger.error("close br error:"+e);
                }
            }
        }
        return sb.toString();
    }
    private FastDFSClientPool() {
        init();
@ -81,8 +139,9 @@ public class FastDFSClientPool {
    private StorageClient getNewStorageClient() {
        try {
            TrackerClient tracker = new TrackerClient();
            logger.info("FastDFSClientPool→tracker==="+tracker);
            TrackerServer trackerServer = tracker.getConnection();
            logger.info("FastDFSClientPool→trackerServer   ===   "+trackerServer);
            StorageClient client = new StorageClient(trackerServer, null);
            return client;
        } catch (Exception e) {

+ 4 - 1
guns-main/src/main/java/cn/stylefeng/guns/zjxlUtil/FastDFSUtil.java

@ -15,6 +15,8 @@ import org.csource.fastdfs.ProtoCommon;
import org.csource.fastdfs.StorageClient;
import org.csource.fastdfs.StorageClient1;
import org.csource.fastdfs.TrackerServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
 * FastDFS 客户端工具.
@ -27,7 +29,7 @@ public class FastDFSUtil {
    public final static String FileIdField = "fid";
    public final static String FileUrlField = "fileUrl";
//    static TrackerClient tracker;
    //    static TrackerClient tracker;
//    static TrackerServer trackerServer;
//    static StorageServer storageServer;
//    static StorageClient client;
@ -83,6 +85,7 @@ public class FastDFSUtil {
     */
    public static ObjectNode upload(InputStream in, String fileExtension,
                                    String description) throws Exception {
        System.out.println("FastDFSUtil→InputStream === "+in);
        StorageClient client = FastDFSClientPool.getInstance().getStorageClient();
        try {
            NameValuePair[] fileMetaData;

+ 4 - 1
guns-main/src/main/resources/application-dev.yml

@ -10,4 +10,7 @@ spring:
    max-pool-prepared-statement-per-connection-size: 20
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
  fastdfs_file_url: http://172.26.0.110:8888/
article:
  id_url: http://172.26.0.30:8080/zjxl/zjxlArticleContent/findArticleContentById?articleContentTitle=&pageNo=1&pageSize=10&systemDictType=&

+ 5 - 1
guns-main/src/main/resources/application-prod.yml

@ -10,4 +10,8 @@ spring:
    max-pool-prepared-statement-per-connection-size: 20
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
  fastdfs_file_url: http://172.26.0.110:8888/
# 有正式线之后,需要将ip修改为正式
article:
  id_url: http://172.26.0.30:8080/zjxl/zjxlArticleContent/findArticleContentById?articleContentTitle=&pageNo=1&pageSize=10&systemDictType=&

+ 4 - 1
guns-main/src/main/resources/application-test.yml

@ -10,4 +10,7 @@ spring:
    max-pool-prepared-statement-per-connection-size: 20
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
  fastdfs_file_url: http://172.26.0.110:8888/
article:
  id_url: http://172.26.0.30:8080/zjxl/zjxlArticleContent/findArticleContentById?articleContentTitle=&pageNo=1&pageSize=10&systemDictType=&