add 下载或预览文件时增加次数并同步更新会员系统

This commit is contained in:
lijiarao
2021-09-30 15:23:53 +08:00
parent 53ca276158
commit a9fc95cfd1
4 changed files with 29 additions and 6 deletions
@@ -14,12 +14,7 @@ import com.jero.modules.oss.entity.OSSFile;
import com.jero.modules.oss.service.IOSSFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.Arrays;
@@ -111,4 +106,14 @@ public class OSSFileController {
return Result.OK(list);
}
/**
* 来款系统更新文件信息
*/
@ResponseBody
@PostMapping("/updateAndPush")
public Result<?> updateAndPush(@RequestBody OSSFile ossFile) {
ossFileService.updateById(ossFile);
return Result.OK();
}
}
@@ -21,4 +21,10 @@ public class OSSFile extends JeroEntity {
@Excel(name = "文件地址")
private String url;
@Excel(name = "浏览数量")
private Integer viewNumber;
@Excel(name = "下载数量")
private Integer downloadNumber;
}
@@ -12,4 +12,9 @@ public interface IOSSFileService extends IService<OSSFile> {
boolean delete(OSSFile ossFile);
/**
* 更新次数并且推送到会员系统
* @param ossFile
*/
void updateAndPush(OSSFile ossFile);
}
@@ -1,6 +1,7 @@
package com.jero.modules.oss.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.util.AuthenticationUtils;
import com.jero.common.util.CommonUtils;
import com.jero.common.util.oss.OssBootUtil;
import com.jero.modules.oss.entity.OSSFile;
@@ -40,4 +41,10 @@ public class OSSFileServiceImpl extends ServiceImpl<OSSFileMapper, OSSFile> impl
return true;
}
@Override
public void updateAndPush(OSSFile ossFile) {
saveOrUpdate(ossFile);
AuthenticationUtils.post("/oss/file/updateAndPush",null,ossFile);
}
}