瀏覽代碼

注册页面

peiguo 5 年之前
父節點
當前提交
c153485511

+ 2 - 3
whepi-doc/login.sql

@@ -54,6 +54,8 @@ DROP TABLE IF EXISTS sys_owner;
 CREATE TABLE sys_owner  (
 CREATE TABLE sys_owner  (
   owner_id          bigint(20) NOT NULL DEFAULT 0 COMMENT '业委会ID',
   owner_id          bigint(20) NOT NULL DEFAULT 0 COMMENT '业委会ID',
   uptown_id         bigint(20) NOT NULL DEFAULT 0 COMMENT '小区ID,下拉选ID',
   uptown_id         bigint(20) NOT NULL DEFAULT 0 COMMENT '小区ID,下拉选ID',
+  linkman           varchar(10)  NOT NULL DEFAULT '' COMMENT '联系人名称',
+  phone             varchar(20)  NOT NULL DEFAULT '' COMMENT '联系人电话',
   user_create       bigint(20) NOT NULL DEFAULT 0 COMMENT '新增人',
   user_create       bigint(20) NOT NULL DEFAULT 0 COMMENT '新增人',
   time_create       datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '新增时间',
   time_create       datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '新增时间',
   user_update       bigint(20) NOT NULL DEFAULT 0 COMMENT '修改人',
   user_update       bigint(20) NOT NULL DEFAULT 0 COMMENT '修改人',
@@ -84,9 +86,6 @@ DROP TABLE IF EXISTS sys_uptown_house;
 CREATE TABLE sys_uptown_house  (
 CREATE TABLE sys_uptown_house  (
   house_id         bigint(20) NOT NULL DEFAULT 0 COMMENT '门牌ID',
   house_id         bigint(20) NOT NULL DEFAULT 0 COMMENT '门牌ID',
   uptown_id         bigint(20) NOT NULL DEFAULT 0 COMMENT '小区ID',
   uptown_id         bigint(20) NOT NULL DEFAULT 0 COMMENT '小区ID',
-  ridgepole         int(11) NOT NULL DEFAULT 0 COMMENT '栋',
-  unit              int(11) NOT NULL DEFAULT 0 COMMENT '单元',
-  doorplate         varchar(20)  NOT NULL DEFAULT '' COMMENT '门牌',
   linkman           varchar(10)  NOT NULL DEFAULT '' COMMENT '联系人名称',
   linkman           varchar(10)  NOT NULL DEFAULT '' COMMENT '联系人名称',
   phone             varchar(20)  NOT NULL DEFAULT '' COMMENT '联系人电话',
   phone             varchar(20)  NOT NULL DEFAULT '' COMMENT '联系人电话',
   young             int(11) NOT NULL DEFAULT 0 COMMENT '家庭年前人数',
   young             int(11) NOT NULL DEFAULT 0 COMMENT '家庭年前人数',

+ 53 - 0
whepi-ui/templates/home/frag.head.ftl

@@ -20,6 +20,58 @@
             font-weight: 300;
             font-weight: 300;
             margin: 0 15%;
             margin: 0 15%;
         }
         }
+
+
+
+        .user-header {
+            padding: 15px 0 5px 0;
+            /*background-color: #16ae9d;*/
+        }
+        .user-title {
+            text-align: center;
+            font-size: 18px;
+            color: #999999;
+            font-weight: 900;
+            margin: 0 15%;
+        }
+        .user-hr {
+            align: center;
+            width: 100%;
+            color: #999999;
+            size: 5px;
+        }
+
+        .user-font {
+            color: #999999;
+        }
+        .user-div-msg {
+            display: inline-block;
+            width: 40%;
+            height: 40%;
+        }
+
+        .maindiv{
+            width: 100%;
+            overflow: hidden; /*关键*/
+            padding: 15px 0 5px 0;
+        }
+        .leftdiv{
+            float: left;
+            width: 45%;
+        }
+        .rightdiv{
+            float: right;
+            width: 45%;
+        }
+        .centerdiv{
+            float: left;
+            width: 5%;
+            border-right:1px dashed rgba(0, 0, 0, 0.46);
+            padding-bottom:45%;  /*关键*/
+            margin-bottom:-45%;  /*关键*/
+        }
+
+
         html,body{height: 100%;}
         html,body{height: 100%;}
         .ri_bao_weui_tab_bd_item_active {
         .ri_bao_weui_tab_bd_item_active {
             display: block !important;
             display: block !important;
@@ -29,5 +81,6 @@
         }
         }
     </style>
     </style>
 </head>
 </head>
+<span hidden="hidden" id="id"></span>
 
 
 <body style="height: 100%" ontouchstart>
 <body style="height: 100%" ontouchstart>

+ 176 - 0
whepi-ui/templates/user/home.ftl

@@ -0,0 +1,176 @@
+<#assign title="业委会"/>
+<#include "/home/frag.head.ftl" />
+
+<div class="weui-tab">
+    <div class="weui-tab__bd">
+        <div id="tab1" class="weui-tab__bd-item weui-tab__bd-item--active">
+            <div class="page__bd">
+                <header class="user-header">
+                    <br/>
+                    <br/>
+                    <h1 class="user-title">家园抗击疫情公共服务平台</h1>
+                    <br/>
+                    <h1 class="user-title">用户登陆</h1>
+                </header>
+
+                <br/>
+                <br/>
+                <br/>
+                <br/>
+                <div class="weui-form" id="fromMsg">
+                    <div class="weui-cells_radio user-font">
+                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;我是&nbsp;&nbsp;
+                        <input name="Fruit" type="radio" value="1"/>家庭用户
+                        <input name="Fruit" type="radio" value="2"/>业委会人员
+                    </div>
+                    <hr class="user-hr">
+                    <div class="maindiv">
+                        <div class="leftdiv">
+                            <br/>
+                            <div class="weui-cells__title"><#if user ??>value="${user.username!''}"</#if></div>
+                            <div class="weui-cells__title">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;登陆</div>
+                            <br/>
+                        </div>
+                        <div class="centerdiv"></div>
+                        <div class="rightdiv">
+                            <div class="weui-cells__title">联系人输入</div>
+                            <div class="weui-cells">
+                                <div class="weui-cell">
+                                    <div class="weui-cell__bd">
+                                        <input class="weui-input" type="text" id="linkman" placeholder="请输入文本"/>
+                                    </div>
+                                </div>
+                            </div>
+                            <div class="weui-cells__title">手机号输入</div>
+                            <div class="weui-cells">
+                                <div class="weui-cell">
+                                    <div class="weui-cell__bd">
+                                        <input class="weui-input" type="text" id="phone" placeholder="请输入文本"/>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                    <br/>
+                    <div class="weui-form__opr-area">
+                        <a class="weui-btn weui-btn_primary "  href="javascript:;" onclick="save();" id="save">确定</a>
+                    </div>
+                </div>
+
+
+                <div class="page" id="tpl_msg_warn_userType" hidden="hidden">
+                    <div class="weui-msg">
+                        <div class="weui-msg__icon-area"><i class="weui-icon-warn weui-icon_msg"></i></div>
+                        <div class="weui-msg__text-area">
+                            <h2 class="weui-msg__title">操作失败</h2>
+                            <p class="weui-msg__desc" id="errorMsg">用户类型不能为空</p>
+                        </div>
+                        <div class="weui-msg__opr-area">
+                            <p class="weui-btn-area">
+                                <a href="javascript:;" onclick="back();" class="weui-btn weui-btn_default">返回</a>
+                            </p>
+                        </div>
+                    </div>
+                </div>
+                <div class="page" id="tpl_msg_warn_linkman" hidden="hidden">
+                    <div class="weui-msg">
+                        <div class="weui-msg__icon-area"><i class="weui-icon-warn weui-icon_msg"></i></div>
+                        <div class="weui-msg__text-area">
+                            <h2 class="weui-msg__title">操作失败</h2>
+                            <p class="weui-msg__desc" id="errorMsg">联系人不能为空</p>
+                        </div>
+                        <div class="weui-msg__opr-area">
+                            <p class="weui-btn-area">
+                                <a href="javascript:;" onclick="back();" class="weui-btn weui-btn_default">返回</a>
+                            </p>
+                        </div>
+                    </div>
+                </div>
+                <div class="page" id="tpl_msg_warn_phone" hidden="hidden">
+                    <div class="weui-msg">
+                        <div class="weui-msg__icon-area"><i class="weui-icon-warn weui-icon_msg"></i></div>
+                        <div class="weui-msg__text-area">
+                            <h2 class="weui-msg__title">操作失败</h2>
+                            <p class="weui-msg__desc" id="errorMsg">电话号码校验失败</p>
+                        </div>
+                        <div class="weui-msg__opr-area">
+                            <p class="weui-btn-area">
+                                <a href="javascript:;" onclick="back();" class="weui-btn weui-btn_default">返回</a>
+                            </p>
+                        </div>
+                    </div>
+                </div>
+
+            </div>
+        </div>
+    </div>
+</div>
+</div>
+</body>
+<#include "/home/frag.foot.ftl" />
+<script>
+
+    var userId = <#if user ??>value="${user.userId!''}"</#if>
+
+    function save() {
+        var userType = $('input:radio:checked').val();
+        if (!userType) {
+            $("#tpl_msg_warn_userType").show();
+            $("#tpl_msg_warn_linkman").hide();
+            $("#tpl_msg_warn_phone").hide();
+            $("#fromMsg").hide();
+            return false;
+        }
+        var linkman = $("#linkman").val();
+        if (!linkman) {
+            $("#tpl_msg_warn_userType").hide();
+            $("#tpl_msg_warn_linkman").show();
+            $("#tpl_msg_warn_phone").hide();
+            $("#fromMsg").hide();
+            return false;
+        }
+        var phone = $("#phone").val();
+        if(!(/^1[3456789]\d{9}$/.test(phone))){
+            $("#tpl_msg_warn_userType").hide();
+            $("#tpl_msg_warn_linkman").hide();
+            $("#tpl_msg_warn_phone").show();
+            $("#fromMsg").hide();
+            return false;
+        }
+        $("#tpl_msg_warn_userType").hide();
+        $("#tpl_msg_warn_linkman").hide();
+        $("#tpl_msg_warn_phone").hide();
+        console.log(userType)
+        console.log(linkman)
+        console.log(phone)
+
+        $.ajax({
+            url: '/admin/supplier/createOrderauditMain.json',
+            type: "post",
+            data: {
+                "userId": userId,
+                "userType": userType,
+                "linkman": linkman,
+                "phone": phone,
+            },
+            beforeSend: function () {
+            },
+            success: function (result) {
+                if (result.success) {
+                    layer.msg('添加成功');
+                } else {
+                    layer.msg(result.message);
+                }
+                closePageTwo();
+            }
+        });
+    }
+
+    function back(){
+        $("#tpl_msg_warn_userType").hide();
+        $("#tpl_msg_warn_linkman").hide();
+        $("#tpl_msg_warn_phone").hide();
+        $("#fromMsg").show();
+    }
+
+</script>

+ 11 - 0
whepi-web/src/main/java/com/bofeng/dao/OwnerMapper.java

@@ -0,0 +1,11 @@
+package com.bofeng.dao;
+
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+import com.bofeng.entity.Owner;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Repository;
+
+@Mapper
+@Repository
+public interface OwnerMapper extends BaseMapper<Owner> {
+}

+ 11 - 0
whepi-web/src/main/java/com/bofeng/dao/UptownHouseMapper.java

@@ -0,0 +1,11 @@
+package com.bofeng.dao;
+
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+import com.bofeng.entity.UptownHouse;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Repository;
+
+@Mapper
+@Repository
+public interface UptownHouseMapper extends BaseMapper<UptownHouse> {
+}

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

@@ -0,0 +1,11 @@
+package com.bofeng.dao;
+
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+import com.bofeng.entity.UserRole;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Repository;
+
+@Mapper
+@Repository
+public interface UserRoleMapper extends BaseMapper<UserRole> {
+}

+ 37 - 0
whepi-web/src/main/java/com/bofeng/entity/Owner.java

@@ -0,0 +1,37 @@
+package com.bofeng.entity;
+
+import com.baomidou.mybatisplus.annotations.TableField;
+import com.baomidou.mybatisplus.annotations.TableName;
+import lombok.Getter;
+import lombok.Setter;
+import org.joda.time.DateTime;
+
+@Getter
+@Setter
+@TableName("sys_owner")
+public class Owner {
+
+    @TableField("owner_id")
+    private Long ownerId;
+
+    @TableField("uptown_id")
+    private Long uptownId;
+
+    @TableField("linkman")
+    private String linkman;
+
+    @TableField("phone")
+    private String phone;
+
+    @TableField("user_create")
+    private Long userCreate;
+
+    @TableField(exist = false)
+    private DateTime timeCreate;
+
+    @TableField("user_update")
+    private Long userUpdate;
+
+    @TableField(exist = false)
+    private DateTime timeUpdate;
+}

+ 57 - 0
whepi-web/src/main/java/com/bofeng/entity/UptownHouse.java

@@ -0,0 +1,57 @@
+package com.bofeng.entity;
+
+import com.baomidou.mybatisplus.annotations.TableField;
+import com.baomidou.mybatisplus.annotations.TableName;
+import lombok.Getter;
+import lombok.Setter;
+import org.joda.time.DateTime;
+
+import java.util.Date;
+
+@Getter
+@Setter
+@TableName("sys_uptown_house")
+public class UptownHouse {
+
+    @TableField("house_id")
+    private Long houseId;
+
+    @TableField("uptown_id")
+    private Long uptownId;
+
+    @TableField("linkman")
+    private String linkman;
+
+    @TableField("phone")
+    private String phone;
+
+    @TableField("young")
+    private Integer young;
+
+    @TableField("middle")
+    private Integer middle;
+
+    @TableField("old")
+    private Integer old;
+
+    @TableField("remark")
+    private String remark;
+
+    /**
+     * 状态:1正常,0草稿,-1删除
+     */
+    @TableField("status")
+    private Integer status;
+
+    @TableField("user_create")
+    private Long userCreate;
+
+    @TableField(exist = false)
+    private DateTime timeCreate;
+
+    @TableField("user_update")
+    private Long userUpdate;
+
+    @TableField(exist = false)
+    private DateTime timeUpdate;
+}

+ 37 - 0
whepi-web/src/main/java/com/bofeng/entity/UserRole.java

@@ -0,0 +1,37 @@
+package com.bofeng.entity;
+
+import com.baomidou.mybatisplus.annotations.TableField;
+import com.baomidou.mybatisplus.annotations.TableName;
+import lombok.Getter;
+import lombok.Setter;
+import org.joda.time.DateTime;
+
+@Getter
+@Setter
+@TableName("sys_user_role")
+public class UserRole {
+
+    @TableField("ur_id")
+    private Long urId;
+
+    @TableField("user_id")
+    private Long userId;
+
+    @TableField("role_id")
+    private Integer roleId;
+
+    @TableField("property_id")
+    private Long propertyId;
+
+    @TableField("user_create")
+    private Long userCreate;
+
+    @TableField(exist = false)
+    private DateTime timeCreate;
+
+    @TableField("user_update")
+    private Long userUpdate;
+
+    @TableField(exist = false)
+    private DateTime timeUpdate;
+}

+ 49 - 6
whepi-web/src/main/java/com/bofeng/service/UserOpenService.java

@@ -1,13 +1,13 @@
 package com.bofeng.service;
 package com.bofeng.service;
 
 
-import com.bofeng.dao.UserMapper;
-import com.bofeng.dao.UserOpenMapper;
-import com.bofeng.dao.UserPlaceMapper;
-import com.bofeng.entity.User;
-import com.bofeng.entity.UserOpen;
-import com.bofeng.entity.UserPlace;
+import com.baomidou.mybatisplus.annotations.TableField;
+import com.baomidou.mybatisplus.toolkit.IdWorker;
+import com.bofeng.dao.*;
+import com.bofeng.entity.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.annotation.Id;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
 @Service
 @Service
@@ -49,4 +49,47 @@ public class UserOpenService {
         return userPlaceMapper.insert(userPlace);
         return userPlaceMapper.insert(userPlace);
 
 
     }
     }
+
+    @Autowired
+    private UptownHouseMapper uptownHouseMapper;
+    @Autowired
+    private OwnerMapper ownerMapper;
+    @Autowired
+    private UserRoleMapper userRoleMapper;
+
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
+    public void saveUserInfo(Long userId, Integer userType, String linkman, String phone) {
+        UserRole userRole = new UserRole();
+        userRole.setUrId(IdWorker.getId());
+        userRole.setUserId(userId);
+        userRole.setRoleId(userType);
+        userRole.setUserCreate(userId);
+        userRole.setUserUpdate(userId);
+        if (userType == 1) {
+            UptownHouse uptownHouse = new UptownHouse();
+//            uptownHouse.setHouseId()
+            uptownHouse.setLinkman(linkman);
+            uptownHouse.setPhone(phone);
+//            uptownHouse.setYoung();
+//            uptownHouse.setMiddle();
+//            uptownHouse.setOld();
+//            uptownHouse.setRemark();
+            uptownHouse.setStatus(1);
+            uptownHouse.setUserCreate(userId);
+            uptownHouse.setUserUpdate(userId);
+            uptownHouseMapper.insert(uptownHouse);
+            userRole.setPropertyId(uptownHouse.getHouseId());
+        } else if (userType == 2) {
+            Owner owner = new Owner();
+            owner.setOwnerId(IdWorker.getId());
+//            owner.setUptownId();
+            owner.setLinkman(linkman);
+            owner.setPhone(phone);
+            owner.setUserCreate(userId);
+            owner.setUserUpdate(userId);
+            ownerMapper.insert(owner);
+            userRole.setPropertyId(owner.getOwnerId());
+        }
+        userRoleMapper.insert(userRole);
+    }
 }
 }

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

@@ -0,0 +1,38 @@
+package com.bofeng.wx.controller;
+
+import com.bofeng.entity.UserOpen;
+import com.bofeng.service.HomeService;
+import com.bofeng.service.UserOpenService;
+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.RestController;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+
+@RestController
+public class UserOpenController {
+
+    @Autowired
+    private HomeService homeService;
+    @Autowired
+    private UserOpenService userOpenService;
+
+    @GetMapping("/user/home.html")
+    public ModelAndView home(ModelMap model) {
+        UserOpen userOpen = homeService.getUserOpen();
+        model.put("user", userOpen);
+        return new ModelAndView("/user/home.ftl", model);
+    }
+
+    @GetMapping("/home/saveUser.json")
+    public ModelAndView saveUser(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");
+        userOpenService.saveUserInfo(userId,userType,linkman,phone);
+        return new ModelAndView("/home/home.ftl");
+    }
+}