Ver código fonte

客户系统+维修统计

wangxiaoming 5 anos atrás
pai
commit
2868f25cf4

+ 6 - 4
watero-rst-service/src/main/java/com/iamberry/rst/service/dm/mapper/dmDealerMapper.xml

@@ -77,10 +77,9 @@
             SELECT ca2.dealer_id,MAX(ca2.coop_agree_end_date) AS coop_agree_end_date FROM tb_rst_dm_cooperation_agree ca2 GROUP BY ca2.dealer_id
         )cax2 ON cax2.dealer_id = t.dealer_id
         LEFT JOIN tb_rst_dm_financial_receipt fr ON t.dealer_id = fr.dealer_id
-
-      /*  LEFT JOIN tb_rst_dm_dealer_channel dc ON t.dealer_id = dc.dealer_id
-        LEFT JOIN tb_rst_store_info si ON t.dealer_id = si.dealer_id
-*/
+        LEFT JOIN tb_rst_dm_dealer_channel dc ON t.dealer_id = dc.dealer_id
+        LEFT JOIN tb_rst_dm_dealer_channel_store dcs ON dcs.deal_channel_id = dc.deal_channel_id
+        LEFT JOIN tb_rst_store_info si ON si.store_id = dcs.store_id
         LEFT JOIN tb_rst_sys_admin sa ON t.create_id = sa.admin_id
         <where>
             <if test="dealerId != null ">
@@ -92,6 +91,9 @@
             <if test="dealerIndustry != null and dealerIndustry != ''">
                 AND t.dealer_industry  like  CONCAT ('%',#{dealerIndustry},'%')
             </if >
+            <if test="storeName != null and storeName != ''">
+                AND si.store_name  like  CONCAT ('%',#{storeName},'%')
+            </if >
             <if test="dealerType != null ">
                 AND t.dealer_type = #{dealerType}
             </if >

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

@@ -17,12 +17,13 @@
     <select id="getDetectProductionList" resultType="DetectStatistics"   parameterType="DetectionConfig">
         SELECT
             t.detect_id,
-            IF(t.detect_production = '','未知',ifnull(t.detect_production,'未知')) AS detect_production,
+            t.detect_production,
             t.detect_create_time,
             cdc.config_id,
             cdc.config_detect_content,
             cdc.config_type
-        FROM tb_rst_complaint_detect t
+        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
         LEFT JOIN tb_rst_complaint_detection_config cdc ON cdi.item_config_id = cdc.config_id
         <where>
@@ -154,24 +155,28 @@
         FROM (
         SELECT
         t.detect_id,
-        COUNT(distinct t.detect_id),
+        COUNT(distinct t.detect_id) AS configNumber,
         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
+        (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 >
-         <!--   <if test="configId != null ">
-                AND	t.detect_create_time 大于 '2019-09-02 00:00:00'
-                AND t.detect_create_time 小于 '2019-09-04 00:00:00'
-            </if >-->
-
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[
+                    AND t.detect_create_time >= #{startDate}
+                ]]>
+            </if >
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[
+                    AND t.detect_create_time <= #{endDate}
+                ]]>
+            </if >
         </where>
             GROUP BY t.detect_production,date_format(t.detect_create_time, '%Y-%m-%d')
         ) xx

+ 39 - 3
watero-rst-web/src/main/java/com/iamberry/rst/controllers/cm/AdminDetectController.java

@@ -1545,12 +1545,48 @@ public class AdminDetectController {
 
         //生产年份
         List<DetectStatistics> detectProductionList = detectStatisticService.getDetectProductionList(detectStatistics);
-//        for (:) {
-//
-//        }
 
+        //所有的创建时间
         List<DetectStatistics> creatTimeList = detectStatisticService.getCreatTimeByConfigIdList(detectStatistics);
 
+        //生产年份与创建时间的笛卡尔积的数量
+        List<DetectStatistics> detectAllList = detectStatisticService.getDetectAllByConfigIdList(detectStatistics);
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+
+        int[] allNum = new int[creatTimeList.size()];
+        for (int i = 0; i < allNum.length; i++) {
+            allNum[i] = 0;
+        }
+
+        List<Map> list = new ArrayList<>();
+        for (int i = 0; i < detectProductionList.size(); i++) {
+            Map map = new HashMap();
+            int[] num = new int[creatTimeList.size()];
+
+            for (int k = 0; k < creatTimeList.size(); k++) {
+                boolean flag = false;
+                String creatTime =  sdf.format(creatTimeList.get(k).getDetectCreateTime());
+                for (int j = 0; j <detectAllList.size() ; j++) {
+                    String dataCreatTime =  sdf.format(detectAllList.get(j).getDetectCreateTime());
+                    if( creatTime.equals(dataCreatTime)
+                        && detectProductionList.get(k).getDetectProduction().equals(detectAllList.get(j).getDetectProduction())){
+                        num[k] = detectAllList.get(j).getConfigNumber();
+                        allNum[k] = allNum[k] + detectAllList.get(j).getConfigNumber();
+                        flag = true;
+                    }
+                }
+                if(!flag){
+                    num[k] = 0;
+                }
+            }
+            map.put(detectProductionList.get(i).getDetectProduction(),num);
+            list.add(map);
+        }
+
+        Map map = new HashMap();
+        map.put("全部",allNum);
+        list.add(map);
         return msg;
     }
 

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

@@ -342,7 +342,7 @@
                         echartsObj.setOption(option,true);
 
                         echartsObj.on('click', function (params) {
-                            toSelectConfigStatistic(data);
+                            toSelectConfigStatistic(params.data);
 
                             // alert("单击了"+params.componentType+"x轴标签");
 
@@ -405,7 +405,7 @@
          */
         function toSelectConfigStatistic(data) {
             var configId = data.configId;
-            window.location.href= "${path}/admin/dealer/to_select_config_statistic?configId="+configId;
+            window.location.href= "${path}/admin/detect/to_select_config_statistic?configId="+configId;
         }
 
         $('.chosen').chosen({

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

@@ -52,89 +52,10 @@
             $.ajax({
                 type: "POST",
                 data: {},
-                url: "${path}/admin/detect/detect_statistics_data",
+                url: "${path}/admin/detect/select_config_statistic",
                 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);
@@ -187,14 +108,6 @@
             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,则要求从选项开头开始匹配

+ 1 - 1
watero-rst-web/src/main/webapp/WEB-INF/views/dm/dealer/dealer_list.ftl

@@ -63,7 +63,7 @@
 
             <input type="text" class="my-input trim_input"  style="width:120px;margin-right: 0px; margin-bottom: 8px;" value="${dmDealer.dealerName!}" placeholder="客户名称" id="dealerName" name="dealerName">
             <input type="text" class="my-input trim_input"  style="width:120px;margin-right: 0px; margin-bottom: 8px;" value="${dmDealer.dealerIndustry!}" placeholder="客户行业" id="dealerIndustry" name="dealerIndustry">
-            <input type="text" class="my-input trim_input"  style="width:120px;margin-right: 0px; margin-bottom: 8px;" value="${dmDealer.dealerIndustry!}" placeholder="店铺名称" id="dealerIndustry" name="dealerIndustry">
+            <input type="text" class="my-input trim_input"  style="width:120px;margin-right: 0px; margin-bottom: 8px;" value="${dmDealer.storeName!}" placeholder="店铺名称" id="storeName" name="storeName">
 
             <button type="submit" class="btn" style="background: #50a2ea;border: 1px solid #50a2ea;color: #fff;height: 35px;margin-top: -8px;"><i class="Hui-iconfont">&#xe665;</i> 查询</button>