From b39bc0d8ca33389fa075ad14e2764991d618465d Mon Sep 17 00:00:00 2001 From: OathK1per Date: Thu, 10 Nov 2022 14:44:31 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A9=BA=E9=97=B4=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/backend/SpaceController.java | 115 +++++ .../java/cn/palmte/work/pojo/SpaceVO.java | 49 ++ .../palmte/work/service/ProjectService.java | 4 + .../cn/palmte/work/service/SpaceService.java | 38 ++ .../templates/admin/project_approve.ftl | 19 - .../templates/admin/project_budget_edit.ftl | 433 +++++++---------- .../resources/templates/admin/space_list.ftl | 458 ++++++++++++++++++ .../templates/admin/space_statistics.ftl | 221 +++++++++ 8 files changed, 1048 insertions(+), 289 deletions(-) create mode 100644 src/main/java/cn/palmte/work/controller/backend/SpaceController.java create mode 100644 src/main/java/cn/palmte/work/pojo/SpaceVO.java create mode 100644 src/main/java/cn/palmte/work/service/SpaceService.java create mode 100644 src/main/resources/templates/admin/space_list.ftl create mode 100644 src/main/resources/templates/admin/space_statistics.ftl diff --git a/src/main/java/cn/palmte/work/controller/backend/SpaceController.java b/src/main/java/cn/palmte/work/controller/backend/SpaceController.java new file mode 100644 index 0000000..6fe3bf2 --- /dev/null +++ b/src/main/java/cn/palmte/work/controller/backend/SpaceController.java @@ -0,0 +1,115 @@ +package cn.palmte.work.controller.backend; + +import cn.palmte.work.model.Admin; +import cn.palmte.work.model.Project; +import cn.palmte.work.pojo.SpaceVO; +import cn.palmte.work.service.ProjectService; +import cn.palmte.work.service.SpaceService; +import cn.palmte.work.utils.FreeMarkerUtil; +import cn.palmte.work.utils.InterfaceUtil; +import cn.palmte.work.utils.Utils; +import cn.palmte.work.utils.excel.ExportUtils; +import com.alibaba.fastjson.JSONObject; +import com.fasterxml.jackson.databind.ser.Serializers; +import org.activiti.engine.task.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import top.jfunc.common.db.bean.Page; +import top.jfunc.common.utils.CollectionUtil; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.Collectors; + +@Controller +@RequestMapping("/space") +public class SpaceController extends BaseController { + private static final Logger logger = LoggerFactory.getLogger(ProjectController.class); + + @Autowired + private SpaceService spaceService; + + @Autowired + private ProjectService projectService; + + /** + * 项目列表 + */ + @RequestMapping("/list") + public String list(@RequestParam(value = "keywords", required = false) String keywords, + @RequestParam(value = "certainty") int certainty, + @RequestParam(value = PAGE_NUMBER, defaultValue = DEFAULT_PAGE_NUMBER) int pageNumber, + @RequestParam(value = PAGE_SIZE, defaultValue = DEFAULT_PAGE_SIZE) int pageSize, + Map model) { + //当前登录人的角色类型 + model.put("keywords", keywords); + model.put("pageNumber", pageNumber); + Admin admin = InterfaceUtil.getAdmin(); + model.put("adminId", admin.getId()); + model.put("admin", admin); + ConcurrentHashMap searchInfo = getSearchInfo(keywords, model); + model.put("certainty", certainty); + searchInfo.putIfAbsent("certainty", String.valueOf(certainty)); + searchInfo.putIfAbsent("deptName", "销售管理部"); + searchInfo.putIfAbsent("estimateStatus", String.valueOf(1)); + Page page = projectService.list(searchInfo, pageNumber, pageSize); + List list = page.getList(); + if(CollectionUtil.isNotEmpty(list)){ + + int offset = (pageNumber - 1) * pageSize; + for (int i = 0 , size = list.size(); i < size; i++) { + list.get(i).setTempId(i+1 + offset); + } + } + model.put("pager", page); + model.put("Utils", FreeMarkerUtil.fromStaticPackage("cn.palmte.work.utils.Utils")); + return "admin/space_list"; + } + + /** + * 项目导出 + */ + @RequestMapping("/export") + public void export(@RequestParam(value = "keywords", required = false) String keywords, @RequestParam(value = "certainty") int certainty, HttpServletResponse httpServletResponse) throws IOException { + Map searchInfo = getSearchInfo(keywords); + searchInfo.putIfAbsent("certainty", String.valueOf(certainty)); + downloadHeader(httpServletResponse, Utils.generateExcelName("项目报表"), "application/octet-stream"); + String[] headers = {"项目编号", "项目名称", "项目类型", "垫资模式", "垫资利息", "垫资峰值", "项目合同金额", "项目毛利", "项目毛利率", "项目把握度", "汇智产品金额", "华智产品金额", + "华三产品金额", "其他产品金额", "项目状态", "行业场景应用", "解决方案", "客户名称", "最终用户名称", "预计合同签订时间", "项目计划招标时间", "是否二次合作", "直签", "战略合作对象", + "项目负责人", "价值及风险", "主合同收款条款", "主合同具体解决方案", "计收计划", "审核状态", "当前审核人", "项目创建者", "部门名称", "项目开始时间", "项目结束时间", "最后更新时间"}; + String[] exportColumns = {"projectNo", "name", "typeDesc", "underwrittenModeStr", "advanceInterestAmountRound", "advancePeakAmountRound", "contractRound", "grossProfitRound", "grossProfitMarginRound", "certaintyStr", "huizhiRound", "huazhiRound", + "huasanRound", "ziguangRound", "statusDesc", "industryScenario", "resolvePlan", "customer", "terminalCustomer", "contractTime", "bidsTime", "isSecondStr", "signTypeStr", "collaborator", + "principal", "valueRisk", "mainContractCollectionTerms", "mainContractResolvePlan", "calculationCollection", "approveStatusDesc", "approveName", "creatorName", "deptName", "startDate", "endDate", "lastUpdateTime"}; + ExportUtils.exportToExcel(headers, exportColumns, 1, 10000, + httpServletResponse.getOutputStream(), (pN, pS) -> projectService.list(searchInfo, pN, pS).getList()); + } + + /** + * 跳转页面 + * + * @param model + * @return + */ + @RequestMapping("/statistics") + public String statistics(Map model) { + + return "/admin/space_statistics"; + } + + @RequestMapping("/listData") + @ResponseBody + public String listData() { + + SpaceVO spaceVO = spaceService.getListData(); + return JSONObject.toJSONString(spaceVO); + } +} diff --git a/src/main/java/cn/palmte/work/pojo/SpaceVO.java b/src/main/java/cn/palmte/work/pojo/SpaceVO.java new file mode 100644 index 0000000..0b37de0 --- /dev/null +++ b/src/main/java/cn/palmte/work/pojo/SpaceVO.java @@ -0,0 +1,49 @@ +package cn.palmte.work.pojo; + +import top.jfunc.common.db.bean.Record; + +import java.util.List; +import java.util.Map; + +public class SpaceVO { + + private Map map; + + private Record count; + + private Record type; + + private List list; + + public Map getMap() { + return map; + } + + public void setMap(Map map) { + this.map = map; + } + + public Record getCount() { + return count; + } + + public void setCount(Record count) { + this.count = count; + } + + public Record getType() { + return type; + } + + public void setType(Record type) { + this.type = type; + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } +} diff --git a/src/main/java/cn/palmte/work/service/ProjectService.java b/src/main/java/cn/palmte/work/service/ProjectService.java index fbc5515..b1f9df8 100644 --- a/src/main/java/cn/palmte/work/service/ProjectService.java +++ b/src/main/java/cn/palmte/work/service/ProjectService.java @@ -100,6 +100,10 @@ public class ProjectService { if(StrUtil.isNotEmpty(searchInfo.get("certainty")) && !"-1".equals(searchInfo.get("certainty"))){ queryHelper.addCondition("p.certainty=?", Integer.parseInt(searchInfo.get("certainty"))); } + queryHelper.addCondition(StrUtil.isNotEmpty(searchInfo.get("deptName")),"p.dept_name LIKE ?", "%"+searchInfo.get("deptName")+"%"); + if(StrUtil.isNotEmpty(searchInfo.get("estimateStatus")) && !"-1".equals(searchInfo.get("estimateStatus"))){ + queryHelper.addCondition("p.approve_status_estimate>=1 and p.approve_status_estimate<=2"); + } if(StrUtil.isNotEmpty(searchInfo.get("extend")) && "0".equals(searchInfo.get("extend"))) { if (StrUtil.isNotEmpty(searchInfo.get("isSecond")) && !"-1".equals(searchInfo.get("isSecond"))) { diff --git a/src/main/java/cn/palmte/work/service/SpaceService.java b/src/main/java/cn/palmte/work/service/SpaceService.java new file mode 100644 index 0000000..9735b2e --- /dev/null +++ b/src/main/java/cn/palmte/work/service/SpaceService.java @@ -0,0 +1,38 @@ +package cn.palmte.work.service; + +import cn.palmte.work.pojo.SpaceVO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import top.jfunc.common.db.bean.Record; +import top.jfunc.common.db.utils.Pagination; + +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + +@Service +public class SpaceService { + + @Autowired + private Pagination pagination; + + public SpaceVO getListData() { + + String sql = "SELECT count(id) as sum, certainty, certainty_str as name FROM project WHERE approve_status_estimate >= 1 and approve_status_estimate <= 2 and dept_name = '销售管理部' GROUP BY certainty"; + List pie = pagination.find(sql); + + String sql2 = "SELECT sum(IFNULL(contract_amount,0)) as sum, avg(IFNULL(gross_profit_margin, 0)) as average, certainty, certainty_str as name FROM project WHERE approve_status_estimate >= 1 and approve_status_estimate <= 2 and dept_name = '销售管理部' GROUP BY certainty"; + List bar = pagination.find(sql2); + return combineData(pie, bar); + } + + private SpaceVO combineData(List pie, List bar) { + Map map = pie.stream().collect(Collectors.toMap(record -> String.valueOf(record.getInt("certainty")), Function.identity())); + + SpaceVO spaceVO = new SpaceVO(); + spaceVO.setMap(map); + spaceVO.setList(bar); + return spaceVO; + } +} diff --git a/src/main/resources/templates/admin/project_approve.ftl b/src/main/resources/templates/admin/project_approve.ftl index 6c806e1..ce3a5f8 100644 --- a/src/main/resources/templates/admin/project_approve.ftl +++ b/src/main/resources/templates/admin/project_approve.ftl @@ -333,26 +333,7 @@ >${project.valueRisk!} -<#-- --> -<#-- -<#-- --> -<#-- -<#--
--> -<#--
--> -<#--
--> -<#--
--> -<#-- --> -<#--
--> -<#--
--> -<#--
--> -<#-- --> -<#-- --> -<#-- --> -<#-- --> -<#-- --> diff --git a/src/main/resources/templates/admin/project_budget_edit.ftl b/src/main/resources/templates/admin/project_budget_edit.ftl index eeda928..ee90975 100644 --- a/src/main/resources/templates/admin/project_budget_edit.ftl +++ b/src/main/resources/templates/admin/project_budget_edit.ftl @@ -102,309 +102,202 @@ - - - - + + + + - + + + + + + + + + + + + + + + <#if project.underwrittenMode! gt 2> + + + + + + + + + + <#if project.cooperateType! == 1> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -<#--
项目立项(概算)其他信息
项目负责人:
*部门名称:*项目编号:部门名称:项目编号:
*项目名称:项目名称:
项目类型: + <#if project.type??> + <#if (project.type) =1> + + <#elseif (project.type) =2> + + <#elseif (project.type) =3> + + + <#else> + + + 项目计划开始时间:项目计划结束时间:
垫资模式: colspan="5" <#else> colspan="1" > + <#if project.underwrittenMode??> + <#if (project.underwrittenMode) =1> + + <#elseif (project.underwrittenMode) =3> + + <#elseif (project.underwrittenMode) =4> + + + <#else> + + + 垫资利息:垫资峰值:
垫资模式: colspan="1" <#else> colspan="5" > + <#if project.cooperateType??> + <#if (project.cooperateType) =1> + + <#elseif (project.cooperateType) =2> + + + <#else> + + + 合作对象: + <#if project.collaboratorUrl?? && project.collaboratorUrl != ""> + + <#else> +
+ +
合同金额:项目毛利:项目毛利率:
汇智产品金额:华智产品金额:华三产品金额:
其他产品金额:项目把握度: + <#if project.certainty??> + <#if (project.certainty) =1> + + <#elseif (project.certainty) =2> + + <#elseif (project.certainty) =3> + + + <#else> + + + 行业场景应用:
项目解决方案: + <#if project.resolvePlan??> + <#if (project.resolvePlan!) =1> + + <#elseif (project.resolvePlan!) =2> + + <#elseif (project.resolvePlan!) =3> + + + <#else> + + + 客户名称:最终用户名称:
价值及风险: - -
*项目类型: - - *项目计划开始时间: - <#-- --> - - *项目计划结束时间: - <#-- --> - -
*垫资模式: - - hidden>*垫资利息:hidden> - - hidden>*垫资峰值:hidden> - -
*合作类型: - - hidden >*合作对象:hidden > -
- - - - - - <#if project.collaboratorUrl??>已上传 - - -
-
*合同金额: - - *项目毛利: - - *项目毛利率: - -
*汇智产品金额: - - *华智产品金额: - - *华三产品金额: - -
*其他产品金额: - - *项目把握度: - - *行业场景应用: - -
*项目解决方案: - - *客户名称: - - *最终用户名称: - -
*价值及风险: -
--> -<#--
--> -<#-- -<#--
--> -<#-- --> -<#-- --> -<#-- --> -<#-- --> -<#-- --> + - - + + - + - + - + diff --git a/src/main/resources/templates/admin/space_list.ftl b/src/main/resources/templates/admin/space_list.ftl new file mode 100644 index 0000000..dd41396 --- /dev/null +++ b/src/main/resources/templates/admin/space_list.ftl @@ -0,0 +1,458 @@ +<#assign base=request.contextPath /> +<#import "../common/defaultLayout.ftl" as defaultLayout> + +<@defaultLayout.layout> + + +
+
+ +
商务应用 / + 空间管理明细数据 +
+
+
+
+
+ + + + +
+ +
+
+
项目名称
+
+ +
+
+
+
项目类型
+
+ +
+
+
+
客户名称
+
+ +
+
+
+
最终用户名称
+
+ +
+
+
+ +
+
+
项目负责人
+
+ +
+
+
+
审核状态
+
+ +
+
+
+
是否二次合作
+
+ +
+
+
+
项目解决方案
+
+ +
+
+
+ +
+
+
项目周期
+
+
+ + +
+
+
+ + +
+
+
+
+
预计合同签订时间
+
+
+ + +
+
+
+ + +
+
+
+
+
+ + +
+
+ +
+
+ +
+
+
+ +
项目立项(概算)其他信息
*项目负责人: - - 项目负责人: 预计合同签订时间: - - 项目计划招标时间: - -
是否二次合作: - + <#elseif (project.isSecond!) =2> + + <#else > + - + <#else> + + 直签: - + <#else > + - + <#else> + +
主合同收款条款: -
主合同具体解决方案: - -
计收计划: -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <#list pager.list as list> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
序号项目编号项目名称项目类型垫资模式垫资利息垫资峰值项目合同金额项目毛利项目毛利率项目把握度汇智产品金额华智产品金额华三产品金额其他产品金额项目状态行业场景应用解决方案客户名称最终用户名称预计合同签订时间项目计划招标时间是否二次合作直签战略合作对象项目负责人审核状态当前审核人项目创建者部门名称项目周期最后更新时间
${list.tempId!}${list.projectNo!}${list.name!}${list.typeDesc!}${list.underwrittenModeStr!}${Utils.format(list.advanceInterestAmount, "0.00")}${Utils.format(list.advancePeakAmount, "0.00")}${Utils.format(list.contractAmount, "0.00")}${Utils.format(list.grossProfit, "0.00")}${Utils.format(list.grossProfitMargin, "0.00")}${list.certaintyStr!}${Utils.format(list.huizhiProductAmount, "0.00")}${Utils.format(list.huazhiProductAmount, "0.00")}${Utils.format(list.huasanProductAmount, "0.00")}${Utils.format(list.ziguangOtherAmount, "0.00")}${list.statusDesc!}${list.industryScenario!}${list.resolvePlanStr!}${list.customer!}${list.terminalCustomer!}${(list.contractTime?string("yyyy-MM-dd"))!}${(list.bidsTime?string("yyyy-MM-dd"))!}${list.isSecondStr!}${list.signTypeStr!}${list.collaborator!}${list.principal!}${list.approveStatusDesc!}${list.approveName!}${list.creatorName!}${list.deptName!}${(list.startDate?string("yyyy-MM"))!} ~ ${(list.endDate?string("yyyy-MM"))!}${(list.lastUpdateTime?string("yyyy-MM-dd HH:mm:ss"))!}
+
+ + + + + +
+
+ + <#if (pager.list)?exists && (pager.list?size>0) > +
+ <#include "../common/project_pager.ftl"> +
+ <#else> +
+

没有找到任何记录!

+
+ +
+
+ + + + + + + diff --git a/src/main/resources/templates/admin/space_statistics.ftl b/src/main/resources/templates/admin/space_statistics.ftl new file mode 100644 index 0000000..d6b50d7 --- /dev/null +++ b/src/main/resources/templates/admin/space_statistics.ftl @@ -0,0 +1,221 @@ +<#assign base=request.contextPath /> +<#import "../common/defaultLayout.ftl" as defaultLayout> +<@defaultLayout.layout> + +
+
+
+
商务信息管理 / + 空间管理
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + +