소스 검색

代码修改

liubing 2 년 전
부모
커밋
11ef93ec4c
1개의 변경된 파일47개의 추가작업 그리고 5개의 파일을 삭제
  1. 47 5
      business/base-service/src/main/java/com/yihu/jw/dailyReport/service/DailyReportUploadService.java

+ 47 - 5
business/base-service/src/main/java/com/yihu/jw/dailyReport/service/DailyReportUploadService.java

@ -5070,9 +5070,12 @@ public class DailyReportUploadService {
    public JSONObject selectBugTotal(String doctorId, String startDate, String endDate, String dept,boolean adminFlag) throws Exception {
        String sqlCondition = "";
        JSONObject result = new JSONObject();
        result.put("bugtotal",0);
        result.put("resolveBugTotal",0);
        result.put("unresolvedBugTotal",0);
        result.put("bugtotal",0); //BUG总数
        result.put("resolveBugTotal",0); //已解决BUG数
        result.put("unresolvedBugTotal",0); //为解决BUG数
        result.put("taskTotal",0); //任务总数
        result.put("unresolvedTaskTotal",0); // 待完成任务数
        result.put("resolveTaskTotal",0); //已完成任务数
        if (adminFlag){
            sqlCondition = " SELECT d.zt_id as ztId FROM base_doctor d LEFT JOIN base_doctor_hospital dh ON d.id=dh.doctor_code where d.del=1 and dh.del=1 and d.zt_id is not null ";
@ -5094,13 +5097,16 @@ public class DailyReportUploadService {
        if (StringUtils.isNoneBlank(str)){
            str = str.substring(0,str.length()-1);
            sqlCondition = " ";
            String  sqlCondition2 = " ";
            if (StringUtils.isNotBlank(startDate)){
                startDate = DateUtil.strToStrShort(startDate)+" 00:00:00";
                sqlCondition += " and lastEditedDate>='"+startDate+"' ";
                sqlCondition2 += " and assignedDate>='"+startDate+"' ";
            }
            if (StringUtils.isNotBlank(endDate)){
                endDate = DateUtil.strToStrShort(endDate)+" 23:59:59";
                sqlCondition += " and lastEditedDate<='"+endDate+"' ";
                sqlCondition2 += " and assignedDate<='"+endDate+"' ";
            }
            String sql = "  select * from ( " +
                    " select count(distinct id) total,'resolve' `status` from zt_bug " +
@ -5110,9 +5116,10 @@ public class DailyReportUploadService {
                    "  and deleted='0' " +sqlCondition+
                    " union ALL " +
                    " select count(distinct id) total,'unresolved' `status` from zt_bug " +
                    " where assignedTo in ("+str+") and `status` in ('active','resolved') and deleted='0' " +sqlCondition+
                    " where assignedTo in ("+str+") " +
                    " and ( (`status` ='active' "+sqlCondition2+") or (`status` ='resolved' "+sqlCondition+" ) )  "+
                    " and deleted='0' "+
                    " )A ";
            String url = "http://172.19.103.134:10023/ykyy/jdbcSQLQuery";
            Map<String,Object> params = new HashedMap();
            params.put("sql",sql);
@ -5143,6 +5150,41 @@ public class DailyReportUploadService {
            result.put("bugtotal",total);
            result.put("resolveBugTotal",resolveBugTotal);
            result.put("unresolvedBugTotal",unresolvedBugTotal);
            sql = " select count(id) 'total','resolve' as 'status' from zt_task " +
                    " where deleted='0' and finishedBy in ('liubing')  " +sqlCondition+
                    " UNION ALL " +
                    " select count(id) 'total','unresolved' as 'status' from zt_task " +
                    " where deleted='0' and assignedTo in ('liubing') AND `status` in ('wait','doing','pause') "+sqlCondition2;
            params = new HashedMap();
            params.put("sql",sql);
            response = HttpUtils.doGet(url,params);
            content = response.getContent();
            logger.info("response:"+content);
            rs = JSON.parseObject(content);
            Long taskTotal = 0l;//任务总数;
            Long resolvetaskTotal=0l;//完成任务总数
            Long unresolvedTaskTotal=0l;//待任务总数
            status = rs.getInteger("status");
            if(status!=null&&status == 200){
                JSONArray array = rs.getJSONArray("detailModelList");
                if (array!=null&&array.size()!=0){
                    taskTotal = array.stream().mapToLong(t ->((JSONObject)t).get("total") == null ? 0 :Long.parseLong(((JSONObject)t).getString("total"))).sum();
                    for (int i=0;i<array.size();i++){
                        JSONObject tmp = array.getJSONObject(i);
                        String taskStatus = tmp.getString("status");
                        Long statusTotal  =Long.parseLong(tmp.getString("total"));
                        if("resolve".equals(taskStatus)){
                            resolvetaskTotal = statusTotal;
                        }else {
                            unresolvedTaskTotal = statusTotal;
                        }
                    }
                }
            }
            result.put("taskTotal",taskTotal); //任务总数
            result.put("unresolvedTaskTotal",unresolvedTaskTotal); // 待完成任务数
            result.put("resolveTaskTotal",resolvetaskTotal); //已完成任务数
        }
        return result;
    }