相关人员列表
This commit is contained in:
+11
-12
@@ -1,25 +1,24 @@
|
||||
package com.jero.modules.project.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.modules.project.entity.ProjectRelatedPersonnel;
|
||||
import com.jero.modules.project.service.IProjectRelatedPersonnelService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
+5
-4
@@ -1,10 +1,10 @@
|
||||
package com.jero.modules.project.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.jero.modules.project.entity.ProjectRelatedPersonnel;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jero.modules.project.entity.ProjectRelatedPersonnel;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 相关人员维护表
|
||||
@@ -14,4 +14,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
*/
|
||||
public interface ProjectRelatedPersonnelMapper extends BaseMapper<ProjectRelatedPersonnel> {
|
||||
|
||||
IPage<ProjectRelatedPersonnel> queryPageList(IPage page, Map<String, Object> params);
|
||||
}
|
||||
|
||||
+22
@@ -14,4 +14,26 @@
|
||||
<result column="certification_engineer" property="certificationEngineer" />
|
||||
<result column="remark" property="remark" />
|
||||
</resultMap>
|
||||
<select id="queryPageList" resultType="com.jero.modules.project.entity.ProjectRelatedPersonnel">
|
||||
SELECT
|
||||
prp.id,
|
||||
prp.project_id,
|
||||
prp.duty_territory,
|
||||
prp.law_engineer,
|
||||
lawuser.username,
|
||||
enguser.username,
|
||||
prp.engineering_interface_person,
|
||||
prp.certification_engineer,
|
||||
prp.remark,
|
||||
prp.create_user_id,
|
||||
prp.create_time,
|
||||
prp.update_user_id,
|
||||
prp.update_time
|
||||
FROM
|
||||
project_related_personnel AS prp
|
||||
LEFT JOIN sys_user AS lawuser ON prp.law_engineer = lawuser.id
|
||||
LEFT JOIN sys_user AS enguser ON prp.engineering_interface_person = enguser.id
|
||||
|
||||
order by prp.create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
+142
-19
@@ -1,15 +1,23 @@
|
||||
package com.jero.modules.project.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.modules.project.entity.ProjectRelatedPersonnel;
|
||||
import com.jero.modules.project.mapper.ProjectRelatedPersonnelMapper;
|
||||
import com.jero.modules.project.service.IProjectRelatedPersonnelService;
|
||||
import com.jero.modules.system.entity.SysUser;
|
||||
import com.jero.modules.system.mapper.SysUserMapper;
|
||||
import com.jero.modules.system.util.StringUtils;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 项目库-相关人员维护表
|
||||
@@ -19,6 +27,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
*/
|
||||
@Service
|
||||
public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelatedPersonnelMapper, ProjectRelatedPersonnel> implements IProjectRelatedPersonnelService {
|
||||
@Autowired
|
||||
private ProjectRelatedPersonnelMapper projectRelatedPersonnelMapper;
|
||||
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
@@ -27,12 +40,15 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(ProjectRelatedPersonnel projectRelatedPersonnel) {
|
||||
Date now = new Date();
|
||||
projectRelatedPersonnel.setCreateTime(now);
|
||||
projectRelatedPersonnel.setUpdateTime(now);
|
||||
save(projectRelatedPersonnel);
|
||||
}
|
||||
public void add(ProjectRelatedPersonnel projectRelatedPersonnel) {
|
||||
Date now = new Date();
|
||||
projectRelatedPersonnel.setCreateTime(now);
|
||||
projectRelatedPersonnel.setUpdateTime(now);
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
projectRelatedPersonnel.setCreateUserId(sysUser.getId());
|
||||
projectRelatedPersonnel.setUpdateUserId(sysUser.getId());
|
||||
save(projectRelatedPersonnel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
@@ -41,11 +57,13 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void editById(ProjectRelatedPersonnel projectRelatedPersonnel) {
|
||||
Date now = new Date();
|
||||
projectRelatedPersonnel.setUpdateTime(now);
|
||||
saveOrUpdate(projectRelatedPersonnel);
|
||||
}
|
||||
public void editById(ProjectRelatedPersonnel projectRelatedPersonnel) {
|
||||
Date now = new Date();
|
||||
projectRelatedPersonnel.setUpdateTime(now);
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
projectRelatedPersonnel.setUpdateUserId(sysUser.getId());
|
||||
saveOrUpdate(projectRelatedPersonnel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
@@ -86,12 +104,117 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<ProjectRelatedPersonnel> queryList() {
|
||||
return list();
|
||||
}
|
||||
public List<ProjectRelatedPersonnel> queryList() {
|
||||
return list();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage<ProjectRelatedPersonnel> queryPageList(Map<String, Object> params) {
|
||||
return null;
|
||||
Integer pageNo = Integer.parseInt(params.get("pageNo").toString());
|
||||
Integer pageSize = Integer.parseInt(params.get("pageSize").toString());
|
||||
IPage page = new Page(pageNo, pageSize);
|
||||
IPage<ProjectRelatedPersonnel> result = projectRelatedPersonnelMapper.queryPageList(page, params);
|
||||
List<ProjectRelatedPersonnel> records = result.getRecords();
|
||||
disposeData(records);
|
||||
return result;
|
||||
}
|
||||
public void disposeData(List<ProjectRelatedPersonnel> records) {
|
||||
for (ProjectRelatedPersonnel projectRelatedPersonnel:records) {
|
||||
//法规工程师
|
||||
List<SysUser> lawEngineerUsers = new ArrayList<>();
|
||||
List<String> lawEngineerIdList = Arrays.asList(projectRelatedPersonnel.getLawEngineer().split(","));
|
||||
if (CollectionUtils.isNotEmpty(lawEngineerIdList)) {
|
||||
lawEngineerIdList = lawEngineerIdList.stream().distinct().collect(Collectors.toList());
|
||||
QueryWrapper<SysUser> userqueryWrapper = new QueryWrapper<>();
|
||||
userqueryWrapper.in("id ", lawEngineerIdList);
|
||||
lawEngineerUsers = sysUserMapper.selectList(userqueryWrapper);
|
||||
}
|
||||
if(CollectionUtils.isNotEmpty(lawEngineerUsers)) {
|
||||
String lawEngineerId = projectRelatedPersonnel.getLawEngineer();
|
||||
String lawEngineerName = null;
|
||||
String lawEngineerEnName = null;
|
||||
StringBuilder certificationName = new StringBuilder();
|
||||
|
||||
for (String data : lawEngineerIdList) {
|
||||
if (StringUtils.isNotEmpty(lawEngineerId)) {
|
||||
lawEngineerName = lawEngineerUsers.stream().filter(e -> data.equals(e.getId()))
|
||||
.map(sysUser -> sysUser.getRealname()).collect(Collectors.joining(","));
|
||||
lawEngineerEnName = lawEngineerUsers.stream().filter(e -> data.equals(e.getId()))
|
||||
.map(sysUser -> sysUser.getUsername()).collect(Collectors.joining(","));
|
||||
}
|
||||
|
||||
certificationName.append(lawEngineerName).append("(").append(lawEngineerEnName).append(")").append(" ");
|
||||
|
||||
}
|
||||
projectRelatedPersonnel.setLawEngineerName(certificationName.toString());
|
||||
}
|
||||
|
||||
|
||||
//工程接口人
|
||||
List<SysUser> engineeringInterfacePersonUsers = new ArrayList<>();
|
||||
List<String> engineeringInterfacePersonIdList = Arrays.asList(projectRelatedPersonnel.getEngineeringInterfacePerson().split(","));
|
||||
if (CollectionUtils.isNotEmpty(engineeringInterfacePersonIdList)) {
|
||||
engineeringInterfacePersonIdList = engineeringInterfacePersonIdList.stream().distinct().collect(Collectors.toList());
|
||||
QueryWrapper<SysUser> userqueryWrapper = new QueryWrapper<>();
|
||||
userqueryWrapper.in("id ", engineeringInterfacePersonIdList);
|
||||
engineeringInterfacePersonUsers = sysUserMapper.selectList(userqueryWrapper);
|
||||
}
|
||||
if(CollectionUtils.isNotEmpty(engineeringInterfacePersonUsers)) {
|
||||
String engineeringInterfacePersonId = projectRelatedPersonnel.getEngineeringInterfacePerson();
|
||||
String engineeringInterfacePersonName = null;
|
||||
String engineeringInterfacePersonEnName = null;
|
||||
StringBuilder certificationName = new StringBuilder();
|
||||
|
||||
for (String data : engineeringInterfacePersonIdList) {
|
||||
if (StringUtils.isNotEmpty(engineeringInterfacePersonId)) {
|
||||
engineeringInterfacePersonName = engineeringInterfacePersonUsers.stream().filter(e -> data.equals(e.getId()))
|
||||
.map(sysUser -> sysUser.getRealname()).collect(Collectors.joining(","));
|
||||
engineeringInterfacePersonEnName = engineeringInterfacePersonUsers.stream().filter(e -> data.equals(e.getId()))
|
||||
.map(sysUser -> sysUser.getUsername()).collect(Collectors.joining(","));
|
||||
}
|
||||
|
||||
certificationName.append(engineeringInterfacePersonName).append("(").append(engineeringInterfacePersonEnName).append(")").append(" ");
|
||||
|
||||
}
|
||||
projectRelatedPersonnel.setEngineeringInterfacePersonName(certificationName.toString());
|
||||
}
|
||||
|
||||
//认证工程师
|
||||
List<SysUser> certificationEngineerUsers = new ArrayList<>();
|
||||
List<String> certificationEngineerIdList = Arrays.asList(projectRelatedPersonnel.getCertificationEngineer().split(","));
|
||||
if (CollectionUtils.isNotEmpty(certificationEngineerIdList)) {
|
||||
certificationEngineerIdList=certificationEngineerIdList.stream().distinct().collect(Collectors.toList());
|
||||
QueryWrapper<SysUser> userqueryWrapper = new QueryWrapper<>();
|
||||
userqueryWrapper.in("id ", certificationEngineerIdList);
|
||||
certificationEngineerUsers = sysUserMapper.selectList(userqueryWrapper);
|
||||
}
|
||||
if(CollectionUtils.isNotEmpty(certificationEngineerUsers)) {
|
||||
String certificationEngineerId = projectRelatedPersonnel.getCertificationEngineer();
|
||||
String certificationEngineerName=null;
|
||||
String certificationEngineerEnName=null;
|
||||
StringBuilder certificationName=new StringBuilder();
|
||||
|
||||
for (String data:certificationEngineerIdList){
|
||||
if (StringUtils.isNotEmpty(certificationEngineerId)) {
|
||||
certificationEngineerName = certificationEngineerUsers.stream().filter(e -> data.equals(e.getId()))
|
||||
.map(sysUser -> sysUser.getRealname()).collect(Collectors.joining(","));
|
||||
certificationEngineerEnName = certificationEngineerUsers.stream().filter(e -> data.equals(e.getId()))
|
||||
.map(sysUser -> sysUser.getUsername()).collect(Collectors.joining(","));
|
||||
}
|
||||
|
||||
certificationName.append(certificationEngineerName).append("(").append(certificationEngineerEnName).append(")").append(" ");
|
||||
|
||||
}
|
||||
projectRelatedPersonnel.setCertificationEngineerName(certificationName.toString());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user