|
@@ -2,6 +2,7 @@ package com.management.platform.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.management.platform.entity.*;
|
|
import com.management.platform.entity.*;
|
|
|
|
+import com.management.platform.entity.vo.ContractPageVO;
|
|
import com.management.platform.mapper.*;
|
|
import com.management.platform.mapper.*;
|
|
import com.management.platform.service.ContractDocumentService;
|
|
import com.management.platform.service.ContractDocumentService;
|
|
import com.management.platform.service.ContractService;
|
|
import com.management.platform.service.ContractService;
|
|
@@ -99,27 +100,36 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
|
|
if (StringUtils.isNotBlank(name)){
|
|
if (StringUtils.isNotBlank(name)){
|
|
name = "%" + name + "%";
|
|
name = "%" + name + "%";
|
|
}
|
|
}
|
|
- if (StringUtils.isNotBlank(typeName)){
|
|
|
|
- typeName = typeName;
|
|
|
|
- }
|
|
|
|
List<Contract> contracts = contractMapper.selectContract(user.getCompanyId(), pageStart, pageSize, number, name , typeName , status, startDate,endDate);
|
|
List<Contract> contracts = contractMapper.selectContract(user.getCompanyId(), pageStart, pageSize, number, name , typeName , status, startDate,endDate);
|
|
List<Contract> total = contractMapper.selectContract(user.getCompanyId(), null, null, number, name, typeName, status, startDate, endDate);
|
|
List<Contract> total = contractMapper.selectContract(user.getCompanyId(), null, null, number, name, typeName, status, startDate, endDate);
|
|
- for (Contract contract : contracts) {
|
|
|
|
- List<ContractDocument> fileUrl = contractDocumentMapper.selectList(new QueryWrapper<ContractDocument>().eq("contract_id", id).eq("is_deleted",0));
|
|
|
|
- List<User> users = userMapper.selectList(new QueryWrapper<User>().eq("company_id", user.getCompanyId()));
|
|
|
|
- WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
|
|
|
|
- for (ContractDocument contractDocument : fileUrl) {
|
|
|
|
- if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
|
- for (User item : users) {
|
|
|
|
- if (item.getId().equals(contractDocument.getCreatorId())){
|
|
|
|
- contractDocument.setCreatorName(item.getCorpwxUserid());
|
|
|
|
- }
|
|
|
|
|
|
+ List<Integer> contractCollect = contracts.stream().map(c -> c.getId()).collect(Collectors.toList());
|
|
|
|
+ List<ContractDocument> fileList = contractDocumentMapper.selectList(new QueryWrapper<ContractDocument>().in("contract_id", contractCollect));
|
|
|
|
+ List<String> userCollect = fileList.stream().map(c -> c.getCreatorId()).collect(Collectors.toList());
|
|
|
|
+ List<User> userList = userMapper.selectList(new QueryWrapper<User>().in("id", userCollect));
|
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
|
|
|
|
+ for (ContractDocument contractDocument : fileList) {
|
|
|
|
+ if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
|
+ for (User item : userList) {
|
|
|
|
+ if (item.getId().equals(contractDocument.getCreatorId())){
|
|
|
|
+ contractDocument.setCreatorName(item.getCorpwxUserid());
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ ArrayList<ContractPageVO> contractPageVOS = new ArrayList<>();
|
|
|
|
+ for (Contract contract : contracts) {
|
|
|
|
+ ContractPageVO contractPageVO = new ContractPageVO();
|
|
|
|
+ contractPageVO.setContract(contract);
|
|
|
|
+ for (ContractDocument contractDocument : fileList) {
|
|
|
|
+ if (contractDocument.getContractId().equals(contractDocument.getId())){
|
|
|
|
+ contractPageVO.getFiles().add(contractDocument);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ contractPageVOS.add(contractPageVO);
|
|
|
|
+ }
|
|
HashMap<String, Object> map = new HashMap<>();
|
|
HashMap<String, Object> map = new HashMap<>();
|
|
- map.put("data",contracts);
|
|
|
|
|
|
+ map.put("data",contractPageVOS);
|
|
map.put("total",total.size());
|
|
map.put("total",total.size());
|
|
httpRespMsg.data = map;
|
|
httpRespMsg.data = map;
|
|
return httpRespMsg;
|
|
return httpRespMsg;
|