Просмотр исходного кода

创建家庭、业委会信息

hudingbo 5 лет назад
Родитель
Сommit
6af1c2fd3d

+ 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.springmvc.HttpUtils;
 import com.yvan.springmvc.ResultModel;
-import io.swagger.annotations.ApiOperation;
 import org.joda.time.DateTime;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -35,7 +34,7 @@ public class RootController {
     }
 
 
-//    @ApiOperation("获取当前用户信息")
+    //    @ApiOperation("获取当前用户信息")
     @GetMapping("/me")
     public Model<ResultModel> me() {
         ResultModel model = new ResultModel()
@@ -46,7 +45,7 @@ public class RootController {
         return Model.newSuccess(model);
     }
 
-//    @ApiOperation("time")
+    //    @ApiOperation("time")
     @GetMapping("/time")
     public Model<Map<String, Long>> time(@Pd(name = "t1", desc = "客户端时间") Long t1) {
         Map<String, Long> timeRp = new LinkedHashMap<>();
@@ -66,7 +65,7 @@ public class RootController {
         return Model.newSuccess(timeRp);
     }
 
-//    @ApiOperation("获取当前访问属性")
+    //    @ApiOperation("获取当前访问属性")
     @GetMapping("/domain")
     public Model<JsonWapper> domain(HttpServletRequest request) {
         JsonWapper jw = new JsonWapper();
@@ -107,7 +106,7 @@ public class RootController {
         return Model.newSuccess(bofengProperties);
     }
 
-    @GetMapping(value = {"/", "/index.html"})
+    @GetMapping(value = {"/"})
     public ModelAndView index() {
         if (!JwtHelper.isLogined()) {
             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;
 
-import com.baomidou.mybatisplus.toolkit.IdWorker;
-import com.bofeng.Consts;
-import com.bofeng.JwtHelper;
-import com.bofeng.entity.*;
 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 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 org.apache.shiro.SecurityUtils;
-import org.apache.shiro.authc.*;
 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 javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.Map;
-
 @RestController
 @Slf4j
 public class UserController {
@@ -51,6 +30,11 @@ public class UserController {
     @Autowired
     private PlaceService placeService;
 
+    @GetMapping("/index.html")
+    public ModelAndView index() {
+        return new ModelAndView("/index.html");
+    }
+
 //    @GetMapping("/user/logout.html")
 //    @PostMapping("/user/logout.html")
 //    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.entity.SysArea;
 import com.bofeng.entity.Uptown;
-import com.bofeng.entity.UptownUnit;
+import com.bofeng.entity.sysUptownUnit;
 import com.bofeng.service.SysAreaService;
 import com.yvan.Model;
-import com.yvan.mvc.Pd;
+import com.yvan.platform.JsonWapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 
 @RestController
@@ -30,8 +29,8 @@ public class WxSysAreaController {
 
     //选择城市
     @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) {
             return Model.newFail("请选择所在省");
         }
@@ -40,8 +39,8 @@ public class WxSysAreaController {
 
     //选择区
     @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) {
             return Model.newFail("请选择所在城市");
         }
@@ -50,32 +49,42 @@ public class WxSysAreaController {
 
     //选择小区
     @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) {
             return Model.newFail("请选择所在区");
         }
         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) {
             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.yvan.Model;
 import com.yvan.mvc.JsonBody;
+import com.yvan.platform.JsonWapper;
 import com.yvan.platform.StringUtils;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -30,11 +31,16 @@ public class WxUserOpenController {
 
     @ApiOperation("用户注册页面点登录")
     @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) {
             return Model.newFail("微信登录失败");
         }
+
         //成功返回用户Id
         return Model.newSuccess(userOpen.getUserId());
     }
@@ -66,14 +72,18 @@ public class WxUserOpenController {
         return Model.newSuccess(list);
     }
 
-    @ApiOperation("完善家庭及住宅信息")
+    @ApiOperation("创建家庭角色,完善家庭及住宅信息")
     @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) {
             return Model.newFail("请选择所在单元");
         }
@@ -90,10 +100,10 @@ public class WxUserOpenController {
             return Model.newFail("请填写家庭联系电话");
         }
         //成功返回用户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")
     public Model<Long> createYWH(HttpServletRequest request, @JsonBody List<OwnerLinkman> lstOwner) throws Exception {
         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.Uptown;
 import com.bofeng.entity.UptownUnit;
+import com.bofeng.entity.sysUptownUnit;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 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")
-    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}")
-    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);
 }

+ 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.TableId;
 import com.baomidou.mybatisplus.annotations.TableName;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
 import org.joda.time.DateTime;
 
 @Data
+@Getter
+@Setter
 @TableName("sys_uptown_unit")
 public class sysUptownUnit {
-    @TableId("unit_id")
+    @ApiModelProperty("单元ID")
+    @TableId("UNIT_ID")
     private Long unitId;
-    @TableField("uptown_id")
+
+    @ApiModelProperty("小区ID")
+    @TableField("UPTOWN_ID")
     private Long uptownId;
-    @TableField("ridgepole")
+
+    @ApiModelProperty("栋")
+    @TableField("RIDGEPOLE")
     private String ridgepole;
-    @TableField("unit")
+
+    @ApiModelProperty("单元")
+    @TableField("UNIT")
     private String unit;
-    @TableField("status")
+
+    @ApiModelProperty("状态:1正常,0草稿,-1删除")
+    @TableField("STATUS")
     private int status;
-    @TableField("time_create")
+
+    @ApiModelProperty("新增时间")
+    @TableField("TIME_CREATE")
     private DateTime timeCreate;
-    @TableField("time_update")
+
+    @ApiModelProperty("修改时间")
+    @TableField("TIME_UPDATE")
     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.entity.ParseCurrentOpenId;
 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.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 org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.servlet.ModelAndView;
-
-import java.util.Map;
 
 @Service
 @Transactional(readOnly = true)
@@ -67,4 +55,39 @@ public class HomeService {
         }
         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;
 
-import com.baomidou.mybatisplus.toolkit.IdWorker;
 import com.bofeng.Consts;
 import com.bofeng.dao.UserMapper;
 import com.bofeng.dao.UserOpenMapper;
@@ -9,8 +8,6 @@ import com.bofeng.entity.ParseCurrentOpenId;
 import com.bofeng.entity.User;
 import com.google.common.base.Strings;
 import com.google.common.collect.Maps;
-import com.yvan.PageDb;
-import com.yvan.platform.YvanUtil;
 import com.yvan.springmvc.HttpParameterParser;
 import com.yvan.springmvc.HttpUtils;
 import lombok.extern.slf4j.Slf4j;
@@ -26,7 +23,6 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.servlet.ModelAndView;
 
-import java.util.List;
 import java.util.Map;
 
 @Service
@@ -68,7 +64,6 @@ public class UserService {
     }
 
 
-
 //    @Transactional
 //    public String updateById(User user) {
 //
@@ -104,7 +99,7 @@ public class UserService {
 
     @Transactional
     public int updatePassword(Long userId, String password, String newPassword) {
-        return userMapper.updatePassword(userId,password, newPassword);
+        return userMapper.updatePassword(userId, password, newPassword);
     }
 
     @Transactional
@@ -201,4 +196,63 @@ public class UserService {
         r.setError(false);
         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)
-    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<>();
-        if (userOpen.getUserId() > 0L) {
-            lstUserRole = userRoleMapper.getUserRoleByUserId(userOpen.getUserId());
+        if (sysUserId > 0L) {
+            lstUserRole = userRoleMapper.getUserRoleByUserId(sysUserId);
         }
         if (lstUserRole.size() > 0) {
             for (UserRole item : lstUserRole) {
@@ -83,9 +90,9 @@ public class WxUserOpenService {
         //创建家庭用户角色
         UserRole userRole = new UserRole();
         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);  //家庭用户
 
         //判断该门牌号是否被创建(该楼栋单元下)