jinlin
2024-03-13 91c67198a84e9c0a76cc0154fbebf62813c1de26
修改
11个文件已修改
5个文件已删除
274 ■■■■ 已修改文件
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/controller/SysPictureBaseController.java 116 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/model/SysPictureBase.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/service/SysPictureBaseService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
starter/src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/public/scale/bottom.jpg 补丁 | 查看 | 原始文档 | blame | 历史
web/public/scale/center.jpg 补丁 | 查看 | 原始文档 | blame | 历史
web/public/scale/left.jpg 补丁 | 查看 | 原始文档 | blame | 历史
web/public/scale/right.jpg 补丁 | 查看 | 原始文档 | blame | 历史
web/public/scale/top.jpg 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/modules/basicInfo/XhProductModel.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/modules/sysPictureBase/SysPictureBase-AddOrUpdate.vue 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/modules/sysPictureBase/SysPictureBase.vue 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
web/src/views/modules/taskReliability/RBD-edit-img.vue 43 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/dao/XhProductModelDao.java
@@ -28,4 +28,6 @@
    List<XhProductModel> getProductList();
    List<ProductImg> getProduct(Long productId);
    String getDefaultImg();
}
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/basicInfo/service/XhProductModelService.java
@@ -12,6 +12,7 @@
import com.zt.modules.sys.model.SysMenu;
import org.springframework.stereotype.Service;
import com.zt.common.db.query.QueryFilter;
import javax.annotation.Resource;
import java.util.List;
@@ -32,7 +33,16 @@
     * @return
     */
    public List<XhProductModel> page(QueryFilter queryFilter) {
        return baseDao.getList(queryFilter.getQueryParams());
        List<XhProductModel> list = baseDao.getList(queryFilter.getQueryParams());
        for (XhProductModel productModel : list) {
            if (productModel.getProductType().equals("1")) {
                productModel.setDefaultImg(baseDao.getDefaultImg());
                if (productModel.getId() != null) {
                    this.update(productModel);
                }
            }
        }
        return list;
    }
    /**
@@ -56,6 +66,7 @@
        }
        return baseDao.getNo(pid);
    }
    public List<XhProductModel> getProductList() {
        List<XhProductModel> ProductList = baseDao.getProductList();
        return TreeUtils.build(ProductList);
modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/controller/SysPictureBaseController.java
@@ -1,6 +1,7 @@
package com.zt.life.modules.sysPictureBase.controller;
import com.spire.xls.Workbook;
import com.zt.common.annotation.LogOperation;
import com.zt.common.constant.Constant;
import com.zt.common.annotation.QueryParam;
@@ -16,13 +17,26 @@
import com.zt.life.modules.sysPictureBase.service.SysPictureBaseService;
import com.zt.life.sys.dto.OssDto;
import com.zt.life.sys.service.SysOssConfigService;
import com.zt.modules.oss.enums.CloudChannel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.*;
/**
@@ -32,7 +46,7 @@
 * @since 1.0.0 2024-02-27
 */
@RestController
@RequestMapping("/sysPictureBase/SysPictureBase/")
@RequestMapping("/sysPictureBase/")
@Api(tags = "sys_picture_base")
public class SysPictureBaseController {
    @Autowired
@@ -40,6 +54,8 @@
    @Autowired
    private SysOssConfigService sysOssConfigService;
    @Value("${zt.oss.local-path}")
    private String localPath;
    @GetMapping("page")
    @ApiOperation("分页")
@@ -58,38 +74,92 @@
    @ApiOperation("信息")
    public Result<SysPictureBase> get(@PathVariable("id") Long id) {
        SysPictureBase data = sysPictureBaseService.get(id);
        if (id != null) {
            OssDto ossDto = sysOssConfigService.getOssByBusiType(id, "sys_picture");
            if (ossDto != null) {
                data.setFiles(ossDto);
            }
        }
        return Result.ok(data);
    }
    @PostMapping
    @ApiOperation("新增")
    @LogOperation("新增")
    public Result insert(@RequestBody SysPictureBase sysPictureBase) {
        //效验数据
        ValidatorUtils.validateEntity(sysPictureBase, AddGroup.class, DefaultGroup.class);
    @PostMapping("save")
    @ApiOperation("保存")
    @LogOperation("保存")
    public Result save(@RequestBody MultipartFile file, Long id, String type, String subType,
                       String name, String contentType, String systemMark, Integer sortNo, String remark) {
        SysPictureBase sysPictureBase;
        if (id != null) {
            sysPictureBase = sysPictureBaseService.get(id);
            sysPictureBase.setType(type);
            sysPictureBase.setSubType(subType);
            sysPictureBase.setName(name);
            sysPictureBase.setContentType(contentType);
            sysPictureBase.setSystemMark(systemMark);
            sysPictureBase.setSortNo(sortNo);
            sysPictureBase.setRemark(remark);
            sysPictureBaseService.update(sysPictureBase);
        } else {
            sysPictureBase = new SysPictureBase();
            sysPictureBase.setType(type);
            sysPictureBase.setSubType(subType);
            sysPictureBase.setName(name);
            sysPictureBase.setContentType(contentType);
            sysPictureBase.setSystemMark(systemMark);
        Integer no = sysPictureBaseService.getNo();
        sysPictureBase.setSortNo(no + 1);
            sysPictureBase.setRemark(remark);
        sysPictureBaseService.insert(sysPictureBase);
        sysOssConfigService.updateOss(sysPictureBase.getId(), sysPictureBase.getFiles());// 保存附件
        }
        if (file != null) {
            BufferedImage bufferedImage = null;
            try {
                String fileName = file.getOriginalFilename();
                String[] arr = fileName.split("\\.");
                String suffixName = arr[arr.length - 1].toLowerCase();
                bufferedImage = ImageIO.read(file.getInputStream());
                // 宽度
                int width = bufferedImage.getWidth();
                sysPictureBase.setWidth(width);
                // 高度
                int height = bufferedImage.getHeight();
                sysPictureBase.setHeight(height);
                sysPictureBaseService.update(sysPictureBase);
                String tempUploadDir = localPath + "/product_img/";
                File dir = new File(tempUploadDir);
                if (!dir.exists()) {
                    dir.mkdirs();
                }
                ImageIO.write(bufferedImage, suffixName, new File(tempUploadDir + sysPictureBase.getId().toString()));
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return Result.ok();
    }
    @PutMapping
    @ApiOperation("修改")
    @LogOperation("修改")
    public Result update(@RequestBody SysPictureBase sysPictureBase) {
        //效验数据
        ValidatorUtils.validateEntity(sysPictureBase, UpdateGroup.class, DefaultGroup.class);
        sysPictureBaseService.update(sysPictureBase);
        sysOssConfigService.updateOss(sysPictureBase.getId(), sysPictureBase.getFiles());// 保存附件
    @RequestMapping("/getProductImg")
    public void getProductImg(HttpServletResponse response, Long id) {
        try {
            String tempUploadDir = localPath + "/product_img/" + id;
            File file = new File(tempUploadDir);
            //读取指定路径下面的文件
            InputStream in = new FileInputStream(file);
        return Result.ok();
            OutputStream outputStream = new BufferedOutputStream(response.getOutputStream());
            //创建存放文件内容的数组
            byte[] buff = new byte[1024];
            //所读取的内容使用n来接收
            int n;
            //当没有读取完时,继续读取,循环
            while ((n = in.read(buff)) != -1) {
                //将字节数组的数据全部写入到输出流中
                outputStream.write(buff, 0, n);
            }
            //强制将缓存区的数据进行输出
            outputStream.flush();
            //关流
            outputStream.close();
            in.close();
        }  catch (IOException e) {
            e.printStackTrace();
        }
    }
    @DeleteMapping
modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/model/SysPictureBase.java
@@ -8,6 +8,7 @@
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.web.multipart.MultipartFile;
import java.util.Date;
@@ -32,6 +33,12 @@
    @ApiModelProperty(value = "图片名称")
    private String name;
    @ApiModelProperty(value = "图片宽度")
    private Integer width;
    @ApiModelProperty(value = "图片高度")
    private Integer height;
    @ApiModelProperty(value = "检索关键字")
    private String contentType;
@@ -45,7 +52,6 @@
    private String remark;
    @TableField(exist = false)
    @ApiModelProperty(value = "附件")
    private OssDto files;
    private MultipartFile file;
}
modules/mainPart/src/main/java/com/zt/life/modules/sysPictureBase/service/SysPictureBaseService.java
@@ -30,9 +30,6 @@
     */
    public List<SysPictureBase> page(QueryFilter queryFilter) {
        List<SysPictureBase> list = baseDao.getList(queryFilter.getQueryParams());
        if (list != null && list.size() > 0) {
            sysOssService.setListOsses(list, "sys_picture");
        }
        return list;
    }
modules/mainPart/src/main/resources/mapper/basicInfo/XhProductModelDao.xml
@@ -47,8 +47,8 @@
               a.`NAME`                    as imgName,
               'node'                      as nodeType,
               ''                          as nodeTypeExt,
               60                          as imgWidth,
               60                          as imgHeight,
               s.width                          as imgWidth,
               s.height                          as imgHeight,
               a.id                        as dataId,
               ''                          as statusImg,
               d.dict_code                 as productType,
@@ -61,16 +61,15 @@
        FROM product_model a
                 left join sys_dict_data d on d.DICT_VALUE = a.product_type and dict_type_id = '1728965873022050306'
                 left join param_data p on p.product_id = a.id and p.page_code = 'expect'
                 left join sys_picture_base s on s.id = a.default_img
        WHERE a.is_delete = 0
          AND a.PID = ${productId}
    </select>
    <select id="getDefaultImg" resultType="java.lang.String">
        SELECT b.id
        SELECT a.id
        FROM sys_picture_base a
                 LEFT JOIN sys_oss b ON a.id = b.BUSI_ID
        WHERE a.IS_DELETE = 0
          AND b.IS_DELETE = 0
          AND a.CONTENT_TYPE = '默认设备'
    </select>
</mapper>
starter/src/main/resources/application.yml
@@ -121,7 +121,7 @@
  oss:
    type: local
    local-domain: http://127.0.0.1:8050/test-project/
    local-path: D:/TestProjectFiles/ #附件存储目录
    local-path: D:/ReliabilitySimulation/ #附件存储目录
    local-qd-path: D:/TestProjectFiles/ #附件存储目录
    local-prefix: accessories #附件存储子目录
    local-area: sy
web/public/scale/bottom.jpg
Binary files differ
web/public/scale/center.jpg
Binary files differ
web/public/scale/left.jpg
Binary files differ
web/public/scale/right.jpg
Binary files differ
web/public/scale/top.jpg
Binary files differ
web/src/views/modules/basicInfo/XhProductModel.vue
@@ -71,7 +71,7 @@
          productType: '',
          type:'',
          pid: '',
          srcId:''
          srcId:'',
        }
      }
    },
web/src/views/modules/sysPictureBase/SysPictureBase-AddOrUpdate.vue
@@ -13,16 +13,21 @@
      <zt-form-item label="检索关键字" prop="contentType" >
        <el-input v-model="dataForm.contentType"></el-input>
      </zt-form-item>
      <zt-form-item label="系统标识" prop="systemMark" rules="required">
      <zt-form-item label="系统标识" prop="systemMark">
        <zt-dict v-model="dataForm.systemMark" dict="product"></zt-dict>
      </zt-form-item>
      <zt-form-item label="排序" prop="sortNo">
        <el-input v-model="dataForm.sortNo"  :readonly="readonly" @input=""></el-input>
      </zt-form-item>
      <div class="el-flex img-src" style="height: 20px">
        <el-form-item class="marginTopAndMarginBottom" style="width: 100%">
          <config-uploader :lineHeight="true" busi-type="sys_picture" model-name="dataForm" :dataForm="dataForm"
                           v-model="dataForm.files"/>
          <!--<config-uploader :lineHeight="true" busi-type="sys_picture" model-name="dataForm" :dataForm="dataForm"
                           v-model="dataForm.files"/>-->
          <el-upload :limit="1" :http-request="httpRequest" :before-upload="beforeUpload" :on-exceed="handleExceed">
            <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
          </el-upload>
          <el-image v-if="dataForm.id" :src="url+dataForm.id" style="height: 50px;width: 50px"></el-image>
        </el-form-item>
      </div>
    </el-form>
@@ -30,9 +35,13 @@
</template>
<script>
  import Cookies from "js-cookie";
  export default {
    data() {
      return {
        url: `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getProductImg?token=${Cookies.get('token')}&id=`,
        fileList: [],
        dataForm: {
          id: '',
          type: '',
@@ -50,17 +59,52 @@
      }
    },
    methods: {
      httpRequest(option) {
        this.fileList.length = 0
        this.fileList.push(option)
      },
      // 上传前处理
      beforeUpload(file) {
        let fileSize = file.size
        const FIVE_M = 5 * 1024 * 1024;
        //大于5M,不允许上传
        if (fileSize > FIVE_M) {
          this.$message.error("最大上传5M")
          return false
        }
      },
      // 文件数量过多时提醒
      handleExceed() {
        this.$message({type: 'error', message: '最多支持1个附件上传'})
      },
      // 获取信息
      async getInfo() {
        let res = await this.$http.get(`/sysPictureBase/SysPictureBase/${this.dataForm.id}`)
        let res = await this.$http.get(`/sysPictureBase/${this.dataForm.id}`)
        this.dataForm = {
          ...this.dataForm,
          ...res.data
        }
        console.log(this.dataForm, 'async getInfo()')
      },
      // 表单提交
      async formSubmit() {
        let res = await this.$http[!this.dataForm.id ? 'post' : 'put']('/sysPictureBase/SysPictureBase/', this.dataForm)
        console.log(this.dataForm, 'async formSubmit()')
        // 使用form表单的数据格式
        const params = new FormData()
        // 将上传文件数组依次添加到参数paramsData中
        this.fileList.forEach((x) => {
          params.append('file', x.file)
        });
        // 将输入表单数据添加到params表单中
        params.append('id', this.dataForm.id)
        params.append('type', this.dataForm.type)
        params.append('subType', this.dataForm.subType)
        params.append('name', this.dataForm.name)
        params.append('contentType', this.dataForm.contentType)
        params.append('systemMark', this.dataForm.systemMark)
        params.append('sortNo', this.dataForm.sortNo)
        console.log(params, 'async formSubmit()')
        let res = await this.$http.post('/sysPictureBase/save', params)
        if (res.success) {
          await this.$tip.success()
          this.$refs.dialog.close()
@@ -74,6 +118,7 @@
  .img-sc > .el-form-item > .el-form-item__content {
    width: 100%;
  }
   .marginTopAndMarginBottom {
    margin-top: 10px !important;
    margin-bottom: 0 !important;
web/src/views/modules/sysPictureBase/SysPictureBase.vue
@@ -1,7 +1,7 @@
<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-sysPictureBase-sysPictureBase}">
      <zt-table-wraper query-url="/sysPictureBase/SysPictureBase/page" delete-url="/sysPictureBase/SysPictureBase/"
      <zt-table-wraper query-url="/sysPictureBase/page" delete-url="/sysPictureBase/"
                       v-slot="{ table }">
        <el-form :inline="true" :model="dataForm" @keyup.enter.native="table.query()">
          <el-form-item>
@@ -24,7 +24,7 @@
          <el-table-column prop="name" label="图片名称"/>
          <el-table-column label="图片" align="center">
            <template v-slot="{ row }">
              <el-image v-if="row.accessoryMap" :src="getPath(row)" style="height: 50px;width: 50px"></el-image>
              <el-image v-if="row.id" :src="url+row.id" style="height: 50px;width: 50px"></el-image>
            </template >
          </el-table-column>
          <el-table-column prop="contentType" label="检索关键字"/>
@@ -41,10 +41,12 @@
<script>
  import AddOrUpdate from './SysPictureBase-AddOrUpdate'
  import Cookies from 'js-cookie'
  export default {
    data() {
      return {
        url: `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getProductImg?token=${Cookies.get('token')}&id=`,
        dataForm: {
          contentType: '',
          systemMark: '',
@@ -55,17 +57,8 @@
    components: {
      AddOrUpdate
    },
    methods: {
      getPath(row) {
          if (row.accessoryMap){
            for (let key in row.accessoryMap) {
              return key
            }
          }
    mounted() {
      },
      indexFormat(index) {
        return index += 1
      },
    }
    methods: {}
  }
</script>
web/src/views/modules/taskReliability/RBD-edit-img.vue
@@ -83,6 +83,7 @@
  import ConfigEdge from './ConfigEdge/index.vue'
  import {removeCurrentTabHandle} from '@/commonJS/common'
  import {setHartBeat} from '@/commonJS/common';
  import Cookies from 'js-cookie'
  export default {
    name: 'RBD-edit-img',
@@ -117,10 +118,26 @@
        imgsList:[
          {imgPath:'start',imgName:'start',nodeType:'start',imgWidth:60,imgHeight:60,imgId:'1',data:{}},
          {imgPath:'end',imgName:'end',nodeType:'end',imgWidth:60,imgHeight:60,imgId:'2',data:{}},
          {imgPath:'connect',imgName:'connect',nodeType:'connect',imgWidth:20,imgHeight:20,imgId:'3',data:{}},
          {
            imgPath: 'connect',
            imgName: 'connect',
            nodeType: 'connect',
            imgWidth: 20,
            imgHeight: 20,
            imgId: '3',
            data: {}
          },
          // {imgPath:'parallelLeft',imgName:'parallelLeft',nodeType:'parallelLeft',imgWidth:60,imgHeight:60,imgId:'3',data:{}},
          // {imgPath:'parallelRight',imgName:'parallel',nodeType:'parallel',imgWidth:60,imgHeight:60,imgId:'4',data:{}},
          {imgPath:'switchRight',imgName:'switch',nodeType:'switch',imgWidth:60,imgHeight:60,imgId:'5',data:{}},
          {
            imgPath: 'switchRight',
            imgName: 'switch',
            nodeType: 'switch',
            imgWidth: 60,
            imgHeight: 60,
            imgId: '5',
            data: {}
          },
          {imgPath:'voteRight',imgName:'vote',nodeType:'vote',imgWidth:60,imgHeight:60,imgId:'6',data:{}},
        ],
        imgsList2:[
@@ -468,6 +485,18 @@
        })
        this.graph.centerContent()
        const stencil = new Addon.Stencil({
          getDropNode(node) {
            let {width, height} = node.size()
            if (node.getData().imgWidth) {
              width = node.getData().imgWidth
            }
            if (node.getData().imgHeight) {
              height = node.getData().imgHeight
            }
            console.log(node.getData().imgWidth, node.getData().imgHeight, 'node.size()')
            return node.clone().size(width, height)
          },
        // 返回一个新的节点作为实际放置到画布上的节点
          title: '',
          target: this.graph,
          stencilGraphWidth: 230,
@@ -531,11 +560,9 @@
        const imageNodes2 = this.imgsList2.map((item) =>
            this.graph.createNode({
              shape: 'image',
              imageUrl: `${window.SITE_CONFIG['apiURL']}/sys/oss/content2?fileId=${item.imgPath}`,
              width:item.imgWidth,
              height:item.imgHeight,
              x:item.imgWidth,
              y:item.imgHeight,
            imageUrl: `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getProductImg?token=${Cookies.get('token')}&id=${item.imgPath}`,
            width: 60,
            height: 60,
              data: {
                isRepair:false,
                dataId: item.dataId,
@@ -550,6 +577,8 @@
                taskMtbcf:item.taskMtbcf,
                taskMtbcfOther:item.taskMtbcfOther,
                voteSum:'',
              imgHeight: item.imgHeight,
              imgWidth: item.imgWidth
              },
              attrs: {
                text:{