Browse Source

Merge branch 'master' of http://git.xt.wenhq.top:8083/wenhongquan/VisualInspection

# Conflicts:
#	Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/mapper/master/StatisticsMapper.xml
#	Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/service/impl/StatisticsServiceImpl.java
MSI\liwei 7 years ago
parent
commit
85c89d983f

+ 2 - 2
VisualInspection/fwq/js/statistics/operation_management_integration.js

@@ -65,7 +65,7 @@ function gethtml(data, i, avg, lists) {
     strTbody += "<tr><td width='8%'>" + data.company_ranking2 + "</td>";
     strTbody += "<td width='8%'>" + data.name + "</td><td width='6%'>" + data.company_check_num +
         "</td><td width='6%'>" + data.company_total_score + "</td><td width='6%'>" + data.third_check_num +
-        "</td><td width='6%'>" + data.third_total_score + "</td><td width='6%'>" + data.onsite_check_num +
+        "</td><td width='6%'>" + data.third_total_score_handle + "</td><td width='6%'>" + data.onsite_check_num +
         "</td><td width='6%'>" + data.onsite_total_score + "</td><td width='8%'>" +
         data.check_total_avg + "</td>" +
         "<td width='8%'>" + data.score_avg + "</td>";
@@ -75,7 +75,7 @@ function gethtml(data, i, avg, lists) {
 
 function getTotalHtml(data) {
     var html = "<tr><td>合计</td><td></td><td>" + data.totalCompanyNum + "</td><td>" + data.totalCompanyScore + "</td><td>" +
-        data.totalThirdNum + "</td><td>" + data.totalThirdScore + "</td><td>" + data.totalOnsiteNum + "</td><td>" + data.totalOnsiteScore +
+        data.totalThirdNum + "</td><td>" + data.totalThirdScoreHandle + "</td><td>" + data.totalOnsiteNum + "</td><td>" + data.totalOnsiteScore +
          "</td><td>-</td><td>-</td></tr>";
     return html;
 }

+ 4 - 4
VisualInspection/js/assess_management/assess_item.js

@@ -277,16 +277,16 @@ function delete_check_item(id ){
             zdataItem["children"] = addobj(m);
              zdataItem.open = true ;
              console.log(user.position_name);
-             if(user.position_name.indexOf('清障队稽查管理员') === 0){
-                 if(m.id == 291 || m.id == 305 || m.id == 306 || m.id == 307){
+             if(user.position_name.indexOf('收费站稽查管理员') === 0){
+                 if(m.id == 271 || m.id == 47 || m.id == 412 || m.id == 208 || m.id == 211){
                     zdata.push(zdataItem);
                  }
              }else if(user.position_name.indexOf('服务区稽查管理员') === 0){
                 if(m.id == 502){
                     zdata.push(zdataItem);
                  }
-             }else if(user.position_name.indexOf('收费站站长') === 0){
-                if(m.id == 47){
+             }else if(user.position_name.indexOf('清障队稽查管理员') === 0){
+                if(m.id == 836){
                     zdata.push(zdataItem);
                  }
              }else{

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

@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.math.BigDecimal;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -62,12 +63,14 @@ public class StatisticsController_F extends BaseController {
                 totalThirdScore = 0,
                 totalOnsiteNum = 0,
                 totalOnsiteScore = 0;
+        BigDecimal totalThirdScoreHandle = new BigDecimal("0.00");
 
         for (FwqStatisticsBean bean : lists) {
             totalCompanyNum += bean.getCompany_check_num();
             totalCompanyScore += bean.getCompany_total_score();
             totalThirdNum += bean.getThird_check_num();
             totalThirdScore += bean.getThird_total_score();
+            totalThirdScoreHandle = totalThirdScoreHandle.add(bean.getThird_total_score_handle());
             totalOnsiteNum += bean.getOnsite_check_num();
             totalOnsiteScore += bean.getOnsite_total_score();
         }
@@ -77,6 +80,7 @@ public class StatisticsController_F extends BaseController {
         resultMap.put("totalCompanyScore", totalCompanyScore);
         resultMap.put("totalThirdNum", totalThirdNum);
         resultMap.put("totalThirdScore", totalThirdScore);
+        resultMap.put("totalThirdScoreHandle", totalThirdScoreHandle);
         resultMap.put("totalOnsiteNum", totalOnsiteNum);
         resultMap.put("totalOnsiteScore", totalOnsiteScore);
         return super.returnSuccessResult(resultMap);

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

@@ -23,7 +23,8 @@
     <select id="selectFeeStationCheckNum" parameterType="com.xintong.visualinspection.bean.FwqStatisticsBean"
             resultType="com.xintong.visualinspection.bean.FwqStatisticsBean">
         SELECT
-        COUNT(t.checked_dept) AS checked_num,
+        /*COUNT(t.checked_dept) AS checked_num,*/
+        15 AS checked_num,
         t.checked_dept AS dept_id
         FROM view_check_task t
         WHERE 1=1
@@ -80,7 +81,11 @@
 
     <select id="selectCheckedTimes" parameterType="com.xintong.visualinspection.bean.FwqStatisticsBean"
             resultType="com.xintong.visualinspection.bean.FwqStatisticsBean">
-        SELECT COUNT(1) AS checked_num , t.checked_dept dept_id FROM view_check_task t
+        SELECT
+            /*COUNT(1) AS checked_num, */
+            15 AS checked_num,
+            t.checked_dept dept_id
+        FROM view_check_task t
         WHERE 1=1
         <if test="dept_id != null and dept_id != ''">
             AND t.checked_dept =#{dept_id}
@@ -155,7 +160,8 @@
         a.*
         FROM (
         SELECT
-        count(t.id)     AS checked_num,
+        /*count(t.id)     AS checked_num,*/
+        15     AS checked_num,
         sum(cs.check_item_score) AS all_check_score,
         cs.check_item_id,
         cs.checked_dept as dept_id
@@ -179,24 +185,30 @@
     <select id="selectYearScoreInfo" parameterType="com.xintong.visualinspection.bean.FwqStatisticsBean"
             resultType="com.xintong.visualinspection.bean.FwqStatisticsBean">
         SELECT
-        sum(tab.checkd_all_score) AS all_check_score,
-        sum(tab.checked_num)      AS checked_num,
-        tab.mth
+        sum(a.all_check_score) AS all_check_score,
+        sum(a.checked_num)     AS checked_num,
+        a.mth
         FROM (
-        <include refid="selectAllCheckedInfoAllCheck"/>
-        ) tab
-        WHERE 1=1
-        <if test="dept_list!=null and queryType == 1 and dept_list.size()>0 ">
-            AND tab.checked_dept IN
-            <foreach item="obj" collection="dept_list" open="("
-                     separator="," close=")">
-                #{obj.id}
-            </foreach>
-        </if>
-        <if test="dept_id!=null and queryType ==2">
-            AND tab.checked_dept=#{dept_id}
-        </if>
-        GROUP BY tab.mth
+            SELECT
+            sum(tab.checkd_all_score) AS all_check_score,
+            sum(tab.checked_num)      AS checked_num,
+            tab.mth
+            FROM (
+            <include refid="selectAllCheckedInfoAllCheck"/>
+            ) tab
+            WHERE 1=1
+            GROUP BY tab.mth
+            UNION ALL
+            SELECT
+            sum(tab2.checkd_all_score) AS all_check_score,
+            sum(tab2.checked_num)      AS checked_num,
+            tab2.mth
+            FROM (
+            <include refid="selectAllOtherCheckedInfoAllCheck"/>
+            ) tab2
+            GROUP BY tab2.mth
+        ) a
+        GROUP BY a.mth
     </select>
 
     <select id="selectFeeStationCheckedScore" parameterType="com.xintong.visualinspection.bean.FwqStatisticsBean"
@@ -219,20 +231,36 @@
     <select id="selectFeeStationScoreInfo" parameterType="com.xintong.visualinspection.bean.FwqStatisticsBean"
             resultType="com.xintong.visualinspection.bean.FwqStatisticsBean">
         SELECT
-        sum(tab.checkd_all_score) AS all_check_score,
-        sum(tab.checked_num)      AS checked_num,
-        tab.checked_dept          AS dept_id
+        sum(a.all_check_score) AS all_check_score,
+        sum(a.checked_num)     AS checked_num,
+        a.dept_id AS dept_id
         FROM (
-        <include refid="selectAllCheckedInfoAllCheck"/>
-        ) tab
-        WHERE 1=1
-        GROUP BY tab.checked_dept
+            SELECT
+            sum(tab.checkd_all_score) AS all_check_score,
+            sum(tab.checked_num)      AS checked_num,
+            tab.checked_dept          AS dept_id
+            FROM (
+            <include refid="selectAllCheckedInfoAllCheck"/>
+            ) tab
+            GROUP BY tab.checked_dept
+            UNION ALL
+            SELECT
+            sum(tab2.checkd_all_score) AS all_check_score,
+            sum(tab2.checked_num)      AS checked_num,
+            tab2.dept_id AS dept_id
+            FROM (
+            <include refid="selectAllOtherCheckedInfoAllCheck"/>
+            ) tab2
+          GROUP BY tab2.dept_id
+          ) a
+        GROUP BY a.dept_id;
     </select>
 
     <select id="selectCheckedItemScoreInfo" parameterType="com.xintong.visualinspection.bean.FwqStatisticsBean"
             resultType="com.xintong.visualinspection.bean.FwqStatisticsBean">
         SELECT
-          count(DISTINCT m.task_id)   AS checked_num,
+          /*count(DISTINCT m.task_id)   AS checked_num,*/
+          15   AS checked_num,
           sum(m.check_item_score)     AS all_check_score,
           m.check_item_id,
           m.checked_dept              AS dept_id
@@ -244,13 +272,27 @@
         ORDER BY m.checked_dept
     </select>
 
-    <select id="selectlimituser"   parameterType="com.xintong.visualinspection.pojo.fwq.ServiceAreaStatistic" resultType="com.xintong.visualinspection.pojo.fwq.ServiceAreaStatistic">
-
+    <select id="selectlimituser" parameterType="com.xintong.visualinspection.pojo.fwq.ServiceAreaStatistic" resultType="com.xintong.visualinspection.pojo.fwq.ServiceAreaStatistic">
         select a.* from (
-        <include refid="selectc"/>
+        <choose>
+            <when test="sctype != null &amp;&amp; sctype != '' &amp;&amp; sctype == 2 ">
+                <include refid="selectc"/>
+            </when>
+            <otherwise>
+                <include refid="selectcwxfw"/>
+            </otherwise>
+        </choose>
         ) 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} )
-
+        COUNT(dept_id) AS COUNT from (
+        <choose>
+            <when test="sctype != null &amp;&amp; sctype != '' &amp;&amp; sctype == 2 ">
+                <include refid="selectc"/>
+            </when>
+            <otherwise>
+                <include refid="selectcwxfw"/>
+            </otherwise>
+        </choose>
+        ) p GROUP BY p.dept_id ) d where d.count >= #{limitnumber} )
     </select>
 
     <sql id="selectc">
@@ -264,6 +306,17 @@
         GROUP BY dept_id, period_id
     </sql>
 
+    <sql id="selectcwxfw">
+        SELECT *
+        FROM
+        check_dept_score AS user_total_score
+        WHERE
+        period_id >= #{startperiod_id}
+        AND period_id &lt;= #{endperiod_id}
+        AND score_wxfw >= #{limitscore} AND score_wxfw &lt;= #{limitscore2}
+        GROUP BY dept_id, period_id
+    </sql>
+
 
     <sql id="selectOneAllCheckedInfoData">
         SELECT
@@ -274,7 +327,8 @@
         FROM
         (
         SELECT
-        COUNT(t.id)             AS checked_num,
+        /*COUNT(t.id)             AS checked_num,*/
+        15             AS checked_num,
         monthfunc(t.start_time) AS mth,
         t.checked_dept
         FROM
@@ -329,7 +383,8 @@
         FROM
         (
         SELECT
-        COUNT(t.checked_dept)   AS checked_num,
+        /*COUNT(t.checked_dept)   AS checked_num,*/
+        15   AS checked_num,
         monthfunc(t.start_time) AS mth,
         t.id,
         t.checked_dept
@@ -377,6 +432,80 @@
         AND check_num_t.mth = checked_score_t.mth
     </sql>
 
+    <!--第三方扣分-包含未扣分的-->
+    <sql id="selectAllOtherCheckedInfoAllCheck">
+        SELECT
+        other_check_num_t.checked_num,
+        other_check_num_t.mth,
+        IFNULL(other_checked_score_t.checkd_all_score, 0) AS checkd_all_score,
+        other_check_num_t.dept_id
+        FROM
+        (
+        SELECT
+        COUNT(oc.dept_id)  AS checked_num,
+        oc.check_time_name AS mth,
+        oc.dept_id
+        FROM
+        other_check oc
+        WHERE 1=1
+        <if test="start_date !=null">
+            AND oc.check_time >= #{start_date}
+        </if>
+        <if test="end_date !=null">
+            AND oc.check_time &lt; #{end_date}
+        </if>
+        <if test="mth!=null and mth!=''">
+            AND oc.check_time_name =#{mth}
+        </if>
+        GROUP BY
+        oc.dept_id,
+        oc.check_time_name
+        ) other_check_num_t
+        LEFT JOIN (
+                SELECT
+                oc.mth,
+                sum(oc.checkd_all_score) AS checkd_all_score,
+                oc.dept_id
+                FROM (
+                SELECT
+                oc.check_time_name  AS mth,
+                sum(oc.check_score) AS checkd_all_score,
+                dept_id
+                FROM other_check oc
+                WHERE check_type = 9
+                <if test="start_date !=null">
+                    AND oc.check_time >= #{start_date}
+                </if>
+                <if test="end_date !=null">
+                    AND oc.check_time &lt; #{end_date}
+                </if>
+                <if test="mth!=null and mth!=''">
+                    AND oc.check_time_name =#{mth}
+                </if>
+                GROUP BY mth, oc.dept_id
+                UNION ALL
+                SELECT
+                oc.check_time_name  AS mth,
+                truncate(sum(oc.check_score)/0.9,2) AS checkd_all_score,
+                dept_id
+                FROM other_check oc
+                WHERE check_type = 8
+                <if test="start_date !=null">
+                    AND oc.check_time >= #{start_date}
+                </if>
+                <if test="end_date !=null">
+                    AND oc.check_time &lt; #{end_date}
+                </if>
+                <if test="mth!=null and mth!=''">
+                    AND oc.check_time_name =#{mth}
+                </if>
+                GROUP BY mth, oc.dept_id
+                ) oc
+            GROUP BY mth,oc.dept_id
+        ) other_checked_score_t ON other_checked_score_t.dept_id = other_check_num_t.dept_id
+        AND other_check_num_t.mth = other_checked_score_t.mth
+    </sql>
+
 </mapper>
 
 

+ 93 - 64
Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/service/impl/StatisticsServiceImpl.java

@@ -21,9 +21,12 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Calendar;
 import java.util.Comparator;
 import java.util.Date;
 import java.util.HashMap;
@@ -74,7 +77,7 @@ public class StatisticsServiceImpl implements StatisticsService_F {
         }
 
         // 获取公司检查的某个收费站的受检次数和扣分合计
-        List<FwqStatisticsBean> company_beans =  getFeeStationCheckItemScore(obj);
+        List<FwqStatisticsBean> company_beans = getFeeStationCheckItemScore(obj);
         // 获取第三方暗访稽查的某个服务区的受检次数和扣分合计
         obj.setCheck_type(8);
         List<FwqStatisticsBean> third_beans = fwqStatisticsDao.getselectFeeStationOperationScoreDetail(obj);
@@ -83,12 +86,17 @@ public class StatisticsServiceImpl implements StatisticsService_F {
         List<FwqStatisticsBean> onsite_beans = fwqStatisticsDao.getselectFeeStationOperationScoreDetail(obj);
 
         for (FwqStatisticsBean company_bean : company_beans) {
-            mapStationInfos.get(company_bean.getDept_id()).setCompany_check_num(company_bean.getChecked_num());
+//            mapStationInfos.get(company_bean.getDept_id()).setCompany_check_num(company_bean.getChecked_num());
+            // 公司稽查固定15次稽查
+            mapStationInfos.get(company_bean.getDept_id()).setCompany_check_num(15);
             mapStationInfos.get(company_bean.getDept_id()).setCompany_total_score(company_bean.getAll_check_score());
         }
         for (FwqStatisticsBean third_bean : third_beans) {
             mapStationInfos.get(third_bean.getDept_id()).setThird_check_num(third_bean.getChecked_num() > 1 ? 1 : third_bean.getChecked_num());
             mapStationInfos.get(third_bean.getDept_id()).setThird_total_score(third_bean.getCheck_total_score());
+            // 2018年09月11日 处理第三方暗访的得分除以0.9
+            third_bean.setThird_total_score_handle(BigDecimal.valueOf(third_bean.getCheck_total_score()).divide(BigDecimal.valueOf(0.9), 2, RoundingMode.HALF_UP));
+            mapStationInfos.get(third_bean.getDept_id()).setThird_total_score_handle(third_bean.getThird_total_score_handle());
         }
 
         for (FwqStatisticsBean onsite_bean : onsite_beans) {
@@ -101,20 +109,24 @@ public class StatisticsServiceImpl implements StatisticsService_F {
         DecimalFormat df = new DecimalFormat("0.00");
         for (Map.Entry<Long, FwqStatisticsBean> station : stationInfos) {
             float avg = 0;
+            float avgWxfw = 0;
             FwqStatisticsBean value = station.getValue();
             value.setThird_check_num(1);
             value.setOnsite_check_num(1);
             // 设置总平均扣分
             if (value.getCompany_check_num() > 0 || value.getThird_check_num() > 0) {
-                avg += (value.getCompany_total_score() + value.getThird_total_score()) / 2.0 / (value.getCompany_check_num() + value.getThird_check_num());
-            }
-            if (value.getOnsite_check_num() > 0) {
-                avg += value.getOnsite_total_score() / 2.0 / value.getOnsite_check_num();
+                avgWxfw += value.getCompany_total_score() / 15.0;
+                avg += value.getCompany_total_score() / 15.0 * 0.3 + value.getThird_total_score() * 0.4 + value.getOnsite_total_score() * 0.3;
             }
+//            if (value.getOnsite_check_num() > 0) {
+//                avg += value.getOnsite_total_score() / 2.0 / value.getOnsite_check_num();
+//            }
             value.setCheck_total_avg(df.format(avg));
             // 设置平均得分
             Float score_avg = (1000 - Float.valueOf(df.format(avg)));
+            Float score_wxfw_avg = (1000 - Float.valueOf(df.format(avgWxfw)));
             value.setScore_avg(score_avg.toString());
+            value.setScore_wxfw_avg(score_wxfw_avg.toString());
         }
         List<FwqStatisticsBean> sortList = new ArrayList<>(mapStationInfos.values());
         sortList.sort(new Comparator<FwqStatisticsBean>() {
@@ -152,12 +164,13 @@ public class StatisticsServiceImpl implements StatisticsService_F {
             }
         }
 
-        CheckTaskPeriod period = commonService.getCheckTaskPeriod(obj.getStart_date().getTime()+1 * 1000 * 60 * 60, obj.getEnd_date().getTime()+1 * 1000 * 60 * 60);
+        CheckTaskPeriod period = commonService.getCheckTaskPeriod(obj.getStart_date().getTime() + 1 * 1000 * 60 * 60, obj.getEnd_date().getTime() + 1 * 1000 * 60 * 60);
 
         if (period != null) {
             for (FwqStatisticsBean s : sortList) {
                 FwqDeptStatistic ss = new FwqDeptStatistic();
                 ss.setScore(Double.parseDouble(s.getScore_avg()));
+                ss.setScoreWxfw(Double.parseDouble(s.getScore_wxfw_avg()));
                 ss.setIntegral(sortList.size() - s.getCompany_ranking2() + 1);
                 ss.setDept_id(s.getDept_id());
                 ss.setPeriod_id(period.getId());
@@ -387,7 +400,7 @@ public class StatisticsServiceImpl implements StatisticsService_F {
         }
 
         if (obj.getStart_date() != null && obj.getEnd_date() != null) {
-            CheckTaskPeriod p = commonService.getCheckTaskPeriod(obj.getStart_date().getTime()+1 * 1000 * 60 * 60, obj.getEnd_date().getTime()+1 * 1000 * 60 * 60);
+            CheckTaskPeriod p = commonService.getCheckTaskPeriod(obj.getStart_date().getTime() + 1 * 1000 * 60 * 60, obj.getEnd_date().getTime() + 1 * 1000 * 60 * 60);
             if (p != null) {
                 obj.setPeriod_id(p.getId());
             }
@@ -406,11 +419,15 @@ public class StatisticsServiceImpl implements StatisticsService_F {
 
         // 处理同一个服务区中,如果item的parent_id是一样的话,将这些数据结合在一起
         for (FwqStatisticsBean sta : listCheckedScore) {
-            sta.setItem_id(itemMap.get(sta.getCheck_item_id().longValue()).getParent_id().intValue());
+            Item item = itemMap.get(sta.getCheck_item_id().longValue());
+            if (item != null) {
+                sta.setItem_id(item.getParent_id().intValue());
+            }
         }
         for (int i = 0; i < listCheckedScore.size(); i++) {
             for (int j = listCheckedScore.size() - 1; j > i; j--) {
-                if (listCheckedScore.get(j).getDept_id().equals(listCheckedScore.get(i).getDept_id()) && listCheckedScore.get(j).getItem_id().equals(listCheckedScore.get(i).getItem_id())) {
+                if (listCheckedScore.get(j).getDept_id() != null && listCheckedScore.get(j).getDept_id().equals(listCheckedScore.get(i).getDept_id()) && listCheckedScore.get(j).getItem_id() != null && listCheckedScore.get(j).getItem_id().equals
+                        (listCheckedScore.get(i).getItem_id())) {
                     listCheckedScore.get(i).setScore(listCheckedScore.get(i).getScore() + listCheckedScore.get(j).getScore());
                     listCheckedScore.remove(j);
                 }
@@ -476,8 +493,13 @@ public class StatisticsServiceImpl implements StatisticsService_F {
     @Override
     public FwqRankingData getEmployeeRankingData(FwqStatisticsBean obj) {
         FwqRankingData data = new FwqRankingData();
-
-        CheckTaskPeriod lastTaskPeriod = commonService.getCheckTaskPeriod(obj.getStart_date().getTime()+1 * 1000 * 60 * 60, obj.getEnd_date().getTime()+1 * 1000 * 60 * 60);
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(obj.getStart_date());
+        cal.add(Calendar.MONTH, -1);
+        Calendar cal2 = Calendar.getInstance();
+        cal2.setTime(obj.getEnd_date());
+        cal2.add(Calendar.MONTH, -1);
+        CheckTaskPeriod lastTaskPeriod = commonService.getCheckTaskPeriod(cal.getTime().getTime() + 1 * 1000 * 60 * 60, cal2.getTime().getTime() + 1 * 1000 * 60 * 60);
         if (lastTaskPeriod != null) {
             FwqStatisticsBean temp = new FwqStatisticsBean();
             temp.setStart_date(new Date(lastTaskPeriod.getStarttime().getTime() - 1 * 1000 * 60 * 60));
@@ -606,11 +628,14 @@ public class StatisticsServiceImpl implements StatisticsService_F {
         Map<Long, Organ> deptMap = commonService.getDeptMap();
         // 将list中的数据找到项目的父项目,然后去除重复的
         for (FwqStatisticsBean sta : list) {
-            sta.setItem_id(itemMap.get(sta.getCheck_item_id().longValue()).getParent_id().intValue());
+            Item item = itemMap.get(sta.getCheck_item_id().longValue());
+            if (item != null) {
+                sta.setItem_id(item.getParent_id().intValue());
+            }
         }
         for (int i = 0; i < list.size(); i++) {
             for (int j = list.size() - 1; j > i; j--) {
-                if (list.get(j).getDept_id().equals(list.get(i).getDept_id()) && list.get(j).getItem_id().equals(list.get(i).getItem_id())) {
+                if (list.get(j).getDept_id().equals(list.get(i).getDept_id()) && list.get(j).getItem_id() != null && list.get(j).getItem_id().equals(list.get(i).getItem_id())) {
                     list.get(i).setScore(list.get(i).getScore() + list.get(j).getScore());
                     list.remove(j);
                 }
@@ -643,7 +668,7 @@ public class StatisticsServiceImpl implements StatisticsService_F {
             if (statisticBoMap.containsKey(statisticsBean.getDept_id())) {
                 FwqStatisticsBo tmp = statisticBoMap.get(statisticsBean.getDept_id());
                 // 组装扣分类型内容
-                if (itemMap.get(statisticsBean.getCheck_item_id().longValue()).getParent_id() != null) {
+                if (itemMap.get(statisticsBean.getCheck_item_id().longValue()) != null && itemMap.get(statisticsBean.getCheck_item_id().longValue()).getParent_id() != null) {
                     statisticsBean.setId(itemMap.get(statisticsBean.getCheck_item_id().longValue()).getParent_id().intValue());
                     if (itemMap.get(statisticsBean.getCheck_item_id().longValue()).getScore() == null) {
                         statisticsBean.setName(itemMap.get(statisticsBean.getCheck_item_id().longValue()).getName());
@@ -770,31 +795,32 @@ public class StatisticsServiceImpl implements StatisticsService_F {
             FwqStatisticsBean obj2 = new FwqStatisticsBean();
             obj2.setDept_id(Long.valueOf(sta.getDeptid()));
             obj2.setName(sta.getName());
-            // 30:连云港道管;31:盐城道管;32:南通道管
-            if ("30".equals(sta.getParentid())) {
-                obj2.setId(1);
-            } else if ("31".equals(sta.getParentid())) {
-                obj2.setId(2);
-            } else if ("32".equals(sta.getParentid())) {
-                obj2.setId(3);
-            }
+//            // 30:连云港道管;31:盐城道管;32:南通道管
+//            if ("30".equals(sta.getParentid())) {
+//                obj2.setId(1);
+//            } else if ("31".equals(sta.getParentid())) {
+//                obj2.setId(2);
+//            } else if ("32".equals(sta.getParentid())) {
+//                obj2.setId(3);
+//            }
+            obj2.setChecked_num(15);
             mapStationInfos.put(Long.valueOf(sta.getDeptid()), obj2);
         }
 
         if (obj.getStart_date() != null && obj.getEnd_date() != null) {
-            CheckTaskPeriod p = commonService.getCheckTaskPeriod(obj.getStart_date().getTime()+1 * 1000 * 60 * 60, obj.getEnd_date().getTime()+1 * 1000 * 60 * 60);
+            CheckTaskPeriod p = commonService.getCheckTaskPeriod(obj.getStart_date().getTime() + 1 * 1000 * 60 * 60, obj.getEnd_date().getTime() + 1 * 1000 * 60 * 60);
             if (p != null) {
                 obj.setPeriod_id(p.getId());
             }
         }
 
-        // 检查次数
-        List<FwqStatisticsBean> listCheckNum = fwqStatisticsDao.selectFeeStationCheckNum(obj);
-        for (FwqStatisticsBean sta : listCheckNum) {
-            if (mapStationInfos.containsKey(sta.getDept_id())) {
-                mapStationInfos.get(sta.getDept_id()).setChecked_num(sta.getChecked_num());
-            }
-        }
+        // 检查次数     此处注释是为了统一每个服务区的检查次数都是15次
+//        List<FwqStatisticsBean> listCheckNum = fwqStatisticsDao.selectFeeStationCheckNum(obj);
+//        for (FwqStatisticsBean sta : listCheckNum) {
+//            if (mapStationInfos.containsKey(sta.getDept_id())) {
+//                mapStationInfos.get(sta.getDept_id()).setChecked_num(sta.getChecked_num());
+//            }
+//        }
 
         List<FwqStatisticsBo> list = getEmployeeCheckedInfo(obj);
         Map<Integer, FwqStatisticsBo> listmap = new HashMap<>();
@@ -829,36 +855,36 @@ public class StatisticsServiceImpl implements StatisticsService_F {
 
         List<FwqStatisticsBean> sortList = new ArrayList<>(mapStationInfos.values());
 
-        sortList.sort(new Comparator<FwqStatisticsBean>() {
-            @Override
-            public int compare(FwqStatisticsBean o1, FwqStatisticsBean o2) {
-                if (o1.getId() > o2.getId()) {
-                    return 1;
-                } else if (o1.getId().equals(o2.getId())) {
-                    if (o1.getChecked_num() != 0 && o2.getChecked_num() != 0) {
-                        if (o1.getAll_check_score() / (o1.getChecked_num() + 0.0) > o2.getAll_check_score()
-                                / (o2.getChecked_num() + 0.0)) {
-                            return 1;
-                        } else if (o1.getAll_check_score() / (o1.getChecked_num() + 0.0) < o2.getAll_check_score()
-                                / (o2.getChecked_num() + 0.0)) {
-                            return -1;
-                        } else {
-                            return 0;
-                        }
-                    } else {
-                        if (o1.getChecked_num() == 0) {
-                            return -1;
-                        } else if (o2.getChecked_num() == 0) {
-                            return 1;
-                        } else {
-                            return 0;
-                        }
-                    }
-                } else {
-                    return -1;
-                }
-            }
-        });
+//        sortList.sort(new Comparator<FwqStatisticsBean>() {
+//            @Override
+//            public int compare(FwqStatisticsBean o1, FwqStatisticsBean o2) {
+//                if (o1.getId() > o2.getId()) {
+//                    return 1;
+//                } else if (o1.getId().equals(o2.getId())) {
+//                    if (o1.getChecked_num() != 0 && o2.getChecked_num() != 0) {
+//                        if (o1.getAll_check_score() / (o1.getChecked_num() + 0.0) > o2.getAll_check_score()
+//                                / (o2.getChecked_num() + 0.0)) {
+//                            return 1;
+//                        } else if (o1.getAll_check_score() / (o1.getChecked_num() + 0.0) < o2.getAll_check_score()
+//                                / (o2.getChecked_num() + 0.0)) {
+//                            return -1;
+//                        } else {
+//                            return 0;
+//                        }
+//                    } else {
+//                        if (o1.getChecked_num() == 0) {
+//                            return -1;
+//                        } else if (o2.getChecked_num() == 0) {
+//                            return 1;
+//                        } else {
+//                            return 0;
+//                        }
+//                    }
+//                } else {
+//                    return -1;
+//                }
+//            }
+//        });
 
         return sortList;
     }
@@ -990,15 +1016,18 @@ public class StatisticsServiceImpl implements StatisticsService_F {
         objList = fwqStatisticsDao.selectCheckedItemScoreInfo(obj);
 
         for (FwqStatisticsBean sta : objList) {
-            sta.setItem_id(itemMap.get(sta.getCheck_item_id().longValue()).getParent_id().intValue());
-            sta.setName(itemMap.get(itemMap.get(sta.getCheck_item_id().longValue()).getParent_id()).getName());
+            Item item = itemMap.get(sta.getCheck_item_id().longValue());
+            if (item != null) {
+                sta.setItem_id(item.getParent_id().intValue());
+                sta.setName(itemMap.get(item.getParent_id()).getName());
+            }
             sta.setFeeStationName(deptMap.get(sta.getDept_id()).getOrganname());
             sta.setPfeeStationName(deptMap.get(deptMap.get(sta.getDept_id()).getParentid().longValue()).getOrganname());
             sta.setParent_dept_id(deptMap.get(sta.getDept_id()).getParentid().longValue());
         }
         for (int i = 0; i < objList.size(); i++) {
             for (int j = objList.size() - 1; j > i; j--) {
-                if (objList.get(j).getDept_id().equals(objList.get(i).getDept_id()) && objList.get(j).getItem_id().equals(objList.get(i).getItem_id())) {
+                if (objList.get(j).getDept_id() != null && objList.get(j).getDept_id().equals(objList.get(i).getDept_id()) && objList.get(j).getItem_id() != null && objList.get(j).getItem_id().equals(objList.get(i).getItem_id())) {
                     objList.get(i).setAll_check_score(objList.get(i).getAll_check_score() + objList.get(j).getAll_check_score());
                     objList.get(i).setChecked_num(objList.get(i).getChecked_num() + objList.get(j).getChecked_num());
                     objList.remove(j);

+ 5 - 0
Visuallnspection_fjq/visuallnspection_fjq/src/main/java/com/xintong/visualinspection/visuallnspection_fjq/service/impl/StatisticsService_FImpl.java

@@ -27,6 +27,8 @@ import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
@@ -87,6 +89,9 @@ public class StatisticsService_FImpl implements StatisticsService_F {
         for (FwqStatisticsBean third_bean : third_beans) {
             mapStationInfos.get(third_bean.getDept_id()).setThird_check_num(third_bean.getChecked_num() > 1 ? 1 : third_bean.getChecked_num());
             mapStationInfos.get(third_bean.getDept_id()).setThird_total_score(third_bean.getCheck_total_score());
+            // 2018年09月11日 处理第三方暗访的得分除以0.9
+            third_bean.setThird_total_score_handle(BigDecimal.valueOf(third_bean.getCheck_total_score()).divide(BigDecimal.valueOf(0.9), 2, RoundingMode.HALF_UP));
+            mapStationInfos.get(third_bean.getDept_id()).setThird_total_score_handle(third_bean.getThird_total_score_handle());
         }
 
         for (FwqStatisticsBean onsite_bean : onsite_beans) {

+ 3 - 0
Visuallnspection_fjq/visuallnspectioninteface/src/main/java/com/xintong/visualinspection/bean/FwqStatisticsBean.java

@@ -6,6 +6,7 @@ import lombok.Data;
 import org.springframework.format.annotation.DateTimeFormat;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -145,6 +146,8 @@ public class FwqStatisticsBean implements Serializable {
     private Integer third_check_num = 0;
     // 第三方暗访扣分合计
     private Integer third_total_score = 0;
+    // 第三方暗访扣分合计(除以0.9)
+    private BigDecimal third_total_score_handle = new BigDecimal("0.00");
     // 现场受检次数
     private Integer onsite_check_num = 0;
     // 现场扣分合计