上传包结构
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;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.sztzjy.financial_bigdata.util.seal.SealCircle;
|
||||
import com.sztzjy.financial_bigdata.util.seal.SealFont;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author 17803
|
||||
* @date 2023-12-05 15:11
|
||||
*/
|
||||
|
||||
@Component
|
||||
public class SealUtil {
|
||||
|
||||
|
||||
@Value("${file.path}")
|
||||
private String filePath;
|
||||
|
||||
public String genertSealB(String name) throws Exception {
|
||||
String file = filePath + "/seal/";
|
||||
// 创建 File 对象
|
||||
File infoFile = new File(file);
|
||||
if (!infoFile.exists()) {
|
||||
infoFile.mkdir();
|
||||
}
|
||||
String s = IdUtil.fastSimpleUUID();
|
||||
com.sztzjy.financial_bigdata.util.seal.SealUtil.builder()
|
||||
.size(200)
|
||||
.borderCircle(SealCircle.builder().line(4).width(95).height(95).build())
|
||||
.mainFont(SealFont.builder().text(name + "有限公司").size(22).space(30.0).margin(4).build())
|
||||
.centerFont(SealFont.builder().text("★").size(60).build())
|
||||
.titleFont(SealFont.builder().text("电子签章").size(16).space(8.0).margin(54).build())
|
||||
.build()
|
||||
.draw(filePath + "/seal/" + s + ".png");
|
||||
System.out.println(name + "公章已生成");
|
||||
return s;
|
||||
}
|
||||
|
||||
public String genertSealA(String name) throws Exception {
|
||||
String file = filePath + "/seal/";
|
||||
// 创建 File 对象
|
||||
File infoFile = new File(file);
|
||||
if (!infoFile.exists()) {
|
||||
infoFile.mkdir();
|
||||
}
|
||||
String s = IdUtil.fastSimpleUUID();
|
||||
com.sztzjy.financial_bigdata.util.seal.SealUtil.builder()
|
||||
.size(200)
|
||||
.borderCircle(SealCircle.builder().line(4).width(95).height(95).build())
|
||||
.mainFont(SealFont.builder().text(name).size(22).space(30.0).margin(4).build())
|
||||
.centerFont(SealFont.builder().text("★").size(60).build())
|
||||
.titleFont(SealFont.builder().text("电子签章").size(16).space(8.0).margin(54).build())
|
||||
.build()
|
||||
.draw(filePath + "/seal/" + s + ".png");
|
||||
System.out.println(name + "公章已生成");
|
||||
return s;
|
||||
}
|
||||
}
|
||||
//package com.sztzjy.financial_bigdata.util;
|
||||
//
|
||||
//import cn.hutool.core.util.IdUtil;
|
||||
//import com.sztzjy.financial_bigdata.util.file.LocalFileUtil;
|
||||
//import com.sztzjy.financial_bigdata.util.seal.SealCircle;
|
||||
//import com.sztzjy.financial_bigdata.util.seal.SealFont;
|
||||
//import org.springframework.beans.factory.annotation.Value;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
//import javax.annotation.Resource;
|
||||
//import java.io.File;
|
||||
//
|
||||
///**
|
||||
// * @author 17803
|
||||
// * @date 2023-12-05 15:11
|
||||
// */
|
||||
//
|
||||
//@Component
|
||||
//public class SealUtil {
|
||||
//
|
||||
// @Resource
|
||||
// LocalFileUtil localFileUtil;
|
||||
//
|
||||
// @Value("${file.path}")
|
||||
// private String filePath;
|
||||
//
|
||||
// public String genertSealB(String name) throws Exception{
|
||||
// String file = filePath+"/seal/";
|
||||
// // 创建 File 对象
|
||||
// File infoFile = new File(file);
|
||||
// if (!infoFile.exists()) {
|
||||
// infoFile.mkdir();
|
||||
// }
|
||||
// String s = IdUtil.fastSimpleUUID();
|
||||
// com.sztzjy.financial_bigdata.util.seal.SealUtil.builder()
|
||||
// .size(200)
|
||||
// .borderCircle(SealCircle.builder().line(4).width(95).height(95).build())
|
||||
// .mainFont(SealFont.builder().text(name+"有限公司").size(22).space(30.0).margin(4).build())
|
||||
// .centerFont(SealFont.builder().text("★").size(60).build())
|
||||
// .titleFont(SealFont.builder().text("电子签章").size(16).space(8.0).margin(54).build())
|
||||
// .build()
|
||||
// .draw(filePath+"/seal/"+ s +".png");
|
||||
// System.out.println(name+"公章已生成");
|
||||
// return s;
|
||||
// }
|
||||
// public String genertSealA(String name) throws Exception{
|
||||
// String file = filePath+"/seal/";
|
||||
// // 创建 File 对象
|
||||
// File infoFile = new File(file);
|
||||
// if (!infoFile.exists()) {
|
||||
// infoFile.mkdir();
|
||||
// }
|
||||
// String s = IdUtil.fastSimpleUUID();
|
||||
// com.sztzjy.financial_bigdata.util.seal.SealUtil.builder()
|
||||
// .size(200)
|
||||
// .borderCircle(SealCircle.builder().line(4).width(95).height(95).build())
|
||||
// .mainFont(SealFont.builder().text(name).size(22).space(30.0).margin(4).build())
|
||||
// .centerFont(SealFont.builder().text("★").size(60).build())
|
||||
// .titleFont(SealFont.builder().text("电子签章").size(16).space(8.0).margin(54).build())
|
||||
// .build()
|
||||
// .draw(filePath+"/seal/"+ s +".png");
|
||||
// System.out.println(name+"公章已生成");
|
||||
// return s;
|
||||
// }
|
||||
//}
|
||||
|
Loading…
Reference in New Issue