Commit 408f1d8ce39f78c69cecb48a2a7dc9462eb02e8b

Authored by 陈强
1 parent f412c8af

A3报告新增页面修改

Showing 22 changed files with 2005 additions and 15 deletions
@@ -133,6 +133,12 @@ @@ -133,6 +133,12 @@
133 <version>1.4.7</version> 133 <version>1.4.7</version>
134 </dependency> 134 </dependency>
135 135
  136 + <!-- Thymeleaf 服务端渲染(A3 报告页面) -->
  137 + <dependency>
  138 + <groupId>org.springframework.boot</groupId>
  139 + <artifactId>spring-boot-starter-thymeleaf</artifactId>
  140 + </dependency>
  141 +
136 <!-- 测试 --> 142 <!-- 测试 -->
137 <dependency> 143 <dependency>
138 <groupId>org.springframework.boot</groupId> 144 <groupId>org.springframework.boot</groupId>
@@ -5,6 +5,9 @@ import com.qgutech.qgyun.apaas.sync.cpsfzzk.service.A3ActionStepService; @@ -5,6 +5,9 @@ import com.qgutech.qgyun.apaas.sync.cpsfzzk.service.A3ActionStepService;
5 import com.qgutech.qgyun.framework.common.result.JsonResult; 5 import com.qgutech.qgyun.framework.common.result.JsonResult;
6 import lombok.extern.slf4j.Slf4j; 6 import lombok.extern.slf4j.Slf4j;
7 import org.springframework.web.bind.annotation.GetMapping; 7 import org.springframework.web.bind.annotation.GetMapping;
  8 +import org.springframework.web.bind.annotation.PathVariable;
  9 +import org.springframework.web.bind.annotation.PostMapping;
  10 +import org.springframework.web.bind.annotation.RequestBody;
8 import org.springframework.web.bind.annotation.RequestMapping; 11 import org.springframework.web.bind.annotation.RequestMapping;
9 import org.springframework.web.bind.annotation.RestController; 12 import org.springframework.web.bind.annotation.RestController;
10 13
@@ -32,4 +35,40 @@ public class A3ActionStepController { @@ -32,4 +35,40 @@ public class A3ActionStepController {
32 List<A3ActionStep> a3ActionStepList = a3ActionStepService.listAll(); 35 List<A3ActionStep> a3ActionStepList = a3ActionStepService.listAll();
33 return new JsonResult<>(true, "成功", a3ActionStepList); 36 return new JsonResult<>(true, "成功", a3ActionStepList);
34 } 37 }
  38 +
  39 + /**
  40 + * 按所属 A3 报告 id 查询推进的行为和步骤列表
  41 + *
  42 + * @param ssabg 所属 A3 报告 id
  43 + * @return 记录列表
  44 + */
  45 + @GetMapping("/list/byReport/{ssabg}")
  46 + public JsonResult listByReport(@PathVariable String ssabg) {
  47 + List<A3ActionStep> list = a3ActionStepService.listBySsabg(ssabg);
  48 + return new JsonResult<>(true, "成功", list);
  49 + }
  50 +
  51 + /**
  52 + * 保存单条推进的行为和步骤记录
  53 + *
  54 + * @param entity 实体
  55 + * @return 主键 id
  56 + */
  57 + @PostMapping("/save")
  58 + public JsonResult save(@RequestBody A3ActionStep entity) {
  59 + String id = a3ActionStepService.save(entity);
  60 + return new JsonResult<>(true, "成功", id);
  61 + }
  62 +
  63 + /**
  64 + * 按主键删除推进的行为和步骤记录
  65 + *
  66 + * @param id 主键 id
  67 + * @return 删除结果
  68 + */
  69 + @PostMapping("/delete/{id}")
  70 + public JsonResult delete(@PathVariable String id) {
  71 + a3ActionStepService.deleteById(id);
  72 + return new JsonResult<>(true, "成功", null);
  73 + }
35 } 74 }
@@ -5,6 +5,9 @@ import com.qgutech.qgyun.apaas.sync.cpsfzzk.service.A3PlanStatusService; @@ -5,6 +5,9 @@ import com.qgutech.qgyun.apaas.sync.cpsfzzk.service.A3PlanStatusService;
5 import com.qgutech.qgyun.framework.common.result.JsonResult; 5 import com.qgutech.qgyun.framework.common.result.JsonResult;
6 import lombok.extern.slf4j.Slf4j; 6 import lombok.extern.slf4j.Slf4j;
7 import org.springframework.web.bind.annotation.GetMapping; 7 import org.springframework.web.bind.annotation.GetMapping;
  8 +import org.springframework.web.bind.annotation.PathVariable;
  9 +import org.springframework.web.bind.annotation.PostMapping;
  10 +import org.springframework.web.bind.annotation.RequestBody;
8 import org.springframework.web.bind.annotation.RequestMapping; 11 import org.springframework.web.bind.annotation.RequestMapping;
9 import org.springframework.web.bind.annotation.RestController; 12 import org.springframework.web.bind.annotation.RestController;
10 13
@@ -32,4 +35,40 @@ public class A3PlanStatusController { @@ -32,4 +35,40 @@ public class A3PlanStatusController {
32 List<A3PlanStatus> a3PlanStatusList = a3PlanStatusService.listAll(); 35 List<A3PlanStatus> a3PlanStatusList = a3PlanStatusService.listAll();
33 return new JsonResult<>(true, "成功", a3PlanStatusList); 36 return new JsonResult<>(true, "成功", a3PlanStatusList);
34 } 37 }
  38 +
  39 + /**
  40 + * 按所属 A3 报告 id 查询工作计划状态和 BIC 列表
  41 + *
  42 + * @param ssabg 所属 A3 报告 id
  43 + * @return 记录列表
  44 + */
  45 + @GetMapping("/list/byReport/{ssabg}")
  46 + public JsonResult listByReport(@PathVariable String ssabg) {
  47 + List<A3PlanStatus> list = a3PlanStatusService.listBySsabg(ssabg);
  48 + return new JsonResult<>(true, "成功", list);
  49 + }
  50 +
  51 + /**
  52 + * 保存单条工作计划状态和 BIC 记录
  53 + *
  54 + * @param entity 实体
  55 + * @return 主键 id
  56 + */
  57 + @PostMapping("/save")
  58 + public JsonResult save(@RequestBody A3PlanStatus entity) {
  59 + String id = a3PlanStatusService.save(entity);
  60 + return new JsonResult<>(true, "成功", id);
  61 + }
  62 +
  63 + /**
  64 + * 按主键删除工作计划状态和 BIC 记录
  65 + *
  66 + * @param id 主键 id
  67 + * @return 删除结果
  68 + */
  69 + @PostMapping("/delete/{id}")
  70 + public JsonResult delete(@PathVariable String id) {
  71 + a3PlanStatusService.deleteById(id);
  72 + return new JsonResult<>(true, "成功", null);
  73 + }
35 } 74 }
@@ -5,6 +5,9 @@ import com.qgutech.qgyun.apaas.sync.cpsfzzk.service.A3ProblemEventService; @@ -5,6 +5,9 @@ import com.qgutech.qgyun.apaas.sync.cpsfzzk.service.A3ProblemEventService;
5 import com.qgutech.qgyun.framework.common.result.JsonResult; 5 import com.qgutech.qgyun.framework.common.result.JsonResult;
6 import lombok.extern.slf4j.Slf4j; 6 import lombok.extern.slf4j.Slf4j;
7 import org.springframework.web.bind.annotation.GetMapping; 7 import org.springframework.web.bind.annotation.GetMapping;
  8 +import org.springframework.web.bind.annotation.PathVariable;
  9 +import org.springframework.web.bind.annotation.PostMapping;
  10 +import org.springframework.web.bind.annotation.RequestBody;
8 import org.springframework.web.bind.annotation.RequestMapping; 11 import org.springframework.web.bind.annotation.RequestMapping;
9 import org.springframework.web.bind.annotation.RestController; 12 import org.springframework.web.bind.annotation.RestController;
10 13
@@ -32,4 +35,40 @@ public class A3ProblemEventController { @@ -32,4 +35,40 @@ public class A3ProblemEventController {
32 List<A3ProblemEvent> a3ProblemEventList = a3ProblemEventService.listAll(); 35 List<A3ProblemEvent> a3ProblemEventList = a3ProblemEventService.listAll();
33 return new JsonResult<>(true, "成功", a3ProblemEventList); 36 return new JsonResult<>(true, "成功", a3ProblemEventList);
34 } 37 }
  38 +
  39 + /**
  40 + * 按所属 A3 报告 id 查询问题事件列表
  41 + *
  42 + * @param ssabg 所属 A3 报告 id
  43 + * @return 记录列表
  44 + */
  45 + @GetMapping("/list/byReport/{ssabg}")
  46 + public JsonResult listByReport(@PathVariable String ssabg) {
  47 + List<A3ProblemEvent> list = a3ProblemEventService.listBySsabg(ssabg);
  48 + return new JsonResult<>(true, "成功", list);
  49 + }
  50 +
  51 + /**
  52 + * 保存单条问题事件记录
  53 + *
  54 + * @param entity 实体
  55 + * @return 主键 id
  56 + */
  57 + @PostMapping("/save")
  58 + public JsonResult save(@RequestBody A3ProblemEvent entity) {
  59 + String id = a3ProblemEventService.save(entity);
  60 + return new JsonResult<>(true, "成功", id);
  61 + }
  62 +
  63 + /**
  64 + * 按主键删除问题事件记录
  65 + *
  66 + * @param id 主键 id
  67 + * @return 删除结果
  68 + */
  69 + @PostMapping("/delete/{id}")
  70 + public JsonResult delete(@PathVariable String id) {
  71 + a3ProblemEventService.deleteById(id);
  72 + return new JsonResult<>(true, "成功", null);
  73 + }
35 } 74 }
1 package com.qgutech.qgyun.apaas.sync.cpsfzzk.controller; 1 package com.qgutech.qgyun.apaas.sync.cpsfzzk.controller;
2 2
  3 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.dto.A3ReportDetailDTO;
  4 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.dto.A3ReportSaveDTO;
3 import com.qgutech.qgyun.apaas.sync.cpsfzzk.model.A3Report; 5 import com.qgutech.qgyun.apaas.sync.cpsfzzk.model.A3Report;
4 import com.qgutech.qgyun.apaas.sync.cpsfzzk.service.A3ReportService; 6 import com.qgutech.qgyun.apaas.sync.cpsfzzk.service.A3ReportService;
5 import com.qgutech.qgyun.framework.common.result.JsonResult; 7 import com.qgutech.qgyun.framework.common.result.JsonResult;
6 import lombok.extern.slf4j.Slf4j; 8 import lombok.extern.slf4j.Slf4j;
7 import org.springframework.web.bind.annotation.GetMapping; 9 import org.springframework.web.bind.annotation.GetMapping;
  10 +import org.springframework.web.bind.annotation.PathVariable;
  11 +import org.springframework.web.bind.annotation.PostMapping;
  12 +import org.springframework.web.bind.annotation.RequestBody;
8 import org.springframework.web.bind.annotation.RequestMapping; 13 import org.springframework.web.bind.annotation.RequestMapping;
  14 +import org.springframework.web.bind.annotation.RequestParam;
9 import org.springframework.web.bind.annotation.RestController; 15 import org.springframework.web.bind.annotation.RestController;
10 16
11 import javax.annotation.Resource; 17 import javax.annotation.Resource;
@@ -32,4 +38,68 @@ public class A3ReportController { @@ -32,4 +38,68 @@ public class A3ReportController {
32 List<A3Report> a3ReportList = a3ReportService.listAll(); 38 List<A3Report> a3ReportList = a3ReportService.listAll();
33 return new JsonResult<>(true, "成功", a3ReportList); 39 return new JsonResult<>(true, "成功", a3ReportList);
34 } 40 }
  41 +
  42 + /**
  43 + * 按条件查询 A3 报告列表
  44 + *
  45 + * @param bk 板块 id,可为空
  46 + * @param fzr 负责人(模糊),可为空
  47 + * @param nfYear 年份(yyyy),可为空
  48 + * @return A3 报告列表
  49 + */
  50 + @GetMapping("/list")
  51 + public JsonResult list(@RequestParam(required = false) String bk,
  52 + @RequestParam(required = false) String fzr,
  53 + @RequestParam(required = false) Integer nfYear) {
  54 + List<A3Report> list = a3ReportService.listByCondition(bk, fzr, nfYear);
  55 + return new JsonResult<>(true, "成功", list);
  56 + }
  57 +
  58 + /**
  59 + * 按主键获取 A3 报告主表
  60 + *
  61 + * @param id 主键 id
  62 + * @return A3 报告主表
  63 + */
  64 + @GetMapping("/get/{id}")
  65 + public JsonResult get(@PathVariable String id) {
  66 + A3Report report = a3ReportService.getById(id);
  67 + return new JsonResult<>(true, "成功", report);
  68 + }
  69 +
  70 + /**
  71 + * 按主键获取 A3 报告聚合详情:主表 + 三张子表 + 板块/指标名称
  72 + *
  73 + * @param id 主键 id
  74 + * @return 详情 DTO
  75 + */
  76 + @GetMapping("/detail/{id}")
  77 + public JsonResult detail(@PathVariable String id) {
  78 + A3ReportDetailDTO detail = a3ReportService.getDetailById(id);
  79 + return new JsonResult<>(true, "成功", detail);
  80 + }
  81 +
  82 + /**
  83 + * 级联保存 A3 报告(主表 + 三张子表)
  84 + *
  85 + * @param dto 保存请求体
  86 + * @return 主表实体
  87 + */
  88 + @PostMapping("/save")
  89 + public JsonResult save(@RequestBody A3ReportSaveDTO dto) {
  90 + A3Report report = a3ReportService.saveCascade(dto);
  91 + return new JsonResult<>(true, "成功", report);
  92 + }
  93 +
  94 + /**
  95 + * 级联删除 A3 报告
  96 + *
  97 + * @param id 主键 id
  98 + * @return 删除结果
  99 + */
  100 + @PostMapping("/delete/{id}")
  101 + public JsonResult delete(@PathVariable String id) {
  102 + a3ReportService.deleteCascade(id);
  103 + return new JsonResult<>(true, "成功", null);
  104 + }
35 } 105 }
  1 +package com.qgutech.qgyun.apaas.sync.cpsfzzk.controller;
  2 +
  3 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.dto.A3ReportDetailDTO;
  4 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.enums.GzjhztEnum;
  5 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.enums.ZtEnum;
  6 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.model.A3Report;
  7 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.model.BlockInfo;
  8 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.model.CompanyIndicator;
  9 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.service.A3ReportService;
  10 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.service.BlockInfoService;
  11 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.service.CompanyIndicatorService;
  12 +import com.alibaba.fastjson.JSON;
  13 +import lombok.extern.slf4j.Slf4j;
  14 +import org.springframework.stereotype.Controller;
  15 +import org.springframework.ui.Model;
  16 +import org.springframework.web.bind.annotation.GetMapping;
  17 +import org.springframework.web.bind.annotation.PathVariable;
  18 +import org.springframework.web.bind.annotation.RequestMapping;
  19 +
  20 +import javax.annotation.Resource;
  21 +import java.util.ArrayList;
  22 +import java.util.Arrays;
  23 +import java.util.Collections;
  24 +import java.util.HashMap;
  25 +import java.util.LinkedHashMap;
  26 +import java.util.List;
  27 +import java.util.Map;
  28 +import java.util.stream.Collectors;
  29 +
  30 +/**
  31 + * A3 报告页面控制器(Thymeleaf 服务端渲染)。
  32 + * <p>
  33 + * 提供列表、新增、编辑、查看四个页面入口,路径以 /a3Report/page 开头,
  34 + * 已在 WebConfig 中排除拦截器,无需登录态即可访问。
  35 + */
  36 +@Slf4j
  37 +@Controller
  38 +@RequestMapping("/a3Report/page")
  39 +public class A3ReportPageController {
  40 +
  41 + @Resource
  42 + private A3ReportService a3ReportService;
  43 +
  44 + @Resource
  45 + private BlockInfoService blockInfoService;
  46 +
  47 + @Resource
  48 + private CompanyIndicatorService companyIndicatorService;
  49 +
  50 + /**
  51 + * A3 报告列表页
  52 + */
  53 + @GetMapping("/list")
  54 + public String list(Model model) {
  55 + List<A3Report> reports = a3ReportService.listAll();
  56 + // 板块 id -> 名称 映射,供列表页显示板块列
  57 + Map<String, String> blockNameMap = loadBlockNameMap();
  58 + model.addAttribute("reports", reports);
  59 + model.addAttribute("blockNameMap", blockNameMap);
  60 + model.addAttribute("gzjhztDescMap", buildGzjhztDescMap());
  61 + return "a3report/list";
  62 + }
  63 +
  64 + /**
  65 + * A3 报告新增页
  66 + */
  67 + @GetMapping("/add")
  68 + public String add(Model model) {
  69 + return renderForm(model, null, "add");
  70 + }
  71 +
  72 + /**
  73 + * A3 报告编辑页
  74 + */
  75 + @GetMapping("/edit/{id}")
  76 + public String edit(@PathVariable String id, Model model) {
  77 + return renderForm(model, id, "edit");
  78 + }
  79 +
  80 + /**
  81 + * A3 报告查看页(表单只读)
  82 + */
  83 + @GetMapping("/view/{id}")
  84 + public String view(@PathVariable String id, Model model) {
  85 + return renderForm(model, id, "view");
  86 + }
  87 +
  88 + /**
  89 + * 统一渲染 form.html:注入模式、详情、板块列表、指标分组、枚举下拉
  90 + */
  91 + private String renderForm(Model model, String id, String mode) {
  92 + A3ReportDetailDTO detail;
  93 + if (id == null || id.isEmpty()) {
  94 + detail = new A3ReportDetailDTO();
  95 + detail.setReport(new A3Report());
  96 + detail.setPlanStatusList(new ArrayList<>());
  97 + detail.setActionStepList(new ArrayList<>());
  98 + detail.setProblemEventList(new ArrayList<>());
  99 + } else {
  100 + detail = a3ReportService.getDetailById(id);
  101 + }
  102 +
  103 + List<BlockInfo> blockList = blockInfoService.listAll();
  104 + // 按板块 id 分组的公司级指标(页面用于选板块后联动过滤指标下拉)
  105 + Map<String, List<CompanyIndicator>> indicatorsByBlock = groupIndicatorsByBlock();
  106 +
  107 + model.addAttribute("mode", mode);
  108 + model.addAttribute("detail", detail);
  109 + model.addAttribute("blockList", blockList);
  110 + model.addAttribute("indicatorsByBlock", indicatorsByBlock);
  111 + model.addAttribute("gzjhztList", Arrays.asList(GzjhztEnum.values()));
  112 + model.addAttribute("ztList", Arrays.asList(ZtEnum.values()));
  113 +
  114 + // 前端需要直接使用的 JSON 字符串(日期统一格式化为 yyyy-MM-dd)
  115 + model.addAttribute("detailJson", JSON.toJSONStringWithDateFormat(detail, "yyyy-MM-dd"));
  116 + model.addAttribute("blockListJson", JSON.toJSONStringWithDateFormat(blockList, "yyyy-MM-dd"));
  117 + model.addAttribute("indicatorsByBlockJson", JSON.toJSONStringWithDateFormat(indicatorsByBlock, "yyyy-MM-dd"));
  118 + return "a3report/form";
  119 + }
  120 +
  121 + /**
  122 + * 加载板块 id -&gt; 名称 映射
  123 + */
  124 + private Map<String, String> loadBlockNameMap() {
  125 + List<BlockInfo> blockList = blockInfoService.listAll();
  126 + Map<String, String> map = new HashMap<>(blockList.size());
  127 + for (BlockInfo b : blockList) {
  128 + map.put(b.getId(), b.getMc());
  129 + }
  130 + return map;
  131 + }
  132 +
  133 + /**
  134 + * 加载所有公司级指标并按 ssbk(所属板块 id)分组,组内按 bkxh/zbxh 排序
  135 + */
  136 + private Map<String, List<CompanyIndicator>> groupIndicatorsByBlock() {
  137 + List<CompanyIndicator> all = companyIndicatorService.listAll();
  138 + if (all == null || all.isEmpty()) {
  139 + return Collections.emptyMap();
  140 + }
  141 + return all.stream()
  142 + .filter(i -> i.getSsbk() != null)
  143 + .collect(Collectors.groupingBy(CompanyIndicator::getSsbk, LinkedHashMap::new, Collectors.toList()));
  144 + }
  145 +
  146 + /**
  147 + * 工作计划状态 code -&gt; desc 映射(列表页展示用)
  148 + */
  149 + private Map<String, String> buildGzjhztDescMap() {
  150 + Map<String, String> map = new LinkedHashMap<>();
  151 + for (GzjhztEnum e : GzjhztEnum.values()) {
  152 + map.put(e.getCode(), e.getDesc());
  153 + }
  154 + return map;
  155 + }
  156 +}
  1 +package com.qgutech.qgyun.apaas.sync.cpsfzzk.dto;
  2 +
  3 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.model.A3ActionStep;
  4 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.model.A3PlanStatus;
  5 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.model.A3ProblemEvent;
  6 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.model.A3Report;
  7 +import lombok.Getter;
  8 +import lombok.Setter;
  9 +import lombok.ToString;
  10 +
  11 +import java.util.ArrayList;
  12 +import java.util.HashMap;
  13 +import java.util.List;
  14 +import java.util.Map;
  15 +
  16 +/**
  17 + * A3 报告详情聚合返回体。
  18 + * <p>
  19 + * 包含主表、三张子表原始数据,以及供页面回显的板块名称、指标 id-&gt;名称映射。
  20 + */
  21 +@Getter
  22 +@Setter
  23 +@ToString
  24 +public class A3ReportDetailDTO {
  25 +
  26 + /**
  27 + * A3 报告主表
  28 + */
  29 + private A3Report report;
  30 +
  31 + /**
  32 + * 工作计划状态和 BIC 列表
  33 + */
  34 + private List<A3PlanStatus> planStatusList = new ArrayList<>();
  35 +
  36 + /**
  37 + * 推进的行为和步骤列表
  38 + */
  39 + private List<A3ActionStep> actionStepList = new ArrayList<>();
  40 +
  41 + /**
  42 + * 显示阶段问题事件列表
  43 + */
  44 + private List<A3ProblemEvent> problemEventList = new ArrayList<>();
  45 +
  46 + /**
  47 + * 板块名称(BlockInfo.mc)
  48 + */
  49 + private String bkName;
  50 +
  51 + /**
  52 + * 指标 id -&gt; 名称(CompanyIndicator.mc)映射,供页面回显
  53 + */
  54 + private Map<String, String> zbNameMap = new HashMap<>();
  55 +}
  1 +package com.qgutech.qgyun.apaas.sync.cpsfzzk.dto;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
  4 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.model.A3ActionStep;
  5 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.model.A3PlanStatus;
  6 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.model.A3ProblemEvent;
  7 +import lombok.Getter;
  8 +import lombok.Setter;
  9 +import lombok.ToString;
  10 +
  11 +import java.util.ArrayList;
  12 +import java.util.Date;
  13 +import java.util.List;
  14 +
  15 +/**
  16 + * A3 报告级联保存请求体。
  17 + * <p>
  18 + * 主表字段与 {@link com.qgutech.qgyun.apaas.sync.cpsfzzk.model.A3Report} 一致,
  19 + * 子表以列表形式提交,后端按主表 id 关联重建。
  20 + */
  21 +@Getter
  22 +@Setter
  23 +@ToString
  24 +public class A3ReportSaveDTO {
  25 +
  26 + /**
  27 + * 主表 id,为空表示新增,非空表示更新
  28 + */
  29 + private String id;
  30 +
  31 + /**
  32 + * 板块(BlockInfo id)
  33 + */
  34 + private String bk;
  35 +
  36 + /**
  37 + * 负责人
  38 + */
  39 + private String fzr;
  40 +
  41 + /**
  42 + * 目标及现状情况
  43 + */
  44 + private String mdjxqkh;
  45 +
  46 + /**
  47 + * 工作计划状态(GzjhztEnum code)
  48 + */
  49 + private String gzjhzt;
  50 +
  51 + /**
  52 + * 战略考量
  53 + */
  54 + private String zlkl;
  55 +
  56 + /**
  57 + * 推进的行为和步骤(总述)
  58 + */
  59 + private String tjdxwh;
  60 +
  61 + /**
  62 + * 显示阶段问题(总述)
  63 + */
  64 + private String xsjdwt;
  65 +
  66 + /**
  67 + * 年份
  68 + */
  69 + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
  70 + private Date nf;
  71 +
  72 + /**
  73 + * 工作计划状态和 BIC 列表
  74 + */
  75 + private List<A3PlanStatus> planStatusList = new ArrayList<>();
  76 +
  77 + /**
  78 + * 推进的行为和步骤列表
  79 + */
  80 + private List<A3ActionStep> actionStepList = new ArrayList<>();
  81 +
  82 + /**
  83 + * 显示阶段问题事件列表
  84 + */
  85 + private List<A3ProblemEvent> problemEventList = new ArrayList<>();
  86 +}
@@ -18,8 +18,7 @@ import java.util.Date; @@ -18,8 +18,7 @@ import java.util.Date;
18 public class A3PlanStatus extends BaseCorpModel { 18 public class A3PlanStatus extends BaseCorpModel {
19 19
20 public static final String SSABG = "ssabg"; 20 public static final String SSABG = "ssabg";
21 - public static final String BK = "bk";  
22 - public static final String ZB = "zb"; 21 + public static final String BKXX = "bkxx";
23 public static final String ZBXH = "zbxh"; 22 public static final String ZBXH = "zbxh";
24 public static final String GSZB = "gszb"; 23 public static final String GSZB = "gszb";
25 24
@@ -31,12 +30,12 @@ public class A3PlanStatus extends BaseCorpModel { @@ -31,12 +30,12 @@ public class A3PlanStatus extends BaseCorpModel {
31 /* 30 /*
32 * 板块 31 * 板块
33 */ 32 */
34 - private String bk; 33 + private String bkxx;
35 34
36 /* 35 /*
37 - * 指标 36 + * 公司指标
38 */ 37 */
39 - private String zb; 38 + private String gszb;
40 39
41 /* 40 /*
42 * 指标序号 41 * 指标序号
@@ -88,8 +87,4 @@ public class A3PlanStatus extends BaseCorpModel { @@ -88,8 +87,4 @@ public class A3PlanStatus extends BaseCorpModel {
88 */ 87 */
89 private String bicbiw; 88 private String bicbiw;
90 89
91 - /*  
92 - * 公司指标  
93 - */  
94 - private String gszb;  
95 } 90 }
@@ -17,7 +17,7 @@ import java.util.Date; @@ -17,7 +17,7 @@ import java.util.Date;
17 @Table(name = "t_auto_hfca_dnxpkp_abgxxx") 17 @Table(name = "t_auto_hfca_dnxpkp_abgxxx")
18 public class A3Report extends BaseCorpModel { 18 public class A3Report extends BaseCorpModel {
19 19
20 - public static final String BK = "bk"; 20 + public static final String BKXX = "bkxx";
21 public static final String FZR = "fzr"; 21 public static final String FZR = "fzr";
22 public static final String NF = "nf"; 22 public static final String NF = "nf";
23 public static final String GZJHZT = "gzjhzt"; 23 public static final String GZJHZT = "gzjhzt";
@@ -25,7 +25,7 @@ public class A3Report extends BaseCorpModel { @@ -25,7 +25,7 @@ public class A3Report extends BaseCorpModel {
25 /* 25 /*
26 * 板块 26 * 板块
27 */ 27 */
28 - private String bk; 28 + private String bkxx;
29 29
30 /* 30 /*
31 * 负责人 31 * 负责人
@@ -69,4 +69,64 @@ public class A3ActionStepService extends BaseServiceImpl<A3ActionStep> { @@ -69,4 +69,64 @@ public class A3ActionStepService extends BaseServiceImpl<A3ActionStep> {
69 Example example = CorpExample.ofCorp(entityClass); 69 Example example = CorpExample.ofCorp(entityClass);
70 return a3ActionStepMapper.selectByExample(example); 70 return a3ActionStepMapper.selectByExample(example);
71 } 71 }
  72 +
  73 + /**
  74 + * 根据所属 A3 报告 id 查询推进行为和步骤列表
  75 + *
  76 + * @param ssabg 所属 A3 报告 id
  77 + * @return 记录列表,ssabg 为空时返回空列表
  78 + */
  79 + @Transactional(readOnly = true)
  80 + public List<A3ActionStep> listBySsabg(String ssabg) {
  81 + if (ssabg == null || ssabg.isEmpty()) {
  82 + return new ArrayList<>(0);
  83 + }
  84 + Example example = new Example(entityClass);
  85 + CorpExample.criteria(example).andEqualTo(A3ActionStep.SSABG, ssabg);
  86 + example.orderBy(A3ActionStep.XH).asc();
  87 + return a3ActionStepMapper.selectByExample(example);
  88 + }
  89 +
  90 + /**
  91 + * 根据所属 A3 报告 id 删除全部子记录
  92 + *
  93 + * @param ssabg 所属 A3 报告 id
  94 + * @return 删除条数
  95 + */
  96 + @Transactional(rollbackFor = Exception.class)
  97 + public int deleteBySsabg(String ssabg) {
  98 + if (ssabg == null || ssabg.isEmpty()) {
  99 + return 0;
  100 + }
  101 + Example example = new Example(entityClass);
  102 + CorpExample.criteria(example).andEqualTo(A3ActionStep.SSABG, ssabg);
  103 + return a3ActionStepMapper.deleteByExample(example);
  104 + }
  105 +
  106 + /**
  107 + * 保存单条记录:id 为空时新增,非空时按主键选择性更新
  108 + *
  109 + * @param entity 待保存实体
  110 + * @return 主键 id
  111 + */
  112 + @Transactional(rollbackFor = Exception.class)
  113 + public String save(A3ActionStep entity) {
  114 + Assert.notNull(entity, "entity is null!");
  115 + if (entity.getId() == null || entity.getId().isEmpty()) {
  116 + return insert(entity);
  117 + }
  118 + a3ActionStepMapper.updateByPrimaryKeySelective(entity);
  119 + return entity.getId();
  120 + }
  121 +
  122 + /**
  123 + * 按主键删除
  124 + *
  125 + * @param id 主键 id
  126 + */
  127 + @Transactional(rollbackFor = Exception.class)
  128 + public void deleteById(String id) {
  129 + Assert.hasLength(id, "id is empty!");
  130 + a3ActionStepMapper.deleteByPrimaryKey(id);
  131 + }
72 } 132 }
@@ -69,4 +69,63 @@ public class A3PlanStatusService extends BaseServiceImpl<A3PlanStatus> { @@ -69,4 +69,63 @@ public class A3PlanStatusService extends BaseServiceImpl<A3PlanStatus> {
69 Example example = CorpExample.ofCorp(entityClass); 69 Example example = CorpExample.ofCorp(entityClass);
70 return a3PlanStatusMapper.selectByExample(example); 70 return a3PlanStatusMapper.selectByExample(example);
71 } 71 }
  72 +
  73 + /**
  74 + * 根据所属 A3 报告 id 查询工作计划状态和 BIC 列表
  75 + *
  76 + * @param ssabg 所属 A3 报告 id
  77 + * @return 记录列表,ssabg 为空时返回空列表
  78 + */
  79 + @Transactional(readOnly = true)
  80 + public List<A3PlanStatus> listBySsabg(String ssabg) {
  81 + if (ssabg == null || ssabg.isEmpty()) {
  82 + return new ArrayList<>(0);
  83 + }
  84 + Example example = new Example(entityClass);
  85 + CorpExample.criteria(example).andEqualTo(A3PlanStatus.SSABG, ssabg);
  86 + return a3PlanStatusMapper.selectByExample(example);
  87 + }
  88 +
  89 + /**
  90 + * 根据所属 A3 报告 id 删除全部子记录
  91 + *
  92 + * @param ssabg 所属 A3 报告 id
  93 + * @return 删除条数
  94 + */
  95 + @Transactional(rollbackFor = Exception.class)
  96 + public int deleteBySsabg(String ssabg) {
  97 + if (ssabg == null || ssabg.isEmpty()) {
  98 + return 0;
  99 + }
  100 + Example example = new Example(entityClass);
  101 + CorpExample.criteria(example).andEqualTo(A3PlanStatus.SSABG, ssabg);
  102 + return a3PlanStatusMapper.deleteByExample(example);
  103 + }
  104 +
  105 + /**
  106 + * 保存单条记录:id 为空时新增,非空时按主键选择性更新
  107 + *
  108 + * @param entity 待保存实体
  109 + * @return 主键 id
  110 + */
  111 + @Transactional(rollbackFor = Exception.class)
  112 + public String save(A3PlanStatus entity) {
  113 + Assert.notNull(entity, "entity is null!");
  114 + if (entity.getId() == null || entity.getId().isEmpty()) {
  115 + return insert(entity);
  116 + }
  117 + a3PlanStatusMapper.updateByPrimaryKeySelective(entity);
  118 + return entity.getId();
  119 + }
  120 +
  121 + /**
  122 + * 按主键删除
  123 + *
  124 + * @param id 主键 id
  125 + */
  126 + @Transactional(rollbackFor = Exception.class)
  127 + public void deleteById(String id) {
  128 + Assert.hasLength(id, "id is empty!");
  129 + a3PlanStatusMapper.deleteByPrimaryKey(id);
  130 + }
72 } 131 }
@@ -69,4 +69,63 @@ public class A3ProblemEventService extends BaseServiceImpl<A3ProblemEvent> { @@ -69,4 +69,63 @@ public class A3ProblemEventService extends BaseServiceImpl<A3ProblemEvent> {
69 Example example = CorpExample.ofCorp(entityClass); 69 Example example = CorpExample.ofCorp(entityClass);
70 return a3ProblemEventMapper.selectByExample(example); 70 return a3ProblemEventMapper.selectByExample(example);
71 } 71 }
  72 +
  73 + /**
  74 + * 根据所属 A3 报告 id 查询问题事件列表
  75 + *
  76 + * @param ssabg 所属 A3 报告 id
  77 + * @return 记录列表,ssabg 为空时返回空列表
  78 + */
  79 + @Transactional(readOnly = true)
  80 + public List<A3ProblemEvent> listBySsabg(String ssabg) {
  81 + if (ssabg == null || ssabg.isEmpty()) {
  82 + return new ArrayList<>(0);
  83 + }
  84 + Example example = new Example(entityClass);
  85 + CorpExample.criteria(example).andEqualTo(A3ProblemEvent.SSABG, ssabg);
  86 + return a3ProblemEventMapper.selectByExample(example);
  87 + }
  88 +
  89 + /**
  90 + * 根据所属 A3 报告 id 删除全部子记录
  91 + *
  92 + * @param ssabg 所属 A3 报告 id
  93 + * @return 删除条数
  94 + */
  95 + @Transactional(rollbackFor = Exception.class)
  96 + public int deleteBySsabg(String ssabg) {
  97 + if (ssabg == null || ssabg.isEmpty()) {
  98 + return 0;
  99 + }
  100 + Example example = new Example(entityClass);
  101 + CorpExample.criteria(example).andEqualTo(A3ProblemEvent.SSABG, ssabg);
  102 + return a3ProblemEventMapper.deleteByExample(example);
  103 + }
  104 +
  105 + /**
  106 + * 保存单条记录:id 为空时新增,非空时按主键选择性更新
  107 + *
  108 + * @param entity 待保存实体
  109 + * @return 主键 id
  110 + */
  111 + @Transactional(rollbackFor = Exception.class)
  112 + public String save(A3ProblemEvent entity) {
  113 + Assert.notNull(entity, "entity is null!");
  114 + if (entity.getId() == null || entity.getId().isEmpty()) {
  115 + return insert(entity);
  116 + }
  117 + a3ProblemEventMapper.updateByPrimaryKeySelective(entity);
  118 + return entity.getId();
  119 + }
  120 +
  121 + /**
  122 + * 按主键删除
  123 + *
  124 + * @param id 主键 id
  125 + */
  126 + @Transactional(rollbackFor = Exception.class)
  127 + public void deleteById(String id) {
  128 + Assert.hasLength(id, "id is empty!");
  129 + a3ProblemEventMapper.deleteByPrimaryKey(id);
  130 + }
72 } 131 }
1 package com.qgutech.qgyun.apaas.sync.cpsfzzk.service; 1 package com.qgutech.qgyun.apaas.sync.cpsfzzk.service;
2 2
3 -import com.qgutech.qgyun.framework.database.mybatis.service.BaseServiceImpl;  
4 import com.qgutech.qgyun.apaas.sync.base.BoErrorCode; 3 import com.qgutech.qgyun.apaas.sync.base.BoErrorCode;
5 import com.qgutech.qgyun.apaas.sync.base.BoException; 4 import com.qgutech.qgyun.apaas.sync.base.BoException;
  5 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.dto.A3ReportDetailDTO;
  6 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.dto.A3ReportSaveDTO;
6 import com.qgutech.qgyun.apaas.sync.cpsfzzk.mapper.A3ReportMapper; 7 import com.qgutech.qgyun.apaas.sync.cpsfzzk.mapper.A3ReportMapper;
  8 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.model.A3ActionStep;
  9 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.model.A3PlanStatus;
  10 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.model.A3ProblemEvent;
7 import com.qgutech.qgyun.apaas.sync.cpsfzzk.model.A3Report; 11 import com.qgutech.qgyun.apaas.sync.cpsfzzk.model.A3Report;
  12 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.model.BlockInfo;
  13 +import com.qgutech.qgyun.apaas.sync.cpsfzzk.model.CompanyIndicator;
  14 +import com.qgutech.qgyun.apaas.sync.utils.CorpExample;
  15 +import com.qgutech.qgyun.framework.database.mybatis.service.BaseServiceImpl;
8 import org.apache.commons.collections4.CollectionUtils; 16 import org.apache.commons.collections4.CollectionUtils;
  17 +import org.apache.commons.lang3.StringUtils;
9 import org.springframework.stereotype.Service; 18 import org.springframework.stereotype.Service;
10 import org.springframework.transaction.annotation.Transactional; 19 import org.springframework.transaction.annotation.Transactional;
11 import org.springframework.util.Assert; 20 import org.springframework.util.Assert;
12 -import com.qgutech.qgyun.apaas.sync.utils.CorpExample;  
13 import tk.mybatis.mapper.entity.Example; 21 import tk.mybatis.mapper.entity.Example;
14 22
15 import javax.annotation.Resource; 23 import javax.annotation.Resource;
16 -import java.util.*; 24 +import java.util.ArrayList;
  25 +import java.util.Calendar;
  26 +import java.util.Collection;
  27 +import java.util.Date;
  28 +import java.util.HashMap;
  29 +import java.util.List;
  30 +import java.util.Map;
17 import java.util.stream.Collectors; 31 import java.util.stream.Collectors;
18 32
19 /** 33 /**
@@ -25,6 +39,21 @@ public class A3ReportService extends BaseServiceImpl<A3Report> { @@ -25,6 +39,21 @@ public class A3ReportService extends BaseServiceImpl<A3Report> {
25 @Resource 39 @Resource
26 private A3ReportMapper a3ReportMapper; 40 private A3ReportMapper a3ReportMapper;
27 41
  42 + @Resource
  43 + private A3PlanStatusService a3PlanStatusService;
  44 +
  45 + @Resource
  46 + private A3ActionStepService a3ActionStepService;
  47 +
  48 + @Resource
  49 + private A3ProblemEventService a3ProblemEventService;
  50 +
  51 + @Resource
  52 + private BlockInfoService blockInfoService;
  53 +
  54 + @Resource
  55 + private CompanyIndicatorService companyIndicatorService;
  56 +
28 @Transactional(readOnly = true) 57 @Transactional(readOnly = true)
29 public A3Report getById(String id) { 58 public A3Report getById(String id) {
30 Assert.hasLength(id, "id is empty!"); 59 Assert.hasLength(id, "id is empty!");
@@ -69,4 +98,194 @@ public class A3ReportService extends BaseServiceImpl<A3Report> { @@ -69,4 +98,194 @@ public class A3ReportService extends BaseServiceImpl<A3Report> {
69 Example example = CorpExample.ofCorp(entityClass); 98 Example example = CorpExample.ofCorp(entityClass);
70 return a3ReportMapper.selectByExample(example); 99 return a3ReportMapper.selectByExample(example);
71 } 100 }
  101 +
  102 + /**
  103 + * 按可选条件查询 A3 报告列表:板块、负责人、年份(yyyy)
  104 + *
  105 + * @param bk 板块 id,可为空
  106 + * @param fzr 负责人,可为空(模糊匹配)
  107 + * @param nfYear 年份(yyyy),可为空,按 nf 字段 [yyyy-01-01, yyyy-12-31] 区间过滤
  108 + * @return 匹配列表
  109 + */
  110 + @Transactional(readOnly = true)
  111 + public List<A3Report> listByCondition(String bk, String fzr, Integer nfYear) {
  112 + Example example = new Example(entityClass);
  113 + Example.Criteria criteria = CorpExample.criteria(example);
  114 + if (StringUtils.isNotBlank(bk)) {
  115 + criteria.andEqualTo(A3Report.BKXX, bk);
  116 + }
  117 + if (StringUtils.isNotBlank(fzr)) {
  118 + criteria.andLike(A3Report.FZR, "%" + fzr + "%");
  119 + }
  120 + if (nfYear != null) {
  121 + Calendar cal = Calendar.getInstance();
  122 + cal.clear();
  123 + cal.set(nfYear, Calendar.JANUARY, 1, 0, 0, 0);
  124 + Date start = cal.getTime();
  125 + cal.set(nfYear, Calendar.DECEMBER, 31, 23, 59, 59);
  126 + Date end = cal.getTime();
  127 + criteria.andBetween(A3Report.NF, start, end);
  128 + }
  129 + example.orderBy(A3Report.NF).desc();
  130 + return a3ReportMapper.selectByExample(example);
  131 + }
  132 +
  133 + /**
  134 + * 聚合查询 A3 报告详情:主表 + 三张子表 + 板块名称 + 指标名称映射
  135 + *
  136 + * @param id 主表 id
  137 + * @return 详情 DTO
  138 + */
  139 + @Transactional(readOnly = true)
  140 + public A3ReportDetailDTO getDetailById(String id) {
  141 + A3Report report = getById(id);
  142 +
  143 + A3ReportDetailDTO dto = new A3ReportDetailDTO();
  144 + dto.setReport(report);
  145 + dto.setPlanStatusList(a3PlanStatusService.listBySsabg(id));
  146 + dto.setActionStepList(a3ActionStepService.listBySsabg(id));
  147 + dto.setProblemEventList(a3ProblemEventService.listBySsabg(id));
  148 +
  149 + // 板块名称回显
  150 + if (StringUtils.isNotBlank(report.getBkxx())) {
  151 + BlockInfo blockInfo = blockInfoService.getByIdOrNull(report.getBkxx());
  152 + if (blockInfo != null) {
  153 + dto.setBkName(blockInfo.getMc());
  154 + }
  155 + }
  156 +
  157 + // 指标名称映射
  158 + List<String> zbIds = dto.getPlanStatusList().stream()
  159 + .map(A3PlanStatus::getGszb)
  160 + .filter(StringUtils::isNotBlank)
  161 + .distinct()
  162 + .collect(Collectors.toList());
  163 + if (CollectionUtils.isNotEmpty(zbIds)) {
  164 + Map<String, CompanyIndicator> zbMap = companyIndicatorService.mapByIds(zbIds);
  165 + Map<String, String> zbNameMap = new HashMap<>(zbMap.size());
  166 + zbMap.forEach((k, v) -> zbNameMap.put(k, v.getMc()));
  167 + dto.setZbNameMap(zbNameMap);
  168 + }
  169 + return dto;
  170 + }
  171 +
  172 + /**
  173 + * 级联保存 A3 报告:主表 id 为空则新增,非空则选择性更新;
  174 + * 三张子表统一按 ssabg 全删后重建,写入前由后端回填 ssabg/bk 等关联字段。
  175 + *
  176 + * @param dto 保存请求体
  177 + * @return 主表实体(含最新 id)
  178 + */
  179 + @Transactional(rollbackFor = Exception.class)
  180 + public A3Report saveCascade(A3ReportSaveDTO dto) {
  181 + Assert.notNull(dto, "dto is null!");
  182 +
  183 + // 1. 主表:id 为空新增,非空更新
  184 + A3Report report = new A3Report();
  185 + report.setId(StringUtils.isBlank(dto.getId()) ? null : dto.getId());
  186 + report.setBkxx(dto.getBk());
  187 + report.setFzr(dto.getFzr());
  188 + report.setMdjxqkh(dto.getMdjxqkh());
  189 + report.setGzjhzt(dto.getGzjhzt());
  190 + report.setZlkl(dto.getZlkl());
  191 + report.setTjdxwh(dto.getTjdxwh());
  192 + report.setXsjdwt(dto.getXsjdwt());
  193 + report.setNf(dto.getNf());
  194 +
  195 + String reportId;
  196 + if (StringUtils.isBlank(dto.getId())) {
  197 + reportId = insert(report);
  198 + report.setId(reportId);
  199 + } else {
  200 + reportId = dto.getId();
  201 + a3ReportMapper.updateByPrimaryKeySelective(report);
  202 + }
  203 +
  204 + // 2. 板块序号(BlockInfo.xh)用于回填子表 bkxh(仅 A3ActionStep 有 bkxh 字段)
  205 + String bkxh = null;
  206 + if (StringUtils.isNotBlank(report.getBkxx())) {
  207 + BlockInfo blockInfo = blockInfoService.getByIdOrNull(report.getBkxx());
  208 + if (blockInfo != null) {
  209 + bkxh = blockInfo.getXh();
  210 + }
  211 + }
  212 +
  213 + // 3. 子表:先按 ssabg 全删,再批量 insert
  214 + a3PlanStatusService.deleteBySsabg(reportId);
  215 + a3ActionStepService.deleteBySsabg(reportId);
  216 + a3ProblemEventService.deleteBySsabg(reportId);
  217 +
  218 + // 3.1 工作计划状态和 BIC
  219 + if (CollectionUtils.isNotEmpty(dto.getPlanStatusList())) {
  220 + for (A3PlanStatus src : dto.getPlanStatusList()) {
  221 + A3PlanStatus item = new A3PlanStatus();
  222 + item.setSsabg(reportId);
  223 + item.setBkxx(report.getBkxx());
  224 + item.setGszb(src.getGszb());
  225 + item.setCx(src.getCx());
  226 + item.setSnd(src.getSnd());
  227 + item.setSndz(src.getSndz());
  228 + item.setBnd(src.getBnd());
  229 + item.setBndz(src.getBndz());
  230 + item.setHn(src.getHn());
  231 + item.setHndz(src.getHndz());
  232 + item.setB(src.getB());
  233 + item.setBicbiw(src.getBicbiw());
  234 + // 指标序号 / 公司指标 从 CompanyIndicator 反查回填
  235 + if (StringUtils.isNotBlank(src.getGszb())) {
  236 + CompanyIndicator indicator = companyIndicatorService.getByIdOrNull(src.getGszb());
  237 + if (indicator != null) {
  238 + item.setZbxh(indicator.getZbxh());
  239 + item.setGszb(indicator.getMc());
  240 + }
  241 + }
  242 + a3PlanStatusService.insert(item);
  243 + }
  244 + }
  245 +
  246 + // 3.2 推进的行为和步骤
  247 + if (CollectionUtils.isNotEmpty(dto.getActionStepList())) {
  248 + int seq = 1;
  249 + for (A3ActionStep src : dto.getActionStepList()) {
  250 + A3ActionStep item = new A3ActionStep();
  251 + item.setSsabg(reportId);
  252 + item.setBk(report.getBkxx());
  253 + item.setBkxh(bkxh);
  254 + item.setTjdxwhbz(src.getTjdxwhbz());
  255 + item.setZt(src.getZt());
  256 + item.setXwbzxh(src.getXwbzxh());
  257 + item.setXh(StringUtils.isNotBlank(src.getXh()) ? src.getXh() : String.valueOf(seq));
  258 + a3ActionStepService.insert(item);
  259 + seq++;
  260 + }
  261 + }
  262 +
  263 + // 3.3 显示阶段问题事件
  264 + if (CollectionUtils.isNotEmpty(dto.getProblemEventList())) {
  265 + for (A3ProblemEvent src : dto.getProblemEventList()) {
  266 + A3ProblemEvent item = new A3ProblemEvent();
  267 + item.setSsabg(reportId);
  268 + item.setXsjdwtsj(src.getXsjdwtsj());
  269 + item.setZrr(src.getZrr());
  270 + item.setSj(src.getSj());
  271 + a3ProblemEventService.insert(item);
  272 + }
  273 + }
  274 +
  275 + return report;
  276 + }
  277 +
  278 + /**
  279 + * 级联删除 A3 报告:先删三张子表,再删主表
  280 + *
  281 + * @param id 主表 id
  282 + */
  283 + @Transactional(rollbackFor = Exception.class)
  284 + public void deleteCascade(String id) {
  285 + Assert.hasLength(id, "id is empty!");
  286 + a3PlanStatusService.deleteBySsabg(id);
  287 + a3ActionStepService.deleteBySsabg(id);
  288 + a3ProblemEventService.deleteBySsabg(id);
  289 + a3ReportMapper.deleteByPrimaryKey(id);
  290 + }
72 } 291 }
@@ -90,4 +90,20 @@ public class BlockInfoService extends BaseServiceImpl<BlockInfo> { @@ -90,4 +90,20 @@ public class BlockInfoService extends BaseServiceImpl<BlockInfo> {
90 } 90 }
91 return list.get(0); 91 return list.get(0);
92 } 92 }
  93 +
  94 + /**
  95 + * 根据 id 查询板块信息,不存在时返回 null(不抛异常)
  96 + *
  97 + * @param id 板块 id
  98 + * @return 板块信息,id 为空或不存在时返回 null
  99 + */
  100 + @Transactional(readOnly = true)
  101 + public BlockInfo getByIdOrNull(String id) {
  102 + if (StringUtils.isBlank(id)) {
  103 + return null;
  104 + }
  105 + Example example = new Example(entityClass);
  106 + CorpExample.criteria(example).andEqualTo(BlockInfo.ID, id);
  107 + return blockInfoMapper.selectOneByExample(example);
  108 + }
93 } 109 }
@@ -10,7 +10,9 @@ public class WebConfig implements WebMvcConfigurer { @@ -10,7 +10,9 @@ public class WebConfig implements WebMvcConfigurer {
10 10
11 @Override 11 @Override
12 public void addInterceptors(InterceptorRegistry registry) { 12 public void addInterceptors(InterceptorRegistry registry) {
13 - registry.addInterceptor(new MyInterceptor()).addPathPatterns("/**").excludePathPatterns("/static/**"); 13 + registry.addInterceptor(new MyInterceptor())
  14 + .addPathPatterns("/**")
  15 + .excludePathPatterns("/static/**", "/a3Report/page/**", "/a3report/**", "/error");
14 } 16 }
15 17
16 @Override 18 @Override
@@ -4,6 +4,12 @@ server: @@ -4,6 +4,12 @@ server:
4 spring: 4 spring:
5 application: 5 application:
6 name: qx-apaas-sync 6 name: qx-apaas-sync
  7 + thymeleaf:
  8 + cache: false
  9 + prefix: classpath:/templates/
  10 + suffix: .html
  11 + mode: HTML
  12 + encoding: UTF-8
7 datasource: 13 datasource:
8 url: jdbc:mysql://10.9.0.128:3306/qixiao-apaas?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8 14 url: jdbc:mysql://10.9.0.128:3306/qixiao-apaas?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8
9 username: guohao 15 username: guohao
  1 +/* ==========================================================================
  2 + A3 报告页面样式:整体风格参照年度方针管理看板截图(蓝色标题栏 + 灰底表头)
  3 + ========================================================================== */
  4 +
  5 +* {
  6 + box-sizing: border-box;
  7 +}
  8 +
  9 +body.a3-page {
  10 + margin: 0;
  11 + padding: 0;
  12 + font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  13 + font-size: 13px;
  14 + color: #303133;
  15 + background: #f0f2f5;
  16 + line-height: 1.5;
  17 +}
  18 +
  19 +/* ---------- 顶部页头 ---------- */
  20 +.a3-header {
  21 + background: linear-gradient(90deg, #1e6fd9 0%, #2b8ae6 100%);
  22 + color: #fff;
  23 + padding: 14px 24px;
  24 + display: flex;
  25 + justify-content: space-between;
  26 + align-items: center;
  27 + box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  28 +}
  29 +
  30 +.a3-header-title {
  31 + display: flex;
  32 + align-items: center;
  33 +}
  34 +
  35 +.a3-header-bar {
  36 + display: inline-block;
  37 + width: 4px;
  38 + height: 22px;
  39 + background: #ffd04b;
  40 + margin-right: 10px;
  41 + border-radius: 2px;
  42 +}
  43 +
  44 +.a3-header-title h1 {
  45 + font-size: 18px;
  46 + margin: 0;
  47 + font-weight: 600;
  48 + letter-spacing: 1px;
  49 +}
  50 +
  51 +.a3-header-title h1 small {
  52 + font-size: 13px;
  53 + font-weight: normal;
  54 + opacity: 0.85;
  55 + margin-left: 6px;
  56 +}
  57 +
  58 +.a3-header-actions .btn {
  59 + background: rgba(255, 255, 255, 0.15);
  60 + color: #fff;
  61 + border: 1px solid rgba(255, 255, 255, 0.5);
  62 +}
  63 +
  64 +.a3-header-actions .btn:hover {
  65 + background: rgba(255, 255, 255, 0.28);
  66 +}
  67 +
  68 +.a3-header-actions .btn-primary {
  69 + background: #ffd04b;
  70 + color: #1e6fd9;
  71 + border-color: #ffd04b;
  72 + font-weight: 600;
  73 +}
  74 +
  75 +.a3-header-actions .btn-primary:hover {
  76 + background: #ffdb70;
  77 +}
  78 +
  79 +/* ---------- 卡片区块 ---------- */
  80 +.a3-card {
  81 + background: #fff;
  82 + margin: 14px 20px;
  83 + border: 1px solid #d0d7de;
  84 + border-radius: 4px;
  85 + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  86 + overflow: hidden;
  87 +}
  88 +
  89 +.a3-card-title {
  90 + background: #1e6fd9;
  91 + color: #fff;
  92 + padding: 8px 14px;
  93 + font-size: 14px;
  94 + font-weight: 600;
  95 + display: flex;
  96 + align-items: center;
  97 + letter-spacing: 0.5px;
  98 +}
  99 +
  100 +.a3-card-title-bar {
  101 + display: inline-block;
  102 + width: 3px;
  103 + height: 14px;
  104 + background: #ffd04b;
  105 + margin-right: 8px;
  106 + border-radius: 2px;
  107 +}
  108 +
  109 +.a3-card-title-btn {
  110 + margin-left: auto;
  111 +}
  112 +
  113 +/* ---------- 表单网格 ---------- */
  114 +.a3-form-grid {
  115 + display: grid;
  116 + grid-template-columns: repeat(4, minmax(0, 1fr));
  117 + gap: 12px 18px;
  118 + padding: 14px 18px;
  119 +}
  120 +
  121 +.a3-form-item {
  122 + display: flex;
  123 + flex-direction: column;
  124 +}
  125 +
  126 +.a3-form-item-full {
  127 + grid-column: 1 / -1;
  128 +}
  129 +
  130 +.a3-form-item label {
  131 + font-size: 12px;
  132 + color: #606266;
  133 + margin-bottom: 4px;
  134 + font-weight: 500;
  135 +}
  136 +
  137 +.a3-form-item label .req {
  138 + color: #f56c6c;
  139 + margin-left: 2px;
  140 +}
  141 +
  142 +.a3-form-item input[type="text"],
  143 +.a3-form-item input[type="number"],
  144 +.a3-form-item input[type="date"],
  145 +.a3-form-item select,
  146 +.a3-form-item textarea {
  147 + width: 100%;
  148 + padding: 6px 8px;
  149 + font-size: 13px;
  150 + border: 1px solid #dcdfe6;
  151 + border-radius: 3px;
  152 + background: #fff;
  153 + color: #303133;
  154 + outline: none;
  155 + font-family: inherit;
  156 + transition: border-color 0.15s;
  157 +}
  158 +
  159 +.a3-form-item input:focus,
  160 +.a3-form-item select:focus,
  161 +.a3-form-item textarea:focus {
  162 + border-color: #1e6fd9;
  163 +}
  164 +
  165 +.a3-form-item textarea {
  166 + resize: vertical;
  167 + min-height: 56px;
  168 +}
  169 +
  170 +/* ---------- 表格 ---------- */
  171 +.a3-table {
  172 + width: 100%;
  173 + border-collapse: collapse;
  174 + font-size: 13px;
  175 +}
  176 +
  177 +.a3-table thead th {
  178 + background: #f5f7fa;
  179 + color: #303133;
  180 + font-weight: 600;
  181 + text-align: left;
  182 + padding: 8px 10px;
  183 + border: 1px solid #e4e7ed;
  184 + white-space: nowrap;
  185 +}
  186 +
  187 +.a3-table tbody td {
  188 + padding: 6px 8px;
  189 + border: 1px solid #ebeef5;
  190 + vertical-align: middle;
  191 +}
  192 +
  193 +.a3-table tbody tr:nth-child(even) {
  194 + background: #fafbfc;
  195 +}
  196 +
  197 +.a3-table tbody tr:hover {
  198 + background: #ecf5ff;
  199 +}
  200 +
  201 +.a3-table input[type="text"],
  202 +.a3-table input[type="number"],
  203 +.a3-table input[type="date"],
  204 +.a3-table select,
  205 +.a3-table textarea {
  206 + width: 100%;
  207 + padding: 4px 6px;
  208 + font-size: 12px;
  209 + border: 1px solid #dcdfe6;
  210 + border-radius: 3px;
  211 + background: #fff;
  212 + outline: none;
  213 + font-family: inherit;
  214 +}
  215 +
  216 +.a3-table input:focus,
  217 +.a3-table select:focus,
  218 +.a3-table textarea:focus {
  219 + border-color: #1e6fd9;
  220 +}
  221 +
  222 +.a3-table .empty-tip {
  223 + text-align: center;
  224 + color: #909399;
  225 + padding: 20px;
  226 + background: #fff;
  227 +}
  228 +
  229 +.a3-table .row-index {
  230 + text-align: center;
  231 + color: #606266;
  232 + font-weight: 500;
  233 +}
  234 +
  235 +.a3-table .op-cell {
  236 + text-align: center;
  237 + white-space: nowrap;
  238 +}
  239 +
  240 +.a3-list-table td.ellipsis {
  241 + max-width: 320px;
  242 + overflow: hidden;
  243 + text-overflow: ellipsis;
  244 + white-space: nowrap;
  245 +}
  246 +
  247 +/* ---------- 按钮 ---------- */
  248 +.btn {
  249 + display: inline-block;
  250 + padding: 6px 14px;
  251 + font-size: 13px;
  252 + border: 1px solid #dcdfe6;
  253 + border-radius: 3px;
  254 + background: #fff;
  255 + color: #606266;
  256 + cursor: pointer;
  257 + text-decoration: none;
  258 + line-height: 1.4;
  259 + transition: all 0.15s;
  260 + font-family: inherit;
  261 +}
  262 +
  263 +.btn:hover {
  264 + color: #1e6fd9;
  265 + border-color: #c6e2ff;
  266 + background: #ecf5ff;
  267 +}
  268 +
  269 +.btn-primary {
  270 + background: #1e6fd9;
  271 + color: #fff;
  272 + border-color: #1e6fd9;
  273 +}
  274 +
  275 +.btn-primary:hover {
  276 + background: #2b8ae6;
  277 + color: #fff;
  278 + border-color: #2b8ae6;
  279 +}
  280 +
  281 +.btn-danger {
  282 + background: #fff;
  283 + color: #f56c6c;
  284 + border-color: #fbc4c4;
  285 +}
  286 +
  287 +.btn-danger:hover {
  288 + background: #f56c6c;
  289 + color: #fff;
  290 + border-color: #f56c6c;
  291 +}
  292 +
  293 +.btn-mini {
  294 + padding: 3px 10px;
  295 + font-size: 12px;
  296 +}
  297 +
  298 +.a3-header-actions .btn,
  299 +.a3-footer .btn {
  300 + margin-left: 8px;
  301 +}
  302 +
  303 +/* ---------- 底部按钮区 ---------- */
  304 +.a3-footer {
  305 + padding: 14px 20px 24px;
  306 + text-align: center;
  307 +}
  308 +
  309 +.a3-footer .btn {
  310 + min-width: 96px;
  311 + padding: 8px 20px;
  312 + font-size: 14px;
  313 +}
  314 +
  315 +/* ---------- 只读(查看)模式视觉降级 ---------- */
  316 +body.a3-page[data-mode="view"] input:disabled,
  317 +body.a3-page[data-mode="view"] select:disabled,
  318 +body.a3-page[data-mode="view"] textarea:disabled {
  319 + background: #f5f7fa;
  320 + color: #606266;
  321 + cursor: not-allowed;
  322 + border-color: #e4e7ed;
  323 +}
  324 +
  325 +/* ---------- 响应式 ---------- */
  326 +@media (max-width: 1200px) {
  327 + .a3-form-grid {
  328 + grid-template-columns: repeat(2, minmax(0, 1fr));
  329 + }
  330 +}
  331 +
  332 +@media (max-width: 720px) {
  333 + .a3-form-grid {
  334 + grid-template-columns: 1fr;
  335 + }
  336 +
  337 + .a3-header {
  338 + flex-direction: column;
  339 + align-items: flex-start;
  340 + gap: 8px;
  341 + }
  342 +}
  1 +/**
  2 + * A3 报告表单页脚本(新增/编辑/查看三合一)
  3 + *
  4 + * 依赖 window 全局变量(由 form.html Thymeleaf 内联注入):
  5 + * - __MODE__ : 'add' | 'edit' | 'view'
  6 + * - __REPORT_ID__ : 主表 id(新增时为 null)
  7 + * - __DETAIL__ : A3ReportDetailDTO 序列化对象
  8 + * - __BLOCKS__ : BlockInfo 列表
  9 + * - __INDICATORS_BY_BLOCK__: {blockId: [CompanyIndicator...]}
  10 + * - __GZJHZT_LIST__ : [{code, desc}...] 工作计划状态
  11 + * - __ZT_LIST__ : [{code, desc}...] 推进步骤状态
  12 + */
  13 +(function () {
  14 + 'use strict';
  15 +
  16 + var MODE = window.__MODE__ || 'add';
  17 + var DETAIL = window.__DETAIL__ || {};
  18 + var REPORT = DETAIL.report || {};
  19 + var BLOCKS = window.__BLOCKS__ || [];
  20 + var INDICATORS_BY_BLOCK = window.__INDICATORS_BY_BLOCK__ || {};
  21 + var ZT_LIST = window.__ZT_LIST__ || [];
  22 +
  23 + /* =============== 初始化 =============== */
  24 + document.addEventListener('DOMContentLoaded', function () {
  25 + initMasterForm();
  26 + renderPlanStatusRows(DETAIL.planStatusList || []);
  27 + renderActionStepRows(DETAIL.actionStepList || []);
  28 + renderProblemEventRows(DETAIL.problemEventList || []);
  29 +
  30 + var bkSel = document.getElementById('f-bk');
  31 + if (bkSel) {
  32 + bkSel.addEventListener('change', function () {
  33 + refreshAllIndicatorOptions();
  34 + });
  35 + }
  36 + });
  37 +
  38 + function initMasterForm() {
  39 + setVal('f-bk', REPORT.bk);
  40 + setVal('f-fzr', REPORT.fzr);
  41 + setVal('f-gzjhzt', REPORT.gzjhzt);
  42 + setVal('f-mdjxqkh', REPORT.mdjxqkh);
  43 + setVal('f-zlkl', REPORT.zlkl);
  44 + setVal('f-tjdxwh', REPORT.tjdxwh);
  45 + setVal('f-xsjdwt', REPORT.xsjdwt);
  46 + // nf 为 yyyy-MM-dd 字符串(Controller 已用 SimpleDateFormatSerializer 格式化)
  47 + if (REPORT.nf) {
  48 + var year = String(REPORT.nf).substring(0, 4);
  49 + setVal('f-nf-year', year);
  50 + }
  51 + }
  52 +
  53 + function setVal(id, val) {
  54 + var el = document.getElementById(id);
  55 + if (el) {
  56 + el.value = val == null ? '' : val;
  57 + }
  58 + }
  59 +
  60 + function getVal(id) {
  61 + var el = document.getElementById(id);
  62 + return el ? el.value : '';
  63 + }
  64 +
  65 + /* =============== 工作计划状态和 BIC =============== */
  66 + function renderPlanStatusRows(list) {
  67 + var tbody = document.getElementById('tbody-plan-status');
  68 + if (!tbody) return;
  69 + tbody.innerHTML = '';
  70 + if (!list || list.length === 0) {
  71 + if (MODE === 'view') {
  72 + tbody.appendChild(emptyRow(13, '暂无数据'));
  73 + }
  74 + return;
  75 + }
  76 + list.forEach(function (item, idx) {
  77 + tbody.appendChild(buildPlanStatusRow(item, idx + 1));
  78 + });
  79 + }
  80 +
  81 + function buildPlanStatusRow(item, seq) {
  82 + item = item || {};
  83 + var tr = document.createElement('tr');
  84 + tr.className = 'row-plan-status';
  85 +
  86 + // 序号
  87 + tr.appendChild(cellIndex(seq));
  88 +
  89 + // 指标(select,随板块联动)
  90 + var tdZb = document.createElement('td');
  91 + tdZb.appendChild(buildIndicatorSelect(item.zb));
  92 + tr.appendChild(tdZb);
  93 +
  94 + tr.appendChild(cellInput('text', 'cx', item.cx, '成效'));
  95 + tr.appendChild(cellInput('date', 'snd', item.snd, '上年度'));
  96 + tr.appendChild(cellInput('text', 'sndz', item.sndz, '上年度值'));
  97 + tr.appendChild(cellInput('date', 'bnd', item.bnd, '本年度'));
  98 + tr.appendChild(cellInput('text', 'bndz', item.bndz, '本年度值'));
  99 + tr.appendChild(cellInput('date', 'hn', item.hn, '后年'));
  100 + tr.appendChild(cellInput('text', 'hndz', item.hndz, '后年度值'));
  101 + tr.appendChild(cellInput('text', 'bicbiw', item.bicbiw, 'BIC 比率'));
  102 +
  103 + // 公司指标:只读,由后端根据 zb 反查回填,前端仅展示 DETAIL.zbNameMap
  104 + var zbNameMap = DETAIL.zbNameMap || {};
  105 + var tdGszb = document.createElement('td');
  106 + var gszbInput = document.createElement('input');
  107 + gszbInput.type = 'text';
  108 + gszbInput.readOnly = true;
  109 + gszbInput.className = 'gszb-display';
  110 + gszbInput.value = item.zb && zbNameMap[item.zb] ? zbNameMap[item.zb] : (item.gszb || '');
  111 + tdGszb.appendChild(gszbInput);
  112 + tr.appendChild(tdGszb);
  113 +
  114 + tr.appendChild(cellInput('text', 'b', item.b, '备注'));
  115 +
  116 + if (MODE !== 'view') {
  117 + tr.appendChild(cellRemove('删除此行'));
  118 + }
  119 + return tr;
  120 + }
  121 +
  122 + window.addPlanStatusRow = function () {
  123 + var tbody = document.getElementById('tbody-plan-status');
  124 + if (!tbody) return;
  125 + clearEmptyRow(tbody);
  126 + var seq = tbody.querySelectorAll('tr.row-plan-status').length + 1;
  127 + tbody.appendChild(buildPlanStatusRow({}, seq));
  128 + };
  129 +
  130 + function buildIndicatorSelect(selectedZb) {
  131 + var sel = document.createElement('select');
  132 + sel.className = 'indicator-select';
  133 + sel.setAttribute('data-field', 'zb');
  134 + sel.disabled = (MODE === 'view');
  135 + var optEmpty = document.createElement('option');
  136 + optEmpty.value = '';
  137 + optEmpty.textContent = '请选择';
  138 + sel.appendChild(optEmpty);
  139 +
  140 + var currentBk = getVal('f-bk');
  141 + var indicators = currentBk ? (INDICATORS_BY_BLOCK[currentBk] || []) : allIndicators();
  142 + indicators.forEach(function (ind) {
  143 + var opt = document.createElement('option');
  144 + opt.value = ind.id;
  145 + opt.textContent = ind.mc || '(未命名)';
  146 + if (selectedZb && ind.id === selectedZb) {
  147 + opt.selected = true;
  148 + }
  149 + sel.appendChild(opt);
  150 + });
  151 +
  152 + // 编辑/查看模式下,若 selectedZb 不属于当前板块的指标集,仍需保留一个占位项显示已选值
  153 + if (selectedZb && !hasOption(sel, selectedZb)) {
  154 + var zbNameMap = DETAIL.zbNameMap || {};
  155 + var opt = document.createElement('option');
  156 + opt.value = selectedZb;
  157 + opt.textContent = (zbNameMap[selectedZb] || selectedZb) + '(历史)';
  158 + opt.selected = true;
  159 + sel.appendChild(opt);
  160 + }
  161 +
  162 + sel.addEventListener('change', function () {
  163 + var td = sel.closest('td');
  164 + var tr = sel.closest('tr');
  165 + if (!td || !tr) return;
  166 + var gszbInput = tr.querySelector('.gszb-display');
  167 + if (gszbInput) {
  168 + var opt = sel.options[sel.selectedIndex];
  169 + gszbInput.value = opt && opt.value ? opt.textContent.replace('(历史)', '') : '';
  170 + }
  171 + });
  172 + return sel;
  173 + }
  174 +
  175 + function allIndicators() {
  176 + var arr = [];
  177 + Object.keys(INDICATORS_BY_BLOCK).forEach(function (k) {
  178 + arr = arr.concat(INDICATORS_BY_BLOCK[k] || []);
  179 + });
  180 + return arr;
  181 + }
  182 +
  183 + function hasOption(sel, val) {
  184 + for (var i = 0; i < sel.options.length; i++) {
  185 + if (sel.options[i].value === val) return true;
  186 + }
  187 + return false;
  188 + }
  189 +
  190 + function refreshAllIndicatorOptions() {
  191 + var selects = document.querySelectorAll('#tbody-plan-status .indicator-select');
  192 + selects.forEach(function (sel) {
  193 + var current = sel.value;
  194 + sel.innerHTML = '';
  195 + var optEmpty = document.createElement('option');
  196 + optEmpty.value = '';
  197 + optEmpty.textContent = '请选择';
  198 + sel.appendChild(optEmpty);
  199 + var bk = getVal('f-bk');
  200 + var list = bk ? (INDICATORS_BY_BLOCK[bk] || []) : allIndicators();
  201 + list.forEach(function (ind) {
  202 + var opt = document.createElement('option');
  203 + opt.value = ind.id;
  204 + opt.textContent = ind.mc || '(未命名)';
  205 + sel.appendChild(opt);
  206 + });
  207 + if (current && hasOption(sel, current)) {
  208 + sel.value = current;
  209 + }
  210 + });
  211 + }
  212 +
  213 + /* =============== 推进的行为和步骤 =============== */
  214 + function renderActionStepRows(list) {
  215 + var tbody = document.getElementById('tbody-action-step');
  216 + if (!tbody) return;
  217 + tbody.innerHTML = '';
  218 + if (!list || list.length === 0) {
  219 + if (MODE === 'view') {
  220 + tbody.appendChild(emptyRow(MODE === 'view' ? 3 : 4, '暂无数据'));
  221 + }
  222 + return;
  223 + }
  224 + list.forEach(function (item, idx) {
  225 + tbody.appendChild(buildActionStepRow(item, idx + 1));
  226 + });
  227 + }
  228 +
  229 + function buildActionStepRow(item, seq) {
  230 + item = item || {};
  231 + var tr = document.createElement('tr');
  232 + tr.className = 'row-action-step';
  233 +
  234 + // 序号(可编辑)
  235 + var tdXh = document.createElement('td');
  236 + var xhInput = document.createElement('input');
  237 + xhInput.type = 'text';
  238 + xhInput.setAttribute('data-field', 'xh');
  239 + xhInput.value = item.xh != null && item.xh !== '' ? item.xh : String(seq);
  240 + xhInput.disabled = (MODE === 'view');
  241 + tdXh.appendChild(xhInput);
  242 + tr.appendChild(tdXh);
  243 +
  244 + tr.appendChild(cellInput('text', 'tjdxwhbz', item.tjdxwhbz, '推进的行为和步骤'));
  245 +
  246 + // 状态下拉
  247 + var tdZt = document.createElement('td');
  248 + var ztSel = document.createElement('select');
  249 + ztSel.setAttribute('data-field', 'zt');
  250 + ztSel.disabled = (MODE === 'view');
  251 + var optEmpty = document.createElement('option');
  252 + optEmpty.value = '';
  253 + optEmpty.textContent = '请选择';
  254 + ztSel.appendChild(optEmpty);
  255 + ZT_LIST.forEach(function (z) {
  256 + var opt = document.createElement('option');
  257 + opt.value = z.code;
  258 + opt.textContent = z.desc;
  259 + if (item.zt === z.code) opt.selected = true;
  260 + ztSel.appendChild(opt);
  261 + });
  262 + tdZt.appendChild(ztSel);
  263 + tr.appendChild(tdZt);
  264 +
  265 + if (MODE !== 'view') {
  266 + tr.appendChild(cellRemove('删除此行'));
  267 + }
  268 + return tr;
  269 + }
  270 +
  271 + window.addActionStepRow = function () {
  272 + var tbody = document.getElementById('tbody-action-step');
  273 + if (!tbody) return;
  274 + clearEmptyRow(tbody);
  275 + var seq = tbody.querySelectorAll('tr.row-action-step').length + 1;
  276 + tbody.appendChild(buildActionStepRow({}, seq));
  277 + };
  278 +
  279 + /* =============== 显示阶段问题事件 =============== */
  280 + function renderProblemEventRows(list) {
  281 + var tbody = document.getElementById('tbody-problem-event');
  282 + if (!tbody) return;
  283 + tbody.innerHTML = '';
  284 + if (!list || list.length === 0) {
  285 + if (MODE === 'view') {
  286 + tbody.appendChild(emptyRow(MODE === 'view' ? 4 : 5, '暂无数据'));
  287 + }
  288 + return;
  289 + }
  290 + list.forEach(function (item, idx) {
  291 + tbody.appendChild(buildProblemEventRow(item, idx + 1));
  292 + });
  293 + }
  294 +
  295 + function buildProblemEventRow(item, seq) {
  296 + item = item || {};
  297 + var tr = document.createElement('tr');
  298 + tr.className = 'row-problem-event';
  299 +
  300 + tr.appendChild(cellIndex(seq));
  301 + tr.appendChild(cellInput('text', 'xsjdwtsj', item.xsjdwtsj, '问题事件'));
  302 + tr.appendChild(cellInput('text', 'zrr', item.zrr, '责任人'));
  303 + tr.appendChild(cellInput('date', 'sj', item.sj, '时间'));
  304 +
  305 + if (MODE !== 'view') {
  306 + tr.appendChild(cellRemove('删除此行'));
  307 + }
  308 + return tr;
  309 + }
  310 +
  311 + window.addProblemEventRow = function () {
  312 + var tbody = document.getElementById('tbody-problem-event');
  313 + if (!tbody) return;
  314 + clearEmptyRow(tbody);
  315 + var seq = tbody.querySelectorAll('tr.row-problem-event').length + 1;
  316 + tbody.appendChild(buildProblemEventRow({}, seq));
  317 + };
  318 +
  319 + /* =============== 通用单元格构造 =============== */
  320 + function cellIndex(seq) {
  321 + var td = document.createElement('td');
  322 + td.className = 'row-index';
  323 + td.textContent = seq;
  324 + return td;
  325 + }
  326 +
  327 + function cellInput(type, field, value, placeholder) {
  328 + var td = document.createElement('td');
  329 + var input = document.createElement('input');
  330 + input.type = type;
  331 + input.setAttribute('data-field', field);
  332 + input.value = value == null ? '' : value;
  333 + input.placeholder = placeholder || '';
  334 + input.disabled = (MODE === 'view');
  335 + td.appendChild(input);
  336 + return td;
  337 + }
  338 +
  339 + function cellRemove(title) {
  340 + var td = document.createElement('td');
  341 + td.className = 'op-cell';
  342 + var btn = document.createElement('button');
  343 + btn.type = 'button';
  344 + btn.className = 'btn btn-mini btn-danger';
  345 + btn.textContent = '删除';
  346 + btn.title = title || '删除';
  347 + btn.onclick = function () {
  348 + var tr = btn.closest('tr');
  349 + if (tr && tr.parentNode) {
  350 + tr.parentNode.removeChild(tr);
  351 + reindexRows();
  352 + }
  353 + };
  354 + td.appendChild(btn);
  355 + return td;
  356 + }
  357 +
  358 + function emptyRow(colspan, text) {
  359 + var tr = document.createElement('tr');
  360 + tr.className = 'empty-row';
  361 + var td = document.createElement('td');
  362 + td.colSpan = colspan;
  363 + td.className = 'empty-tip';
  364 + td.textContent = text;
  365 + tr.appendChild(td);
  366 + return tr;
  367 + }
  368 +
  369 + function clearEmptyRow(tbody) {
  370 + var empties = tbody.querySelectorAll('tr.empty-row');
  371 + empties.forEach(function (tr) {
  372 + tr.parentNode.removeChild(tr);
  373 + });
  374 + }
  375 +
  376 + function reindexRows() {
  377 + ['plan-status', 'action-step', 'problem-event'].forEach(function (key) {
  378 + var tbody = document.getElementById('tbody-' + key);
  379 + if (!tbody) return;
  380 + var rows = tbody.querySelectorAll('tr.row-' + key);
  381 + rows.forEach(function (tr, idx) {
  382 + var cell = tr.querySelector('td.row-index');
  383 + if (cell) cell.textContent = idx + 1;
  384 + if (key === 'action-step') {
  385 + var xhInput = tr.querySelector('input[data-field="xh"]');
  386 + if (xhInput && (!xhInput.value || xhInput.getAttribute('data-auto') === '1')) {
  387 + xhInput.value = String(idx + 1);
  388 + xhInput.setAttribute('data-auto', '1');
  389 + }
  390 + }
  391 + });
  392 + });
  393 + }
  394 +
  395 + /* =============== 保存 =============== */
  396 + window.saveReport = function () {
  397 + var payload = collectForm();
  398 + if (!payload.bk) {
  399 + alert('请选择板块');
  400 + return;
  401 + }
  402 + var btnSave = document.getElementById('btn-save');
  403 + if (btnSave) btnSave.disabled = true;
  404 +
  405 + fetch('/a3Report/save', {
  406 + method: 'POST',
  407 + headers: {'Content-Type': 'application/json'},
  408 + body: JSON.stringify(payload)
  409 + }).then(function (resp) {
  410 + return resp.json();
  411 + }).then(function (json) {
  412 + if (json && (json.success === true || json.success === 'true')) {
  413 + alert('保存成功');
  414 + window.location.href = '/a3Report/page/list';
  415 + } else {
  416 + alert('保存失败:' + ((json && (json.message || json.msg)) || '未知错误'));
  417 + if (btnSave) btnSave.disabled = false;
  418 + }
  419 + }).catch(function (err) {
  420 + alert('保存请求异常:' + err);
  421 + if (btnSave) btnSave.disabled = false;
  422 + });
  423 + };
  424 +
  425 + function collectForm() {
  426 + var yearStr = getVal('f-nf-year');
  427 + var nf = null;
  428 + if (yearStr) {
  429 + var y = parseInt(yearStr, 10);
  430 + if (!isNaN(y)) {
  431 + nf = y + '-01-01';
  432 + }
  433 + }
  434 + var dto = {
  435 + id: window.__REPORT_ID__ || null,
  436 + bk: getVal('f-bk') || null,
  437 + fzr: getVal('f-fzr') || null,
  438 + gzjhzt: getVal('f-gzjhzt') || null,
  439 + mdjxqkh: getVal('f-mdjxqkh') || null,
  440 + zlkl: getVal('f-zlkl') || null,
  441 + tjdxwh: getVal('f-tjdxwh') || null,
  442 + xsjdwt: getVal('f-xsjdwt') || null,
  443 + nf: nf,
  444 + planStatusList: collectRows('tbody-plan-status', 'row-plan-status',
  445 + ['zb', 'cx', 'snd', 'sndz', 'bnd', 'bndz', 'hn', 'hndz', 'bicbiw', 'b']),
  446 + actionStepList: collectRows('tbody-action-step', 'row-action-step',
  447 + ['xh', 'tjdxwhbz', 'zt']),
  448 + problemEventList: collectRows('tbody-problem-event', 'row-problem-event',
  449 + ['xsjdwtsj', 'zrr', 'sj'])
  450 + };
  451 + return dto;
  452 + }
  453 +
  454 + function collectRows(tbodyId, rowClass, fields) {
  455 + var tbody = document.getElementById(tbodyId);
  456 + if (!tbody) return [];
  457 + var rows = tbody.querySelectorAll('tr.' + rowClass);
  458 + var list = [];
  459 + rows.forEach(function (tr) {
  460 + var obj = {};
  461 + var hasValue = false;
  462 + fields.forEach(function (f) {
  463 + var el = tr.querySelector('[data-field="' + f + '"]');
  464 + var v = el ? (el.value || '') : '';
  465 + obj[f] = v === '' ? null : v;
  466 + if (v !== '') hasValue = true;
  467 + });
  468 + if (hasValue) {
  469 + list.push(obj);
  470 + }
  471 + });
  472 + return list;
  473 + }
  474 +})();
  1 +/**
  2 + * A3 报告列表页脚本:仅提供级联删除能力。
  3 + */
  4 +function deleteReport(id) {
  5 + if (!id) {
  6 + return;
  7 + }
  8 + if (!window.confirm('确定要删除该 A3 报告及其所有子表数据吗?')) {
  9 + return;
  10 + }
  11 + fetch('/a3Report/delete/' + encodeURIComponent(id), {
  12 + method: 'POST',
  13 + headers: {'Content-Type': 'application/json'}
  14 + }).then(function (resp) {
  15 + return resp.json();
  16 + }).then(function (json) {
  17 + if (json && (json.success === true || json.success === 'true')) {
  18 + window.location.reload();
  19 + } else {
  20 + alert('删除失败:' + ((json && (json.message || json.msg)) || '未知错误'));
  21 + }
  22 + }).catch(function (err) {
  23 + alert('删除请求异常:' + err);
  24 + });
  25 +}
  1 +<!DOCTYPE html>
  2 +<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
  3 +<head>
  4 + <meta charset="UTF-8">
  5 + <title th:text="${mode=='add'} ? 'A3 报告 - 新增' : (${mode=='edit'} ? 'A3 报告 - 编辑' : 'A3 报告 - 查看')">A3 报告</title>
  6 + <link rel="stylesheet" th:href="@{/a3report/a3report.css}">
  7 +</head>
  8 +<body class="a3-page" th:attr="data-mode=${mode}">
  9 +<div class="a3-header">
  10 + <div class="a3-header-title">
  11 + <span class="a3-header-bar"></span>
  12 + <h1>
  13 + 年度方针管理看板 - A3 报告
  14 + <small th:text="${mode=='add'} ? '(新增)' : (${mode=='edit'} ? '(编辑)' : '(查看)')"></small>
  15 + </h1>
  16 + </div>
  17 + <div class="a3-header-actions">
  18 + <a class="btn" th:href="@{/a3Report/page/list}">返回列表</a>
  19 + <button type="button" class="btn btn-primary" id="btn-save" onclick="saveReport()"
  20 + th:if="${mode!='view'}">保存
  21 + </button>
  22 + </div>
  23 +</div>
  24 +
  25 +<!-- 1. 顶部信息区 -->
  26 +<div class="a3-card">
  27 + <div class="a3-card-title">
  28 + <span class="a3-card-title-bar"></span>
  29 + <span>基本信息</span>
  30 + </div>
  31 + <div class="a3-form-grid">
  32 + <div class="a3-form-item">
  33 + <label>板块<span class="req">*</span></label>
  34 + <select id="f-bk" th:disabled="${mode=='view'}">
  35 + <option value="">请选择</option>
  36 + <option th:each="b : ${blockList}" th:value="${b.id}" th:text="${b.mc}"></option>
  37 + </select>
  38 + </div>
  39 + <div class="a3-form-item">
  40 + <label>负责人</label>
  41 + <input type="text" id="f-fzr" th:disabled="${mode=='view'}" placeholder="请输入负责人">
  42 + </div>
  43 + <div class="a3-form-item">
  44 + <label>年份</label>
  45 + <input type="number" id="f-nf-year" min="2000" max="2100" step="1"
  46 + th:disabled="${mode=='view'}" placeholder="如 2026">
  47 + </div>
  48 + <div class="a3-form-item">
  49 + <label>工作计划状态</label>
  50 + <select id="f-gzjhzt" th:disabled="${mode=='view'}">
  51 + <option value="">请选择</option>
  52 + <option th:each="e : ${gzjhztList}" th:value="${e.code}" th:text="${e.desc}"></option>
  53 + </select>
  54 + </div>
  55 + <div class="a3-form-item a3-form-item-full">
  56 + <label>目标及现状情况</label>
  57 + <textarea id="f-mdjxqkh" rows="3" th:disabled="${mode=='view'}"
  58 + placeholder="请输入目标及现状情况"></textarea>
  59 + </div>
  60 + <div class="a3-form-item a3-form-item-full">
  61 + <label>战略考量</label>
  62 + <textarea id="f-zlkl" rows="3" th:disabled="${mode=='view'}"
  63 + placeholder="请输入战略考量"></textarea>
  64 + </div>
  65 + <div class="a3-form-item a3-form-item-full">
  66 + <label>推进的行为和步骤(总述)</label>
  67 + <textarea id="f-tjdxwh" rows="2" th:disabled="${mode=='view'}"
  68 + placeholder="请输入推进的行为和步骤总述"></textarea>
  69 + </div>
  70 + <div class="a3-form-item a3-form-item-full">
  71 + <label>显示阶段问题(总述)</label>
  72 + <textarea id="f-xsjdwt" rows="2" th:disabled="${mode=='view'}"
  73 + placeholder="请输入显示阶段问题总述"></textarea>
  74 + </div>
  75 + </div>
  76 +</div>
  77 +
  78 +<!-- 2. 工作计划状态和 BIC -->
  79 +<div class="a3-card">
  80 + <div class="a3-card-title">
  81 + <span class="a3-card-title-bar"></span>
  82 + <span>工作计划状态和 BIC</span>
  83 + <button type="button" class="btn btn-mini btn-primary a3-card-title-btn"
  84 + onclick="addPlanStatusRow()" th:if="${mode!='view'}">+ 新增行
  85 + </button>
  86 + </div>
  87 + <table class="a3-table" id="tbl-plan-status">
  88 + <thead>
  89 + <tr>
  90 + <th style="width:50px;">序号</th>
  91 + <th style="width:180px;">指标</th>
  92 + <th style="width:140px;">成效</th>
  93 + <th style="width:110px;">上年度</th>
  94 + <th style="width:110px;">上年度值</th>
  95 + <th style="width:110px;">本年度</th>
  96 + <th style="width:110px;">本年度值</th>
  97 + <th style="width:110px;">后年</th>
  98 + <th style="width:110px;">后年度值</th>
  99 + <th style="width:110px;">BIC 比率</th>
  100 + <th style="width:140px;">公司指标</th>
  101 + <th>备注</th>
  102 + <th style="width:80px;" th:if="${mode!='view'}">操作</th>
  103 + </tr>
  104 + </thead>
  105 + <tbody id="tbody-plan-status"></tbody>
  106 + </table>
  107 +</div>
  108 +
  109 +<!-- 3. 推进的行为和步骤 -->
  110 +<div class="a3-card">
  111 + <div class="a3-card-title">
  112 + <span class="a3-card-title-bar"></span>
  113 + <span>推进的行为和步骤</span>
  114 + <button type="button" class="btn btn-mini btn-primary a3-card-title-btn"
  115 + onclick="addActionStepRow()" th:if="${mode!='view'}">+ 新增行
  116 + </button>
  117 + </div>
  118 + <table class="a3-table" id="tbl-action-step">
  119 + <thead>
  120 + <tr>
  121 + <th style="width:80px;">序号</th>
  122 + <th>推进的行为和步骤</th>
  123 + <th style="width:180px;">状态</th>
  124 + <th style="width:80px;" th:if="${mode!='view'}">操作</th>
  125 + </tr>
  126 + </thead>
  127 + <tbody id="tbody-action-step"></tbody>
  128 + </table>
  129 +</div>
  130 +
  131 +<!-- 4. 显示阶段问题事件 -->
  132 +<div class="a3-card">
  133 + <div class="a3-card-title">
  134 + <span class="a3-card-title-bar"></span>
  135 + <span>显示阶段问题事件</span>
  136 + <button type="button" class="btn btn-mini btn-primary a3-card-title-btn"
  137 + onclick="addProblemEventRow()" th:if="${mode!='view'}">+ 新增行
  138 + </button>
  139 + </div>
  140 + <table class="a3-table" id="tbl-problem-event">
  141 + <thead>
  142 + <tr>
  143 + <th style="width:60px;">序号</th>
  144 + <th>问题事件</th>
  145 + <th style="width:180px;">责任人</th>
  146 + <th style="width:180px;">时间</th>
  147 + <th style="width:80px;" th:if="${mode!='view'}">操作</th>
  148 + </tr>
  149 + </thead>
  150 + <tbody id="tbody-problem-event"></tbody>
  151 + </table>
  152 +</div>
  153 +
  154 +<div class="a3-footer" th:if="${mode!='view'}">
  155 + <a class="btn" th:href="@{/a3Report/page/list}">取消</a>
  156 + <button type="button" class="btn btn-primary" onclick="saveReport()">保存</button>
  157 +</div>
  158 +
  159 +<!-- 数据注入 -->
  160 +<script th:inline="javascript">
  161 + /*<![CDATA[*/
  162 + window.__MODE__ = /*[[${mode}]]*/ 'add';
  163 + window.__REPORT_ID__ = /*[[${detail.report != null ? detail.report.id : null}]]*/ null;
  164 + window.__DETAIL__ = JSON.parse(/*[[${detailJson}]]*/ '{}');
  165 + window.__BLOCKS__ = JSON.parse(/*[[${blockListJson}]]*/ '[]');
  166 + window.__INDICATORS_BY_BLOCK__ = JSON.parse(/*[[${indicatorsByBlockJson}]]*/ '{}');
  167 + window.__GZJHZT_LIST__ = [
  168 + /*[# th:each="e : ${gzjhztList}"]*/
  169 + {code: /*[[${e.code}]]*/ '', desc: /*[[${e.desc}]]*/ ''},
  170 + /*[/]*/
  171 + ];
  172 + window.__ZT_LIST__ = [
  173 + /*[# th:each="e : ${ztList}"]*/
  174 + {code: /*[[${e.code}]]*/ '', desc: /*[[${e.desc}]]*/ ''},
  175 + /*[/]*/
  176 + ];
  177 + /*]]>*/
  178 +</script>
  179 +<script th:src="@{/a3report/form.js}"></script>
  180 +</body>
  181 +</html>
  1 +<!DOCTYPE html>
  2 +<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
  3 +<head>
  4 + <meta charset="UTF-8">
  5 + <title>A3 报告列表</title>
  6 + <link rel="stylesheet" th:href="@{/a3report/a3report.css}">
  7 +</head>
  8 +<body class="a3-page">
  9 +<div class="a3-header">
  10 + <div class="a3-header-title">
  11 + <span class="a3-header-bar"></span>
  12 + <h1>年度方针管理看板 - A3 报告</h1>
  13 + </div>
  14 + <div class="a3-header-actions">
  15 + <a class="btn btn-primary" th:href="@{/a3Report/page/add}">新增报告</a>
  16 + </div>
  17 +</div>
  18 +
  19 +<div class="a3-card">
  20 + <div class="a3-card-title">
  21 + <span class="a3-card-title-bar"></span>
  22 + <span>A3 报告列表</span>
  23 + </div>
  24 + <table class="a3-table a3-list-table">
  25 + <thead>
  26 + <tr>
  27 + <th style="width:60px;">序号</th>
  28 + <th style="width:180px;">板块</th>
  29 + <th style="width:140px;">负责人</th>
  30 + <th style="width:120px;">年份</th>
  31 + <th style="width:140px;">工作计划状态</th>
  32 + <th>目标及现状情况</th>
  33 + <th style="width:220px;">操作</th>
  34 + </tr>
  35 + </thead>
  36 + <tbody>
  37 + <tr th:if="${#lists.isEmpty(reports)}">
  38 + <td colspan="7" class="empty-tip">暂无数据</td>
  39 + </tr>
  40 + <tr th:each="r,stat : ${reports}">
  41 + <td th:text="${stat.count}">1</td>
  42 + <td th:text="${blockNameMap.get(r.bk)} ?: '-'">板块</td>
  43 + <td th:text="${r.fzr} ?: '-'">负责人</td>
  44 + <td th:text="${r.nf != null} ? ${#dates.format(r.nf,'yyyy')} : '-'">2026</td>
  45 + <td th:text="${gzjhztDescMap.get(r.gzjhzt)} ?: (${r.gzjhzt} ?: '-')">状态</td>
  46 + <td class="ellipsis" th:text="${r.mdjxqkh} ?: '-'">目标及现状情况</td>
  47 + <td class="op-cell">
  48 + <a class="btn btn-mini" th:href="@{'/a3Report/page/view/' + ${r.id}}">查看</a>
  49 + <a class="btn btn-mini btn-primary" th:href="@{'/a3Report/page/edit/' + ${r.id}}">编辑</a>
  50 + <button type="button" class="btn btn-mini btn-danger"
  51 + th:attr="data-id=${r.id}"
  52 + onclick="deleteReport(this.getAttribute('data-id'))">删除
  53 + </button>
  54 + </td>
  55 + </tr>
  56 + </tbody>
  57 + </table>
  58 +</div>
  59 +
  60 +<script th:src="@{/a3report/list.js}"></script>
  61 +</body>
  62 +</html>