From 73d2cb44a799bb41aca8e526662121e5aaae0b49 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Wed, 2 Aug 2023 15:27:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E7=AD=BE=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/handler/GlobalResponseHandler.java | 3 +- .../pmapi/portrait/controller/TagController.java | 56 +++++++ .../pmapi/portrait/manage/TagManage.java | 174 +++++++++++++++++++++ .../pmapi/portrait/mapper/ProjectTagMapper.java | 15 ++ .../pmapi/portrait/mapper/TagMapper.java | 15 ++ .../pmapi/portrait/model/dto/TagDTO.java | 36 +++++ .../pmapi/portrait/model/dto/TagToProjectDTO.java | 31 ++++ .../pmapi/portrait/model/entity/ProjectTag.java | 40 +++++ .../pmapi/portrait/model/entity/Tag.java | 45 ++++++ .../pmapi/portrait/model/req/TagPageReq.java | 25 +++ .../ningdatech/pmapi/portrait/model/vo/TagVO.java | 40 +++++ .../pmapi/portrait/service/IProjectTagService.java | 14 ++ .../pmapi/portrait/service/ITagService.java | 14 ++ .../service/impl/ProjectTagServiceImpl.java | 21 +++ .../portrait/service/impl/TagServiceImpl.java | 21 +++ .../pmapi/safety/manage/SafetyRiskManage.java | 22 ++- 16 files changed, 568 insertions(+), 4 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/portrait/controller/TagController.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/portrait/manage/TagManage.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/portrait/mapper/ProjectTagMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/portrait/mapper/TagMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/dto/TagDTO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/dto/TagToProjectDTO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/entity/ProjectTag.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/entity/Tag.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/req/TagPageReq.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/vo/TagVO.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/IProjectTagService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/ITagService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/impl/ProjectTagServiceImpl.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/impl/TagServiceImpl.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java index 7f7bb57..2c0646c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java @@ -31,7 +31,8 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; "com.ningdatech.pmapi.filemanage.controller", "com.ningdatech.pmapi.performance.controller", "com.ningdatech.pmapi.irs.controller", - "com.ningdatech.pmapi.safety.controller" + "com.ningdatech.pmapi.safety.controller", + "com.ningdatech.pmapi.portrait.controller" }) public class GlobalResponseHandler implements ResponseBodyAdvice { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/controller/TagController.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/controller/TagController.java new file mode 100644 index 0000000..c56bf7a --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/controller/TagController.java @@ -0,0 +1,56 @@ +package com.ningdatech.pmapi.portrait.controller; + +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.log.annotation.WebLog; +import com.ningdatech.pmapi.portrait.manage.TagManage; +import com.ningdatech.pmapi.portrait.model.dto.TagDTO; +import com.ningdatech.pmapi.portrait.model.dto.TagToProjectDTO; +import com.ningdatech.pmapi.portrait.model.req.TagPageReq; +import com.ningdatech.pmapi.portrait.model.vo.TagVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + +/** + * @Classname TagController + * @Description + * @Date 2023/8/2 14:11 + * @Author PoffyZhang + */ +@RestController +@RequiredArgsConstructor +@Api(tags = "项目画像-标签") +@RequestMapping("/api/v1/portrait/tag") +public class TagController { + private final TagManage tagManage; + + @GetMapping("/list/{areaCode}") + @ApiOperation("按区域查询标签列表") + public PageVo list(@PathVariable String areaCode, TagPageReq req) { + return tagManage.list(areaCode,req); + } + + @PostMapping("/save") + @ApiOperation("保存标签") + @WebLog("保存标签") + public String save(@Valid @RequestBody TagDTO dto) { + return tagManage.save(dto); + } + + @PostMapping("/save-to-project") + @ApiOperation("设置标签到项目") + @WebLog("设置标签到项目") + public String saveToProject(@Valid @RequestBody TagToProjectDTO dto) { + return tagManage.saveToProject(dto); + } + + @PostMapping("/remove-tag-to-project") + @ApiOperation("项目删除标签") + @WebLog("项目删除标签") + public String removeTagToProject(@Valid @RequestBody TagToProjectDTO dto) { + return tagManage.removeTagToProject(dto); + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/manage/TagManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/manage/TagManage.java new file mode 100644 index 0000000..7aea60a --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/manage/TagManage.java @@ -0,0 +1,174 @@ +package com.ningdatech.pmapi.portrait.manage; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.PageVo; +import com.ningdatech.basic.util.CollUtils; +import com.ningdatech.pmapi.portrait.model.dto.TagDTO; +import com.ningdatech.pmapi.portrait.model.dto.TagToProjectDTO; +import com.ningdatech.pmapi.portrait.model.entity.ProjectTag; +import com.ningdatech.pmapi.portrait.model.entity.Tag; +import com.ningdatech.pmapi.portrait.model.req.TagPageReq; +import com.ningdatech.pmapi.portrait.model.vo.TagVO; +import com.ningdatech.pmapi.portrait.service.IProjectTagService; +import com.ningdatech.pmapi.portrait.service.ITagService; +import com.ningdatech.pmapi.projectlib.model.entity.Project; +import com.ningdatech.pmapi.projectlib.service.IProjectService; +import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; +import com.ningdatech.pmapi.user.util.LoginUserUtil; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; + +/** + * @Classname TagManage + * @Description + * @Date 2023/8/2 14:10 + * @Author PoffyZhang + */ +@Component +@Slf4j +@AllArgsConstructor +public class TagManage { + + private final ITagService tagService; + + private final IProjectService projectService; + + private final IProjectTagService projectTagService; + + /** + * 标签分页 + * @param areaCode + * @param req + * @return + */ + public PageVo list(String areaCode, TagPageReq req) { + LambdaQueryWrapper query = Wrappers.lambdaQuery(Tag.class) + .eq(Tag::getAreaCode, areaCode) + .like(StringUtils.isNotBlank(req.getName()),Tag::getName,req.getName()) + .orderByDesc(Tag::getUpdateOn); + checkAuth(query,LoginUserUtil.loginUserDetail()); + Page page = tagService.page(req.page(), query); + long total; + if ((total = page.getTotal()) == 0) { + return PageVo.empty(); + } + List records = CollUtils.convert(page.getRecords(), + t -> BeanUtil.copyProperties(t,TagVO.class)); + return PageVo.of(records, total); + } + + /** + * 权限控制 + * @param query + * @param user + */ + private void checkAuth(LambdaQueryWrapper query, UserInfoDetails user) { + //如果是超管 + if(user.getSuperAdmin()){ + log.info(user.getUsername() + " 是超管,可以看所有标签"); + }else if(user.getRegionAdmin()){ + //如果是区域管理员 + log.info(user.getUsername() + " 是区管,可以看本区域" + user.getRegionCode() + "标签"); + query.eq(Tag::getAreaCode,user.getRegionCode()); + }else{ + //其它角色全都看不见 + query.eq(Tag::getId,0L); + } + } + + /** + * 保存标签 + * @param dto + * @return + */ + public String save(TagDTO dto) { + deduplicationName(dto); + UserInfoDetails user = LoginUserUtil.loginUserDetail(); + Tag entity = BeanUtil.copyProperties(dto,Tag.class); + if(Objects.nonNull(dto.getId())){ + Tag old = tagService.getById(dto.getId()); + VUtils.isTrue(Objects.isNull(old)).throwMessage("此id标签不存在!"); + entity.setId(old.getId()); + }else{ + entity.setId(null); + entity.setCreateOn(LocalDateTime.now()); + entity.setCreateBy(user.getUsername()); + } + entity.setUpdateOn(LocalDateTime.now()); + entity.setUpdateBy(user.getUsername()); + tagService.saveOrUpdate(entity); + + return "保存成功"; + } + + /** + * 标签名 去重 + * @param dto + */ + private void deduplicationName(TagDTO dto) { + if(StringUtils.isNotBlank(dto.getName())){ + long count = tagService.count(Wrappers.lambdaQuery(Tag.class) + .eq(Tag::getAreaCode, dto.getAreaCode()) + .eq(Tag::getName, dto.getName()) + .ne(Objects.nonNull(dto.getId()), Tag::getId, dto.getId())); + VUtils.isTrue(count > 0).throwMessage("保存失败!此区域标签名重复!"); + } + } + + 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("标签不存在!"); + + 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()); + projectTagService.save(projectTag); + + return "保存成功"; + } + + public String removeTagToProject(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("标签不存在!"); + + VUtils.isTrue(!tag.getAreaCode().equals(project.getAreaCode())) + .throwMessage("项目和标签不是一个区域的!"); + + ProjectTag pt = projectTagService.getOne(Wrappers.lambdaQuery(ProjectTag.class) + .eq(ProjectTag::getProjectCode, projectCode) + .eq(ProjectTag::getTagId, tagId)); + + VUtils.isTrue(Objects.isNull(pt)) + .throwMessage("该项目没有绑定此标签!"); + projectTagService.removeById(pt.getId()); + + return "删除成功"; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/mapper/ProjectTagMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/mapper/ProjectTagMapper.java new file mode 100644 index 0000000..7ee6898 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/mapper/ProjectTagMapper.java @@ -0,0 +1,15 @@ +package com.ningdatech.pmapi.portrait.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.pmapi.portrait.model.entity.ProjectTag; + +/** + *

+ *

+ * + * @author ZPF + * @since 2023-08-2 + */ +public interface ProjectTagMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/mapper/TagMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/mapper/TagMapper.java new file mode 100644 index 0000000..78ed337 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/mapper/TagMapper.java @@ -0,0 +1,15 @@ +package com.ningdatech.pmapi.portrait.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.pmapi.portrait.model.entity.Tag; + +/** + *

+ *

+ * + * @author ZPF + * @since 2023-08-2 + */ +public interface TagMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/dto/TagDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/dto/TagDTO.java new file mode 100644 index 0000000..4cc5a2e --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/dto/TagDTO.java @@ -0,0 +1,36 @@ +package com.ningdatech.pmapi.portrait.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + *

+ * 标签 + *

+ * + * @author ZPF + * @since 2023-08-02 + */ +@Data +@ApiModel(value = "Tag对象", description = "标签") +public class TagDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("标签名") + private String name; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("区域CODE") + @NotNull(message = "区域CODE必填") + private String areaCode; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/dto/TagToProjectDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/dto/TagToProjectDTO.java new file mode 100644 index 0000000..7bdb8d8 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/dto/TagToProjectDTO.java @@ -0,0 +1,31 @@ +package com.ningdatech.pmapi.portrait.model.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + *

+ * 标签 + *

+ * + * @author ZPF + * @since 2023-08-02 + */ +@Data +@ApiModel(value = "Tag对象", description = "标签") +public class TagToProjectDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @NotNull(message = "标签ID必填") + private Long tagId; + + @ApiModelProperty("当前项目编号") + @NotNull(message = "项目编号必填") + private String projectCode; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/entity/ProjectTag.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/entity/ProjectTag.java new file mode 100644 index 0000000..f399112 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/entity/ProjectTag.java @@ -0,0 +1,40 @@ +package com.ningdatech.pmapi.portrait.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 标签项目关联 + *

+ * + * @author ZPF + * @since 2023-08-02 + */ +@Data +@TableName("nd_project_tag") +@ApiModel(value = "ProjectTag对象", description = "标签项目关联") +public class ProjectTag implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("项目编号") + private String projectCode; + + @ApiModelProperty("标签ID") + private Long tagId; + + private LocalDateTime createOn; + private String createBy; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/entity/Tag.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/entity/Tag.java new file mode 100644 index 0000000..df641ae --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/entity/Tag.java @@ -0,0 +1,45 @@ +package com.ningdatech.pmapi.portrait.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 标签 + *

+ * + * @author ZPF + * @since 2023-08-02 + */ +@Data +@TableName("nd_tag") +@ApiModel(value = "Tag对象", description = "标签") +public class Tag implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + @TableId(type = IdType.AUTO) + private Long id; + + @ApiModelProperty("标签名") + private String name; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("区域CODE") + private String areaCode; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/req/TagPageReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/req/TagPageReq.java new file mode 100644 index 0000000..85dfd3f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/req/TagPageReq.java @@ -0,0 +1,25 @@ +package com.ningdatech.pmapi.portrait.model.req; + +import com.ningdatech.basic.model.PagePo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; + +/** + * @Classname TagPageReq + * @Description + * @Date 2023/8/2 14:16 + * @Author PoffyZhang + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@ApiModel("标签列表查询") +@EqualsAndHashCode(callSuper = true) +public class TagPageReq extends PagePo { + + @ApiModelProperty("标签名") + private String name; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/vo/TagVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/vo/TagVO.java new file mode 100644 index 0000000..3527f98 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/model/vo/TagVO.java @@ -0,0 +1,40 @@ +package com.ningdatech.pmapi.portrait.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * 标签 + *

+ * + * @author ZPF + * @since 2023-08-02 + */ +@Data +@ApiModel(value = "Tag对象", description = "标签") +public class TagVO implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("标签名") + private String name; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("区域CODE") + private String areaCode; + + private LocalDateTime createOn; + private LocalDateTime updateOn; + private String createBy; + private String updateBy; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/IProjectTagService.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/IProjectTagService.java new file mode 100644 index 0000000..a400cc5 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/IProjectTagService.java @@ -0,0 +1,14 @@ +package com.ningdatech.pmapi.portrait.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.pmapi.portrait.model.entity.ProjectTag; + +/** + * @Classname ITagService + * @Description + * @Date 2023/8/2 10:47 + * @Author PoffyZhang + */ +public interface IProjectTagService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/ITagService.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/ITagService.java new file mode 100644 index 0000000..b635e07 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/ITagService.java @@ -0,0 +1,14 @@ +package com.ningdatech.pmapi.portrait.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.pmapi.portrait.model.entity.Tag; + +/** + * @Classname ITagService + * @Description + * @Date 2023/8/2 10:47 + * @Author PoffyZhang + */ +public interface ITagService extends IService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/impl/ProjectTagServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/impl/ProjectTagServiceImpl.java new file mode 100644 index 0000000..53bd932 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/impl/ProjectTagServiceImpl.java @@ -0,0 +1,21 @@ +package com.ningdatech.pmapi.portrait.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.pmapi.portrait.mapper.ProjectTagMapper; +import com.ningdatech.pmapi.portrait.model.entity.ProjectTag; +import com.ningdatech.pmapi.portrait.service.IProjectTagService; +import org.springframework.stereotype.Service; + +/** + *

+ *

+ * + * @author ZPF + * @since 2023-08-2 + */ +@Service +public class ProjectTagServiceImpl extends ServiceImpl implements IProjectTagService { + + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/impl/TagServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/impl/TagServiceImpl.java new file mode 100644 index 0000000..142029a --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/portrait/service/impl/TagServiceImpl.java @@ -0,0 +1,21 @@ +package com.ningdatech.pmapi.portrait.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.pmapi.portrait.mapper.TagMapper; +import com.ningdatech.pmapi.portrait.model.entity.Tag; +import com.ningdatech.pmapi.portrait.service.ITagService; +import org.springframework.stereotype.Service; + +/** + *

+ *

+ * + * @author ZPF + * @since 2023-08-2 + */ +@Service +public class TagServiceImpl extends ServiceImpl implements ITagService { + + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/safety/manage/SafetyRiskManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/safety/manage/SafetyRiskManage.java index e9c8f5a..5e990df 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/safety/manage/SafetyRiskManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/safety/manage/SafetyRiskManage.java @@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ningdatech.basic.exception.BizException; import com.ningdatech.basic.function.VUtils; import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; @@ -64,7 +65,8 @@ public class SafetyRiskManage { .ge(Project::getStatus, ProjectStatusEnum.UNDER_CONSTRUCTION.getCode()) .ne(Project::getStatus, ProjectStatusEnum.OPERATION.getCode()) .like(StringUtils.isNotBlank(req.getProjectName()),Project::getProjectName,req.getProjectName()) - .like(StringUtils.isNotBlank(req.getBuildOrgName()),Project::getBuildOrgName,req.getBuildOrgName()); + .like(StringUtils.isNotBlank(req.getBuildOrgName()),Project::getBuildOrgName,req.getBuildOrgName()) + .orderByDesc(Project::getUpdateOn); checkAuth(query,LoginUserUtil.loginUserDetail()); Page page = projectService.page(req.page(), query); long total; @@ -145,9 +147,16 @@ public class SafetyRiskManage { UserInfoDetails user = LoginUserUtil.loginUserDetail(); + String projectCode = dtos.get(0).getProjectCode(); + if(StringUtils.isBlank(projectCode)){ + throw new BizException("参数有误!"); + } + supplierSafetyQualificationService.remove(Wrappers.lambdaQuery(SupplierSafetyQualification.class) + .eq(SupplierSafetyQualification::getProjectCode, projectCode)); + Integer sucessNum = 0; for(SupplierSafetyQualificationDTO dto : dtos){ - String projectCode = dto.getProjectCode(); + projectCode = dto.getProjectCode(); Project project = projectService.getOne(Wrappers.lambdaQuery(Project.class) .eq(Project::getNewest, Boolean.TRUE) .eq(Project::getProjectCode, projectCode) @@ -176,9 +185,16 @@ public class SafetyRiskManage { UserInfoDetails user = LoginUserUtil.loginUserDetail(); + String projectCode = dtos.get(0).getProjectCode(); + if(StringUtils.isBlank(projectCode)){ + throw new BizException("参数有误!"); + } + personSafetyInfoService.remove(Wrappers.lambdaQuery(PersonSafetyInfo.class) + .eq(PersonSafetyInfo::getProjectCode, projectCode)); + Integer sucessNum = 0; for(PersonSafetyInfoDTO dto : dtos){ - String projectCode = dto.getProjectCode(); + projectCode = dto.getProjectCode(); Project project = projectService.getOne(Wrappers.lambdaQuery(Project.class) .eq(Project::getNewest, Boolean.TRUE) .eq(Project::getProjectCode, projectCode)