From 41f250e71c66bba20a435ba2d703454d1df76af5 Mon Sep 17 00:00:00 2001 From: zhangsiqi <2825463979@qq.com> Date: Fri, 31 May 2024 18:06:48 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=E6=96=B0=E5=A2=9E=E4=BE=9B=E5=BA=94?= =?UTF-8?q?=E5=95=86=E9=A1=B5=E9=9D=A2=E4=B8=8A=E4=BC=A0=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD=EF=BC=8C?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E4=BE=9B=E5=BA=94=E5=95=86=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E6=98=BE=E7=A4=BA=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/system/domain/SysSupplier.java | 40 +++++++ .../service/impl/SysSupplierServiceImpl.java | 43 +++++++ .../mapper/system/SysSupplierMapper.xml | 70 +++++++++--- .../templates/system/supplier/edit.html | 108 +++++++++++++----- 4 files changed, 222 insertions(+), 39 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSupplier.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSupplier.java index 71ddc72c..cc89ef0b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSupplier.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSupplier.java @@ -155,6 +155,46 @@ public class SysSupplier extends BaseEntity private String updateInfoTime; + private Long photoAttachId; + + /** 照片 */ + private String photoUrl; + + private String fileIdStr; + + private String removeFileIdStr; + + public Long getPhotoAttachId() { + return photoAttachId; + } + + public void setPhotoAttachId(Long photoAttachId) { + this.photoAttachId = photoAttachId; + } + + public String getPhotoUrl() { + return photoUrl; + } + + public void setPhotoUrl(String photoUrl) { + this.photoUrl = photoUrl; + } + + public String getFileIdStr() { + return fileIdStr; + } + + public void setFileIdStr(String fileIdStr) { + this.fileIdStr = fileIdStr; + } + + public String getRemoveFileIdStr() { + return removeFileIdStr; + } + + public void setRemoveFileIdStr(String removeFileIdStr) { + this.removeFileIdStr = removeFileIdStr; + } public String getAuditStatus() { return auditStatus; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSupplierServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSupplierServiceImpl.java index 55af200e..6523aaeb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSupplierServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSupplierServiceImpl.java @@ -2,12 +2,20 @@ package com.ruoyi.system.service.impl; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.text.Convert; +import com.ruoyi.common.service.ICommonService; +import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.system.domain.SysAttach; import com.ruoyi.system.domain.SysSupplier; import com.ruoyi.system.mapper.SysSupplierMapper; +import com.ruoyi.system.service.ISysAttachFileService; +import com.ruoyi.system.service.ISysAttachService; import com.ruoyi.system.service.ISysSupplierService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Arrays; +import java.util.Date; import java.util.List; /** @@ -24,6 +32,16 @@ public class SysSupplierServiceImpl implements ISysSupplierService @Autowired private RedisCache redisCache; + + @Autowired + private ISysAttachFileService attachFileService; + + @Autowired + private ISysAttachService attachService; + + @Autowired + private ICommonService commonService; + /** * 查询供应商资料 * @@ -69,6 +87,31 @@ public class SysSupplierServiceImpl implements ISysSupplierService @Override public int updateSysSupplier(SysSupplier sysSupplier) { + String loginName = ShiroUtils.getLoginName(); + Long id = sysSupplier.getSupplierId(); + String fileIdStr = sysSupplier.getFileIdStr(); + Long photoAttachId = sysSupplier.getPhotoAttachId(); + String removeFileIdStr = sysSupplier.getRemoveFileIdStr(); + sysSupplier.setUpdateTime(new Date()); + if(StringUtils.isNotBlank(removeFileIdStr)){ + List removeFileIdList = Arrays.asList(removeFileIdStr.split(";")); + + commonService.deleteByIds(removeFileIdList); + } + if(StringUtils.isNotBlank(fileIdStr)) { + List fileIdList = Arrays.asList(fileIdStr.split(";")); + if (photoAttachId == null) { + SysAttach attach = new SysAttach(); + attach.setCreateBy(loginName); + attach.setCreateTime(new Date()); + attach.setSourceType("erpMaterial"); + attach.setSourceSubType("photo"); + attach.setRelId(id); + attachService.insertSysAttach(attach); + photoAttachId = attach.getId(); + } + attachFileService.updateAttachIdByIdList(photoAttachId, fileIdList); + } return sysSupplierMapper.updateSysSupplier(sysSupplier); } diff --git a/ruoyi-admin/src/main/resources/mapper/system/SysSupplierMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/SysSupplierMapper.xml index 50ab368a..8dcde90e 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/SysSupplierMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/SysSupplierMapper.xml @@ -43,6 +43,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -59,24 +61,66 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +
@@ -215,21 +216,27 @@
- -
- - 点击上传 -
只能上传jpg/png文件,第一张图片为主图
-
+ +
+ +
+ + 点击上传 +
只能上传jpg/png文件,第一张图片为主图
+
+
+ + +
-
@@ -245,17 +252,71 @@
- - \ No newline at end of file