bug修护
parent
824d6fd9f0
commit
a837b298f3
|
|
@ -40,8 +40,8 @@ public class OrgDepartmentController {
|
||||||
|
|
||||||
@ApiOperation("查询部门详情")
|
@ApiOperation("查询部门详情")
|
||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
public SingleResponse<OrgDepartmentCO> get(@ApiParam("主键ID") @RequestParam Long id) {
|
public SingleResponse<OrgDepartmentCO> get(@ApiParam("主键ID") @RequestParam String id) {
|
||||||
return orgDepartmentApi.get(id);
|
return orgDepartmentApi.get(Long.parseLong(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("修改部门")
|
@ApiOperation("修改部门")
|
||||||
|
|
@ -52,8 +52,8 @@ public class OrgDepartmentController {
|
||||||
|
|
||||||
@ApiOperation("删除部门")
|
@ApiOperation("删除部门")
|
||||||
@PostMapping("/delete")
|
@PostMapping("/delete")
|
||||||
public SingleResponse<Void> delete(@ApiParam("主键ID") @RequestParam Long id) {
|
public SingleResponse<Void> delete(@ApiParam("主键ID") @RequestParam String id) {
|
||||||
return orgDepartmentApi.delete(id);
|
return orgDepartmentApi.delete(Long.parseLong(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("分页查询部门")
|
@ApiOperation("分页查询部门")
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,8 @@ public class OrgDepartmentExecutor implements OrgDepartmentApi {
|
||||||
@Override
|
@Override
|
||||||
public SingleResponse<OrgDepartmentCO> modify(OrgDepartmentModifyCmd cmd) {
|
public SingleResponse<OrgDepartmentCO> modify(OrgDepartmentModifyCmd cmd) {
|
||||||
OrgDepartmentEntity entity = new OrgDepartmentEntity();
|
OrgDepartmentEntity entity = new OrgDepartmentEntity();
|
||||||
entity.setId(cmd.getId());
|
entity.setId(cmd.getId() != null ? Long.parseLong(cmd.getId()) : null);
|
||||||
entity.setParentId(cmd.getParentId());
|
entity.setParentId(cmd.getParentId() != null ? Long.parseLong(cmd.getParentId()) : null);
|
||||||
entity.setDeptName(cmd.getDeptName());
|
entity.setDeptName(cmd.getDeptName());
|
||||||
entity.setManagerName(cmd.getManagerName());
|
entity.setManagerName(cmd.getManagerName());
|
||||||
entity.setManagerAccount(cmd.getManagerAccount());
|
entity.setManagerAccount(cmd.getManagerAccount());
|
||||||
|
|
@ -93,14 +93,14 @@ public class OrgDepartmentExecutor implements OrgDepartmentApi {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
OrgDepartmentCO co = new OrgDepartmentCO();
|
OrgDepartmentCO co = new OrgDepartmentCO();
|
||||||
co.setId(entity.getId());
|
co.setId(entity.getId() != null ? String.valueOf(entity.getId()) : null);
|
||||||
co.setParentId(entity.getParentId());
|
co.setParentId(entity.getParentId() != null ? String.valueOf(entity.getParentId()) : null);
|
||||||
co.setDeptName(entity.getDeptName());
|
co.setDeptName(entity.getDeptName());
|
||||||
co.setManagerName(entity.getManagerName());
|
co.setManagerName(entity.getManagerName());
|
||||||
co.setManagerAccount(entity.getManagerAccount());
|
co.setManagerAccount(entity.getManagerAccount());
|
||||||
co.setDeptLevelCode(entity.getDeptLevelCode());
|
co.setDeptLevelCode(entity.getDeptLevelCode());
|
||||||
co.setDeptLevelName(entity.getDeptLevelName());
|
co.setDeptLevelName(entity.getDeptLevelName());
|
||||||
co.setTenantId(entity.getTenantId());
|
co.setTenantId(entity.getTenantId() != null ? String.valueOf(entity.getTenantId()) : null);
|
||||||
return co;
|
return co;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,9 @@ public class OrgPersonnelCertExecutor implements OrgPersonnelCertApi {
|
||||||
domainQuery.setPersonnelId(query.getPersonnelId());
|
domainQuery.setPersonnelId(query.getPersonnelId());
|
||||||
domainQuery.setCertName(query.getCertName());
|
domainQuery.setCertName(query.getCertName());
|
||||||
domainQuery.setCertTypeCode(query.getCertTypeCode());
|
domainQuery.setCertTypeCode(query.getCertTypeCode());
|
||||||
|
domainQuery.setCertNo(query.getCertNo());
|
||||||
|
domainQuery.setCertCategoryName(query.getCertCategoryName());
|
||||||
|
domainQuery.setOperationCategoryName(query.getOperationCategoryName());
|
||||||
|
|
||||||
PageResult<OrgPersonnelCertEntity> pageResult = orgPersonnelCertDomainService.page(domainQuery);
|
PageResult<OrgPersonnelCertEntity> pageResult = orgPersonnelCertDomainService.page(domainQuery);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,10 @@ import lombok.Data;
|
||||||
public class OrgDepartmentCO {
|
public class OrgDepartmentCO {
|
||||||
|
|
||||||
@ApiModelProperty(value = "主键ID")
|
@ApiModelProperty(value = "主键ID")
|
||||||
private Long id;
|
private String id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "父部门ID")
|
@ApiModelProperty(value = "父部门ID")
|
||||||
private Long parentId;
|
private String parentId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "部门名称")
|
@ApiModelProperty(value = "部门名称")
|
||||||
private String deptName;
|
private String deptName;
|
||||||
|
|
@ -33,5 +33,5 @@ public class OrgDepartmentCO {
|
||||||
private String deptLevelName;
|
private String deptLevelName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "租户ID")
|
@ApiModelProperty(value = "租户ID")
|
||||||
private Long tenantId;
|
private String tenantId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,10 @@ import lombok.Data;
|
||||||
public class OrgDepartmentModifyCmd {
|
public class OrgDepartmentModifyCmd {
|
||||||
|
|
||||||
@ApiModelProperty(value = "主键ID")
|
@ApiModelProperty(value = "主键ID")
|
||||||
private Long id;
|
private String id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "上级部门id,0为根")
|
@ApiModelProperty(value = "上级部门id,0为根")
|
||||||
private Long parentId;
|
private String parentId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "部门名称")
|
@ApiModelProperty(value = "部门名称")
|
||||||
private String deptName;
|
private String deptName;
|
||||||
|
|
|
||||||
|
|
@ -24,4 +24,13 @@ public class OrgPersonnelCertPageQuery extends BasePageQuery {
|
||||||
|
|
||||||
@ApiModelProperty(value = "证书类型编码")
|
@ApiModelProperty(value = "证书类型编码")
|
||||||
private Long certTypeCode;
|
private Long certTypeCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "证书编号")
|
||||||
|
private String certNo;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "证书类别名称")
|
||||||
|
private String certCategoryName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "证书作业类别名称")
|
||||||
|
private String operationCategoryName;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -116,4 +116,7 @@ public class OrgPersonnelEntity {
|
||||||
|
|
||||||
/** 租户ID */
|
/** 租户ID */
|
||||||
private Long tenantId;
|
private Long tenantId;
|
||||||
|
|
||||||
|
/** 删除标识(false 未删除 / true 已删除) */
|
||||||
|
private String deleteEnum;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,10 @@ public interface OrgPersonnelGateway {
|
||||||
|
|
||||||
OrgPersonnelEntity getByAccount(String account);
|
OrgPersonnelEntity getByAccount(String account);
|
||||||
|
|
||||||
|
OrgPersonnelEntity findAnyByAccount(String account);
|
||||||
|
|
||||||
|
OrgPersonnelEntity restore(OrgPersonnelEntity entity);
|
||||||
|
|
||||||
OrgPersonnelEntity findByUserName(String userName);
|
OrgPersonnelEntity findByUserName(String userName);
|
||||||
|
|
||||||
OrgPersonnelEntity modify(OrgPersonnelEntity entity);
|
OrgPersonnelEntity modify(OrgPersonnelEntity entity);
|
||||||
|
|
|
||||||
|
|
@ -30,4 +30,13 @@ public class OrgPersonnelCertQuery {
|
||||||
|
|
||||||
/** 证书类型 */
|
/** 证书类型 */
|
||||||
private Long certTypeCode;
|
private Long certTypeCode;
|
||||||
|
|
||||||
|
/** 证书编号 */
|
||||||
|
private String certNo;
|
||||||
|
|
||||||
|
/** 证书类别名称 */
|
||||||
|
private String certCategoryName;
|
||||||
|
|
||||||
|
/** 证书作业类别名称 */
|
||||||
|
private String operationCategoryName;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,14 @@ public class OrgPersonnelDomainService {
|
||||||
private OrgPersonnelGateway orgPersonnelGateway;
|
private OrgPersonnelGateway orgPersonnelGateway;
|
||||||
|
|
||||||
public OrgPersonnelEntity add(OrgPersonnelEntity entity) {
|
public OrgPersonnelEntity add(OrgPersonnelEntity entity) {
|
||||||
assertAccountUnique(entity.getAccount(), null);
|
applyEmploymentDefault(entity);
|
||||||
if (entity.getEmploymentStatusCode() == null) {
|
OrgPersonnelEntity existing = orgPersonnelGateway.findAnyByAccount(entity.getAccount());
|
||||||
entity.setEmploymentStatusCode(1);
|
if (existing != null) {
|
||||||
entity.setEmploymentStatusName("在职");
|
if (!isSoftDeleted(existing)) {
|
||||||
|
throw new BizException(ErrorCode.ORG_PERSONNEL_ACCOUNT_EXISTS);
|
||||||
|
}
|
||||||
|
entity.setId(existing.getId());
|
||||||
|
return orgPersonnelGateway.restore(entity);
|
||||||
}
|
}
|
||||||
return orgPersonnelGateway.save(entity);
|
return orgPersonnelGateway.save(entity);
|
||||||
}
|
}
|
||||||
|
|
@ -144,9 +148,21 @@ public class OrgPersonnelDomainService {
|
||||||
if (!StringUtils.hasText(account)) {
|
if (!StringUtils.hasText(account)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
OrgPersonnelEntity found = orgPersonnelGateway.getByAccount(account);
|
OrgPersonnelEntity found = orgPersonnelGateway.findAnyByAccount(account);
|
||||||
if (found != null && (excludeId == null || !found.getId().equals(excludeId))) {
|
if (found != null && !isSoftDeleted(found)
|
||||||
|
&& (excludeId == null || !found.getId().equals(excludeId))) {
|
||||||
throw new BizException(ErrorCode.ORG_PERSONNEL_ACCOUNT_EXISTS);
|
throw new BizException(ErrorCode.ORG_PERSONNEL_ACCOUNT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void applyEmploymentDefault(OrgPersonnelEntity entity) {
|
||||||
|
if (entity.getEmploymentStatusCode() == null) {
|
||||||
|
entity.setEmploymentStatusCode(1);
|
||||||
|
entity.setEmploymentStatusName("在职");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isSoftDeleted(OrgPersonnelEntity entity) {
|
||||||
|
return entity != null && "true".equals(entity.getDeleteEnum());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.qinan.safetyeval.infrastructure.dataobject;
|
package org.qinan.safetyeval.infrastructure.dataobject;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -51,6 +52,11 @@ public class OrgPersonnelDO {
|
||||||
private String proofMaterialUrl;
|
private String proofMaterialUrl;
|
||||||
|
|
||||||
// ---- GBS默认字段 ----
|
// ---- GBS默认字段 ----
|
||||||
|
/**
|
||||||
|
* 逻辑删除标识:false-未删除,true-已删除。
|
||||||
|
* 显式指定为字符串类型以覆盖框架全局的整数逻辑删除配置,保持与数据库 varchar 字段一致。
|
||||||
|
*/
|
||||||
|
@TableLogic(value = "false", delval = "true")
|
||||||
private String deleteEnum;
|
private String deleteEnum;
|
||||||
private String remarks;
|
private String remarks;
|
||||||
private String createName;
|
private String createName;
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,15 @@ public class OrgPersonnelCertGatewayImpl implements OrgPersonnelCertGateway {
|
||||||
if (query.getCertTypeCode() != null) {
|
if (query.getCertTypeCode() != null) {
|
||||||
wrapper.eq(OrgPersonnelCertDO::getCertTypeCode, query.getCertTypeCode());
|
wrapper.eq(OrgPersonnelCertDO::getCertTypeCode, query.getCertTypeCode());
|
||||||
}
|
}
|
||||||
|
if (StringUtils.hasText(query.getCertNo())) {
|
||||||
|
wrapper.like(OrgPersonnelCertDO::getCertNo, query.getCertNo());
|
||||||
|
}
|
||||||
|
if (StringUtils.hasText(query.getCertCategoryName())) {
|
||||||
|
wrapper.like(OrgPersonnelCertDO::getCertCategoryName, query.getCertCategoryName());
|
||||||
|
}
|
||||||
|
if (StringUtils.hasText(query.getOperationCategoryName())) {
|
||||||
|
wrapper.like(OrgPersonnelCertDO::getOperationCategoryName, query.getOperationCategoryName());
|
||||||
|
}
|
||||||
|
|
||||||
Page<OrgPersonnelCertDO> page = new Page<>(query.getPageNum(), query.getPageSize());
|
Page<OrgPersonnelCertDO> page = new Page<>(query.getPageNum(), query.getPageSize());
|
||||||
IPage<OrgPersonnelCertDO> result = orgPersonnelCertMapper.selectPage(page, wrapper);
|
IPage<OrgPersonnelCertDO> result = orgPersonnelCertMapper.selectPage(page, wrapper);
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ import org.qinan.safetyeval.infrastructure.dataobject.OrgPersonnelDO;
|
||||||
import org.qinan.safetyeval.infrastructure.mapper.OrgPersonnelMapper;
|
import org.qinan.safetyeval.infrastructure.mapper.OrgPersonnelMapper;
|
||||||
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
|
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
|
||||||
import org.qinan.safetyeval.infrastructure.support.OrgContextResolver;
|
import org.qinan.safetyeval.infrastructure.support.OrgContextResolver;
|
||||||
|
import org.qinan.safetyeval.infrastructure.support.OrgPersonnelRawRepository;
|
||||||
|
import org.springframework.dao.DuplicateKeyException;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
|
@ -32,11 +34,24 @@ public class OrgPersonnelGatewayImpl implements OrgPersonnelGateway {
|
||||||
@Resource
|
@Resource
|
||||||
private OrgContextResolver orgContextResolver;
|
private OrgContextResolver orgContextResolver;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OrgPersonnelRawRepository orgPersonnelRawRepository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OrgPersonnelEntity save(OrgPersonnelEntity entity) {
|
public OrgPersonnelEntity save(OrgPersonnelEntity entity) {
|
||||||
OrgPersonnelDO dataObject = toDO(entity);
|
OrgPersonnelDO dataObject = toDO(entity);
|
||||||
InsertFieldDefaults.apply(dataObject);
|
InsertFieldDefaults.apply(dataObject);
|
||||||
orgPersonnelMapper.insert(dataObject);
|
try {
|
||||||
|
orgPersonnelMapper.insert(dataObject);
|
||||||
|
}
|
||||||
|
catch (DuplicateKeyException ex) {
|
||||||
|
OrgPersonnelEntity existing = findAnyByAccount(entity.getAccount());
|
||||||
|
if (existing == null || !"true".equals(existing.getDeleteEnum())) {
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
entity.setId(existing.getId());
|
||||||
|
return restore(entity);
|
||||||
|
}
|
||||||
entity.setId(dataObject.getId());
|
entity.setId(dataObject.getId());
|
||||||
InsertFieldDefaults.apply(entity);
|
InsertFieldDefaults.apply(entity);
|
||||||
entity.setTenantId(dataObject.getTenantId());
|
entity.setTenantId(dataObject.getTenantId());
|
||||||
|
|
@ -61,6 +76,26 @@ public class OrgPersonnelGatewayImpl implements OrgPersonnelGateway {
|
||||||
return toEntity(dataObject);
|
return toEntity(dataObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrgPersonnelEntity findAnyByAccount(String account) {
|
||||||
|
if (!StringUtils.hasText(account)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Long orgId = orgContextResolver.resolveOrgId(null);
|
||||||
|
OrgPersonnelDO dataObject = orgPersonnelRawRepository.selectAnyByOrgIdAndAccount(orgId, account);
|
||||||
|
return toEntity(dataObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OrgPersonnelEntity restore(OrgPersonnelEntity entity) {
|
||||||
|
OrgPersonnelDO dataObject = toDO(entity);
|
||||||
|
dataObject.setId(entity.getId());
|
||||||
|
dataObject.setDeleteEnum("false");
|
||||||
|
InsertFieldDefaults.applyForUpdate(dataObject);
|
||||||
|
orgPersonnelRawRepository.restoreById(dataObject);
|
||||||
|
return get(entity.getId());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OrgPersonnelEntity findByUserName(String userName) {
|
public OrgPersonnelEntity findByUserName(String userName) {
|
||||||
if (!StringUtils.hasText(userName)) {
|
if (!StringUtils.hasText(userName)) {
|
||||||
|
|
@ -207,6 +242,7 @@ public class OrgPersonnelGatewayImpl implements OrgPersonnelGateway {
|
||||||
entity.setWorkExperience(dataObject.getWorkExperience());
|
entity.setWorkExperience(dataObject.getWorkExperience());
|
||||||
entity.setProofMaterialUrl(dataObject.getProofMaterialUrl());
|
entity.setProofMaterialUrl(dataObject.getProofMaterialUrl());
|
||||||
entity.setTenantId(dataObject.getTenantId());
|
entity.setTenantId(dataObject.getTenantId());
|
||||||
|
entity.setDeleteEnum(dataObject.getDeleteEnum());
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue