关联项目

This commit is contained in:
lcj
2025-12-11 08:52:58 +08:00
parent 2b3c86e763
commit e49ab63a0b
4 changed files with 127 additions and 83 deletions

View File

@ -6,6 +6,8 @@ import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import org.dromara.common.translation.annotation.Translation;
import org.dromara.common.translation.constant.TransConstant;
import org.dromara.project.domain.BusProject;
import org.dromara.project.domain.bo.Punchrange;
import org.dromara.system.domain.vo.SysRoleVo;
@ -92,6 +94,12 @@ public class BusProjectVo implements Serializable {
@ExcelDictFormat(dictType = "project_type")
private String projectType;
/**
* 项目类型名称
*/
@Translation(type = TransConstant.DICT_TYPE_TO_LABEL, mapper = "projectType", other = "project_type")
private String projectTypeName;
/**
* 项目阶段
*/
@ -99,6 +107,12 @@ public class BusProjectVo implements Serializable {
@ExcelDictFormat(dictType = "project_stage")
private String projectStage;
/**
* 项目类型名称
*/
@Translation(type = TransConstant.DICT_TYPE_TO_LABEL, mapper = "projectType", other = "project_stage")
private String projectStageName;
/**
* 项目地址
*/
@ -218,6 +232,17 @@ public class BusProjectVo implements Serializable {
*/
private List<Long> deptIds;
/**
* 部门列表
*/
private String deptStr;
/**
* 部门名称列表
*/
@Translation(type = TransConstant.DEPT_ID_TO_NAME, mapper = "deptStr")
private String deptNames;
/**
* 某个用户在此项目下的所有角色
*/

View File

@ -4,7 +4,6 @@ import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.PhoneUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -644,7 +643,7 @@ public class BusProjectServiceImpl extends ServiceImpl<BusProjectMapper, BusProj
String projectName = entity.getProjectName();
String principalPhone = entity.getPrincipalPhone();
// 新增项目参数验证
if (create) {
/* if (create) {
if (StringUtils.isBlank(projectName)) {
throw new ServiceException("项目名称不能为空", HttpStatus.BAD_REQUEST);
}
@ -654,7 +653,7 @@ public class BusProjectServiceImpl extends ServiceImpl<BusProjectMapper, BusProj
}
if (StringUtils.isNotBlank(principalPhone) && !PhoneUtil.isPhone(principalPhone)) {
throw new ServiceException("负责人手机号格式不正确", HttpStatus.BAD_REQUEST);
}
}*/
}
/**
@ -741,7 +740,12 @@ public class BusProjectServiceImpl extends ServiceImpl<BusProjectMapper, BusProj
List<BusProjectDept> deptList = projectDeptService.lambdaQuery()
.eq(BusProjectDept::getProjectId, project.getId())
.list();
projectVo.setDeptIds(deptList.stream().map(BusProjectDept::getDeptId).toList());
List<Long> deptIds = deptList.stream().map(BusProjectDept::getDeptId).toList();
projectVo.setDeptIds(deptIds);
if (CollUtil.isNotEmpty(deptIds)) {
String deptStr = deptIds.stream().map(String::valueOf).collect(Collectors.joining(","));
projectVo.setDeptStr(deptStr);
}
return projectVo;
}

View File

@ -17,6 +17,8 @@ import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.web.core.BaseController;
import org.dromara.project.domain.vo.project.BusProjectVo;
import org.dromara.project.service.IBusProjectService;
import org.dromara.xzd.domain.bo.XzdProjectBo;
import org.dromara.xzd.domain.bo.XzdProjectManagerApprovalBo;
import org.dromara.xzd.domain.bo.XzdProjectTypeBo;
@ -43,6 +45,7 @@ import java.util.List;
@RequestMapping("/xzd/project")
public class XzdProjectController extends BaseController {
private final IBusProjectService projectService;
private final IXzdProjectService xzdProjectService;
private final IXzdProjectTypeService xzdProjectTypeService;
private final IXzdProjectManagerApprovalService xzdProjectManagerApprovalService;
@ -75,7 +78,7 @@ public class XzdProjectController extends BaseController {
// @SaCheckPermission("xzd:project:query")
@GetMapping("/{id}")
public R<XzdProjectVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
@PathVariable Long id) {
return R.ok(xzdProjectService.queryById(id));
}
@ -152,5 +155,16 @@ public class XzdProjectController extends BaseController {
return xzdProjectManagerApprovalService.queryPageList(bo, pageQuery);
}
/**
* 获取项目详细信息
*
* @param sysProjectId 主键
*/
@SaCheckPermission("xzd:project:list")
@GetMapping("/sysProject/{sysProjectId}")
public R<BusProjectVo> getSysProjectInfo(@NotNull(message = "主键不能为空")
@PathVariable Long sysProjectId) {
return R.ok(projectService.queryById(sysProjectId));
}
}

View File

@ -6,45 +6,46 @@
<select id="search" resultType="org.dromara.xzd.domain.vo.XzdProjectVo">
SELECT
project.id,
project.city_code as cityCode,
project.shzt as shzt,
# profile.parent_project_id as fjxm,
(SELECT project_name FROM xzd_project WHERE id = profile.parent_project_id) as fjxm,
project.project_attribute as projectAttribute,
project.project_number as projectNumber,
project.project_name as projectName,
project.file_id as fileId,
project.filing_manager as filingManager,
project.manager_execution as managerExecution,
project.manager_responsible as managerResponsible,
project.audit_status as auditStatus,
project.project_abbreviation as projectAbbreviation,
project.project_status as projectStatus,
type.type_name as projectTypeName,
profile.contract_amount as targetContractAmount,
project.planned_start_date as plannedStartDate,
project.planned_completion_date as plannedCompletionDate,
project.actual_start_date as actualStartDate,
project.actual_completion_date as actualCompletionDate,
approval1.prospective_manager_name as filingManagerName,
approval2.prospective_manager_name as managerExecutionName,
profile.project_address as xmdz,
project.management_organization as managementOrganization,
dept.dept_name as managementOrganizationName,
project.construction_unit as constructionUnit,
profile.country as gj,
profile.province as sheng,
profile.city as cs,
user2.nick_name as managerResponsibleName,
user3.nick_name as lrr,
project.create_time as createTime,
project.project_amount as projectAmount,
profile.height as gd,
project.contracting_method as contractingMethod,
project.manager_execution_phone as managerExecutionPhone,
project.gov_filing_project_name as govFilingProjectName,
project.business_model as businessModel
project.id,
project.city_code as cityCode,
project.shzt as shzt,
project.sys_project_id as sysProjectId,
# profile.parent_project_id as fjxm,
(SELECT project_name FROM xzd_project WHERE id = profile.parent_project_id) as fjxm,
project.project_attribute as projectAttribute,
project.project_number as projectNumber,
project.project_name as projectName,
project.file_id as fileId,
project.filing_manager as filingManager,
project.manager_execution as managerExecution,
project.manager_responsible as managerResponsible,
project.audit_status as auditStatus,
project.project_abbreviation as projectAbbreviation,
project.project_status as projectStatus,
type.type_name as projectTypeName,
profile.contract_amount as targetContractAmount,
project.planned_start_date as plannedStartDate,
project.planned_completion_date as plannedCompletionDate,
project.actual_start_date as actualStartDate,
project.actual_completion_date as actualCompletionDate,
approval1.prospective_manager_name as filingManagerName,
approval2.prospective_manager_name as managerExecutionName,
profile.project_address as xmdz,
project.management_organization as managementOrganization,
dept.dept_name as managementOrganizationName,
project.construction_unit as constructionUnit,
profile.country as gj,
profile.province as sheng,
profile.city as cs,
user2.nick_name as managerResponsibleName,
user3.nick_name as lrr,
project.create_time as createTime,
project.project_amount as projectAmount,
profile.height as gd,
project.contracting_method as contractingMethod,
project.manager_execution_phone as managerExecutionPhone,
project.gov_filing_project_name as govFilingProjectName,
project.business_model as businessModel
FROM xzd_project as project
@ -58,57 +59,57 @@
<where>
<if test='ssgs != null and projectAttribute != ""'>
AND project.ssgs = #{ssgs}
</if>
<if test='ssgs != null and projectAttribute != ""'>
AND project.ssgs = #{ssgs}
</if>
<if test='projectNumber != null and projectNumber != ""'>
AND project.project_number LIKE CONCAT('%',#{projectNumber},'%')
</if>
<if test='projectNumber != null and projectNumber != ""'>
AND project.project_number LIKE CONCAT('%',#{projectNumber},'%')
</if>
<if test="cityCode != null and cityCode != ''">
AND project.city_code = #{cityCode}
</if>
<if test="cityCode != null and cityCode != ''">
AND project.city_code = #{cityCode}
</if>
<if test='projectName != null and projectName != ""'>
AND project.project_name LIKE CONCAT('%',#{projectName},'%')
</if>
<if test='projectName != null and projectName != ""'>
AND project.project_name LIKE CONCAT('%',#{projectName},'%')
</if>
<if test='managementOrganization != null and managementOrganization != ""'>
AND project.management_organization = #{managementOrganization}
</if>
<if test='managementOrganization != null and managementOrganization != ""'>
AND project.management_organization = #{managementOrganization}
</if>
<if test='constructionUnit != null and constructionUnit != ""'>
AND project.construction_unit = #{constructionUnit}
</if>
<if test='constructionUnit != null and constructionUnit != ""'>
AND project.construction_unit = #{constructionUnit}
</if>
<if test='gj != null and gj != ""'>
AND profile.country = #{gj}
</if>
<if test='gj != null and gj != ""'>
AND profile.country = #{gj}
</if>
<if test='sheng != null and sheng != ""'>
AND profile.province = #{sheng}
</if>
<if test='sheng != null and sheng != ""'>
AND profile.province = #{sheng}
</if>
<if test='cs != null and cs != ""'>
AND profile.city = #{cs}
</if>
<if test='cs != null and cs != ""'>
AND profile.city = #{cs}
</if>
<if test='qx != null and qx != ""'>
AND profile.district = #{qx}
</if>
<if test='qx != null and qx != ""'>
AND profile.district = #{qx}
</if>
<if test='xmbajl != null and xmbajl != ""'>
AND approval1.id = #{xmbajl}
</if>
<if test='xmbajl != null and xmbajl != ""'>
AND approval1.id = #{xmbajl}
</if>
<if test='selfId != null and selfId != ""'>
AND project.id != #{selfId}
</if>
<if test='selfId != null and selfId != ""'>
AND project.id != #{selfId}
</if>
<if test='constructionUnit != null and constructionUnit != ""'>
AND project.construction_unit = #{constructionUnit}
</if>
<if test='constructionUnit != null and constructionUnit != ""'>
AND project.construction_unit = #{constructionUnit}
</if>
</where>