添加讨论区功能

This commit is contained in:
yangjun 2024-05-20 23:02:19 +08:00
parent a5c5faf429
commit ca270a56e2
4 changed files with 54 additions and 3 deletions

View File

@ -105,6 +105,22 @@ public class ZyJxdgController extends JeecgController<ZyJxdg, IZyJxdgService> {
zyJxdg.setPdfPath("contract/"+namePath);
}
}else if(StringUtils.isNotEmpty(zyJxdg.getJxrlFilePath())){
String nameLast = zyJxdg.getJxrlFilePath().substring(zyJxdg.getJxrlFilePath().lastIndexOf(".")+1);
if(StringUtils.equals("pdf",nameLast)){
zyJxdg.setJxrlPdfPath(zyJxdg.getJxrlFilePath());
}else{
Global global = SpringContextHolder.getBean(Global.class);
FileUtil.mkdir(global.getContractDickPath());
String dd = DateUtils.formatDate(new Date(),"yyyyMMddHHmmss");
String docPath = upLoadPath+ File.separator+ zyJxdg.getJxrlFilePath();
String namePath = dd + ".pdf";
String pdfPath = global.getContractDickPath() + namePath;
PDFUtil.office2PDF(docPath,pdfPath);
zyJxdg.setJxrlPdfPath("contract/"+namePath);
}
}
zyJxdgService.save(zyJxdg);
return Result.OK("添加成功!");
@ -144,14 +160,35 @@ public class ZyJxdgController extends JeecgController<ZyJxdg, IZyJxdgService> {
update.set("file_path",zyJxdg.getFilePath());
update.set("pdf_path",zyJxdg.getPdfPath());
}
}else{
}
if(StringUtils.isNotEmpty(zyJxdg.getJxrlFilePath())){
String nameLast = zyJxdg.getJxrlFilePath().substring(zyJxdg.getJxrlFilePath().lastIndexOf(".")+1);
if(StringUtils.equals("pdf",nameLast)){
zyJxdg.setPdfPath(zyJxdg.getJxrlFilePath());
update.set("jxrl_file_path",zyJxdg.getJxrlFilePath());
update.set("jxrl_pdf_path",zyJxdg.getJxrlFilePath());
}else{
Global global = SpringContextHolder.getBean(Global.class);
FileUtil.mkdir(global.getContractDickPath());
String dd = DateUtils.formatDate(new Date(),"yyyyMMddHHmmss");
String docPath = upLoadPath+ File.separator+ zyJxdg.getJxrlFilePath();
String namePath = dd + ".pdf";
String pdfPath = global.getContractDickPath() + namePath;
PDFUtil.office2PDF(docPath,pdfPath);
zyJxdg.setJxrlPdfPath("contract/"+namePath);
update.set("jxrl_file_path",zyJxdg.getJxrlFilePath());
update.set("jxrl_pdf_path",zyJxdg.getJxrlPdfPath());
}
}if(StringUtils.isNotEmpty(zyJxdg.getKcjs())){
update.set("kcjs",zyJxdg.getKcjs());
}
update.eq("id",zyJxdg.getId());
zyJxdgService.update(update);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*

View File

@ -74,4 +74,13 @@ public class ZyJxdg implements Serializable {
private java.lang.String pdfPath;
private String kcjs;
/**附件*/
@Excel(name = "附件", width = 15)
@ApiModelProperty(value = "附件")
private java.lang.String jxrlFilePath;
/**pdf附件*/
@Excel(name = "pdf附件", width = 15)
@ApiModelProperty(value = "pdf附件")
private java.lang.String jxrlPdfPath;
}

View File

@ -9,8 +9,11 @@ import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.kc.zyTlqContent.entity.ZyTlqContent;
import org.jeecg.modules.kc.zyTlqContent.service.IZyTlqContentService;
@ -83,6 +86,8 @@ public class ZyTlqContentController extends JeecgController<ZyTlqContent, IZyTlq
@ApiOperation(value="讨论内容-添加", notes="讨论内容-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody ZyTlqContent zyTlqContent) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
zyTlqContent.setStudentName(sysUser.getRealname());
zyTlqContentService.save(zyTlqContent);
return Result.OK("添加成功!");
}

View File

@ -72,5 +72,5 @@ public class ZyTlqContent implements Serializable {
@Excel(name = "点赞", width = 15)
@ApiModelProperty(value = "点赞")
private java.lang.Integer dianzan;
private java.lang.Integer studentName;
private java.lang.String studentName;
}