优化删除逻辑
This commit is contained in:
parent
c9a45e70c0
commit
a4c65116e6
|
|
@ -118,7 +118,7 @@ public class TbKeyPeopleController extends BaseController {
|
|||
return success("关键人员删除成功");
|
||||
}catch (Exception e){
|
||||
log.info("关键人员删除失败{}",e.getMessage());
|
||||
return error("关键人员删除失败");
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -95,4 +95,25 @@ public interface EpcMapper {
|
|||
* @return
|
||||
*/
|
||||
int updateEpcTemp(TbGwModelDto o);
|
||||
|
||||
/**
|
||||
* 根据关键人id获取模板信息
|
||||
* @param useId
|
||||
* @return
|
||||
*/
|
||||
List<ComCorePersonBean> selectComCoreListByKeyId(Long useId);
|
||||
|
||||
/**
|
||||
* 根据其他人id获取模版信息
|
||||
* @param useId
|
||||
* @return
|
||||
*/
|
||||
List<ComOtherPersonBean> selectComCoreListByOtherId(Long useId);
|
||||
|
||||
/**
|
||||
* 根据分包商其他人员id获取相关信息
|
||||
* @param useId
|
||||
* @return
|
||||
*/
|
||||
List<SubOtherPeopleBean> selectSubOtherListByPeopleId(Long useId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,4 +94,25 @@ public interface SouthMapper {
|
|||
* @return
|
||||
*/
|
||||
int updateSouthTemp(TbGwModelDto o);
|
||||
|
||||
/**
|
||||
* 根据关键人员id获取模板信息
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<ComCorePersonBean> selectComCoreListByKeyId(Long userId);
|
||||
|
||||
/**
|
||||
* 根据其他人员id获取模版信息
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<ComOtherPersonBean> selectComCoreListByOtherId(Long userId);
|
||||
|
||||
/**
|
||||
* 根据分包商人员id获取模版信息
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<SubOtherPeopleBean> selectSubOtherListByPeopleId(Long userId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,4 +129,46 @@ public interface StateGridMapper {
|
|||
* @return
|
||||
*/
|
||||
List<TbFileSourceVo> getFileSourceList(@Param("id") Long id,@Param("tableName") String tableName);
|
||||
|
||||
/**
|
||||
* 根据keyId获取关联列表
|
||||
* @param keyId
|
||||
* @return
|
||||
*/
|
||||
List<ComCorePersonBean> selectComCoreListByKeyId(Long keyId);
|
||||
|
||||
/**
|
||||
* 根据其他人员id获取关联列表
|
||||
* @param otherId
|
||||
* @return
|
||||
*/
|
||||
List<ComOtherPersonBean> selectComOtherListByOtherId(Long otherId);
|
||||
|
||||
/**
|
||||
* 根据业绩id获取关联信息
|
||||
* @param perfId
|
||||
* @return
|
||||
*/
|
||||
List<ComPerformanceBean> selectComPerfListByPerfId(Long perfId);
|
||||
|
||||
/**
|
||||
* 根据分包商id获取关联信息
|
||||
* @param subId
|
||||
* @return
|
||||
*/
|
||||
List<SubBean> selectSubListBySubId(Long subId);
|
||||
|
||||
/**
|
||||
* 根据分包商业绩id获取关联信息
|
||||
* @param perfId
|
||||
* @return
|
||||
*/
|
||||
List<SubPerformanceBean> selectSubPerfListByPerfId(Long perfId);
|
||||
|
||||
/**
|
||||
* 根据分包商人员id获取关联信息
|
||||
* @param peopleId
|
||||
* @return
|
||||
*/
|
||||
List<SubOtherPeopleBean> selectSubOtherListByPeopleId(Long peopleId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,4 +11,6 @@ public interface TbCompanyPerfRelMapper {
|
|||
void addTbCompanyPerRel(TbCompanyPerfRelVo tbCompanyPerfRelVo);
|
||||
|
||||
void delTbCompanyPerRelByPerfId(@Param("perfId") Long perfId, @Param("source")String source);
|
||||
|
||||
List<TbCompanyPerfRelVo> getTbCompanyPerRelByKeyUser(@Param("userId")Long userId,@Param("source")String source);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,4 +25,12 @@ public interface TbCompanyPerfRelService {
|
|||
* @param perfId
|
||||
*/
|
||||
void delTbCompanyPerRelByPerfId(Long perfId,String source) throws Exception;
|
||||
|
||||
/**
|
||||
* 根据userId获取业务信息
|
||||
*
|
||||
* @param userId
|
||||
* @param s
|
||||
*/
|
||||
List<TbCompanyPerfRelVo> getTbCompanyPerRelByKeyUser(Long userId, String s);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<TbCompanyPerfRelVo> getTbCompanyPerRelByKeyUser(Long userId, String source) {
|
||||
List<TbCompanyPerfRelVo> tbCompanyPerfRelList= tbCompanyPerfRelMapper.getTbCompanyPerRelByKeyUser(userId,source);
|
||||
return tbCompanyPerfRelList;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<ComPerformanceBean> 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("删除照片失败!");
|
||||
}
|
||||
}
|
||||
}
|
||||
//删除附件信息
|
||||
|
|
|
|||
|
|
@ -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<TbCompanyPerfRelVo> tbCompanyPerfRelList = tbCompanyPerfRelService.getTbCompanyPerRelByKeyUser(tbKeyPeopleVo.getId(),"1");
|
||||
if (tbCompanyPerfRelList.size()>0){
|
||||
throw new ServiceException("关键人员已绑定公司业绩");
|
||||
}
|
||||
List<ComCorePersonBean> 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<TbFileSourceVo> 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("删除照片失败!");
|
||||
}
|
||||
}
|
||||
}
|
||||
//删除附件信息表中信息
|
||||
|
|
|
|||
|
|
@ -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<ComOtherPersonBean> 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<TbFileSourceVo> 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("删除照片失败!");
|
||||
}
|
||||
}
|
||||
}
|
||||
//删除附件信息表中信息
|
||||
|
|
|
|||
|
|
@ -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<TbCompanyPerfRelVo> tbCompanyPerfRelList = tbCompanyPerfRelService.getTbCompanyPerRelByKeyUser(tbSubPeopleVo.getId(),"2");
|
||||
if (tbCompanyPerfRelList.size()>0){
|
||||
throw new ServiceException("人员已绑定分包商业绩");
|
||||
}
|
||||
List<SubOtherPeopleBean> 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<TbFileSourceVo> 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("删除照片失败!");
|
||||
}
|
||||
}
|
||||
}
|
||||
//删除附件信息表中信息
|
||||
|
|
|
|||
|
|
@ -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<SubPerformanceBean> 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("删除照片失败!");
|
||||
}
|
||||
}
|
||||
}
|
||||
//删除附件信息
|
||||
|
|
|
|||
|
|
@ -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<SubBean> subList = stateGridMapper.selectSubListBySubId(tbSubVo.getId());
|
||||
if (subList.size()>0){
|
||||
throw new ServiceException("分包商已绑定国网模版");
|
||||
}
|
||||
//查看要删除的分包商是否存在人员信息
|
||||
TbSubPeopleVo tbSubPeopleVo = new TbSubPeopleVo();
|
||||
tbSubPeopleVo.setSubId(tbSubVo.getId());
|
||||
List<TbSubPeopleVo> tbSubPeopleList = tbSubPeopleMapper.getTbSubPeopleList(tbSubPeopleVo);
|
||||
if (tbSubPeopleList.size()>0){
|
||||
throw new ServiceException("分包商下存在人员");
|
||||
}
|
||||
//查看要删除的分包商是否存在业绩信息
|
||||
TbSubPerfVo tbSubPerfVo = new TbSubPerfVo();
|
||||
tbSubPerfVo.setSubId(tbSubVo.getId());
|
||||
List<TbSubPerfVo> tbSubPerfList = tbSubPerfMapper.getTbSubPerfList(tbSubPerfVo);
|
||||
if (tbSubPerfList.size()>0){
|
||||
throw new ServiceException("分包商下存在业绩");
|
||||
}
|
||||
tbSubMapper.delTbSub(tbSubVo);
|
||||
//获取人员附件
|
||||
List<TbFileSourceVo> 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("删除照片失败!");
|
||||
}
|
||||
}
|
||||
}
|
||||
//删除附件信息表中信息
|
||||
|
|
|
|||
|
|
@ -174,5 +174,25 @@
|
|||
LEFT JOIN tb_sub_people tkp ON tgou.user_id = tkp.id
|
||||
WHERE tgou.epc_id = #{id}
|
||||
</select>
|
||||
<select id="selectComCoreListByKeyId" resultType="com.bonus.tool.dto.ComCorePersonBean">
|
||||
SELECT tgku.id,
|
||||
tgku.position as post_name,
|
||||
tgku.perf_id,
|
||||
tgku.pro_perf
|
||||
FROM tb_epc_company_user tgku
|
||||
WHERE tgku.key_id = #{useId}
|
||||
</select>
|
||||
<select id="selectComCoreListByOtherId" resultType="com.bonus.tool.dto.ComOtherPersonBean">
|
||||
SELECT tgou.id,
|
||||
tgou.position as post_name
|
||||
FROM tb_epc_other_user tgou
|
||||
WHERE tgou.other_id = #{useId}
|
||||
</select>
|
||||
<select id="selectSubOtherListByPeopleId" resultType="com.bonus.tool.dto.SubOtherPeopleBean">
|
||||
SELECT tgou.id,
|
||||
tgou.position as post_name
|
||||
FROM tb_epc_sub_user tgou
|
||||
WHERE tgou.user_id = #{useId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -174,5 +174,25 @@
|
|||
LEFT JOIN tb_sub_people tkp ON tgou.user_id = tkp.id
|
||||
WHERE tgou.south_id = #{id}
|
||||
</select>
|
||||
<select id="selectComCoreListByKeyId" resultType="com.bonus.tool.dto.ComCorePersonBean">
|
||||
SELECT tgku.id,
|
||||
tgku.position as post_name,
|
||||
tgku.perf_id,
|
||||
tgku.pro_perf
|
||||
FROM tb_south_company_user tgku
|
||||
WHERE tgku.key_id = #{userId}
|
||||
</select>
|
||||
<select id="selectComCoreListByOtherId" resultType="com.bonus.tool.dto.ComOtherPersonBean">
|
||||
SELECT tgou.id,
|
||||
tgou.position as post_name
|
||||
FROM tb_south_other_user tgou
|
||||
WHERE tgou.other_id = #{userId}
|
||||
</select>
|
||||
<select id="selectSubOtherListByPeopleId" resultType="com.bonus.tool.dto.SubOtherPeopleBean">
|
||||
SELECT tgou.id,
|
||||
tgou.position as post_name
|
||||
FROM tb_south_sub_user tgou
|
||||
WHERE tgou.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
</select>
|
||||
<select id="selectComCoreListByKeyId" resultType="com.bonus.tool.dto.ComCorePersonBean">
|
||||
SELECT tgku.id,
|
||||
tgku.position as post_name,
|
||||
tgku.in_time as ein_date,
|
||||
tgku.out_time as exit_date,
|
||||
tgku.perf_id,
|
||||
tgku.pro_perf
|
||||
FROM tb_gw_key_user tgku
|
||||
WHERE tgku.key_id = #{keyId}
|
||||
</select>
|
||||
<select id="selectComOtherListByOtherId" resultType="com.bonus.tool.dto.ComOtherPersonBean">
|
||||
SELECT tgou.id,
|
||||
tgou.position as post_name
|
||||
FROM tb_gw_other_user tgou
|
||||
WHERE tgou.other_id = #{otherId}
|
||||
</select>
|
||||
<select id="selectComPerfListByPerfId" resultType="com.bonus.tool.dto.ComPerformanceBean">
|
||||
SELECT tgpr.perf_id,
|
||||
tgpr.gw_id
|
||||
FROM tb_gw_perf_rel tgpr
|
||||
WHERE tgpr.perf_id = #{perfId}
|
||||
</select>
|
||||
<select id="selectSubListBySubId" resultType="com.bonus.tool.dto.SubBean">
|
||||
SELECT tgms.id,
|
||||
tgms.gw_id
|
||||
FROM tb_gw_model_sub tgms
|
||||
WHERE tgms.sub_id = #{subId}
|
||||
</select>
|
||||
<select id="selectSubPerfListByPerfId" resultType="com.bonus.tool.dto.SubPerformanceBean">
|
||||
SELECT tbsr.id,
|
||||
tbsr.gw_id,
|
||||
tbsr.sub_id,
|
||||
tbsr.perf_id
|
||||
FROM tb_gw_sub_rel tbsr
|
||||
WHERE tbsr.perf_id = #{perfId}
|
||||
</select>
|
||||
<select id="selectSubOtherListByPeopleId" resultType="com.bonus.tool.dto.SubOtherPeopleBean">
|
||||
SELECT tgsu.id,
|
||||
tgsu.position AS post_name,
|
||||
tgsu.pro_perf
|
||||
FROM tb_gw_sub_user tgsu
|
||||
WHERE tgsu.people_id = #{peopleId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
</select>
|
||||
<select id="getTbCompanyPerRelByKeyUser" resultType="com.bonus.tool.dto.TbCompanyPerfRelVo">
|
||||
select tcpr.id as id,tcpr.title as title,tcpr.work_content as workContent,tcpr.key_user as keyUser,
|
||||
tcpr.perf_id as perfId
|
||||
from tb_company_perf_rel tcpr where tcpr.key_user = #{userId} and tcpr.source = #{source}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue