Forráskód Böngészése

增加本部部门指标计划生成报表

hlf 1 éve
szülő
commit
692831b78e

+ 7 - 7
ims-service/ims-eval/src/main/java/com/ims/eval/controller/DepartmentalPerformanceIndicatorAssessmentController.java

@@ -97,12 +97,12 @@ public class DepartmentalPerformanceIndicatorAssessmentController {
 		String os = System.getProperty("os.name");
 		String path;
 		if (os.toLowerCase().startsWith("win")) {  //如果是Windows系统
-			path = "D:/home/statement/" ;
+			path = "D:/home/statement/";
 		} else {  //linux和mac
-			path = "/home/dbkp/statement/" ;
+			path = "/home/dbkp/statement/";
 		}
-		String fileName = evaluationDeptBusinessAssessment.getAppraisalYear() + "年度经营业绩完成情况.doc" ;
-		WordUtil.generateWord(dataMap, "template_dbkp.ftl", path, fileName);
+		String fileName = evaluationDeptBusinessAssessment.getAppraisalYear() + "年度经营业绩完成情况.doc";
+		WordUtil.generateWord(dataMap, "template_dbkp_wcqk.ftl", path, fileName);
 		return R.ok().data(fileName);
 	}
 
@@ -119,9 +119,9 @@ public class DepartmentalPerformanceIndicatorAssessmentController {
 		String os = System.getProperty("os.name");
 		String path;
 		if (os.toLowerCase().startsWith("win")) { //如果是Windows系统
-			path = "D:/home/statement/" ;
+			path = "D:/home/statement/";
 		} else { //linux和mac
-			path = "/home/dbkp/statement/" ;
+			path = "/home/dbkp/statement/";
 		}
 		InputStream inputStream = null;
 		ServletOutputStream outputStream = null;
@@ -153,7 +153,7 @@ public class DepartmentalPerformanceIndicatorAssessmentController {
 	/**
 	 * 修改状态
 	 *
-	 * @param id 主键
+	 * @param id    主键
 	 * @param stage 状态
 	 * @return 结果
 	 */

+ 42 - 3
ims-service/ims-eval/src/main/java/com/ims/eval/controller/DepartmentalPerformanceIndicatorPlanController.java

@@ -7,6 +7,7 @@ import com.ims.eval.entity.*;
 import com.ims.eval.entity.dto.result.R;
 import com.ims.eval.service.*;
 import com.ims.eval.util.ExcelUtil;
+import com.ims.eval.util.WordUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -14,9 +15,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
 import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
+import java.util.*;
 
 /**
  * 本部部门业绩指标计划
@@ -251,4 +250,44 @@ public class DepartmentalPerformanceIndicatorPlanController {
 			return R.customError(e.getMessage()).data("失败!");
 		}
 	}
+
+	/**
+	 * 生成报表
+	 *
+	 * @return 结果
+	 */
+	@GetMapping(value = "/generateReport/{id}")
+	public R generateReport(@PathVariable("id") String id) throws Exception {
+		Map<String, Object> dataMap = new HashMap<>();
+		EvaluationDeptBusinessPlan evaluationDeptBusinessPlan = evaluationDeptBusinessPlanService.getById(id);
+		String[] deptIds = evaluationDeptBusinessPlan.getDeptId().split(",");
+		String[] deptNames = evaluationDeptBusinessPlan.getDeptName().split(",");
+		List<EvaluationDept> evaluationDeptList = new ArrayList<>();
+		for (int i = 0; i < deptIds.length; i++) {
+			EvaluationDept evaluationDept = new EvaluationDept();
+			evaluationDept.setDeptId(deptIds[i]);
+			evaluationDept.setDeptName(deptNames[i]);
+			List<EvaluationDeptBusinessContent> evaluationDeptBusinessContentList = evaluationDeptBusinessContentService.selectEvaluationDeptBusinessContentListByBusinessPlanId(id, deptIds[i]);
+			if (evaluationDeptBusinessContentList.size() > 0) {
+				evaluationDept.setEvaluationDeptBusinessContent(evaluationDeptBusinessContentList.get(0));
+				if (evaluationDeptBusinessContentList.size() > 1) {
+					evaluationDeptBusinessContentList.remove(0);
+					evaluationDept.setList(evaluationDeptBusinessContentList);
+				}
+			}
+			evaluationDeptList.add(evaluationDept);
+		}
+		dataMap.put("appraisalYear", evaluationDeptBusinessPlan.getAppraisalYear());
+		dataMap.put("list", evaluationDeptList);
+		String os = System.getProperty("os.name");
+		String path;
+		if (os.toLowerCase().startsWith("win")) {  //如果是Windows系统
+			path = "D:/home/statement/";
+		} else {  //linux和mac
+			path = "/home/dbkp/statement/";
+		}
+		String fileName = evaluationDeptBusinessPlan.getAppraisalYear() + "年度经营业绩指标计划.doc";
+		WordUtil.generateWord(dataMap, "template_dbkp_zbjh.ftl", path, fileName);
+		return R.ok().data(fileName);
+	}
 }

+ 5 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/entity/EvaluationDept.java

@@ -103,6 +103,11 @@ public class EvaluationDept extends Model {
 	@TableField(exist = false)
 	private List<EvaluationDeptIndicator> evaluationDeptIndicatorList;
 
+	//生成报表word数据集合
 	@TableField(exist = false)
 	private List<EvaluationDeptBusinessContent> list;
+
+	//生成报表word数据
+	@TableField(exist = false)
+	private EvaluationDeptBusinessContent evaluationDeptBusinessContent;
 }

+ 1 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/EvaluationDeptBusinessPlanServiceImpl.java

@@ -117,7 +117,7 @@ public class EvaluationDeptBusinessPlanServiceImpl extends ServiceImpl<Evaluatio
 				evaluationDeptBusinessAssessment.setFinalReviewPeople(evaluationDeptBusinessPlan.getFinalReviewPeople());
 				evaluationDeptBusinessAssessment.setFinalReviewPeopleTime(evaluationDeptBusinessPlan.getFinalReviewPeopleTime());
 				evaluationDeptBusinessAssessment.setFinalReviewOpinion(evaluationDeptBusinessPlan.getFinalReviewOpinion());
-				evaluationDeptBusinessAssessment.setInstId(evaluationDeptBusinessPlan.getInstId());
+				//evaluationDeptBusinessAssessment.setInstId(evaluationDeptBusinessPlan.getInstId());
 				evaluationDeptBusinessAssessment.setCreateTime(DateUtil.date());
 				evaluationDeptBusinessAssessment.setCreateBy(evaluationDeptBusinessPlan.getCreateBy());
 				evaluationDeptBusinessAssessment.setUpdateTime(evaluationDeptBusinessPlan.getUpdateTime());

+ 27 - 0
ims-service/ims-eval/src/main/resources/templates/template_dbkp.ftl

@@ -3443,6 +3443,33 @@
 						</w:tr>
 					</#list>
 				</w:tbl>
+                <w:p wsp:rsidR="003A49A3" wsp:rsidRDefault="003A49A3" wsp:rsidP="003A49A3">
+                    <w:pPr>
+                        <w:pStyle w:val="6"/>
+                        <w:ind w:left-chars="0" w:left="0"/>
+                        <w:rPr>
+                            <w:rFonts w:hint="fareast"/>
+                        </w:rPr>
+                    </w:pPr>
+                </w:p>
+                <w:p wsp:rsidR="003A49A3" wsp:rsidRDefault="003A49A3" wsp:rsidP="003A49A3">
+                    <w:pPr>
+                        <w:pStyle w:val="6"/>
+                        <w:ind w:left-chars="0" w:left="0"/>
+                        <w:rPr>
+                            <w:rFonts w:hint="fareast"/>
+                        </w:rPr>
+                    </w:pPr>
+                </w:p>
+                <w:p wsp:rsidR="003A49A3" wsp:rsidRDefault="003A49A3" wsp:rsidP="003A49A3">
+                    <w:pPr>
+                        <w:pStyle w:val="6"/>
+                        <w:ind w:left-chars="0" w:left="0"/>
+                        <w:rPr>
+                            <w:rFonts w:hint="fareast"/>
+                        </w:rPr>
+                    </w:pPr>
+                </w:p>
 			</#list>
             <w:p wsp:rsidR="00D9719A" wsp:rsidRPr="00D9719A" wsp:rsidRDefault="00D9719A" wsp:rsidP="00D9719A">
                 <w:pPr>

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 3333 - 0
ims-service/ims-eval/src/main/resources/templates/template_dbkp_zbjh.ftl