diff --git a/pms-admin/src/main/java/tech/unissense/pms/web/controller/business/demand/ProjectDemandController.java b/pms-admin/src/main/java/tech/unissense/pms/web/controller/business/demand/ProjectDemandController.java index f5df795..40a8d99 100644 --- a/pms-admin/src/main/java/tech/unissense/pms/web/controller/business/demand/ProjectDemandController.java +++ b/pms-admin/src/main/java/tech/unissense/pms/web/controller/business/demand/ProjectDemandController.java @@ -7,9 +7,11 @@ import org.springframework.web.bind.annotation.*; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; +import tech.unissense.pms.common.annotation.Log; import tech.unissense.pms.common.core.controller.BaseController; import tech.unissense.pms.common.core.domain.AjaxResult; import tech.unissense.pms.common.core.page.TableDataInfo; +import tech.unissense.pms.common.enums.BusinessType; import java.util.List; @@ -44,6 +46,7 @@ public class ProjectDemandController extends BaseController { @PostMapping("/insert") + @Log(title = "需求管理", businessType = BusinessType.INSERT) public AjaxResult add(@RequestBody ProjectDemand projectDemand) { return toAjax(projectDemandService.insert(projectDemand)); } @@ -51,6 +54,7 @@ public class ProjectDemandController extends BaseController { @ApiOperation("编辑数据") @PutMapping("/update") + @Log(title = "需求管理", businessType = BusinessType.UPDATE) public AjaxResult edit(@RequestBody ProjectDemand projectDemand) { return toAjax(projectDemandService.update(projectDemand)); } @@ -58,6 +62,7 @@ public class ProjectDemandController extends BaseController { @ApiOperation("删除数据") @DeleteMapping("/{id}") + @Log(title = "需求管理", businessType = BusinessType.DELETE) public AjaxResult remove(@PathVariable("id") Integer id) { return toAjax(projectDemandService.deleteById(id)); } @@ -67,6 +72,7 @@ public class ProjectDemandController extends BaseController { */ @ApiOperation(value = "批量删除") @DeleteMapping("/remove/batch/{ids}") + @Log(title = "需求管理", businessType = BusinessType.DELETE) public AjaxResult batchRemove(@PathVariable("ids") Integer[] ids) { return AjaxResult.success(projectDemandService.batchRemove(ids)); } diff --git a/pms-admin/src/main/java/tech/unissense/pms/web/controller/business/version/ProjectVersionController.java b/pms-admin/src/main/java/tech/unissense/pms/web/controller/business/version/ProjectVersionController.java index cf8f523..f4f9f28 100644 --- a/pms-admin/src/main/java/tech/unissense/pms/web/controller/business/version/ProjectVersionController.java +++ b/pms-admin/src/main/java/tech/unissense/pms/web/controller/business/version/ProjectVersionController.java @@ -7,9 +7,11 @@ import tech.unissense.pms.business.version.service.IProjectVersionService; import org.springframework.web.bind.annotation.*; import org.springframework.beans.factory.annotation.Autowired; +import tech.unissense.pms.common.annotation.Log; import tech.unissense.pms.common.core.controller.BaseController; import tech.unissense.pms.common.core.domain.AjaxResult; import tech.unissense.pms.common.core.page.TableDataInfo; +import tech.unissense.pms.common.enums.BusinessType; import java.util.List; @@ -49,6 +51,7 @@ public class ProjectVersionController extends BaseController { @ApiOperation("新增数据") @PostMapping("/insert") + @Log(title = "版本管理", businessType = BusinessType.INSERT) public AjaxResult add(@RequestBody ProjectVersion projectVersion) { return toAjax(projectVersionService.insert(projectVersion)); } @@ -56,6 +59,7 @@ public class ProjectVersionController extends BaseController { @ApiOperation("编辑数据") @PutMapping("/update") + @Log(title = "需求管理", businessType = BusinessType.UPDATE) public AjaxResult edit(@RequestBody ProjectVersion projectVersion) { return toAjax(projectVersionService.update(projectVersion)); } @@ -63,6 +67,7 @@ public class ProjectVersionController extends BaseController { @ApiOperation("删除数据") @DeleteMapping("/{id}") + @Log(title = "需求管理", businessType = BusinessType.DELETE) public AjaxResult remove(@PathVariable("id") Integer id) { return toAjax(projectVersionService.deleteById(id)); } @@ -72,6 +77,7 @@ public class ProjectVersionController extends BaseController { */ @ApiOperation(value = "批量删除") @DeleteMapping("/remove/batch/{ids}") + @Log(title = "需求管理", businessType = BusinessType.DELETE) public AjaxResult batchRemove(@PathVariable("ids") Integer[] ids) { return AjaxResult.success(projectVersionService.batchRemove(ids)); } diff --git a/pms-admin/src/main/java/tech/unissense/pms/web/controller/business/work/WorkHourController.java b/pms-admin/src/main/java/tech/unissense/pms/web/controller/business/work/WorkHourController.java index 4b1e058..aa3c5ae 100644 --- a/pms-admin/src/main/java/tech/unissense/pms/web/controller/business/work/WorkHourController.java +++ b/pms-admin/src/main/java/tech/unissense/pms/web/controller/business/work/WorkHourController.java @@ -1,5 +1,6 @@ package tech.unissense.pms.web.controller.business.work; +import cn.hutool.core.lang.Assert; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import tech.unissense.pms.business.project.domain.Project; @@ -34,6 +35,7 @@ public class WorkHourController extends BaseController { @PostMapping("/add") @Log(title = "工作日志", businessType = BusinessType.INSERT) public AjaxResult addData(@RequestBody WorkLogger workLogger) { + Assert.notNull(workLogger.getProjectId(), "项目不能为空"); service.insert(workLogger); return success(); } diff --git a/pms-business/src/main/java/tech/unissense/pms/business/demand/service/impl/ProjectDemandServiceImpl.java b/pms-business/src/main/java/tech/unissense/pms/business/demand/service/impl/ProjectDemandServiceImpl.java index 15a3450..0538e9a 100644 --- a/pms-business/src/main/java/tech/unissense/pms/business/demand/service/impl/ProjectDemandServiceImpl.java +++ b/pms-business/src/main/java/tech/unissense/pms/business/demand/service/impl/ProjectDemandServiceImpl.java @@ -72,9 +72,9 @@ public class ProjectDemandServiceImpl implements IProjectDemandService { if (project == null) { throw new ServiceException("项目不存在"); } - if (Project.ProjectStateEnum.JXZ.value().equals(project.getProjectState())) { - throw new ServiceException("项目不处于进行中"); - } +// if (Project.ProjectStateEnum.JXZ.value().equals(project.getProjectState())) { +// throw new ServiceException("项目不处于进行中"); +// } } diff --git a/pms-business/src/main/java/tech/unissense/pms/business/version/service/impl/ProjectVersionServiceImpl.java b/pms-business/src/main/java/tech/unissense/pms/business/version/service/impl/ProjectVersionServiceImpl.java index 0843335..4a21138 100644 --- a/pms-business/src/main/java/tech/unissense/pms/business/version/service/impl/ProjectVersionServiceImpl.java +++ b/pms-business/src/main/java/tech/unissense/pms/business/version/service/impl/ProjectVersionServiceImpl.java @@ -78,18 +78,7 @@ public class ProjectVersionServiceImpl implements IProjectVersionService { List projectVersions = projectVersionMapper.queryAll(projectVersion); // 构建需求查询参数(根据项目ID) - ProjectDemand param = new ProjectDemand(); - param.setProjectId(projectVersion.getProjectId()); - if (projectVersion.getUserId() != null) { - param.setResponsiblePerson(projectVersion.getUserId()); - } - if (projectVersion.getQueryDate() != null) { - param.setQueryDate(projectVersion.getQueryDate()); - } - if (CollUtil.isNotEmpty(projectVersion.getDemandStatusList())) { - param.setDemandStatusList(projectVersion.getDemandStatusList()); - } - List allDemands = demandService.queryAll(param); + List allDemands = getProjectDemands(projectVersion); // 过滤出未关联版本的根需求(versionId为null的需求) List rootDemands = allDemands.stream() .filter(d -> d.getVersionId() == null) @@ -133,6 +122,21 @@ public class ProjectVersionServiceImpl implements IProjectVersionService { return versionTreeVoList; } + private List getProjectDemands(ProjectVersion projectVersion) { + ProjectDemand param = new ProjectDemand(); + param.setProjectId(projectVersion.getProjectId()); + if (projectVersion.getUserId() != null) { + param.setResponsiblePerson(projectVersion.getUserId()); + } + if (projectVersion.getQueryDate() != null) { + param.setQueryDate(projectVersion.getQueryDate()); + } + if (CollUtil.isNotEmpty(projectVersion.getDemandStatusList())) { + param.setDemandStatusList(projectVersion.getDemandStatusList()); + } + return demandService.queryAll(param); + } + }