|
@ -9,10 +9,19 @@ import com.yihu.wlyy.util.DateUtil;
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
import com.yihu.wlyy.util.IdCardUtil;
|
|
import com.yihu.wlyy.util.IdCardUtil;
|
|
import com.yihu.wlyy.util.fastdfs.FastDFSUtil;
|
|
import com.yihu.wlyy.util.fastdfs.FastDFSUtil;
|
|
|
|
import com.yihu.wlyy.util.http.HttpUtils;
|
|
import com.yihu.wlyy.util.query.BaseJpaService;
|
|
import com.yihu.wlyy.util.query.BaseJpaService;
|
|
import jxl.Workbook;
|
|
import jxl.Workbook;
|
|
import jxl.write.*;
|
|
import jxl.write.*;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.http.HttpEntity;
|
|
|
|
import org.apache.http.HttpResponse;
|
|
|
|
import org.apache.http.client.methods.HttpPost;
|
|
|
|
import org.apache.http.entity.ContentType;
|
|
|
|
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
|
|
|
import org.apache.http.impl.client.CloseableHttpClient;
|
|
|
|
import org.apache.http.impl.client.HttpClientBuilder;
|
|
|
|
import org.apache.http.util.EntityUtils;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@ -20,12 +29,19 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import java.io.IOException;
|
|
import java.io.OutputStream;
|
|
import java.io.OutputStream;
|
|
|
|
import java.nio.charset.Charset;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
|
|
import static org.springframework.util.ResourceUtils.getFile;
|
|
|
|
|
|
/**
|
|
/**
|
|
* Created by 刘文彬 on 2018/9/27.
|
|
* Created by 刘文彬 on 2018/9/27.
|
|
*/
|
|
*/
|
|
@ -67,6 +83,8 @@ public class SynergyManageService extends BaseJpaService {
|
|
private FastDFSUtil fastDFSUtil;
|
|
private FastDFSUtil fastDFSUtil;
|
|
@Autowired
|
|
@Autowired
|
|
private ManageCustomerOnlineRecordDao manageCustomerOnlineRecordDao;
|
|
private ManageCustomerOnlineRecordDao manageCustomerOnlineRecordDao;
|
|
|
|
@Autowired
|
|
|
|
private ManageSynergyAccessoryDao manageSynergyAccessoryDao;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据服务编码获取工单
|
|
* 根据服务编码获取工单
|
|
@ -409,6 +427,8 @@ public class SynergyManageService extends BaseJpaService {
|
|
//获取退回原因
|
|
//获取退回原因
|
|
map.put("returnedRemark", workorderDO.getReturnedRemark());
|
|
map.put("returnedRemark", workorderDO.getReturnedRemark());
|
|
}
|
|
}
|
|
|
|
List<ManageSynergyAccessoryDO> accessoryList = accessoryList(workorderCode);
|
|
|
|
map.put("accessoryList",accessoryList);//附件列表
|
|
return map;
|
|
return map;
|
|
}
|
|
}
|
|
|
|
|
|
@ -842,7 +862,7 @@ public class SynergyManageService extends BaseJpaService {
|
|
if(receiveType==1){
|
|
if(receiveType==1){
|
|
sql =" select DISTINCT r.* from manage_synergy_workorder_reminder r " +
|
|
sql =" select DISTINCT r.* from manage_synergy_workorder_reminder r " +
|
|
" LEFT JOIN manage_synergy_workorder_executor e on r.workorder_code=e.workorder_code " +
|
|
" LEFT JOIN manage_synergy_workorder_executor e on r.workorder_code=e.workorder_code " +
|
|
" where e.executor_code='' and e.del=1 and r.deal_with=0 " +sort;
|
|
|
|
|
|
" where e.executor_code='"+userCode+"' and e.del=1 and r.deal_with=0 " +sort;
|
|
}else if(receiveType==2){
|
|
}else if(receiveType==2){
|
|
sql =" select r.* from manage_synergy_workorder_reminder r where r.principal_code='"+userCode+"' and r.deal_with=0 "+sort;
|
|
sql =" select r.* from manage_synergy_workorder_reminder r where r.principal_code='"+userCode+"' and r.deal_with=0 "+sort;
|
|
}
|
|
}
|
|
@ -851,7 +871,7 @@ public class SynergyManageService extends BaseJpaService {
|
|
for(Map<String,Object> one:List){
|
|
for(Map<String,Object> one:List){
|
|
Map<String,Object> resultMap = new HashMap<>();
|
|
Map<String,Object> resultMap = new HashMap<>();
|
|
resultMap.put("workorderCode",one.get("workorder_code"));
|
|
resultMap.put("workorderCode",one.get("workorder_code"));
|
|
resultMap.put("title","来自"+one.get("create_user_name")+"医生("+one.get("hospital_name")+")催单,请尽快处理(服务编号:)"+one.get("workorder_code"));//标题
|
|
|
|
|
|
resultMap.put("title","来自"+one.get("create_user_name")+"医生("+one.get("hospital_name")+")催单,请尽快处理(服务编号:"+one.get("workorder_code")+")");//标题
|
|
String workorderTypeName ="";
|
|
String workorderTypeName ="";
|
|
Integer workorderType = (Integer) one.get("workorder_type");
|
|
Integer workorderType = (Integer) one.get("workorder_type");
|
|
switch (workorderType){
|
|
switch (workorderType){
|
|
@ -1243,15 +1263,30 @@ public class SynergyManageService extends BaseJpaService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//求总时长
|
|
//求总时长
|
|
int seconds = totalTaklTime(waihudList);
|
|
|
|
//求平均时长
|
|
|
|
map.put("waihuAvgTalkTime",getAvgTime(seconds,waihudList.size()));
|
|
|
|
|
|
if (waihudList.size()>0){
|
|
|
|
int seconds = totalTaklTime(waihudList);
|
|
|
|
//求平均时长
|
|
|
|
map.put("waihuAvgTalkTime",getAvgTime(seconds,waihudList.size()));
|
|
|
|
}else {
|
|
|
|
map.put("waihuAvgTalkTime",0);
|
|
|
|
}
|
|
|
|
|
|
map.put("waihuCount",waihudList.size());
|
|
map.put("waihuCount",waihudList.size());
|
|
map.put("waihuCustomerNoCount",customerNoCount);
|
|
map.put("waihuCustomerNoCount",customerNoCount);
|
|
|
|
|
|
//--------------今日在线时长-----------------//
|
|
//--------------今日在线时长-----------------//
|
|
|
|
|
|
List<ManageCustomerOnlineRecordDO> manageCustomerOnlineRecordDOList = manageCustomerOnlineRecordDao.findByCustomerCodeToday(userCode,startTime,endTime);
|
|
|
|
|
|
String lineSql="SELECT" +
|
|
|
|
" *" +
|
|
|
|
" FROM" +
|
|
|
|
" `manage_customer_online_record`" +
|
|
|
|
" WHERE" +
|
|
|
|
" customer_code ='"+userCode+"'" +
|
|
|
|
" AND create_time >='"+startTime+"'" +
|
|
|
|
" AND create_time <='"+endTime+"'" +
|
|
|
|
" ORDER BY" +
|
|
|
|
" create_time";
|
|
|
|
List<ManageCustomerOnlineRecordDO> manageCustomerOnlineRecordDOList = jdbcTemplate.query(lineSql,new BeanPropertyRowMapper<>(ManageCustomerOnlineRecordDO.class));
|
|
//如果最新一条是离线则直接获取总在线时长就是在线时间,
|
|
//如果最新一条是离线则直接获取总在线时长就是在线时间,
|
|
// 如果最新一条是在线,则用当前时间减去上一条登录时间加上之前的在线时长为总的在线时长
|
|
// 如果最新一条是在线,则用当前时间减去上一条登录时间加上之前的在线时长为总的在线时长
|
|
Map<String,Object> lineMap = getOnlineAndNotOnlineAndNowOnline(manageCustomerOnlineRecordDOList);
|
|
Map<String,Object> lineMap = getOnlineAndNotOnlineAndNowOnline(manageCustomerOnlineRecordDOList);
|
|
@ -1262,7 +1297,10 @@ public class SynergyManageService extends BaseJpaService {
|
|
//求总时长
|
|
//求总时长
|
|
int jieruTotalSecond = totalTaklTime(jieruList);
|
|
int jieruTotalSecond = totalTaklTime(jieruList);
|
|
//求平均时长
|
|
//求平均时长
|
|
map.put("jieruAvgTalkTime",getAvgTime(jieruTotalSecond,jieruList.size()));
|
|
|
|
|
|
if (jieruList.size()>0){
|
|
|
|
map.put("jieruAvgTalkTime",getAvgTime(jieruTotalSecond,jieruList.size()));
|
|
|
|
}
|
|
|
|
map.put("jieruAvgTalkTime",0);
|
|
map.put("jieruCount",jieruList.size());
|
|
map.put("jieruCount",jieruList.size());
|
|
|
|
|
|
//--------------今日协同任务完成数-----------------//
|
|
//--------------今日协同任务完成数-----------------//
|
|
@ -1285,7 +1323,7 @@ public class SynergyManageService extends BaseJpaService {
|
|
" executor_code = '"+userCode+"'" +
|
|
" executor_code = '"+userCode+"'" +
|
|
" AND executor_type = 2" +
|
|
" AND executor_type = 2" +
|
|
" AND `status`<3";
|
|
" AND `status`<3";
|
|
Map<String,Object> weiwanchenMap = jdbcTemplate.queryForMap(wanchenSql);
|
|
|
|
|
|
Map<String,Object> weiwanchenMap = jdbcTemplate.queryForMap(weiwanchenSql);
|
|
String fasongSql="SELECT" +
|
|
String fasongSql="SELECT" +
|
|
" COUNT(*) AS fasongCount" +
|
|
" COUNT(*) AS fasongCount" +
|
|
" FROM" +
|
|
" FROM" +
|
|
@ -1306,46 +1344,54 @@ public class SynergyManageService extends BaseJpaService {
|
|
|
|
|
|
public Map<String,Object> getOnlineAndNotOnlineAndNowOnline(List<ManageCustomerOnlineRecordDO> list){
|
|
public Map<String,Object> getOnlineAndNotOnlineAndNowOnline(List<ManageCustomerOnlineRecordDO> list){
|
|
Map<String,Object> map = new HashMap<>();
|
|
Map<String,Object> map = new HashMap<>();
|
|
//如果最新一条是离线则直接获取总在线时长就是在线时间,
|
|
|
|
// 如果最新一条是在线,则用当前时间减去上一条登录时间加上之前的在线时长为总的在线时长
|
|
|
|
int status = list.get(list.size()-1).getStatus();
|
|
|
|
String firstOnlineTime = DateUtil.dateToStr(list.get(0).getCreateTime(),DateUtil.YYYY_MM_DD_HH_MM_SS);
|
|
|
|
int totalOnlineMinute=0;
|
|
|
|
int totalNotOnlineMinute =0;
|
|
|
|
int toMinute = 0;
|
|
|
|
//离线status==2
|
|
|
|
if (status==2){
|
|
|
|
totalOnlineMinute =list.get(list.size()-1).getTotalOnlineTime();
|
|
|
|
long allTime = list.get(list.size()-1).getCreateTime().getTime()-list.get(0).getCreateTime().getTime();
|
|
|
|
totalNotOnlineMinute= Integer.valueOf(String.valueOf(allTime/1000/60))-totalOnlineMinute;
|
|
|
|
}
|
|
|
|
//在线status==1
|
|
|
|
if (status==1){
|
|
|
|
//只有一条在线的数据,用当前时间减去数据创建时间
|
|
|
|
long onlineDate = 0L;
|
|
|
|
long allDateTime = 0L;
|
|
|
|
int lastOnlineTime =0;
|
|
|
|
Date now = new Date();
|
|
|
|
onlineDate = now.getTime()-list.get(list.size()-1).getCreateTime().getTime();
|
|
|
|
allDateTime = now.getTime()-list.get(0).getCreateTime().getTime();
|
|
|
|
toMinute = Integer.valueOf(String.valueOf(onlineDate/1000/60));
|
|
|
|
//多条数据,要加上上一次记录的在线时长
|
|
|
|
if(list.size()>1){
|
|
|
|
int notOnlineCount=0;
|
|
|
|
for (ManageCustomerOnlineRecordDO m : list){
|
|
|
|
if (m.getStatus()==2 && notOnlineCount<1){
|
|
|
|
notOnlineCount++;
|
|
|
|
lastOnlineTime = m.getTotalOnlineTime();
|
|
|
|
|
|
if (list!=null && list.size()>0){
|
|
|
|
//如果最新一条是离线则直接获取总在线时长就是在线时间,
|
|
|
|
// 如果最新一条是在线,则用当前时间减去上一条登录时间加上之前的在线时长为总的在线时长
|
|
|
|
int status = list.get(list.size()-1).getStatus();
|
|
|
|
String firstOnlineTime = DateUtil.dateToStr(list.get(0).getCreateTime(),DateUtil.YYYY_MM_DD_HH_MM_SS);
|
|
|
|
int totalOnlineMinute=0;
|
|
|
|
int totalNotOnlineMinute =0;
|
|
|
|
int toMinute = 0;
|
|
|
|
//离线status==2
|
|
|
|
if (status==2){
|
|
|
|
totalOnlineMinute =list.get(list.size()-1).getTotalOnlineTime();
|
|
|
|
long allTime = list.get(list.size()-1).getCreateTime().getTime()-list.get(0).getCreateTime().getTime();
|
|
|
|
totalNotOnlineMinute= Integer.valueOf(String.valueOf(allTime/1000/60))-totalOnlineMinute;
|
|
|
|
}
|
|
|
|
//在线status==1
|
|
|
|
if (status==1){
|
|
|
|
//只有一条在线的数据,用当前时间减去数据创建时间
|
|
|
|
long onlineDate = 0L;
|
|
|
|
long allDateTime = 0L;
|
|
|
|
int lastOnlineTime =0;
|
|
|
|
Date now = new Date();
|
|
|
|
onlineDate = now.getTime()-list.get(list.size()-1).getCreateTime().getTime();
|
|
|
|
allDateTime = now.getTime()-list.get(0).getCreateTime().getTime();
|
|
|
|
toMinute = Integer.valueOf(String.valueOf(onlineDate/1000/60));
|
|
|
|
//多条数据,要加上上一次记录的在线时长
|
|
|
|
if(list.size()>1){
|
|
|
|
int notOnlineCount=0;
|
|
|
|
for (ManageCustomerOnlineRecordDO m : list){
|
|
|
|
if (m.getStatus()==2 && notOnlineCount<1){
|
|
|
|
notOnlineCount++;
|
|
|
|
lastOnlineTime = m.getTotalOnlineTime();
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
totalOnlineMinute=toMinute+lastOnlineTime;
|
|
|
|
totalNotOnlineMinute = Integer.valueOf(String.valueOf(allDateTime/1000/60))-totalOnlineMinute;
|
|
}
|
|
}
|
|
totalOnlineMinute=toMinute+lastOnlineTime;
|
|
|
|
totalNotOnlineMinute = Integer.valueOf(String.valueOf(allDateTime/1000/60))-totalOnlineMinute;
|
|
|
|
|
|
map.put("notOnline",totalNotOnlineMinute);
|
|
|
|
map.put("online",totalOnlineMinute);
|
|
|
|
map.put("nowOnline",toMinute);
|
|
|
|
map.put("firstOnlineTime",firstOnlineTime);
|
|
|
|
}else {
|
|
|
|
map.put("notOnline",0);
|
|
|
|
map.put("online",0);
|
|
|
|
map.put("nowOnline",0);
|
|
|
|
map.put("firstOnlineTime","");
|
|
}
|
|
}
|
|
map.put("notOnline",totalNotOnlineMinute);
|
|
|
|
map.put("online",totalOnlineMinute);
|
|
|
|
map.put("nowOnline",toMinute);
|
|
|
|
map.put("firstOnlineTime",firstOnlineTime);
|
|
|
|
|
|
|
|
return map;
|
|
return map;
|
|
}
|
|
}
|
|
|
|
|
|
@ -1424,11 +1470,89 @@ public class SynergyManageService extends BaseJpaService {
|
|
// System.out.println(aa);
|
|
// System.out.println(aa);
|
|
// System.out.println(a.substring(0,aa));
|
|
// System.out.println(a.substring(0,aa));
|
|
// }
|
|
// }
|
|
public void wordToPDF(String path) throws Exception{
|
|
|
|
String groupName = path.substring(0,path.lastIndexOf("/"));
|
|
|
|
String remoteFileName =path.substring(path.lastIndexOf("/"),path.length()-1);
|
|
|
|
byte[] bb =FastDFSUtil.download(groupName,remoteFileName);
|
|
|
|
|
|
// public void wordToPDF(String path) throws Exception{
|
|
|
|
// String groupName = path.substring(0,path.lastIndexOf("/"));
|
|
|
|
// String remoteFileName =path.substring(path.lastIndexOf("/"),path.length()-1);
|
|
|
|
// byte[] bb =FastDFSUtil.download(groupName,remoteFileName);
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
public Map<String,Object> uploadAccessory(String workorderCode, HttpServletRequest request) throws Exception{
|
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
|
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
|
|
|
MultipartFile multipartFile = multipartRequest.getFile("file");
|
|
|
|
long size = multipartFile.getSize();
|
|
|
|
if(size<=0){
|
|
|
|
map.put("uploadStatus",1);//size小于0
|
|
|
|
map.put("accessory",null);//
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
String fileName = multipartFile.getOriginalFilename();
|
|
|
|
String type = fileName.split(".")[1];
|
|
|
|
if(!("doc".equals(type)||"docx".equals(type)||"xls".equals(type)||"xlsx".equals(type))){
|
|
|
|
map.put("uploadStatus",2);//文件类型不对
|
|
|
|
map.put("accessory",null);//
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
String response = request(wlyyUrl + "/upload/chat", multipartFile, null);
|
|
|
|
JSONObject rs = new JSONObject(response);
|
|
|
|
Integer status =(Integer)rs.get("status");
|
|
|
|
if(status==200){
|
|
|
|
String url = rs.get("urls")+"";
|
|
|
|
ManageSynergyAccessoryDO manageSynergyAccessoryDO = new ManageSynergyAccessoryDO();
|
|
|
|
manageSynergyAccessoryDO.setCode(getCode());
|
|
|
|
manageSynergyAccessoryDO.setDel(0);
|
|
|
|
manageSynergyAccessoryDO.setName(fileName);
|
|
|
|
manageSynergyAccessoryDO.setUrl(url);
|
|
|
|
manageSynergyAccessoryDO.setWorkorderCode(workorderCode);
|
|
|
|
ManageSynergyAccessoryDO accessoryDO = manageSynergyAccessoryDao.save(manageSynergyAccessoryDO);
|
|
|
|
map.put("uploadStatus",0);//文件类型正确
|
|
|
|
map.put("accessory",accessoryDO);//
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
throw new Exception();
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<ManageSynergyAccessoryDO> accessoryList(String workorderCode){
|
|
|
|
|
|
|
|
List<ManageSynergyAccessoryDO> list = manageSynergyAccessoryDao.findByWorkorderCode(workorderCode);
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String request(String remote_url, MultipartFile file, String type) {
|
|
|
|
CloseableHttpClient httpClient = HttpClientBuilder.create().build();
|
|
|
|
String result = "";
|
|
|
|
try {
|
|
|
|
String fileName = file.getOriginalFilename();
|
|
|
|
HttpPost httpPost = new HttpPost(remote_url);
|
|
|
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
|
|
|
builder.addBinaryBody("file", file.getInputStream(), ContentType.MULTIPART_FORM_DATA, fileName);// 文件流
|
|
|
|
builder.addTextBody("filename", fileName);// 类似浏览器表单提交,对应input的name和value
|
|
|
|
if (!org.springframework.util.StringUtils.isEmpty(type)) {
|
|
|
|
builder.addTextBody("type", type); //发送类型
|
|
|
|
}
|
|
|
|
HttpEntity entity = builder.build();
|
|
|
|
httpPost.setEntity(entity);
|
|
|
|
HttpResponse response = httpClient.execute(httpPost);// 执行提交
|
|
|
|
HttpEntity responseEntity = response.getEntity();
|
|
|
|
if (responseEntity != null) {
|
|
|
|
// 将响应内容转换为字符串
|
|
|
|
result = EntityUtils.toString(responseEntity, Charset.forName("UTF-8"));
|
|
|
|
}
|
|
|
|
} catch (IOException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
} finally {
|
|
|
|
try {
|
|
|
|
httpClient.close();
|
|
|
|
} catch (IOException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
public Map<String,Object> adminIndex(){
|
|
public Map<String,Object> adminIndex(){
|
|
@ -1492,11 +1616,11 @@ public class SynergyManageService extends BaseJpaService {
|
|
" COUNT(*) AS weiwanchengCount" +
|
|
" COUNT(*) AS weiwanchengCount" +
|
|
" FROM" +
|
|
" FROM" +
|
|
" `manage_synergy_workorder_servicer` s" +
|
|
" `manage_synergy_workorder_servicer` s" +
|
|
"LEFT JOIN wlyy_user u ON s.executor_code = u.`code`" +
|
|
|
|
|
|
" LEFT JOIN wlyy_user u ON s.executor_code = u.`code`" +
|
|
" WHERE" +
|
|
" WHERE" +
|
|
" executor_type = 2" +
|
|
" executor_type = 2" +
|
|
" AND `status`<3";
|
|
" AND `status`<3";
|
|
Map<String,Object> weiwanchenMap = jdbcTemplate.queryForMap(wanchenSql);
|
|
|
|
|
|
Map<String,Object> weiwanchenMap = jdbcTemplate.queryForMap(weiwanchenSql);
|
|
String fasongSql="SELECT" +
|
|
String fasongSql="SELECT" +
|
|
" COUNT(*) AS fasongCount" +
|
|
" COUNT(*) AS fasongCount" +
|
|
" FROM" +
|
|
" FROM" +
|
|
@ -1505,7 +1629,7 @@ public class SynergyManageService extends BaseJpaService {
|
|
" s.*, w.create_user," +
|
|
" s.*, w.create_user," +
|
|
" w.create_user_name" +
|
|
" w.create_user_name" +
|
|
" FROM" +
|
|
" FROM" +
|
|
" manage_synergy_workorder_servicer s" +
|
|
|
|
|
|
" manage_synergy_workorder_servicer s" +
|
|
" LEFT JOIN manage_synergy_workorder w ON s.workorder_code = w.`code`" +
|
|
" LEFT JOIN manage_synergy_workorder w ON s.workorder_code = w.`code`" +
|
|
" WHERE" +
|
|
" WHERE" +
|
|
" w.create_user_type = 2" +
|
|
" w.create_user_type = 2" +
|
|
@ -1568,12 +1692,12 @@ public class SynergyManageService extends BaseJpaService {
|
|
String today = DateUtil.dateToStrShort(new Date());
|
|
String today = DateUtil.dateToStrShort(new Date());
|
|
String startTime=today+" 00:00:00";
|
|
String startTime=today+" 00:00:00";
|
|
String endTime = today+" 23:59:59";
|
|
String endTime = today+" 23:59:59";
|
|
startTime="2017-11-15 00:00:00";
|
|
|
|
endTime="2017-11-22 23:59:59";
|
|
|
|
|
|
/*startTime="2017-11-15 00:00:00";
|
|
|
|
endTime="2017-11-22 23:59:59";*/
|
|
String sql="SELECT" +
|
|
String sql="SELECT" +
|
|
" u.`code`,"+
|
|
" u.`code`,"+
|
|
" u.`name`," +
|
|
" u.`name`," +
|
|
" u.`online`," +
|
|
|
|
|
|
" u.`online` as onlineType," +
|
|
" r.type," +
|
|
" r.type," +
|
|
" COUNT(*) as num"+
|
|
" COUNT(*) as num"+
|
|
" FROM" +
|
|
" FROM" +
|
|
@ -1598,7 +1722,7 @@ public class SynergyManageService extends BaseJpaService {
|
|
Map<String,Object> resultMap = new HashMap<>();
|
|
Map<String,Object> resultMap = new HashMap<>();
|
|
resultMap.put("userCode",userCode);
|
|
resultMap.put("userCode",userCode);
|
|
resultMap.put("userName",map.get("name"));
|
|
resultMap.put("userName",map.get("name"));
|
|
resultMap.put("online",map.get("online"));
|
|
|
|
|
|
resultMap.put("onlineType",map.get("online"));
|
|
if ("1".equals(type)){
|
|
if ("1".equals(type)){
|
|
resultMap.put("jieruCount",map.get("num"));
|
|
resultMap.put("jieruCount",map.get("num"));
|
|
resultMap.put("waihuCount",0);
|
|
resultMap.put("waihuCount",0);
|
|
@ -1624,7 +1748,7 @@ public class SynergyManageService extends BaseJpaService {
|
|
Map<String,Object> resultMap = new HashMap<>();
|
|
Map<String,Object> resultMap = new HashMap<>();
|
|
resultMap.put("userCode",userCode);
|
|
resultMap.put("userCode",userCode);
|
|
resultMap.put("userName",map.get("name"));
|
|
resultMap.put("userName",map.get("name"));
|
|
resultMap.put("online",map.get("online"));
|
|
|
|
|
|
resultMap.put("onlineType",map.get("onlineType"));
|
|
if ("1".equals(type)){
|
|
if ("1".equals(type)){
|
|
resultMap.put("jieruCount",map.get("num"));
|
|
resultMap.put("jieruCount",map.get("num"));
|
|
resultMap.put("waihuCount",0);
|
|
resultMap.put("waihuCount",0);
|
|
@ -1640,8 +1764,18 @@ public class SynergyManageService extends BaseJpaService {
|
|
}
|
|
}
|
|
for (Map<String,Object> reMap : resultList){
|
|
for (Map<String,Object> reMap : resultList){
|
|
String userCode = String.valueOf(reMap.get("userCode"));
|
|
String userCode = String.valueOf(reMap.get("userCode"));
|
|
List<ManageCustomerOnlineRecordDO> manageCustomerOnlineRecordDOList = manageCustomerOnlineRecordDao.findByCustomerCodeToday(userCode,startTime,endTime);
|
|
|
|
//如果最新一条是离线则直接获取总在线时长就是在线时间,
|
|
|
|
|
|
String lineSql="SELECT" +
|
|
|
|
" *" +
|
|
|
|
" FROM" +
|
|
|
|
" `manage_customer_online_record`" +
|
|
|
|
" WHERE" +
|
|
|
|
" customer_code ='"+userCode+"'" +
|
|
|
|
" AND create_time >='"+startTime+"'" +
|
|
|
|
" AND create_time <='"+endTime+"'" +
|
|
|
|
" ORDER BY" +
|
|
|
|
" create_time";
|
|
|
|
List<ManageCustomerOnlineRecordDO> manageCustomerOnlineRecordDOList = jdbcTemplate.query(lineSql,new BeanPropertyRowMapper<>(ManageCustomerOnlineRecordDO.class));
|
|
|
|
//如果最新一条是离线则直接获取总在线时长就是在线时间
|
|
// 如果最新一条是在线,则用当前时间减去上一条登录时间加上之前的在线时长为总的在线时长
|
|
// 如果最新一条是在线,则用当前时间减去上一条登录时间加上之前的在线时长为总的在线时长
|
|
Map<String,Object> lineMap = getOnlineAndNotOnlineAndNowOnline(manageCustomerOnlineRecordDOList);
|
|
Map<String,Object> lineMap = getOnlineAndNotOnlineAndNowOnline(manageCustomerOnlineRecordDOList);
|
|
reMap.putAll(lineMap);
|
|
reMap.putAll(lineMap);
|