Przeglądaj źródła

Merge remote-tracking branch 'origin/master'

Longlin 5 lat temu
rodzic
commit
c62507b6fc

+ 35 - 24
whepi-ui/templates/home/buy.ftl

@@ -11,35 +11,24 @@
         <div class="weui-tab__panel"><#--团购信息的列表-->
             <div id="buy_nav1" style="text-align: center ">
                 团购信息
-            </div>
 
+                <div class="container">
+                    <div class="weui-form-preview"
+                         id="buyListGroup">
+
+                        <div style="display: flex; flex-direction: row; color: grey; font-size: medium;">
+                            <div style="width: 30%; text-align: center;color: #0a001f">标题</div>
+                            <div style="width: 20%; text-align: center;color: #0a001f">已团</div>
+                            <div style="width: 35%; text-align: center;color: #0a001f">截止时间</div>
+                            <div style="width: 15%; text-align: center;color: #0a001f">状态</div>
+                        </div>
 
-            <div id="buy_nav2" style="display: none"><#--我的团购信息-->
-                <div class="weui-form-preview">
-                    <div style="display: flex; flex-direction: row; color: grey; font-size: medium;">
-                        <div style="width: 33%; text-align: center;color: #0a001f">我的订单</div>
-                        <div style="width: 33%; text-align: center;color: #0a001f">提交时间</div>
-                        <div style="width: 33%; text-align: center;color: #0a001f">订单状态</div>
                     </div>
+
                 </div>
                 <div class="container">
-                    <div id="MyBuyAll">
-                    </div>
-                </div>
-            </div>
-        </div>
-        <div class="weui-form-preview"
-             id="buyListGroup">
-            <div style="display: flex; flex-direction: row; color: grey; font-size: medium;">
-                <div style="width: 30%; text-align: center;color: #0a001f">标题</div>
-                <div style="width: 20%; text-align: center;color: #0a001f">已团</div>
-                <div style="width: 35%; text-align: center;color: #0a001f">截止时间</div>
-                <div style="width: 15%; text-align: center;color: #0a001f">状态</div>
-            </div>
-        </div>
-        <div class="container">
-            <div id="buyAll" class="weui-panel__bd">
-            <#--   <a href="javascript:void(0);" style="color: grey;font-size: large">
+                    <div id="buyAll" class="weui-panel__bd">
+                    <#--   <a href="javascript:void(0);" style="color: grey;font-size: large">
                 <div style="display: flex; flex-direction: row; text-align: center; font-size: x-small; line-height: 5vh;"
                      onclick=" myBuyClick()">
                     <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 12px">
@@ -56,8 +45,30 @@
                     </div>
                 </div>
             </a>-->
+                    </div>
+                    <div style="height: 20vh"></div>
+                </div>
+
+            </div>
+
+
+            <div id="buy_nav2" style="display: none"><#--我的团购信息-->
+                <div class="weui-form-preview">
+                    <div style="display: flex; flex-direction: row; color: grey; font-size: medium;">
+                        <div style="width: 33%; text-align: center;color: #0a001f">我的订单</div>
+                        <div style="width: 33%; text-align: center;color: #0a001f">提交时间</div>
+                        <div style="width: 33%; text-align: center;color: #0a001f">订单状态</div>
+                    </div>
+                </div>
+                <div class="container">
+                    <div id="MyBuyAll">
+
+                    </div>
+                    <div style="height: 20vh"></div>
+                </div>
             </div>
         </div>
+
     </div>
 
     <script>

+ 17 - 4
whepi-ui/templates/home/buyClient.ftl

@@ -17,7 +17,7 @@
             <div style="display: inline;">
                 <input type="text" id="buyCount"
                        style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh; width: 50%;font-size: 16px;margin-top: 1vh;"
-                       maxlength="4" onkeyup="this.value=this.value.replace(/[^0-9-]+/,'');" min="1"
+                       maxlength="2" onkeyup="this.value=this.value.replace(/[^0-9-]+/,'');" min="1"
                        onchange="changeBuy()">
             </div>
         </div>
@@ -68,13 +68,14 @@
             url: '/query/getAll/status',
             data: {
                 jmId: $('#jmBuy').val(),
+                userId: $('#buyuserId').val(),
             },
             type: 'GET',
             success: function (data) {
                 console.log(data);
-                $("#Buycount").html(data.data.count)
-                $("#myStatus").html(getStatus(data.data.tgStatus))
-                /* $("#myMenory").html(data.data.tgPrice)*/
+                $("#Buycount").html(data.data.count);
+                $("#myStatus").html(getStatus(data.data.tgStatus));
+                $("#myPhone").val(data.data.phone);
             },
             error: function () {
             }
@@ -127,6 +128,12 @@
             $.alert("请填写联系电话");
             return;
         }
+
+        if (!(/^1[34578]\d{9}$/.test($('#myPhone').val()))) {
+            $.alert("手机号码有误,请重填");
+            return false;
+
+        }
         /* if ($('#Myremarks').val() == undefined || $('#Myremarks').val() == '') {
              $.alert("请填写备注");
              return;
@@ -156,10 +163,16 @@
 
     //输入购买的数量
     function changeBuy() {
+        if ($('#buyCount').val() > 20 || $('#buyCount').val() < 1) {
+            $('#buyCount').val('')
+            $.alert('请输入1到20以内的整数')
+            return ;
+        }
         $.ajax({
             url: '/query/getAll/status',
             data: {
                 jmId: $('#jmBuy').val(),
+                userId: $('#buyuserId').val(),
             },
             type: 'GET',
             async: false,

+ 1 - 1
whepi-ui/templates/home/buytc.ftl

@@ -60,7 +60,7 @@
                         '\n' +
                         '            <div style="text-indent: -0em;margin-left: 2em;">单&nbsp;&nbsp;&nbsp;&nbsp;价:&nbsp;&nbsp;' + v.tgPrice + '</div>\n' +
                         '\n' +
-                        '            <div style="text-indent: -0em;margin-left: 2em;">最小起定量(份):&nbsp;&nbsp;' + v.tgMinNum + '</div>\n' +
+                        '            <div style="text-indent: -0em;margin-left: 2em;">最低起送:&nbsp;&nbsp;' + v.tgMinNum + '</div>\n' +
                         '\n' +
                         '            <div style="text-indent: -0em;margin-left: 2em;">截止时间:&nbsp;&nbsp;' + v.tgEndTime + '</div>\n' +
                         '\n' +

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

@@ -9,7 +9,7 @@
         <div id="tab2" class="weui-tab__bd-item">
             <#include "/home/qiuzhu.ftl" /></div>
         <div id="tab3" class="weui-tab__bd-item">
-           <#include "/home/buy.ftl" /></div>
+    <#include "/home/buy.ftl" /></div>
     <#--<div id="tab4" class="weui-tab__bd-item">-->
     <#--<h1>页面四</h1> </div>-->
     </div>

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

@@ -1,4 +1,4 @@
-<#assign title="管理员"/>
+<#assign title="业委会"/>
 <#include "/home/frag.head.ftl" />
 
 <div class="weui-tab">
@@ -13,9 +13,9 @@
         </div>
         <div id="tab2" class="weui-tab__bd-item">
             <#include "/yeweihui/qiuzhu.ftl" /></div>
-        <div id="tab3" class="weui-tab__bd-item">
-            <#include "/yeweihui/tuangou.ftl" />
-        </div>
+        <#--<div id="tab3" class="weui-tab__bd-item">-->
+            <#--<#include "/yeweihui/tuangou.ftl" />-->
+        <#--</div>-->
     <#--<div id="tab3" class="weui-tab__bd-item">-->
     <#--<h1>页面三</h1> </div>-->
     <#--<div id="tab4" class="weui-tab__bd-item">-->
@@ -30,10 +30,10 @@
             <div class="weui-tabbar__icon"><img src="/static/images/wx/customer_service.png" alt=""></div>
             <p class="weui-tabbar__label">求助</p>
         </a>
-        <a id="tab3a" href="#tab3" class="weui-tabbar__item">
-            <div class="weui-tabbar__icon"><img src="/static/images/wx/customer_service.png" alt=""></div>
-            <p class="weui-tabbar__label">团购</p>
-        </a>
+        <#--<a id="tab3a" href="#tab3" class="weui-tabbar__item">-->
+            <#--<div class="weui-tabbar__icon"><img src="/static/images/wx/customer_service.png" alt=""></div>-->
+            <#--<p class="weui-tabbar__label">团购</p>-->
+        <#--</a>-->
     <#--<a href="#tab3" class="weui-tabbar__item">-->
     <#--<div class="weui-tabbar__icon"> <img src="./images/icon_nav_article.png" alt=""> </div>-->
     <#--<p class="weui-tabbar__label">发现</p>-->

+ 2 - 2
whepi-web/src/main/java/com/bofeng/dao/BuyMapper.java

@@ -21,7 +21,7 @@ public interface BuyMapper extends BaseMapper<Buy> {
 
   JmTuangou selectGroup(@Param("userId") Long userId, @Param("jmId") Long jmId);
 
-  Buy status(@Param("jmId") Long jmId);
+  Buy status(@Param("jmId") Long jmId,@Param("userId") Long userId);
 
-  List<Buy> selectCountNum(@Param("jmId") Long jmId);
+  Buy selectCountNum(@Param("jmId") Long jmId);
 }

+ 14 - 0
whepi-web/src/main/java/com/bofeng/dao/UptownUnitMapper.java

@@ -15,4 +15,18 @@ public interface UptownUnitMapper extends BaseMapper<UptownUnit> {
 
     @Select("select * from sys_uptown_unit where status = 1 and uptown_id = #{uptownId}")
     List<UptownUnit> getUptownUnitData(@Param("uptownId") Long uptownId);
+
+
+    List<UptownUnit> queryDongList(@Param("uptownId") Long uptownId);
+
+    List<UptownUnit> queryDanYuanList(@Param("uptownId") Long uptownId, @Param("ridgepole") Long ridgepole);
+
+    List<UptownUnit> queryMenPaiList(@Param("uptownId") Long uptownId, @Param("ridgepole") Long ridgepole, @Param("unitId") Long unitId, @Param("reportDate") String reportDate);
+
+    List<UptownUnit> queryXiaoQuList(@Param("uptownId") Long uptownId);
+
+    List<UptownUnit> queryYiBaoList(@Param("uptownId") Long uptownId, @Param("reportDate") String reportDate);
+
+    List<UptownUnit> queryYiChangList(@Param("uptownId") Long uptownId, @Param("reportDate") String reportDate);
+
 }

+ 8 - 0
whepi-web/src/main/java/com/bofeng/dao/UserRoleMapper.java

@@ -15,4 +15,12 @@ public interface UserRoleMapper extends BaseMapper<UserRole> {
 
     @Select("select * from sys_user_role where user_id = #{userId}")
     List<UserRole> getUserRoleByUserId(@Param("userId") Long userId);
+
+
+    @Select("select * from sys_user_role where user_id=#{userId} and role_id=2")
+    UserRole getUserRoleYwhByUserId(@Param("userId") Long userId);
+
+    @Select("select * from sys_user_role where user_id=#{userId} and role_id=2")
+    List<UserRole> getUserRoleYwhsByUserId(@Param("userId") Long userId);
+
 }

+ 2 - 1
whepi-web/src/main/java/com/bofeng/entity/Owner.java

@@ -1,6 +1,7 @@
 package com.bofeng.entity;
 
 import com.baomidou.mybatisplus.annotations.TableField;
+import com.baomidou.mybatisplus.annotations.TableId;
 import com.baomidou.mybatisplus.annotations.TableName;
 import lombok.Getter;
 import lombok.Setter;
@@ -11,7 +12,7 @@ import org.joda.time.DateTime;
 @TableName("sys_owner")
 public class Owner {
 
-    @TableField("owner_id")
+    @TableId("owner_id")
     private Long ownerId;
 
     @TableField("uptown_id")

+ 38 - 1
whepi-web/src/main/java/com/bofeng/entity/UptownUnit.java

@@ -3,10 +3,13 @@ package com.bofeng.entity;
 import com.baomidou.mybatisplus.annotations.TableField;
 import com.baomidou.mybatisplus.annotations.TableId;
 import com.baomidou.mybatisplus.annotations.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Getter;
 import lombok.Setter;
 import org.joda.time.DateTime;
 
+import java.util.Date;
+
 /**
  * 门牌信息表
  */
@@ -19,7 +22,7 @@ public class UptownUnit {
     private Long unitId;
 
     @TableField("uptown_id")
-    private Long uptown_id;
+    private Long uptownId;
 
     @TableField("ridgepole")
     private String ridgepole;
@@ -44,4 +47,38 @@ public class UptownUnit {
 
     @TableField(exist = false)
     private DateTime timeUpdate;
+
+    @TableField(exist = false)
+    private String uptownName;
+    @TableField(exist = false)
+    private Long houseId;
+    @TableField(exist = false)
+    private String doorplate;
+    @TableField(exist = false)
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date reportDate;
+    @TableField(exist = false)
+    private Integer doorplateNum;
+
+    @TableField(exist = false)
+    private Integer yiBaoNum;
+    @TableField(exist = false)
+    private Integer weiBaoNum;
+    @TableField(exist = false)
+    private Integer yiChangNum;
+    @TableField(exist = false)
+    private Integer yiChangAddNum;
+    @TableField(exist = false)
+    private Integer yiChangSubNum;
+
+
+    @TableField(exist = false)
+    private Long reportId;
+    @TableField(exist = false)
+    private Integer msStatus;
+    @TableField(exist = false)
+    private String msStatusStr = "";
+    @TableField(exist = false)
+    private Integer safetyNum;
+
 }

+ 14 - 5
whepi-web/src/main/java/com/bofeng/service/BuyService.java

@@ -74,7 +74,7 @@ public class BuyService {
   }
 
   public Buy status(Buy buy) {
-    return buyMapper.status(buy.getJmId());
+    return buyMapper.status(buy.getJmId(), buy.getUserId());
   }
 
   //截止日期状态的更改
@@ -87,9 +87,18 @@ public class BuyService {
         if (list.getTgEndTime().getTime() < new DateTime().getMillis()) {
 
           // 团购数量  最小起订量
-          List<Buy> buys = buyMapper.selectCountNum(list.getJmId());
-          if (buys != null && buys.size() > 0) {
-            for (Buy v : buys) {                //最小起订量
+          Buy buy = buyMapper.selectCountNum(list.getJmId());
+          if (buy != null) { //最小起订量
+            if (list.getTgMinNum().intValue() > buy.getCount().intValue()) {
+              jmTuangouDao.updateStatusByJmId(list.getJmId(), 4L);//取消
+            } else {
+              jmTuangouDao.updateStatusByJmId(list.getJmId(), 2L);//发货
+            }
+          } else {
+            jmTuangouDao.updateStatusByJmId(list.getJmId(), 4L);//取消
+          }
+      /*    if (buys != null && buys.size() > 0) {
+            for (Buy v : buys) {
               if (v.getCount().intValue() < list.getTgMinNum().intValue()) {
                 jmTuangouDao.updateStatusByJmId(list.getJmId(), 4L);//取消
               } else {
@@ -98,7 +107,7 @@ public class BuyService {
             }
           } else {
             jmTuangouDao.updateStatusByJmId(list.getJmId(), 4L);//取消
-          }
+          }*/
 
         }
     }

+ 133 - 16
whepi-web/src/main/java/com/bofeng/service/RiBaoService.java

@@ -2,14 +2,8 @@ package com.bofeng.service;
 
 
 import com.baomidou.mybatisplus.toolkit.IdWorker;
-import com.bofeng.dao.MsReportMapper;
-import com.bofeng.dao.MsSuspectedMapper;
-import com.bofeng.dao.UptownHouseMapper;
-import com.bofeng.dao.UptownUnitMapper;
-import com.bofeng.entity.MsReport;
-import com.bofeng.entity.MsSuspected;
-import com.bofeng.entity.UptownHouse;
-import com.bofeng.entity.UptownUnit;
+import com.bofeng.dao.*;
+import com.bofeng.entity.*;
 import org.apache.commons.collections.CollectionUtils;
 import org.joda.time.DateTime;
 import org.springframework.beans.BeanUtils;
@@ -44,6 +38,14 @@ public class RiBaoService {
     @Autowired
     private UptownUnitMapper uptownUnitMapper;
 
+
+    @Autowired
+    private UserRoleMapper userRoleMapper;
+    @Autowired
+    private OwnerMapper ownerMapper;
+    @Autowired
+    private UptownMapper uptownMapper;
+
     @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
     public MsReport editRibao(Long reportId) {
         DateTime dateTime = new DateTime();
@@ -112,16 +114,13 @@ public class RiBaoService {
 
         //确诊
         trueNum = msReportMapper.selectSuspectedNum(reportId);
-
+        //疑似
+        isNoSuspected = msReportMapper.selectisNoSuspectedNum(reportId);
         //居家隔离
         singleNum = msReportMapper.selectSingleRoomNum(reportId);
-
         //正常
         isSuspected = msReportMapper.selectisSuspectedNum(reportId);
 
-        //疑似
-        isNoSuspected = msReportMapper.selectisNoSuspectedNum(reportId);
-
         //今日居家
         List<MsSuspected> list = msSuspectedMapper.selectByReportId(reportId);
         if (list != null && list.size() > 0)
@@ -129,14 +128,16 @@ public class RiBaoService {
         MsReport msReport = msReportMapper.selectById(reportId);
         if (msReport != null) {
             msReport.setSureNum(trueNum);
-            msReport.setSingleNum(singleNum);
             msReport.setSuspectedNum(isNoSuspected);
             msReport.setNormalNum(isSuspected);
+            msReport.setSingleNum(singleNum);
             msReport.setSafetyNum(isFamliy);
-            if (isNoSuspected > 0)
+            if (trueNum > 0 || isNoSuspected > 0 || singleNum > 0) {
                 msReport.setMsStatus(2);// 健康状态:1正常,2异常
-            else
+            } else {
                 msReport.setMsStatus(1);
+            }
+
             msReportMapper.updateById(msReport);
         }
     }
@@ -492,5 +493,121 @@ public class RiBaoService {
 
         return reportId;
     }
+//-----------------------------------------------------------------
+
 
+    public UptownUnit getRibaoYwh(Long userId) {
+        DateTime dateTime = new DateTime();
+        UptownUnit uptownUnitVo = new UptownUnit();
+        uptownUnitVo.setUptownId(0L);
+        uptownUnitVo.setUptownName("");
+        uptownUnitVo.setReportDate(dateTime.toDate());
+        uptownUnitVo.setDoorplateNum(0);
+        uptownUnitVo.setYiBaoNum(0);
+        uptownUnitVo.setWeiBaoNum(0);
+        uptownUnitVo.setYiChangNum(0);
+        uptownUnitVo.setYiChangAddNum(0);
+        uptownUnitVo.setYiChangSubNum(0);
+
+        List<UserRole> userRoles = userRoleMapper.getUserRoleYwhsByUserId(userId);
+        Long ownerId = userRoles.get(0).getPropertyId();
+        Owner owner = ownerMapper.selectById(ownerId);
+        Uptown uptown = uptownMapper.selectById(owner.getUptownId());
+        Long uptownId = uptown.getUptownId();
+
+        List<UptownUnit> dongList = uptownUnitMapper.queryDongList(uptownId);
+        if (CollectionUtils.isNotEmpty(dongList)) {
+
+            List<UptownUnit> xiaoQuList = uptownUnitMapper.queryXiaoQuList(uptownId);
+            if (null == xiaoQuList) {
+                xiaoQuList = new ArrayList<UptownUnit>();
+            }
+            int doorplateNum = xiaoQuList.size();
+
+            Date today = new Date();
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+            String todayStr = sdf.format(today);
+            List<UptownUnit> yiBaoList = uptownUnitMapper.queryYiBaoList(uptownId, todayStr);
+            if (null == yiBaoList) {
+                yiBaoList = new ArrayList<UptownUnit>();
+            }
+            int yiBaoNum = yiBaoList.size();
+
+            List<UptownUnit> yiChangList = uptownUnitMapper.queryYiChangList(uptownId, todayStr);
+            if (null == yiChangList) {
+                yiChangList = new ArrayList<UptownUnit>();
+            }
+            int yiChangNum = yiChangList.size();
+//            System.out.println("yiChangNum================>>" + yiChangNum);
+
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(today);
+            calendar.add(Calendar.DATE, -1);
+            String yestodayStr = sdf.format(calendar.getTime());
+            List<UptownUnit> yiChangYestodayList = uptownUnitMapper.queryYiChangList(uptownId, yestodayStr);
+            if (null == yiChangList) {
+                yiChangYestodayList = new ArrayList<UptownUnit>();
+            }
+            int yiChangYestodayNum = yiChangYestodayList.size();
+//            System.out.println("yiChangYestodayNum================>>" + yiChangYestodayNum);
+
+            UptownUnit uptownUnitDb = dongList.get(0);
+            uptownUnitVo.setUptownId(uptownUnitDb.getUptownId());// 小区id
+            uptownUnitVo.setUptownName(uptownUnitDb.getUptownName());// 小区名称
+            uptownUnitVo.setReportDate(dateTime.toDate());// 日报日期
+            uptownUnitVo.setDoorplateNum(doorplateNum);// 户数
+
+            uptownUnitVo.setYiBaoNum(yiBaoNum);// 已报数
+            uptownUnitVo.setWeiBaoNum(doorplateNum - yiBaoNum);// 未报数
+            uptownUnitVo.setYiChangNum(yiChangNum);// 异常数
+            if (yiChangNum - yiChangYestodayNum > 0) {
+                uptownUnitVo.setYiChangAddNum(yiChangNum - yiChangYestodayNum);// 异常新增数
+            }
+            if (yiBaoNum > 0 && yiChangYestodayNum - yiChangNum > 0) {
+                uptownUnitVo.setYiChangSubNum(yiChangYestodayNum - yiChangNum);// 异常减少数
+            }
+        }
+
+        return uptownUnitVo;
+    }
+
+    public List<UptownUnit> queryRibaoYwhDongList(Long uptownId) {
+        List<UptownUnit> dongList = uptownUnitMapper.queryDongList(uptownId);
+        return dongList;
+    }
+
+
+    public List<UptownUnit> queryDanYuanList(Long uptownId, Long ridgepole) {
+        List<UptownUnit> dongList = uptownUnitMapper.queryDanYuanList(uptownId, ridgepole);
+        return dongList;
+    }
+
+    public List<UptownUnit> queryMenPaiList(Long uptownId, Long ridgepole, Long unitId) {
+        Date today = new Date();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        String todayStr = sdf.format(today);
+
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(today);
+        calendar.add(Calendar.DATE, -2);
+        String yestodayStr = sdf.format(calendar.getTime());
+
+        List<UptownUnit> dongList = uptownUnitMapper.queryMenPaiList(uptownId, ridgepole, unitId, yestodayStr);
+        if (CollectionUtils.isNotEmpty(dongList)) {
+            for (UptownUnit obj : dongList) {
+                if (obj.getMsStatus() != null && obj.getMsStatus().intValue() == 1) {
+//                    健康状态:1正常,2异常
+                    obj.setMsStatusStr("正常");
+                } else if (obj.getMsStatus() != null && obj.getMsStatus().intValue() == 2) {
+//                    健康状态:1正常,2异常
+                    obj.setMsStatusStr("异常");
+                } else {
+                    obj.setMsStatus(-1);
+                    obj.setMsStatusStr("未报");
+                    obj.setSafetyNum(0);
+                }
+            }
+        }
+        return dongList;
+    }
 }

+ 0 - 3
whepi-web/src/main/java/com/bofeng/wx/controller/RiBaoController.java

@@ -3,7 +3,6 @@ package com.bofeng.wx.controller;
 
 import com.bofeng.entity.MsReport;
 import com.bofeng.entity.MsSuspected;
-import com.bofeng.service.MsSuspectedService;
 import com.bofeng.service.RiBaoService;
 import com.yvan.Model;
 import com.yvan.ModelOps;
@@ -25,8 +24,6 @@ import java.util.List;
 public class RiBaoController {
 
     @Autowired
-    private MsSuspectedService msSuspectedService;
-    @Autowired
     private RiBaoService riBaoService;
 
 

+ 337 - 0
whepi-web/src/main/java/com/bofeng/wx/controller/RiBaoYwhController.java

@@ -0,0 +1,337 @@
+package com.bofeng.wx.controller;
+
+import com.bofeng.dao.RbMapper;
+import com.bofeng.dao.UptownMapper;
+import com.bofeng.entity.*;
+import com.bofeng.excel.ExcelUtils;
+import com.bofeng.service.*;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.yvan.Model;
+import com.yvan.ModelOps;
+import com.yvan.PageDb;
+import com.yvan.mvc.Pd;
+import com.yvan.platform.Conv;
+import com.yvan.platform.JsonWapper;
+import com.yvan.platform.YvanUtil;
+import com.yvan.springmvc.HttpParameterParser;
+import io.swagger.annotations.ApiOperation;
+import lombok.SneakyThrows;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+public class RiBaoYwhController {
+
+    @Autowired
+    private QzTaskService qzTaskService;
+    @Autowired
+    private RbService rbService;
+
+    @Autowired
+    private QzTaskReplyService qzTaskReplyService;
+
+    @Autowired
+    private HomeService homeService;
+
+    @Autowired
+    private JmTuangouService jmTuangouService;
+
+    @Autowired
+    private UptownMapper uptownMapper;
+
+    @Autowired
+    private RbMapper rbMapper;
+
+
+    @Autowired
+    private RiBaoService riBaoService;
+
+    // 查询业委会日报首页小区及统计数据
+    @GetMapping("/ywh/getRibaoYwh")
+    public Model<UptownUnit> getRibaoYwh(@Pd(name = "userId") Long userId) {
+        return Model.newSuccess(riBaoService.getRibaoYwh(userId));
+    }
+
+
+    // 查询业委会日报首页小区对应栋列表
+    @GetMapping("/ywh/queryRibaoYwhDongList")
+    public Model<List<UptownUnit>> queryRibaoYwhDongList(@Pd(name = "uptownId") Long uptownId) {
+        List<UptownUnit> listSuspected = riBaoService.queryRibaoYwhDongList(uptownId);
+        return Model.newSuccess(listSuspected);
+    }
+
+
+    // 查询业委会日报某一栋小区单元数据 根据queryRibaoYwhDongList获取栋数据作为参数传递给此接口
+    @GetMapping("/ywh/queryDanYuanList")
+    public Model<List<UptownUnit>> queryDanYuanList(@Pd(name = "uptownId") Long uptownId, @Pd(name = "ridgepole") Long ridgepole) {
+        List<UptownUnit> listSuspected = riBaoService.queryDanYuanList(uptownId, ridgepole);
+        return Model.newSuccess(listSuspected);
+    }
+
+
+    // 查询业委会日报某一栋门牌数据 根据queryDanYuanList获取单元数据作为参数传递给此接口
+    // uptownId:小区id; ridgepole:栋;unitId:单元id
+    @GetMapping("/ywh/queryMenPaiList")
+    public Model<List<UptownUnit>> queryMenPaiList(@Pd(name = "uptownId") Long uptownId, @Pd(name = "ridgepole") Long ridgepole, @Pd(name = "unitId") Long unitId) {
+        List<UptownUnit> listSuspected = riBaoService.queryMenPaiList(uptownId, ridgepole, unitId);
+        return Model.newSuccess(listSuspected);
+    }
+
+
+    @GetMapping("/ywh/home.html")
+    public ModelAndView yeweihui(ModelMap model, @RequestParam(value = "userId") Long userId, @RequestParam(value = "show", required = false, defaultValue = "-") String show) {
+
+//        List<QzTask> taskList = qzTaskService.selectAll(1225321682867105793L);
+//        List<sysUptownUnit> rbList = rbService.selectAll(1225321682867105793L);
+        List<QzTask> taskList = qzTaskService.selectAll(userId);
+        List<sysUptownUnit> rbList = rbService.selectAll(userId);
+        model.put("taskList", YvanUtil.toJsonPretty(taskList));
+        model.put("rbList", YvanUtil.toJsonPretty(rbList));
+        model.put("user_id", "\"" + userId + "\"");
+        model.put("show", "\"" + show + "\"");
+
+        return new ModelAndView("/yeweihui/home.ftl", model);
+    }
+
+    @GetMapping("/ywh/qiuzhuDetail.html")
+    public ModelAndView qiuzhudetail(@Pd(name = "taskId") Long taskId, @Pd(name = "userId") Long userId, ModelMap model) throws JsonProcessingException {
+
+        QzTask task = qzTaskService.queryByTaskId(taskId);
+//        A业委会,B居委会,C物业,D志愿者
+        StringBuffer target = new StringBuffer();
+        if (task.getTaskTarget().equals("A")) {
+            target.append("业委会");
+        } else if (task.getTaskTarget().equals("B")) {
+            if (target.length() > 0) {
+                target.append("、居委会");
+            } else {
+                target.append("居委会");
+            }
+        } else if (task.getTaskTarget().equals("C")) {
+            if (target.length() > 0) {
+                target.append("、物业");
+            } else {
+                target.append("物业");
+            }
+        } else if (task.getTaskTarget().equals("D")) {
+            if (target.length() > 0) {
+                target.append("、志愿者");
+            } else {
+                target.append("志愿者");
+            }
+        }
+
+        task.setTaskTarget(target.toString());
+
+        model.put("taskJson", new JsonWapper(task));
+        model.put("task", task);
+        model.put("userId", "\"" + userId + "\"");
+
+        return new ModelAndView("/yeweihui/qiuzhuDetail.ftl", model);
+    }
+
+    @PostMapping("/ywh/qiuzhu/queryTasksByStatus.json")
+    public Model queryTasksByStatus(@Pd(name = "status") Integer status) {
+
+        List<QzTask> taskList = qzTaskService.queryQzTaskByStatus(status);
+
+        return Model.newSuccess(taskList);
+    }
+
+    @PostMapping("/ywh/qiuzhu/reply/add.json")
+    public ModelOps replyQiuzhuInsert(QzTaskReply qzTaskReply) {
+
+        Integer success = qzTaskReplyService.insertQzTaskReply(qzTaskReply);
+
+        if (success > 0) {
+            return ModelOps.newSuccess();
+        } else {
+            return ModelOps.newFail("操作失败");
+        }
+    }
+
+    @PostMapping("/ywh/qiuzhu/reply/querybytaskid.json")
+    public Model replyQiuzhuQueryByTaskId(@Pd(name = "taskId") Long taskId) {
+
+        List<QzTaskReply> reply = qzTaskReplyService.queryQzTaskReplyByTaskId(taskId);
+
+        return Model.newSuccess(reply);
+    }
+
+    @PostMapping("/ywh/qiuzhu/list.json")
+    public Model queryByHouseNumber(String houseNumber, @Pd(name = "status") Integer status) {
+
+        if (houseNumber.length() <= 0) {
+            return Model.newSuccess(qzTaskService.queryQzTaskByStatus(status));
+        }
+
+        List<QzTask> list = qzTaskService.queryByHouseNumber(houseNumber, status);
+
+        return Model.newSuccess(list);
+    }
+
+    @GetMapping("/ywh/ribao.html")
+    public ModelAndView yeweihuiRibao(ModelMap model) {
+
+//        List<QzTask> taskList = qzTaskService.selectAll();
+//
+//        model.put("taskList", YvanUtil.toJsonPretty(taskList));
+
+        return new ModelAndView("/yeweihui/ribao.ftl", model);
+    }
+
+    @GetMapping("/ywh/ribaoDy")
+    public Model<List<SysUptownHouse>> yeweihuiRibaoDy(Long str) {
+//        String[] split = str.split("&");
+        List<SysUptownHouse> rbList = rbService.selectXq(str);
+
+        return Model.newSuccess(rbList);
+    }
+
+    @GetMapping("/ywh/ribaoXq.html")
+    public ModelAndView yeweihuiRibaoYcXq(ModelMap model) {
+        Map<String, Object> queryParam = Maps.newLinkedHashMap();
+        queryParam.put("userId", "12345677");
+        queryParam.put("statistics", "M");
+        return new ModelAndView("/yeweihui/ribaoXq.ftl", model);
+    }
+
+    @GetMapping("/ywh/ribaoDyYcXq")
+    public Model<List<MsSuspected>> yeweihuiRibaoYcXq(Long houseId) {
+        List<MsSuspected> rbList = rbService.selectYcXq(houseId);
+        return Model.newSuccess(rbList);
+    }
+
+    @GetMapping("/ywh/ribaohuiz.html")
+    public ModelAndView yeweihuiRibaohuiz(ModelMap model) {
+        return new ModelAndView("/yeweihui/ribaohuiz.ftl", model);
+    }
+
+    @GetMapping("/ywh/yeweihui/ribaohuiz")
+    public Model<Map<String, Object>> yeweihuiRibaohuiz(Long userCreate, String reportDate) {
+//        Long userCreate = 1225321682867105793L;
+
+        List<Uptown> uptowns = rbMapper.selectUptown(userCreate);
+
+        if (uptowns != null && uptowns.size() > 0) {
+            Long upId = uptowns.get(0).getUptownId();
+            Map<String, Integer> map1 = rbMapper.selecthuiz(upId, reportDate);
+            Map<String, Integer> map2 = rbMapper.selectyicahng(upId, reportDate);
+            Map<String, Integer> map3 = rbMapper.selecthuiz1(upId);
+
+            Map<String, Object> reMap = Maps.newHashMap();
+            reMap.put("uptownName", uptowns.get(0).getUptownName());
+            List<Integer> nums = Lists.newArrayList();
+            nums.add(Conv.NI(map3.get("houseCount")));
+            nums.add(Conv.NI(map1.get("reportCount")));
+            nums.add(Conv.NI(map2.get("yichangCount")));
+            nums.add(Conv.NI(map1.get("safetyNum")));
+            nums.add(Conv.NI(map1.get("suspectedNum")));
+            reMap.put("nums", nums);
+            return Model.newSuccess(reMap);
+        }
+        return Model.newFail("没有数据");
+
+    }
+
+    @ApiOperation("导出正常家庭上报明细")
+    @GetMapping("/ywh/yeweihui/exportRiBao")
+    @SneakyThrows
+    public void exportRiBao(@Pd(name = "uptownId") Long uptownId,
+                            @Pd(name = "date") String date,
+                            HttpServletResponse resp) {
+
+        Uptown uptown = uptownMapper.selectById(uptownId);
+        if (uptown != null && uptown.getUptownId() > 0) {
+            Long upId = uptown.getUptownId();
+            String fileName = uptown.getUptownName();
+            fileName += "上报信息-";
+            fileName += date;
+            List<ExcelRiBao> list = rbMapper.selectExcelRiBao(upId, date);
+            ExcelUtils.writeSheet(ExcelRiBao.class, list).export(resp, fileName);
+        }
+    }
+
+    @ApiOperation("导出凌云家庭上报明细")
+    @GetMapping("/ywh/lun/exportRiBao")
+    @SneakyThrows
+    public void lunExportRiBao(@Pd(name = "date") String date,
+                               HttpServletResponse resp) {
+
+        Uptown uptown = uptownMapper.selectById("1238790987234");
+        Long upId = uptown.getUptownId();
+        String fileName = uptown.getUptownName();
+        fileName += "上报信息-";
+        fileName += date;
+        List<ExcelRiBaoLY> list = rbMapper.selectExcelRiBaoLY(upId, date);
+        ExcelUtils.writeSheet(ExcelRiBaoLY.class, list).export(resp, fileName);
+
+    }
+
+    @ApiOperation("导出小区家庭上报明细")
+    @GetMapping("/ywh/yeweihui/EXR")
+    @SneakyThrows
+    public void exportRiBaoByXiaoQu(@Pd(name = "uptownId") Long uptownId,
+                                    @Pd(name = "date") String date,
+                                    HttpServletResponse resp) {
+        Uptown uptown = uptownMapper.selectById(uptownId);
+        if (uptown != null && uptown.getUptownId() > 0) {
+            Long upId = uptown.getUptownId();
+            String fileName = uptown.getUptownName();
+            fileName += "上报信息-";
+            fileName += date;
+            List<ExcelRiBaoPrivate> list = rbMapper.selectExcelRiBaoPrivate(upId, date);
+            ExcelUtils.writeSheet(ExcelRiBaoPrivate.class, list).export(resp, fileName);
+        }
+    }
+
+    @GetMapping("/ywh/tgPublish.html")
+    public ModelAndView tgPublish(@Pd(name = "userId") Long userId, ModelMap model) throws JsonProcessingException {
+        model.put("userId", "\"" + userId + "\"");
+
+        return new ModelAndView("/yeweihui/tgPublish.ftl", model);
+    }
+
+    @PostMapping("/ywh/tgPublish.json")
+    public Model tuangouPublish(JmTuangou jmTuangou) {
+
+        Integer success = jmTuangouService.tuangouPublish(jmTuangou);
+        if (success == 1) {
+            return Model.newSuccess("操作成功");
+        } else {
+            return Model.newFail("操作失败");
+        }
+    }
+
+    @PostMapping("/ywh/tuangou/list/query.json")
+    public Model queryTuangouListByTitle(@Pd(name = "userId") Long userId, @Pd(name = "title", required = false) String title) {
+
+        List<JmTuangou> list = jmTuangouService.queryTuangouListByTitle(userId, title);
+
+        return Model.newSuccess(list);
+    }
+
+    @PostMapping("/ywh/tuangou/mylist/query.json")
+    public Model queryTuangouMyListByTitle(@Pd(name = "userId") Long userId, @Pd(name = "title", required = false) String title) {
+
+        List<JmTuangou> myList = jmTuangouService.queryTuangouMyListByTitle(userId, title);
+
+        return Model.newSuccess(myList);
+    }
+
+    @PostMapping("/ywh/getAllUptown")
+    public Model<List<Uptown>> getAllUptown(HttpParameterParser parser, PageDb pageDb) {
+        return Model.newSuccess(pageDb, uptownMapper.getUptowns(pageDb, parser.getMap()));
+    }
+}

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

@@ -30,165 +30,165 @@ import java.util.List;
 @RestController
 public class UserOpenController {
 
-  @Autowired
-  private HomeService homeService;
-  @Autowired
-  private UserOpenService userOpenService;
-  @Autowired
-  private UserOpenMapper userOpenMapper;
-  @Autowired
-  private UptownMapper uptownMapper;
-  @Autowired
-  private UptownHouseMapper uptownHouseMapper;
-  @Autowired
-  private UptownHomeMapper uptownHomeMapper;
-  @Autowired
-  private UserRoleMapper userRoleMapper;
-  @Autowired
-  private UptownUnitMapper uptownUnitMapper;
-  @Autowired
-  private QzTaskService qzTaskService;
-  @Autowired
-  private RbService rbService;
-  @Autowired
-  private MsReportService msReportService;
-  @Autowired
-  private RbMapper rbMapper;
-
-  @ApiOperation("登陆首页")
-  @ApiImplicitParams({@ApiImplicitParam(name = "userId", value = "用户ID", required = false, dataType = "Long", paramType = "query"),
-    @ApiImplicitParam(name = "userType", value = "用户类型", required = false, dataType = "Integer", paramType = "query")
-  })
-  @GetMapping("/user/home.html")
-  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(1225321682867105793L);
-            UserOpen userOpen = userOpenMapper.selectByUserId(1225321682867105793L);
-      userId = userOpen.getUserId();
-      model.put("user", userOpen);
-      model.put("user_id", "\"" + userOpen.getUserId() + "\"");
-
-      List<Uptown> uptowns = rbMapper.selectUptown(userId);
-      if (uptowns != null && uptowns.size() > 0) {
-        Long uptown_id = uptowns.get(0).getUptownId();
-        String uptown_name = uptowns.get(0).getUptownName();
-        model.put("uptown_id", "\"" + uptown_id + "\"");
-        model.put("uptown_name", uptown_name);
-      }
-
-
-      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));
-      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) {
-        return new ModelAndView("/user/changeRole.ftl", model);
-      }
+    @Autowired
+    private HomeService homeService;
+    @Autowired
+    private UserOpenService userOpenService;
+    @Autowired
+    private UserOpenMapper userOpenMapper;
+    @Autowired
+    private UptownMapper uptownMapper;
+    @Autowired
+    private UptownHouseMapper uptownHouseMapper;
+    @Autowired
+    private UptownHomeMapper uptownHomeMapper;
+    @Autowired
+    private UserRoleMapper userRoleMapper;
+    @Autowired
+    private UptownUnitMapper uptownUnitMapper;
+    @Autowired
+    private QzTaskService qzTaskService;
+    @Autowired
+    private RbService rbService;
+    @Autowired
+    private MsReportService msReportService;
+    @Autowired
+    private RbMapper rbMapper;
+
+    @ApiOperation("登陆首页")
+    @ApiImplicitParams({@ApiImplicitParam(name = "userId", value = "用户ID", required = false, dataType = "Long", paramType = "query"),
+            @ApiImplicitParam(name = "userType", value = "用户类型", required = false, dataType = "Integer", paramType = "query")
+    })
+    @GetMapping("/user/home.html")
+    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(1225321682867105793L);
+//            UserOpen userOpen = userOpenMapper.selectByUserId(1225321682867105793L);
+            userId = userOpen.getUserId();
+            model.put("user", userOpen);
+            model.put("user_id", "\"" + userOpen.getUserId() + "\"");
+
+            List<Uptown> uptowns = rbMapper.selectUptown(userId);
+            if (uptowns != null && uptowns.size() > 0) {
+                Long uptown_id = uptowns.get(0).getUptownId();
+                String uptown_name = uptowns.get(0).getUptownName();
+                model.put("uptown_id", "\"" + uptown_id + "\"");
+                model.put("uptown_name", uptown_name);
+            }
+
+
+            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));
+            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) {
+                return new ModelAndView("/user/changeRole.ftl", model);
+            }
+        }
+        return null;
     }
-    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, @RequestParam(value = "show", required = false, defaultValue = "-") String show) throws JsonProcessingException {
-    if (userId != 0 && userType != 0) {
-      model.put("user_id", "\"" + userId + "\"");
-      List<Uptown> uptowns = rbMapper.selectUptown(userId);
-      if (uptowns != null && uptowns.size() > 0) {
-        Long uptown_id = uptowns.get(0).getUptownId();
-        String uptown_name = uptowns.get(0).getUptownName();
-        model.put("uptown_id", "\"" + uptown_id + "\"");
-        model.put("uptown_name", uptown_name);
-      }
-      if (userType == 1) {
-        MsReport msReport = msReportService.getReportByDateNow(userId);
-        model.put("msReport", new JsonWapper(msReport));
-        model.put("show", "\"" + show + "\"");
-        return new ModelAndView("/home/home.ftl", model);
-      } else if (userType == 2) {
-        List<QzTask> taskList = qzTaskService.selectAll(userId);
-        model.put("taskList", YvanUtil.toJsonPretty(taskList));
-        List<sysUptownUnit> rbList = rbService.selectAll(userId);
-        model.put("rbList", YvanUtil.toJsonPretty(rbList));
-
-        return new ModelAndView("/yeweihui/home.ftl", model);
-      }
+
+    @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, @RequestParam(value = "show", required = false, defaultValue = "-") String show) throws JsonProcessingException {
+        if (userId != 0 && userType != 0) {
+            model.put("user_id", "\"" + userId + "\"");
+            List<Uptown> uptowns = rbMapper.selectUptown(userId);
+            if (uptowns != null && uptowns.size() > 0) {
+                Long uptown_id = uptowns.get(0).getUptownId();
+                String uptown_name = uptowns.get(0).getUptownName();
+                model.put("uptown_id", "\"" + uptown_id + "\"");
+                model.put("uptown_name", uptown_name);
+            }
+            if (userType == 1) {
+                MsReport msReport = msReportService.getReportByDateNow(userId);
+                model.put("msReport", new JsonWapper(msReport));
+                model.put("show", "\"" + show + "\"");
+                return new ModelAndView("/home/home.ftl", model);
+            } else if (userType == 2) {
+                List<QzTask> taskList = qzTaskService.selectAll(userId);
+                model.put("taskList", YvanUtil.toJsonPretty(taskList));
+                List<sysUptownUnit> rbList = rbService.selectAll(userId);
+                model.put("rbList", YvanUtil.toJsonPretty(rbList));
+
+                return new ModelAndView("/yeweihui/home.ftl", model);
+            }
+        }
+        return null;
+    }
+
+    @GetMapping("/home/getUptownData.json")
+    public List<Uptown> getUptownData(HttpServletRequest request, @RequestParam(value = "area") Integer area) {
+        return uptownMapper.getAllUptown(area);
     }
-    return null;
-  }
-
-  @GetMapping("/home/getUptownData.json")
-  public List<Uptown> getUptownData(HttpServletRequest request, @RequestParam(value = "area") Integer area) {
-    return uptownMapper.getAllUptown(area);
-  }
-
-  @GetMapping("/home/getUptownUnitData.json")
-  public List<UptownUnit> getUptownUnitData(HttpServletRequest request, @RequestParam(value = "uptownId") Long uptownId) {
-    return uptownUnitMapper.getUptownUnitData(uptownId);
-  }
-
-  @PostMapping("/home/checkHouseId.json")
-  public ResultModel checkHouseId(HttpServletRequest request) {
-    ResultModel resultModel = new ResultModel();
-    Long unitId = Long.parseLong(request.getParameter("unitId"));
-    String doorplate = request.getParameter("doorplate");
-    List<UptownHouse> list = uptownHouseMapper.getUptownHouseBy(unitId, doorplate);
-    if (list.size() > 0) {
-      resultModel.put("success", false);
-      resultModel.put("msg", "该门牌已有人入住!");
-      return resultModel;
+
+    @GetMapping("/home/getUptownUnitData.json")
+    public List<UptownUnit> getUptownUnitData(HttpServletRequest request, @RequestParam(value = "uptownId") Long uptownId) {
+        return uptownUnitMapper.getUptownUnitData(uptownId);
     }
-    resultModel.put("success", true);
-    resultModel.put("msg", "操作成功");
-    return resultModel;
-  }
-
-  @PostMapping("/home/saveUser.json")
-  public void saveUser(ModelMap model, HttpServletRequest request) {
-    Long userId = Long.parseLong(request.getParameter("userId"));
+
+    @PostMapping("/home/checkHouseId.json")
+    public ResultModel checkHouseId(HttpServletRequest request) {
+        ResultModel resultModel = new ResultModel();
+        Long unitId = Long.parseLong(request.getParameter("unitId"));
+        String doorplate = request.getParameter("doorplate");
+        List<UptownHouse> list = uptownHouseMapper.getUptownHouseBy(unitId, doorplate);
+        if (list.size() > 0) {
+            resultModel.put("success", false);
+            resultModel.put("msg", "该门牌已有人入住!");
+            return resultModel;
+        }
+        resultModel.put("success", true);
+        resultModel.put("msg", "操作成功");
+        return resultModel;
+    }
+
+    @PostMapping("/home/saveUser.json")
+    public void saveUser(ModelMap model, HttpServletRequest request) {
+        Long userId = Long.parseLong(request.getParameter("userId"));
 //        Integer userType = Integer.parseInt(request.getParameter("userType"));
-    String linkman = request.getParameter("linkman");
-    String phone = request.getParameter("phone");
-    Integer area = Integer.parseInt(request.getParameter("area"));
-    Long uptownId = Long.parseLong(request.getParameter("uptownId"));
-    Long unitId = Long.parseLong(request.getParameter("unitId"));
-    String doorplate = request.getParameter("doorplate");
-    userOpenService.saveUserInfo(userId, 1, linkman, phone, area, uptownId, unitId, doorplate);
-  }
-
-  @ApiOperation("客户档案信息错误数据导出")
-  @GetMapping("/user/importExcelUserOpen")
-  @SneakyThrows
-  public void errorCustInfo(HttpServletResponse resp) {
-    List<UserOpen> list = userOpenMapper.getAllUser();
-    ExcelUtils.writeSheet(UserOpen.class, list).export(resp, "errorCust");
-  }
-
-  @GetMapping("/home/desc.html")
-  public ModelAndView descHome(ModelMap model) {
-    return new ModelAndView("/home/desc.ftl", model);
-  }
-
-  @GetMapping("/home/homeHelp.html")
-  public ModelAndView homeHelp(ModelMap model) {
-    return new ModelAndView("/home/homeHelp.ftl", model);
-  }
+        String linkman = request.getParameter("linkman");
+        String phone = request.getParameter("phone");
+        Integer area = Integer.parseInt(request.getParameter("area"));
+        Long uptownId = Long.parseLong(request.getParameter("uptownId"));
+        Long unitId = Long.parseLong(request.getParameter("unitId"));
+        String doorplate = request.getParameter("doorplate");
+        userOpenService.saveUserInfo(userId, 1, linkman, phone, area, uptownId, unitId, doorplate);
+    }
+
+    @ApiOperation("客户档案信息错误数据导出")
+    @GetMapping("/user/importExcelUserOpen")
+    @SneakyThrows
+    public void errorCustInfo(HttpServletResponse resp) {
+        List<UserOpen> list = userOpenMapper.getAllUser();
+        ExcelUtils.writeSheet(UserOpen.class, list).export(resp, "errorCust");
+    }
+
+    @GetMapping("/home/desc.html")
+    public ModelAndView descHome(ModelMap model) {
+        return new ModelAndView("/home/desc.ftl", model);
+    }
+
+    @GetMapping("/home/homeHelp.html")
+    public ModelAndView homeHelp(ModelMap model) {
+        return new ModelAndView("/home/homeHelp.ftl", model);
+    }
 }

+ 6 - 6
whepi-web/src/main/resources/mapper/BuyMapper.xml

@@ -32,15 +32,15 @@
     </select>
 
     <select id="status" resultType="com.bofeng.entity.Buy">
-       SELECT a.tg_status,a.tg_price,
-       IFNULL(( SELECT SUM(b.buy_count)
-      FROM jm_buy b WHERE a.jm_id = b.jm_id and buy_status=1), 0 ) AS count
-      FROM jm_tuangou a
-      WHERE a.jm_id = #{jmId} limit 1
+       SELECT a.tg_status, a.tg_price, IFNULL(( SELECT SUM(b.buy_count) FROM jm_buy b WHERE a.jm_id = b.jm_id AND buy_status = 1 ), 0 ) AS count,
+       ( SELECT phone FROM sys_user_role aa INNER JOIN sys_uptown_home bb ON aa.property_id = bb.house_id WHERE aa.role_id = 1 AND aa.user_id = #{userId}
+       LIMIT 1 ) AS phone FROM jm_tuangou a WHERE a.jm_id = #{jmId}
+       AND a.user_id = #{userId}
+       LIMIT 1
     </select>
 
     <select id="selectCountNum" resultType="com.bofeng.entity.Buy">
-        select sum(buy_count) as count,buy_id from jm_buy where jm_id=#{jmId} GROUP BY buy_id
+        select sum(buy_count) as count,jm_id from jm_buy where jm_id=#{jmId} and buy_status=1 GROUP BY jm_id
     </select>
 
 </mapper>

+ 58 - 0
whepi-web/src/main/resources/mapper/UptownUnitMapper.xml

@@ -0,0 +1,58 @@
+<?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.bofeng.dao.UptownUnitMapper">
+    <select id="queryDongList" resultType="com.bofeng.entity.UptownUnit">
+        SELECT DISTINCT a.ridgepole, a.uptown_id, b.uptown_name FROM `sys_uptown_unit` a
+        LEFT JOIN sys_uptown b on a.uptown_id=b.uptown_id
+        <where>
+            <if test="uptownId!=null and uptownId!=''">
+                and a.uptown_id=#{uptownId}
+            </if>
+        </where>
+        order by ridgepole
+    </select>
+
+    <select id="queryDanYuanList" resultType="com.bofeng.entity.UptownUnit">
+        SELECT unit_id, uptown_id, ridgepole, unit FROM `sys_uptown_unit`
+        <where>
+            <if test="uptownId!=null and uptownId!=''">
+                and uptown_id=#{uptownId}
+            </if>
+            <if test="ridgepole!=null and ridgepole!=''">
+                and ridgepole=#{ridgepole}
+            </if>
+        </where>
+        order by unit_id
+    </select>
+
+    <select id="queryMenPaiList" resultType="com.bofeng.entity.UptownUnit">
+        SELECT a.*,c.report_date, c.ms_status,c.safety_num,c.report_id from (
+          SELECT a.house_id, a.doorplate, a.unit_id,b.unit, b.ridgepole,b.uptown_id FROM `sys_uptown_house` a
+          inner JOIN `sys_uptown_unit` b  on a.unit_id=b.unit_id and b.ridgepole=#{ridgepole} and b.unit_id=#{unitId}
+          where b.uptown_id=#{uptownId}
+          order by house_id
+        ) a
+        left JOIN `ms_report` c  on a.house_id=c.house_id  and c.report_date = #{reportDate}
+    </select>
+
+    <select id="queryXiaoQuList" resultType="com.bofeng.entity.UptownUnit">
+        SELECT a.house_id, a.doorplate, a.unit_id,b.unit, b.ridgepole,b.uptown_id FROM `sys_uptown_house` a
+        inner JOIN `sys_uptown_unit` b  on a.unit_id=b.unit_id
+        where b.uptown_id=#{uptownId}
+    </select>
+
+    <select id="queryYiBaoList" resultType="com.bofeng.entity.UptownUnit">
+        SELECT a.house_id, a.doorplate, a.unit_id,b.unit, b.ridgepole,b.uptown_id,c.report_date, c.ms_status FROM `sys_uptown_house` a
+        inner JOIN `sys_uptown_unit` b  on a.unit_id=b.unit_id
+        inner JOIN `ms_report` c  on a.house_id=c.house_id  and c.report_date = #{reportDate}
+        where b.uptown_id=#{uptownId}
+    </select>
+
+    <select id="queryYiChangList" resultType="com.bofeng.entity.UptownUnit">
+        SELECT a.house_id, a.doorplate, a.unit_id,b.unit, b.ridgepole,b.uptown_id,c.report_date, c.ms_status FROM `sys_uptown_house` a
+        inner JOIN `sys_uptown_unit` b  on a.unit_id=b.unit_id
+        inner JOIN `ms_report` c  on a.house_id=c.house_id  and c.report_date = #{reportDate} and c.ms_status=2
+        where b.uptown_id=#{uptownId}
+    </select>
+
+</mapper>