From b0f3b089a20bd867b8e364fc63061d6367f3bdb3 Mon Sep 17 00:00:00 2001
From: White <83705444@qq.com>
Date: Wed, 21 Dec 2022 10:33:49 +0800
Subject: [PATCH 1/4] =?UTF-8?q?=E5=BE=AE=E8=B0=83=EF=BC=8C=E5=95=86?=
=?UTF-8?q?=E5=8A=A1=E5=BA=94=E7=94=A8-=E7=A9=BA=E9=97=B4=E7=AE=A1?=
=?UTF-8?q?=E7=90=86-=E8=A1=A8=E6=A0=BC=E7=9A=84=E9=A1=B9=E7=9B=AE?=
=?UTF-8?q?=E5=90=8D=E7=A7=B0=E5=AE=BD=E5=BA=A6=E5=8D=A0=E6=AF=9440%?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/main/resources/templates/admin/space_list.ftl | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/main/resources/templates/admin/space_list.ftl b/src/main/resources/templates/admin/space_list.ftl
index 7664831..142a299 100644
--- a/src/main/resources/templates/admin/space_list.ftl
+++ b/src/main/resources/templates/admin/space_list.ftl
@@ -301,7 +301,7 @@
序号 |
项目编号 |
- 项目名称 |
+ 项目名称 |
项目类型 |
项目阶段 |
项目合同金额 |
@@ -338,7 +338,8 @@
<#--项目编号-->
${list.projectNo!} |
<#--项目名称-->
- ${list.name!} |
+<#-- ${list.name!} | -->
+ ${list.name!} |
<#--项目类型-->
${list.typeDesc!} |
<#--项目阶段-->
From 999c3bbc52dd83dd0fc558b571ad56617f18ca8c Mon Sep 17 00:00:00 2001
From: White <83705444@qq.com>
Date: Thu, 22 Dec 2022 17:08:27 +0800
Subject: [PATCH 2/4] =?UTF-8?q?X=E8=BD=B4name=E4=BD=8D=E7=BD=AE=E8=B0=83?=
=?UTF-8?q?=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/main/resources/templates/admin/space_statistics.ftl | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/main/resources/templates/admin/space_statistics.ftl b/src/main/resources/templates/admin/space_statistics.ftl
index 26b7854..4c193db 100644
--- a/src/main/resources/templates/admin/space_statistics.ftl
+++ b/src/main/resources/templates/admin/space_statistics.ftl
@@ -110,6 +110,10 @@
axisLabel: {
interval:0
},
+
+ nameGap: 30, // x轴name与横坐标轴线的间距
+ // nameLocation: "middle", // x轴name处于x轴的什么位置
+ offset: 0,
data: []
},
grid: {
From 2f02bb9ef39ce6573e86a72aacac608b0a9b4da3 Mon Sep 17 00:00:00 2001
From: OathK1per
Date: Fri, 23 Dec 2022 09:20:46 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=E7=BB=93=E7=AE=97=E5=8F=AF=E9=80=89?=
=?UTF-8?q?=E6=97=B6=E9=97=B4=E8=B7=A8=E5=BA=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../backend/ProjectSettleController.java | 42 +++++++++++---
.../work/model/ProjectSettleMonthRange.java | 56 +++++++++++++++++++
.../ProjectSettleMonthRangeRepository.java | 16 ++++++
.../templates/admin/project_settle_add.ftl | 32 ++++++-----
.../templates/admin/project_settle_edit.ftl | 6 +-
5 files changed, 129 insertions(+), 23 deletions(-)
create mode 100644 src/main/java/cn/palmte/work/model/ProjectSettleMonthRange.java
create mode 100644 src/main/java/cn/palmte/work/model/ProjectSettleMonthRangeRepository.java
diff --git a/src/main/java/cn/palmte/work/controller/backend/ProjectSettleController.java b/src/main/java/cn/palmte/work/controller/backend/ProjectSettleController.java
index 88e6b37..d9e67ab 100644
--- a/src/main/java/cn/palmte/work/controller/backend/ProjectSettleController.java
+++ b/src/main/java/cn/palmte/work/controller/backend/ProjectSettleController.java
@@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.datetime.DateFormatter;
import org.springframework.format.number.NumberStyleFormatter;
import org.springframework.stereotype.Controller;
+import org.springframework.validation.BindingResult;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -54,6 +55,9 @@ public class ProjectSettleController extends BaseController{
@Autowired
private ProjectUserTimeRepository projectUserTimeRepository;
+ @Autowired
+ private ProjectSettleMonthRangeRepository projectSettleMonthRangeRepository;
+
@RequestMapping("/add")
public String add(@RequestParam("id") int id, Map model) {
String time = null;
@@ -68,12 +72,14 @@ public class ProjectSettleController extends BaseController{
instance.set(Calendar.MONTH, instance.get(Calendar.MONTH) + 1);
Date current = instance.getTime();
time = DateKit.toStr(current, DateKit.DATE_FORMAT_YEAR_MONTH2);
- model.put("time", time);
+ model.put("startMonth", time);
+ model.put("endMonth", time);
model.put("formerBean", projectSettleService.getFormerSettle(project, time));
} else {
time = DateKit.toStr(project.getStartDate(), DateKit.DATE_FORMAT_YEAR_MONTH2);
- model.put("time", time);
+ model.put("startMonth", time);
+ model.put("endMonth", time);
model.put("formerBean", new FormerBean());
}
@@ -100,7 +106,13 @@ public class ProjectSettleController extends BaseController{
ProjectSettleIncome projectSettleIncome = projectSettleIncomeRepository.findNewByProjectId(id);
List projectBudgetPlanDetails = projectBudgetService.getProjectBudgetPlanDetails(project);
String time = projectSettleIncome.getTime();
- model.put("time", time);
+ ProjectSettleMonthRange projectSettleMonthRange = projectSettleMonthRangeRepository.findAllByProjectIdAndEndDate(id, time);
+ if (projectSettleMonthRange != null) {
+ model.put("startMonth", projectSettleMonthRange.getStartDate());
+ } else {
+ model.put("startMonth", time);
+ }
+ model.put("endMonth", time);
model.put("project", project);
model.put("estimateBean", projectEstimateService.getEstimate(project));
model.put("budgetBean", projectBudgetService.getBudget(project));
@@ -122,8 +134,15 @@ public class ProjectSettleController extends BaseController{
}
@RequestMapping("/save")
- public String save(Project project, SettleBean settleBean, BudgetSettleBean budgetBean, EstimateSettleBean estimateBean, String time) {
- projectSettleService.save(project, settleBean, budgetBean, estimateBean, time);
+ public String save(Project project, BindingResult bindingResult, SettleBean settleBean, BudgetSettleBean budgetBean, EstimateSettleBean estimateBean, String startMonth, String endMonth) {
+ if (!startMonth.equals(endMonth) && projectSettleMonthRangeRepository.findAllByProjectIdAndEndDate(project.getId(), endMonth) == null) {
+ ProjectSettleMonthRange range = new ProjectSettleMonthRange();
+ range.setProjectId(project.getId());
+ range.setStartDate(startMonth);
+ range.setEndDate(endMonth);
+ projectSettleMonthRangeRepository.save(range);
+ }
+ projectSettleService.save(project, settleBean, budgetBean, estimateBean, endMonth);
return "redirect:/project/list";
}
@@ -133,13 +152,20 @@ public class ProjectSettleController extends BaseController{
* @param settleBean
* @param budgetBean
* @param estimateBean
- * @param time
+ * @param endMonth
* @return
* @throws Exception
*/
@RequestMapping("/saveAndApprove")
- public String saveAndApprove(Project project, SettleBean settleBean, BudgetSettleBean budgetBean, EstimateSettleBean estimateBean, String time) throws Exception{
- projectSettleService.saveAndApprove(project, settleBean, budgetBean, estimateBean, time);
+ public String saveAndApprove(Project project, SettleBean settleBean, BudgetSettleBean budgetBean, EstimateSettleBean estimateBean, String startMonth, String endMonth) throws Exception{
+ if (!startMonth.equals(endMonth) && projectSettleMonthRangeRepository.findAllByProjectIdAndEndDate(project.getId(), endMonth) == null) {
+ ProjectSettleMonthRange range = new ProjectSettleMonthRange();
+ range.setProjectId(project.getId());
+ range.setStartDate(startMonth);
+ range.setEndDate(endMonth);
+ projectSettleMonthRangeRepository.save(range);
+ }
+ projectSettleService.saveAndApprove(project, settleBean, budgetBean, estimateBean, endMonth);
return "redirect:/project/list";
}
diff --git a/src/main/java/cn/palmte/work/model/ProjectSettleMonthRange.java b/src/main/java/cn/palmte/work/model/ProjectSettleMonthRange.java
new file mode 100644
index 0000000..310af2e
--- /dev/null
+++ b/src/main/java/cn/palmte/work/model/ProjectSettleMonthRange.java
@@ -0,0 +1,56 @@
+package cn.palmte.work.model;
+
+import org.hibernate.annotations.GenericGenerator;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "project_settle_month_range")
+public class ProjectSettleMonthRange {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @GenericGenerator(name = "persistenceGenerator", strategy = "increment")
+ private Integer id;
+
+ @Column(name = "project_id")
+ private int projectId;
+
+ @Column(name = "start_date")
+ private String startDate;
+
+ @Column(name = "end_date")
+ private String endDate;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public int getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(int projectId) {
+ this.projectId = projectId;
+ }
+
+ public String getStartDate() {
+ return startDate;
+ }
+
+ public void setStartDate(String startDate) {
+ this.startDate = startDate;
+ }
+
+ public String getEndDate() {
+ return endDate;
+ }
+
+ public void setEndDate(String endDate) {
+ this.endDate = endDate;
+ }
+}
diff --git a/src/main/java/cn/palmte/work/model/ProjectSettleMonthRangeRepository.java b/src/main/java/cn/palmte/work/model/ProjectSettleMonthRangeRepository.java
new file mode 100644
index 0000000..1b586e2
--- /dev/null
+++ b/src/main/java/cn/palmte/work/model/ProjectSettleMonthRangeRepository.java
@@ -0,0 +1,16 @@
+package cn.palmte.work.model;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+
+import java.util.List;
+
+/**
+ * @author Yuanping Zhang
+ * @date 2022/12/22
+ */
+public interface ProjectSettleMonthRangeRepository extends JpaRepository {
+
+ @Query(value = "select * from project_settle_month_range where project_id = ?1 and end_date = ?2 limit 1", nativeQuery = true)
+ ProjectSettleMonthRange findAllByProjectIdAndEndDate(int id, String endDate);
+}
diff --git a/src/main/resources/templates/admin/project_settle_add.ftl b/src/main/resources/templates/admin/project_settle_add.ftl
index 318e27a..7104006 100644
--- a/src/main/resources/templates/admin/project_settle_add.ftl
+++ b/src/main/resources/templates/admin/project_settle_add.ftl
@@ -39,7 +39,11 @@
@@ -409,19 +413,19 @@