Browse Source

组织下有网格,不允许删除

dev_shibei_match
zhaoqifeng 5 years ago
parent
commit
5a630f86b9
  1. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -67,6 +67,7 @@ public enum EpmetErrorCode {
NOT_DEL_AGENCY(8202, "该机关存在下级机关,不允许删除"),
NOT_DEL_AGENCY_PER(8205, "该机关存在工作人员,不允许删除"),
NOT_DEL_DEPARTMENT(8206, "该部门存在工作人员,不允许删除"),
NOT_DEL_AGENCY_GRID(8207, "该机关存在网格,不允许删除"),
REQUIRE_PERMISSION(8301, "您没有足够的操作权限"),

12
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java

@ -26,6 +26,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.CustomerAgencyConstant;
import com.epmet.constant.RoleKeyConstants;
import com.epmet.dao.CustomerAgencyDao;
import com.epmet.dao.CustomerGridDao;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.GovStaffRoleDTO;
import com.epmet.dto.form.*;
@ -64,6 +65,8 @@ public class AgencyServiceImpl implements AgencyService {
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private StaffServiceImpl staffServiceImpl;
@Autowired
private CustomerGridDao customerGridDao;
/**
* @param formDTO
@ -188,7 +191,14 @@ public class AgencyServiceImpl implements AgencyService {
result.setMsg(EpmetErrorCode.NOT_DEL_AGENCY_PER.getMsg());
return result;
}
//3:删除当前机关组织(逻辑删)
//3:组织下有网格,不允许删除
int gridCount = customerGridDao.selectGridCountByAgencyId(formDTO.getAgencyId());
if (gridCount > NumConstant.ZERO) {
result.setCode(EpmetErrorCode.NOT_DEL_AGENCY_GRID.getCode());
result.setMsg(EpmetErrorCode.NOT_DEL_AGENCY_GRID.getMsg());
return result;
}
//4:删除当前机关组织(逻辑删)
if (customerAgencyDao.deleteById(formDTO.getAgencyId()) < NumConstant.ONE) {
log.error(CustomerAgencyConstant.DEL_EXCEPTION);
throw new RenException(CustomerAgencyConstant.DEL_EXCEPTION);

Loading…
Cancel
Save