Conflicts: pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.javamaster
@@ -13,6 +13,7 @@ import lombok.RequiredArgsConstructor; | |||||
import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
import javax.validation.Valid; | import javax.validation.Valid; | ||||
import java.util.List; | |||||
/** | /** | ||||
* @Classname TagController | * @Classname TagController | ||||
@@ -40,11 +41,18 @@ public class TagController { | |||||
return tagManage.save(dto); | return tagManage.save(dto); | ||||
} | } | ||||
@PostMapping("/delete/{id}") | |||||
@ApiOperation("删除标签") | |||||
@WebLog("删除标签") | |||||
public String save(@PathVariable Long id) { | |||||
return tagManage.delete(id); | |||||
} | |||||
@PostMapping("/save-to-project") | @PostMapping("/save-to-project") | ||||
@ApiOperation("设置标签到项目") | @ApiOperation("设置标签到项目") | ||||
@WebLog("设置标签到项目") | @WebLog("设置标签到项目") | ||||
public String saveToProject(@Valid @RequestBody TagToProjectDTO dto) { | |||||
return tagManage.saveToProject(dto); | |||||
public String saveToProject(@Valid @RequestBody List<TagToProjectDTO> dtos) { | |||||
return tagManage.saveToProject(dtos); | |||||
} | } | ||||
@PostMapping("/remove-tag-to-project") | @PostMapping("/remove-tag-to-project") | ||||
@@ -1,6 +1,7 @@ | |||||
package com.ningdatech.pmapi.portrait.manage; | package com.ningdatech.pmapi.portrait.manage; | ||||
import cn.hutool.core.bean.BeanUtil; | import cn.hutool.core.bean.BeanUtil; | ||||
import cn.hutool.core.collection.CollUtil; | |||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
@@ -125,32 +126,39 @@ public class TagManage { | |||||
} | } | ||||
} | } | ||||
public String saveToProject(TagToProjectDTO dto) { | |||||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||||
String projectCode = dto.getProjectCode(); | |||||
Project project = projectService.getProjectByCode(projectCode); | |||||
VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!"); | |||||
Long tagId = dto.getTagId(); | |||||
Tag tag = tagService.getById(tagId); | |||||
VUtils.isTrue(Objects.isNull(tag)).throwMessage("标签不存在!"); | |||||
public String saveToProject(List<TagToProjectDTO> dtos) { | |||||
if(CollUtil.isEmpty(dtos)){ | |||||
return "参入的标签为空"; | |||||
} | |||||
VUtils.isTrue(!tag.getAreaCode().equals(project.getAreaCode())) | |||||
.throwMessage("项目和标签不是一个区域的!"); | |||||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||||
ProjectTag projectTag = new ProjectTag(); | |||||
projectTag.setProjectCode(projectCode); | |||||
projectTag.setTagId(tagId); | |||||
projectTag.setCreateOn(LocalDateTime.now()); | |||||
projectTag.setCreateBy(user.getUsername()); | |||||
projectTagService.save(projectTag); | |||||
Integer successNum = 0; | |||||
for(TagToProjectDTO dto : dtos){ | |||||
String projectCode = dto.getProjectCode(); | |||||
Project project = projectService.getProjectByCode(projectCode); | |||||
VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!"); | |||||
Long tagId = dto.getTagId(); | |||||
Tag tag = tagService.getById(tagId); | |||||
VUtils.isTrue(Objects.isNull(tag)).throwMessage("标签不存在!"); | |||||
VUtils.isTrue(!tag.getAreaCode().equals(project.getAreaCode())) | |||||
.throwMessage("项目和标签不是一个区域的!"); | |||||
ProjectTag projectTag = new ProjectTag(); | |||||
projectTag.setProjectCode(projectCode); | |||||
projectTag.setTagId(tagId); | |||||
projectTag.setCreateOn(LocalDateTime.now()); | |||||
projectTag.setCreateBy(user.getUsername()); | |||||
if(projectTagService.save(projectTag)){ | |||||
successNum ++; | |||||
} | |||||
} | |||||
return "保存成功"; | |||||
return "保存成功" + successNum + "条"; | |||||
} | } | ||||
public String removeTagToProject(TagToProjectDTO dto) { | public String removeTagToProject(TagToProjectDTO dto) { | ||||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||||
String projectCode = dto.getProjectCode(); | String projectCode = dto.getProjectCode(); | ||||
Project project = projectService.getProjectByCode(projectCode); | Project project = projectService.getProjectByCode(projectCode); | ||||
VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!"); | VUtils.isTrue(Objects.isNull(project)).throwMessage("项目不存在!"); | ||||
@@ -171,4 +179,23 @@ public class TagManage { | |||||
return "删除成功"; | return "删除成功"; | ||||
} | } | ||||
/** | |||||
* 删除标签 | |||||
* @param id | |||||
* @return | |||||
*/ | |||||
public String delete(Long id) { | |||||
Tag tag = tagService.getById(id); | |||||
VUtils.isTrue(Objects.isNull(tag)) | |||||
.throwMessage("删除失败 此标签ID不存在!"); | |||||
if(tagService.removeById(id)){ | |||||
//关联关系 也要删 | |||||
projectTagService.remove(Wrappers.lambdaQuery(ProjectTag.class) | |||||
.eq(ProjectTag::getTagId,id)); | |||||
return "删除成功"; | |||||
} | |||||
return "删除失败"; | |||||
} | |||||
} | } |
@@ -59,6 +59,13 @@ import com.ningdatech.pmapi.projectlib.model.vo.ProjectApplicationVO; | |||||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; | import com.ningdatech.pmapi.projectlib.model.vo.ProjectDetailVO; | ||||
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO; | ||||
import com.ningdatech.pmapi.projectlib.service.*; | import com.ningdatech.pmapi.projectlib.service.*; | ||||
import com.ningdatech.pmapi.safety.model.entity.PersonSafetyInfo; | |||||
import com.ningdatech.pmapi.safety.model.entity.SupplierSafetyQualification; | |||||
import com.ningdatech.pmapi.safety.model.vo.PersonSafetyInfoVO; | |||||
import com.ningdatech.pmapi.safety.model.vo.SafetyMonitorVO; | |||||
import com.ningdatech.pmapi.safety.model.vo.SupplierSafetyQualificationVO; | |||||
import com.ningdatech.pmapi.safety.service.IPersonSafetyInfoService; | |||||
import com.ningdatech.pmapi.safety.service.ISupplierSafetyQualificationService; | |||||
import com.ningdatech.pmapi.todocenter.model.req.ProcessDetailReq; | import com.ningdatech.pmapi.todocenter.model.req.ProcessDetailReq; | ||||
import com.ningdatech.pmapi.todocenter.service.ITodoService; | import com.ningdatech.pmapi.todocenter.service.ITodoService; | ||||
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; | ||||
@@ -115,6 +122,12 @@ public class ProjectLibManage { | |||||
private final IProjectTagService projectTagService; | private final IProjectTagService projectTagService; | ||||
private final ITagService tagService; | private final ITagService tagService; | ||||
private final IOperationService operationService; | |||||
private final ISupplierSafetyQualificationService supplierSafetyQualificationService; | |||||
private final IPersonSafetyInfoService personSafetyInfoService; | |||||
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) { | ||||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | ||||
query.eq(Project::getNewest, Boolean.TRUE); | query.eq(Project::getNewest, Boolean.TRUE); | ||||
@@ -662,6 +675,25 @@ public class ProjectLibManage { | |||||
.last(BizConst.LIMIT_1)); | .last(BizConst.LIMIT_1)); | ||||
vo.setOperation(BeanUtil.copyProperties(operation, OperationVO.class)); | vo.setOperation(BeanUtil.copyProperties(operation, OperationVO.class)); | ||||
SafetyMonitorVO safetyVo = new SafetyMonitorVO(); | |||||
//查询风险监测 | |||||
List<SupplierSafetyQualification> ssq = supplierSafetyQualificationService.list(Wrappers.lambdaQuery(SupplierSafetyQualification.class) | |||||
.eq(SupplierSafetyQualification::getProjectCode, projectInfo.getProjectCode())); | |||||
if(CollUtil.isNotEmpty(ssq)){ | |||||
safetyVo.setSupplierSafetyQualification(ssq.stream() | |||||
.map(s -> BeanUtil.copyProperties(s, SupplierSafetyQualificationVO.class)) | |||||
.collect(Collectors.toList())); | |||||
} | |||||
vo.setSafetyInfo(safetyVo); | |||||
List<PersonSafetyInfo> psi = personSafetyInfoService.list(Wrappers.lambdaQuery(PersonSafetyInfo.class) | |||||
.eq(PersonSafetyInfo::getProjectCode, projectInfo.getProjectCode())); | |||||
if(CollUtil.isNotEmpty(psi)){ | |||||
safetyVo.setPersonSafetyInfo(psi.stream() | |||||
.map(p -> BeanUtil.copyProperties(p, PersonSafetyInfoVO.class)) | |||||
.collect(Collectors.toList())); | |||||
} | |||||
//查询初验信息 | //查询初验信息 | ||||
List<PreInsAcceptancePerson> acceptancePersons = acceptancePersonService.list(Wrappers.lambdaQuery(PreInsAcceptancePerson.class) | List<PreInsAcceptancePerson> acceptancePersons = acceptancePersonService.list(Wrappers.lambdaQuery(PreInsAcceptancePerson.class) | ||||
.in(PreInsAcceptancePerson::getProjectId, allVersionProjectId) | .in(PreInsAcceptancePerson::getProjectId, allVersionProjectId) | ||||
@@ -13,6 +13,7 @@ import com.ningdatech.pmapi.projectdeclared.model.vo.PreInsAcceptancePersonVO; | |||||
import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO; | import com.ningdatech.pmapi.projectdeclared.model.vo.PurchaseVO; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | ||||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; | import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum; | ||||
import com.ningdatech.pmapi.safety.model.vo.SafetyMonitorVO; | |||||
import com.ningdatech.pmapi.todocenter.model.vo.ProcessProgressDetailVo; | import com.ningdatech.pmapi.todocenter.model.vo.ProcessProgressDetailVo; | ||||
import io.swagger.annotations.ApiModel; | import io.swagger.annotations.ApiModel; | ||||
import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
@@ -445,4 +446,7 @@ public class ProjectDetailVO { | |||||
} | } | ||||
return StringUtils.EMPTY; | return StringUtils.EMPTY; | ||||
} | } | ||||
@ApiModelProperty("安全风险监测信息") | |||||
private SafetyMonitorVO safetyInfo; | |||||
} | } |