|
@ -16,14 +16,18 @@ import org.jfw.apt.web.annotation.operate.Post;
|
16
|
16
|
import org.jfw.apt.web.annotation.param.JdbcConn;
|
17
|
17
|
import org.jfw.util.PageQueryResult;
|
18
|
18
|
import org.jfw.util.StringUtil;
|
|
19
|
import org.jfw.util.exception.JfwBaseException;
|
19
|
20
|
|
20
|
21
|
import com.ekexiu.portal.dao.ConsultDao;
|
21
|
22
|
import com.ekexiu.portal.dao.ConsultRejectDao;
|
22
|
23
|
import com.ekexiu.portal.dao.ProfessorDao;
|
23
|
24
|
import com.ekexiu.portal.dao.TidingsDao;
|
|
25
|
import com.ekexiu.portal.dao.UserDao;
|
24
|
26
|
import com.ekexiu.portal.po.Consult;
|
25
|
27
|
import com.ekexiu.portal.po.ConsultReject;
|
|
28
|
import com.ekexiu.portal.po.Professor;
|
26
|
29
|
import com.ekexiu.portal.po.Tidings;
|
|
30
|
import com.ekexiu.portal.po.User;
|
27
|
31
|
import com.ekexiu.portal.pojo.EditProfessor;
|
28
|
32
|
|
29
|
33
|
@Path("/consult")
|
|
@ -33,6 +37,8 @@ public class ConsultService {
|
33
|
37
|
@Autowrie
|
34
|
38
|
private ProfessorDao professorDao;
|
35
|
39
|
@Autowrie
|
|
40
|
private UserDao userDao;
|
|
41
|
@Autowrie
|
36
|
42
|
private ImageService imageService;
|
37
|
43
|
@Autowrie
|
38
|
44
|
private TidingsDao tidingsDao;
|
|
@ -40,6 +46,8 @@ public class ConsultService {
|
40
|
46
|
private ConsultRejectDao consultRejectDao;
|
41
|
47
|
@Autowrie
|
42
|
48
|
private GrowthLogService growthLogService;
|
|
49
|
@Autowrie
|
|
50
|
private SysService sysService;
|
43
|
51
|
|
44
|
52
|
public ConsultDao getConsultDao() {
|
45
|
53
|
return consultDao;
|
|
@ -53,6 +61,12 @@ public class ConsultService {
|
53
|
61
|
public void setProfessorDao(ProfessorDao professorDao) {
|
54
|
62
|
this.professorDao = professorDao;
|
55
|
63
|
}
|
|
64
|
public UserDao getUserDao() {
|
|
65
|
return userDao;
|
|
66
|
}
|
|
67
|
public void setUserDao(UserDao userDao) {
|
|
68
|
this.userDao = userDao;
|
|
69
|
}
|
56
|
70
|
public ImageService getImageService() {
|
57
|
71
|
return imageService;
|
58
|
72
|
}
|
|
@ -77,10 +91,16 @@ public class ConsultService {
|
77
|
91
|
public void setGrowthLogService(GrowthLogService growthLogService) {
|
78
|
92
|
this.growthLogService = growthLogService;
|
79
|
93
|
}
|
|
94
|
public SysService getSysService() {
|
|
95
|
return sysService;
|
|
96
|
}
|
|
97
|
public void setSysService(SysService sysService) {
|
|
98
|
this.sysService = sysService;
|
|
99
|
}
|
80
|
100
|
|
81
|
101
|
@Post
|
82
|
102
|
@Path
|
83
|
|
public String insert(@JdbcConn(true) Connection con, Consult consult) throws SQLException {
|
|
103
|
public String insert(@JdbcConn(true) Connection con, Consult consult) throws SQLException, JfwBaseException {
|
84
|
104
|
String consultId = StringUtil.buildUUID();
|
85
|
105
|
consult.setConsultId(consultId);
|
86
|
106
|
consult.setAssessStatus(0);
|
|
@ -101,9 +121,29 @@ public class ConsultService {
|
101
|
121
|
tidings.setReadStatus(1);
|
102
|
122
|
this.tidingsDao.insert(con, tidings);
|
103
|
123
|
//需求确认给专家增加积分
|
104
|
|
if(consult.getDemandId() != null){
|
105
|
|
this.growthLogService.demandConfirm(con, consult.getProfessorId());
|
|
124
|
// if(consult.getDemandId() != null){
|
|
125
|
// this.growthLogService.demandConfirm(con, consult.getProfessorId());
|
|
126
|
// }
|
|
127
|
/*Professor professor = this.professorDao.queryOne(con, consult.getProfessorId());
|
|
128
|
User user = this.userDao.query(con, consult.getProfessorId());
|
|
129
|
String email = null;
|
|
130
|
String mobile = null;
|
|
131
|
if((professor.getEmail() != null) && (!"".equals(professor.getEmail()))){
|
|
132
|
email = professor.getEmail();
|
|
133
|
}else if((user.getEmail() != null) && (!"".equals(user.getEmail()))){
|
|
134
|
email = user.getEmail();
|
|
135
|
}
|
|
136
|
if((user.getMobilePhone() != null) && (user.getMobilePhone().trim().length() == 11)){
|
|
137
|
mobile = user.getMobilePhone();
|
|
138
|
}else if((professor.getPhone() != null) && (professor.getPhone().trim().length() == 11)){
|
|
139
|
mobile = professor.getPhone();
|
106
|
140
|
}
|
|
141
|
if(email != null){
|
|
142
|
this.sysService.sendConsultMail(email);
|
|
143
|
}
|
|
144
|
if(mobile != null){
|
|
145
|
this.sysService.sendConsultSMS(mobile);
|
|
146
|
}*/
|
107
|
147
|
return consultId;
|
108
|
148
|
}
|
109
|
149
|
|
|
@ -120,7 +160,7 @@ public class ConsultService {
|
120
|
160
|
//点击确认接受咨询,更新咨询状态为进行中
|
121
|
161
|
this.consultDao.updateConsultStatus(con, consultId, 0);
|
122
|
162
|
//接受咨询给专家增加积分
|
123
|
|
this.growthLogService.consultReceive(con, consult.getProfessorId());
|
|
163
|
//this.growthLogService.consultReceive(con, consult.getProfessorId());
|
124
|
164
|
}
|
125
|
165
|
|
126
|
166
|
@Post
|
|
@ -152,7 +192,7 @@ public class ConsultService {
|
152
|
192
|
int finishConsult = this.consultDao.queryReceiveConsult(con, consult.getProfessorId());
|
153
|
193
|
this.professorDao.updateConsultCount(con, consult.getProfessorId(), finishConsult);
|
154
|
194
|
//咨询完成给咨询者增加积分
|
155
|
|
this.growthLogService.consultFinish(con, consult.getConsultantId());
|
|
195
|
//this.growthLogService.consultFinish(con, consult.getConsultantId());
|
156
|
196
|
return true;
|
157
|
197
|
}
|
158
|
198
|
return false;
|
|
@ -168,11 +208,11 @@ public class ConsultService {
|
168
|
208
|
BigDecimal avgStar = this.consultDao.queryStarLevel(con, consult.getProfessorId());
|
169
|
209
|
this.professorDao.updateStarLevel(con, consult.getProfessorId(), avgStar);
|
170
|
210
|
//评价一次咨询给咨询者增加积分
|
171
|
|
this.growthLogService.consultAssess(con, consult.getConsultantId());
|
|
211
|
//this.growthLogService.consultAssess(con, consult.getConsultantId());
|
172
|
212
|
//获得4星及以上评价给专家增加积分
|
173
|
|
if(assessStar > 3){
|
174
|
|
this.growthLogService.receiveFourStar(con, consult.getProfessorId());
|
175
|
|
}
|
|
213
|
// if(assessStar > 3){
|
|
214
|
// this.growthLogService.receiveFourStar(con, consult.getProfessorId());
|
|
215
|
// }
|
176
|
216
|
return true;
|
177
|
217
|
}
|
178
|
218
|
return false;
|