lyhzzz 1 năm trước cách đây
mục cha
commit
bc699daefd

+ 2 - 1
src/main/java/com/fdkankan/fusion/controller/CaseInquestController.java

@@ -13,6 +13,7 @@ import com.fdkankan.fusion.exception.BusinessException;
 import com.fdkankan.fusion.response.CaseInquestVo;
 import com.fdkankan.fusion.response.WitnessVo;
 import com.fdkankan.fusion.service.ICaseInquestService;
+import org.apache.poi.xwpf.usermodel.UnderlinePatterns;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -81,7 +82,7 @@ public class CaseInquestController {
         }
         TextRenderData text = new TextRenderData("000000",msg.toString());
         Style style = text.getStyle();
-        style.setUnderLine(true);
+        style.setUnderlinePatterns(UnderlinePatterns.SINGLE);
         vo.setText(text);
 
         XWPFTemplate template = XWPFTemplate.compile(inputStream).render(vo);

+ 0 - 55
src/main/java/com/fdkankan/fusion/controller/TestController.java

@@ -121,59 +121,4 @@ public class TestController {
         }
         return ResultData.ok();
     }
-    @Autowired
-    ICaseInquestService caseInquestService;
-    @GetMapping("/downDocx")
-    public void downDocx(@RequestParam(required = false) Integer caseId,
-                         HttpServletResponse res, HttpServletRequest req) throws IOException {
-
-        if(caseId == null){
-            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
-        }
-        CaseInquest caseInquest = caseInquestService.getByCaseId(caseId);
-        if(caseInquest == null){
-            throw new BusinessException(ResultCode.INQUEST_ERROR2);
-        }
-
-        InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("template/inquest-template.docx");
-        // 渲染模板
-
-        CaseInquestVo vo = new CaseInquestVo();
-        BeanUtils.copyProperties(caseInquest,vo);
-
-
-        String info = "证人或当事人(签名):%s  %s年 %s月 %s日 身份证件号码:%s\n"
-                +"   单位或住址:%s\n";
-        StringBuilder msg = new StringBuilder();
-        for (Object object : vo.getWitnessInfo()) {
-            JSONObject obj = (JSONObject) object;
-            WitnessVo witnessVo = JSONObject.toJavaObject(obj,WitnessVo.class);
-            String format = String.format(info, witnessVo.getName(), witnessVo.getYear(), witnessVo.getMonth(), witnessVo.getDay(), witnessVo.getId(), witnessVo.getAddress());
-            msg.append(format);
-        }
-        TextRenderData text = new TextRenderData("000000",msg.toString());
-        Style style = text.getStyle();
-        style.setUnderLine(true);
-        vo.setText(text);
-
-        XWPFTemplate template = XWPFTemplate.compile(inputStream).render(vo);
-
-        // 设置响应头,指定文件类型和内容长度
-        res.setContentType("application/octet-stream");
-        res.setHeader("Content-Disposition", "attachment; filename=output.docx");
-
-        try {
-            // 返回网络流
-            OutputStream out = res.getOutputStream();
-            BufferedOutputStream bos = new BufferedOutputStream(out);
-            template.write(bos);
-            bos.flush();
-            out.flush();
-            // 关闭流
-            PoitlIOUtils.closeQuietlyMulti(template, bos, out);
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
-
-    }
 }

+ 5 - 1
src/main/java/com/fdkankan/fusion/service/impl/TmProjectServiceImpl.java

@@ -342,6 +342,7 @@ public class TmProjectServiceImpl extends ServiceImpl<ITmProjectMapper, TmProjec
     public TmProject getByProjectSn(String projectSn) {
         LambdaQueryWrapper<TmProject> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(TmProject::getProjectSn,projectSn);
+        wrapper.eq(TmProject::getIsDelete,0);
         return this.getOne(wrapper);
     }
 
@@ -373,7 +374,10 @@ public class TmProjectServiceImpl extends ServiceImpl<ITmProjectMapper, TmProjec
     public HashMap<String, TmProject> getMapByIds(Set<String> tmProIds) {
         HashMap<String, TmProject> map  = new HashMap<>();
         if(tmProIds.size() >0){
-            List<TmProject> tmProjects = this.listByIds(tmProIds);
+            LambdaQueryWrapper<TmProject> wrapper = new LambdaQueryWrapper<>();
+            wrapper.in(TmProject::getId,tmProIds);
+            wrapper.eq(TmProject::getIsDelete,0);
+            List<TmProject> tmProjects = this.list(wrapper);
             for (TmProject tmProject : tmProjects) {
                 map.put(tmProject.getId(),tmProject);
             }