|
@@ -22,6 +22,10 @@ import com.ningdatech.pmapi.gov.model.vo.*; |
|
|
import com.ningdatech.pmapi.gov.service.*; |
|
|
import com.ningdatech.pmapi.gov.service.*; |
|
|
import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; |
|
|
import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; |
|
|
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; |
|
|
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.RequiredArgsConstructor; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
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) |
|
|
.eq(StringUtils.isNotBlank(req.getRegionCode()),GovBizProjectBaseinfo::getBaseAreaCode,req.getRegionCode() + BizConst.NINE_AREA_CODE_LAST) |
|
|
.gt(Objects.nonNull(req.getCreateOnMin()),GovBizProjectBaseinfo::getTongTime,req.getCreateOnMin()) |
|
|
.gt(Objects.nonNull(req.getCreateOnMin()),GovBizProjectBaseinfo::getTongTime,req.getCreateOnMin()) |
|
|
.le(Objects.nonNull(req.getCreateOnMax()),GovBizProjectBaseinfo::getTongTime,req.getCreateOnMax()) |
|
|
.le(Objects.nonNull(req.getCreateOnMax()),GovBizProjectBaseinfo::getTongTime,req.getCreateOnMax()) |
|
|
|
|
|
.eq(GovBizProjectBaseinfo::getDeleted,Boolean.FALSE) |
|
|
.orderByDesc(GovBizProjectBaseinfo::getBizTime); |
|
|
.orderByDesc(GovBizProjectBaseinfo::getBizTime); |
|
|
|
|
|
permissions(wrapper); |
|
|
baseinfoService.page(page,wrapper); |
|
|
baseinfoService.page(page,wrapper); |
|
|
|
|
|
|
|
|
if(CollUtil.isEmpty(page.getRecords())){ |
|
|
if(CollUtil.isEmpty(page.getRecords())){ |
|
@@ -145,6 +151,25 @@ public class GovProjectCollectionManage { |
|
|
return PageVo.of(res,page.getTotal()); |
|
|
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) { |
|
|
public Long count(ProjectListReq req) { |
|
|
LambdaQueryWrapper<GovBizProjectBaseinfo> wrapper = Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) |
|
|
LambdaQueryWrapper<GovBizProjectBaseinfo> wrapper = Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) |
|
|
.like(StringUtils.isNotBlank(req.getProjectName()),GovBizProjectBaseinfo::getBaseProjName,req.getProjectName()) |
|
|
.like(StringUtils.isNotBlank(req.getProjectName()),GovBizProjectBaseinfo::getBaseProjName,req.getProjectName()) |
|
@@ -231,8 +256,11 @@ public class GovProjectCollectionManage { |
|
|
*/ |
|
|
*/ |
|
|
@Transactional |
|
|
@Transactional |
|
|
public String save(GovBizProjectSaveDTO saveDTO) { |
|
|
public String save(GovBizProjectSaveDTO saveDTO) { |
|
|
|
|
|
UserInfoDetails user = LoginUserUtil.loginUserDetail(); |
|
|
|
|
|
|
|
|
GovBizProjectBaseinfoDTO base = saveDTO.getBaseinfo(); |
|
|
GovBizProjectBaseinfoDTO base = saveDTO.getBaseinfo(); |
|
|
String baseProjId = base.getBaseProjId(); |
|
|
String baseProjId = base.getBaseProjId(); |
|
|
|
|
|
String baseAreaCode = user.getRegionCode() + BizConst.NINE_AREA_CODE_LAST; |
|
|
String baseProjName = base.getBaseProjName(); |
|
|
String baseProjName = base.getBaseProjName(); |
|
|
//如果是新增的话 要生成 项目编号 |
|
|
//如果是新增的话 要生成 项目编号 |
|
|
if(StringUtils.isBlank(baseProjId)){ |
|
|
if(StringUtils.isBlank(baseProjId)){ |
|
@@ -258,6 +286,7 @@ public class GovProjectCollectionManage { |
|
|
saveBase.setId(oldBaseInfo.getId()); |
|
|
saveBase.setId(oldBaseInfo.getId()); |
|
|
}else{ |
|
|
}else{ |
|
|
saveBase.setTongTime(LocalDateTime.now()); |
|
|
saveBase.setTongTime(LocalDateTime.now()); |
|
|
|
|
|
saveBase.setBaseAreaCode(baseAreaCode); |
|
|
} |
|
|
} |
|
|
if(Objects.nonNull(saveBase.getBaseAreaCode())){ |
|
|
if(Objects.nonNull(saveBase.getBaseAreaCode())){ |
|
|
saveBase.setBaseAreaCode(saveBase.getBaseAreaCode() + BizConst.NINE_AREA_CODE_LAST); |
|
|
saveBase.setBaseAreaCode(saveBase.getBaseAreaCode() + BizConst.NINE_AREA_CODE_LAST); |
|
@@ -396,24 +425,31 @@ public class GovProjectCollectionManage { |
|
|
|
|
|
|
|
|
VUtils.isTrue(Objects.isNull(baseinfo)).throwMessage("项目不存在!"); |
|
|
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; |
|
|
return BizConst.OP_SUCCESS; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void checkName(String baseProjName, String baseProjId) { |
|
|
private void checkName(String baseProjName, String baseProjId) { |
|
|
VUtils.isTrue(baseinfoService.count(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) |
|
|
VUtils.isTrue(baseinfoService.count(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) |
|
|
.eq(GovBizProjectBaseinfo::getBaseProjName,baseProjName) |
|
|
.eq(GovBizProjectBaseinfo::getBaseProjName,baseProjName) |
|
|
|
|
|
.eq(GovBizProjectBaseinfo::getDeleted,Boolean.FALSE) |
|
|
.ne(GovBizProjectBaseinfo::getBaseProjId,baseProjId)) > 0L) |
|
|
.ne(GovBizProjectBaseinfo::getBaseProjId,baseProjId)) > 0L) |
|
|
.throwMessage("项目名重复"); |
|
|
.throwMessage("项目名重复"); |
|
|
} |
|
|
} |
|
@@ -431,7 +467,7 @@ public class GovProjectCollectionManage { |
|
|
MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); |
|
|
MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8"); |
|
|
headers.setContentType(type); |
|
|
headers.setContentType(type); |
|
|
headers.add("Accept", MediaType.APPLICATION_JSON.toString()); |
|
|
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); |
|
|
ResponseEntity<String> response = restTemplate.postForEntity(url, formEntity, String.class); |
|
|
log.info("推送结果 {} :{}",saveDTO.getBaseProjId(),response); |
|
|
log.info("推送结果 {} :{}",saveDTO.getBaseProjId(),response); |
|
|
}catch (Exception e){ |
|
|
}catch (Exception e){ |
|
|