Explorar o código

Merge branch 'develop' of http://132.232.206.88:3000/lift-manager/lift-server into feature-bieao

别傲 %!s(int64=5) %!d(string=hai) anos
pai
achega
7ba128ecd3

+ 2 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/emergency/controller/EmergencyRepairController.java

@@ -15,6 +15,8 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 /**
  * <p>
  * 临修记录 前端控制器

+ 25 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/emergency/dto/RepairResponse.java

@@ -1,6 +1,8 @@
 package cn.com.ty.lift.business.emergency.dto;
 
 import cn.com.ty.lift.business.emergency.entity.EmergencyRepair;
+import cn.hutool.core.date.BetweenFormater;
+import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import lombok.Data;
@@ -41,9 +43,32 @@ public class RepairResponse extends EmergencyRepair{
      */
     private String callName;
 
+    /**
+     * 维修工
+     */
+    private String workerName;
+
+    /**
+     * 创建人(召修人)
+     */
+    private String createName;
     /**
      * 电梯公司状态
      */
     private Integer liftCompanyStatus;
 
+    /**
+     * 维修时长秒数
+     */
+    private long repairDiff;
+
+    private String repairDuration;
+
+    /**
+     * 重新getter方法,换算时长
+     * @return
+     */
+    public String getRepairDuration() {
+        return DateUtil.formatBetween(this.repairDiff, BetweenFormater.Level.SECOND);
+    }
 }

+ 6 - 6
lift-business-service/src/main/java/cn/com/ty/lift/business/emergency/entity/EmergencyRepair.java

@@ -52,31 +52,31 @@ public class EmergencyRepair implements Serializable {
     private Integer isCritical;
 
     /**
-     * 修故障描述
+     * 修故障描述
      */
     @TableField("caller_fault_description")
     private String callerFaultDescription;
 
     /**
-     * 修来源(1 物业;2 维保;3 物联)
+     * 修来源(1 物业;2 维保;3 物联)
      */
     @TableField("source")
     private Integer source;
 
     /**
-     * 修人ID
+     * 修人ID
      */
     @TableField("caller_id")
     private Long callerId;
 
     /**
-     * 修人电话
+     * 修人电话
      */
     @TableField("caller_tel")
     private String callerTel;
 
     /**
-     * 修时间
+     * 修时间
      */
     @TableField("caller_date")
     private LocalDateTime callerDate;
@@ -148,7 +148,7 @@ public class EmergencyRepair implements Serializable {
     private Integer status;
 
     /**
-     * 创建人ID
+     * 创建人ID 召修人就是发起人,是创建急修的人
      */
     @TableField("creator_id")
     private Long creatorId;

+ 27 - 15
lift-business-service/src/main/resources/mapper/emergency/EmergencyRepairMapper.xml

@@ -44,26 +44,34 @@
 		<result column="registration_code" property="registrationCode" jdbcType="VARCHAR" />
 		<result column="device_position" property="devicePosition" jdbcType="VARCHAR" />
 		<result column="call_name" property="callName" jdbcType="VARCHAR" />
+		<result column="create_name" property="createName" jdbcType="VARCHAR" />
+		<result column="worker_name" property="workerName" jdbcType="VARCHAR" />
 		<result column="lift_company_status" property="liftCompanyStatus" jdbcType="VARCHAR" />
+		<result column="repair_diff" property="repairDiff" jdbcType="BIGINT" />
 	</resultMap>
 
 	<!--查询急修中-->
     <select id="listByRepairing" resultMap="BaseResultMap" parameterType="cn.com.ty.lift.business.emergency.dto.RepairRequest">
         SELECT
-            er.*,
-            ui.`name` AS call_name,
-            li.registration_code,
-            li.device_position,
-            pr.project_name,
-            pclr.lift_company_status
+        	t.*,
+        	ui.name AS worker_name
         FROM
-            emergency_repair er
-            LEFT JOIN user_info ui ON ui.user_id = er.caller_id
-            LEFT JOIN lift li ON li.id = er.lift_id
-            LEFT JOIN project pr ON pr.id = er.project_id
-            LEFT JOIN platform_company_lift_relevance pclr ON pclr.lift_id = li.id
-        WHERE
-          er.`status` <![CDATA[ <> ]]> 4
+			(SELECT
+				er.*,
+				ui.`name` AS create_name,
+				li.registration_code,
+				li.device_position,
+				pr.project_name,
+				pclr.lift_company_status
+			FROM
+				emergency_repair er
+				LEFT JOIN user_info ui ON ui.user_id = er.caller_id
+				LEFT JOIN lift li ON li.id = er.lift_id
+				LEFT JOIN project pr ON pr.id = er.project_id
+				LEFT JOIN platform_company_lift_relevance pclr ON pclr.lift_id = li.id
+			WHERE
+			  er.`status` <![CDATA[ <> ]]> 4 ) t
+          LEFT JOIN user_info ui ON ui.user_id = t.worker_id1
     </select>
 
     <!--根据条件查询急修记录总条数-->
@@ -86,13 +94,17 @@
         SELECT
             er.*,
 			li.registration_code AS registration_code,
+			li.device_position AS device_position,
             pr.project_name,
-            re.area_name
+            re.area_name,
+			ui.name AS worker_name,
+			TimeStampDiff(SECOND ,er.stop_date,er.recovery_date) AS repair_diff
         FROM
             emergency_repair er
             LEFT JOIN project pr ON er.project_id = pr.id
             LEFT JOIN region re ON pr.region_id = re.id
 			LEFT JOIN lift li ON er.lift_id = li.id
+			LEFT JOIN user_info ui ON ui.user_id = er.worker_id1
         WHERE 1 = 1
             <if test="cond.projectId != null and cond.projectId > 0">
                 AND pr.id = #{cond.projectId}
@@ -101,7 +113,7 @@
                 AND pr.region_id = #{cond.regionId}
             </if>
             <if test="cond.workerId != null and cond.workerId > 0">
-                AND er.worker_id = #{cond.workerId}
+                AND er.worker_id1 = #{cond.workerId}
             </if>
             <if test="cond.repairBegin != null">
                 AND er.caller_date &gt; #{cond.repairBegin}

+ 5 - 0
lift-common/src/main/java/cn.com.ty.lift.common/utils/DateUtils.java

@@ -1,6 +1,7 @@
 package cn.com.ty.lift.common.utils;
 
 
+import cn.hutool.core.date.BetweenFormater;
 import cn.hutool.core.date.DateUtil;
 
 import java.time.LocalDate;
@@ -32,4 +33,8 @@ public class DateUtils {
     public static String generateCode() {
         return DateUtil.format(new Date(), "yyyyMMddHHmmssSSS");
     }
+
+    public static void main(String[] args) {
+        System.out.println(DateUtil.formatBetween(1212112121, BetweenFormater.Level.SECOND));
+    }
 }