浏览代码

项目归集的列表权限和逻辑删除

master
PoffyZhang 1年前
父节点
当前提交
e3982315b7
共有 13 个文件被更改,包括 157 次插入13 次删除
  1. +49
    -13
      pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java
  2. +9
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectApply.java
  3. +9
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectApprove.java
  4. +9
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectBaseinfo.java
  5. +9
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectCimplement.java
  6. +9
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectMimplement.java
  7. +9
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectProcure.java
  8. +9
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectApplyVO.java
  9. +9
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectApproveVO.java
  10. +9
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectBaseinfoVO.java
  11. +9
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectCimplementVO.java
  12. +9
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectMimplementVO.java
  13. +9
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectProcureVO.java

+ 49
- 13
pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java 查看文件

@@ -22,6 +22,10 @@ import com.ningdatech.pmapi.gov.model.vo.*;
import com.ningdatech.pmapi.gov.service.*;
import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.sys.model.entity.Role;
import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -106,7 +110,9 @@ public class GovProjectCollectionManage {
.eq(StringUtils.isNotBlank(req.getRegionCode()),GovBizProjectBaseinfo::getBaseAreaCode,req.getRegionCode() + BizConst.NINE_AREA_CODE_LAST)
.gt(Objects.nonNull(req.getCreateOnMin()),GovBizProjectBaseinfo::getTongTime,req.getCreateOnMin())
.le(Objects.nonNull(req.getCreateOnMax()),GovBizProjectBaseinfo::getTongTime,req.getCreateOnMax())
.eq(GovBizProjectBaseinfo::getDeleted,Boolean.FALSE)
.orderByDesc(GovBizProjectBaseinfo::getBizTime);
permissions(wrapper);
baseinfoService.page(page,wrapper);

if(CollUtil.isEmpty(page.getRecords())){
@@ -145,6 +151,25 @@ public class GovProjectCollectionManage {
return PageVo.of(res,page.getTotal());
}

/**
* 数据权限
* @param wrapper
*/
private void permissions(LambdaQueryWrapper<GovBizProjectBaseinfo> wrapper) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();
List<Role> userRoleList = user.getUserRoleList();
for(Role role : userRoleList){
//超管和区域管理员
if(RoleEnum.SUPER_ADMIN.name().equals(role.getCode()) ||
RoleEnum.REGION_MANAGER.name().equals(role.getCode())){
log.info("超管和区管 可以看所有");
}else{
//其他情况 都只能看 自己单位的
wrapper.eq(GovBizProjectBaseinfo::getBaseBuildDeprtDing,user.getEmpPosUnitCode());
}
}
}

public Long count(ProjectListReq req) {
LambdaQueryWrapper<GovBizProjectBaseinfo> wrapper = Wrappers.lambdaQuery(GovBizProjectBaseinfo.class)
.like(StringUtils.isNotBlank(req.getProjectName()),GovBizProjectBaseinfo::getBaseProjName,req.getProjectName())
@@ -231,8 +256,11 @@ public class GovProjectCollectionManage {
*/
@Transactional
public String save(GovBizProjectSaveDTO saveDTO) {
UserInfoDetails user = LoginUserUtil.loginUserDetail();

GovBizProjectBaseinfoDTO base = saveDTO.getBaseinfo();
String baseProjId = base.getBaseProjId();
String baseAreaCode = user.getRegionCode() + BizConst.NINE_AREA_CODE_LAST;
String baseProjName = base.getBaseProjName();
//如果是新增的话 要生成 项目编号
if(StringUtils.isBlank(baseProjId)){
@@ -258,6 +286,7 @@ public class GovProjectCollectionManage {
saveBase.setId(oldBaseInfo.getId());
}else{
saveBase.setTongTime(LocalDateTime.now());
saveBase.setBaseAreaCode(baseAreaCode);
}
if(Objects.nonNull(saveBase.getBaseAreaCode())){
saveBase.setBaseAreaCode(saveBase.getBaseAreaCode() + BizConst.NINE_AREA_CODE_LAST);
@@ -396,24 +425,31 @@ public class GovProjectCollectionManage {
VUtils.isTrue(Objects.isNull(baseinfo)).throwMessage("项目不存在!");

baseinfoService.removeById(baseinfo);
projectApplyService.remove(Wrappers.lambdaQuery(GovBizProjectApply.class)
.eq(GovBizProjectApply::getBaseProjId,projId));
approveService.remove(Wrappers.lambdaQuery(GovBizProjectApprove.class)
.eq(GovBizProjectApprove::getBaseProjId,projId));
cimplementService.remove(Wrappers.lambdaQuery(GovBizProjectCimplement.class)
.eq(GovBizProjectCimplement::getBaseProjId,projId));
mimplementService.remove(Wrappers.lambdaQuery(GovBizProjectMimplement.class)
.eq(GovBizProjectMimplement::getBaseProjId,projId));
procureService.remove(Wrappers.lambdaQuery(GovBizProjectProcure.class)
.eq(GovBizProjectProcure::getBaseProjId,projId));
// notEffectiveProject(BeanUtil.copyProperties(baseinfo,GovBizProjectBaseinfoDTO.class));
//改正逻辑删除
baseinfo.setDeleted(Boolean.TRUE);
baseinfoService.updateById(baseinfo);
projectApplyService.update(Wrappers.lambdaUpdate(GovBizProjectApply.class)
.eq(GovBizProjectApply::getBaseProjId,projId)
.set(GovBizProjectApply::getDeleted,Boolean.TRUE));
approveService.update(Wrappers.lambdaUpdate(GovBizProjectApprove.class)
.eq(GovBizProjectApprove::getBaseProjId,projId)
.set(GovBizProjectApprove::getDeleted,Boolean.TRUE));
cimplementService.update(Wrappers.lambdaUpdate(GovBizProjectCimplement.class)
.eq(GovBizProjectCimplement::getBaseProjId,projId)
.set(GovBizProjectCimplement::getDeleted,Boolean.TRUE));
mimplementService.update(Wrappers.lambdaUpdate(GovBizProjectMimplement.class)
.eq(GovBizProjectMimplement::getBaseProjId,projId)
.set(GovBizProjectMimplement::getDeleted,Boolean.TRUE));
procureService.update(Wrappers.lambdaUpdate(GovBizProjectProcure.class)
.eq(GovBizProjectProcure::getBaseProjId,projId)
.set(GovBizProjectProcure::getDeleted,Boolean.TRUE));
return BizConst.OP_SUCCESS;
}

private void checkName(String baseProjName, String baseProjId) {
VUtils.isTrue(baseinfoService.count(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class)
.eq(GovBizProjectBaseinfo::getBaseProjName,baseProjName)
.eq(GovBizProjectBaseinfo::getDeleted,Boolean.FALSE)
.ne(GovBizProjectBaseinfo::getBaseProjId,baseProjId)) > 0L)
.throwMessage("项目名重复");
}
@@ -431,7 +467,7 @@ public class GovProjectCollectionManage {
MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
headers.setContentType(type);
headers.add("Accept", MediaType.APPLICATION_JSON.toString());
HttpEntity<ProjectPushReq> formEntity = new HttpEntity<ProjectPushReq>(req, headers);
HttpEntity<ProjectPushReq> formEntity = new HttpEntity(req, headers);
ResponseEntity<String> response = restTemplate.postForEntity(url, formEntity, String.class);
log.info("推送结果 {} :{}",saveDTO.getBaseProjId(),response);
}catch (Exception e){


+ 9
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectApply.java 查看文件

@@ -140,4 +140,13 @@ public class GovBizProjectApply implements Serializable {

@ApiModelProperty("入库时间")
private LocalDateTime tongTime;

@ApiModelProperty("逻辑删除")
private Boolean deleted;

@ApiModelProperty("最后修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("最后修改人")
private String updateBy;
}

+ 9
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectApprove.java 查看文件

@@ -90,4 +90,13 @@ public class GovBizProjectApprove implements Serializable {

@ApiModelProperty("入库时间")
private LocalDateTime tongTime;

@ApiModelProperty("逻辑删除")
private Boolean deleted;

@ApiModelProperty("最后修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("最后修改人")
private String updateBy;
}

+ 9
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectBaseinfo.java 查看文件

@@ -104,4 +104,13 @@ public class GovBizProjectBaseinfo implements Serializable {

@ApiModelProperty("入库时间")
private LocalDateTime tongTime;

@ApiModelProperty("逻辑删除")
private Boolean deleted;

@ApiModelProperty("最后修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("最后修改人")
private String updateBy;
}

+ 9
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectCimplement.java 查看文件

@@ -106,4 +106,13 @@ public class GovBizProjectCimplement implements Serializable {

@ApiModelProperty("入库时间")
private LocalDateTime tongTime;

@ApiModelProperty("逻辑删除")
private Boolean deleted;

@ApiModelProperty("最后修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("最后修改人")
private String updateBy;
}

+ 9
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectMimplement.java 查看文件

@@ -94,4 +94,13 @@ public class GovBizProjectMimplement implements Serializable {

@ApiModelProperty("入库时间")
private LocalDateTime tongTime;

@ApiModelProperty("逻辑删除")
private Boolean deleted;

@ApiModelProperty("最后修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("最后修改人")
private String updateBy;
}

+ 9
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectProcure.java 查看文件

@@ -95,4 +95,13 @@ public class GovBizProjectProcure implements Serializable {

@ApiModelProperty("入库时间")
private LocalDateTime tongTime;

@ApiModelProperty("逻辑删除")
private Boolean deleted;

@ApiModelProperty("最后修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("最后修改人")
private String updateBy;
}

+ 9
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectApplyVO.java 查看文件

@@ -135,4 +135,13 @@ public class GovBizProjectApplyVO implements Serializable {

@ApiModelProperty("入库时间")
private LocalDateTime tongTime;

@ApiModelProperty("逻辑删除")
private Boolean deleted;

@ApiModelProperty("最后修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("最后修改人")
private String updateBy;
}

+ 9
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectApproveVO.java 查看文件

@@ -85,4 +85,13 @@ public class GovBizProjectApproveVO implements Serializable {

@ApiModelProperty("入库时间")
private LocalDateTime tongTime;

@ApiModelProperty("逻辑删除")
private Boolean deleted;

@ApiModelProperty("最后修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("最后修改人")
private String updateBy;
}

+ 9
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectBaseinfoVO.java 查看文件

@@ -98,4 +98,13 @@ public class GovBizProjectBaseinfoVO implements Serializable {

@ApiModelProperty("入库时间")
private LocalDateTime tongTime;

@ApiModelProperty("逻辑删除")
private Boolean deleted;

@ApiModelProperty("最后修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("最后修改人")
private String updateBy;
}

+ 9
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectCimplementVO.java 查看文件

@@ -101,4 +101,13 @@ public class GovBizProjectCimplementVO implements Serializable {

@ApiModelProperty("入库时间")
private LocalDateTime tongTime;

@ApiModelProperty("逻辑删除")
private Boolean deleted;

@ApiModelProperty("最后修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("最后修改人")
private String updateBy;
}

+ 9
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectMimplementVO.java 查看文件

@@ -89,4 +89,13 @@ public class GovBizProjectMimplementVO implements Serializable {

@ApiModelProperty("入库时间")
private LocalDateTime tongTime;

@ApiModelProperty("逻辑删除")
private Boolean deleted;

@ApiModelProperty("最后修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("最后修改人")
private String updateBy;
}

+ 9
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectProcureVO.java 查看文件

@@ -90,4 +90,13 @@ public class GovBizProjectProcureVO implements Serializable {

@ApiModelProperty("入库时间")
private LocalDateTime tongTime;

@ApiModelProperty("逻辑删除")
private Boolean deleted;

@ApiModelProperty("最后修改时间")
private LocalDateTime updateOn;

@ApiModelProperty("最后修改人")
private String updateBy;
}

正在加载...
取消
保存