Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/master'

yuliang 5 anni fa
parent
commit
f766b68854

+ 1 - 1
whepi-doc/mrsb.sql

@@ -44,7 +44,7 @@ CREATE TABLE ms_suspected  (
   diarrhea          int(11)    NOT NULL DEFAULT 0                           COMMENT '腹泻:0无,1轻度腹泻少于于3次,2中度腹泻4-6次,3重度腹泻超过6次',
   diarrhea          int(11)    NOT NULL DEFAULT 0                           COMMENT '腹泻:0无,1轻度腹泻少于于3次,2中度腹泻4-6次,3重度腹泻超过6次',
   score_histroy     int(11)    NOT NULL DEFAULT 0                           COMMENT '历史数据,没有历史数据,就是1分以下为安全,2分到3分为注意观察,3分以上联系医生,5分尽快就诊。有历史数据,一天增加三分及以上就是建议马上就医',
   score_histroy     int(11)    NOT NULL DEFAULT 0                           COMMENT '历史数据,没有历史数据,就是1分以下为安全,2分到3分为注意观察,3分以上联系医生,5分尽快就诊。有历史数据,一天增加三分及以上就是建议马上就医',
   score             int(11)    NOT NULL DEFAULT 0                           COMMENT '今日数据',
   score             int(11)    NOT NULL DEFAULT 0                           COMMENT '今日数据',
-  score_rezult      int(11)    NOT NULL DEFAULT 0                           COMMENT '评分结果,未评分(0),安全(1),注意观察(2),联系医生(3),尽快就诊(4)',
+  score_rezult      int(11)    NOT NULL DEFAULT 0                           COMMENT '评分结果,未评分(0),正常(1),注意观察(2),联系医生(3),尽快就诊(4)',
   single_room       int(11)    NOT NULL DEFAULT 0                           COMMENT '单间隔离:0否,1是',
   single_room       int(11)    NOT NULL DEFAULT 0                           COMMENT '单间隔离:0否,1是',
   suspected_status  int(11)    NOT NULL DEFAULT 0                           COMMENT '是否疑似:0否,1是',
   suspected_status  int(11)    NOT NULL DEFAULT 0                           COMMENT '是否疑似:0否,1是',
   others            varchar(600)  NOT NULL DEFAULT ''                       COMMENT '其他',
   others            varchar(600)  NOT NULL DEFAULT ''                       COMMENT '其他',

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

@@ -30,10 +30,10 @@
             <div class="weui-tabbar__icon"><img src="/static/images/wx/customer_service.png" alt=""></div>
             <div class="weui-tabbar__icon"><img src="/static/images/wx/customer_service.png" alt=""></div>
             <p class="weui-tabbar__label">求助</p>
             <p class="weui-tabbar__label">求助</p>
         </a>
         </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">-->
     <#--<a href="#tab3" class="weui-tabbar__item">-->
     <#--<div class="weui-tabbar__icon"> <img src="./images/icon_nav_article.png" alt=""> </div>-->
     <#--<div class="weui-tabbar__icon"> <img src="./images/icon_nav_article.png" alt=""> </div>-->
     <#--<p class="weui-tabbar__label">发现</p>-->
     <#--<p class="weui-tabbar__label">发现</p>-->

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

@@ -49,49 +49,49 @@
 
 
         let title = $("#tg_input_title").val();
         let title = $("#tg_input_title").val();
         if (title.length <= 0) {
         if (title.length <= 0) {
-            alert("请输入组团标题");
+            $.alert("请输入组团标题");
             return;
             return;
         }
         }
 
 
         let supplier = $("#tg_input_supplier").val();
         let supplier = $("#tg_input_supplier").val();
         if (supplier.length <= 0) {
         if (supplier.length <= 0) {
-            alert("请输入供应商名称");
+            $.alert("请输入供应商名称");
             return;
             return;
         }
         }
 
 
         let goods = $("#tg_input_goods").val();
         let goods = $("#tg_input_goods").val();
         if (goods.length <= 0) {
         if (goods.length <= 0) {
-            alert("请输入套餐内容");
+            $.alert("请输入套餐内容");
             return;
             return;
         }
         }
 
 
         let price = $("#tg_input_price").val();
         let price = $("#tg_input_price").val();
         if (price.length <= 0) {
         if (price.length <= 0) {
-            alert("请输入套餐单价");
+            $.alert("请输入套餐单价");
             return;
             return;
         }
         }
 
 
         let mixnum = $("#tg_input_mixnum").val();
         let mixnum = $("#tg_input_mixnum").val();
         if (mixnum.length <= 0) {
         if (mixnum.length <= 0) {
-            alert("请输入最小起订量");
+            $.alert("请输入最小起订量");
             return;
             return;
         }
         }
 
 
         let end_time = $("#tg_input_end_time").val();
         let end_time = $("#tg_input_end_time").val();
         if (end_time.length <= 0) {
         if (end_time.length <= 0) {
-            alert("请选择截止时间");
+            $.alert("请选择截止时间");
             return;
             return;
         }
         }
 
 
         let deliver_time = $("#tg_input_deliver_time").val();
         let deliver_time = $("#tg_input_deliver_time").val();
         if (deliver_time.length <= 0) {
         if (deliver_time.length <= 0) {
-            alert("请选择送货时间");
+            $.alert("请选择送货时间");
             return;
             return;
         }
         }
 
 
         let phone_number = $("#tg_input_phone_number").val();
         let phone_number = $("#tg_input_phone_number").val();
         if (phone_number.length <= 0) {
         if (phone_number.length <= 0) {
-            alert("请输入服务电话");
+            $.alert("请输入服务电话");
             return;
             return;
         }
         }
 
 

+ 1 - 1
whepi-ui/templates/yeweihui/tuangouMemberList.ftl

@@ -9,7 +9,7 @@
 
 
     <div class="weui-btn-area">
     <div class="weui-btn-area">
         <div style="display: flex; flex-direction: row; justify-content: space-around;">
         <div style="display: flex; flex-direction: row; justify-content: space-around;">
-            <div id="tg_member_xiaoqu">敬业小区</div>
+            <div id="tg_member_xiaoqu"></div>
             <div id="tg_member_num">当前已团: </div>
             <div id="tg_member_num">当前已团: </div>
         </div>
         </div>
 
 

+ 4 - 5
whepi-web/src/main/java/com/bofeng/controller/RootController.java

@@ -9,7 +9,6 @@ import com.yvan.mvc.Pd;
 import com.yvan.platform.JsonWapper;
 import com.yvan.platform.JsonWapper;
 import com.yvan.springmvc.HttpUtils;
 import com.yvan.springmvc.HttpUtils;
 import com.yvan.springmvc.ResultModel;
 import com.yvan.springmvc.ResultModel;
-import io.swagger.annotations.ApiOperation;
 import org.joda.time.DateTime;
 import org.joda.time.DateTime;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -35,7 +34,7 @@ public class RootController {
     }
     }
 
 
 
 
-//    @ApiOperation("获取当前用户信息")
+    //    @ApiOperation("获取当前用户信息")
     @GetMapping("/me")
     @GetMapping("/me")
     public Model<ResultModel> me() {
     public Model<ResultModel> me() {
         ResultModel model = new ResultModel()
         ResultModel model = new ResultModel()
@@ -46,7 +45,7 @@ public class RootController {
         return Model.newSuccess(model);
         return Model.newSuccess(model);
     }
     }
 
 
-//    @ApiOperation("time")
+    //    @ApiOperation("time")
     @GetMapping("/time")
     @GetMapping("/time")
     public Model<Map<String, Long>> time(@Pd(name = "t1", desc = "客户端时间") Long t1) {
     public Model<Map<String, Long>> time(@Pd(name = "t1", desc = "客户端时间") Long t1) {
         Map<String, Long> timeRp = new LinkedHashMap<>();
         Map<String, Long> timeRp = new LinkedHashMap<>();
@@ -66,7 +65,7 @@ public class RootController {
         return Model.newSuccess(timeRp);
         return Model.newSuccess(timeRp);
     }
     }
 
 
-//    @ApiOperation("获取当前访问属性")
+    //    @ApiOperation("获取当前访问属性")
     @GetMapping("/domain")
     @GetMapping("/domain")
     public Model<JsonWapper> domain(HttpServletRequest request) {
     public Model<JsonWapper> domain(HttpServletRequest request) {
         JsonWapper jw = new JsonWapper();
         JsonWapper jw = new JsonWapper();
@@ -107,7 +106,7 @@ public class RootController {
         return Model.newSuccess(bofengProperties);
         return Model.newSuccess(bofengProperties);
     }
     }
 
 
-    @GetMapping(value = {"/", "/index.html"})
+    @GetMapping(value = {"/"})
     public ModelAndView index() {
     public ModelAndView index() {
         if (!JwtHelper.isLogined()) {
         if (!JwtHelper.isLogined()) {
             return new ModelAndView(new RedirectViewJs("/user/login.html"));
             return new ModelAndView(new RedirectViewJs("/user/login.html"));

+ 7 - 23
whepi-web/src/main/java/com/bofeng/controller/UserController.java

@@ -1,34 +1,13 @@
 package com.bofeng.controller;
 package com.bofeng.controller;
 
 
-import com.baomidou.mybatisplus.toolkit.IdWorker;
-import com.bofeng.Consts;
-import com.bofeng.JwtHelper;
-import com.bofeng.entity.*;
 import com.bofeng.service.*;
 import com.bofeng.service.*;
-import com.google.common.base.Strings;
-import com.yvan.Model;
-import com.yvan.ModelOps;
-import com.yvan.freemarker.RedirectViewJs;
-import com.yvan.mvc.Pd;
-import com.yvan.platform.Conv;
-import com.yvan.springmvc.HttpUtils;
-import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
-import me.chanjar.weixin.common.error.WxErrorException;
 import me.chanjar.weixin.mp.api.WxMpService;
 import me.chanjar.weixin.mp.api.WxMpService;
-import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
-import me.chanjar.weixin.mp.bean.result.WxMpUser;
-import org.apache.shiro.SecurityUtils;
-import org.apache.shiro.authc.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.ui.ModelMap;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.servlet.ModelAndView;
 import org.springframework.web.servlet.ModelAndView;
 
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.Map;
-
 @RestController
 @RestController
 @Slf4j
 @Slf4j
 public class UserController {
 public class UserController {
@@ -51,6 +30,11 @@ public class UserController {
     @Autowired
     @Autowired
     private PlaceService placeService;
     private PlaceService placeService;
 
 
+    @GetMapping("/index.html")
+    public ModelAndView index() {
+        return new ModelAndView("/index.html");
+    }
+
 //    @GetMapping("/user/logout.html")
 //    @GetMapping("/user/logout.html")
 //    @PostMapping("/user/logout.html")
 //    @PostMapping("/user/logout.html")
 //    public ModelAndView logout() {
 //    public ModelAndView logout() {

+ 33 - 24
whepi-web/src/main/java/com/bofeng/controller/WxSysAreaController.java

@@ -3,15 +3,14 @@ package com.bofeng.controller;
 import com.bofeng.dao.SysAreaMapper;
 import com.bofeng.dao.SysAreaMapper;
 import com.bofeng.entity.SysArea;
 import com.bofeng.entity.SysArea;
 import com.bofeng.entity.Uptown;
 import com.bofeng.entity.Uptown;
-import com.bofeng.entity.UptownUnit;
+import com.bofeng.entity.sysUptownUnit;
 import com.bofeng.service.SysAreaService;
 import com.bofeng.service.SysAreaService;
 import com.yvan.Model;
 import com.yvan.Model;
-import com.yvan.mvc.Pd;
+import com.yvan.platform.JsonWapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
-import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 import java.util.List;
 
 
 @RestController
 @RestController
@@ -30,8 +29,8 @@ public class WxSysAreaController {
 
 
     //选择城市
     //选择城市
     @PostMapping("/admin/selectCityByProvince")
     @PostMapping("/admin/selectCityByProvince")
-    public Model<List<SysArea>> selectCityByProvince(@Pd(name = "areaId", desc = "省份的ID") Long areaId) {
-        //Long areaId = Long.parseLong(request.getParameter("areaId"));
+    public Model<List<SysArea>> selectCityByProvince(JsonWapper jsonWapper) {
+        Long areaId = jsonWapper.asObject(Long.class, "areaId");
         if (areaId == null || areaId == 0L) {
         if (areaId == null || areaId == 0L) {
             return Model.newFail("请选择所在省");
             return Model.newFail("请选择所在省");
         }
         }
@@ -40,8 +39,8 @@ public class WxSysAreaController {
 
 
     //选择区
     //选择区
     @PostMapping("/admin/selectAreaByCity")
     @PostMapping("/admin/selectAreaByCity")
-    public Model<List<SysArea>> selectAreaByCity(HttpServletRequest request) {
-        Long areaId = Long.parseLong(request.getParameter("areaId"));
+    public Model<List<SysArea>> selectAreaByCity(JsonWapper jsonWapper) {
+        Long areaId = jsonWapper.asObject(Long.class, "areaId");
         if (areaId == null || areaId == 0L) {
         if (areaId == null || areaId == 0L) {
             return Model.newFail("请选择所在城市");
             return Model.newFail("请选择所在城市");
         }
         }
@@ -50,32 +49,42 @@ public class WxSysAreaController {
 
 
     //选择小区
     //选择小区
     @PostMapping("/admin/selectUptownByArea")
     @PostMapping("/admin/selectUptownByArea")
-    public Model<List<Uptown>> selectUptownByArea(HttpServletRequest request) {
-        Long areaId = Long.parseLong(request.getParameter("areaId"));
+    public Model<List<Uptown>> selectUptownByArea(JsonWapper jsonWapper) {
+        Long areaId = jsonWapper.asObject(Long.class, "areaId");
         if (areaId == null || areaId == 0L) {
         if (areaId == null || areaId == 0L) {
             return Model.newFail("请选择所在区");
             return Model.newFail("请选择所在区");
         }
         }
         return Model.newSuccess(sysAreaMapper.selectUptownByArea(areaId));
         return Model.newSuccess(sysAreaMapper.selectUptownByArea(areaId));
     }
     }
 
 
-    //选择栋
-    @PostMapping("/admin/selectRidgepoleByArea")
-    public Model<List<String>> selectRidgepoleByArea(HttpServletRequest request) {
-        Long uptownId = Long.parseLong(request.getParameter("uptownId"));
-        if (uptownId == null || uptownId == 0L) {
-            return Model.newFail("请选择所在小区");
-        }
-        return Model.newSuccess(sysAreaMapper.selectRidgepoleByArea(uptownId));
-    }
+//    //选择栋
+//    @PostMapping("/admin/selectRidgepoleByUptownId")
+//    public Model<List<String>> selectRidgepoleByUptownId(JsonWapper jsonWapper) {
+//        Long uptownId = jsonWapper.asObject(Long.class, "uptownId");
+//        if (uptownId == null || uptownId == 0L) {
+//            return Model.newFail("请选择所在小区");
+//        }
+//        return Model.newSuccess(sysAreaMapper.selectRidgepoleByUptownId(uptownId));
+//    }
+//
+//    //选择单元
+//    @PostMapping("/admin/selectUnitByUptownIdAndRidgepole")
+//    public Model<List<UptownUnit>> selectUnitByUptownIdAndRidgepole(JsonWapper jsonWapper) {
+//        Long uptownId = jsonWapper.asObject(Long.class, "uptownId");
+//        Long ridgepole = jsonWapper.asObject(Long.class, "ridgepole");
+//        if (uptownId == null || uptownId == 0L) {
+//            return Model.newFail("请选择所在小区");
+//        }
+//        return Model.newSuccess(sysAreaMapper.selectUnitByUptownIdAndRidgepole(uptownId, ridgepole));
+//    }
 
 
-    //选择单元
-    @PostMapping("/admin/selectUnitByArea")
-    public Model<List<UptownUnit>> selectUnitByArea(HttpServletRequest request) {
-        Long uptownId = Long.parseLong(request.getParameter("uptownId"));
-        Long ridgepole = Long.parseLong(request.getParameter("ridgepole"));
+    //选择栋和单元
+    @PostMapping("/admin/selectUnitByUptownId")
+    public Model<List<sysUptownUnit>> selectUnitByUptownId(JsonWapper jsonWapper) {
+        Long uptownId = jsonWapper.asObject(Long.class, "uptownId");
         if (uptownId == null || uptownId == 0L) {
         if (uptownId == null || uptownId == 0L) {
             return Model.newFail("请选择所在小区");
             return Model.newFail("请选择所在小区");
         }
         }
-        return Model.newSuccess(sysAreaMapper.selectUnitByArea(uptownId, ridgepole));
+        return Model.newSuccess(sysAreaMapper.selectUnitByUptownId(uptownId));
     }
     }
 }
 }

+ 21 - 11
whepi-web/src/main/java/com/bofeng/controller/WxUserOpenController.java

@@ -8,6 +8,7 @@ import com.bofeng.service.HomeService;
 import com.bofeng.service.WxUserOpenService;
 import com.bofeng.service.WxUserOpenService;
 import com.yvan.Model;
 import com.yvan.Model;
 import com.yvan.mvc.JsonBody;
 import com.yvan.mvc.JsonBody;
+import com.yvan.platform.JsonWapper;
 import com.yvan.platform.StringUtils;
 import com.yvan.platform.StringUtils;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -30,11 +31,16 @@ public class WxUserOpenController {
 
 
     @ApiOperation("用户注册页面点登录")
     @ApiOperation("用户注册页面点登录")
     @PostMapping("/userOpen/login")
     @PostMapping("/userOpen/login")
-    public Model<Long> login() {
-        UserOpen userOpen = homeService.getUserOpen();
+    public Model<Long> login(HttpServletRequest request) {
+        String code = request.getParameter("code").trim();
+        if (StringUtils.isNullOrEmpty(code)) {
+            return Model.newFail("code为空");
+        }
+        UserOpen userOpen = homeService.getUserOpenByCode(code);
         if (userOpen == null) {
         if (userOpen == null) {
             return Model.newFail("微信登录失败");
             return Model.newFail("微信登录失败");
         }
         }
+
         //成功返回用户Id
         //成功返回用户Id
         return Model.newSuccess(userOpen.getUserId());
         return Model.newSuccess(userOpen.getUserId());
     }
     }
@@ -66,14 +72,18 @@ public class WxUserOpenController {
         return Model.newSuccess(list);
         return Model.newSuccess(list);
     }
     }
 
 
-    @ApiOperation("完善家庭及住宅信息")
+    @ApiOperation("创建家庭角色,完善家庭及住宅信息")
     @PostMapping("/userOpen/createFamily")
     @PostMapping("/userOpen/createFamily")
-    public Model<Long> createFamily(HttpServletRequest request) throws Exception {
-        Long unitId = Long.parseLong(request.getParameter("unitId"));
-        String doorPlate = request.getParameter("doorPlate");
-        String linkMan = request.getParameter("linkMan");
-        Integer helpNum = Integer.parseInt(request.getParameter("helpNum"));
-        String phone = request.getParameter("phone");
+    public Model<Long> createFamily(JsonWapper jsonWapper) throws Exception {
+        Long userId = jsonWapper.asObject(Long.class, "userId");
+        Long unitId = jsonWapper.asObject(Long.class, "unitId");
+        String doorPlate = jsonWapper.asObject(String.class, "doorPlate");
+        String linkMan = jsonWapper.asObject(String.class, "linkMan");
+        Integer helpNum = jsonWapper.asObject(Integer.class, "helpNum");
+        String phone = jsonWapper.asObject(String.class, "phone");
+        if (userId == null || userId == 0L) {
+            return Model.newFail("用户不存在");
+        }
         if (unitId == null || unitId == 0L) {
         if (unitId == null || unitId == 0L) {
             return Model.newFail("请选择所在单元");
             return Model.newFail("请选择所在单元");
         }
         }
@@ -90,10 +100,10 @@ public class WxUserOpenController {
             return Model.newFail("请填写家庭联系电话");
             return Model.newFail("请填写家庭联系电话");
         }
         }
         //成功返回用户Id
         //成功返回用户Id
-        return Model.newSuccess(wxUserOpenService.createFamily(unitId, doorPlate, linkMan, helpNum, phone));
+        return Model.newSuccess(wxUserOpenService.createFamily(userId, unitId, doorPlate, linkMan, helpNum, phone));
     }
     }
 
 
-    @ApiOperation("完善家庭及住宅信息")
+    @ApiOperation("创建业委会角色、成员信息")
     @PostMapping("/userOpen/createYWH")
     @PostMapping("/userOpen/createYWH")
     public Model<Long> createYWH(HttpServletRequest request, @JsonBody List<OwnerLinkman> lstOwner) throws Exception {
     public Model<Long> createYWH(HttpServletRequest request, @JsonBody List<OwnerLinkman> lstOwner) throws Exception {
         Long uptownId = Long.parseLong(request.getParameter("uptownId"));
         Long uptownId = Long.parseLong(request.getParameter("uptownId"));

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

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.mapper.BaseMapper;
 import com.bofeng.entity.SysArea;
 import com.bofeng.entity.SysArea;
 import com.bofeng.entity.Uptown;
 import com.bofeng.entity.Uptown;
 import com.bofeng.entity.UptownUnit;
 import com.bofeng.entity.UptownUnit;
+import com.bofeng.entity.sysUptownUnit;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Select;
@@ -30,10 +31,13 @@ public interface SysAreaMapper extends BaseMapper<SysArea> {
 
 
     //查询小区的栋
     //查询小区的栋
     @Select("select ridgepole from sys_uptown_unit where status = 1 and uptown_id = #{uptownId} group by ridgepole")
     @Select("select ridgepole from sys_uptown_unit where status = 1 and uptown_id = #{uptownId} group by ridgepole")
-    List<String> selectRidgepoleByArea(@Param("uptownId") Long uptownId);
+    List<String> selectRidgepoleByUptownId(@Param("uptownId") Long uptownId);
 
 
     //查询小区栋的单元
     //查询小区栋的单元
     @Select("select * from sys_uptown_unit where status = 1 and uptown_id = #{uptownId} and ridgepole = #{ridgepole}")
     @Select("select * from sys_uptown_unit where status = 1 and uptown_id = #{uptownId} and ridgepole = #{ridgepole}")
-    List<UptownUnit> selectUnitByArea(@Param("uptownId") Long uptownId, @Param("ridgepole") Long ridgepole);
+    List<UptownUnit> selectUnitByUptownIdAndRidgepole(@Param("uptownId") Long uptownId, @Param("ridgepole") Long ridgepole);
 
 
+    //查询小区栋和单元
+    @Select("select *,case when uptown_id<10000 then CONCAT(ridgepole,'栋',unit,'单元') else CONCAT(ridgepole,'-',unit) end as teamUnit from sys_uptown_unit where status = 1 and uptown_id = #{uptownId} order by ridgepole,unit")
+    List<sysUptownUnit> selectUnitByUptownId(@Param("uptownId") Long uptownId);
 }
 }

+ 39 - 7
whepi-web/src/main/java/com/bofeng/entity/JmTuangouMember.java

@@ -7,32 +7,64 @@ import lombok.Data;
 public class JmTuangouMember {
 public class JmTuangouMember {
 
 
     /**
     /**
+     * 团购标题
+     */
+    @ExcelProperty(value = "团购标题", index = 0)
+    private String tgTitle;
+
+    /**
+     * 团购供应商
+     */
+    @ExcelProperty(value = "团购供应商", index = 1)
+    private String tgSupplier;
+
+    /**
+     * 团购物资(套餐)
+     */
+    @ExcelProperty(value = "团购物资(套餐)", index = 2)
+    private String tgGoods;
+
+    /**
+     * 价格
+     */
+    @ExcelProperty(value = "价格", index = 3)
+    private String tgPrice;
+
+    /**
+     * 最小起订量
+     */
+    @ExcelProperty(value = "最小起订量", index = 4)
+    private Integer tgMinNum;
+    /**
+     * 小区名称
+     */
+    @ExcelProperty(value = "小区名称", index = 5)
+    private String uptownName;
+    /**
      * 栋
      * 栋
      */
      */
-    @ExcelProperty(value = "楼栋", index = 0)
+    @ExcelProperty(value = "楼栋", index = 6)
     private String ridgepole;
     private String ridgepole;
     /**
     /**
      * 单元
      * 单元
      */
      */
-    @ExcelProperty(value = "单元", index = 1)
+    @ExcelProperty(value = "单元", index = 7)
     private String unit;
     private String unit;
     /**
     /**
      * 门牌号
      * 门牌号
      */
      */
-    @ExcelProperty(value = "门牌号", index = 2)
+    @ExcelProperty(value = "门牌号", index = 8)
     private String houseNumber;
     private String houseNumber;
     /**
     /**
      * 参团数量
      * 参团数量
      */
      */
-    @ExcelProperty(value = "参团数量", index = 3)
+    @ExcelProperty(value = "参团数量", index = 9)
     private Integer buyCount;
     private Integer buyCount;
     /**
     /**
      * 联系方式
      * 联系方式
      */
      */
-    @ExcelProperty(value = "联系方式", index = 4)
+    @ExcelProperty(value = "联系方式", index = 10)
     private String phone;
     private String phone;
 
 
     private Integer uptownId;
     private Integer uptownId;
-
-    private String uptownName;
 }
 }

+ 31 - 7
whepi-web/src/main/java/com/bofeng/entity/sysUptownUnit.java

@@ -3,24 +3,48 @@ package com.bofeng.entity;
 import com.baomidou.mybatisplus.annotations.TableField;
 import com.baomidou.mybatisplus.annotations.TableField;
 import com.baomidou.mybatisplus.annotations.TableId;
 import com.baomidou.mybatisplus.annotations.TableId;
 import com.baomidou.mybatisplus.annotations.TableName;
 import com.baomidou.mybatisplus.annotations.TableName;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
 import org.joda.time.DateTime;
 import org.joda.time.DateTime;
 
 
 @Data
 @Data
+@Getter
+@Setter
 @TableName("sys_uptown_unit")
 @TableName("sys_uptown_unit")
 public class sysUptownUnit {
 public class sysUptownUnit {
-    @TableId("unit_id")
+    @ApiModelProperty("单元ID")
+    @TableId("UNIT_ID")
     private Long unitId;
     private Long unitId;
-    @TableField("uptown_id")
+
+    @ApiModelProperty("小区ID")
+    @TableField("UPTOWN_ID")
     private Long uptownId;
     private Long uptownId;
-    @TableField("ridgepole")
+
+    @ApiModelProperty("栋")
+    @TableField("RIDGEPOLE")
     private String ridgepole;
     private String ridgepole;
-    @TableField("unit")
+
+    @ApiModelProperty("单元")
+    @TableField("UNIT")
     private String unit;
     private String unit;
-    @TableField("status")
+
+    @ApiModelProperty("状态:1正常,0草稿,-1删除")
+    @TableField("STATUS")
     private int status;
     private int status;
-    @TableField("time_create")
+
+    @ApiModelProperty("新增时间")
+    @TableField("TIME_CREATE")
     private DateTime timeCreate;
     private DateTime timeCreate;
-    @TableField("time_update")
+
+    @ApiModelProperty("修改时间")
+    @TableField("TIME_UPDATE")
     private DateTime timeUpdate;
     private DateTime timeUpdate;
+
+    /**
+     * 栋和单元合并显示
+     */
+    @TableField(exist = false)
+    private String teamUnit;
 }
 }

+ 35 - 12
whepi-web/src/main/java/com/bofeng/service/HomeService.java

@@ -4,24 +4,12 @@ import com.baomidou.mybatisplus.toolkit.IdWorker;
 import com.bofeng.dao.UserOpenMapper;
 import com.bofeng.dao.UserOpenMapper;
 import com.bofeng.entity.ParseCurrentOpenId;
 import com.bofeng.entity.ParseCurrentOpenId;
 import com.bofeng.entity.UserOpen;
 import com.bofeng.entity.UserOpen;
-import com.google.common.base.Strings;
-import com.google.common.collect.Maps;
-import com.yvan.springmvc.HttpParameterParser;
-import com.yvan.springmvc.HttpUtils;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
-import lombok.val;
-import me.chanjar.weixin.common.error.WxErrorException;
-import me.chanjar.weixin.mp.api.WxMpService;
-import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
 import me.chanjar.weixin.mp.bean.result.WxMpUser;
 import me.chanjar.weixin.mp.bean.result.WxMpUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.servlet.ModelAndView;
-
-import java.util.Map;
 
 
 @Service
 @Service
 @Transactional(readOnly = true)
 @Transactional(readOnly = true)
@@ -67,4 +55,39 @@ public class HomeService {
         }
         }
         return user;
         return user;
     }
     }
+
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+    public UserOpen getUserOpenByCode(String code) {
+        ParseCurrentOpenId wxToken = userService.currentWxUserByCode(code);
+        WxMpUser wxMpUser = wxToken.getWxMpUser();
+        UserOpen user = userOpenMapper.selectByOpenId(wxMpUser.getOpenId());
+        if (user == null) {
+            // 账户没有注册,需要注册
+            UserOpen userOpen = new UserOpen();
+            userOpen.setUserId(IdWorker.getId());
+            userOpen.setOpenId(wxMpUser.getOpenId());
+            userOpen.setNickName(wxMpUser.getNickname());
+            userOpen.setSexDesc(wxMpUser.getSexDesc());
+            userOpen.setSex(wxMpUser.getSex());
+            userOpen.setCity(wxMpUser.getCity());
+            userOpen.setProvince(wxMpUser.getProvince());
+            userOpen.setCountry(wxMpUser.getCountry());
+            userOpen.setHeadImgUrl(wxMpUser.getHeadImgUrl());
+            userOpen.setBeActive("Y");
+            userOpenMapper.insert(userOpen);
+            return userOpen;
+        }
+        if (!user.getNickName().equals(wxMpUser.getNickname())) {
+            user.setOpenId(wxMpUser.getOpenId());
+            user.setNickName(wxMpUser.getNickname());
+            user.setSexDesc(wxMpUser.getSexDesc());
+            user.setSex(wxMpUser.getSex());
+            user.setCity(wxMpUser.getCity());
+            user.setProvince(wxMpUser.getProvince());
+            user.setCountry(wxMpUser.getCountry());
+            user.setHeadImgUrl(wxMpUser.getHeadImgUrl());
+            userOpenMapper.updateById(user);
+        }
+        return user;
+    }
 }
 }

+ 60 - 6
whepi-web/src/main/java/com/bofeng/service/UserService.java

@@ -1,6 +1,5 @@
 package com.bofeng.service;
 package com.bofeng.service;
 
 
-import com.baomidou.mybatisplus.toolkit.IdWorker;
 import com.bofeng.Consts;
 import com.bofeng.Consts;
 import com.bofeng.dao.UserMapper;
 import com.bofeng.dao.UserMapper;
 import com.bofeng.dao.UserOpenMapper;
 import com.bofeng.dao.UserOpenMapper;
@@ -9,8 +8,6 @@ import com.bofeng.entity.ParseCurrentOpenId;
 import com.bofeng.entity.User;
 import com.bofeng.entity.User;
 import com.google.common.base.Strings;
 import com.google.common.base.Strings;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Maps;
-import com.yvan.PageDb;
-import com.yvan.platform.YvanUtil;
 import com.yvan.springmvc.HttpParameterParser;
 import com.yvan.springmvc.HttpParameterParser;
 import com.yvan.springmvc.HttpUtils;
 import com.yvan.springmvc.HttpUtils;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
@@ -26,7 +23,6 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.servlet.ModelAndView;
 import org.springframework.web.servlet.ModelAndView;
 
 
-import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
 @Service
 @Service
@@ -68,7 +64,6 @@ public class UserService {
     }
     }
 
 
 
 
-
 //    @Transactional
 //    @Transactional
 //    public String updateById(User user) {
 //    public String updateById(User user) {
 //
 //
@@ -104,7 +99,7 @@ public class UserService {
 
 
     @Transactional
     @Transactional
     public int updatePassword(Long userId, String password, String newPassword) {
     public int updatePassword(Long userId, String password, String newPassword) {
-        return userMapper.updatePassword(userId,password, newPassword);
+        return userMapper.updatePassword(userId, password, newPassword);
     }
     }
 
 
     @Transactional
     @Transactional
@@ -201,4 +196,63 @@ public class UserService {
         r.setError(false);
         r.setError(false);
         return r;
         return r;
     }
     }
+
+    public ParseCurrentOpenId currentWxUserByCode(String code) {
+        val r = new ParseCurrentOpenId();
+        String openId = "";
+
+        Map<String, Object> model = Maps.newLinkedHashMap();
+        model.put("title", "授权错误");
+
+        if (!Strings.isNullOrEmpty(code)) {
+            try {
+
+                WxMpOAuth2AccessToken accessToken = wxMpService.oauth2getAccessToken(code);
+                WxMpUser wxMpUser = wxMpService.oauth2getUserInfo(accessToken, null);
+                r.setWxMpUser(wxMpUser);
+                openId = wxMpUser.getOpenId();
+
+            } catch (WxErrorException e) {
+                model.put("message", "获取code失败 " + code);
+                model.put("isError", true);
+                r.setErrorResult(new ModelAndView("/prompt/prompt.ftl", model));
+                r.setError(true);
+
+                log.error("获取code失败 " + code, e);
+                return r;
+            }
+        }
+
+        if (Strings.isNullOrEmpty(openId)) {
+            model.put("message", "OpenId 为空 " + code);
+            model.put("isError", true);
+            r.setErrorResult(new ModelAndView("/prompt/prompt.ftl", model));
+            r.setError(true);
+            log.error("OpenId 为空 " + code);
+            return r;
+        }
+
+        val userOpen = userOpenService.getUserByOpenId(openId);
+        if (userOpen == null) {
+            model.put("message", "userOpen 不存在 " + openId);
+            model.put("isError", true);
+            r.setErrorResult(new ModelAndView("/prompt/prompt.ftl", model));
+            r.setError(true);
+            log.error("userOpen 不存在 " + openId);
+            return r;
+        }
+        if (!Consts.ACT_ENABLE.equals(userOpen.getBeActive())) {
+            model.put("message", "userOpen 被禁用 " + userOpen.getUserId());
+            model.put("isError", true);
+            r.setErrorResult(new ModelAndView("/prompt/prompt.ftl", model));
+            r.setError(true);
+            log.error("userOpen 被禁用 " + userOpen.getUserId());
+            return r;
+        }
+
+        r.setUserOpen(userOpen);
+//        r.setUser(user);
+        r.setError(false);
+        return r;
+    }
 }
 }

+ 16 - 9
whepi-web/src/main/java/com/bofeng/service/WxUserOpenService.java

@@ -63,15 +63,22 @@ public class WxUserOpenService {
     }
     }
 
 
     @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
     @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
-    public Long createFamily(Long unitId, String doorPlate, String linkMan, Integer helpNum, String phone) throws Exception {
-        UserOpen userOpen = homeService.getUserOpen();
-        if (userOpen == null) {
-            throw new Exception("微信登录失败");
+    public Long createFamily(Long userId, Long unitId, String doorPlate, String linkMan, Integer helpNum, String phone) throws Exception {
+        Long sysUserId = 0L;
+        if (userId == null || userId == 0L) {
+            UserOpen userOpen = homeService.getUserOpen();
+            if (userOpen == null) {
+                throw new Exception("微信登录失败");
+            }
+            sysUserId = userOpen.getUserId();
+        } else {
+            sysUserId = userId;
         }
         }
+
         //判断该用户是否已经创建了家庭用户角色
         //判断该用户是否已经创建了家庭用户角色
         List<UserRole> lstUserRole = new ArrayList<>();
         List<UserRole> lstUserRole = new ArrayList<>();
-        if (userOpen.getUserId() > 0L) {
-            lstUserRole = userRoleMapper.getUserRoleByUserId(userOpen.getUserId());
+        if (sysUserId > 0L) {
+            lstUserRole = userRoleMapper.getUserRoleByUserId(sysUserId);
         }
         }
         if (lstUserRole.size() > 0) {
         if (lstUserRole.size() > 0) {
             for (UserRole item : lstUserRole) {
             for (UserRole item : lstUserRole) {
@@ -83,9 +90,9 @@ public class WxUserOpenService {
         //创建家庭用户角色
         //创建家庭用户角色
         UserRole userRole = new UserRole();
         UserRole userRole = new UserRole();
         userRole.setUrId(IdWorker.getId());
         userRole.setUrId(IdWorker.getId());
-        userRole.setUserId(userOpen.getUserId());
-        userRole.setUserCreate(userOpen.getUserId());
-        userRole.setUserUpdate(userOpen.getUserId());
+        userRole.setUserId(sysUserId);
+        userRole.setUserCreate(sysUserId);
+        userRole.setUserUpdate(sysUserId);
         userRole.setRoleId(1);  //家庭用户
         userRole.setRoleId(1);  //家庭用户
 
 
         //判断该门牌号是否被创建(该楼栋单元下)
         //判断该门牌号是否被创建(该楼栋单元下)

+ 17 - 12
whepi-web/src/main/resources/mapper/JmTuangouMemberMapper.xml

@@ -3,18 +3,23 @@
 <mapper namespace="com.bofeng.dao.JmTuangouMemberDao">
 <mapper namespace="com.bofeng.dao.JmTuangouMemberDao">
 
 
     <select id="querMemberListByJmId" resultType="com.bofeng.entity.JmTuangouMember">
     <select id="querMemberListByJmId" resultType="com.bofeng.entity.JmTuangouMember">
-        select a.user_id,a.buy_count,a.phone, y.houseNumber, y.ridgepole, y.unit, y.uptown_id, y.uptown_name from jm_buy a
-        LEFT JOIN
-          (
-              select a.user_id, b.house_id, b.doorplate as houseNumber, c.uptown_id, c.ridgepole, c.unit, u.uptown_name
-              FROM sys_user_role a
-                       INNER JOIN sys_uptown_house b on a.property_id=b.house_id
-                       INNER JOIN sys_uptown_unit c on c.unit_id=b.unit_id
-                       INNER JOIN sys_uptown u on u.uptown_id = c.uptown_id
-              where a.user_id in (select user_id from jm_buy where jm_id=#{JmId})
-          ) y
-          on a.user_id=y.user_id
-        where a.jm_id=#{JmId}
+        select a.user_id,a.buy_count,a.phone, y.houseNumber, y.ridgepole, y.unit, y.uptown_id, y.uptown_name, z.tg_title, z.tg_supplier, z.tg_goods, z.tg_price, z.tg_min_num from jm_buy a
+           LEFT JOIN
+       (
+           select a.user_id, b.house_id, b.doorplate as houseNumber, c.uptown_id, c.ridgepole, c.unit, u.uptown_name
+           FROM sys_user_role a
+                    INNER JOIN sys_uptown_house b on a.property_id=b.house_id
+                    INNER JOIN sys_uptown_unit c on c.unit_id=b.unit_id
+                    INNER JOIN sys_uptown u on u.uptown_id = c.uptown_id
+           where a.user_id in (select user_id from jm_buy where jm_id=#{JmId})
+       ) y
+       on a.user_id=y.user_id
+           LEFT JOIN
+       (
+           SELECT * FROM jm_tuangou
+       ) z
+       on a.jm_id=z.jm_id
+        where a.jm_id=#{JmId} and a.buy_status=1
     </select>
     </select>
 
 
 </mapper>
 </mapper>