person
parent
7962d4daa6
commit
91b53ec045
|
|
@ -6,6 +6,7 @@ import io.swagger.annotations.ApiParam;
|
|||
import org.qinan.safetyeval.client.api.OrgPersonnelApi;
|
||||
import org.qinan.safetyeval.client.co.OrgPersonnelCO;
|
||||
import org.qinan.safetyeval.client.co.OrgPersonnelImportResultCO;
|
||||
import org.qinan.safetyeval.client.co.QualFilingPersonnelInfoCO;
|
||||
import org.qinan.safetyeval.client.dto.*;
|
||||
import org.qinan.safetyeval.infrastructure.dataobject.base.Req;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
|
@ -57,6 +58,12 @@ public class OrgPersonnelController {
|
|||
return orgPersonnelApi.page(query);
|
||||
}
|
||||
|
||||
@ApiOperation("资质备案人员分页查询")
|
||||
@GetMapping("/filing/page")
|
||||
public PageResponse<QualFilingPersonnelInfoCO> filingPage(@Validated OrgFilingPersonnelPageQuery query) {
|
||||
return orgPersonnelApi.filingPage(query);
|
||||
}
|
||||
|
||||
@ApiOperation("重置人员密码")
|
||||
@PostMapping("/reset-password")
|
||||
public SingleResponse<Void> resetPassword(@ApiParam("主键ID") @RequestBody Req<Long> req) {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package org.qinan.safetyeval.app.executor;
|
|||
import com.jjb.saas.system.client.user.request.UserAddCmd;
|
||||
import com.jjb.saas.system.client.user.request.UserRoleUpdateCmd;
|
||||
import com.jjb.saas.system.client.user.request.UserUpdatePasswordCmd;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zcloud.gbscommon.utils.MD5;
|
||||
import com.zcloud.gbscommon.utils.Sm2Util;
|
||||
import org.qinan.safetyeval.app.convertor.OrgPersonnelConvertor;
|
||||
|
|
@ -12,6 +14,8 @@ import org.qinan.safetyeval.app.support.OrgPersonnelViewEnricher;
|
|||
import org.qinan.safetyeval.client.api.OrgPersonnelApi;
|
||||
import org.qinan.safetyeval.client.co.OrgPersonnelCO;
|
||||
import org.qinan.safetyeval.client.co.OrgPersonnelImportResultCO;
|
||||
import org.qinan.safetyeval.client.co.PersonnelProfessionalCapabilityCO;
|
||||
import org.qinan.safetyeval.client.co.QualFilingPersonnelInfoCO;
|
||||
import org.qinan.safetyeval.client.dto.*;
|
||||
import org.qinan.safetyeval.domain.entity.OrgPersonnelEntity;
|
||||
import org.qinan.safetyeval.domain.entity.OrgPositionEntity;
|
||||
|
|
@ -26,7 +30,10 @@ import org.qinan.safetyeval.domain.service.OrgPositionDomainService;
|
|||
import org.qinan.safetyeval.infrastructure.adapter.ThreadLocalUserInfoAdapter;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.gbs.GbsUserFacadeClient;
|
||||
import org.qinan.safetyeval.infrastructure.mapper.OrgPersonnelMapper;
|
||||
import org.qinan.safetyeval.infrastructure.mapper.QualFilingPersonnelCertMapper;
|
||||
import org.qinan.safetyeval.infrastructure.support.UserOrgIdResolver;
|
||||
import org.qinan.safetyeval.infrastructure.utils.CommonUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -34,13 +41,13 @@ import org.springframework.beans.factory.annotation.Value;
|
|||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 人员信息执行器(App层)
|
||||
|
|
@ -82,6 +89,11 @@ public class OrgPersonnelExecutor implements OrgPersonnelApi {
|
|||
@Autowired(required = false)
|
||||
private UserOrgIdResolver userOrgIdResolver;
|
||||
|
||||
@Autowired
|
||||
private OrgPersonnelMapper orgPersonnelMapper;
|
||||
@Autowired
|
||||
private QualFilingPersonnelCertMapper qualFilingPersonnelCertMapper;
|
||||
|
||||
@Value("${def.password:a123456}")
|
||||
private String defPassword;
|
||||
@Value("${def.publicKey:0402df2195296d4062ac85ad766994d73e871b887e18efb9a9a06b4cebc72372869b7da6c347c129dee2b46a0f279ff066b01c76208c2a052af75977c722a2ccee}")
|
||||
|
|
@ -213,6 +225,50 @@ public class OrgPersonnelExecutor implements OrgPersonnelApi {
|
|||
return PageResponse.of(records, pageResult.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResponse<QualFilingPersonnelInfoCO> filingPage(OrgFilingPersonnelPageQuery query) {
|
||||
query.setOrgId(ThreadLocalUserInfoAdapter.getOrgId());
|
||||
// 直连 infrastructure 层 Mapper,跳过 domain,由 XML 直接返回 CO,无需转换
|
||||
Page<QualFilingPersonnelInfoCO> page = new Page<>(query.getCurrent(), query.getSize());
|
||||
IPage<QualFilingPersonnelInfoCO> result = orgPersonnelMapper.filingPage(page, query);
|
||||
List<QualFilingPersonnelInfoCO> records = result.getRecords();
|
||||
setProfessionalCapabilityCodeList(records);
|
||||
return PageResponse.of(records, result.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量设置人员专业能力证书类型编码列表
|
||||
*
|
||||
* @param personnelList personnelList
|
||||
*/
|
||||
private void setProfessionalCapabilityCodeList(List<QualFilingPersonnelInfoCO> personnelList) {
|
||||
if (CollectionUtils.isEmpty(personnelList)) {
|
||||
return;
|
||||
}
|
||||
List<Long> personnelIdList = personnelList.stream()
|
||||
.map(QualFilingPersonnelInfoCO::getSourcePersonnelId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(personnelIdList)) {
|
||||
return;
|
||||
}
|
||||
List<PersonnelProfessionalCapabilityCO> capabilityList =
|
||||
qualFilingPersonnelCertMapper.getProfessionalCapabilityCodeList(personnelIdList);
|
||||
Map<Long, List<String>> capabilityMap = capabilityList.stream()
|
||||
.filter(item -> StringUtils.hasText(item.getProfessionalCapabilityCodeList()))
|
||||
.collect(Collectors.toMap(
|
||||
PersonnelProfessionalCapabilityCO::getPersonnelId,
|
||||
item -> Arrays.asList(item.getProfessionalCapabilityCodeList()
|
||||
.split(CommonUtil.COMMA)),
|
||||
(a, b) -> a));
|
||||
for (QualFilingPersonnelInfoCO personnel : personnelList) {
|
||||
List<String> codes = capabilityMap.get(personnel.getSourcePersonnelId());
|
||||
if (codes != null) {
|
||||
personnel.setProfessionalCapabilityCodeList(codes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void syncGbsUser(String action, Runnable runnable) {
|
||||
try {
|
||||
runnable.run();
|
||||
|
|
|
|||
|
|
@ -2,13 +2,8 @@ package org.qinan.safetyeval.client.api;
|
|||
|
||||
import org.qinan.safetyeval.client.co.OrgPersonnelCO;
|
||||
import org.qinan.safetyeval.client.co.OrgPersonnelImportResultCO;
|
||||
import org.qinan.safetyeval.client.dto.PageResponse;
|
||||
import org.qinan.safetyeval.client.dto.SingleResponse;
|
||||
import org.qinan.safetyeval.client.dto.OrgPersonnelAddCmd;
|
||||
import org.qinan.safetyeval.client.dto.OrgPersonnelCompareFaceCmd;
|
||||
import org.qinan.safetyeval.client.dto.OrgPersonnelModifyCmd;
|
||||
import org.qinan.safetyeval.client.dto.OrgPersonnelPageQuery;
|
||||
import org.qinan.safetyeval.client.dto.OrgPersonnelUpdateOriginFaceCmd;
|
||||
import org.qinan.safetyeval.client.co.QualFilingPersonnelInfoCO;
|
||||
import org.qinan.safetyeval.client.dto.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -30,6 +25,8 @@ public interface OrgPersonnelApi {
|
|||
|
||||
PageResponse<OrgPersonnelCO> page(OrgPersonnelPageQuery query);
|
||||
|
||||
PageResponse<QualFilingPersonnelInfoCO> filingPage(OrgFilingPersonnelPageQuery query);
|
||||
|
||||
SingleResponse<Void> resetPassword(Long id);
|
||||
|
||||
SingleResponse<OrgPersonnelCO> updateOriginFace(OrgPersonnelUpdateOriginFaceCmd cmd);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package org.qinan.safetyeval.client.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 资质备案人员分页查询参数
|
||||
*
|
||||
* @author safety-eval
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class OrgFilingPersonnelPageQuery extends BasePageQuery {
|
||||
|
||||
@ApiModelProperty(value = "单位id")
|
||||
private Long orgId;
|
||||
|
||||
@ApiModelProperty(value = "人员姓名")
|
||||
private String personName;
|
||||
}
|
||||
|
|
@ -1,9 +1,13 @@
|
|||
package org.qinan.safetyeval.infrastructure.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.qinan.safetyeval.client.co.IndustryProfessionalPersonCo;
|
||||
import org.qinan.safetyeval.client.co.QualFilingPersonnelInfoCO;
|
||||
import org.qinan.safetyeval.client.dto.OrgFilingPersonnelPageQuery;
|
||||
import org.qinan.safetyeval.infrastructure.dataobject.OrgPersonnelDO;
|
||||
import org.qinan.safetyeval.infrastructure.persistence.domainobject.OrgPersonnelLeaderCountDO;
|
||||
|
||||
|
|
@ -27,4 +31,14 @@ public interface OrgPersonnelMapper extends BaseMapper<OrgPersonnelDO> {
|
|||
* @return 人员专业能力信息列表
|
||||
*/
|
||||
List<IndustryProfessionalPersonCo> selectProfessionalCapabilityByPersonnelIds(@Param("ids") List<Long> ids);
|
||||
|
||||
/**
|
||||
* 资质备案人员分页查询,由 XML 直接返回 CO,无需转换。
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param query 查询条件
|
||||
* @return 备案人员信息分页结果
|
||||
*/
|
||||
IPage<QualFilingPersonnelInfoCO> filingPage(Page<QualFilingPersonnelInfoCO> page,
|
||||
@Param("query") OrgFilingPersonnelPageQuery query);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,4 +68,21 @@
|
|||
</foreach>
|
||||
</select>
|
||||
|
||||
<!-- 资质备案人员分页查询,直接返回 CO -->
|
||||
<select id="filingPage" resultType="org.qinan.safetyeval.client.co.QualFilingPersonnelInfoCO">
|
||||
SELECT p.id source_personnel_id, p.id, p.user_name personName, po.position_name, p.post_id, p.gender_code, p.gender_name
|
||||
, p.birth_date, p.register_engineer_flag, p.evaluator_cert_no
|
||||
FROM org_personnel p
|
||||
left join org_department d on p.dept_id = d.id and d.delete_enum = 'false'
|
||||
left join org_position po on po.id = p.post_id and po.delete_enum = 'false'
|
||||
<where>
|
||||
p.delete_enum = 'false'
|
||||
AND p.org_id = #{query.orgId}
|
||||
<if test="query.personName != null and query.personName != ''">
|
||||
AND p.user_name LIKE CONCAT('%', #{query.personName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY p.id DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue