Forráskód Böngészése

Merge branch 'wanghaicheng' of lift-manager/lift-server into develop

wanghaicheng 5 éve
szülő
commit
d91d77cb4b

+ 102 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/controller/ScanRecordController.java

@@ -0,0 +1,102 @@
+package cn.com.ty.lift.business.maintenance.controller;
+
+import cn.com.ty.lift.business.framework.util.MessageUtils;
+import cn.com.ty.lift.business.maintenance.dao.entity.MaintenanceRecord;
+import cn.com.ty.lift.business.maintenance.dao.entity.ScanRecord;
+import cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenanceRecordDetailRequest;
+import cn.com.ty.lift.business.maintenance.dao.entity.model.request.ScanRecordRequest;
+import cn.com.ty.lift.business.maintenance.dao.entity.model.response.ScanRecordResponse;
+import cn.com.ty.lift.business.maintenance.dao.mapper.MaintenanceRecordMapper;
+import cn.com.ty.lift.business.maintenance.service.MaintenanceRecordService;
+import cn.com.ty.lift.business.maintenance.service.ScanRecordService;
+import cn.com.xwy.boot.web.dto.RestResponse;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 电梯二维码扫码Controller
+ */
+@RestController
+@RequestMapping("scan")
+@AllArgsConstructor
+public class ScanRecordController {
+    private final MaintenanceRecordMapper maintenanceRecordMapper;
+    private final MaintenanceRecordService maintenanceRecordService;
+    private final ScanRecordService scanRecordService;
+
+    /**
+     * 根据电梯id查询已完成的维保记录
+     *
+     * @param request liftId
+     * @return 分页维保记录列表
+     */
+    @PostMapping("maintenance/success/record")
+    public RestResponse maintenanceRecord(@RequestBody ScanRecordRequest request) {
+        Page<ScanRecordResponse> page = new Page<>(request.getPageNum(), request.getPageSize());
+        IPage<ScanRecordResponse> record = maintenanceRecordMapper.findRecordByLiftId(page, request);
+        if (record.getRecords().isEmpty()) {
+            return RestResponse.success();
+        }
+        for (ScanRecordResponse scanRecord : record.getRecords()) {
+            if (scanRecord.getLiftType() != null) {
+                int liftType = scanRecord.getLiftType();
+                if (liftType == 1) {
+                    scanRecord.setLiftTypeName("直梯");
+                } else if (liftType == 2) {
+                    scanRecord.setLiftTypeName("扶梯");
+                } else {
+                    scanRecord.setLiftTypeName("未设置电梯类型");
+                }
+            }
+        }
+        return RestResponse.success(record);
+    }
+
+    /**
+     * 维保详情记录
+     *
+     * @param request 维保id
+     * @return 维保记录详情
+     */
+    @PostMapping("maintenance/record/detail")
+    public RestResponse detail(@RequestBody MaintenanceRecordDetailRequest request) {
+        MaintenanceRecord record = maintenanceRecordService.detail(request.getId());
+        if (ObjectUtil.isEmpty(record)) {
+            return RestResponse.success();
+        }
+        return RestResponse.success(record, MessageUtils.get("msg.query.detail.success"));
+    }
+
+    /**
+     * 根据电梯id查询电梯扫码记录列表
+     *
+     * @param record pageNum,pageSize,liftId
+     * @return 扫码记录
+     */
+    @PostMapping("record/list")
+    public RestResponse list(@RequestBody ScanRecordRequest record) {
+        Page<ScanRecord> scanRecordPage = new Page<>(record.getPageNum(), record.getPageNum());
+        IPage<ScanRecord> page = scanRecordService.page(scanRecordPage, Wrappers
+                .<ScanRecord>query()
+                .eq(record.getLiftId() != null, "lift_id", record.getLiftId()));
+        return RestResponse.success(page);
+    }
+
+    /**
+     * 新增扫码记录
+     *
+     * @param scanRecord 扫码记录
+     * @return 操作结果
+     */
+    @PostMapping("record/add")
+    public RestResponse add(@RequestBody ScanRecord scanRecord) {
+        return RestResponse.success(scanRecordService.save(scanRecord));
+    }
+}

+ 69 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/dao/entity/ScanRecord.java

@@ -0,0 +1,69 @@
+package cn.com.ty.lift.business.maintenance.dao.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 电梯二维码扫码记录表
+ * </p>
+ *
+ * @author wang-hai-cheng
+ * @since 2020-04-28
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class ScanRecord implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 电梯二维码扫码记录id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 电梯注册代码
+     */
+    @TableField("registration_code")
+    private String registrationCode;
+
+    /**
+     * 电梯位置
+     */
+    @TableField("device_position")
+    private String devicePosition;
+
+    /**
+     * 项目名
+     */
+    @TableField("project_name")
+    private String projectName;
+
+    /**
+     * 电梯类型(直梯,扶梯)
+     */
+    @TableField("lift_type_name")
+    private String liftTypeName;
+
+    /**
+     * 维保人员名字
+     */
+    @TableField("worker_name")
+    private String workerName;
+
+    /**
+     * 电梯id
+     */
+    @TableField("lift_id")
+    private Long liftId;
+    
+}

+ 18 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/dao/entity/model/request/ScanRecordRequest.java

@@ -0,0 +1,18 @@
+package cn.com.ty.lift.business.maintenance.dao.entity.model.request;
+
+import cn.com.ty.lift.business.maintenance.dao.entity.ScanRecord;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 电梯扫码请求
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ScanRecordRequest extends ScanRecord {
+    @TableField(exist = false)
+    private long pageNum = 1;
+    @TableField(exist = false)
+    private long pageSize = 10;
+}

+ 17 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/dao/entity/model/response/ScanRecordResponse.java

@@ -0,0 +1,17 @@
+package cn.com.ty.lift.business.maintenance.dao.entity.model.response;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import lombok.Data;
+
+@Data
+public class ScanRecordResponse {
+    private Long id;
+    private Long liftId;
+    private String registrationCode;
+    private String projectName;
+    private String devicePosition;
+    @JsonIgnore
+    private Integer liftType;
+    private String liftTypeName;
+    private String workerName;
+}

+ 9 - 4
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/dao/mapper/MaintenanceRecordMapper.java

@@ -6,10 +6,8 @@ import cn.com.ty.lift.business.maintenance.dao.entity.MaintenanceRecord;
 import cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenanceAppRequest;
 import cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenanceRecordRequest;
 import cn.com.ty.lift.business.maintenance.dao.entity.model.request.MtRecordRequest;
-import cn.com.ty.lift.business.maintenance.dao.entity.model.response.MaintenanceAppResponse;
-import cn.com.ty.lift.business.maintenance.dao.entity.model.response.MaintenancePlanResponse;
-import cn.com.ty.lift.business.maintenance.dao.entity.model.response.MaintenanceRecordResponse;
-import cn.com.ty.lift.business.maintenance.dao.entity.model.response.MtRecordResponse;
+import cn.com.ty.lift.business.maintenance.dao.entity.model.request.ScanRecordRequest;
+import cn.com.ty.lift.business.maintenance.dao.entity.model.response.*;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.apache.ibatis.annotations.Param;
@@ -37,6 +35,13 @@ public interface MaintenanceRecordMapper extends BaseMapper<MaintenanceRecord> {
      */
     IPage<MaintenanceAppResponse> findRecordByWorkerId(IPage<MaintenancePlanResponse> page, @Param("request") MaintenanceAppRequest request);
 
+    /**
+     * 根据电梯id和维保状态是完成的查询保养任务列表
+     * @param request 用户id和维保状态
+     * @return RestResponse 保养任务列表
+     */
+    IPage<ScanRecordResponse> findRecordByLiftId(IPage<ScanRecordResponse> page, @Param("request") ScanRecordRequest request);
+
     /**
      * @param request 公司id和电梯id
      * @return MaintenanceRecordResponse 项目信息

+ 16 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/dao/mapper/ScanRecordMapper.java

@@ -0,0 +1,16 @@
+package cn.com.ty.lift.business.maintenance.dao.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import cn.com.ty.lift.business.maintenance.dao.entity.ScanRecord;
+
+/**
+ * <p>
+ * 电梯二维码扫码记录表 Mapper 接口
+ * </p>
+ *
+ * @author wang-hai-cheng
+ * @since 2020-04-28
+ */
+public interface ScanRecordMapper extends BaseMapper<ScanRecord> {
+
+}

+ 19 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/service/ScanRecordService.java

@@ -0,0 +1,19 @@
+package cn.com.ty.lift.business.maintenance.service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import cn.com.ty.lift.business.maintenance.dao.entity.ScanRecord;
+import cn.com.ty.lift.business.maintenance.dao.mapper.ScanRecordMapper;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 电梯二维码扫码记录表 服务实现类
+ * </p>
+ *
+ * @author wang-hai-cheng
+ * @since 2020-04-28
+ */
+@Service
+public class ScanRecordService extends ServiceImpl<ScanRecordMapper, ScanRecord> {
+
+}

+ 222 - 197
lift-business-service/src/main/resources/mapper/maintenance/MaintenanceRecordMapper.xml

@@ -1,164 +1,186 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="cn.com.ty.lift.business.maintenance.dao.mapper.MaintenanceRecordMapper" >
-	<resultMap id="BaseResultMap" type="cn.com.ty.lift.business.maintenance.dao.entity.model.response.MtRecordResponse" >
-		<id column="id" property="id" jdbcType="BIGINT" />
-		<result column="mt_plan_id" property="mtPlanId" jdbcType="BIGINT" />
-		<result column="lift_id" property="liftId" jdbcType="BIGINT" />
-		<result column="project_id" property="projectId" jdbcType="BIGINT" />
-		<result column="mt_company_id" property="mtCompanyId" jdbcType="BIGINT" />
-		<result column="worker_id" property="workerId" jdbcType="BIGINT" />
-		<result column="code" property="code" jdbcType="CHAR" />
-		<result column="lift_type" property="liftType" jdbcType="TINYINT" />
-		<result column="type" property="type" jdbcType="TINYINT" />
-		<result column="plan_date" property="planDate" jdbcType="TIMESTAMP" />
-		<result column="work_date" property="workDate" jdbcType="TIMESTAMP" />
-		<result column="stop_date" property="stopDate" jdbcType="TIMESTAMP" />
-		<result column="recovery_date" property="recoveryDate" jdbcType="TIMESTAMP" />
-		<result column="maintenance_advice" property="maintenanceAdvice" jdbcType="VARCHAR" />
-		<result column="maintenance_option" property="maintenanceOption" jdbcType="LONGVARCHAR" />
-		<result column="position" property="position" jdbcType="VARCHAR" />
-		<result column="status" property="status" jdbcType="TINYINT" />
-		<result column="is_regular" property="isRegular" jdbcType="TINYINT" />
-		<result column="creator_id" property="creatorId" jdbcType="BIGINT" />
-		<result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
-		<result column="worker_id1" property="workerId1" jdbcType="BIGINT" />
-		<result column="is_repair" property="isRepair" jdbcType="TINYINT" />
-		<result column="repair_reason" property="repairReason" jdbcType="VARCHAR" />
-		<result column="signature_img1" property="signatureImg1" jdbcType="VARCHAR" />
-		<result column="signature_img2" property="signatureImg2" jdbcType="VARCHAR" />
-		<result column="sparepart" property="sparepart" jdbcType="LONGVARCHAR" />
-		<result column="parts_cost" property="partsCost" jdbcType="DECIMAL" />
-		<result column="man_cost" property="manCost" jdbcType="DECIMAL" />
-		<result column="safety_confirm" property="safetyConfirm" jdbcType="VARCHAR" />
-		<result column="has_evaluate" property="hasEvaluate" jdbcType="INTEGER" />
+<mapper namespace="cn.com.ty.lift.business.maintenance.dao.mapper.MaintenanceRecordMapper">
+    <resultMap id="BaseResultMap" type="cn.com.ty.lift.business.maintenance.dao.entity.model.response.MtRecordResponse">
+        <id column="id" property="id" jdbcType="BIGINT"/>
+        <result column="mt_plan_id" property="mtPlanId" jdbcType="BIGINT"/>
+        <result column="lift_id" property="liftId" jdbcType="BIGINT"/>
+        <result column="project_id" property="projectId" jdbcType="BIGINT"/>
+        <result column="mt_company_id" property="mtCompanyId" jdbcType="BIGINT"/>
+        <result column="worker_id" property="workerId" jdbcType="BIGINT"/>
+        <result column="code" property="code" jdbcType="CHAR"/>
+        <result column="lift_type" property="liftType" jdbcType="TINYINT"/>
+        <result column="type" property="type" jdbcType="TINYINT"/>
+        <result column="plan_date" property="planDate" jdbcType="TIMESTAMP"/>
+        <result column="work_date" property="workDate" jdbcType="TIMESTAMP"/>
+        <result column="stop_date" property="stopDate" jdbcType="TIMESTAMP"/>
+        <result column="recovery_date" property="recoveryDate" jdbcType="TIMESTAMP"/>
+        <result column="maintenance_advice" property="maintenanceAdvice" jdbcType="VARCHAR"/>
+        <result column="maintenance_option" property="maintenanceOption" jdbcType="LONGVARCHAR"/>
+        <result column="position" property="position" jdbcType="VARCHAR"/>
+        <result column="status" property="status" jdbcType="TINYINT"/>
+        <result column="is_regular" property="isRegular" jdbcType="TINYINT"/>
+        <result column="creator_id" property="creatorId" jdbcType="BIGINT"/>
+        <result column="create_date" property="createDate" jdbcType="TIMESTAMP"/>
+        <result column="worker_id1" property="workerId1" jdbcType="BIGINT"/>
+        <result column="is_repair" property="isRepair" jdbcType="TINYINT"/>
+        <result column="repair_reason" property="repairReason" jdbcType="VARCHAR"/>
+        <result column="signature_img1" property="signatureImg1" jdbcType="VARCHAR"/>
+        <result column="signature_img2" property="signatureImg2" jdbcType="VARCHAR"/>
+        <result column="sparepart" property="sparepart" jdbcType="LONGVARCHAR"/>
+        <result column="parts_cost" property="partsCost" jdbcType="DECIMAL"/>
+        <result column="man_cost" property="manCost" jdbcType="DECIMAL"/>
+        <result column="safety_confirm" property="safetyConfirm" jdbcType="VARCHAR"/>
+        <result column="has_evaluate" property="hasEvaluate" jdbcType="INTEGER"/>
 
-        <result column="project_name" property="projectName" jdbcType="VARCHAR" />
-		<result column="project_code" property="projectCode" jdbcType="VARCHAR" />
-		<result column="use_company_code" property="useCompanyCode" jdbcType="VARCHAR" />
-        <result column="mt_company_name" property="mtCompanyName" jdbcType="VARCHAR" />
-		<result column="category" property="category" jdbcType="INTEGER" />
-        <result column="registration_code" property="registrationCode" jdbcType="VARCHAR" />
-        <result column="worker_name" property="workerName" jdbcType="VARCHAR" />
-        <result column="repair_diff" property="repairDiff" jdbcType="BIGINT" />
-        <result column="star_level" property="starLevel" jdbcType="INTEGER" />
-	</resultMap>
+        <result column="project_name" property="projectName" jdbcType="VARCHAR"/>
+        <result column="project_code" property="projectCode" jdbcType="VARCHAR"/>
+        <result column="use_company_code" property="useCompanyCode" jdbcType="VARCHAR"/>
+        <result column="mt_company_name" property="mtCompanyName" jdbcType="VARCHAR"/>
+        <result column="category" property="category" jdbcType="INTEGER"/>
+        <result column="registration_code" property="registrationCode" jdbcType="VARCHAR"/>
+        <result column="worker_name" property="workerName" jdbcType="VARCHAR"/>
+        <result column="repair_diff" property="repairDiff" jdbcType="BIGINT"/>
+        <result column="star_level" property="starLevel" jdbcType="INTEGER"/>
+    </resultMap>
 
-	<sql id="Base_Column_List" >
+    <sql id="Base_Column_List">
 		id, mt_plan_id, lift_id, project_id, mt_company_id, worker_id, code, lift_type, type, 
 		plan_date, work_date, stop_date, recovery_date, maintenance_advice, maintenance_option, position, status,
 		is_regular, creator_id, create_date, worker_id1, is_repair, repair_reason, signature_img1, 
 		signature_img2, sparepart, parts_cost, man_cost, safety_confirm
 	</sql>
 
-	<!--根据公司id和电梯id项目名称、项目id、电梯位置 -->
-	<select id="findProjectByCompanyId" resultType="cn.com.ty.lift.business.maintenance.dao.entity.model.response.MaintenanceRecordResponse"
-			parameterType="cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenanceRecordRequest">
-		SELECT l.id              AS liftId,
-		       l.device_position AS devicePosition,
-			   p.project_name    AS projectName,
-		       p.id              AS projectId
-		FROM project_lift_relevance plr
-		LEFT JOIN project p ON plr.project_id = p.id
-		LEFT JOIN lift l ON plr.lift_id = l.id
-		WHERE 1 = 1
-		<if test="request.mtCompanyId!=null and request.mtCompanyId!=''">
-			AND plr.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
-		</if>
-		<if test="request.liftId!=null and request.liftId!=''">
-			AND plr.lift_id = #{request.liftId,jdbcType=BIGINT}
-		</if>
-	</select>
+    <!--根据公司id和电梯id项目名称、项目id、电梯位置 -->
+    <select id="findProjectByCompanyId"
+            resultType="cn.com.ty.lift.business.maintenance.dao.entity.model.response.MaintenanceRecordResponse"
+            parameterType="cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenanceRecordRequest">
+        SELECT l.id AS liftId,
+        l.device_position AS devicePosition,
+        p.project_name AS projectName,
+        p.id AS projectId
+        FROM project_lift_relevance plr
+        LEFT JOIN project p ON plr.project_id = p.id
+        LEFT JOIN lift l ON plr.lift_id = l.id
+        WHERE 1 = 1
+        <if test="request.mtCompanyId!=null and request.mtCompanyId!=''">
+            AND plr.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
+        </if>
+        <if test="request.liftId!=null and request.liftId!=''">
+            AND plr.lift_id = #{request.liftId,jdbcType=BIGINT}
+        </if>
+    </select>
 
-	<!--根据公司id和电梯id获取上次保养信息 -->
-	<select id="findRecordByCompanyId" resultType="cn.com.ty.lift.business.maintenance.dao.entity.model.response.MaintenanceRecordResponse"
-			parameterType="cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenanceRecordRequest">
-		SELECT work_date AS workDate,
-			   type      AS type,
-		       lift_id   AS liftId
-		FROM maintenance_record
-		WHERE 1=1
-		<if test="request.mtCompanyId!=null and request.mtCompanyId!=''">
-			AND mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
-	    </if>
-		<if test="request.liftId!=null and request.liftId!=''">
-			AND lift_id = #{request.liftId,jdbcType=BIGINT}
-		</if>
-		AND work_date = (SELECT max(work_date)
-		FROM maintenance_record
-		WHERE status > 1
-		<if test="request.mtCompanyId!=null and request.mtCompanyId!=''">
-			AND mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
-		</if>
-		<if test="request.liftId!=null and request.liftId!=''">
-			AND lift_id = #{request.liftId,jdbcType=BIGINT}
-		</if>)
-	</select>
+    <!--根据公司id和电梯id获取上次保养信息 -->
+    <select id="findRecordByCompanyId"
+            resultType="cn.com.ty.lift.business.maintenance.dao.entity.model.response.MaintenanceRecordResponse"
+            parameterType="cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenanceRecordRequest">
+        SELECT work_date AS workDate,
+        type AS type,
+        lift_id AS liftId
+        FROM maintenance_record
+        WHERE 1=1
+        <if test="request.mtCompanyId!=null and request.mtCompanyId!=''">
+            AND mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
+        </if>
+        <if test="request.liftId!=null and request.liftId!=''">
+            AND lift_id = #{request.liftId,jdbcType=BIGINT}
+        </if>
+        AND work_date = (SELECT max(work_date)
+        FROM maintenance_record
+        WHERE status > 1
+        <if test="request.mtCompanyId!=null and request.mtCompanyId!=''">
+            AND mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
+        </if>
+        <if test="request.liftId!=null and request.liftId!=''">
+            AND lift_id = #{request.liftId,jdbcType=BIGINT}
+        </if>)
+    </select>
 
-	<!--app端 保养任务列表 (1:保养中、2:已完成) -->
-	<select id="findRecordByWorkerId" resultType="cn.com.ty.lift.business.maintenance.dao.entity.model.response.MaintenanceAppResponse"
-			parameterType="cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenanceAppRequest">
-		SELECT p.project_name AS projectName,
-			p.id                AS projectId,
-			mr.id               AS mtPlanId,
-			mr.id               AS recordId,
-			l.id                AS liftId,
-			l.coordinate        AS coordinate,
-			l.registration_code AS registrationCode,
-			l.use_company_code  AS useCompanyCode,
-			l.lift_type         AS liftType,
-			l.category          AS category,
-			l.lift_code         AS liftCode,
-			l.device_position   AS devicePosition,
-			ui.name             AS workerName,
-			mr.worker_id        AS workerId,
-		    mr.worker_id1       AS workerId1,
-			mr.plan_date        AS planDate,
-			mr.type             AS maintenanceType,
-			mr.status           AS status
-		FROM maintenance_record mr
-		LEFT JOIN project p ON mr.project_id = p.id
-		LEFT JOIN lift l ON mr.lift_id = l.id
-		LEFT JOIN user_info ui ON mr.worker_id = ui.user_id
-		WHERE mr.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
-		<if test="request.workerId!=null and request.workerId!=''">
-			AND mr.worker_id1 = #{request.workerId,jdbcType=BIGINT}
-		</if>
-		<if test="request.status!=null and request.status!=''">
-			AND mr.status = #{request.status,jdbcType=VARCHAR}
-		</if>
-	</select>
+    <!--app端 保养任务列表 (1:保养中、2:已完成) -->
+    <select id="findRecordByWorkerId"
+            resultType="cn.com.ty.lift.business.maintenance.dao.entity.model.response.MaintenanceAppResponse"
+            parameterType="cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenanceAppRequest">
+        SELECT p.project_name AS projectName,
+        p.id AS projectId,
+        mr.id AS mtPlanId,
+        mr.id AS recordId,
+        l.id AS liftId,
+        l.coordinate AS coordinate,
+        l.registration_code AS registrationCode,
+        l.use_company_code AS useCompanyCode,
+        l.lift_type AS liftType,
+        l.category AS category,
+        l.lift_code AS liftCode,
+        l.device_position AS devicePosition,
+        ui.name AS workerName,
+        mr.worker_id AS workerId,
+        mr.worker_id1 AS workerId1,
+        mr.plan_date AS planDate,
+        mr.type AS maintenanceType,
+        mr.status AS status
+        FROM maintenance_record mr
+        LEFT JOIN project p ON mr.project_id = p.id
+        LEFT JOIN lift l ON mr.lift_id = l.id
+        LEFT JOIN user_info ui ON mr.worker_id = ui.user_id
+        WHERE mr.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
+        <if test="request.workerId!=null and request.workerId!=''">
+            AND mr.worker_id1 = #{request.workerId,jdbcType=BIGINT}
+        </if>
+        <if test="request.status!=null and request.status!=''">
+            AND mr.status = #{request.status,jdbcType=VARCHAR}
+        </if>
+    </select>
+
+    <select id="findRecordByLiftId"
+            resultType="cn.com.ty.lift.business.maintenance.dao.entity.model.response.ScanRecordResponse"
+            parameterType="cn.com.ty.lift.business.maintenance.dao.entity.model.request.MtRecordRequest">
+        SELECT mr.id               AS id,
+               l.id                AS liftId,
+               l.registration_code AS registrationCode,
+               p.project_name      AS projectName,
+               l.device_position   AS devicePosition,
+               l.lift_type         AS liftType,
+               ui.name             AS workerName
+        FROM maintenance_record mr
+             LEFT JOIN lift l ON l.id = mr.lift_id
+             LEFT JOIN project p ON mr.project_id = p.id
+             LEFT JOIN user_info ui ON mr.worker_id = ui.user_id
+        WHERE mr.lift_id = #{request.liftId,jdbcType=BIGINT} AND mr.status = '2'
+    </select>
 
-	<select id="countDoingByUser" resultType="java.lang.Long" parameterType="cn.com.ty.lift.business.common.CommonRequest">
-		SELECT
-		count(1)
-		FROM maintenance_record mr
-		WHERE mr.status = '1'
-		<if test="request.userId != null and request.userId > 0">
-			AND mr.worker_id1 = #{request.userId}
-		</if>
-		<if test="request.mtCompanyId != null and request.mtCompanyId > 0">
-			AND mr.mt_company_id = #{request.mtCompanyId}
-		</if>
-	</select>
+    <select id="countDoingByUser" resultType="java.lang.Long"
+            parameterType="cn.com.ty.lift.business.common.CommonRequest">
+        SELECT
+        count(1)
+        FROM maintenance_record mr
+        WHERE mr.status = '1'
+        <if test="request.userId != null and request.userId > 0">
+            AND mr.worker_id1 = #{request.userId}
+        </if>
+        <if test="request.mtCompanyId != null and request.mtCompanyId > 0">
+            AND mr.mt_company_id = #{request.mtCompanyId}
+        </if>
+    </select>
 
-	<!--日常保养-保养单:根据条件分页查询-->
-    <select id="pageRecordByCondition" resultMap="BaseResultMap" parameterType="cn.com.ty.lift.business.maintenance.dao.entity.model.request.MtRecordRequest">
+    <!--日常保养-保养单:根据条件分页查询-->
+    <select id="pageRecordByCondition" resultMap="BaseResultMap"
+            parameterType="cn.com.ty.lift.business.maintenance.dao.entity.model.request.MtRecordRequest">
         SELECT
-            mr.*,
-            li.use_company_code,
-            li.registration_code,
-            li.category,
-            ui.`name` AS worker_name,
-            pr.project_name,
-            ifnull(ev.star_level, 0),
-            TimeStampDiff(SECOND ,mr.stop_date,mr.recovery_date) AS repair_diff
+        mr.*,
+        li.use_company_code,
+        li.registration_code,
+        li.category,
+        ui.`name` AS worker_name,
+        pr.project_name,
+        ifnull(ev.star_level, 0),
+        TimeStampDiff(SECOND ,mr.stop_date,mr.recovery_date) AS repair_diff
         FROM
-            maintenance_record mr
-            LEFT JOIN lift li ON mr.lift_id = li.id
-            LEFT JOIN user_info ui ON mr.worker_id1 = ui.user_id
-            LEFT JOIN project pr ON mr.project_id = pr.id AND pr.mt_company_id = mr.mt_company_id
-            LEFT JOIN evaluation ev ON mr.id = ev.record_id
+        maintenance_record mr
+        LEFT JOIN lift li ON mr.lift_id = li.id
+        LEFT JOIN user_info ui ON mr.worker_id1 = ui.user_id
+        LEFT JOIN project pr ON mr.project_id = pr.id AND pr.mt_company_id = mr.mt_company_id
+        LEFT JOIN evaluation ev ON mr.id = ev.record_id
         <where>
             <if test="cond.mtCompanyId != null and cond.mtCompanyId > 0">
                 AND mr.mt_company_id = #{cond.mtCompanyId}
@@ -184,12 +206,13 @@
         </where>
     </select>
 
-	<!--日常保养-保养单:根据条件汇总条数-->
-    <select id="countRecordByCondition" resultType="java.lang.Long" parameterType="cn.com.ty.lift.business.maintenance.dao.entity.model.request.MtRecordRequest">
+    <!--日常保养-保养单:根据条件汇总条数-->
+    <select id="countRecordByCondition" resultType="java.lang.Long"
+            parameterType="cn.com.ty.lift.business.maintenance.dao.entity.model.request.MtRecordRequest">
         SELECT
-          	count(*)
+        count(*)
         FROM
-          	maintenance_record mr
+        maintenance_record mr
         <where>
             <if test="cond.mtCompanyId != null and cond.mtCompanyId > 0">
                 AND mr.mt_company_id = #{cond.mtCompanyId}
@@ -197,60 +220,62 @@
         </where>
     </select>
 
-	<!--日常保养-保养单:根据id查询,带关联信息-->
-	<select id="infoById" resultMap="BaseResultMap" parameterType="cn.com.ty.lift.business.maintenance.dao.entity.model.request.MtRecordRequest">
-		SELECT
-			mr.*,
-			li.use_company_code,
-			li.registration_code,
-			li.category,
-            mc.name AS mt_company_name,
-			ui.`name` AS worker_name,
-			pr.project_name,
-			pr.project_code,
-			ev.star_level
-		FROM
-			maintenance_record mr
-		LEFT JOIN lift li ON mr.lift_id = li.id
-		LEFT JOIN user_info ui ON mr.worker_id1 = ui.user_id
-		LEFT JOIN project pr ON mr.project_id = pr.id AND mr.mt_company_id = pr.mt_company_id
-		LEFT JOIN evaluation ev ON mr.id = ev.record_id AND ev.source = 1
+    <!--日常保养-保养单:根据id查询,带关联信息-->
+    <select id="infoById" resultMap="BaseResultMap"
+            parameterType="cn.com.ty.lift.business.maintenance.dao.entity.model.request.MtRecordRequest">
+        SELECT
+        mr.*,
+        li.use_company_code,
+        li.registration_code,
+        li.category,
+        mc.name AS mt_company_name,
+        ui.`name` AS worker_name,
+        pr.project_name,
+        pr.project_code,
+        ev.star_level
+        FROM
+        maintenance_record mr
+        LEFT JOIN lift li ON mr.lift_id = li.id
+        LEFT JOIN user_info ui ON mr.worker_id1 = ui.user_id
+        LEFT JOIN project pr ON mr.project_id = pr.id AND mr.mt_company_id = pr.mt_company_id
+        LEFT JOIN evaluation ev ON mr.id = ev.record_id AND ev.source = 1
         LEFT JOIN maintenance_company mc ON mr.mt_company_id = mc.id
-		<where>
-			<if test="cond.id != null and cond.id > 0">
-				mr.id = #{cond.id}
-			</if>
-		</where>
-	</select>
+        <where>
+            <if test="cond.id != null and cond.id > 0">
+                mr.id = #{cond.id}
+            </if>
+        </where>
+    </select>
 
-	<select id="pageByLift" resultMap="BaseResultMap" parameterType="cn.com.ty.lift.business.maintenance.dao.entity.model.request.MtRecordRequest">
-		SELECT
-            mr.*,
-            li.use_company_code,
-            li.registration_code,
-            li.category,
-            mc.name AS mt_company_name,
-            ui.`name` AS worker_name,
-            pr.project_name,
-            pr.project_code,
-            ev.star_level
-		FROM
-		  maintenance_record mr
-		LEFT JOIN lift li ON mr.lift_id = li.id
-		LEFT JOIN user_info ui ON mr.worker_id1 = ui.user_id
-		LEFT JOIN project pr ON mr.project_id = pr.id
-		LEFT JOIN evaluation ev ON mr.id = ev.record_id
-		LEFT JOIN maintenance_company mc ON mr.mt_company_id = mc.id
-		<where>
-			<if test="cond.liftId != null and cond.liftId > 0">
-				AND mr.lift_id = #{cond.liftId}
-			</if>
+    <select id="pageByLift" resultMap="BaseResultMap"
+            parameterType="cn.com.ty.lift.business.maintenance.dao.entity.model.request.MtRecordRequest">
+        SELECT
+        mr.*,
+        li.use_company_code,
+        li.registration_code,
+        li.category,
+        mc.name AS mt_company_name,
+        ui.`name` AS worker_name,
+        pr.project_name,
+        pr.project_code,
+        ev.star_level
+        FROM
+        maintenance_record mr
+        LEFT JOIN lift li ON mr.lift_id = li.id
+        LEFT JOIN user_info ui ON mr.worker_id1 = ui.user_id
+        LEFT JOIN project pr ON mr.project_id = pr.id
+        LEFT JOIN evaluation ev ON mr.id = ev.record_id
+        LEFT JOIN maintenance_company mc ON mr.mt_company_id = mc.id
+        <where>
+            <if test="cond.liftId != null and cond.liftId > 0">
+                AND mr.lift_id = #{cond.liftId}
+            </if>
             <if test="cond.projectId != null and cond.projectId > 0">
                 AND mr.project_id = #{cond.projectId}
             </if>
             <if test="cond.mtCompanyId != null and cond.mtCompanyId > 0">
                 AND mr.mt_company_id = #{cond.mtCompanyId}
             </if>
-		</where>
-	</select>
+        </where>
+    </select>
 </mapper>

+ 2 - 2
lift-quan-service/src/main/java/cn/com/ty/lift/quan/news/service/impl/QuanNewsServiceImpl.java

@@ -47,7 +47,7 @@ public class QuanNewsServiceImpl extends ServiceImpl<QuanNewsMapper, QuanNews> i
         Page<QuanNews> page = new Page<>(request.getPageNum(), request.getPageSize());
         IPage<QuanNews> news = this.page(page, Wrappers.<QuanNews>query()
                 .like(null != request.getTitle(), "title", request.getTitle())
-                .eq("top_serial", "0")
+                .eq("is_top", false)
                 .orderByDesc("release_date"));
         //全部新闻的浏览量列表
         Map<Object, Object> lookTimes = redisTemplate.boundHashOps("system-quanNews-look-time").entries();
@@ -58,7 +58,7 @@ public class QuanNewsServiceImpl extends ServiceImpl<QuanNewsMapper, QuanNews> i
         result.put("news", news);
         if (request.getHaveTops() == 1) {
             List<QuanNews> topNews = this.list(Wrappers.<QuanNews>query()
-                    .ne("top_serial", "0")
+                    .ne("is_top", true)
                     .orderByAsc("top_serial"));
             //把点赞的用户数量和浏览量整入新闻字段中
             newsAddLookAndLike(topNews, lookTimes, likeUsers);