InvestigateServiceImpl.java
2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package com.project.demo.service.Impl;
import com.project.demo.domain.Investigate;
import com.project.demo.domain.InvestigateUser;
import com.project.demo.mapper.InvestigateMapper;
import com.project.demo.service.InvestigateService;
import com.project.demo.service.InvestigateUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by bert on 2018/7/5.
*/
@Service
public class InvestigateServiceImpl implements InvestigateService {
@Autowired
private InvestigateMapper investigateMapper;
@Autowired
private InvestigateUserService investigateUserService;
@Override
public List<Investigate> search (Map<String, Object> params){
List<Investigate> investigates = investigateMapper.search(params);
return investigates;
}
@Override
public void save (Investigate investigate){
investigateMapper.insert(investigate);
}
@Override
public Investigate searchDetails(Integer companyId){
Investigate investigate=investigateMapper.searchDetails(companyId);
return investigate;
}
@Override
public Investigate findById(Integer id){
return investigateMapper.findById(id);
}
@Override
public List<Investigate> findByUserId(Integer usersId){
return investigateMapper.findByUserId(usersId);
}
@Override
public List<Integer> usersInvestigate(Integer usersId){
final Map<String,Object> params = new HashMap<>();
List<Integer> investigateIds = new ArrayList<>();
params.put("usersId",usersId);
List<InvestigateUser> salesManList = investigateUserService.search(params);
for(int i=0;i<salesManList.size();i++){
investigateIds.add(salesManList.get(i).getComInvestigationId());
}
List<Investigate> createList = findByUserId(usersId);
for(int j=0;j<createList.size();j++){
investigateIds.add(createList.get(j).getId());
}
investigateIds.add(0);
return investigateIds;
}
@Override
public List<Integer> salesMan(Integer id){
List<Integer> investigateIds = new ArrayList<>();
Integer thisId = findById(id).getUserId();
investigateIds.add(thisId);
final Map<String,Object> params = new HashMap<>();
params.put("comInvestigationId",id);
List<InvestigateUser> salesManList = investigateUserService.search(params);
if(salesManList.size()>0){
for(int i = 0;i < salesManList.size();i++){
investigateIds.add(salesManList.get(i).getUsersId());
}
}
return investigateIds;
}
}