接口优化
This commit is contained in:
parent
75c57a4e86
commit
1c209385d0
|
|
@ -14,6 +14,8 @@ import com.bonus.common.core.utils.DateUtils;
|
|||
import com.bonus.common.core.utils.encryption.Sm4Utils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.basic.domain.BmAgreementInfo;
|
||||
import com.bonus.material.basic.mapper.BmAgreementInfoMapper;
|
||||
import com.bonus.material.purchase.config.RemoteConfig;
|
||||
import com.bonus.system.api.RemoteDeptService;
|
||||
import com.bonus.system.api.domain.SysDept;
|
||||
|
|
@ -21,6 +23,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
|
|||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.material.basic.mapper.BmProjectMapper;
|
||||
import com.bonus.material.basic.domain.BmProject;
|
||||
|
|
@ -48,6 +51,9 @@ public class BmProjectServiceImpl implements IBmProjectService
|
|||
@Resource
|
||||
private RemoteConfig remoteConfig;
|
||||
|
||||
@Resource
|
||||
private BmAgreementInfoMapper bmAgreementInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询标段工程管理
|
||||
*
|
||||
|
|
@ -255,6 +261,16 @@ public class BmProjectServiceImpl implements IBmProjectService
|
|||
@Override
|
||||
public AjaxResult deleteBmProjectByProId(Long proId)
|
||||
{
|
||||
if (proId == null) {
|
||||
return AjaxResult.error(HttpCodeEnum.TO_PARAM_NULL.getCode(), HttpCodeEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
// 根据工程id查询该工程是否已新建协议,存在则不能删除
|
||||
BmAgreementInfo bmAgreementInfo = new BmAgreementInfo();
|
||||
bmAgreementInfo.setProjectId(proId);
|
||||
List<BmAgreementInfo> list = bmAgreementInfoMapper.selectBmAgreementInfoList(bmAgreementInfo);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
return AjaxResult.error("该工程已新建协议,不能删除");
|
||||
}
|
||||
int result = bmProjectMapper.deleteBmProjectByProId(proId);
|
||||
if (result > 0) {
|
||||
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg(), result);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ import com.bonus.common.core.utils.StringUtils;
|
|||
import com.bonus.common.core.utils.encryption.Sm4Utils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.basic.domain.BmAgreementInfo;
|
||||
import com.bonus.material.basic.mapper.BmAgreementInfoMapper;
|
||||
import com.bonus.material.purchase.config.RemoteConfig;
|
||||
import com.bonus.system.api.RemoteDeptService;
|
||||
import com.bonus.system.api.domain.SysDept;
|
||||
|
|
@ -47,6 +49,9 @@ public class BmUnitServiceImpl implements IBmUnitService
|
|||
@Resource
|
||||
private RemoteDeptService remoteDeptService;
|
||||
|
||||
@Resource
|
||||
private BmAgreementInfoMapper bmAgreementInfoMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询往来单位管理
|
||||
|
|
@ -198,6 +203,16 @@ public class BmUnitServiceImpl implements IBmUnitService
|
|||
@Override
|
||||
public AjaxResult deleteBmUnitByUnitId(Long unitId)
|
||||
{
|
||||
if (unitId == null) {
|
||||
return AjaxResult.error(HttpCodeEnum.TO_PARAM_NULL.getCode(), HttpCodeEnum.TO_PARAM_NULL.getMsg());
|
||||
}
|
||||
// 根据工程id查询该工程是否已新建协议,存在则不能删除
|
||||
BmAgreementInfo bmAgreementInfo = new BmAgreementInfo();
|
||||
bmAgreementInfo.setUnitId(unitId);
|
||||
List<BmAgreementInfo> list = bmAgreementInfoMapper.selectBmAgreementInfoList(bmAgreementInfo);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
return AjaxResult.error("该单位已新建协议,不能删除");
|
||||
}
|
||||
//先查看往来单位是否被绑定,绑定则不能删除
|
||||
if (bmUnitMapper.countBmUnitPersonByUnitId(unitId) > 0) {
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "该单位还绑定相关人员,无法删除");
|
||||
|
|
|
|||
Loading…
Reference in New Issue