|
@@ -20,6 +20,7 @@ import javax.annotation.Resource;
|
|
|
import java.util.List;
|
|
|
|
|
|
import static com.citu.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
+import static com.citu.module.menduner.system.enums.ErrorCodeConstants.MDE_BUSINESS_LICENSE_OCR_CODE_DUPLICATE;
|
|
|
import static com.citu.module.menduner.system.enums.ErrorCodeConstants.MDE_ENTERPRISE_BUSINESS_NOT_EXISTS;
|
|
|
|
|
|
/**
|
|
@@ -32,13 +33,13 @@ import static com.citu.module.menduner.system.enums.ErrorCodeConstants.MDE_ENTER
|
|
|
public class EnterpriseBusinessServiceImpl implements EnterpriseBusinessService {
|
|
|
|
|
|
@Resource
|
|
|
- private EnterpriseBusinessMapper enterpriseBusinessMapper;
|
|
|
+ private EnterpriseBusinessMapper mapper;
|
|
|
|
|
|
@Override
|
|
|
public Long createEnterpriseBusiness(EnterpriseBusinessSaveReqVO createReqVO) {
|
|
|
// 插入
|
|
|
EnterpriseBusinessDO enterpriseBusiness = BeanUtils.toBean(createReqVO, EnterpriseBusinessDO.class);
|
|
|
- enterpriseBusinessMapper.insert(enterpriseBusiness);
|
|
|
+ mapper.insert(enterpriseBusiness);
|
|
|
// 返回
|
|
|
return enterpriseBusiness.getId();
|
|
|
}
|
|
@@ -49,7 +50,7 @@ public class EnterpriseBusinessServiceImpl implements EnterpriseBusinessService
|
|
|
validateEnterpriseBusinessExists(updateReqVO.getId());
|
|
|
// 更新
|
|
|
EnterpriseBusinessDO updateObj = BeanUtils.toBean(updateReqVO, EnterpriseBusinessDO.class);
|
|
|
- enterpriseBusinessMapper.updateById(updateObj);
|
|
|
+ mapper.updateById(updateObj);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -57,48 +58,52 @@ public class EnterpriseBusinessServiceImpl implements EnterpriseBusinessService
|
|
|
// 校验存在
|
|
|
validateEnterpriseBusinessExists(id);
|
|
|
// 删除
|
|
|
- enterpriseBusinessMapper.deleteById(id);
|
|
|
+ mapper.deleteById(id);
|
|
|
}
|
|
|
|
|
|
private void validateEnterpriseBusinessExists(Long id) {
|
|
|
- if (enterpriseBusinessMapper.selectById(id) == null) {
|
|
|
+ if (mapper.selectById(id) == null) {
|
|
|
throw exception(MDE_ENTERPRISE_BUSINESS_NOT_EXISTS);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public EnterpriseBusinessDO getEnterpriseBusiness(Long id) {
|
|
|
- return enterpriseBusinessMapper.selectById(id);
|
|
|
+ return mapper.selectById(id);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public EnterpriseBusinessDO getByEnterpriseId(Long enterpriseId) {
|
|
|
- return enterpriseBusinessMapper.selectByEnterpriseId(enterpriseId);
|
|
|
+ return mapper.selectByEnterpriseId(enterpriseId);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public PageResult<EnterpriseBusinessDO> getEnterpriseBusinessPage(EnterpriseBusinessPageReqVO pageReqVO) {
|
|
|
- return enterpriseBusinessMapper.selectPage(pageReqVO);
|
|
|
+ return mapper.selectPage(pageReqVO);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public EnterpriseBusinessDO getByCode(String code) {
|
|
|
- return enterpriseBusinessMapper.selectByCode(code);
|
|
|
+ return mapper.selectByCode(code);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public EnterpriseBusinessDO getByName(String name) {
|
|
|
- return enterpriseBusinessMapper.selectByName(name);
|
|
|
+ return mapper.selectByName(name);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Long createSimpleBusiness(Long enterpriseId, String code, String name) {
|
|
|
+ public Long createSimpleBusiness(Long enterpriseId, String code, String name,String businessUrl) {
|
|
|
EnterpriseBusinessDO business = EnterpriseBusinessDO.builder()
|
|
|
.code(code)
|
|
|
.name(name)
|
|
|
.enterpriseId(enterpriseId)
|
|
|
+ .businessUrl(businessUrl)
|
|
|
.build();
|
|
|
- enterpriseBusinessMapper.insert(business);
|
|
|
+ if(mapper.existByCode(null, business.getCode())) {
|
|
|
+ throw exception(MDE_BUSINESS_LICENSE_OCR_CODE_DUPLICATE);
|
|
|
+ }
|
|
|
+ mapper.insert(business);
|
|
|
return business.getEnterpriseId();
|
|
|
}
|
|
|
|
|
@@ -121,14 +126,18 @@ public class EnterpriseBusinessServiceImpl implements EnterpriseBusinessService
|
|
|
.businessStatus(businessLicense.getBusinessStatus())
|
|
|
.businessTerm(businessLicense.getBusinessTerm())
|
|
|
.businessScope(businessLicense.getBusinessScope())
|
|
|
+ .businessUrl(businessLicense.getBusinessUrl())
|
|
|
.build();
|
|
|
- enterpriseBusinessMapper.insert(business);
|
|
|
+ if(mapper.existByCode(null, business.getCode())) {
|
|
|
+ throw exception(MDE_BUSINESS_LICENSE_OCR_CODE_DUPLICATE);
|
|
|
+ }
|
|
|
+ mapper.insert(business);
|
|
|
return business.getEnterpriseId();
|
|
|
}
|
|
|
|
|
|
public EnterpriseBusinessDO selectBusiness() {
|
|
|
EnterpriseBusinessDO businessDO =
|
|
|
- enterpriseBusinessMapper.selectByEnterpriseId(LoginUserContext.getEnterpriseId());
|
|
|
+ mapper.selectByEnterpriseId(LoginUserContext.getEnterpriseId());
|
|
|
if (null == businessDO) {
|
|
|
throw exception(MDE_ENTERPRISE_BUSINESS_NOT_EXISTS);
|
|
|
}
|
|
@@ -143,17 +152,21 @@ public class EnterpriseBusinessServiceImpl implements EnterpriseBusinessService
|
|
|
// 更新
|
|
|
EnterpriseBusinessDO updateObj = EnterpriseConvert.INSTANCE.convert14(reqVO);
|
|
|
updateObj.setId(businessDO.getId());
|
|
|
- enterpriseBusinessMapper.updateById(updateObj);
|
|
|
+ if(mapper.existByCode(businessDO.getId(), updateObj.getCode())) {
|
|
|
+ throw exception(MDE_BUSINESS_LICENSE_OCR_CODE_DUPLICATE);
|
|
|
+ }
|
|
|
+ mapper.updateById(updateObj);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public AppRecruitEnterpriseBusinessRespVO get() {
|
|
|
return EnterpriseConvert.INSTANCE.convert15(
|
|
|
- enterpriseBusinessMapper.selectByEnterpriseId(LoginUserContext.getEnterpriseId()));
|
|
|
+ mapper.selectByEnterpriseId(LoginUserContext.getEnterpriseId()));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<EnterpriseBusinessDO> searchByName(String name) {
|
|
|
- return enterpriseBusinessMapper.searchByName(name);
|
|
|
+ return mapper.searchByName(name);
|
|
|
}
|
|
|
+
|
|
|
}
|