Просмотр исходного кода

服务区连续月统计功能完成

huangchengzdm 8 лет назад
Родитель
Сommit
6208a4a830

+ 99 - 0
VisualInspection/fwq/js/statistics/service_area_check_statistics.js

@@ -0,0 +1,99 @@
+var year = new Date().getFullYear();
+$(function() {
+    // 公用方法,根据当前年月动态将13个月push数组
+    month_method();
+    // 公用方法,月份下拉框
+    // select_option();
+    // 回显当前年月份
+    // $(".div-month select").val(initDate);
+    $.jeDate("#month_date_from", {
+        isinitVal: true,
+        format: 'YYYY/MM' // 分隔符可以任意定义,该例子表示只显示年月
+    });
+    $.jeDate("#month_date_to", {
+        isinitVal: true,
+        format: 'YYYY/MM' // 分隔符可以任意定义,该例子表示只显示年月
+    });
+
+    $("#month_date_from").val("2018-04");
+    $("#month_date_to").val(moment(moment().format("YYYY-MM")).subtract(1, "month").format("YYYY-MM"));
+
+
+    $("#searchbtn").on("click", function() {
+        var s_s = $("#start-score").val();
+        var e_s = $("#end-score").val();
+        var m_s = $("#month_number").val();
+        if (!isRealNum(s_s) || !isRealNum(e_s) || !isRealNum(m_s)) {
+            layer.msg('参数有错误!');
+            return;
+        }
+        getscore($("#month_date_from").val(), $("#month_date_to").val(), m_s, s_s, e_s);
+    });
+
+
+    getscore("2018-04", moment(moment().format("YYYY-MM")).subtract(1, "month").format("YYYY-MM"), 3, 985, 1000);
+
+
+
+});
+
+
+
+
+function getscore(starttime, endtime, limitnumber, limitscore, limitscore2) {
+
+    var data_p = {
+        "start_date": moment(starttime + "-26 00:00:00").valueOf(),
+        "end_date": moment(endtime + "-26 00:00:00").valueOf(),
+        "limitnumber": limitnumber,
+        "limitscore": limitscore,
+        "limitscore2": limitscore2
+    };
+
+    //获取该人员排班
+    var url = "f/statistics/user/score";
+
+    post_common_service(url, data_p, function(data) {
+
+        var table = '';
+        // $("#totlapeople").html(data.length);
+        for (var i in data) {
+            var ss = data[i];
+            var dat = "";
+            for (var j in ss.fwqStatistics) {
+                var po = ss.fwqStatistics[j];
+                dat += po.p_str + "月、";
+            }
+            dat = dat.substring(0, dat.length - 1);
+            table += "<tr><td width='5%;'>" + (parseInt(i) + 1) + "</td><td width='15%;'><a href='JavaScript:void(0)' onclick='jumpuser(\"" + ss.dept_id + "\")'>" + ss.dept + "</a></td><td width='60%;'>" + dat + "</td></tr>";
+        }
+        $(".table-tbody").html(table);
+        $('[data-toggle="tooltip"]').tooltip();
+        $("tr:gt(0):odd").css("background", "#EFEFEF");
+
+    });
+
+}
+
+function jumpuser(deptid) {
+
+
+    var param = {
+        "parent_dept_id": GV("#center-manager"),
+        "dept_id": GV("#fsList"),
+        "start_date": $("#start-time").val(),
+        "end_date": $("#end-time").val(),
+        "start_num": $("#start-num").val(),
+        "end_num": $("#end-num").val(),
+        "start_score": $("#start-score").val(),
+        "end_score": $("#end-score").val(),
+        "job_select": $("#jobSelect").val()
+    }
+    $.zui.store.set('store_param_' + current_url, param);
+
+    url = "/fwq/view/statistics/service_area_data_statistics.html?deptid=" + deptid + "&jump=1"
+
+    isnew = false;
+    changePage(url);
+
+}

+ 1 - 1
VisualInspection/fwq/view/statistics/assess_type.html

@@ -54,7 +54,7 @@
                 </table>
             </div>
           </div>
-          <div id="scrollTable" style="overflow:auto;margin-right:-10px;">
+          <div id="scrollTable" style="overflow:auto;">
               <div class="table-head" style="margin:0px;">
                   <table border="1" width="100%" height="90px" align="center" style="border-top:0px;">
                     <tbody class="table-tbody" style="background:white" align="center">

+ 121 - 0
VisualInspection/fwq/view/statistics/service_area_check_statistics.html

@@ -0,0 +1,121 @@
+<script src="/js/statistics/common_statistic.js?__inline"></script>
+<script src="/fwq/js/statistics/service_area_check_statistics.js">
+</script>
+<style type="text/css">
+    table td,
+    table th {
+        text-align: center;
+        padding: 10px;
+        border: 1px solid #d9d9d9
+    }
+    
+    .table-title {
+        line-height: 50px;
+        text-align: center;
+    }
+    
+    .table-title span {
+        font-size: 22px;
+        color: #333;
+    }
+    
+    .table-head {
+        background-color: #EBF3FD;
+        margin-top: 10px;
+        width: 100%;
+    }
+    
+    .table-head table {
+        border: 1px solid #C7C6C5;
+    }
+    
+    #scrollTable table {
+        border: 1px solid #C7C6C5;
+    }
+    
+    .table-head table tr th {
+        font-size: 12px;
+        color: #333;
+        text-align: center;
+        border: 1px solid #C7C6C5;
+    }
+    
+    .table-tbody tr td {
+        height: 43px;
+    }
+    
+    table {
+        border-color: #d9d9d9;
+    }
+    
+    .div-score {
+        float: left;
+        padding-top: 6px;
+    }
+    
+    .special-style td {
+        border: 1px solid #c7c6c5;
+    }
+</style>
+
+<div class="container-fluid ">
+    <div class="row">
+        <label class="col-sm-1" style="line-height:30px;width:80px">开始月</label>
+        <div class="div-month col-sm-1">
+            <input id="month_date_from" class="form-control form-date" type="text" placeholder="请选择" style="height:30px;">
+        </div>
+        <label class="col-sm-1" style="line-height:30px;width:80px">结束月</label>
+        <div class="div-month col-sm-1">
+            <input id="month_date_to" class="form-control form-date " type="text " placeholder="请选择 " style="height:30px; ">
+        </div>
+
+        <label class="col-sm-1" style="line-height:30px;width:80px">连续月数</label>
+        <div class="div-month col-sm-2">
+            <input id="month_number" type="number" placeholder="请输入0以上的整数" style="height:30px;padding:5px " value="3" />
+        </div>
+        <div class="form-group col-sm-3">
+            <label for="exampleInputAccount1" class="col-sm-4" style="line-height:30px;width:80px">得分区间</label>
+            <div class="col-sm-3">
+                <input type="text" id="start-score" class="form-control form-date" value="985">
+            </div>
+            <div class="to-score col-sm-2" style="padding-top: 6px;text-align:center;width:10px"><label> - </label></div>
+            <div class="col-sm-3">
+                <input type="text" id="end-score" class="form-control form-date" value="1000">
+            </div>
+        </div>
+        <div class="col-sm-2 "><button class="btn btn-info2 col-sm-6 query-company " id="searchbtn">查询</button></div>
+    </div>
+
+
+</div>
+
+
+<div class="row ">
+
+    <div class="datatable" data-checkable="false" style="margin-bottom: 0px;margin-right:10px;    background: #ffffff00;" data-sortable="false">
+        <!-- <label style="margin: 0;">共查询到 <span id="totlapeople" >0</span> 人</label> -->
+        <div class="table-head">
+            <table border="0" width="100%" align="center" style="margin-right:10px;">
+                <thead class="table-thead" align="center">
+                    <tr>
+                        <th width="5%">序号</th>
+                        <!-- <th width="10%">工号</th> -->
+                        <th width="15%">服务区</th>
+                        <!-- <th width="10%">姓名</th> -->
+                        <th width="60%">满足条件月份</th>
+                    </tr>
+                </thead>
+            </table>
+        </div>
+        <!-- 使用一个div来显示数据表格   -->
+        <div id="scrollTable" style="height:500px;overflow:scroll;    margin-right: -10px;">
+            <table style="border-top:0" border="0" width="100%" align="center" id="table">
+                <tbody class="table-tbody" style="background:white; " align="center">
+
+                </tbody>
+            </table>
+        </div>
+    </div>
+
+</div>
+</div>

+ 11 - 0
VisualInspection_server/src/main/java/com/xintong/visualinspection/controller/gettway/StatisticsController_F.java

@@ -6,6 +6,8 @@ import com.xintong.visualinspection.bean.FwqStatisticsBean;
 import com.xintong.visualinspection.controller.BaseController;
 import com.xintong.visualinspection.dao.cluster.DepartmentDao;
 import com.xintong.visualinspection.pojo.fwq.FwqRankingData;
+import com.xintong.visualinspection.pojo.fwq.FwqStatisiticPojo;
+import com.xintong.visualinspection.pojo.fwq.ServiceAreaStatistic;
 import com.xintong.visualinspection.service.CommonService;
 import com.xintong.visualinspection.service.StatisticsService_F;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -245,4 +247,13 @@ public class StatisticsController_F extends BaseController {
         resultMap.put("list", returnMap);
         return super.returnSuccessResult(resultMap);
     }
+
+    /**
+     * 服务区连续月统计
+     */
+    @RequestMapping(value = "/user/score")
+    public String getFsOnePersonCheckedItemDetailInfo(@RequestBody ServiceAreaStatistic obj){
+        List<FwqStatisiticPojo> returnList=  statisticsService_f.getFwqStatistic(obj);
+        return super.returnSuccessResult((returnList));
+    }
 }

+ 3 - 0
Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/dao/FwqStatisticsDao.java

@@ -1,6 +1,7 @@
 package com.xintong.visualinspection.visuallnspection_fjq.dao;
 
 import com.xintong.visualinspection.bean.FwqStatisticsBean;
+import com.xintong.visualinspection.pojo.fwq.ServiceAreaStatistic;
 import org.apache.ibatis.annotations.Mapper;
 
 import java.util.List;
@@ -34,4 +35,6 @@ public interface FwqStatisticsDao {
     List<FwqStatisticsBean> selectFeeStationScoreInfo(FwqStatisticsBean obj);
 
     List<FwqStatisticsBean> selectCheckedItemScoreInfo(FwqStatisticsBean obj);
+
+    List<ServiceAreaStatistic> selectlimituser(ServiceAreaStatistic obj);
 }

+ 19 - 0
Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/mapper/master/StatisticsMapper.xml

@@ -244,6 +244,25 @@
         ORDER BY m.checked_dept
     </select>
 
+    <select id="selectlimituser"   parameterType="com.xintong.visualinspection.pojo.fwq.ServiceAreaStatistic" resultType="com.xintong.visualinspection.pojo.fwq.ServiceAreaStatistic">
+
+        select a.* from (
+        <include refid="selectc"/>
+        ) a where a.dept_id IN ( select d.dept_id from  (select p.dept_id,
+        COUNT(dept_id) AS COUNT from (<include refid="selectc"/>) p GROUP BY p.dept_id ) d where d.count >= #{limitnumber} )
+
+    </select>
+
+    <sql id="selectc">
+        SELECT *
+        FROM
+        check_dept_score AS user_total_score
+        WHERE
+        period_id >= #{startperiod_id}
+        AND period_id &lt;= #{endperiod_id}
+        AND score >= #{limitscore} AND score &lt;= #{limitscore2}
+        GROUP BY dept_id, period_id
+    </sql>
 
 
     <sql id="selectOneAllCheckedInfoData">

+ 109 - 3
Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/service/impl/StatisticsServiceImpl.java

@@ -11,6 +11,8 @@ import com.xintong.visualinspection.bean.FwqStatisticsBo;
 import com.xintong.visualinspection.bean.Item;
 import com.xintong.visualinspection.bean.Organ;
 import com.xintong.visualinspection.pojo.fwq.FwqRankingData;
+import com.xintong.visualinspection.pojo.fwq.FwqStatisiticPojo;
+import com.xintong.visualinspection.pojo.fwq.ServiceAreaStatistic;
 import com.xintong.visualinspection.service.CommonService;
 import com.xintong.visualinspection.service.StatisticsService_F;
 import com.xintong.visualinspection.visuallnspection_fjq.dao.FwqCheckDeptStatisticsDao;
@@ -787,9 +789,9 @@ public class StatisticsServiceImpl implements StatisticsService_F {
             mapStationInfos.put(Long.valueOf(sta.getDeptid()), obj2);
         }
 
-        if(obj.getStart_date()!=null && obj.getEnd_date()!=null){
+        if (obj.getStart_date() != null && obj.getEnd_date() != null) {
             CheckTaskPeriod p = commonService.getCheckTaskPeriod(obj.getStart_date().getTime(), obj.getEnd_date().getTime());
-            if(p!=null){
+            if (p != null) {
                 obj.setPeriod_id(p.getId());
             }
         }
@@ -910,7 +912,7 @@ public class StatisticsServiceImpl implements StatisticsService_F {
                 centerManageList.get(1).setChecked_num(centerManageList.get(1).getChecked_num()
                         + centerManageMap.get(sta.getDept_id()).getChecked_num());
                 centerManageList.get(1).setFeeStationName("盐城");
-            } else if (sta.getParent_dept_id() == 32){
+            } else if (sta.getParent_dept_id() == 32) {
                 centerManageList.get(2).setAll_check_score(centerManageList.get(2).getAll_check_score()
                         + centerManageMap.get(sta.getDept_id()).getAll_check_score());
                 centerManageList.get(2).setChecked_num(centerManageList.get(2).getChecked_num()
@@ -1017,6 +1019,110 @@ public class StatisticsServiceImpl implements StatisticsService_F {
         return map;
     }
 
+    @Override
+    public List<FwqStatisiticPojo> getFwqStatistic(ServiceAreaStatistic obj) {
+
+        List<CheckTaskPeriod> checkTaskPeriods = commonService.getAllCheckTaskPeriod();
+        Map<Long, Organ> deptMap = commonService.getDeptMap();
+
+        for (CheckTaskPeriod p : checkTaskPeriods) {
+            if (obj.getStart_date() == p.getEndtime().getTime()) {
+                obj.setStartperiod_id(p.getId());
+            }
+            if (obj.getEnd_date() == p.getEndtime().getTime()) {
+                obj.setEndperiod_id(p.getId());
+            }
+        }
+        if (obj.getStart_date() > (checkTaskPeriods.get(checkTaskPeriods.size() - 1).getEndtime().getTime())) {
+            return new ArrayList<>();
+        }
+        if (obj.getEnd_date() < (checkTaskPeriods.get(0).getEndtime().getTime())) {
+            return new ArrayList<>();
+        }
+        if (obj.getStart_date() < (checkTaskPeriods.get(0).getEndtime().getTime())) {
+            obj.setStartperiod_id(checkTaskPeriods.get(0).getId());
+        }
+        if (obj.getEnd_date() > (checkTaskPeriods.get(checkTaskPeriods.size() - 1).getEndtime().getTime())) {
+            obj.setEndperiod_id(checkTaskPeriods.get(checkTaskPeriods.size() - 1).getId());
+        }
+
+        List<CheckTaskPeriod> temp_p = new ArrayList<>();
+        for (CheckTaskPeriod p : checkTaskPeriods) {
+            if (p.getId() >= obj.getStartperiod_id() && p.getId() <= obj.getEndperiod_id()) {
+                temp_p.add(p);
+            }
+        }
+
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy.MM");
+        //获取满足条件的服务区
+        List<ServiceAreaStatistic> fwqStatistics = fwqStatisticsDao.selectlimituser(obj);
+
+        HashMap<Integer, List<ServiceAreaStatistic>> usm = new HashMap<>();
+
+        for (ServiceAreaStatistic c : fwqStatistics
+                ) {
+            List<ServiceAreaStatistic> s = usm.get(c.getDept_id());
+            if (s == null) {
+                s = new ArrayList<>();
+            }
+            s.add(c);
+            usm.put(c.getDept_id(), s);
+            for (CheckTaskPeriod p : checkTaskPeriods) {
+                if (c.getPeriod_id().equals(p.getId())) {
+                    c.setP_str(simpleDateFormat.format(p.getEndtime()));
+                }
+            }
+        }
+
+        List<FwqStatisiticPojo> fwq_ids = new ArrayList<>();
+
+        //判断是否连续
+        for (Integer k : usm.keySet()) {
+            List<ServiceAreaStatistic> user_temp = new ArrayList<>();
+            boolean isM = false;
+
+            List<ServiceAreaStatistic> pp = new ArrayList<>();
+            //获取得分
+            List<ServiceAreaStatistic> ll = usm.get(k);
+            int count = 0;
+            for (CheckTaskPeriod p : temp_p) {
+                boolean isfond = false;
+                for (ServiceAreaStatistic s : ll) {
+                    if (s.getPeriod_id().equals(p.getId())) {
+                        isfond = true;
+                        pp.add(s);
+                        break;
+                    }
+                }
+                if (isfond) {
+                    count++;
+                    if (count >= obj.getLimitnumber()) {
+                        isM = true;
+                        user_temp.addAll(pp);
+                        pp.clear();
+                    }
+                } else {
+                    if (count >= obj.getLimitnumber()) {
+                        isM = true;
+                        user_temp.addAll(pp);
+                    }
+                    count = 0;
+                    pp.clear();
+                }
+            }
+
+            if (isM) {
+                FwqStatisiticPojo p = new FwqStatisiticPojo();
+                p.setDept_id(k.longValue());
+                p.setDept(deptMap.get(k.longValue()).getOrganname());
+                p.setFwqStatistics(user_temp);
+                fwq_ids.add(p);
+            }
+        }
+
+        return fwq_ids;
+    }
+
     private List<FwqStatisticsBean> reFeeStationScoreInfo(FwqStatisticsBean obj) {
         List<FwqStatisticsBean> scoreList = fwqStatisticsDao.selectFeeStationScoreInfo(obj);
         Map<Long, FwqStatisticsBean> feeStationMap = new HashMap<>();

+ 17 - 0
Visuallnspection_fjq/visuallnspectioninteface/src/main/java/com/xintong/visualinspection/pojo/fwq/FwqStatisiticPojo.java

@@ -0,0 +1,17 @@
+package com.xintong.visualinspection.pojo.fwq;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 文件名:StatisiticPojo
+ * 版本信息:日期:2018/2/6 Copyright 江苏省交通规划设计院 Corporation 2018 版权所有.
+ */
+@Data
+public class FwqStatisiticPojo implements Serializable{
+    private Long dept_id;
+    private String dept;
+    private List<ServiceAreaStatistic> fwqStatistics;
+}

+ 34 - 0
Visuallnspection_fjq/visuallnspectioninteface/src/main/java/com/xintong/visualinspection/pojo/fwq/ServiceAreaStatistic.java

@@ -0,0 +1,34 @@
+package com.xintong.visualinspection.pojo.fwq;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 文件名:UserStatistic
+ * 版本信息:日期:2018/2/5 Copyright 江苏省交通规划设计院 Corporation 2018 版权所有.
+ */
+@Data
+public class ServiceAreaStatistic implements Serializable {
+    private Long id;
+    private Integer period_id;
+    private Integer score;
+    private Integer dept_id;
+    ////////////查询条件////////////
+    private Integer startperiod_id;
+    private Integer endperiod_id;
+    private Double limitscore;
+    private Double limitscore2;
+    private Double start_date;
+    private Double end_date;
+    private Integer limitnumber;
+    ////////////查询条件////////////
+    private String p_str;
+
+    private Integer count;
+
+//    public void setUserTotalScore(){
+//        this.user_total_score = 1000 - user_total_score/(user_check_num*1.00);
+//    }
+
+}

+ 5 - 0
Visuallnspection_fjq/visuallnspectioninteface/src/main/java/com/xintong/visualinspection/service/StatisticsService_F.java

@@ -4,6 +4,8 @@ import com.xintong.visualinspection.bean.FwqDeptStatistic;
 import com.xintong.visualinspection.bean.FwqStatisticsBean;
 import com.xintong.visualinspection.bean.FwqStatisticsBo;
 import com.xintong.visualinspection.pojo.fwq.FwqRankingData;
+import com.xintong.visualinspection.pojo.fwq.FwqStatisiticPojo;
+import com.xintong.visualinspection.pojo.fwq.ServiceAreaStatistic;
 
 import java.util.List;
 import java.util.Map;
@@ -49,4 +51,7 @@ public interface StatisticsService_F {
     // 各个问题类别的扣分情况
     Map<String,List<FwqStatisticsBean>> get2CheckedItemScoreInfo(FwqStatisticsBean obj);
 
+    //获取连续月达标的服务区
+    List<FwqStatisiticPojo> getFwqStatistic(ServiceAreaStatistic obj);
+
 }