Browse Source

提交后端代码

Lijy 1 year ago
parent
commit
3998fd95e0

+ 7 - 15
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/AttachmentCenterController.java

@@ -135,20 +135,12 @@ public class AttachmentCenterController {
     public HttpRespMsg rename(Integer id,String name){
         HttpRespMsg msg=new HttpRespMsg();
         AttachmentCenter attachmentCenter = attachmentCenterMapper.selectById(id);
-        File file = new File(uploadPath+ attachmentCenter.getAttachmentName());
+        File file = new File(attachmentCenter.getServerName());
         if(file.exists()){
-            File newFile = new File(uploadPath + name);
-            boolean b = file.renameTo(newFile);
-            if(b){
-                attachmentCenter.setAttachmentName(name);
-                attachmentCenter.setServerName(uploadPath+name);
-                String pathPrefix = "/upload/";
-                attachmentCenter.setUrl(pathPrefix + name);
-                attachmentCenterMapper.updateById(attachmentCenter);
-                msg.setError("文件重命名成功");
-            }else {
-                msg.setError("文件重命名失败");
-            }
+            attachmentCenter.setAttachmentName(name);
+            String pathPrefix = "/upload/";
+            attachmentCenterMapper.updateById(attachmentCenter);
+            msg.setMsg("文件重命名成功");
         }else {
             msg.setError("文件不存在");
         }
@@ -159,12 +151,12 @@ public class AttachmentCenterController {
     public HttpRespMsg delete(Integer id){
         HttpRespMsg msg=new HttpRespMsg();
         AttachmentCenter attachmentCenter = attachmentCenterMapper.selectById(id);
-        File file = new File(uploadPath+ attachmentCenter.getAttachmentName());
+        File file = new File(attachmentCenter.getServerName());
         if(file.exists()){
             boolean delete = file.delete();
             if(delete){
                 attachmentCenterMapper.deleteById(id);
-                msg.setError("文件删除成功");
+                msg.setMsg("文件删除成功");
             }else {
                 msg.setError("文件删除失败");
             }

+ 5 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/AuditLogCenter.java

@@ -6,9 +6,12 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import java.time.LocalDateTime;
 import com.baomidou.mybatisplus.annotation.TableField;
 import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
 
 /**
  * <p>
@@ -44,6 +47,8 @@ public class AuditLogCenter extends Model<AuditLogCenter> {
      * 操作时间
      */
     @TableField("audit_time")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     private LocalDateTime auditTime;
 
     /**