|
@@ -1,10 +1,19 @@
|
|
package com.ruoyi.web.controller.branch;
|
|
package com.ruoyi.web.controller.branch;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+import java.util.function.Function;
|
|
|
|
+import java.util.stream.Collectors;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
import com.ruoyi.branch.domain.TBranchPlanItem;
|
|
import com.ruoyi.branch.domain.TBranchPlanItem;
|
|
import com.ruoyi.branch.service.ITBranchPlanItemService;
|
|
import com.ruoyi.branch.service.ITBranchPlanItemService;
|
|
|
|
+import com.ruoyi.common.core.domain.entity.SysDictData;
|
|
|
|
+import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
|
+import com.ruoyi.common.utils.StringUtils;
|
|
|
|
+import com.ruoyi.system.service.ISysDictTypeService;
|
|
|
|
+import com.ruoyi.system.service.ISysUserService;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
@@ -40,14 +49,19 @@ public class TBranchPlanController extends BaseController
|
|
@Autowired
|
|
@Autowired
|
|
private ITBranchPlanItemService tBranchPlanItemService;
|
|
private ITBranchPlanItemService tBranchPlanItemService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ISysDictTypeService sysDictTypeService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ISysUserService userService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 查询支部年度工作计划列表
|
|
* 查询支部年度工作计划列表
|
|
*/
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('branch:plan:list')")
|
|
@PreAuthorize("@ss.hasPermi('branch:plan:list')")
|
|
@GetMapping("/list")
|
|
@GetMapping("/list")
|
|
- public TableDataInfo list(TBranchPlan tBranchPlan)
|
|
|
|
|
|
+ public AjaxResult list(TBranchPlan tBranchPlan)
|
|
{
|
|
{
|
|
- startPage();
|
|
|
|
List<TBranchPlan> list = tBranchPlanService.selectTBranchPlanList(tBranchPlan);
|
|
List<TBranchPlan> list = tBranchPlanService.selectTBranchPlanList(tBranchPlan);
|
|
// 查询工作计划条目
|
|
// 查询工作计划条目
|
|
for (TBranchPlan branchPlan : list) {
|
|
for (TBranchPlan branchPlan : list) {
|
|
@@ -58,7 +72,7 @@ public class TBranchPlanController extends BaseController
|
|
List<TBranchPlanItem> tBranchPlanItems = tBranchPlanItemService.selectTBranchPlanItemList(tBranchPlanItem);
|
|
List<TBranchPlanItem> tBranchPlanItems = tBranchPlanItemService.selectTBranchPlanItemList(tBranchPlanItem);
|
|
branchPlan.setItemList(tBranchPlanItems);
|
|
branchPlan.setItemList(tBranchPlanItems);
|
|
}
|
|
}
|
|
- return getDataTable(list);
|
|
|
|
|
|
+ return AjaxResult.success(list);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -69,9 +83,48 @@ public class TBranchPlanController extends BaseController
|
|
@PostMapping("/export")
|
|
@PostMapping("/export")
|
|
public void export(HttpServletResponse response, TBranchPlan tBranchPlan)
|
|
public void export(HttpServletResponse response, TBranchPlan tBranchPlan)
|
|
{
|
|
{
|
|
|
|
+ List<TBranchPlanItem> itemList = new ArrayList<TBranchPlanItem>();
|
|
List<TBranchPlan> list = tBranchPlanService.selectTBranchPlanList(tBranchPlan);
|
|
List<TBranchPlan> list = tBranchPlanService.selectTBranchPlanList(tBranchPlan);
|
|
- ExcelUtil<TBranchPlan> util = new ExcelUtil<TBranchPlan>(TBranchPlan.class);
|
|
|
|
- util.exportExcel(response, list, "支部年度工作计划数据");
|
|
|
|
|
|
+ // 查询工作计划条目
|
|
|
|
+ for (TBranchPlan branchPlan : list) {
|
|
|
|
+ TBranchPlanItem tBranchPlanItem = new TBranchPlanItem();
|
|
|
|
+ tBranchPlanItem.setPlanId(branchPlan.getPlanId());
|
|
|
|
+ tBranchPlanItem.setItemStatus(tBranchPlan.getItemStatus());
|
|
|
|
+ tBranchPlanItem.setPersonInCharge(tBranchPlan.getPersonInCharge());
|
|
|
|
+ List<TBranchPlanItem> tBranchPlanItems = tBranchPlanItemService.selectTBranchPlanItemList(tBranchPlanItem);
|
|
|
|
+ itemList.addAll(tBranchPlanItems);
|
|
|
|
+ }
|
|
|
|
+ List<SysDictData> PlanItemStatus = sysDictTypeService.selectDictDataByType("plan_item_status");
|
|
|
|
+ List<SysUser> sysUsers = userService.selectUserList(new SysUser());
|
|
|
|
+ Map<Long, String> userMap = sysUsers.stream().collect(Collectors.toMap(SysUser::getUserId, SysUser::getNickName));
|
|
|
|
+ List<TBranchPlan> branchPlans = tBranchPlanService.selectTBranchPlanList(new TBranchPlan());
|
|
|
|
+ Map<Long, String> planMap = branchPlans.stream().collect(Collectors.toMap(TBranchPlan::getPlanId, TBranchPlan::getPlanTitle));
|
|
|
|
+ for (TBranchPlanItem tBranchPlanItem : itemList) {
|
|
|
|
+ for (SysDictData data : PlanItemStatus) {
|
|
|
|
+ if (data.getDictValue().equals(tBranchPlanItem.getItemStatus())) {
|
|
|
|
+ tBranchPlanItem.setItemStatus(data.getDictLabel());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String personInCharge = "";
|
|
|
|
+ String[] split = tBranchPlanItem.getPersonInCharge().split(",");
|
|
|
|
+ for (String s : split) {
|
|
|
|
+ for (Long key : userMap.keySet()) {
|
|
|
|
+ if (key.toString().equals(s)) {
|
|
|
|
+ personInCharge += userMap.get(key) + "、";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ tBranchPlanItem.setPersonInCharge(personInCharge.substring(0, personInCharge.length() - 1));
|
|
|
|
+
|
|
|
|
+ for (Long key : planMap.keySet()) {
|
|
|
|
+ if (key.toString().equals(tBranchPlanItem.getPlanId().toString())) {
|
|
|
|
+ tBranchPlanItem.setTitle(planMap.get(key));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ ExcelUtil<TBranchPlanItem> util = new ExcelUtil<TBranchPlanItem>(TBranchPlanItem.class);
|
|
|
|
+ util.exportExcel(response, itemList, "支部年度工作计划数据");
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|