浏览代码

调整用户id

459242451@qq.com 3 年之前
父节点
当前提交
b5dd411950

+ 0 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/PlanTask.java

@@ -88,7 +88,6 @@ public class PlanTask {
                                     planRecord.setStartTime(s.split("~")[0]);
                                     planRecord.setEndTime(s.split("~")[1]);
                                     planRecord.setPlanName(inspectionPlan.getPlanName());
-                                    planRecord.setUserId(planUser.getUserId());
                                     planRecord.setNickName(planUser.getNickName());
                                     planRecord.setCard(planUser.getCard());
                                     planRecord.setScore(inspectionPlan.getScore());

+ 3 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/XunTask.java

@@ -60,17 +60,20 @@ public class XunTask {
                 String thirdId = jsonObject.getStr("id");
                 String name = jsonObject.getStr("name");
                 String code = jsonObject.getStr("code");
+                Long areaId = jsonObject.getLong("areaId");
                 // 根据thirdId查询是否存在
                 TlInspectionDevice tlInspectionDevice = tlInspectionDeviceService.queryByThirdId(thirdId);
                 if (tlInspectionDevice != null) {
                     tlInspectionDevice.setDeviceCode(code);
                     tlInspectionDevice.setDeviceName(name);
+                    tlInspectionDevice.setAreaId(areaId);
                     tlInspectionDevice.setVersion(version);
                     tlInspectionDeviceService.updateTlInspectionDevice(tlInspectionDevice);
                 } else {
                     tlInspectionDevice = new TlInspectionDevice();
                     tlInspectionDevice.setDeviceCode(code);
                     tlInspectionDevice.setDeviceName(name);
+                    tlInspectionDevice.setAreaId(areaId);
                     tlInspectionDevice.setVersion(version);
                     tlInspectionDevice.setThirdId(thirdId);
                     tlInspectionDeviceService.insertTlInspectionDevice(tlInspectionDevice);

+ 0 - 1
ruoyi-system/src/main/java/com/ruoyi/qdtl/domain/PlanUser.java

@@ -11,7 +11,6 @@ import lombok.Data;
 @Data
 public class PlanUser {
     private Long planId;
-    private Long userId;
     private String nickName;
     private String card;
 }

+ 37 - 35
ruoyi-system/src/main/java/com/ruoyi/qdtl/domain/TlInspectionPlanUser.java

@@ -1,79 +1,81 @@
 package com.ruoyi.qdtl.domain;
 
-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 org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
 
 /**
  * 巡检计划人员关系对象 tl_inspection_plan_user
- * 
+ *
  * @author ruoyi
  * @date 2022-03-03
  */
-public class TlInspectionPlanUser extends BaseEntity
-{
+public class TlInspectionPlanUser extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** id */
+    /**
+     * id
+     */
     private Long id;
 
-    /** 计划id */
+    /**
+     * 计划id
+     */
     @Excel(name = "计划id")
     private Long planId;
 
-    /** 人员id */
-    @Excel(name = "人员id")
-    private Long userId;
+    /**
+     * 人员id
+     */
+    @Excel(name = "巡检员卡号")
+    private String card;
 
-    /** 人员姓名 */
+    /**
+     * 人员姓名
+     */
     @Excel(name = "人员姓名")
     private String nickName;
 
-    public void setId(Long id) 
-    {
+    public void setId(Long id) {
         this.id = id;
     }
 
-    public Long getId() 
-    {
+    public Long getId() {
         return id;
     }
-    public void setPlanId(Long planId) 
-    {
+
+    public void setPlanId(Long planId) {
         this.planId = planId;
     }
 
-    public Long getPlanId() 
-    {
+    public Long getPlanId() {
         return planId;
     }
-    public void setUserId(Long userId) 
-    {
-        this.userId = userId;
+
+    public void setCard(String card) {
+        this.card = card;
     }
 
-    public Long getUserId() 
-    {
-        return userId;
+    public String getCard() {
+        return card;
     }
-    public void setNickName(String nickName) 
-    {
+
+    public void setNickName(String nickName) {
         this.nickName = nickName;
     }
 
-    public String getNickName() 
-    {
+    public String getNickName() {
         return nickName;
     }
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("planId", getPlanId())
-            .append("userId", getUserId())
-            .append("nickName", getNickName())
-            .toString();
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("id", getId())
+                .append("planId", getPlanId())
+                .append("card", getCard())
+                .append("nickName", getNickName())
+                .toString();
     }
 }

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/qdtl/mapper/TlInspectionPlanMapper.java

@@ -65,7 +65,7 @@ public interface TlInspectionPlanMapper {
 
     List<PlanUser> queryPlanUser(@Param("id") Long id);
 
-    List<TlInspectionPlan> queryPlanUserExcludeId(@Param("userId") Long userId, @Param("excludePlanId") Long excludePlanId);
+    List<TlInspectionPlan> queryPlanUserExcludeId(@Param("card") String card, @Param("excludePlanId") Long excludePlanId);
 
     List<TlInspectionPlan> queryByDatePeriod(@Param("startDate") String startDate, @Param("endDate") String endDate);
 }

+ 2 - 2
ruoyi-system/src/main/java/com/ruoyi/qdtl/service/impl/TlInspectionPlanServiceImpl.java

@@ -229,10 +229,10 @@ public class TlInspectionPlanServiceImpl implements ITlInspectionPlanService {
         // 当前计划所有的点位
         List<Long> currentLocation = tlInspectionLineLocationService.queryLocationId(tlInspectionPlan.getLineId());
         for (TlInspectionPlanUser planUser : tlInspectionPlan.getPlanUsers()) {
-            Long userId = planUser.getUserId();
+            String card = planUser.getCard();
             String userName = planUser.getNickName();
             // 查询该用户的计划
-            List<TlInspectionPlan> list = tlInspectionPlanMapper.queryPlanUserExcludeId(userId, excludePlanId);
+            List<TlInspectionPlan> list = tlInspectionPlanMapper.queryPlanUserExcludeId(card, excludePlanId);
             if (list != null && list.size() > 0) {
                 for (TlInspectionPlan inspectionPlan : list) {
                     // 组装日期范围

+ 4 - 5
ruoyi-system/src/main/resources/mapper/qdtl/TlInspectionPlanMapper.xml

@@ -66,18 +66,17 @@
     </select>
 
     <select id="queryPlanUser" resultType="com.ruoyi.qdtl.domain.PlanUser">
-        select plan_id as planId, t1.user_id as userId, t1.nick_name as nickName, patrolman as card
+        select plan_id as planId, t1.card as card, t1.nick_name as nickName
         from tl_inspection_plan_user t1
-                 left join sys_user t2 on t1.user_id = t2.user_id
-        where t1.plan_id = #{id}
-          and t2.patrolman != '';
+                 left join tl_patrolman t2 on t1.card = t2.card
+        where t1.plan_id = #{id};
     </select>
 
     <select id="queryPlanUserExcludeId" resultMap="TlInspectionPlanResult">
         select t2.*
         from tl_inspection_plan_user t1
                  left join tl_inspection_plan t2 on t1.plan_id = t2.id
-        where t1.user_id = #{userId}
+        where t1.card = #{card}
           and t1.plan_id != #{excludePlanId}
     </select>
 

+ 8 - 8
ruoyi-system/src/main/resources/mapper/qdtl/TlInspectionPlanUserMapper.xml

@@ -7,12 +7,12 @@
     <resultMap type="TlInspectionPlanUser" id="TlInspectionPlanUserResult">
         <result property="id" column="id"/>
         <result property="planId" column="plan_id"/>
-        <result property="userId" column="user_id"/>
+        <result property="card" column="card"/>
         <result property="nickName" column="nick_name"/>
     </resultMap>
 
     <sql id="selectTlInspectionPlanUserVo">
-        select id, plan_id, user_id, nick_name
+        select id, plan_id, card, nick_name
         from tl_inspection_plan_user
     </sql>
 
@@ -20,7 +20,7 @@
         <include refid="selectTlInspectionPlanUserVo"/>
         <where>
             <if test="planId != null ">and plan_id = #{planId}</if>
-            <if test="userId != null ">and user_id = #{userId}</if>
+            <if test="card != null ">and card = #{card}</if>
             <if test="nickName != null  and nickName != ''">and nick_name like concat('%', #{nickName}, '%')</if>
         </where>
     </select>
@@ -42,20 +42,20 @@
         insert into tl_inspection_plan_user
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="planId != null">plan_id,</if>
-            <if test="userId != null">user_id,</if>
+            <if test="card != null">card,</if>
             <if test="nickName != null">nick_name,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="planId != null">#{planId},</if>
-            <if test="userId != null">#{userId},</if>
+            <if test="card != null">#{card},</if>
             <if test="nickName != null">#{nickName},</if>
         </trim>
     </insert>
 
     <insert id="batchInsert">
-        insert into tl_inspection_plan_user(plan_id, user_id, nick_name) values
+        insert into tl_inspection_plan_user(plan_id, card, nick_name) values
         <foreach item="item" index="index" collection="list" separator=",">
-            (#{item.planId},#{item.userId},#{item.nickName})
+            (#{item.planId},#{card},#{item.nickName})
         </foreach>
     </insert>
 
@@ -63,7 +63,7 @@
         update tl_inspection_plan_user
         <trim prefix="SET" suffixOverrides=",">
             <if test="planId != null">plan_id = #{planId},</if>
-            <if test="userId != null">user_id = #{userId},</if>
+            <if test="card != null">card = #{card},</if>
             <if test="nickName != null">nick_name = #{nickName},</if>
         </trim>
         where id = #{id}