|
@@ -18,7 +18,9 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -38,6 +40,10 @@ public class TmContractorServiceImpl extends ServiceImpl<ITmContractorMapper, Tm
|
|
|
IUserService userService;
|
|
|
@Autowired
|
|
|
ICompanyService companyService;
|
|
|
+ @Autowired
|
|
|
+ IScenePlusService scenePlusService;
|
|
|
+ @Autowired
|
|
|
+ ISceneProService sceneProService;
|
|
|
|
|
|
@Override
|
|
|
public Page<TmContractor> pageList(ContractorParam param) {
|
|
@@ -97,13 +103,13 @@ public class TmContractorServiceImpl extends ServiceImpl<ITmContractorMapper, Tm
|
|
|
|
|
|
@Override
|
|
|
public void unCollaborate(ContractorParam param, User user) {
|
|
|
- if(param.getIds() == null || param.getIds().isEmpty()){
|
|
|
+ if(param.getContractorId() == null ||param.getDetailIds() == null || param.getDetailIds().isEmpty()){
|
|
|
throw new BusinessException(ResultCode.PARAM_ERROR);
|
|
|
}
|
|
|
- tmContractorNumService.removeByIds(param.getIds());
|
|
|
- List<TmContractorNum> contractorIds = tmContractorNumService.getByContractorIds(Arrays.asList(param.getId()));
|
|
|
+ tmContractorNumService.removeByIds(param.getDetailIds());
|
|
|
+ List<TmContractorNum> contractorIds = tmContractorNumService.getByContractorIds(Arrays.asList(param.getContractorId()));
|
|
|
if(contractorIds.size() <=0){
|
|
|
- this.removeById(param.getId());
|
|
|
+ this.removeById(param.getContractorId());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -112,8 +118,22 @@ public class TmContractorServiceImpl extends ServiceImpl<ITmContractorMapper, Tm
|
|
|
if(param.getId() == null){
|
|
|
throw new BusinessException(ResultCode.PARAM_ERROR);
|
|
|
}
|
|
|
+ List<TmContractorNum> contractorNumList = tmContractorNumService.getByContractorIds(Arrays.asList(param.getId()));
|
|
|
+ List<String> numList = contractorNumList.stream().map(TmContractorNum::getNum).collect(Collectors.toList());
|
|
|
+ HashMap<String,ScenePro> proMap = sceneProService.getByNumList(numList);
|
|
|
+ HashMap<String,ScenePlus> plusMap = scenePlusService.getByNumList(numList);
|
|
|
+ for (TmContractorNum tmContractorNum : contractorNumList) {
|
|
|
+ ScenePro scenePro = proMap.get(tmContractorNum.getNum());
|
|
|
+ ScenePlus scenePlus = plusMap.get(tmContractorNum.getNum());
|
|
|
+ if(scenePro != null){
|
|
|
+ tmContractorNum.setTitle(scenePro.getSceneName());
|
|
|
+ }
|
|
|
+ if(scenePlus != null){
|
|
|
+ tmContractorNum.setTitle(scenePlus.getTitle());
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- return tmContractorNumService.getByContractorIds(Arrays.asList(param.getId()));
|
|
|
+ return contractorNumList;
|
|
|
}
|
|
|
|
|
|
private TmContractor getByMainContractor(Long userId, Long userId2) {
|