Browse Source

Merge branch 'master' into develop

wangxiaoming 5 years ago
parent
commit
dc23f4b60f

+ 10 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/fm/ComplaintDetectInfo.java

@@ -140,6 +140,8 @@ public class ComplaintDetectInfo implements Serializable {
     private Integer detectIsDownload;
     private String signclosedCustomerDesc;//签收客服备注
 
+    private Integer countNum;//数量
+
     public String getQuestionName() {
         return questionName;
     }
@@ -898,4 +900,12 @@ public class ComplaintDetectInfo implements Serializable {
     public void setSignclosedCustomerDesc(String signclosedCustomerDesc) {
         this.signclosedCustomerDesc = signclosedCustomerDesc;
     }
+
+    public Integer getCountNum() {
+        return countNum;
+    }
+
+    public void setCountNum(Integer countNum) {
+        this.countNum = countNum;
+    }
 }

+ 125 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/fm/DetectStatistics.java

@@ -0,0 +1,125 @@
+package com.iamberry.rst.core.fm;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public class DetectStatistics implements Serializable {
+    private static final long serialVersionUID = -917161067185690800L;
+
+    //维修主键
+    private Integer detectId;
+    //生产年份
+    private String detectProduction;
+    //创建时间
+    private Date detectCreateTime;
+    //配置ID
+    private Integer configId;
+    //配置ID
+    private Integer configNumber;
+    //类型 检测类别1工厂检测现象2. 故障原因3. 判定结果4. 故障指向5. 原因分析
+    private Integer configType;
+
+    //配置属性名称
+    private String configDetectContent;
+
+    private String beginTime;                 //开始时间
+    private String endTime;                   //结束时间
+
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
+    private Date startDate;                 //开始时间
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
+    private Date endDate;                   //结束时间
+
+    public Integer getDetectId() {
+        return detectId;
+    }
+
+    public void setDetectId(Integer detectId) {
+        this.detectId = detectId;
+    }
+
+    public String getDetectProduction() {
+        return detectProduction;
+    }
+
+    public void setDetectProduction(String detectProduction) {
+        this.detectProduction = detectProduction;
+    }
+
+    public Date getDetectCreateTime() {
+        return detectCreateTime;
+    }
+
+    public void setDetectCreateTime(Date detectCreateTime) {
+        this.detectCreateTime = detectCreateTime;
+    }
+
+    public Integer getConfigId() {
+        return configId;
+    }
+
+    public void setConfigId(Integer configId) {
+        this.configId = configId;
+    }
+
+    public Integer getConfigNumber() {
+        return configNumber;
+    }
+
+    public void setConfigNumber(Integer configNumber) {
+        this.configNumber = configNumber;
+    }
+
+    public Integer getConfigType() {
+        return configType;
+    }
+
+    public void setConfigType(Integer configType) {
+        this.configType = configType;
+    }
+
+    public Date getStartDate() {
+        return startDate;
+    }
+
+    public void setStartDate(Date startDate) {
+        this.startDate = startDate;
+    }
+
+    public Date getEndDate() {
+        return endDate;
+    }
+
+    public void setEndDate(Date endDate) {
+        this.endDate = endDate;
+    }
+
+    public String getBeginTime() {
+        return beginTime;
+    }
+
+    public void setBeginTime(String beginTime) {
+        this.beginTime = beginTime;
+    }
+
+    public String getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(String endTime) {
+        this.endTime = endTime;
+    }
+
+    public String getConfigDetectContent() {
+        return configDetectContent;
+    }
+
+    public void setConfigDetectContent(String configDetectContent) {
+        this.configDetectContent = configDetectContent;
+    }
+}

+ 55 - 0
watero-rst-interface/src/main/java/com/iamberry/rst/faces/fm/DetectStatisticService.java

@@ -0,0 +1,55 @@
+package com.iamberry.rst.faces.fm;
+
+import com.iamberry.rst.core.fm.ComplaintDetectInfo;
+import com.iamberry.rst.core.fm.DetectStatistics;
+import com.iamberry.rst.core.fm.DetectionConfig;
+
+import java.util.List;
+
+public interface DetectStatisticService {
+
+    /**
+     * 获取本月全部故障机器所对应的生产日期的月份与数量
+     * @return
+     */
+    List<ComplaintDetectInfo> getAllMalfunctionByMonth();
+
+    /**
+     * 获取固定生产时间类的,某个类型的检测的所有配置数据
+     * @return
+     */
+    List<DetectStatistics> getDetectConfigList(DetectStatistics detectStatistics);
+
+    /**
+     * 获取固定生产时间类的,某个类型的检测的所有生产日期
+     * @return
+     */
+    List<DetectStatistics> getDetectProductionList(DetectStatistics detectStatistics);
+
+    /**
+     * 获取固定生产时间类的,某个类型的检测的所有条目
+     * @return
+     */
+    List<DetectStatistics> getDetectList(DetectStatistics detectStatistics);
+
+    /**
+     * 根据类型查询所有的配置数据
+     * @return
+     */
+    List<DetectionConfig> getDetectConfigByTypeList(DetectionConfig detectionConfig);
+
+    /**
+     * 获取所有的返厂日期
+     * @param detectStatistics
+     * @return
+     */
+    List<DetectStatistics> getCreatTimeByConfigIdList(DetectStatistics detectStatistics);
+
+    /**
+     * 依据某个configId , 返厂日期与出厂日期对应的机器的台数
+     * @param detectStatistics
+     * @return
+     */
+    List<DetectStatistics> getDetectAllByConfigIdList(DetectStatistics detectStatistics)
+
+}

+ 54 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/fm/DetectStatisticServiceImpl.java

@@ -0,0 +1,54 @@
+package com.iamberry.rst.service.fm;
+
+import com.iamberry.rst.core.fm.ComplaintDetectInfo;
+import com.iamberry.rst.core.fm.DetectStatistics;
+import com.iamberry.rst.core.fm.DetectionConfig;
+import com.iamberry.rst.faces.fm.DetectStatisticService;
+import com.iamberry.rst.service.fm.mapper.DetectStatisticMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class DetectStatisticServiceImpl implements DetectStatisticService {
+
+    @Autowired
+    private DetectStatisticMapper detectStatisticMapper;
+
+    @Override
+    public List<ComplaintDetectInfo> getAllMalfunctionByMonth() {
+        return detectStatisticMapper.getAllMalfunctionByMonth();
+    }
+
+    @Override
+    public List<DetectStatistics> getDetectConfigList(DetectStatistics detectStatistics) {
+        return detectStatisticMapper.getDetectConfigList(detectStatistics);
+    }
+
+    @Override
+    public List<DetectStatistics> getDetectProductionList(DetectStatistics detectStatistics) {
+        return detectStatisticMapper.getDetectProductionList(detectStatistics);
+    }
+
+    @Override
+    public List<DetectStatistics> getDetectList(DetectStatistics detectStatistics) {
+        return detectStatisticMapper.getDetectList(detectStatistics);
+    }
+
+    @Override
+    public List<DetectionConfig> getDetectConfigByTypeList(DetectionConfig detectionConfig) {
+        return detectStatisticMapper.getDetectConfigByTypeList(detectionConfig);
+    }
+
+
+    @Override
+    public List<DetectStatistics> getCreatTimeByConfigIdList(DetectStatistics detectStatistics) {
+        return detectStatisticMapper.getCreatTimeByConfigIdList(detectStatistics);
+    }
+
+    @Override
+    public List<DetectStatistics> getDetectAllByConfigIdList(DetectStatistics detectStatistics) {
+        return detectStatisticMapper.getDetectAllByConfigIdList(detectStatistics);
+    }
+}

+ 53 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/fm/mapper/DetectStatisticMapper.java

@@ -0,0 +1,53 @@
+package com.iamberry.rst.service.fm.mapper;
+
+import com.iamberry.rst.core.fm.ComplaintDetectInfo;
+import com.iamberry.rst.core.fm.DetectStatistics;
+import com.iamberry.rst.core.fm.DetectionConfig;
+
+import java.util.List;
+
+public interface DetectStatisticMapper {
+
+    /**
+     * 获取本月全部故障机器所对应的生产日期的月份与数量
+     * @return
+     */
+    List<ComplaintDetectInfo> getAllMalfunctionByMonth();
+
+    /**
+     * 获取固定生产时间类的,某个类型的检测的所有配置数据
+     * @return
+     */
+    List<DetectStatistics> getDetectConfigList(DetectStatistics detectStatistics);
+
+    /**
+     * 获取固定生产时间类的,某个类型的检测的所有生产日期
+     * @return
+     */
+    List<DetectStatistics> getDetectProductionList(DetectStatistics detectStatistics);
+
+    /**
+     * 获取固定生产时间类的,某个类型的检测的所有条目
+     * @return
+     */
+    List<DetectStatistics> getDetectList(DetectStatistics detectStatistics);
+
+    /**
+     * 根据类型查询所有的配置数据
+     * @return
+     */
+    List<DetectionConfig> getDetectConfigByTypeList(DetectionConfig detectionConfig);
+
+    /**
+     * 依据某个config 来获取所有的 返厂时间
+     * @return
+     */
+    List<DetectStatistics> getCreatTimeByConfigIdList(DetectStatistics detectStatistics);
+
+    /**
+     * 依据某个configId , 返厂日期与出厂日期对应的机器的台数
+     * @return
+     */
+    List<DetectStatistics> getDetectAllByConfigIdList(DetectStatistics detectStatistics);
+
+}

+ 180 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/fm/mapper/detectStatisticMapper.xml

@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.iamberry.rst.service.fm.mapper.DetectStatisticMapper" >
+
+
+    <select id="getAllMalfunctionByMonth" resultType="ComplaintDetectInfo"   parameterType="DetectionConfig">
+        SELECT
+            COUNT(detect_id) AS countNum,
+            IF(detect_production = '','未知',ifnull(detect_production,'未知')) AS detect_production,
+            detect_create_time
+        FROM tb_rst_complaint_detect
+        WHERE DATE_FORMAT(detect_create_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
+        GROUP BY detect_production
+        ORDER BY detect_production
+    </select>
+
+    <select id="getDetectProductionList" resultType="DetectStatistics"   parameterType="DetectionConfig">
+        SELECT
+            t.detect_id,
+            IF(t.detect_production = '','未知',ifnull(t.detect_production,'未知')) AS detect_production,
+            t.detect_create_time,
+            cdc.config_id,
+            cdc.config_detect_content,
+            cdc.config_type
+        FROM tb_rst_complaint_detect t
+        LEFT JOIN tb_rst_complaint_detection_item cdi ON t.detect_id = cdi.detect_id
+        LEFT JOIN tb_rst_complaint_detection_config cdc ON cdi.item_config_id = cdc.config_id
+        <where>
+            <if test="configType != null ">
+                AND  cdc.config_type = #{configType}
+            </if >
+            <if test="configId != null ">
+                AND  cdi.item_config_id = #{configId}
+            </if >
+            <if test="beginTime != null and beginTime != ''">
+                AND t.detect_production &gt;= #{beginTime}
+            </if >
+            <if test="endTime != null and endTime != ''">
+                AND t.detect_production &lt;= #{endTime}
+            </if >
+        </where>
+        GROUP BY t.detect_production
+        ORDER BY t.detect_production
+    </select>
+
+    <select id="getDetectConfigList" resultType="DetectStatistics"  parameterType="DetectionConfig" >
+        SELECT
+        t.detect_id,
+        t.detect_production,
+        t.detect_create_time,
+        cdc.config_id,
+        COUNT(cdc.config_id) AS configNumber,
+        cdc.config_detect_content,
+        cdc.config_type
+        FROM tb_rst_complaint_detect t
+        LEFT JOIN tb_rst_complaint_detection_item cdi ON t.detect_id = cdi.detect_id
+        LEFT JOIN tb_rst_complaint_detection_config cdc ON cdi.item_config_id = cdc.config_id
+        <where>
+            <if test="configType != null ">
+                AND  cdc.config_type = #{configType}
+            </if >
+            <if test="configId != null ">
+                AND  cdi.item_config_id = #{configId}
+            </if >
+            <if test="beginTime != null and beginTime != ''">
+                AND t.detect_production &gt;= #{beginTime}
+            </if >
+            <if test="endTime != null and endTime != ''">
+                AND t.detect_production &lt;= #{endTime}
+            </if >
+        </where>
+        GROUP BY cdc.config_id
+        ORDER BY configNumber DESC
+    </select>
+
+    <select id="getDetectList" resultType="DetectStatistics" parameterType="DetectionConfig" >
+        SELECT
+        t.detect_id,
+        IF(t.detect_production = '','未知',ifnull(t.detect_production,'未知')) AS detect_production,
+        t.detect_create_time,
+        cdc.config_id,
+        COUNT(cdc.config_id) AS configNumber,
+        cdc.config_detect_content,
+        cdc.config_type
+        FROM tb_rst_complaint_detect t
+        LEFT JOIN tb_rst_complaint_detection_item cdi ON t.detect_id = cdi.detect_id
+        LEFT JOIN tb_rst_complaint_detection_config cdc ON cdi.item_config_id = cdc.config_id
+        <where>
+            <if test="configType != null ">
+                AND  cdc.config_type = #{configType}
+            </if >
+            <if test="configId != null ">
+                AND  cdi.item_config_id = #{configId}
+            </if >
+            <if test="beginTime != null and beginTime != ''">
+                AND t.detect_production &gt;= #{beginTime}
+            </if >
+            <if test="endTime != null and endTime != ''">
+                AND t.detect_production &lt;= #{endTime}
+            </if >
+        </where>
+        GROUP BY t.detect_production,cdc.config_id
+        ORDER BY t.detect_production
+    </select>
+
+    <select id="getDetectConfigByTypeList" resultType="DetectionConfig"  parameterType="DetectionConfig">
+        SELECT
+          cdc.*
+        FROM tb_rst_complaint_detection_config cdc
+        <where>
+            <if test="configType != null ">
+                AND  cdc.config_type = #{configType}
+            </if >
+            <if test="configId != null ">
+                AND  cdc.config_id = #{configId}
+            </if >
+        </where>
+        ORDER BY cdc.config_id DESC
+    </select>
+
+
+    <select id="getCreatTimeByConfigIdList" resultType="DetectStatistics"  parameterType="DetectStatistics">
+        SELECT
+            t.detect_id,
+            IF (
+            t.detect_production = '',
+            '未知',
+            ifnull(
+            t.detect_production,
+            '未知'
+            )
+            ) AS detect_production,
+            t.detect_create_time,
+            cdc.config_id,
+            cdc.config_detect_content,
+            cdc.config_type
+        FROM
+            tb_rst_complaint_detect t
+        LEFT JOIN tb_rst_complaint_detection_item cdi ON t.detect_id = cdi.detect_id
+        LEFT JOIN tb_rst_complaint_detection_config cdc ON cdi.item_config_id = cdc.config_id
+        <where>
+            <if test="configId != null ">
+                AND  t.config_id = #{configId}
+            </if >
+        </where>
+        GROUP BY
+        date_format(t.detect_create_time, '%Y-%m-%d')
+        ORDER BY
+        t.detect_create_time
+    </select>
+
+    <select id="getDetectAllByConfigIdList" resultType="DetectStatistics"  parameterType="DetectStatistics">
+        SELECT *
+        FROM (
+        SELECT
+        t.detect_id,
+        COUNT(distinct t.detect_id),
+        t.detect_production,
+        t.detect_create_time,
+        cdi.item_config_id,
+        cdi.item_detect_content
+        FROM
+        (SELECT cc.detect_id,IF (cc.detect_production = '','未知',ifnull(cc.detect_production,'未知')) AS detect_production, cc.detect_create_time FROM	tb_rst_complaint_detect cc
+        ) t
+        LEFT JOIN tb_rst_complaint_detection_item cdi ON t.detect_id = cdi.detect_id
+        <where>
+            <if test="configId != null ">
+                AND  cdi.item_config_id = #{configId}
+            </if >
+            AND	t.detect_create_time > '2019-09-02 00:00:00'
+            AND t.detect_create_time < '2019-09-04 00:00:00'
+        </where>
+            GROUP BY t.detect_production,date_format(t.detect_create_time, '%Y-%m-%d')
+        ) xx
+        ORDER BY date_format(xx.detect_create_time , '%Y-%m-%d')
+    </select>
+
+
+
+</mapper>

+ 145 - 8
watero-rst-web/src/main/java/com/iamberry/rst/controllers/cm/AdminDetectController.java

@@ -15,10 +15,7 @@ import com.iamberry.rst.core.tools.LogisticsInfo;
 import com.iamberry.rst.faces.cm.CompanyInfoService;
 import com.iamberry.rst.faces.cm.ProcTypeService;
 import com.iamberry.rst.faces.cm.SalesOrderService;
-import com.iamberry.rst.faces.fm.AwaitingSignclosedProductInfoService;
-import com.iamberry.rst.faces.fm.ComplaintDetectInfoService;
-import com.iamberry.rst.faces.fm.ComplaintSignclosedInfoService;
-import com.iamberry.rst.faces.fm.ComplaintSignclosedProductInfoService;
+import com.iamberry.rst.faces.fm.*;
 import com.iamberry.rst.faces.product.ProductService;
 import com.iamberry.rst.service.cm.mapper.ComplaintQuestionInfoMapper;
 import com.iamberry.rst.service.sys.mapper.SysMapper;
@@ -41,10 +38,7 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.*;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 /**
  * Created by wxm on 2017/8/29.
@@ -76,6 +70,8 @@ public class AdminDetectController {
     private SysMapper sysMapper;
     @Autowired
     private ProcTypeService procTypeService;
+    @Autowired
+    private DetectStatisticService detectStatisticService;
     /**
      * 跳转到添加检测记录页面
      *
@@ -1417,5 +1413,146 @@ public class AdminDetectController {
         }
         return msg;
     }
+
+    /**
+     * 跳转到统计页面
+     * @return
+     */
+    @RequiresPermissions("detect:statistics:detect")
+    @RequestMapping(value = "/detect_statistics")
+    public ModelAndView detectStatistics(HttpServletRequest request) {
+        ModelAndView mv = new ModelAndView("cm/inspection/detect_statistics");
+
+        //类型 检测类别1工厂检测现象2. 故障原因3. 判定结果4. 故障指向5. 原因分析
+        DetectionConfig detectionConfig = new DetectionConfig();
+        detectionConfig.setConfigType(3);
+        List<DetectionConfig>  criticalResultList = detectStatisticService.getDetectConfigByTypeList(detectionConfig);
+        detectionConfig.setConfigType(2);
+        List<DetectionConfig>  causeIssueList = detectStatisticService.getDetectConfigByTypeList(detectionConfig);
+        detectionConfig.setConfigType(5);
+        List<DetectionConfig>  causeAnalysisList = detectStatisticService.getDetectConfigByTypeList(detectionConfig);
+
+        mv.addObject("criticalResultList",criticalResultList);
+        mv.addObject("causeIssueList",causeIssueList);
+        mv.addObject("causeAnalysisList",causeAnalysisList);
+        return mv;
+    }
+
+    /**
+     * 报表 - 本月故障机器
+     * @param request
+     * @return
+     * @throws Exception
+     */
+    @ResponseBody
+    @RequiresPermissions("detect:statistics:detect")
+    @RequestMapping("/detect_statistics_data")
+    public ResponseJson detectStatisticsData(HttpServletRequest request){
+        ResponseJson msg = ResponseJson.getSUCCESS();
+        List<ComplaintDetectInfo> complaintDetectInfoList = detectStatisticService.getAllMalfunctionByMonth();
+        msg.addResponseKeyValue("complaintDetectInfoList",complaintDetectInfoList);
+        return msg;
+    }
+
+    /**
+     * 报表 - 按照各个检测类型分类统计固定生产时间内,机器损坏数量
+     * @param request
+     * @return
+     * @throws Exception
+     */
+    @ResponseBody
+    @RequiresPermissions("detect:statistics:detect")
+    @RequestMapping("/detect_statistics_one")
+    public ResponseJson detectStatisticsOne(HttpServletRequest request, DetectStatistics detectStatistics){
+        ResponseJson msg = ResponseJson.getSUCCESS();
+
+//        detectStatistics.setBeginTime("2019-02");
+
+        //生产年份
+        List<DetectStatistics> detectProductionList = detectStatisticService.getDetectProductionList(detectStatistics);
+
+        //配置
+        List<DetectStatistics> detectConfigList = detectStatisticService.getDetectConfigList(detectStatistics);
+
+        List<Map> list = new ArrayList<>();
+        List<DetectStatistics> detectList = detectStatisticService.getDetectList(detectStatistics);
+        List<Integer> cinfigList = new ArrayList<>();
+        for (int i=0; i<detectConfigList.size(); i++) {
+            Map map = new HashMap();
+            int[] num = new int[detectProductionList.size()];
+            for (int k=0; k<detectProductionList.size(); k++){
+                boolean flag = false;
+                for (int j = 0; j <detectList.size() ; j++) {
+                    if(detectProductionList.get(k).getDetectProduction().equals(detectList.get(j).getDetectProduction())
+                            && Objects.equals(detectConfigList.get(i).getConfigId(), detectList.get(j).getConfigId())
+                        ){
+                        num[k] = detectList.get(j).getConfigNumber();
+                        flag =true;
+                    }
+                }
+                if(!flag){
+                    num[k] = 0;
+                }
+            }
+            DetectStatistics detectConfig = detectConfigList.get(i);
+            map.put(detectConfig.getConfigDetectContent(),num);
+            list.add(map);
+            cinfigList.add(detectConfigList.get(i).getConfigId());
+
+            if(i >= 2){
+                break;
+            }
+        }
+        msg.addResponseKeyValue("detectConfigList",detectConfigList);
+        msg.addResponseKeyValue("detectProductionList",detectProductionList);
+        msg.addResponseKeyValue("list",list);
+        msg.addResponseKeyValue("cinfigList",cinfigList);
+        return msg;
+    }
+
+    /**
+     * 跳转到统计页面
+     * @return
+     */
+    @RequiresPermissions("detect:statistics:detect")
+    @RequestMapping(value = "/to_select_config_statistic")
+    public ModelAndView toSelectConfigStatistic(HttpServletRequest request,Integer configId) {
+        ModelAndView mv = new ModelAndView("cm/inspection/detect_statistics_config");
+
+        DetectionConfig detectionConfig = new DetectionConfig();
+        detectionConfig.setConfigId(configId);
+        List<DetectionConfig>  configList = detectStatisticService.getDetectConfigByTypeList(detectionConfig);
+        detectionConfig = configList.get(0);
+
+        mv.addObject("detectionConfig",detectionConfig);
+        return mv;
+    }
+
+
+
+
+    /**
+     * 报表 - 按照各个检测类型分类统计固定生产时间内,机器损坏数量
+     * @param request
+     * @return
+     * @throws Exception
+     */
+    @ResponseBody
+    @RequiresPermissions("detect:statistics:detect")
+    @RequestMapping("/select_config_statistic")
+    public ResponseJson selectConfigStatistic(HttpServletRequest request,DetectStatistics detectStatistics){
+        ResponseJson msg = ResponseJson.getSUCCESS();
+
+        //生产年份
+        List<DetectStatistics> detectProductionList = detectStatisticService.getDetectProductionList(detectStatistics);
+//        for (:) {
+//
+//        }
+
+        List<DetectStatistics> creatTimeList = detectStatisticService.getCreatTimeByConfigIdList(detectStatistics);
+
+        return msg;
+    }
+
 }
 

+ 2 - 32
watero-rst-web/src/main/java/com/iamberry/rst/controllers/cm/detectController.java

@@ -1,49 +1,17 @@
 package com.iamberry.rst.controllers.cm;
 
-import com.iamberry.rst.core.cm.CompanyInfo;
-import com.iamberry.rst.core.cm.ComplaintQuestionInfo;
-import com.iamberry.rst.core.cm.ProcType;
 import com.iamberry.rst.core.cm.SalesOrder;
 import com.iamberry.rst.core.fm.*;
-import com.iamberry.rst.core.order.Product;
-import com.iamberry.rst.core.order.ProductColor;
-import com.iamberry.rst.core.order.ProductType;
-import com.iamberry.rst.core.page.PageRequest;
-import com.iamberry.rst.core.page.PagedResult;
-import com.iamberry.rst.core.sys.Admin;
-import com.iamberry.rst.core.tools.LogisticsInfo;
-import com.iamberry.rst.faces.cm.CompanyInfoService;
-import com.iamberry.rst.faces.cm.ProcTypeService;
 import com.iamberry.rst.faces.cm.SalesOrderService;
-import com.iamberry.rst.faces.fm.AwaitingSignclosedProductInfoService;
 import com.iamberry.rst.faces.fm.ComplaintDetectInfoService;
-import com.iamberry.rst.faces.fm.ComplaintSignclosedInfoService;
-import com.iamberry.rst.faces.fm.ComplaintSignclosedProductInfoService;
-import com.iamberry.rst.faces.product.ProductService;
-import com.iamberry.rst.service.cm.mapper.ComplaintQuestionInfoMapper;
-import com.iamberry.rst.service.sys.mapper.SysMapper;
-import com.iamberry.rst.utils.AdminUtils;
-import com.iamberry.rst.utils.GenerateKeyUtil;
-import com.iamberry.rst.utils.StitchAttrUtil;
 import com.iamberry.wechat.tools.ResponseJson;
-import org.apache.poi.hssf.usermodel.*;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 
-import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.*;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
 import java.util.List;
 
 /**
@@ -58,6 +26,7 @@ public class detectController {
     private ComplaintDetectInfoService complaintDetectInfoService;
     @Autowired
     private SalesOrderService salesOrderService;
+
     /**
      * 跳转到修改确认售后处理方式页面
      *
@@ -151,5 +120,6 @@ public class detectController {
         }
         return msg;
     }
+
 }
 

+ 6 - 6
watero-rst-web/src/main/resources/dev-jdbc.properties

@@ -1,13 +1,13 @@
 jdbc.driver=com.mysql.jdbc.Driver
 ##### \uFFFD\uFFFD\u02BD\uFFFD\uFFFD\uFFFD\uFFFD ####
-#jdbc.url=jdbc:mysql://iamberry.mysql.rds.aliyuncs.com/rst?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull
-#jdbc.username=watero_rst
-#jdbc.password=watero_RST
+jdbc.url=jdbc:mysql://iamberry.mysql.rds.aliyuncs.com/rst?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull
+jdbc.username=watero_rst
+jdbc.password=watero_RST
 ##### \uFFFD\uFFFD\u02BD\uFFFD\uFFFD\uFFFD\uFFFD end #####
 
-jdbc.url=jdbc:mysql://iamberry.mysql.rds.aliyuncs.com/rst_test_2?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull
-jdbc.username=rst_test
-jdbc.password=RST_test
+#jdbc.url=jdbc:mysql://iamberry.mysql.rds.aliyuncs.com/rst_test_2?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull
+#jdbc.username=rst_test
+#jdbc.password=RST_test
 
 #pool settings
 jdbc.pool.init=1

+ 4 - 12
watero-rst-web/src/main/resources/watero-rst-orm.xml

@@ -94,6 +94,7 @@
 		<typeAlias type="com.iamberry.rst.core.cm.ProcType" alias="ProcType"/>
 		<typeAlias type="com.iamberry.rst.core.cm.CmRelation" alias="CmRelation"/>
 
+
 		<typeAlias type="com.iamberry.rst.core.fm.AwaitingSignclosedProductInfo" alias="AwaitingSignclosedProductInfo"/>
 		<typeAlias type="com.iamberry.rst.core.fm.ComplaintDetectInfo" alias="ComplaintDetectInfo"/>
 		<typeAlias type="com.iamberry.rst.core.fm.ComplaintMaintenanceInfo" alias="ComplaintMaintenanceInfo"/>
@@ -114,6 +115,7 @@
 		<typeAlias type="com.iamberry.rst.core.fm.QcInfo" alias="QcInfo"/>
 		<typeAlias type="com.iamberry.rst.core.fm.TreatmentRecordLog" alias="TreatmentRecordLog"/>
 		<typeAlias type="com.iamberry.rst.core.fm.ComplaintAfterSalesNum" alias="ComplaintAfterSalesNum"/>
+		<typeAlias type="com.iamberry.rst.core.fm.DetectStatistics" alias="DetectStatistics"/>
 
 		<typeAlias type="com.iamberry.rst.core.sys.SysConfig" alias="SysConfig"/>
 		<typeAlias type="com.iamberry.rst.core.sys.SystemLogs" alias="SystemLogs"/>
@@ -258,18 +260,6 @@
 		<mapper resource="com/iamberry/rst/service/pts/mapper/ptsSalesCompanyMapper.xml"/>
 
 
-
-	<!--	<mapper resource="com/iamberry/rst/service/cm/mapper/noreasonBackMapper.xml"/>
-		<mapper resource="com/iamberry/rst/service/cm/mapper/backGoodsMapper.xml"/>
-		<mapper resource="com/iamberry/rst/service/cm/mapper/reissueMapper.xml"/>
-		<mapper resource="com/iamberry/rst/service/cm/mapper/renewedMapper.xml"/>
-		<mapper resource="com/iamberry/rst/service/cm/mapper/repairMapper.xml"/>
-		<mapper resource="com/iamberry/rst/service/cm/mapper/sendFittingMapper.xml"/>
-		<mapper resource="com/iamberry/rst/service/cm/mapper/fittingsInfoMapper.xml"/>
-		<mapper resource="com/iamberry/rst/service/cm/mapper/closedFittingMapper.xml"/>-->
-
-
-
 		<mapper resource="com/iamberry/rst/service/cm/mapper/closedProdcueMapper.xml"/>
 		<mapper resource="com/iamberry/rst/service/cm/mapper/complaintQuestionInfoMapper.xml"/>
 		<mapper resource="com/iamberry/rst/service/cm/mapper/complaintTypeInfoMapper.xml"/>
@@ -299,6 +289,8 @@
 		<mapper resource="com/iamberry/rst/service/fm/mapper/complaintSmallClassInfoMapper.xml"/>
 		<mapper resource="com/iamberry/rst/service/fm/mapper/inventoryLogMapper.xml"/>
 		<mapper resource="com/iamberry/rst/service/fm/mapper/inventoryMapper.xml"/>
+		<mapper resource="com/iamberry/rst/service/fm/mapper/detectStatisticMapper.xml"/>
+
 
 		<mapper resource="com/iamberry/rst/service/address/mapper/addressMapper.xml"/>
 

+ 5 - 3
watero-rst-web/src/main/webapp/WEB-INF/views/cm/customer/update_relation.ftl

@@ -387,9 +387,11 @@
                             <td>${(postageInfo.postageAlipayName)!''}</td>
                             <td>${(postageInfo.postageAlipay)!''}</td>
                             <td>
-                                <#if postageInfo.postageAlipayType == 1>用户付款</#if>
-                                <#if postageInfo.postageAlipayType == 2>客户付款</#if>
-                                <#if postageInfo.postageAlipayType == 3>公司付款</#if>
+                                <#if postageInfo.postageAlipayType??>
+                                    <#if postageInfo.postageAlipayType == 1>用户付款</#if>
+                                    <#if postageInfo.postageAlipayType == 2>客户付款</#if>
+                                    <#if postageInfo.postageAlipayType == 3>公司付款</#if>
+                                </#if>
                             </td>
                             <#if postageInfo.postageStatus??>
                                 <#if postageInfo.postageStatus == 0><td>未申请</td></#if>

+ 428 - 0
watero-rst-web/src/main/webapp/WEB-INF/views/cm/inspection/detect_statistics.ftl

@@ -0,0 +1,428 @@
+<!DOCTYPE html>
+<html>
+	<head>
+		<meta charset="utf-8">
+		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
+		<meta name="apple-mobile-web-app-capable" content="yes">
+		<meta name="apple-mobile-web-app-status-bar-style" content="black">
+    <#include "/base/add_base.ftl">
+		<title>维修统计</title>
+        <style>
+            .my-title{font-weight: 500;padding-left: 15px;position: relative;}
+            .my-title:after{content: '';position: absolute;left: 0;top:12%;width: 3px;height: 80%;background: #32a3d8;}
+            .my-input{padding: 8px 5px;width: 80%;border:1px solid rgba(0,0,0,.1);}
+            .my-input-date{padding: 8px 10px;border:1px solid rgba(0,0,0,.1);width: 80%;background: url(http://s.iamberry.com/images/rili-1.png) 98.5% center no-repeat; background-size:auto 50%;}
+            .input-box{margin: 18px 0;}
+            .input-dic{float: left;margin:5px 10px 0 0;font-size: 12px;}
+            .add-list{list-style-type: none;padding: 10px;background-color: #f5f5f5;width: 60%;float: left;margin: 0;}
+            .add-list>li{margin: 10px 0;}
+            .my-textarea{padding: 5px 10px;width: 65%;border:1px solid rgba(0,0,0,.1);margin-left: 12.5%;}
+            .my-btn-reset{padding: 10px 20px;width: 150px; background-color: #fff;color: #32a3d8;border: 1px solid #32a3d8;cursor:pointer;margin: 10px 10px 0 10px;}
+            .my-btn-submit{padding: 10px 20px;width: 130px; background-color: #50a2ea;color: #fff;border: 1px solid #50a2ea;cursor:pointer;margin: 10px auto 0 auto;display: block;}
+            .my-select{border: 1px solid rgba(0,0,0,.1);padding:6px 50px 6px 15px;height: 34px; -webkit-appearance:none;appearance:none;background: url(/common/images/pts/select-11.png) right center no-repeat;background-size:auto 100%;}
+            input[type=radio]{-webkit-appearance:none;appearance:none;background: url(${path}/common/images/pts/radio-1.png) center center no-repeat;background-size:auto 100%;width: 20px;height: 20px;margin-right: 10px;}
+            input[type=radio]:checked{-webkit-appearance:none;appearance:none;background: url(${path}/common/images/pts/radio-2.png) center center no-repeat;background-size:auto 100%;width: 20px;height: 20px;margin-right: 10px;}
+            .huanhang{ float:left}
+            .check-box, .radio-box{padding-left: 0;}
+            .my-close{position:absolute;right: 0.5em;top: 0.45em;width:0.15em;height:1em;background: #333;-webkit-transform: rotate(45deg);transform: rotate(45deg);display: inline-block;}
+            .my-close:after{content: "";position: absolute;top: 0;left: 0;width:0.15em;height:1em;background: #333;-webkit-transform: rotate(270deg);transform: rotate(270deg);}
+            .b-close{position: relative; display: inline-block;margin: 2px 0; padding:4px 1em 4px 4px; width: 100px;background: #f0f0f0;border: 1px solid rgba(0,0,0,.1);border-radius: 5px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;cursor: pointer;}
+            .close-box{width: 500px;margin-left: 15px;margin-top: -15px;}
+        </style>
+	</head>
+	<body>
+    	<div id="main" style="width: 1400px;height:500px;"></div>
+
+
+        <div class="input-box" style="height: 45px;"  class="dataTableStatis" seachType="3">
+            <label class="form-label col-2 col-sm-2 huanhang" style="text-align: right;margin: 10px 0px;font-weight: bold;font-size: 23px;">判定结果</label>
+            <div class="formControls col-2 col-sm-2 text-c huanhang" style="margin-left: -4%;margin: 10px 0px 10px -19px;">
+                <input class="my-input beginTime" style="width: 90%;" type="text" value="" name="beginTime_1" id="beginTime_1" onClick="WdatePicker({skin:'whyGreen',maxDate:'%y-%M',dateFmt: 'yyyy-MM',onpicked: getResetDateByTime,oncleared :getResetDateByTime })" placeholder="请选择月份(开始)" readonly="readonly"/>
+            </div>
+            <div class="formControls col-2 col-sm-2 text-c huanhang" style="margin-left: -4%;margin: 10px 0px 10px -19px;">
+                <input class="my-input endTime" style="width: 90%;" type="text" value="" name="endTime_1" id="endTime_1" onClick="WdatePicker({skin:'whyGreen',maxDate:'%y-%M',dateFmt: 'yyyy-MM',minDate:beginTime_1.value,onpicked: getResetDateByTime,oncleared :getResetDateByTime })" placeholder="请选择月份(结束)" readonly="readonly"/>
+            </div>
+            <div class="formControls col-2 col-sm-2 huanhang" style="margin: 10px 0px;line-height: 34px;">
+                <select id="configSelect_1" name="configSelect_1" class="chosen configSelect" style="">
+                    <option value="">判断结果</option>
+                    <#if (criticalResultList?size > 0)>
+                        <#list criticalResultList as config>
+                            <option value="${config.configId!""}">${config.configDetectContent!""}</option>
+                        </#list>
+                    </#if>
+                </select>
+            </div>
+        </div>
+    	<div id="main3" style="width: 1400px;height:500px;"></div>
+
+
+        <div class="input-box" style="height: 45px;" class="dataTableStatis" seachType="2">
+            <label class="form-label col-2 col-sm-2 huanhang" style="text-align: right;margin: 10px 0px;font-weight: bold;font-size: 23px;">故障原因</label>
+            <div class="formControls col-2 col-sm-2 text-c huanhang" style="margin-left: -4%;margin: 10px 0px 10px -19px;">
+                <input class="my-input beginTime" style="width: 90%;" type="text" value="" name="beginTime_2" id="beginTime_2" onClick="WdatePicker({skin:'whyGreen',maxDate:'%y-%M',dateFmt: 'yyyy-MM',onpicked: getResetDateByTime,oncleared :getResetDateByTime })" placeholder="请选择月份(开始)" readonly="readonly"/>
+            </div>
+            <div class="formControls col-2 col-sm-2 text-c huanhang" style="margin-left: -4%;margin: 10px 0px 10px -19px;">
+                <input class="my-input endTime" style="width: 90%;" type="text" value="" name="endTime_2" id="endTime_2" onClick="WdatePicker({skin:'whyGreen',maxDate:'%y-%M',dateFmt: 'yyyy-MM',minDate:beginTime_2.value,onpicked: getResetDateByTime,oncleared :getResetDateByTime })" placeholder="请选择月份(结束)" readonly="readonly"/>
+            </div>
+            <div class="formControls col-2 col-sm-2 huanhang" style="margin: 10px 0px;line-height: 34px;">
+                <select id="configSelect_2" name="configSelect_2" class="chosen configSelect" style="">
+                    <option value="">故障原因</option>
+                <#if (causeIssueList?size > 0)>
+                    <#list causeIssueList as config>
+                        <option value="${config.configId!""}">${config.configDetectContent!""}</option>
+                    </#list>
+                </#if>
+                </select>
+            </div>
+        </div>
+    	<div id="main4" style="width: 1400px;height:500px;"></div>
+
+        <div class="input-box" style="height: 45px;" class="dataTableStatis" seachType="5">
+            <label class="form-label col-2 col-sm-2 huanhang" style="text-align: right;margin: 10px 0px;font-weight: bold;font-size: 23px;">原因分析</label>
+            <div class="formControls col-2 col-sm-2 text-c huanhang" style="margin-left: -4%;margin: 10px 0px 10px -19px;">
+                <input class="my-input beginTime" style="width: 90%;" type="text" value="" name="beginTime_3" id="beginTime_3" onClick="WdatePicker({skin:'whyGreen',maxDate:'%y-%M',dateFmt: 'yyyy-MM',onpicked: getResetDateByTime,oncleared :getResetDateByTime })" placeholder="请选择月份(开始)" readonly="readonly"/>
+            </div>
+            <div class="formControls col-2 col-sm-2 text-c huanhang" style="margin-left: -4%;margin: 10px 0px 10px -19px;">
+                <input class="my-input endTime" style="width: 90%;" type="text" value="" name="endTime_3" id="endTime_3" onClick="WdatePicker({skin:'whyGreen',maxDate:'%y-%M',dateFmt: 'yyyy-MM',minDate:beginTime_3.value,onpicked: getResetDateByTime,oncleared :getResetDateByTime })" placeholder="请选择月份(结束)" readonly="readonly"/>
+            </div>
+            <div class="formControls col-2 col-sm-2 huanhang" style="margin: 10px 0px;line-height: 34px;">
+                <select id="configSelect_3" name="configSelect_3" class="chosen configSelect" style="">
+                    <option value="">原因分析</option>
+                <#if (causeAnalysisList?size > 0)>
+                    <#list causeAnalysisList as config>
+                        <option value="${config.configId!""}">${config.configDetectContent!""}</option>
+                    </#list>
+                </#if>
+                </select>
+            </div>
+        </div>
+    	<div id="main5" style="width: 1400px;height:500px;"></div>
+	</body>
+    <script type="text/javascript" src="${path}/common/lib/echarts/3.8/echarts.common.min.js"></script>
+    <script type="text/javascript" src="${path}/common/lib/echarts/3.8/echarts.min.js"></script>
+    <script type="text/javascript" src="${path}/common/lib/echarts/3.8/macarons.js"></script>
+    <script type="text/javascript" src="${path}/common/lib/My97DatePicker/4.8/WdatePicker.js"></script>
+	<script>
+        var myChart = echarts.init(document.getElementById('main'));
+        //type = 3
+        var myChart3 = echarts.init(document.getElementById('main3'));
+        //type = 2
+        var myChart4 = echarts.init(document.getElementById('main4'));
+        //type = 5
+        var myChart5 = echarts.init(document.getElementById('main5'));
+
+		$(function () {
+            detectStatisticsData();
+            detectStatisticsJudgement(3,"","","");
+            detectStatisticsJudgement(2,"","","");
+            detectStatisticsJudgement(5,"","","");
+        })
+
+        /**
+         * 当月统计
+         * @param state
+         */
+        function detectStatisticsData() {
+            $.ajax({
+                type: "POST",
+                data: {},
+                url: "${path}/admin/detect/detect_statistics_data",
+                success: function(data){
+                    if (data.returnCode == 200) {
+
+                        var numArray = new Array();
+                        var monthArray = new Array();
+                        for (var i=0;i<data.returnMsg.complaintDetectInfoList.length;i++){
+                            var countNum = data.returnMsg.complaintDetectInfoList[i].countNum;
+                            numArray.push(countNum);
+
+                            var detectProduction = data.returnMsg.complaintDetectInfoList[i].detectProduction;
+                            if(detectProduction == "未知"){
+                                var flag = false;
+                                for (var k=0;k<monthArray.length;k++){
+                                    if(monthArray[k] == '未知'){
+                                        var otherMonthNum = numArray[k];
+                                        numArray[k] = numArray[k]+countNum;
+                                        flag = true;
+                                    }
+                                }
+                                if(!flag){
+                                    monthArray.push('未知');
+                                }
+                            }else{
+                                var newDate = formatDate(detectProduction,"yyyy年MM月");
+                                monthArray.push(newDate.substring(2,newDate.length))
+                            }
+						}
+
+                        var newNumArray = new Array();
+                        for (var i=0;i<monthArray.length;i++){
+                            newNumArray.push(numArray[i]);
+                        }
+                        var option = {
+                            title : {
+                                text: '本月故障机器',
+                                subtext: ''
+                            },
+                            tooltip : {
+                                trigger: 'axis'
+                            },
+                            legend: {
+                                data:['本月故障机器']
+                            },
+                            toolbox: {
+                                show : true,
+                                feature : {
+//                                    dataView : {show: true, readOnly: false},
+//                                    magicType : {show: true, type: ['line', 'bar']},
+//                                    restore : {show: true},
+//                                    saveAsImage : {show: true}
+                                }
+                            },
+                            calculable : true,
+                            xAxis : [
+                                {
+                                    type : 'category',
+                                    data : monthArray
+                                }
+                            ],
+                            yAxis : [
+                                {
+                                    type : 'value'
+                                }
+                            ],
+                            series : {
+                                name:'本月故障机器',
+                                type:'bar',
+                                data:newNumArray,
+//								barWidth : 10%,
+                                markPoint : {
+                                    data : [
+                                        {type : 'max', name: '最大值'},
+                                        {type : 'min', name: '最小值'}
+                                    ]
+                                }
+//                                ,markLine : {
+//                                    data : [
+//                                        {type : 'average', name: '平均值'}
+//                                    ]
+//                                }
+                            }
+                        };
+
+                        // 使用刚指定的配置项和数据显示图表。
+                        myChart.setOption(option);
+                    }else{
+                        layer.msg("获取信息失败!", {icon: 5, time: 3000});
+                    }
+                },
+                error: function(XmlHttpRequest, textStatus, errorThrown){
+                }
+            });
+        }
+
+        /**
+         * @param configType
+         * @param beginTime
+         * @param endTime
+         * @param echartsObj
+         */
+        function detectStatisticsJudgement(configType,beginTime,endTime,configId,) {
+            var echartsObj = null;
+            switch (parseInt(configType)){
+                case 3:
+                    echartsObj = myChart3;
+                    break;
+                case 2:
+                    echartsObj = myChart4;
+                    break;
+                case 5:
+                    echartsObj = myChart5;
+                    break;
+                default:
+                    break
+            }
+            if(!isEmpty(echartsObj)){
+                return false;
+            }
+            $.ajax({
+                type: "POST",
+                data: {
+                    configType : configType,
+                    beginTime : beginTime,
+                    endTime : endTime,
+                    configId :configId
+                },
+                url: "${path}/admin/detect/detect_statistics_one",
+                success: function(data){
+                    if (data.returnCode == 200) {
+
+                        var menuDate = new Array();
+                        for (var i=0;i<data.returnMsg.detectConfigList.length;i++) {
+                            var configDetectContent = data.returnMsg.detectConfigList[i].configDetectContent;
+                            menuDate.push(configDetectContent);
+                        }
+
+                        var monthArray = new Array();
+                        for (var j=0;j<data.returnMsg.detectProductionList.length;j++) {
+                            var detectProduction = data.returnMsg.detectProductionList[j].detectProduction;
+                            if(detectProduction == "未知"){
+                                monthArray.push(detectProduction);
+                            }else{
+                                var newDate = formatDate(detectProduction,"yyyy-MM");
+                                monthArray.push(newDate.substring(2,newDate.length));
+                            }
+                        }
+                        var seriesArray = new Array();
+                        for (var k=0;k<data.returnMsg.list.length;k++) {
+                            var newDate = data.returnMsg.list[k];
+                            var dateName,dateAttr;
+                            var configId = data.returnMsg.cinfigList[k];
+                            for(var m in newDate) {
+                                dateName = m;
+                                dateAttr = newDate[m];
+                            }
+                            var objArray = new Array();
+                            for(var q=0;q<dateAttr.length;q++){
+                                var obj = {
+                                    value:dateAttr[q],
+                                    name:dateName,
+                                    configId:configId,
+                                    configName:dateName
+                                }
+                                objArray.push(obj);
+                            }
+                            var series = {
+                                name:dateName,
+                                type:'bar',
+                                data:objArray,
+                                markLine : {
+//                                    data : [
+//                                        {type : 'average', name: '平均值'}
+//                                    ]
+                                }
+                            }
+                            seriesArray.push(series);
+                        }
+                        var option = {
+                            title : {
+                                text: '',
+                                subtext: ''
+                            },
+                            tooltip : {
+                                trigger: 'axis'
+                            },
+                            legend: {
+                                data:menuDate
+                            },
+                            toolbox: {
+                                show : true,
+                                feature : {
+//                                    dataView : {show: true, readOnly: false},
+//                                    magicType : {show: true, type: ['line', 'bar']},
+//                                    restore : {show: true},
+//                                    saveAsImage : {show: true}
+                                }
+                            },
+                            calculable : true,
+                            xAxis : [
+                                {
+                                    type : 'category',
+                                    data : monthArray
+                                }
+                            ],
+                            yAxis : [
+                                {
+                                    type : 'value'
+                                }
+                            ],
+                            series :seriesArray
+                        };
+                        // 使用刚指定的配置项和数据显示图表。
+                        echartsObj.setOption(option,true);
+
+                        echartsObj.on('click', function (params) {
+                            toSelectConfigStatistic(data);
+
+                            // alert("单击了"+params.componentType+"x轴标签");
+
+                            //param具体包含的参数见 https://blog.csdn.net/allenjay11/article/details/76033232
+
+//                            updatePage(option.xAxis.data[params.dataIndex],params.value);
+//                            refresh();
+                        });
+                    }else{
+                        layer.msg("获取信息失败!", {icon: 5, time: 3000});
+                    }
+                },
+                error: function(XmlHttpRequest, textStatus, errorThrown){
+                }
+            });
+        }
+
+        $('.configSelect').change(function() {
+            getResetDate($(this));
+        });
+
+        $('.beginTime').change(function() {
+            getResetDate($(this));
+        });
+        $('.endTime').change(function() {
+            getResetDate($(this));
+        });
+
+        /**
+         * 选择数据后重置数据
+         */
+        function getResetDateByTime() {
+            var id = this.id;
+            var $node = $("#"+id);
+//            var $thisDiv = $node.parents(".dataTableStatis");
+            var $thisDiv = $node.parent().parent();
+            var type = $thisDiv.attr("seachType");
+            var beginTime = $thisDiv.find(".beginTime").val();
+            var endTime = $thisDiv.find(".endTime").val();
+            var configName = $thisDiv.find(".configSelect").find("option:selected").text();
+            var configId = $thisDiv.find(".configSelect").val();
+            detectStatisticsJudgement(type,beginTime,endTime,configId);
+        }
+        /**
+         * 选择数据后重置数据
+         */
+        function getResetDate($node) {
+//            var $thisDiv = $node.parents(".dataTableStatis");
+            var $thisDiv = $node.parent().parent();
+            var type = $thisDiv.attr("seachType");
+            var beginTime = $thisDiv.find(".beginTime").val();
+            var endTime = $thisDiv.find(".endTime").val();
+            var configName = $thisDiv.find(".configSelect").find("option:selected").text();
+            var configId = $thisDiv.find(".configSelect").val();
+            detectStatisticsJudgement(type,beginTime,endTime,configId);
+        }
+
+        /**
+         * 到单独配置页面
+         */
+        function toSelectConfigStatistic(data) {
+            var configId = data.configId;
+            window.location.href= "${path}/admin/dealer/to_select_config_statistic?configId="+configId;
+        }
+
+        $('.chosen').chosen({
+            no_results_text: "没有找到结果!",//搜索无结果时显示的提示
+            search_contains:true,   //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配
+            allow_single_deselect:true, //单选下拉框是否允许取消选择。如果允许,选中选项会有一个x号可以删除选项
+            disable_search: false, //禁用搜索。设置为true,则无法搜索选项。
+            disable_search_threshold: 0, //当选项少等于于指定个数时禁用搜索。
+            inherit_select_classes: true, //是否继承原下拉框的样式类,此处设为继承
+            placeholder_text_single: '', //单选选择框的默认提示信息,当选项为空时会显示。如果原下拉框设置了data-placeholder,会覆盖这里的值。
+            width: '200px', //设置chosen下拉框的宽度。即使原下拉框本身设置了宽度,也会被width覆盖。
+            max_shown_results: 1000, //下拉框最大显示选项数量
+            display_disabled_options: false,
+            single_backstroke_delete: false, //false表示按两次删除键才能删除选项,true表示按一次删除键即可删除
+            case_sensitive_search: false, //搜索大小写敏感。此处设为不敏感
+            group_search: false, //选项组是否可搜。此处搜索不可搜
+            include_group_label_in_selected: true //选中选项是否显示选项分组。false不显示,true显示。默认false。
+        });
+	</script>
+</html>

+ 215 - 0
watero-rst-web/src/main/webapp/WEB-INF/views/cm/inspection/detect_statistics_config.ftl

@@ -0,0 +1,215 @@
+<!DOCTYPE html>
+<html>
+	<head>
+		<meta charset="utf-8">
+		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
+		<meta name="apple-mobile-web-app-capable" content="yes">
+		<meta name="apple-mobile-web-app-status-bar-style" content="black">
+    <#include "/base/add_base.ftl">
+		<title>维修统计</title>
+        <style>
+            .my-title{font-weight: 500;padding-left: 15px;position: relative;}
+            .my-title:after{content: '';position: absolute;left: 0;top:12%;width: 3px;height: 80%;background: #32a3d8;}
+            .my-input{padding: 8px 5px;width: 80%;border:1px solid rgba(0,0,0,.1);}
+            .my-input-date{padding: 8px 10px;border:1px solid rgba(0,0,0,.1);width: 80%;background: url(http://s.iamberry.com/images/rili-1.png) 98.5% center no-repeat; background-size:auto 50%;}
+            .input-box{margin: 18px 0;}
+            .input-dic{float: left;margin:5px 10px 0 0;font-size: 12px;}
+            .add-list{list-style-type: none;padding: 10px;background-color: #f5f5f5;width: 60%;float: left;margin: 0;}
+            .add-list>li{margin: 10px 0;}
+            .my-textarea{padding: 5px 10px;width: 65%;border:1px solid rgba(0,0,0,.1);margin-left: 12.5%;}
+            .my-btn-reset{padding: 10px 20px;width: 150px; background-color: #fff;color: #32a3d8;border: 1px solid #32a3d8;cursor:pointer;margin: 10px 10px 0 10px;}
+            .my-btn-submit{padding: 10px 20px;width: 130px; background-color: #50a2ea;color: #fff;border: 1px solid #50a2ea;cursor:pointer;margin: 10px auto 0 auto;display: block;}
+            .my-select{border: 1px solid rgba(0,0,0,.1);padding:6px 50px 6px 15px;height: 34px; -webkit-appearance:none;appearance:none;background: url(/common/images/pts/select-11.png) right center no-repeat;background-size:auto 100%;}
+            input[type=radio]{-webkit-appearance:none;appearance:none;background: url(${path}/common/images/pts/radio-1.png) center center no-repeat;background-size:auto 100%;width: 20px;height: 20px;margin-right: 10px;}
+            input[type=radio]:checked{-webkit-appearance:none;appearance:none;background: url(${path}/common/images/pts/radio-2.png) center center no-repeat;background-size:auto 100%;width: 20px;height: 20px;margin-right: 10px;}
+            .huanhang{ float:left}
+            .check-box, .radio-box{padding-left: 0;}
+            .my-close{position:absolute;right: 0.5em;top: 0.45em;width:0.15em;height:1em;background: #333;-webkit-transform: rotate(45deg);transform: rotate(45deg);display: inline-block;}
+            .my-close:after{content: "";position: absolute;top: 0;left: 0;width:0.15em;height:1em;background: #333;-webkit-transform: rotate(270deg);transform: rotate(270deg);}
+            .b-close{position: relative; display: inline-block;margin: 2px 0; padding:4px 1em 4px 4px; width: 100px;background: #f0f0f0;border: 1px solid rgba(0,0,0,.1);border-radius: 5px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;cursor: pointer;}
+            .close-box{width: 500px;margin-left: 15px;margin-top: -15px;}
+        </style>
+	</head>
+	<body>
+    	<div id="main" style="width: 1400px;height:500px;"></div>
+
+	</body>
+    <script type="text/javascript" src="${path}/common/lib/echarts/3.8/echarts.common.min.js"></script>
+    <script type="text/javascript" src="${path}/common/lib/echarts/3.8/echarts.min.js"></script>
+    <script type="text/javascript" src="${path}/common/lib/echarts/3.8/macarons.js"></script>
+    <script type="text/javascript" src="${path}/common/lib/My97DatePicker/4.8/WdatePicker.js"></script>
+	<script>
+        var myChart = echarts.init(document.getElementById('main'));
+		$(function () {
+            detectStatisticsData();
+        })
+
+        /**
+         * 当月统计
+         * @param state
+         */
+        function detectStatisticsData() {
+            $.ajax({
+                type: "POST",
+                data: {},
+                url: "${path}/admin/detect/detect_statistics_data",
+                success: function(data){
+                    if (data.returnCode == 200) {
+
+                        var numArray = new Array();
+                        var monthArray = new Array();
+                        for (var i=0;i<data.returnMsg.complaintDetectInfoList.length;i++){
+                            var countNum = data.returnMsg.complaintDetectInfoList[i].countNum;
+                            numArray.push(countNum);
+
+                            var detectProduction = data.returnMsg.complaintDetectInfoList[i].detectProduction;
+                            if(detectProduction == "未知"){
+                                var flag = false;
+                                for (var k=0;k<monthArray.length;k++){
+                                    if(monthArray[k] == '未知'){
+                                        var otherMonthNum = numArray[k];
+                                        numArray[k] = numArray[k]+countNum;
+                                        flag = true;
+                                    }
+                                }
+                                if(!flag){
+                                    monthArray.push('未知');
+                                }
+                            }else{
+                                var newDate = formatDate(detectProduction,"yyyy年MM月");
+                                monthArray.push(newDate.substring(2,newDate.length))
+                            }
+						}
+
+                        var newNumArray = new Array();
+                        for (var i=0;i<monthArray.length;i++){
+                            newNumArray.push(numArray[i]);
+                        }
+                        var option = {
+                            title : {
+                                text: '本月故障机器',
+                                subtext: ''
+                            },
+                            tooltip : {
+                                trigger: 'axis'
+                            },
+                            legend: {
+                                data:['本月故障机器']
+                            },
+                            toolbox: {
+                                show : true,
+                                feature : {
+//                                    dataView : {show: true, readOnly: false},
+//                                    magicType : {show: true, type: ['line', 'bar']},
+//                                    restore : {show: true},
+//                                    saveAsImage : {show: true}
+                                }
+                            },
+                            calculable : true,
+                            xAxis : [
+                                {
+                                    type : 'category',
+                                    data : monthArray
+                                }
+                            ],
+                            yAxis : [
+                                {
+                                    type : 'value'
+                                }
+                            ],
+                            series : {
+                                name:'本月故障机器',
+                                type:'bar',
+                                data:newNumArray,
+//								barWidth : 10%,
+                                markPoint : {
+                                    data : [
+                                        {type : 'max', name: '最大值'},
+                                        {type : 'min', name: '最小值'}
+                                    ]
+                                }
+//                                ,markLine : {
+//                                    data : [
+//                                        {type : 'average', name: '平均值'}
+//                                    ]
+//                                }
+                            }
+                        };
+
+                        // 使用刚指定的配置项和数据显示图表。
+                        myChart.setOption(option);
+                    }else{
+                        layer.msg("获取信息失败!", {icon: 5, time: 3000});
+                    }
+                },
+                error: function(XmlHttpRequest, textStatus, errorThrown){
+                }
+            });
+        }
+
+        $('.configSelect').change(function() {
+            getResetDate($(this));
+        });
+
+        $('.beginTime').change(function() {
+            getResetDate($(this));
+        });
+        $('.endTime').change(function() {
+            getResetDate($(this));
+        });
+
+        /**
+         * 选择数据后重置数据
+         */
+        function getResetDateByTime() {
+            var id = this.id;
+            var $node = $("#"+id);
+//            var $thisDiv = $node.parents(".dataTableStatis");
+            var $thisDiv = $node.parent().parent();
+            var type = $thisDiv.attr("seachType");
+            var beginTime = $thisDiv.find(".beginTime").val();
+            var endTime = $thisDiv.find(".endTime").val();
+            var configName = $thisDiv.find(".configSelect").find("option:selected").text();
+            var configId = $thisDiv.find(".configSelect").val();
+            detectStatisticsJudgement(type,beginTime,endTime,configId);
+        }
+        /**
+         * 选择数据后重置数据
+         */
+        function getResetDate($node) {
+//            var $thisDiv = $node.parents(".dataTableStatis");
+            var $thisDiv = $node.parent().parent();
+            var type = $thisDiv.attr("seachType");
+            var beginTime = $thisDiv.find(".beginTime").val();
+            var endTime = $thisDiv.find(".endTime").val();
+            var configName = $thisDiv.find(".configSelect").find("option:selected").text();
+            var configId = $thisDiv.find(".configSelect").val();
+            detectStatisticsJudgement(type,beginTime,endTime,configId);
+        }
+
+        /**
+         * 到单独配置页面
+         */
+        function toSelectConfigStatistic(data) {
+            var configId = data.configId;
+            window.location.href= "${path}/admin/dealer/to_select_config_statistic?configId="+configId;
+        }
+
+        $('.chosen').chosen({
+            no_results_text: "没有找到结果!",//搜索无结果时显示的提示
+            search_contains:true,   //关键字模糊搜索。设置为true,只要选项包含搜索词就会显示;设置为false,则要求从选项开头开始匹配
+            allow_single_deselect:true, //单选下拉框是否允许取消选择。如果允许,选中选项会有一个x号可以删除选项
+            disable_search: false, //禁用搜索。设置为true,则无法搜索选项。
+            disable_search_threshold: 0, //当选项少等于于指定个数时禁用搜索。
+            inherit_select_classes: true, //是否继承原下拉框的样式类,此处设为继承
+            placeholder_text_single: '', //单选选择框的默认提示信息,当选项为空时会显示。如果原下拉框设置了data-placeholder,会覆盖这里的值。
+            width: '200px', //设置chosen下拉框的宽度。即使原下拉框本身设置了宽度,也会被width覆盖。
+            max_shown_results: 1000, //下拉框最大显示选项数量
+            display_disabled_options: false,
+            single_backstroke_delete: false, //false表示按两次删除键才能删除选项,true表示按一次删除键即可删除
+            case_sensitive_search: false, //搜索大小写敏感。此处设为不敏感
+            group_search: false, //选项组是否可搜。此处搜索不可搜
+            include_group_label_in_selected: true //选中选项是否显示选项分组。false不显示,true显示。默认false。
+        });
+	</script>
+</html>

+ 1 - 0
watero-rst-web/src/main/webapp/common/js/common/common.js

@@ -18,6 +18,7 @@ var formatDate = function(date, format) {
     if (!date instanceof Date) return;
     var dict = {
         "yyyy": date.getFullYear(),
+        "yy": date.getFullYear(),
         "M": date.getMonth() + 1,
         "d": date.getDate(),
         "H": date.getHours(),