瀏覽代碼

app-工作台保养任务统计待保养的任务,后台项目系统台量sql修改

别傲 5 年之前
父節點
當前提交
8e3b1c7c17

+ 3 - 3
lift-business-service/src/main/java/cn/com/ty/lift/business/common/CommonController.java

@@ -6,7 +6,7 @@ import cn.com.ty.lift.business.emergency.service.EmergencyRepairService;
 import cn.com.ty.lift.business.framework.conf.SystemConfiguration;
 import cn.com.ty.lift.business.framework.util.MessageUtils;
 import cn.com.ty.lift.business.library.dao.entity.LiftBrand;
-import cn.com.ty.lift.business.maintenance.service.MaintenanceRecordService;
+import cn.com.ty.lift.business.maintenance.service.MaintenancePlanService;
 import cn.com.ty.lift.common.constants.RedisConstants;
 import cn.com.ty.lift.common.model.AreaCode;
 import cn.com.ty.lift.common.utils.ValuePool;
@@ -46,7 +46,7 @@ public class CommonController {
     private AnnualInspectionService       annualInspectionService;
     private EmergencyRepairService        emergencyRepairService;
     private CapitalRepairLiftRelevanceService capitalRepairLiftRelevanceService;
-    private MaintenanceRecordService maintenanceRecordService;
+    private MaintenancePlanService maintenancePlanService;
 
     /**
      * @return RestResponse 省、市、区树形结构列表
@@ -168,7 +168,7 @@ public class CommonController {
         long inspection = annualInspectionService.countDoingByUser(request);
         long repair = emergencyRepairService.countDoingByUser(request);
         long capital = capitalRepairLiftRelevanceService.countDoingByUser(request);
-        long maintain = maintenanceRecordService.countDoingByUser(request);
+        long maintain = maintenancePlanService.countWaitingMaintenanceByUser(request);
         CommonResponse common = new CommonResponse();
         common.setInspection(inspection);
         common.setRepair(repair);

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

@@ -1,5 +1,6 @@
 package cn.com.ty.lift.business.maintenance.dao.mapper;
 
+import cn.com.ty.lift.business.common.CommonRequest;
 import cn.com.ty.lift.business.maintenance.dao.entity.MaintenancePlan;
 import cn.com.ty.lift.business.maintenance.dao.entity.model.MaintenanceCount;
 import cn.com.ty.lift.business.maintenance.dao.entity.model.MaintenanceTask;
@@ -51,4 +52,6 @@ public interface MaintenancePlanMapper extends BaseMapper<MaintenancePlan> {
 
     List<Map<String, String>> exportList(@Param("exportList") List<String> ids);
 
+    long countWaitingMaintenanceByUser(@Param("request") CommonRequest request);
+
 }

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

@@ -1,7 +1,6 @@
 package cn.com.ty.lift.business.maintenance.dao.mapper;
 
 
-import cn.com.ty.lift.business.common.CommonRequest;
 import cn.com.ty.lift.business.maintenance.dao.entity.MaintenanceRecord;
 import cn.com.ty.lift.business.maintenance.dao.entity.model.MaintenanceCount;
 import cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenanceRecordRequest;
@@ -67,6 +66,4 @@ public interface MaintenanceRecordMapper extends BaseMapper<MaintenanceRecord> {
     MtRecordResponse infoById(@Param("cond") MtRecordRequest request);
 
     IPage<MtRecordResponse> pageByLift(IPage<MtRecordResponse> page, @Param("cond") MtRecordRequest request);
-
-    long countDoingByUser(@Param("request") CommonRequest request);
 }

+ 11 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/service/MaintenancePlanService.java

@@ -1,6 +1,7 @@
 package cn.com.ty.lift.business.maintenance.service;
 
 import cn.com.ty.lift.business.capital.dao.mapper.CommonMapper;
+import cn.com.ty.lift.business.common.CommonRequest;
 import cn.com.ty.lift.business.framework.util.MessageUtils;
 import cn.com.ty.lift.business.library.dao.entity.Lift;
 import cn.com.ty.lift.business.library.service.LiftService;
@@ -612,6 +613,16 @@ public class MaintenancePlanService extends ServiceImpl<MaintenancePlanMapper, M
         return baseMapper.countPlanByCondition(request);
     }
 
+    /**
+     * @param request 公司id,用户id
+     * @return 条数
+     * @description 根据公司id和用户id查询待保养的任务数量
+     * @date 2020/4/25 9:31 上午
+     */
+    public long countWaitingMaintenanceByUser(CommonRequest request) {
+        return baseMapper.countWaitingMaintenanceByUser(request);
+    }
+
     /**
      * 根据条件统计 维保计划-超期计划
      * @author wcz

+ 0 - 10
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/service/MaintenanceRecordService.java

@@ -519,14 +519,4 @@ public class MaintenanceRecordService extends ServiceImpl<MaintenanceRecordMappe
     public IPage<MtRecordResponse> pageByLift(MtRecordRequest request){
         return baseMapper.pageByLift(request.getPage(), request);
     }
-
-    /**
-     * @param request 公司id,用户id
-     * @return 条数
-     * @description 根据公司id和用户id查询保养中的任务数量
-     * @date 2020/4/25 9:31 上午
-     */
-    public long countDoingByUser(CommonRequest request) {
-        return baseMapper.countDoingByUser(request);
-    }
 }

+ 0 - 1
lift-business-service/src/main/java/cn/com/ty/lift/business/project/service/ProjectService.java

@@ -28,7 +28,6 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
-import cn.hutool.poi.excel.ExcelUtil;
 import cn.hutool.poi.excel.ExcelWriter;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

+ 18 - 2
lift-business-service/src/main/resources/mapper/maintenance/MaintenancePlanMapper.xml

@@ -237,7 +237,7 @@
 		LEFT JOIN project pr ON pr.id = mp.project_id AND pr.mt_company_id = mp.mt_company_id
 		LEFT JOIN user_info ui ON ui.user_id = mp.worker_id
 		LEFT JOIN maintenance_record mr ON mr.mt_plan_id = mp.id
-        WHERE mp.plan_date &lt; now() AND mp.work_date IS NULL
+        WHERE mp.plan_date &lt; date_format(now(),'%Y-%m-%d') AND mp.work_date IS NULL
         <if test="cond.mtCompanyId != null and cond.mtCompanyId > 0">
             AND mp.mt_company_id = #{cond.mtCompanyId}
         </if>
@@ -267,12 +267,28 @@
             count(*)
         FROM
           maintenance_plan mp
-        WHERE mp.plan_date &lt; now() AND mp.work_date IS NULL
+        WHERE mp.plan_date &lt; date_format(now(),'%Y-%m-%d') AND mp.work_date IS NULL
         <if test="cond.mtCompanyId != null and cond.mtCompanyId > 0">
               AND mp.mt_company_id = #{cond.mtCompanyId}
         </if>
     </select>
 
+	<select id="countWaitingMaintenanceByUser" resultType="java.lang.Long"
+			parameterType="cn.com.ty.lift.business.common.CommonRequest">
+		SELECT
+			count(1)
+		FROM maintenance_plan mp
+		LEFT JOIN project_user pu ON pu.project_id = mp.project_id AND pu.mt_company_id = mp.mt_company_id
+		WHERE mp.status = '0'
+		AND mp.plan_date = current_date()
+		<if test="request.userId != null and request.userId > 0">
+			AND pu.user_id = #{request.userId}
+		</if>
+		<if test="request.mtCompanyId != null and request.mtCompanyId > 0">
+			AND mp.mt_company_id = #{request.mtCompanyId}
+		</if>
+	</select>
+
 	<select id="exportList" parameterType="java.util.List" resultType="java.util.Map">
 		SELECT DATE_FORMAT(mp.plan_date,'%Y-%m-%d')  AS planDate,
 			   l.registration_code AS registrationCode,

+ 0 - 14
lift-business-service/src/main/resources/mapper/maintenance/MaintenanceRecordMapper.xml

@@ -206,20 +206,6 @@
         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="pageRecordByCondition" resultMap="BaseResultMap"
             parameterType="cn.com.ty.lift.business.maintenance.dao.entity.model.request.MtRecordRequest">

+ 4 - 0
lift-business-service/src/main/resources/mapper/project/ProjectMapper.xml

@@ -71,6 +71,10 @@
         LEFT JOIN user_info ui ON r.user_id = ui.user_id
         LEFT JOIN property_company pc ON p.pp_company_id = pc.id
 		LEFT JOIN contracts c ON p.id = c.project_id
+		LEFT JOIN (SELECT count(1) AS actualNum, project_id
+					FROM project_lift_relevance plr
+					WHERE plr.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
+					GROUP BY project_id) plr ON plr.project_id = p.id
         WHERE p.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
 		<if test="request.provinceCode!=null and request.provinceCode!=''">
 			AND p.province_code= #{request.provinceCode,jdbcType=VARCHAR}