zd_123 6 vuotta sitten
vanhempi
commit
752b208056

+ 14 - 8
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/CustomerSynergyManageController.java

@ -242,9 +242,12 @@ public class CustomerSynergyManageController extends BaseController {
    public String saveCallLabel(@ApiParam(name="callCode",value="通话记录code")@RequestParam(value = "callCode")String callCode,
                                @ApiParam(name="callLabels",value="通话标签,多个用逗号隔开")@RequestParam(value = "callLabels",required = false)String callLabels){
        try{
            String sql ="UPDATE manage_call_record SET call_label='"+callLabels+"' WHERE `code`='"+callCode+"'";
            jdbcTemplate.update(sql);
            return write(200,"保存成功!");
            int result = synergyManageService.saveCallLabel(callLabels,callCode);
            if (result>0){
                return write(200,"保存成功!");
            }else {
                return write(-1,"保存失败!");
            }
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"保存失败!");
@ -269,9 +272,12 @@ public class CustomerSynergyManageController extends BaseController {
                                @ApiParam(name="serviceType",value="服务类型,多个用逗号隔开")@RequestParam(value = "serviceType",required = false)String serviceType,
                               @ApiParam(name="serviceContent",value="服务记录")@RequestParam(value = "serviceContent",required = false)String serviceContent){
        try{
            String sql ="UPDATE manage_call_record SET service_type='"+serviceType+"',service_content='"+serviceContent+"' WHERE `code`='"+callCode+"'";
            jdbcTemplate.update(sql);
            return write(200,"保存成功!");
            int result = synergyManageService.saveCallInfo(serviceType,serviceContent,callCode);
            if (result>0){
                return write(200,"保存成功!");
            }else {
                return write(-1,"保存失败!");
            }
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"保存失败!");
@ -308,9 +314,9 @@ public class CustomerSynergyManageController extends BaseController {
        }
    }
    @RequestMapping(value = "customerHomePage",method = RequestMethod.GET)
    @RequestMapping(value = "customerIndex",method = RequestMethod.GET)
    @ApiOperation(value = "客服首页")
    public String customerHomePage(@ApiParam(name="userCode",value="客服code")@RequestParam(value ="userCode")String userCode){
    public String customerIndex(@ApiParam(name="userCode",value="客服code")@RequestParam(value ="userCode")String userCode){
        try{
            return write(200,"获取成功!");

+ 60 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyManageService.java

@ -1,6 +1,7 @@
package com.yihu.wlyy.service.synergy;
import com.yihu.wlyy.entity.*;
import com.yihu.wlyy.entity.call.CallRecord;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkordeReminderDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderExecutorDO;
@ -13,10 +14,12 @@ import com.yihu.wlyy.util.IdCardUtil;
import com.yihu.wlyy.util.query.BaseJpaService;
import jxl.Workbook;
import jxl.write.*;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -1079,7 +1082,63 @@ public class SynergyManageService extends BaseJpaService {
        return list;
    }
    public void customerHomePage(String userCode){
    public int saveCallLabel(String callLabels,String callCode){
        String sql ="UPDATE manage_call_record SET call_label='"+callLabels+"' WHERE `code`='"+callCode+"'";
        return  jdbcTemplate.update(sql);
    }
    public int saveCallInfo(String serviceType,String serviceContent,String callCode){
        String sql ="UPDATE manage_call_record SET service_type='"+serviceType+"',service_content='"+serviceContent+"' WHERE `code`='"+callCode+"'";
        return  jdbcTemplate.update(sql);
    }
    public void customerIndex(String userCode){
        Map<String,Object> map = new HashMap<>();
        String today = DateUtil.dateToStrShort(new Date());
        String callSql ="SELECT * FROM manage_call_record WHERE user_code='"+userCode+"' and create_time>='"+today+" 00:00:00' and create_time<='"+today+" 23:59:59'";
        //今日外呼量
        List<CallRecord> waihudList = jdbcTemplate.query(callSql+" and type=2",new BeanPropertyRowMapper<>(CallRecord.class));
        int customerNoCount = 0;
        int hours = 0;
        int minutes = 0;
        int seconds = 0;
        for(CallRecord callRecord : waihudList){
            //求总时长
            if (callRecord.getAnswerStatus()==1){
                String talkTime = callRecord.getTalkTime();
                String[] talkTimeStr = talkTime.split(":");
                for (int i=0;i<talkTimeStr.length;i++){
                    if (i==0){
                        hours += Integer.valueOf(talkTimeStr[i]);
                    }
                    if (i==1){
                        minutes += Integer.valueOf(talkTimeStr[i]);
                    }
                    if (i==2){
                        seconds += Integer.valueOf(talkTimeStr[i]);
                    }
                }
            }
            //获取客户未接通数量
            if(callRecord.getAnswerStatus()==3){
                customerNoCount++;
            }
        }
        String avgTalkTime = "";
        seconds = hours*3600+minutes*60+seconds;
        avgTalkTime =seconds/3600+"时";
        if (seconds%3600==0){
           avgTalkTime +="0分0秒";
        }else {
           if (seconds%3600%60==0){
               avgTalkTime +=seconds%3600/60+"分0秒";
           }else {
               avgTalkTime +=seconds%3600/60+"分"+seconds%3600%60+"秒";
           }
        }
        map.put("waihuCount",waihudList.size());
        map.put("waihuCustomerNoCount",customerNoCount);
        map.put("waihuAvgTalkTime",avgTalkTime);
    }
}