diff --git a/search-tool/src/main/java/com/bonus/tool/controller/search/TbKeyPeopleController.java b/search-tool/src/main/java/com/bonus/tool/controller/search/TbKeyPeopleController.java index 9714158..51c6225 100644 --- a/search-tool/src/main/java/com/bonus/tool/controller/search/TbKeyPeopleController.java +++ b/search-tool/src/main/java/com/bonus/tool/controller/search/TbKeyPeopleController.java @@ -118,7 +118,7 @@ public class TbKeyPeopleController extends BaseController { return success("关键人员删除成功"); }catch (Exception e){ log.info("关键人员删除失败{}",e.getMessage()); - return error("关键人员删除失败"); + return error(e.getMessage()); } } diff --git a/search-tool/src/main/java/com/bonus/tool/controller/search/TbOtherPeopleController.java b/search-tool/src/main/java/com/bonus/tool/controller/search/TbOtherPeopleController.java index 627225a..4181c49 100644 --- a/search-tool/src/main/java/com/bonus/tool/controller/search/TbOtherPeopleController.java +++ b/search-tool/src/main/java/com/bonus/tool/controller/search/TbOtherPeopleController.java @@ -93,10 +93,10 @@ public class TbOtherPeopleController extends BaseController { public AjaxResult updateTbOtherPeople(@RequestBody TbOtherPeopleVo tbOtherPeopleVo) { try { tbOtherPeopleService.updateTbOtherPeople(tbOtherPeopleVo); - return success("关键人员修改成功"); + return success("其他人员修改成功"); }catch (Exception e){ - log.info("关键人员修改失败{}",e.getMessage()); - return error("其他人员删除失败"); + log.info("其他人员修改失败{}",e.getMessage()); + return error(e.getMessage()); } } @@ -114,7 +114,7 @@ public class TbOtherPeopleController extends BaseController { return success("其他人员删除成功"); }catch (Exception e){ log.info("其他人员删除失败{}",e.getMessage()); - return error("其他人员删除失败"); + return error(e.getMessage()); } } diff --git a/search-tool/src/main/java/com/bonus/tool/mapper/EpcMapper.java b/search-tool/src/main/java/com/bonus/tool/mapper/EpcMapper.java index 46937dc..f740a91 100644 --- a/search-tool/src/main/java/com/bonus/tool/mapper/EpcMapper.java +++ b/search-tool/src/main/java/com/bonus/tool/mapper/EpcMapper.java @@ -95,4 +95,25 @@ public interface EpcMapper { * @return */ int updateEpcTemp(TbGwModelDto o); + + /** + * 根据关键人id获取模板信息 + * @param useId + * @return + */ + List selectComCoreListByKeyId(Long useId); + + /** + * 根据其他人id获取模版信息 + * @param useId + * @return + */ + List selectComCoreListByOtherId(Long useId); + + /** + * 根据分包商其他人员id获取相关信息 + * @param useId + * @return + */ + List selectSubOtherListByPeopleId(Long useId); } diff --git a/search-tool/src/main/java/com/bonus/tool/mapper/SouthMapper.java b/search-tool/src/main/java/com/bonus/tool/mapper/SouthMapper.java index c6bef1b..c1ac13f 100644 --- a/search-tool/src/main/java/com/bonus/tool/mapper/SouthMapper.java +++ b/search-tool/src/main/java/com/bonus/tool/mapper/SouthMapper.java @@ -94,4 +94,25 @@ public interface SouthMapper { * @return */ int updateSouthTemp(TbGwModelDto o); + + /** + * 根据关键人员id获取模板信息 + * @param userId + * @return + */ + List selectComCoreListByKeyId(Long userId); + + /** + * 根据其他人员id获取模版信息 + * @param userId + * @return + */ + List selectComCoreListByOtherId(Long userId); + + /** + * 根据分包商人员id获取模版信息 + * @param userId + * @return + */ + List selectSubOtherListByPeopleId(Long userId); } diff --git a/search-tool/src/main/java/com/bonus/tool/mapper/StateGridMapper.java b/search-tool/src/main/java/com/bonus/tool/mapper/StateGridMapper.java index 1467c8e..d097dc5 100644 --- a/search-tool/src/main/java/com/bonus/tool/mapper/StateGridMapper.java +++ b/search-tool/src/main/java/com/bonus/tool/mapper/StateGridMapper.java @@ -129,4 +129,46 @@ public interface StateGridMapper { * @return */ List getFileSourceList(@Param("id") Long id,@Param("tableName") String tableName); + + /** + * 根据keyId获取关联列表 + * @param keyId + * @return + */ + List selectComCoreListByKeyId(Long keyId); + + /** + * 根据其他人员id获取关联列表 + * @param otherId + * @return + */ + List selectComOtherListByOtherId(Long otherId); + + /** + * 根据业绩id获取关联信息 + * @param perfId + * @return + */ + List selectComPerfListByPerfId(Long perfId); + + /** + * 根据分包商id获取关联信息 + * @param subId + * @return + */ + List selectSubListBySubId(Long subId); + + /** + * 根据分包商业绩id获取关联信息 + * @param perfId + * @return + */ + List selectSubPerfListByPerfId(Long perfId); + + /** + * 根据分包商人员id获取关联信息 + * @param peopleId + * @return + */ + List selectSubOtherListByPeopleId(Long peopleId); } diff --git a/search-tool/src/main/java/com/bonus/tool/mapper/TbCompanyPerfRelMapper.java b/search-tool/src/main/java/com/bonus/tool/mapper/TbCompanyPerfRelMapper.java index fd93af7..6b5eb29 100644 --- a/search-tool/src/main/java/com/bonus/tool/mapper/TbCompanyPerfRelMapper.java +++ b/search-tool/src/main/java/com/bonus/tool/mapper/TbCompanyPerfRelMapper.java @@ -11,4 +11,6 @@ public interface TbCompanyPerfRelMapper { void addTbCompanyPerRel(TbCompanyPerfRelVo tbCompanyPerfRelVo); void delTbCompanyPerRelByPerfId(@Param("perfId") Long perfId, @Param("source")String source); + + List getTbCompanyPerRelByKeyUser(@Param("userId")Long userId,@Param("source")String source); } diff --git a/search-tool/src/main/java/com/bonus/tool/service/TbCompanyPerfRelService.java b/search-tool/src/main/java/com/bonus/tool/service/TbCompanyPerfRelService.java index e97ba6a..602cf24 100644 --- a/search-tool/src/main/java/com/bonus/tool/service/TbCompanyPerfRelService.java +++ b/search-tool/src/main/java/com/bonus/tool/service/TbCompanyPerfRelService.java @@ -25,4 +25,12 @@ public interface TbCompanyPerfRelService { * @param perfId */ void delTbCompanyPerRelByPerfId(Long perfId,String source) throws Exception; + + /** + * 根据userId获取业务信息 + * + * @param userId + * @param s + */ + List getTbCompanyPerRelByKeyUser(Long userId, String s); } diff --git a/search-tool/src/main/java/com/bonus/tool/service/impl/TbCompanyPerfRelServiceImpl.java b/search-tool/src/main/java/com/bonus/tool/service/impl/TbCompanyPerfRelServiceImpl.java index 7ce9fce..8346b82 100644 --- a/search-tool/src/main/java/com/bonus/tool/service/impl/TbCompanyPerfRelServiceImpl.java +++ b/search-tool/src/main/java/com/bonus/tool/service/impl/TbCompanyPerfRelServiceImpl.java @@ -1,7 +1,6 @@ package com.bonus.tool.service.impl; import com.bonus.common.enums.TableType; -import com.bonus.system.service.ISysFileService; import com.bonus.tool.dto.TbCompanyPerfRelVo; import com.bonus.tool.dto.TbFileSourceVo; import com.bonus.tool.mapper.TbCompanyPerfRelMapper; @@ -29,8 +28,6 @@ public class TbCompanyPerfRelServiceImpl implements TbCompanyPerfRelService { @Resource private TbFileSourceService tbFileSourceService; - @Resource - private ISysFileService iSysFileService; /** * 获取业绩表关联关键人员 @@ -77,4 +74,16 @@ public class TbCompanyPerfRelServiceImpl implements TbCompanyPerfRelService { //获取公司业绩下的关键人员信息 tbCompanyPerfRelMapper.delTbCompanyPerRelByPerfId(perfId,source); } + + /** + * 根据userId获取业务信息 + * + * @param userId + * @param source + */ + @Override + public List getTbCompanyPerRelByKeyUser(Long userId, String source) { + List tbCompanyPerfRelList= tbCompanyPerfRelMapper.getTbCompanyPerRelByKeyUser(userId,source); + return tbCompanyPerfRelList; + } } diff --git a/search-tool/src/main/java/com/bonus/tool/service/impl/TbCompanyPerfServiceImpl.java b/search-tool/src/main/java/com/bonus/tool/service/impl/TbCompanyPerfServiceImpl.java index 68095f7..67112ae 100644 --- a/search-tool/src/main/java/com/bonus/tool/service/impl/TbCompanyPerfServiceImpl.java +++ b/search-tool/src/main/java/com/bonus/tool/service/impl/TbCompanyPerfServiceImpl.java @@ -5,9 +5,11 @@ import com.bonus.common.exception.ServiceException; import com.bonus.common.utils.SecurityUtils; import com.bonus.common.utils.StringUtils; import com.bonus.system.service.ISysFileService; +import com.bonus.tool.dto.ComPerformanceBean; import com.bonus.tool.dto.TbCompanyPerfRelVo; import com.bonus.tool.dto.TbCompanyPerfVo; import com.bonus.tool.dto.TbFileSourceVo; +import com.bonus.tool.mapper.StateGridMapper; import com.bonus.tool.mapper.TbCompanyPerfMapper; import com.bonus.tool.service.TbCompanyPerfRelService; import com.bonus.tool.service.TbCompanyPerfService; @@ -40,6 +42,9 @@ public class TbCompanyPerfServiceImpl implements TbCompanyPerfService { @Resource private ISysFileService iSysFileService; + @Resource + private StateGridMapper stateGridMapper; + /** * 公司业绩管理列表查询 * @param @@ -134,6 +139,12 @@ public class TbCompanyPerfServiceImpl implements TbCompanyPerfService { @Override @Transactional public void delTbCompanyPerf(TbCompanyPerfVo tbCompanyPerfVo) throws Exception { + + //查看关键人员是否绑定国网模版 + List comPerformanceList = stateGridMapper.selectComPerfListByPerfId(tbCompanyPerfVo.getId()); + if (comPerformanceList.size()>0){ + throw new ServiceException("公司业绩已绑定国网模版"); + } //公司业绩管理删除 tbCompanyPerfMapper.delTbCompanyPerf(tbCompanyPerfVo); //获取公司业绩管理附件 @@ -141,7 +152,11 @@ public class TbCompanyPerfServiceImpl implements TbCompanyPerfService { //删除服务器图片 if (!tbFileSourceVoList.isEmpty()){ for (TbFileSourceVo tbFileSource:tbFileSourceVoList) { - iSysFileService.deleteFile(tbFileSource.getFilePath()); + try { + iSysFileService.deleteFile(tbFileSource.getFilePath()); + }catch (Exception e){ + log.error("删除照片失败!"); + } } } //删除附件信息 diff --git a/search-tool/src/main/java/com/bonus/tool/service/impl/TbKeyPeopleServiceImpl.java b/search-tool/src/main/java/com/bonus/tool/service/impl/TbKeyPeopleServiceImpl.java index 90faf5a..4a42fb9 100644 --- a/search-tool/src/main/java/com/bonus/tool/service/impl/TbKeyPeopleServiceImpl.java +++ b/search-tool/src/main/java/com/bonus/tool/service/impl/TbKeyPeopleServiceImpl.java @@ -6,9 +6,15 @@ import com.bonus.common.exception.ServiceException; import com.bonus.common.utils.SecurityUtils; import com.bonus.common.utils.StringUtils; import com.bonus.system.service.ISysFileService; +import com.bonus.tool.dto.ComCorePersonBean; +import com.bonus.tool.dto.TbCompanyPerfRelVo; import com.bonus.tool.dto.TbKeyPeopleVo; import com.bonus.tool.dto.TbFileSourceVo; +import com.bonus.tool.mapper.EpcMapper; +import com.bonus.tool.mapper.SouthMapper; +import com.bonus.tool.mapper.StateGridMapper; import com.bonus.tool.mapper.TbKeyPeopleMapper; +import com.bonus.tool.service.TbCompanyPerfRelService; import com.bonus.tool.service.TbFileSourceService; import com.bonus.tool.service.TbKeyPeopleServcie; import lombok.extern.slf4j.Slf4j; @@ -16,6 +22,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -35,6 +42,20 @@ public class TbKeyPeopleServiceImpl implements TbKeyPeopleServcie { @Resource private ISysFileService iSysFileService; + + @Resource + private TbCompanyPerfRelService tbCompanyPerfRelService; + + @Resource + private StateGridMapper stateGridMapper; + + @Resource + private EpcMapper epcMapper; + + @Resource + private SouthMapper southMapper; + + /** * 关键人员列表 * @param tbKeyPeopleVo @@ -112,13 +133,39 @@ public class TbKeyPeopleServiceImpl implements TbKeyPeopleServcie { @Override @Transactional public void delTbKeyPeople(TbKeyPeopleVo tbKeyPeopleVo) throws Exception { + + //查看关键人员是否绑定公司业绩 + List tbCompanyPerfRelList = tbCompanyPerfRelService.getTbCompanyPerRelByKeyUser(tbKeyPeopleVo.getId(),"1"); + if (tbCompanyPerfRelList.size()>0){ + throw new ServiceException("关键人员已绑定公司业绩"); + } + List comCorePersonList = new ArrayList<>(); + //查看关键人员是否绑定国网模版 + comCorePersonList = stateGridMapper.selectComCoreListByKeyId(tbKeyPeopleVo.getId()); + if (comCorePersonList.size()>0){ + throw new ServiceException("关键人员已绑定国网模版"); + } + //查看是否绑定EPC模板 + comCorePersonList = epcMapper.selectComCoreListByKeyId(tbKeyPeopleVo.getId()); + if (comCorePersonList.size()>0){ + throw new ServiceException("关键人员已绑定EPC模板"); + } + //查看是否绑定南网模板 + comCorePersonList = southMapper.selectComCoreListByKeyId(tbKeyPeopleVo.getId()); + if (comCorePersonList.size()>0){ + throw new ServiceException("关键人员已绑定南网模板"); + } tbKeyPeopleMapper.delTbKeyPeople(tbKeyPeopleVo); //获取人员附件 List tbFileSourceVoList = tbFileSourceService.getTbFileSourceList(tbKeyPeopleVo.getId(),TableType.TB_KEY_PEOPLE.getCode()); //删除服务器图片 if (tbFileSourceVoList.size()>0){ for (TbFileSourceVo TbFileSource:tbFileSourceVoList) { - iSysFileService.deleteFile(TbFileSource.getFilePath()); + try { + iSysFileService.deleteFile(TbFileSource.getFilePath()); + }catch (Exception e){ + log.error("删除照片失败!"); + } } } //删除附件信息表中信息 diff --git a/search-tool/src/main/java/com/bonus/tool/service/impl/TbOtherPeopleServiceImpl.java b/search-tool/src/main/java/com/bonus/tool/service/impl/TbOtherPeopleServiceImpl.java index 3d03af8..bdc56ff 100644 --- a/search-tool/src/main/java/com/bonus/tool/service/impl/TbOtherPeopleServiceImpl.java +++ b/search-tool/src/main/java/com/bonus/tool/service/impl/TbOtherPeopleServiceImpl.java @@ -5,8 +5,13 @@ import com.bonus.common.exception.ServiceException; import com.bonus.common.utils.SecurityUtils; import com.bonus.common.utils.StringUtils; import com.bonus.system.service.ISysFileService; +import com.bonus.tool.dto.ComCorePersonBean; +import com.bonus.tool.dto.ComOtherPersonBean; import com.bonus.tool.dto.TbFileSourceVo; import com.bonus.tool.dto.TbOtherPeopleVo; +import com.bonus.tool.mapper.EpcMapper; +import com.bonus.tool.mapper.SouthMapper; +import com.bonus.tool.mapper.StateGridMapper; import com.bonus.tool.mapper.TbOtherPeopleMapper; import com.bonus.tool.service.TbFileSourceService; import com.bonus.tool.service.TbOtherPeopleService; @@ -15,6 +20,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -35,6 +41,15 @@ public class TbOtherPeopleServiceImpl implements TbOtherPeopleService { @Resource private ISysFileService iSysFileService; + @Resource + private StateGridMapper stateGridMapper; + + @Resource + private EpcMapper epcMapper; + + @Resource + private SouthMapper southMapper; + /** * 其他人员列表查询 * @param @@ -114,13 +129,34 @@ public class TbOtherPeopleServiceImpl implements TbOtherPeopleService { @Override @Transactional public void delTbOtherPeople(TbOtherPeopleVo tbOtherPeopleVo) throws Exception { + + List comCorePersonList = new ArrayList<>(); + //查看关键人员是否绑定国网模版 + comCorePersonList = stateGridMapper.selectComOtherListByOtherId(tbOtherPeopleVo.getId()); + if (comCorePersonList.size()>0){ + throw new ServiceException("关键人员已绑定国网模版"); + } + //查看是否绑定EPC模板 + comCorePersonList = epcMapper.selectComCoreListByOtherId(tbOtherPeopleVo.getId()); + if (comCorePersonList.size()>0){ + throw new ServiceException("关键人员已绑定EPC模板"); + } + //查看是否绑定南网模板 + comCorePersonList = southMapper.selectComCoreListByOtherId(tbOtherPeopleVo.getId()); + if (comCorePersonList.size()>0){ + throw new ServiceException("关键人员已绑定南网模板"); + } tbOtherPeopleMapper.delTbOtherPeople(tbOtherPeopleVo); //获取人员附件 List tbFileSourceVoList = tbFileSourceService.getTbFileSourceList(tbOtherPeopleVo.getId(),TableType.TB_OTHER_PEOPLE.getCode()); //删除服务器图片 if (tbFileSourceVoList.size()>0){ for (TbFileSourceVo tbFileSource:tbFileSourceVoList) { - iSysFileService.deleteFile(tbFileSource.getFilePath()); + try { + iSysFileService.deleteFile(tbFileSource.getFilePath()); + }catch (Exception e){ + log.error("删除照片失败!"); + } } } //删除附件信息表中信息 diff --git a/search-tool/src/main/java/com/bonus/tool/service/impl/TbSubPeopleServiceImpl.java b/search-tool/src/main/java/com/bonus/tool/service/impl/TbSubPeopleServiceImpl.java index d4a0e60..8fac97b 100644 --- a/search-tool/src/main/java/com/bonus/tool/service/impl/TbSubPeopleServiceImpl.java +++ b/search-tool/src/main/java/com/bonus/tool/service/impl/TbSubPeopleServiceImpl.java @@ -5,9 +5,12 @@ import com.bonus.common.exception.ServiceException; import com.bonus.common.utils.SecurityUtils; import com.bonus.common.utils.StringUtils; import com.bonus.system.service.ISysFileService; -import com.bonus.tool.dto.TbFileSourceVo; -import com.bonus.tool.dto.TbSubPeopleVo; +import com.bonus.tool.dto.*; +import com.bonus.tool.mapper.EpcMapper; +import com.bonus.tool.mapper.SouthMapper; +import com.bonus.tool.mapper.StateGridMapper; import com.bonus.tool.mapper.TbSubPeopleMapper; +import com.bonus.tool.service.TbCompanyPerfRelService; import com.bonus.tool.service.TbFileSourceService; import com.bonus.tool.service.TbSubPeopleService; import lombok.extern.slf4j.Slf4j; @@ -15,6 +18,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -35,6 +39,19 @@ public class TbSubPeopleServiceImpl implements TbSubPeopleService { @Resource private ISysFileService iSysFileService; + @Resource + private StateGridMapper stateGridMapper; + + @Resource + private EpcMapper epcMapper; + + @Resource + private SouthMapper southMapper; + + @Resource + private TbCompanyPerfRelService tbCompanyPerfRelService; + + /** * 分包商人员信息列表查询 * @param @@ -114,13 +131,39 @@ public class TbSubPeopleServiceImpl implements TbSubPeopleService { @Override @Transactional public void delTbSubPeople(TbSubPeopleVo tbSubPeopleVo) throws Exception { + + //查看人员是否绑定分包商业绩 + List tbCompanyPerfRelList = tbCompanyPerfRelService.getTbCompanyPerRelByKeyUser(tbSubPeopleVo.getId(),"2"); + if (tbCompanyPerfRelList.size()>0){ + throw new ServiceException("人员已绑定分包商业绩"); + } + List subOtherPeopleList = new ArrayList<>(); + //查看关键人员是否绑定国网模版 + subOtherPeopleList = stateGridMapper.selectSubOtherListByPeopleId(tbSubPeopleVo.getId()); + if (subOtherPeopleList.size()>0){ + throw new ServiceException("人员已绑定国网模版"); + } + //查看是否绑定EPC模板 + subOtherPeopleList = epcMapper.selectSubOtherListByPeopleId(tbSubPeopleVo.getId()); + if (subOtherPeopleList.size()>0){ + throw new ServiceException("人员已绑定EPC模板"); + } + //查看是否绑定南网模板 + subOtherPeopleList = southMapper.selectSubOtherListByPeopleId(tbSubPeopleVo.getId()); + if (subOtherPeopleList.size()>0){ + throw new ServiceException("人员已绑定南网模板"); + } tbSubPeopleMapper.delTbSubPeople(tbSubPeopleVo); //获取人员附件 List tbFileSourceVoList = tbFileSourceService.getTbFileSourceList(tbSubPeopleVo.getId(),TableType.TB_SUB_PEOPLE.getCode()); //删除服务器图片 if (tbFileSourceVoList.size()>0){ for (TbFileSourceVo tbFileSource:tbFileSourceVoList) { - iSysFileService.deleteFile(tbFileSource.getFilePath()); + try { + iSysFileService.deleteFile(tbFileSource.getFilePath()); + }catch (Exception e){ + log.error("删除照片失败!"); + } } } //删除附件信息表中信息 diff --git a/search-tool/src/main/java/com/bonus/tool/service/impl/TbSubPerfServiceImpl.java b/search-tool/src/main/java/com/bonus/tool/service/impl/TbSubPerfServiceImpl.java index 5a16c59..47627dd 100644 --- a/search-tool/src/main/java/com/bonus/tool/service/impl/TbSubPerfServiceImpl.java +++ b/search-tool/src/main/java/com/bonus/tool/service/impl/TbSubPerfServiceImpl.java @@ -5,10 +5,8 @@ import com.bonus.common.exception.ServiceException; import com.bonus.common.utils.SecurityUtils; import com.bonus.common.utils.StringUtils; import com.bonus.system.service.ISysFileService; -import com.bonus.tool.dto.TbCompanyPerfRelVo; -import com.bonus.tool.dto.TbCompanyPerfVo; -import com.bonus.tool.dto.TbFileSourceVo; -import com.bonus.tool.dto.TbSubPerfVo; +import com.bonus.tool.dto.*; +import com.bonus.tool.mapper.StateGridMapper; import com.bonus.tool.mapper.TbSubPerfMapper; import com.bonus.tool.service.TbCompanyPerfRelService; import com.bonus.tool.service.TbFileSourceService; @@ -41,6 +39,8 @@ public class TbSubPerfServiceImpl implements TbSubPerfService { @Resource private ISysFileService iSysFileService; + @Resource + private StateGridMapper stateGridMapper; /** *分包业绩管理列表查询 @@ -138,6 +138,12 @@ public class TbSubPerfServiceImpl implements TbSubPerfService { */ @Override public void delTbSubPerf(TbSubPerfVo tbSubPerfVo) throws Exception { + + //查看要删除的分包商是否绑定国网模板 + List subPerformanceList = stateGridMapper.selectSubPerfListByPerfId(tbSubPerfVo.getId()); + if (subPerformanceList.size()>0){ + throw new ServiceException("分包业绩已绑定国网模版"); + } //公司业绩管理删除 tbSubPerfMapper.delTbSubPerf(tbSubPerfVo); //获取公司业绩管理附件 @@ -145,7 +151,11 @@ public class TbSubPerfServiceImpl implements TbSubPerfService { //删除服务器图片 if (!tbFileSourceVoList.isEmpty()){ for (TbFileSourceVo tbFileSource:tbFileSourceVoList) { - iSysFileService.deleteFile(tbFileSource.getFilePath()); + try { + iSysFileService.deleteFile(tbFileSource.getFilePath()); + }catch (Exception e){ + log.error("删除照片失败!"); + } } } //删除附件信息 diff --git a/search-tool/src/main/java/com/bonus/tool/service/impl/TbSubServiceImpl.java b/search-tool/src/main/java/com/bonus/tool/service/impl/TbSubServiceImpl.java index d41e7d3..cd26b0d 100644 --- a/search-tool/src/main/java/com/bonus/tool/service/impl/TbSubServiceImpl.java +++ b/search-tool/src/main/java/com/bonus/tool/service/impl/TbSubServiceImpl.java @@ -5,9 +5,11 @@ import com.bonus.common.exception.ServiceException; import com.bonus.common.utils.SecurityUtils; import com.bonus.common.utils.StringUtils; import com.bonus.system.service.ISysFileService; -import com.bonus.tool.dto.TbFileSourceVo; -import com.bonus.tool.dto.TbSubVo; +import com.bonus.tool.dto.*; +import com.bonus.tool.mapper.StateGridMapper; import com.bonus.tool.mapper.TbSubMapper; +import com.bonus.tool.mapper.TbSubPeopleMapper; +import com.bonus.tool.mapper.TbSubPerfMapper; import com.bonus.tool.service.TbFileSourceService; import com.bonus.tool.service.TbSubService; import lombok.extern.slf4j.Slf4j; @@ -35,6 +37,14 @@ public class TbSubServiceImpl implements TbSubService { @Resource private ISysFileService iSysFileService; + @Resource + private StateGridMapper stateGridMapper; + + @Resource + private TbSubPeopleMapper tbSubPeopleMapper; + + @Resource + private TbSubPerfMapper tbSubPerfMapper; /** * 分包商列表查询 @@ -115,13 +125,37 @@ public class TbSubServiceImpl implements TbSubService { @Override @Transactional public void delTbSub(TbSubVo tbSubVo) throws Exception { + + //查看要删除的分包商是否绑定国网模板 + List subList = stateGridMapper.selectSubListBySubId(tbSubVo.getId()); + if (subList.size()>0){ + throw new ServiceException("分包商已绑定国网模版"); + } + //查看要删除的分包商是否存在人员信息 + TbSubPeopleVo tbSubPeopleVo = new TbSubPeopleVo(); + tbSubPeopleVo.setSubId(tbSubVo.getId()); + List tbSubPeopleList = tbSubPeopleMapper.getTbSubPeopleList(tbSubPeopleVo); + if (tbSubPeopleList.size()>0){ + throw new ServiceException("分包商下存在人员"); + } + //查看要删除的分包商是否存在业绩信息 + TbSubPerfVo tbSubPerfVo = new TbSubPerfVo(); + tbSubPerfVo.setSubId(tbSubVo.getId()); + List tbSubPerfList = tbSubPerfMapper.getTbSubPerfList(tbSubPerfVo); + if (tbSubPerfList.size()>0){ + throw new ServiceException("分包商下存在业绩"); + } tbSubMapper.delTbSub(tbSubVo); //获取人员附件 List tbFileSourceVoList = tbFileSourceService.getTbFileSourceList(tbSubVo.getId(),TableType.TB_SUB.getCode()); //删除服务器图片 if (tbFileSourceVoList.size()>0){ for (TbFileSourceVo tbFileSource:tbFileSourceVoList) { - iSysFileService.deleteFile(tbFileSource.getFilePath()); + try { + iSysFileService.deleteFile(tbFileSource.getFilePath()); + }catch (Exception e){ + log.error("删除照片失败!"); + } } } //删除附件信息表中信息 diff --git a/search-tool/src/main/resources/mapper/EpcMapper.xml b/search-tool/src/main/resources/mapper/EpcMapper.xml index 82012d4..1bf180c 100644 --- a/search-tool/src/main/resources/mapper/EpcMapper.xml +++ b/search-tool/src/main/resources/mapper/EpcMapper.xml @@ -174,5 +174,25 @@ LEFT JOIN tb_sub_people tkp ON tgou.user_id = tkp.id WHERE tgou.epc_id = #{id} + + + diff --git a/search-tool/src/main/resources/mapper/SouthMapper.xml b/search-tool/src/main/resources/mapper/SouthMapper.xml index 1bdc919..6476a88 100644 --- a/search-tool/src/main/resources/mapper/SouthMapper.xml +++ b/search-tool/src/main/resources/mapper/SouthMapper.xml @@ -174,5 +174,25 @@ LEFT JOIN tb_sub_people tkp ON tgou.user_id = tkp.id WHERE tgou.south_id = #{id} + + + diff --git a/search-tool/src/main/resources/mapper/StateGridMapper.xml b/search-tool/src/main/resources/mapper/StateGridMapper.xml index 16ba9f9..6dbb923 100644 --- a/search-tool/src/main/resources/mapper/StateGridMapper.xml +++ b/search-tool/src/main/resources/mapper/StateGridMapper.xml @@ -253,5 +253,48 @@ file_name as fileName,file_suffix as fileSuffix,create_time as createTime,upload_user as uploadUser from tb_file_source where del_flag=0 and table_name = #{tableName} and table_id = #{id} + + + + + + diff --git a/search-tool/src/main/resources/mapper/TbCompanyPerfRelMapper.xml b/search-tool/src/main/resources/mapper/TbCompanyPerfRelMapper.xml index 8b77b77..191509a 100644 --- a/search-tool/src/main/resources/mapper/TbCompanyPerfRelMapper.xml +++ b/search-tool/src/main/resources/mapper/TbCompanyPerfRelMapper.xml @@ -31,4 +31,9 @@ left join tb_key_people tkp on tcpr.key_user = tkp.id where tcpr.perf_id = #{perfId} and tcpr.source = #{source} +