Procházet zdrojové kódy

Merge remote-tracking branch 'origin/master'

Longlin před 5 roky
rodič
revize
1175d5b1aa

+ 2 - 3
whepi-ui/templates/home/home.ftl

@@ -60,9 +60,8 @@
         family_init();
         ribao_add();
         ribao_cancel();
-        ribao_commit();
 
-        var msReport = ${msReport};
+        <#if msReport ??>var msReport = ${msReport}</#if>;
         $('#ribao_safety_num').val(msReport.safetyNum);
         ribaoInitialization(msReport.reportId);
         /*submit_back();*/
@@ -118,7 +117,7 @@
                 '                            </div>\n' +
                 '                        </div>\n' +
                 '                        <div class="weui-cell__ft">' + conversion(v.taskStatus) + '</div>\n' +
-                '                    </a>\n<br />'));
+                '                    </a>\n<br/>'));
 
     }
 

+ 10 - 3
whepi-ui/templates/home/qiuzhu.ftl

@@ -47,6 +47,8 @@
                         <div class="weui-cell__ft"></div>
                     </a>-->
                 </div>
+                <br/>
+                <br/>
                 <div id="titlteZs" style="display: none">
                     <div class="page__bd">
                         <div class="weui-panel weui-panel_access" id="qzHS">
@@ -86,6 +88,8 @@
                     <div id="family">
                         <div class="weui-panel__bd" id="valueQz">
                         </div>
+                        <br>
+                        <br>
                     </div>
                 </div>
                 <div id="play" style="display: none" class="weui-panel__bd"><#--发起求助的展示界面-->
@@ -121,7 +125,7 @@
                                 <label class="weui-cell weui-cell_active weui-check__label" for="qzf2">
                                     <div class="weui-cell__hd">
                                         <input type="checkbox" name="checkbox2" class="weui-check" id="qzf2"
-                                               value="业委会">
+                                               value="A" checked="checked">
                                         <i class="weui-icon-checked"></i>
                                     </div>
                                     <div class="weui-cell__bd">
@@ -191,6 +195,9 @@
                             <div class="weui-btn-area">
                                 <a class="weui-btn weui-btn_primary" onclick="HomeStatus();" id="isHiddenStyle12"
                                    style="display: none">完成</a>
+                                <br>
+                                <br>
+                                <br>
                             </div>
                         </div>
                     </div>
@@ -305,7 +312,7 @@
                 '                                    </div>\n' +
                 '                                </div>\n' +
                 '                                <div class="weui-cell__ft">' + conversion(v.taskStatus) + '</div>\n' +
-                '                            </a><br />'));
+                '                            </a><br/>'));
     }
 
     var aid;
@@ -408,7 +415,7 @@
         /*展示*/
         $('#play')[0].style.display = '';
         $('#Qzinput').val("")
-        $("#qzf2").removeAttr('checked', false)
+       // $("#qzf2").removeAttr('checked', false)
         $('#remarks').val("")
     }
 

+ 1 - 0
whepi-ui/templates/home/ribao.ftl

@@ -136,6 +136,7 @@
             <div id="rb_nav2" class="weui-tab__bd-item ">
                 <div id="my-input-ribao"></div>
                 <div class="weui-panel weui-panel_access">
+                    <div class="weui-panel__hd" style="color: #0bb20c; font-size: large" >我的家人</div>
                     <div class="weui-panel__bd" id="ribao_famliy">
                         <#--<div class="weui-media-box weui-media-box_text">-->
                             <#--<h4 class="weui-media-box__title">家人1:咳嗽、乏力、未确诊</h4>-->

+ 35 - 28
whepi-ui/templates/home/ribao.js

@@ -33,9 +33,12 @@ function ribaoInitialization(reportId) {
 
 //刷新今日日报
 function ribao_refrash() {
+  var userId = $("#userId").val();
   $.ajax({
     url: '/home/home/queryRibao',
-    data: {},
+    data: {
+      userCreate: userId
+    },
     type: 'GET',
     success: function (data) {
       console.log(data);
@@ -74,7 +77,7 @@ function ribao_cell(v) {
   else
     conditionStatus += "&nbsp;&nbsp;&nbsp;未确诊"
   $('#rb_family').append($('<div class="weui-media-box weui-media-box_text">\n' +
-    '                                      <h4 class="weui-media-box__title">' + conditionStatus + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="color: #2a62bc" onclick=\'deleteSuspected(' + JSON.stringify(v.suspectedId)+ ')\'>删除</a></h4>\n' +
+    '                                      <h4 class="weui-media-box__title">' + conditionStatus + '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a style="color: #2a62bc" onclick=\'deleteSuspected(' + JSON.stringify(v.suspectedId) + ')\'>删除</a></h4>\n' +
     '                                      <p class="weui-media-box__desc">' + v.remarks + '</p>\n' +
     '                                    </div>\n' +
     '                              '));
@@ -104,34 +107,23 @@ function ribao_cancel() {
   });
 }
 
-function ribao_commit() {
-  $('#commit').on('click', function () {
-
-    if ($('#ribao')[0].style.display == 'none') {
-      $('#notOpenRibao').toggle();
-      $('#ribao')[0].style.display = '';
-    } else {
-      $('#notOpenRibao')[0].style.display = '';
-      $('#ribao')[0].style.display = 'none';
-    }
-  });
-}
-
-
 function ribaoCommit() {
+  var userId = $("#userId").val();
   var user_name = $("#js_input_user_name").val();
-  if(user_name==""){
+  if (user_name == "") {
     alert("请填写家人姓名");
     return;
-  }if(user_name.length>25){
+  }
+  if (user_name.length > 25) {
     alert("请填写正确格式家人姓名");
     return;
   }
   var remarks = $("#rb_remarks").val();
-  if(remarks==""){
+  if (remarks == "") {
     alert("请填写病情描述");
     return;
-  }if(remarks.length>100){
+  }
+  if (remarks.length > 100) {
     alert("病情描述内容太长");
     return;
   }
@@ -167,15 +159,23 @@ function ribaoCommit() {
     conditionStatus += ",6";
 
   $.ajax({
-    url: '/home/addRibao.json',
+    url: '/home/addRibao',
     type: "post",
     data: {
+      "userCreate": userId,
       "userName": user_name,
       "conditionStatus": conditionStatus,
       "medical": medical,
       "remarks": remarks,
     },
     success: function (data) {
+      if ($('#ribao')[0].style.display == 'none') {
+        $('#notOpenRibao').toggle();
+        $('#ribao')[0].style.display = '';
+      } else {
+        $('#notOpenRibao')[0].style.display = '';
+        $('#ribao')[0].style.display = 'none';
+      }
       ribao_refrash();
     },
   });
@@ -183,7 +183,7 @@ function ribaoCommit() {
 
 function deleteSuspected(suspectedId) {
   $.ajax({
-    url: '/home/deleteSuspected.json',
+    url: '/home/deleteSuspected',
     type: "post",
     data: {
       "suspectedId": suspectedId
@@ -196,17 +196,22 @@ function deleteSuspected(suspectedId) {
 
 
 function addReport() {
+  var userId = $("#userId").val();
   var safety_num = $("#ribao_safety_num").val();
-  if(safety_num==""){
+  if (safety_num == "") {
     alert("请填写居家人数");
     return;
   }
   $.ajax({
-    url: '/home/addReport.json',
+    url: '/home/addReport',
     type: "post",
     data: {
+      "userCreate": userId,
       "safetyNum": safety_num,
     },
+    success: function (data) {
+      $.toast("操作成功");
+    },
   });
 }
 
@@ -215,14 +220,16 @@ $("#my-input-ribao").calendar({
   inputReadOnly: false,
   onChange: function (p, values, displayValues) {
     var reportDate = values.toString();
+    var userId = $("#userId").val();
     $.ajax({
       url: '/home/home/queryRibaoReportDate',
       data: {
+        "userCreate": userId,
         "reportDate": reportDate,
       },
       type: 'GET',
       success: function (data) {
-        if(data.data==undefined){
+        if (data.data == undefined) {
           $('#ribao_famliy').empty();
         }
         else {
@@ -249,13 +256,13 @@ function helpValue1(v) {
   if (conditionStatusList[0] > 0)
     conditionStatus += "&nbsp;&nbsp;&nbsp;咳嗽"
   if (conditionStatusList[1] > 0) {
-      conditionStatus += "&nbsp;&nbsp;&nbsp;发烧"
+    conditionStatus += "&nbsp;&nbsp;&nbsp;发烧"
   }
   if (conditionStatusList[2] > 0) {
-      conditionStatus += "&nbsp;&nbsp;&nbsp;腹泻"
+    conditionStatus += "&nbsp;&nbsp;&nbsp;腹泻"
   }
   if (conditionStatusList[3] > 0) {
-      conditionStatus += "&nbsp;&nbsp;&nbsp;酸痛"
+    conditionStatus += "&nbsp;&nbsp;&nbsp;酸痛"
   }
   if (conditionStatusList[4] > 0) {
     conditionStatus += "&nbsp;&nbsp;&nbsp;乏力"

+ 65 - 0
whepi-ui/templates/user/changeRole.ftl

@@ -0,0 +1,65 @@
+<#assign title="选择角色"/>
+<#include "/home/frag.head.ftl" />
+
+<div class="weui-tab">
+    <div class="weui-tab__bd">
+        <input id="userId" type="text" hidden="hidden" value=${user_id!}/>
+            <div class="weui-tab__bd-item weui-tab__bd-item--active">
+                <div class="page__bd">
+                    <header class="user-header">
+                        <br/>
+                        <br/>
+                        <br/>
+                        <br/>
+                        <h1 class="user-title">家园抗击疫情公共服务平台</h1>
+                        <br/>
+                        <h1 class="user-title"><#if user ??>${user.nickName!''}</#if>登陆</h1>
+                        <br/>
+                        <br/>
+                        <br/>
+                        <br/>
+                    </header>
+                    <div class="weui-form" id="fromMsg">
+                        <div class="weui-cells weui-cells_checkbox">
+                            <label class="weui-cell weui-cell_active weui-check__label" for="s11">
+                                <div class="weui-cell__hd">
+                                    <input type="radio" name="radio" value="1" class="weui-check" id="s11">
+                                    <i class="weui-icon-checked"></i>
+                                </div>
+                                <div class="weui-cell__bd">
+                                    <p>家庭用户</p>
+                                </div>
+                            </label>
+                            <label class="weui-cell weui-cell_active weui-check__label" for="s12">
+                                <div class="weui-cell__hd">
+                                    <input type="radio" name="radio" value="2" class="weui-check" id="s12">
+                                    <i class="weui-icon-checked"></i>
+                                </div>
+                                <div class="weui-cell__bd">
+                                    <p>业委会人员</p>
+                                </div>
+                            </label>
+                        </div>
+                        <br/>
+                        <div class="weui-form__opr-area">
+                            <a class="weui-btn weui-btn_primary" href="javascript:;" onclick="login();"
+                               id="login">登陆</a>
+                        </div>
+                    </div>
+                </div>
+            </div>
+    </div>
+</div>
+</div>
+</body>
+<#include "/home/frag.foot.ftl" />
+<script>
+    function login() {
+        var userType = $('input:radio:checked').val();
+        if (!userType) {
+            alert("请选择用户角色!")
+            return false;
+        }
+        window.location.href = "/user/homeIndex.html?userId=" + $("#userId").val() + "&userType=" + userType;
+    }
+</script>

+ 37 - 63
whepi-ui/templates/user/home.ftl

@@ -266,72 +266,50 @@
         }
         var unitId = $("#unitId").val();
         var doorplate = $("#doorplate").val().trim();
-        if(userType == 1) {
-            if (!unitId) {
-                alert("栋/单元!")
-                return false;
-            }
-            if (!doorplate) {
-                alert("请选择门牌信息!")
-                return false;
-            }
+        if (!unitId) {
+            alert("栋/单元!")
+            return false;
+        }
+        if (!doorplate) {
+            alert("请选择门牌信息!")
+            return false;
         }
         console.log(city)
         console.log(area)
         console.log(uptownId)
         console.log(unitId)
         console.log(doorplate)
-        if (userType == 1) {
-            $.ajax({
-                url: '/home/checkHouseId.json',
-                type: "post",
-                data: {
-                    "unitId": unitId,
-                    "doorplate": doorplate,
-                },success: function (data) {
-                    if (!data.success) {
-                        alert(data.msg);
-                        return false;
-                    } else {
-                        $.ajax({
-                            url: '/home/saveUser.json',
-                            type: "post",
-                            data: {
-                                "userId": userId,
-                                "userType": $('input:radio:checked').val(),
-                                "linkman": $("#linkman").val(),
-                                "phone": $("#phone").val(),
-                                "city": city,
-                                "area": area,
-                                "unitId": unitId,
-                                "uptownId": uptownId,
-                                "doorplate": doorplate,
-                            },success: function (date) {
-                                window.location.href = "/user/home.html?userId=" + userId;
-                            }
-                        });
-                    }
-                }
-            });
-        } else {
-            $.ajax({
-                url: '/home/saveUser.json',
-                type: "post",
-                data: {
-                    "userId": userId,
-                    "userType": $('input:radio:checked').val(),
-                    "linkman": $("#linkman").val(),
-                    "phone": $("#phone").val(),
-                    "city": city,
-                    "area": area,
-                    "unitId": unitId,
-                    "uptownId": uptownId,
-                    "doorplate": doorplate,
-                },success: function (date) {
-                    window.location.href = "/user/home.html?userId=" + userId;
+        $.ajax({
+            url: '/home/checkHouseId.json',
+            type: "post",
+            data: {
+                "unitId": unitId,
+                "doorplate": doorplate,
+            },success: function (data) {
+                if (!data.success) {
+                    alert(data.msg);
+                    return false;
+                } else {
+                    $.ajax({
+                        url: '/home/saveUser.json',
+                        type: "post",
+                        data: {
+                            "userId": userId,
+                            "userType": $('input:radio:checked').val(),
+                            "linkman": $("#linkman").val(),
+                            "phone": $("#phone").val(),
+                            "city": city,
+                            "area": area,
+                            "unitId": unitId,
+                            "uptownId": uptownId,
+                            "doorplate": doorplate,
+                        },success: function (date) {
+                            window.location.href = "/user/home.html?userId=" + userId + "&userType=" + $('input:radio:checked').val();
+                        }
+                    });
                 }
-            });
-        }
+            }
+        });
     }
 
     function goOn() {
@@ -367,10 +345,6 @@
         console.log(userType)
         console.log(linkman)
         console.log(phone)
-        if (userType == 2) {
-            $("#unitMsg").hide();
-            $("#doorplateMsg").hide();
-        }
     }
 
     function back() {

+ 10 - 30
whepi-ui/templates/wuye/home.ftl

@@ -28,38 +28,18 @@
 <script>
     <#include "/wuye/fabu.js" />
     <#include "/wuye/qiuzhu.js" />
-    (function ($) {
-        // $(function () {
-        //     $('.weui-navbar__item').on('click', function () {
-        //         $(this).addClass('weui-bar__item_on').siblings('.weui-bar__item_on').removeClass('weui-bar__item_on');
-        //         //内容切换
-        //         var moduleClass = jQuery(this).attr("module");
-        //         var ss = ".weui-tab__panel ." + moduleClass + "_weui_tab_bd_item_active";
-        //         $(ss).removeClass(moduleClass + '_weui_tab_bd_item_active');
-        //         var data_toggle = jQuery(this).attr("target");
-        //         $(data_toggle).addClass(moduleClass + "_weui_tab_bd_item_active");
-        //     });
-        // });
-        //
-        // $(function () {
-        //     $("#ground").bind("click", function () {
-        //         if ($("#Gj").val() == "off") {
-        //             $("#Gj").val("on");
-        //             console.log("关闭查看所有");
-        //             qzMy_help(1);
-        //         } else {
-        //             $("#Gj").val("off");
-        //             console.log("查看已解决的");
-        //             qzMy_help(2);
-        //         }
-        //     });
-        // });
-    })(jQuery);
 
+    (function ($) {
+        $(function () {
 
-    //小区求助信息的展示
-    function familyClick() {
+        });
+        var userId = $("#userId").val;
 
-    }
+    <#--console.log('ssssss');-->
+    <#--var tasks = ${taskList!'[]'};-->
+        // console.log('ssssss', tasks);
+        // console.log('asdsfdgfhjghfgdf');
+        qiuzhu_init();
+    })(jQuery);
 
 </script>

+ 1 - 62
whepi-ui/templates/wuye/qiuzhu.ftl

@@ -39,65 +39,4 @@
             </div>
         </div>
     </div>
-</div>
-
-<script>
-    (function ($) {
-        familyClick();
-    })(jQuery);
-
-    //用户求助信息统计
-    function familyClick() {
-        $('#userHelpAnaly').empty();//清除节点
-        $.ajax({
-            url: '/wuye/userHelpAnaly',
-            data: {queryDate: '2020-02-05'},
-            type: 'GET',
-            success: function (data) {
-                console.log(data);
-                if (data.data.length > 0) {
-                    hasData = true;
-                    getHelpData(data);
-                } else {
-
-                }
-            },
-            error: function () {
-            }
-        });
-    }
-
-    function getHelpData(data) {
-        $('#userHelpAnaly').append($('<div class="weui-flex"> \n' +
-                '                   <div class="weui-flex__item">\n' +
-                '                       <div class="placeholder">今日新增</div>\n' +
-                '                       <div>' + data.todayAdd + '</div>\n' +
-                '                   </div>\n' +
-                '                   <div class="weui-flex__item">\n' +
-                '                       <div class="placeholder">今日已处理</div>\n' +
-                '                       <div>\' + data.todayDo + \'</div>\n' +
-                '                   </div>\n' +
-                '                   <div class="weui-flex__item">\n' +
-                '                   <div class="placeholder">今日未处理</div>\n' +
-                '                       <div>\' + data.todayDonot + \'</div>\n' +
-                '                   </div>\n' +
-                '               <div>'));
-    }
-
-    //我的求助的页面展示
-    function dateSelect() {
-        weui.datePicker({
-            start: 1990,
-            end: 2000,
-            defaultValue: [1991, 6, 9],
-            onChange: function (result) {
-                console.log(result);
-            },
-            onConfirm: function (result) {
-                console.log(result);
-            },
-            id: 'datePicker'
-        });
-    }
-</script>
-
+</div>

+ 61 - 49
whepi-ui/templates/wuye/qiuzhu.js

@@ -1,58 +1,70 @@
 function qiuzhu_init() {
-
-}
-
-function shValue(v) {
-  $('#qzHS').append($('<a href="javascript:void(0);" class="weui-media-box weui-media-box_appmsg">\n' +
-    '                <div class="weui-media-box__bd">\n' +
-    '                    <div style="display: flex; flex-direction: row; justify-content: space-between;">\n' +
-    '                        <p class="weui-media-box__desc">业主1号</p>\n' +
-    '                        <p class="weui-media-box__desc">' + timestampToTime(v.timeUpdate) + '</p>\n' +
-    '                    </div>\n' +
-    '                    <div class="weui-cell ">\n' +
-    '                        <div class="weui-cell__bd">\n' +
-    '                            <textarea class="weui-textarea" rows="1" readonly >' + v.replyContent + '</textarea>\n' +
-    '                            <div class="weui-textarea-counter"></div>\n' +
-    '                        </div>\n' +
-    '                    </div>\n' +
-    '                </div>\n' +
-    '            </a>\n<br />'));
-}
-
-function timestampToTime(timestamp) {
-  var date = new Date(timestamp); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
-  var Y = date.getFullYear() + '/';
-  var M = ((date.getMonth() + 1) < 10) ? ('0' + (date.getMonth() + 1) + '/') : ((date.getMonth() + 1) + '/');
-  var D = (date.getDate() < 10) ? ('0' + date.getDate() + ' ') : (date.getDate() + ' ');
-  var h = (date.getHours() < 10) ? ('0' + date.getHours() + ':') : (date.getHours() + ':');
-  var m = (date.getMinutes() < 10) ? ('0' + date.getMinutes() + ':') : (date.getMinutes() + ':');
-  var s = (date.getSeconds() < 10) ? ('0' + date.getSeconds()) : (date.getSeconds());
-  return Y + M + D + h + m + s;
+  analyData();
 }
 
-function family_init() {
-  /*$('#family').on('click',function () {
-    $('#familyDisplay')[0].style.display == '';
-    alert($('#familyDisplay')[0].style.display == 'none')
-    if($('#familyDisplay')[0].style.display == 'none'){
-      $('#notPlay').toggle();
+function analyData() {
+  $('#userHelpAnaly').empty();//清除节点
+  $.ajax({
+    url: '/wuye/userHelpAnaly',
+    data: {queryDate: '2020-02-05'},
+    type: 'GET',
+    success: function (data) {
+      console.log(data);
+      if (data.data != null && data.data != undefined) {
+        hasData = true;
+        getHelpData(data.data);
+      } else {
 
-    }else{
-      $('#familyDisplay')[0].style.display == '';
-      $('#notPlay')[0].style.display == 'none';
+      }
+    },
+    error: function () {
     }
-
-
-  })*/
+  });
 }
 
-function submit_back() {
-  $('#back').on('click', function () {
-    if ($('#notPlay')[0].style.display = 'none') {
-      $('#notPlay')[0].style.display = '';
-      $('#play').toggle();
-
-    }
+function getHelpData(data) {
+  $('#userHelpAnaly').append($('<div class="weui-flex"> \n' +
+    '                   <div class="weui-flex__item">\n' +
+    '                       <div class="placeholder">今日新增</div>\n' +
+    '                       <div>' + data.todayAdd + '</div>\n' +
+    '                   </div>\n' +
+    '                   <div class="weui-flex__item">\n' +
+    '                       <div class="placeholder">今日已处理</div>\n' +
+    '                       <div>' + data.todayDo + '</div>\n' +
+    '                   </div>\n' +
+    '                   <div class="weui-flex__item">\n' +
+    '                   <div class="placeholder">今日未处理</div>\n' +
+    '                       <div>' + data.todayDonot + '</div>\n' +
+    '                   </div>\n' +
+    '               </div>\n' +
+    '               <div class="weui-flex"> \n' +
+    '                   <div class="weui-flex__item">\n' +
+    '                       <div class="placeholder">近30天新增</div>\n' +
+    '                       <div>' + data.monthAdd + '</div>\n' +
+    '                   </div>\n' +
+    '                   <div class="weui-flex__item">\n' +
+    '                       <div class="placeholder">近30天已处理</div>\n' +
+    '                       <div>' + data.monthDo + '</div>\n' +
+    '                   </div>\n' +
+    '                   <div class="weui-flex__item">\n' +
+    '                   <div class="placeholder">近30天未处理</div>\n' +
+    '                       <div>' + data.monthDonot + '</div>\n' +
+    '                   </div>\n' +
+    '               </div>'));
+}
 
-  })
+//我的求助的页面展示
+function dateSelect() {
+  weui.datePicker({
+    start: 1990,
+    end: 2000,
+    defaultValue: [1991, 6, 9],
+    onChange: function (result) {
+      console.log(result);
+    },
+    onConfirm: function (result) {
+      console.log(result);
+    },
+    id: 'datePicker'
+  });
 }

+ 3 - 3
whepi-ui/templates/yeweihui/home.ftl

@@ -58,9 +58,9 @@ var statisticsOrderList =${rbList!'[]'};
 
     });
     $('#btnRB').empty();
-    for (var i = 0; i < statisticsOrderList.length; i++) {
-        var v = statisticsOrderList[i];//value="'+v.ridgepole+'&'+v.unit+'"
-        $('#btnRB').append('<button class="weui-btn weui-btn_primary" style="display: grid;" value="'+v.ridgepole+'&'+v.unit+'" onclick="ribao_init(this.value)" >'+v.ridgepole+'栋'+v.unit+'单元'+'</button>');
+    for (var i = 0; i < statisticsOrderList.length; i++) {//unitId
+        var v = statisticsOrderList[i];//'+v.ridgepole+'&'+v.unit+'&'+userId+'
+        $('#btnRB').append('<button class="weui-btn weui-btn_primary" style="display: grid;" value="'+v.unitId+'" onclick="ribao_init(this.value)" >'+v.ridgepole+'栋'+v.unit+'单元'+'</button>');
     }
     <#--console.log('ssssss');-->
     <#--var tasks = ${taskList!'[]'};-->

+ 6 - 5
whepi-ui/templates/yeweihui/ribao.ftl

@@ -50,6 +50,7 @@
 <script>
     (function ($) {
         $(function(){
+            var userId = $("#userId").val;
             var date2 = new Date();
             date2.setTime(date2.getTime());
             var month = date2.getMonth()+1;
@@ -72,16 +73,16 @@
                 var tr = $("<tr></tr>");
                 for (var i = 0; i < data.data.length; i++) {
                     var v = data.data[i];
-                    if(ii%10==0 && ii !=0){
+                    if(ii%5==0 && ii !=0){
                         tr = $("<tr></tr>");
                     }
                     var td;
                     if(v.msStatus == 2){//异常
-                        td = '<td style="background-color: yellow">'+v.doorplate+'</td>';
+                        td = '<td style="background-color: yellow" align="center">'+v.doorplate+'</td>';
                     }else if(v.msStatus != 2 && v.reportId != 0 && v.msStatus != null && v.reportId !=null){//已报
-                        td = '<td style="background-color: #0bb20c">'+v.doorplate+'</td>';
+                        td = '<td style="background-color: #0bb20c" align="center">'+v.doorplate+'</td>';
                     }else if(v.reportId == null){//待报
-                        td = '<td style="background-color: #75859f">'+v.doorplate+'</td>';
+                        td = '<td style="background-color: #75859f" align="center">'+v.doorplate+'</td>';
                     }
                     tr.append(td);
                     $("#tableId").append(tr);
@@ -94,7 +95,7 @@
     })(jQuery);
 
     $('#return').on('click', function () {
-        window.location.href = "/yeweihui/home.html#tab2"
+        window.location.href = "/user/home.html#tab2"
         // alert("日报");
     });
 </script>

+ 1 - 0
whepi-ui/templates/yeweihui/ribao.js

@@ -1,6 +1,7 @@
 function ribao_init(tt) {
   $('#btnRB').on('click', function () {
       console.log(tt);
+      // alert(tt.toString());
       window.location.href = "/yeweihui/ribao.html?"+tt
   });
 }

+ 1 - 1
whepi-web/src/main/java/com/bofeng/dao/MsReportMapper.java

@@ -19,7 +19,7 @@ public interface MsReportMapper extends BaseMapper<MsReport> {
 
     List<MsReport> selectByReportDate(@Param("reportDate") String reportDate,@Param("userCreate") Long userCreate);
 
-    @Select("select property_id from sys_user_role where user_id=#{userId}")
+    @Select("select property_id from sys_user_role where user_id=#{userId} and role_id=1")
     long selectHouseIdByUserId(@Param("userId") Long userId);
 
     //

+ 7 - 5
whepi-web/src/main/java/com/bofeng/dao/RbMapper.java

@@ -17,14 +17,16 @@ import java.util.List;
 @Repository
 public interface RbMapper extends BaseMapper<sysUptownUnit> {
 
-    @Select("select a.doorplate as doorplate,c.report_id as reportId,c.ms_status as msStatus,a.time_update as time from sys_uptown_house a " +
+    @Select("select a.doorplate as doorplate,c.report_id as reportId,c.ms_status as msStatus,b.unit_id as unitId from sys_uptown_house a " +
             "inner join sys_uptown_unit b on a.unit_id = b.unit_id " +
-            "left join ms_report c on c.house_id = a.house_id and c.time_update = #{date} " +
-            "where b.ridgepole = #{ridgepole} and b.unit = #{unit}")
-    List<SysUptownHouse> selectMp(@Param("ridgepole") String ridgepole,@Param("unit") String unit,@Param("date") Date date);
+            "inner join sys_owner d on d.uptown_id = b.uptown_id " +
+            "inner join sys_user_role e on e.property_id = d.owner_id and e.role_id = 2 " +
+            "left join ms_report c on c.house_id = a.house_id and DATE_FORMAT(c.time_update,'%Y-%m-%d') = #{dateStr} " +
+            "where b.unit_id = #{str}")
+    List<SysUptownHouse> selectMp(@Param("str") Long str,@Param("dateStr") String dateStr);
     // and c.time_update = #{date}
 
-    @Select("select c.ridgepole as ridgepole,c.unit as unit from sys_user_role a " +
+    @Select("select c.ridgepole as ridgepole,c.unit as unit,c.unit_id as unitId from sys_user_role a " +
             "inner join sys_owner b on b.owner_id = a.property_id and a.role_id = 2 " +
             "inner join sys_uptown_unit c on c.uptown_id = b.uptown_id " +
             "where a.user_id = #{userId}")

+ 3 - 0
whepi-web/src/main/java/com/bofeng/entity/SysUptownHouse.java

@@ -17,6 +17,9 @@ public class SysUptownHouse implements Serializable {
     private Long uptownId;
 
     @TableField(exist = false)
+    private Long unitId;
+
+    @TableField(exist = false)
     private String ridgepole;
 
     @TableField(exist = false)

+ 0 - 1
whepi-web/src/main/java/com/bofeng/service/MsSuspectedService.java

@@ -92,7 +92,6 @@ public class MsSuspectedService {
     @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
     public void deleteSuspected(Long suspectedId) {
 
-
         MsSuspected msSuspected = msSuspectedMapper.selectById(suspectedId);
         if (msSuspected != null) {
             msSuspectedMapper.deleteById(suspectedId);

+ 1 - 1
whepi-web/src/main/java/com/bofeng/service/QzTaskService.java

@@ -51,7 +51,7 @@ public class QzTaskService {
     qzTak.setTimeCreate(new DateTime());
     qzTak.setUserUpdate(userId);
     qzTak.setTimeUpdate(new DateTime());
-    return 1;
+    return qzTaskDao.insert(qzTak);
   }
 
   public List<QzTask> queryQzTaskByStatus(Integer taskStatus) {

+ 6 - 2
whepi-web/src/main/java/com/bofeng/service/RbService.java

@@ -9,6 +9,7 @@ import com.bofeng.entity.sysUptownUnit;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
 
@@ -24,10 +25,13 @@ public class RbService {
         return sysUptownHouses;
     }
 
-    public List<SysUptownHouse> selectXq (String ridgepole,String unit) {
+    public List<SysUptownHouse> selectXq (Long str) {
+//        userId = 1224706869998772226L;
 //        List<SysUptownHouse> sysUptownHouses = rbMapper.selectList(new EntityWrapper<SysUptownHouse>().eq("ridgepole",ridgepole).eq("unit",unit));
         Date date = new Date();
-        List<SysUptownHouse> sysUptownHouses = rbMapper.selectMp(ridgepole,unit,date);
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        String dateStr = simpleDateFormat.format(date);
+        List<SysUptownHouse> sysUptownHouses = rbMapper.selectMp(str,dateStr);
         return sysUptownHouses;
     }
 }

+ 27 - 21
whepi-web/src/main/java/com/bofeng/service/UserOpenService.java

@@ -62,28 +62,27 @@ public class UserOpenService {
         UserRole userRole = new UserRole();
         userRole.setUrId(IdWorker.getId());
         userRole.setUserId(userId);
-        userRole.setRoleId(userType);
+        userRole.setRoleId(1);
         userRole.setUserCreate(userId);
         userRole.setUserUpdate(userId);
-        if (userType == 1) {
-            UptownHouse uptownHouse = new UptownHouse();
-            uptownHouse.setHouseId(IdWorker.getId());
-            uptownHouse.setUnitId(unitId);
-            uptownHouse.setDoorplate(doorplate);
-            uptownHouse.setStatus(1);
-            uptownHouseMapper.insert(uptownHouse);
-            UptownHome uptownHome = new UptownHome();
-            uptownHome.setHouseId(uptownHouse.getHouseId());
-            uptownHome.setLinkman(linkman);
-            uptownHome.setPhone(phone);
-            uptownHome.setYoung(0);
-            uptownHome.setMiddle(0);
-            uptownHome.setOld(0);
-            uptownHome.setRemark("");
-            uptownHome.setStatus(1);
-            uptownHomeMapper.insert(uptownHome);
-            userRole.setPropertyId(uptownHome.getHouseId());
-        } else if (userType == 2) {
+        UptownHouse uptownHouse = new UptownHouse();
+        uptownHouse.setHouseId(IdWorker.getId());
+        uptownHouse.setUnitId(unitId);
+        uptownHouse.setDoorplate(doorplate);
+        uptownHouse.setStatus(1);
+        uptownHouseMapper.insert(uptownHouse);
+        UptownHome uptownHome = new UptownHome();
+        uptownHome.setHouseId(uptownHouse.getHouseId());
+        uptownHome.setLinkman(linkman);
+        uptownHome.setPhone(phone);
+        uptownHome.setYoung(0);
+        uptownHome.setMiddle(0);
+        uptownHome.setOld(0);
+        uptownHome.setRemark("");
+        uptownHome.setStatus(1);
+        uptownHomeMapper.insert(uptownHome);
+        userRole.setPropertyId(uptownHome.getHouseId());
+        if (userType == 2) {
             Owner owner = new Owner();
             owner.setOwnerId(IdWorker.getId());
             owner.setUptownId(uptownId);
@@ -92,7 +91,14 @@ public class UserOpenService {
             owner.setUserCreate(userId);
             owner.setUserUpdate(userId);
             ownerMapper.insert(owner);
-            userRole.setPropertyId(owner.getOwnerId());
+            UserRole userRole1 = new UserRole();
+            userRole1.setUrId(IdWorker.getId());
+            userRole1.setUserId(userId);
+            userRole1.setRoleId(userType);
+            userRole1.setUserCreate(userId);
+            userRole1.setUserUpdate(userId);
+            userRole1.setPropertyId(owner.getOwnerId());
+            userRoleMapper.insert(userRole1);
         }
         userRoleMapper.insert(userRole);
     }

+ 3 - 2
whepi-web/src/main/java/com/bofeng/wx/controller/HomeController.java

@@ -49,8 +49,9 @@ public class HomeController {
     public ModelAndView home(ModelMap model) throws JsonProcessingException {
         model.put("user", new JsonWapper("{\"www\": \"er\"}"));
         //初始化今日日报
-        //UserOpen userOpen = homeService.getUserOpen();
-        Long userId = 1224706869998772226L;
+        UserOpen userOpen = homeService.getUserOpen();
+        Long userId = userOpen.getUserId();
+        //Long userId = 1224706869998772226L;
         MsReport msReport = msReportService.getReportByDateNow(userId);
         model.put("msReport", new JsonWapper(msReport));
         return new ModelAndView("/home/home.ftl", model);

+ 23 - 33
whepi-web/src/main/java/com/bofeng/wx/controller/MsReportController.java

@@ -2,7 +2,6 @@ package com.bofeng.wx.controller;
 
 
 import com.bofeng.entity.*;
-import com.bofeng.service.HomeService;
 import com.bofeng.service.MsReportService;
 import com.bofeng.service.MsSuspectedService;
 import com.yvan.Model;
@@ -11,7 +10,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
 import java.text.SimpleDateFormat;
@@ -26,66 +24,58 @@ import java.util.List;
 public class MsReportController {
 
     @Autowired
-    private HomeService homeService;
-
-    @Autowired
     private MsSuspectedService msSuspectedService;
     @Autowired
     private MsReportService msReportService;
 
     //添加家人
-    @PostMapping("/home/addRibao.json")
-    public ModelAndView saveUser(HttpServletRequest request) {
-        //UserOpen userOpen = homeService.getUserOpen();
-        long userId = 1224706869998772226L;
+    @PostMapping("/home/addRibao")
+    public Integer saveUser(HttpServletRequest request) {
+        //初始化今日日报
+        Long userCreate = Long.parseLong(request.getParameter("userCreate"));
         String userName = request.getParameter("userName");
         String conditionStatus = request.getParameter("conditionStatus");
         Integer medical = Integer.parseInt(request.getParameter("medical"));
         String remarks = request.getParameter("remarks");
-        msSuspectedService.addSuspected(userName, conditionStatus, medical, remarks, userId);
-        return new ModelAndView("/home/home.ftl");
+        msSuspectedService.addSuspected(userName, conditionStatus, medical, remarks, userCreate);
+        return 1;
     }
 
-    //删除家人
-    @PostMapping("/home/deleteSuspected.json")
-    public ModelAndView deleteSuspected(HttpServletRequest request) {
+    //删除家人病例
+    @PostMapping("/home/deleteSuspected")
+    public Integer deleteSuspected(HttpServletRequest request) {
         Long suspectedId = Long.parseLong(request.getParameter("suspectedId"));
         msSuspectedService.deleteSuspected(suspectedId);
-        return new ModelAndView("/home/home.ftl");
+        return 1;
     }
 
-    //获取家人
+    //根据登录人获取家人
     @GetMapping("/home/home/queryRibao")
-    public Model<List<MsSuspected>> queryRibao() {
-        //UserOpen userOpen = homeService.getUserOpen();
-        long userId = 1224706869998772226L;
+    public Model<List<MsSuspected>> queryRibao(@Pd(name = "userCreate") Long userCreate) {
         Date t = new Date();
         SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
         String reportDate = df.format(t);
-        return Model.newSuccess(msReportService.getByReportReportDate(reportDate, userId));
+        return Model.newSuccess(msReportService.getByReportReportDate(reportDate, userCreate));
     }
 
-    //获取家人
+    //根据日报获取家人
     @GetMapping("/home/home/queryRibaoRefresh")
-    public Model<List<MsSuspected>> queryRibao(@Pd(name = "reportId") Long reportId) {
+    public Model<List<MsSuspected>> queryRibaoRefresh(@Pd(name = "reportId") Long reportId) {
         return Model.newSuccess(msReportService.getByReportId(reportId));
     }
 
     //全家报平安
-    @PostMapping("/home/addReport.json")
-    public ModelAndView addReport(HttpServletRequest request) {
-        //UserOpen userOpen = homeService.getUserOpen();
-        long userId = 1224706869998772226L;
+    @PostMapping("/home/addReport")
+    public Integer addReport(HttpServletRequest request) {
+        Long userCreate = Long.parseLong(request.getParameter("userCreate"));
         String safetyNum = request.getParameter("safetyNum");
-        msReportService.addReport(safetyNum, userId);
-        return new ModelAndView("/home/home.ftl");
+        msReportService.addReport(safetyNum, userCreate);
+        return 1;
     }
 
-    //获取家人
+    //根据日期获取家人
     @GetMapping("/home/home/queryRibaoReportDate")
-    public Model<List<MsSuspected>> queryRibaoReportDate(@Pd(name = "reportDate") String reportDate) {
-        //UserOpen userOpen = homeService.getUserOpen();
-        long userId = 1224706869998772226L;
-        return Model.newSuccess(msReportService.getByReportReportDate(reportDate, userId));
+    public Model<List<MsSuspected>> queryRibaoReportDate(@Pd(name = "reportDate") String reportDate, @Pd(name = "userCreate") Long userCreate) {
+        return Model.newSuccess(msReportService.getByReportReportDate(reportDate, userCreate));
     }
 }

+ 35 - 28
whepi-web/src/main/java/com/bofeng/wx/controller/UserOpenController.java

@@ -46,29 +46,52 @@ public class UserOpenController {
     private MsReportService msReportService;
 
     @GetMapping("/user/home.html")
-    public ModelAndView home(ModelMap model, @RequestParam(value = "userId", required = false,defaultValue = "0") Long userId) throws JsonProcessingException {
+    public ModelAndView home(ModelMap model, @RequestParam(value = "userId", required = false,defaultValue = "0") Long userId,
+                             @RequestParam(value = "userType", required = false,defaultValue = "0") Integer userType) throws JsonProcessingException {
         List<UserRole> list = new ArrayList<>();
         if (userId == 0) {
             UserOpen userOpen = homeService.getUserOpen();
             list = userRoleMapper.getUserRoleByUserId(userOpen.getUserId());
-//            list = userRoleMapper.getUserRoleByUserId(1224239062748065800L);
-//            UserOpen userOpen = userOpenMapper.selectByUserId(1224239062748065800L);
+//            list = userRoleMapper.getUserRoleByUserId(123L);
+//            UserOpen userOpen = userOpenMapper.selectByUserId(123L);
             userId = userOpen.getUserId();
             model.put("user", userOpen);
             model.put("user_id", "\""+userOpen.getUserId()+"\"");
+            if (list.size() == 0) {
+                return new ModelAndView("/user/home.ftl", model);
+            }
+            if (list.size() == 1) {
+                MsReport msReport =msReportService.getReportByDateNow(userId);
+                model.put("msReport", new JsonWapper(msReport));
+                return new ModelAndView("/home/home.ftl", model);
+            }
+            if (list.size() == 2) {
+                return new ModelAndView("/user/changeRole.ftl", model);
+            }
         } else {
             model.put("user", userOpenMapper.selectByUserId(userId));
-            list = userRoleMapper.getUserRoleByUserId(userId);
             model.put("user_id", "\""+userId+"\"");
-        }
-        if (list.size() == 0) {
-            return new ModelAndView("/user/home.ftl", model);
-        } else if (list.size()>0) {
-            if (list.get(0).getRoleId() == 1) {
+            if (userType == 1) {
                 MsReport msReport =msReportService.getReportByDateNow(userId);
                 model.put("msReport", new JsonWapper(msReport));
                 return new ModelAndView("/home/home.ftl", model);
-            } else if(list.get(0).getRoleId() == 2) {
+            } else if (userType == 2) {
+                return new ModelAndView("/user/changeRole.ftl", model);
+            }
+        }
+        return null;
+    }
+
+    @GetMapping("/user/homeIndex.html")
+    public ModelAndView homeIndex(ModelMap model, @RequestParam(value = "userId", required = false,defaultValue = "0") Long userId,
+                             @RequestParam(value = "userType", required = false,defaultValue = "0") Integer userType) throws JsonProcessingException {
+        if (userId != 0 && userType != 0) {
+            model.put("user_id", "\"" + userId + "\"");
+            if (userType == 1) {
+                MsReport msReport = msReportService.getReportByDateNow(userId);
+                model.put("msReport", new JsonWapper(msReport));
+                return new ModelAndView("/home/home.ftl", model);
+            } else if (userType == 2) {
                 List<QzTask> taskList = qzTaskService.selectAll();
                 model.put("taskList", YvanUtil.toJsonPretty(taskList));
                 List<sysUptownUnit> rbList = rbService.selectAll(userId);
@@ -113,24 +136,8 @@ public class UserOpenController {
         String phone = request.getParameter("phone");
         Integer area = Integer.parseInt(request.getParameter("area"));
         Long uptownId = Long.parseLong(request.getParameter("uptownId"));
-        Long unitId = 0L;
-        String doorplate = "";
-        if (userType == 1) {
-            unitId = Long.parseLong(request.getParameter("unitId"));
-            doorplate = request.getParameter("doorplate");
-        }
+        Long unitId = Long.parseLong(request.getParameter("unitId"));
+        String doorplate = request.getParameter("doorplate");
         userOpenService.saveUserInfo(userId,userType,linkman,phone,area,uptownId,unitId,doorplate);
-//        UserOpen userOpen = userOpenMapper.selectByUserId(userId);
-//        model.put("user", userOpen);
-//        if (userType == 1) {
-//            return new ModelAndView("redirect:/home/home.html");
-//        } else if (userType == 2) {
-//            List<QzTask> taskList = qzTaskService.selectAll();
-//            model.put("taskList", YvanUtil.toJsonPretty(taskList));
-//            return new ModelAndView("redirect:/yeweihui/home.html");
-//        } else {
-//            return null;
-//        }
-
     }
 }

+ 6 - 5
whepi-web/src/main/java/com/bofeng/wx/controller/YeWeiHuiController.java

@@ -14,6 +14,7 @@ import com.yvan.ModelOps;
 import com.yvan.mvc.Pd;
 import com.yvan.platform.JsonWapper;
 import com.yvan.platform.YvanUtil;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -47,9 +48,9 @@ public class YeWeiHuiController {
         queryParam.put("statistics", "M");
 
         List<QzTask> taskList = qzTaskService.selectAll();
-//        List<sysUptownUnit> rbList = rbService.selectAll();
+        List<sysUptownUnit> rbList = rbService.selectAll(1224706869998772226L);
         model.put("taskList", YvanUtil.toJsonPretty(taskList));
-//        model.put("rbList", YvanUtil.toJsonPretty(rbList));
+        model.put("rbList", YvanUtil.toJsonPretty(rbList));
 
         return new ModelAndView("/yeweihui/home.ftl", model);
     }
@@ -148,9 +149,9 @@ public class YeWeiHuiController {
     }
 
     @GetMapping("/yeweihui/ribaoDy")
-    public Model<List<SysUptownHouse>> yeweihuiRibaoDy(String str) {
-        String[] split = str.split("&");
-        List<SysUptownHouse> rbList = rbService.selectXq(split[0],split[1]);
+    public Model<List<SysUptownHouse>> yeweihuiRibaoDy(Long str) {
+//        String[] split = str.split("&");
+        List<SysUptownHouse> rbList = rbService.selectXq(str);
 
         return Model.newSuccess(rbList);
     }

+ 1 - 1
whepi-web/src/main/resources/mapper/QzTaskDao.xml

@@ -45,7 +45,7 @@
         SELECT b.house_id ,b.doorplate as houseNumber
         from sys_user_role a
         INNER JOIN sys_uptown_house b on a.property_id=b.house_id
-        where a.user_id=#{userId}
+        where a.user_id=#{userId} limit 1
     </select>
 
 </mapper>