Browse Source

设备设置新增

zhengjie 1 year ago
parent
commit
f0ac5eaa5e

+ 8 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java

@@ -2,6 +2,8 @@ package com.ruoyi.web.controller.system;
 
 import java.util.List;
 import java.util.Set;
+
+import com.ruoyi.system.service.ISysUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -31,6 +33,9 @@ public class SysLoginController
     @Autowired
     private ISysMenuService menuService;
 
+    @Autowired
+    private ISysUserService sysUserService;
+
     @Autowired
     private SysPermissionService permissionService;
 
@@ -47,6 +52,9 @@ public class SysLoginController
         // 生成令牌
         String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
                 loginBody.getUuid());
+        SysUser sysUser = sysUserService.selectUserByUserName(loginBody.getUsername());
+        sysUser.setToken(token);
+        sysUserService.updateUser(sysUser);
         ajax.put(Constants.TOKEN, token);
         return ajax;
     }

+ 12 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TUserProfileController.java

@@ -11,6 +11,7 @@ import com.ruoyi.common.utils.file.FileUploadUtils;
 import com.ruoyi.framework.config.ServerConfig;
 import com.ruoyi.system.domain.SysDeptfile;
 import com.ruoyi.system.domain.TServiceManage;
+import com.ruoyi.system.domain.dto.TUserProfileDto;
 import com.ruoyi.system.service.ISysDeptfileService;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -57,6 +58,17 @@ public class TUserProfileController extends BaseController
         return getDataTable(list);
     }
 
+    /**
+     * 查询用户档案列表
+     */
+    @GetMapping("/listDevice")
+    public TableDataInfo listDevice(TUserProfileDto tUserProfileDto)
+    {
+        startPage();
+        List<TUserProfileDto> list = tUserProfileService.selectTUserProfileListByDevice(tUserProfileDto);
+        return getDataTable(list);
+    }
+
     /**
      * 导出用户档案列表
      */

+ 12 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java

@@ -89,6 +89,9 @@ public class SysUser extends BaseEntity
     /** 角色ID */
     private Long roleId;
 
+    /** token */
+    private String token;
+
     public SysUser()
     {
 
@@ -297,6 +300,14 @@ public class SysUser extends BaseEntity
         this.roleId = roleId;
     }
 
+    public String getToken() {
+        return token;
+    }
+
+    public void setToken(String token) {
+        this.token = token;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@@ -319,6 +330,7 @@ public class SysUser extends BaseEntity
             .append("updateTime", getUpdateTime())
             .append("remark", getRemark())
             .append("dept", getDept())
+            .append("token", getToken())
             .toString();
     }
 }

+ 82 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/TDeviceList.java

@@ -1,10 +1,13 @@
 package com.ruoyi.system.domain;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
 
+import java.util.Date;
+
 /**
  * 设备列对象 t_device_list
  * 
@@ -70,6 +73,31 @@ public class TDeviceList extends BaseEntity
     @Excel(name = "支付方式")
     private Integer payment;
 
+    /** 是否注册成功 */
+    @Excel(name = "是否注册成功")
+    private Integer status;
+
+    /** 用户姓名 */
+    @Excel(name = "用户姓名")
+    private String name;
+
+    /** 联系方式 */
+    @Excel(name = "联系方式")
+    private String tel_one;
+
+    /** 在线状态 */
+    @Excel(name = "在线状态")
+    private Integer online_statis;
+
+    /** 设备电量 */
+    @Excel(name = "设备电量")
+    private Integer electric_quantity;
+
+    /** 最后在线时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "最后在线时间")
+    private Date offlinetime;
+
     public void setId(Integer id) 
     {
         this.id = id;
@@ -197,6 +225,54 @@ public class TDeviceList extends BaseEntity
         return payment;
     }
 
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getTel_one() {
+        return tel_one;
+    }
+
+    public void setTel_one(String tel_one) {
+        this.tel_one = tel_one;
+    }
+
+    public Integer getOnline_statis() {
+        return online_statis;
+    }
+
+    public void setOnline_statis(Integer online_statis) {
+        this.online_statis = online_statis;
+    }
+
+    public Integer getElectric_quantity() {
+        return electric_quantity;
+    }
+
+    public void setElectric_quantity(Integer electric_quantity) {
+        this.electric_quantity = electric_quantity;
+    }
+
+    public Date getOfflinetime() {
+        return offlinetime;
+    }
+
+    public void setOfflinetime(Date offlinetime) {
+        this.offlinetime = offlinetime;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@@ -215,6 +291,12 @@ public class TDeviceList extends BaseEntity
             .append("cost", getCost())
             .append("payment", getPayment())
             .append("createTime", getCreateTime())
+            .append("status", getStatus())
+            .append("name", getName())
+            .append("tel_one", getTel_one())
+            .append("online_statis", getOnline_statis())
+            .append("electric_quantity", getElectric_quantity())
+            .append("offlinetime", getOfflinetime())
             .toString();
     }
 }

+ 92 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/TUserProfileDto.java

@@ -0,0 +1,92 @@
+package com.ruoyi.system.domain.dto;
+
+import com.ruoyi.common.annotation.Excel;
+
+public class TUserProfileDto {
+
+    private static final long serialVersionUID = 1L;
+
+    /** id */
+    private Integer id;
+
+    /** 姓名 */
+    @Excel(name = "姓名")
+    private String name;
+
+    /** 性别 */
+    @Excel(name = "性别")
+    private Integer gender;
+
+    /** 身份证号 */
+    @Excel(name = "身份证号")
+    private String sfzid;
+
+    /** 电话1 */
+    @Excel(name = "电话1")
+    private String telOne;
+
+    /** 年龄 */
+    @Excel(name = "年龄")
+    private Integer age;
+
+    /** 家庭地址 */
+    @Excel(name = "家庭地址")
+    private String familyAddress;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getGender() {
+        return gender;
+    }
+
+    public void setGender(Integer gender) {
+        this.gender = gender;
+    }
+
+    public String getSfzid() {
+        return sfzid;
+    }
+
+    public void setSfzid(String sfzid) {
+        this.sfzid = sfzid;
+    }
+
+    public String getTelOne() {
+        return telOne;
+    }
+
+    public void setTelOne(String telOne) {
+        this.telOne = telOne;
+    }
+
+    public Integer getAge() {
+        return age;
+    }
+
+    public void setAge(Integer age) {
+        this.age = age;
+    }
+
+    public String getFamilyAddress() {
+        return familyAddress;
+    }
+
+    public void setFamilyAddress(String familyAddress) {
+        this.familyAddress = familyAddress;
+    }
+
+}

+ 9 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TUserProfileMapper.java

@@ -7,6 +7,7 @@ import com.ruoyi.common.enums.DataSourceType;
 import com.ruoyi.system.domain.TServiceManage;
 import com.ruoyi.system.domain.TUserProfile;
 import com.ruoyi.system.domain.TEmergentPeople;
+import com.ruoyi.system.domain.dto.TUserProfileDto;
 
 /**
  * 用户档案Mapper接口
@@ -32,6 +33,14 @@ public interface TUserProfileMapper
      */
     public List<TUserProfile> selectTUserProfileList(TUserProfile tUserProfile);
 
+    /**
+     * 查询用户档案列表
+     *
+     * @param tUserProfileDto 用户档案
+     * @return 用户档案集合
+     */
+    public List<TUserProfileDto> selectTUserProfileListByDevice(TUserProfileDto tUserProfileDto);
+
     /**
      * 新增用户档案
      * 

+ 10 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ITUserProfileService.java

@@ -4,6 +4,7 @@ import java.util.List;
 
 import com.ruoyi.system.domain.TServiceManage;
 import com.ruoyi.system.domain.TUserProfile;
+import com.ruoyi.system.domain.dto.TUserProfileDto;
 
 /**
  * 用户档案Service接口
@@ -29,6 +30,15 @@ public interface ITUserProfileService
      */
     public List<TUserProfile> selectTUserProfileList(TUserProfile tUserProfile);
 
+
+    /**
+     * 查询用户档案列表
+     *
+     * @param tUserProfileDto 用户档案
+     * @return 用户档案集合
+     */
+    public List<TUserProfileDto> selectTUserProfileListByDevice(TUserProfileDto tUserProfileDto);
+
     /**
      * 新增用户档案
      * 

+ 12 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TUserProfileServiceImpl.java

@@ -5,6 +5,7 @@ import java.util.List;
 import com.ruoyi.common.exception.ServiceException;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.system.domain.TServiceManage;
+import com.ruoyi.system.domain.dto.TUserProfileDto;
 import com.ruoyi.system.mapper.TEmergentPeopleMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -58,6 +59,17 @@ public class TUserProfileServiceImpl implements ITUserProfileService
         return tUserProfileList;
     }
 
+    /**
+     * 查询用户档案列表
+     *
+     * @param tUserProfileDto 用户档案
+     * @return 用户档案集合
+     */
+    @Override
+    public List<TUserProfileDto> selectTUserProfileListByDevice(TUserProfileDto tUserProfileDto) {
+        return tUserProfileMapper.selectTUserProfileListByDevice(tUserProfileDto);
+    }
+
     /**
      * 新增用户档案
      * 

+ 5 - 1
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -23,6 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateBy"     column="update_by"    />
         <result property="updateTime"   column="update_time"  />
         <result property="remark"       column="remark"       />
+		<result property="token"       column="token"       />
         <association property="dept"    column="dept_id" javaType="SysDept" resultMap="deptResult" />
         <collection  property="roles"   javaType="java.util.List"           resultMap="RoleResult" />
     </resultMap>
@@ -47,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 	
 	<sql id="selectUserVo">
-        select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, 
+        select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
         d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
         r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
         from sys_user u
@@ -156,6 +157,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="status != null and status != ''">status,</if>
  			<if test="createBy != null and createBy != ''">create_by,</if>
  			<if test="remark != null and remark != ''">remark,</if>
+			<if test="token != null and token != ''">token,</if>
  			create_time
  		)values(
  			<if test="userId != null and userId != ''">#{userId},</if>
@@ -170,6 +172,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="status != null and status != ''">#{status},</if>
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
  			<if test="remark != null and remark != ''">#{remark},</if>
+			<if test="token != null and token != ''">#{token},</if>
  			sysdate()
  		)
 	</insert>
@@ -190,6 +193,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="loginDate != null">login_date = #{loginDate},</if>
  			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  			<if test="remark != null">remark = #{remark},</if>
+			<if test="token != null">token = #{token},</if>
  			update_time = sysdate()
  		</set>
  		where user_id = #{userId}

+ 24 - 16
ruoyi-system/src/main/resources/mapper/system/TDeviceListMapper.xml

@@ -19,7 +19,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="price"    column="price"    />
         <result property="cost"    column="cost"    />
         <result property="payment"    column="payment"    />
-        <result property="createTime"    column="createtime"    />
+        <result property="status"    column="status"    />
+        <result property="name"    column="name"    />
+        <result property="tel_one"    column="tel_one"    />
+        <result property="online_statis"    column="online_statis"    />
+        <result property="electric_quantity"    column="electric_quantity"    />
+        <result property="offlinetime"    column="offlinetime"    />
     </resultMap>
 
     <sql id="selectTDeviceListVo">
@@ -27,22 +32,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </sql>
 
     <select id="selectTDeviceListList" parameterType="TDeviceList" resultMap="TDeviceListResult">
-        <include refid="selectTDeviceListVo"/>
+        select a.id, a.device_proper, a.userid, a.factory, a.device_model, a.device_id, a.sim_code, a.serial_number, a.grant_type, a.price, a.cost, a.payment, a.createtime, b.`status`,c.name,c.sfzid,c.tel_one,d.online_statis,d.electric_quantity,d.offlinetime from t_device_list a
+        left join t_facility b on a.device_id=b.code
+        left join t_user_profile c on a.userid=c.id
+        left join t_shouhuan_info d on a.device_id=d.device_id_code
         <where>  
-            <if test="deviceProper != null "> and device_proper = #{deviceProper}</if>
-            <if test="userid != null "> and userid = #{userid}</if>
-            <if test="sfzid != null  and sfzid != ''"> and sfzid = #{sfzid}</if>
-            <if test="telno != null  and telno != ''"> and telno = #{telno}</if>
-            <if test="factory != null "> and factory = #{factory}</if>
-            <if test="deviceModel != null "> and device_model = #{deviceModel}</if>
-            <if test="deviceId != null  and deviceId != ''"> and device_id = #{deviceId}</if>
-            <if test="simCode != null  and simCode != ''"> and sim_code = #{simCode}</if>
-            <if test="serialNumber != null  and serialNumber != ''"> and serial_number = #{serialNumber}</if>
-            <if test="grantType != null "> and grant_type = #{grantType}</if>
-            <if test="price != null  and price != ''"> and price = #{price}</if>
-            <if test="cost != null  and cost != ''"> and cost = #{cost}</if>
-            <if test="payment != null "> and payment = #{payment}</if>
-            <if test="createTime != null "> and createtime = #{createTime}</if>
+            <if test="deviceProper != null "> and a.device_proper = #{deviceProper}</if>
+            <if test="userid != null "> and a.userid = #{userid}</if>
+            <if test="sfzid != null  and sfzid != ''"> and a.sfzid = #{sfzid}</if>
+            <if test="telno != null  and telno != ''"> and a.telno = #{telno}</if>
+            <if test="factory != null "> and a.factory = #{factory}</if>
+            <if test="deviceModel != null "> and a.device_model = #{deviceModel}</if>
+            <if test="deviceId != null  and deviceId != ''"> and a.device_id = #{deviceId}</if>
+            <if test="simCode != null  and simCode != ''"> and a.sim_code = #{simCode}</if>
+            <if test="serialNumber != null  and serialNumber != ''"> and a.serial_number = #{serialNumber}</if>
+            <if test="grantType != null "> and a.grant_type = #{grantType}</if>
+            <if test="price != null  and price != ''"> and a.price = #{price}</if>
+            <if test="cost != null  and cost != ''"> and a.cost = #{cost}</if>
+            <if test="payment != null "> and a.payment = #{payment}</if>
+            <if test="createTime != null "> and a.createtime = #{createTime}</if>
         </where>
     </select>
     

+ 12 - 1
ruoyi-system/src/main/resources/mapper/system/TUserProfileMapper.xml

@@ -128,7 +128,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         left join t_emergent_people b on b.profile_id = a.id
         where a.id = #{id}
     </select>
-        
+    <select id="selectTUserProfileListByDevice" resultType="com.ruoyi.system.domain.dto.TUserProfileDto">
+        select id, name, gender, sfzid, tel_one, age, family_address from t_user_profile
+        <where>
+            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
+            <if test="gender != null "> and gender = #{gender}</if>
+            <if test="sfzid != null  and sfzid != ''"> and sfzid = #{sfzid}</if>
+            <if test="telOne != null  and telOne != ''"> and tel_one = #{telOne}</if>
+            <if test="age != null "> and age = #{age}</if>
+            <if test="familyAddress != null  and familyAddress != ''"> and family_address = #{familyAddress}</if>
+        </where>
+    </select>
+
     <insert id="insertTUserProfile" parameterType="TUserProfile" useGeneratedKeys="true" keyProperty="id">
         insert into t_user_profile
         <trim prefix="(" suffix=")" suffixOverrides=",">