上传包结构
parent
db85b51715
commit
09eb0ebc86
@ -0,0 +1,12 @@
|
|||||||
|
package com.sztzjy.financial_bigdata.service.tea;
|
||||||
|
|
||||||
|
import com.sztzjy.financial_bigdata.entity.TeaResourceCenter;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ITeaResourceCenterService {
|
||||||
|
Boolean uploadResource(MultipartFile file, String schoolId,String chapterId);
|
||||||
|
|
||||||
|
List<TeaResourceCenter> selectResource(String schoolId, String chapterId);
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
package com.sztzjy.financial_bigdata.service.tea.impl;
|
||||||
|
|
||||||
|
import com.sztzjy.financial_bigdata.entity.TeaResourceCenter;
|
||||||
|
import com.sztzjy.financial_bigdata.entity.TeaResourceCenterExample;
|
||||||
|
import com.sztzjy.financial_bigdata.mapper.TeaResourceCenterMapper;
|
||||||
|
import com.sztzjy.financial_bigdata.service.tea.ITeaResourceCenterService;
|
||||||
|
import com.sztzjy.financial_bigdata.util.file.IFileUtil;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class TeaResourceCenterServiceImpl implements ITeaResourceCenterService {
|
||||||
|
@Autowired
|
||||||
|
IFileUtil fileUtil;
|
||||||
|
@Autowired
|
||||||
|
TeaResourceCenterMapper resourceCenterMapper;
|
||||||
|
@Override
|
||||||
|
public Boolean uploadResource(MultipartFile file, String schoolId,String chapterId) {
|
||||||
|
String uploadUrl = fileUtil.upload(file);
|
||||||
|
TeaResourceCenter resourceCenter=new TeaResourceCenter();
|
||||||
|
resourceCenter.setResourceId(String.valueOf(UUID.randomUUID()));
|
||||||
|
resourceCenter.setResourceName(file.getOriginalFilename());
|
||||||
|
resourceCenter.setResourceUrl(uploadUrl);
|
||||||
|
resourceCenter.setChapterId(chapterId);
|
||||||
|
resourceCenter.setSchoolId(schoolId);
|
||||||
|
int insert = resourceCenterMapper.insert(resourceCenter);
|
||||||
|
if(insert!=0){
|
||||||
|
return true;
|
||||||
|
}else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TeaResourceCenter> selectResource(String schoolId, String chapterId) {
|
||||||
|
// TeaResourceCenterExample example=new TeaResourceCenterExample();
|
||||||
|
// TeaResourceCenterExample.Criteria criteria = example.createCriteria();
|
||||||
|
// criteria.andChapterIdEqualTo(chapterId).andSc
|
||||||
|
// resourceCenterMapper.selectByExample()
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -1,62 +1,65 @@
|
|||||||
package com.sztzjy.financial_bigdata.util;
|
//package com.sztzjy.financial_bigdata.util;
|
||||||
|
//
|
||||||
import cn.hutool.core.util.IdUtil;
|
//import cn.hutool.core.util.IdUtil;
|
||||||
import com.sztzjy.financial_bigdata.util.seal.SealCircle;
|
//import com.sztzjy.financial_bigdata.util.file.LocalFileUtil;
|
||||||
import com.sztzjy.financial_bigdata.util.seal.SealFont;
|
//import com.sztzjy.financial_bigdata.util.seal.SealCircle;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
//import com.sztzjy.financial_bigdata.util.seal.SealFont;
|
||||||
import org.springframework.stereotype.Component;
|
//import org.springframework.beans.factory.annotation.Value;
|
||||||
|
//import org.springframework.stereotype.Component;
|
||||||
import java.io.File;
|
//
|
||||||
|
//import javax.annotation.Resource;
|
||||||
/**
|
//import java.io.File;
|
||||||
* @author 17803
|
//
|
||||||
* @date 2023-12-05 15:11
|
///**
|
||||||
*/
|
// * @author 17803
|
||||||
|
// * @date 2023-12-05 15:11
|
||||||
@Component
|
// */
|
||||||
public class SealUtil {
|
//
|
||||||
|
//@Component
|
||||||
|
//public class SealUtil {
|
||||||
@Value("${file.path}")
|
//
|
||||||
private String filePath;
|
// @Resource
|
||||||
|
// LocalFileUtil localFileUtil;
|
||||||
public String genertSealB(String name) throws Exception {
|
//
|
||||||
String file = filePath + "/seal/";
|
// @Value("${file.path}")
|
||||||
// 创建 File 对象
|
// private String filePath;
|
||||||
File infoFile = new File(file);
|
//
|
||||||
if (!infoFile.exists()) {
|
// public String genertSealB(String name) throws Exception{
|
||||||
infoFile.mkdir();
|
// String file = filePath+"/seal/";
|
||||||
}
|
// // 创建 File 对象
|
||||||
String s = IdUtil.fastSimpleUUID();
|
// File infoFile = new File(file);
|
||||||
com.sztzjy.financial_bigdata.util.seal.SealUtil.builder()
|
// if (!infoFile.exists()) {
|
||||||
.size(200)
|
// infoFile.mkdir();
|
||||||
.borderCircle(SealCircle.builder().line(4).width(95).height(95).build())
|
// }
|
||||||
.mainFont(SealFont.builder().text(name + "有限公司").size(22).space(30.0).margin(4).build())
|
// String s = IdUtil.fastSimpleUUID();
|
||||||
.centerFont(SealFont.builder().text("★").size(60).build())
|
// com.sztzjy.financial_bigdata.util.seal.SealUtil.builder()
|
||||||
.titleFont(SealFont.builder().text("电子签章").size(16).space(8.0).margin(54).build())
|
// .size(200)
|
||||||
.build()
|
// .borderCircle(SealCircle.builder().line(4).width(95).height(95).build())
|
||||||
.draw(filePath + "/seal/" + s + ".png");
|
// .mainFont(SealFont.builder().text(name+"有限公司").size(22).space(30.0).margin(4).build())
|
||||||
System.out.println(name + "公章已生成");
|
// .centerFont(SealFont.builder().text("★").size(60).build())
|
||||||
return s;
|
// .titleFont(SealFont.builder().text("电子签章").size(16).space(8.0).margin(54).build())
|
||||||
}
|
// .build()
|
||||||
|
// .draw(filePath+"/seal/"+ s +".png");
|
||||||
public String genertSealA(String name) throws Exception {
|
// System.out.println(name+"公章已生成");
|
||||||
String file = filePath + "/seal/";
|
// return s;
|
||||||
// 创建 File 对象
|
// }
|
||||||
File infoFile = new File(file);
|
// public String genertSealA(String name) throws Exception{
|
||||||
if (!infoFile.exists()) {
|
// String file = filePath+"/seal/";
|
||||||
infoFile.mkdir();
|
// // 创建 File 对象
|
||||||
}
|
// File infoFile = new File(file);
|
||||||
String s = IdUtil.fastSimpleUUID();
|
// if (!infoFile.exists()) {
|
||||||
com.sztzjy.financial_bigdata.util.seal.SealUtil.builder()
|
// infoFile.mkdir();
|
||||||
.size(200)
|
// }
|
||||||
.borderCircle(SealCircle.builder().line(4).width(95).height(95).build())
|
// String s = IdUtil.fastSimpleUUID();
|
||||||
.mainFont(SealFont.builder().text(name).size(22).space(30.0).margin(4).build())
|
// com.sztzjy.financial_bigdata.util.seal.SealUtil.builder()
|
||||||
.centerFont(SealFont.builder().text("★").size(60).build())
|
// .size(200)
|
||||||
.titleFont(SealFont.builder().text("电子签章").size(16).space(8.0).margin(54).build())
|
// .borderCircle(SealCircle.builder().line(4).width(95).height(95).build())
|
||||||
.build()
|
// .mainFont(SealFont.builder().text(name).size(22).space(30.0).margin(4).build())
|
||||||
.draw(filePath + "/seal/" + s + ".png");
|
// .centerFont(SealFont.builder().text("★").size(60).build())
|
||||||
System.out.println(name + "公章已生成");
|
// .titleFont(SealFont.builder().text("电子签章").size(16).space(8.0).margin(54).build())
|
||||||
return s;
|
// .build()
|
||||||
}
|
// .draw(filePath+"/seal/"+ s +".png");
|
||||||
}
|
// System.out.println(name+"公章已生成");
|
||||||
|
// return s;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
Loading…
Reference in New Issue