diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyJxdg/controller/ZyJxdgController.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyJxdg/controller/ZyJxdgController.java index ac75f8a3..d68a07b3 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyJxdg/controller/ZyJxdgController.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyJxdg/controller/ZyJxdgController.java @@ -105,6 +105,22 @@ public class ZyJxdgController extends JeecgController { 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 { 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删除 * diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyJxdg/entity/ZyJxdg.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyJxdg/entity/ZyJxdg.java index 97dcfed2..b33e7792 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyJxdg/entity/ZyJxdg.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyJxdg/entity/ZyJxdg.java @@ -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; } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyTlqContent/controller/ZyTlqContentController.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyTlqContent/controller/ZyTlqContentController.java index 00e69e3d..7a05f846 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyTlqContent/controller/ZyTlqContentController.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyTlqContent/controller/ZyTlqContentController.java @@ -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 add(@RequestBody ZyTlqContent zyTlqContent) { + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + zyTlqContent.setStudentName(sysUser.getRealname()); zyTlqContentService.save(zyTlqContent); return Result.OK("添加成功!"); } diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyTlqContent/entity/ZyTlqContent.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyTlqContent/entity/ZyTlqContent.java index 5c8b55da..3659ce8d 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyTlqContent/entity/ZyTlqContent.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/zyTlqContent/entity/ZyTlqContent.java @@ -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; }