瀏覽代碼

物业管理端

tjf 4 月之前
父節點
當前提交
f712bbfa35

+ 26 - 6
ruoyi-admin/src/main/java/com/ruoyi/web/controller/checkPoint/CheckPointManageController.java

@@ -30,7 +30,7 @@ public class CheckPointManageController extends BaseController {
     /**
      * 查询巡更点管理列表
      */
-    @PreAuthorize("@ss.hasPermi('wuYe:manage:list')")
+    @PreAuthorize("@ss.hasPermi('wuYe:checkPointManage:list')")
     @GetMapping("/list")
     public TableDataInfo list(CheckPointManage checkPointManage) {
         startPage();
@@ -38,10 +38,21 @@ public class CheckPointManageController extends BaseController {
         return getDataTable(list);
     }
 
+    /**
+     * 查询巡更点管理列表
+     */
+    @PreAuthorize("@ss.hasPermi('wuYe:checkPointManage:listNoPage')")
+    @GetMapping("/listNoPage")
+    public TableDataInfo listNoPage(CheckPointManage checkPointManage) {
+
+        List<CheckPointManage> list = checkPointManageService.selectCheckPointManageList(checkPointManage);
+        return getDataTable(list);
+    }
+
     /**
      * 导出巡更点管理列表
      */
-    @PreAuthorize("@ss.hasPermi('wuYe:manage:export')")
+    @PreAuthorize("@ss.hasPermi('wuYe:checkPointManage:export')")
     @Log(title = "巡更点管理", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     public void export(HttpServletResponse response, CheckPointManage checkPointManage) {
@@ -53,7 +64,7 @@ public class CheckPointManageController extends BaseController {
     /**
      * 获取巡更点管理详细信息
      */
-    @PreAuthorize("@ss.hasPermi('wuYe:manage:query')")
+    @PreAuthorize("@ss.hasPermi('wuYe:checkPointManage:query')")
     @GetMapping(value = "/{checkPointManageId}")
     public AjaxResult getInfo(@PathVariable("checkPointManageId") Long checkPointManageId) {
         return success(checkPointManageService.selectCheckPointManageByCheckPointManageId(checkPointManageId));
@@ -62,17 +73,26 @@ public class CheckPointManageController extends BaseController {
     /**
      * 新增巡更点管理
      */
-    @PreAuthorize("@ss.hasPermi('wuYe:manage:add')")
+    @PreAuthorize("@ss.hasPermi('wuYe:checkPointManage:add')")
     @Log(title = "巡更点管理", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody CheckPointManage checkPointManage) {
         return toAjax(checkPointManageService.insertCheckPointManage(checkPointManage));
     }
 
+    /**
+     * 批量新增巡更点管理
+     */
+    @PreAuthorize("@ss.hasPermi('wuYe:checkPointManage:addList')")
+    @PostMapping("/addList")
+    public AjaxResult addList(@RequestBody List<CheckPointManage> checkPointManageList) {
+        return toAjax(checkPointManageService.batchCheckPointManage(checkPointManageList));
+    }
+
     /**
      * 修改巡更点管理
      */
-    @PreAuthorize("@ss.hasPermi('wuYe:manage:edit')")
+    @PreAuthorize("@ss.hasPermi('wuYe:checkPointManage:edit')")
     @Log(title = "巡更点管理", businessType = BusinessType.UPDATE)
     @PostMapping("/put")
     public AjaxResult edit(@RequestBody CheckPointManage checkPointManage) {
@@ -82,7 +102,7 @@ public class CheckPointManageController extends BaseController {
     /**
      * 删除巡更点管理
      */
-    @PreAuthorize("@ss.hasPermi('wuYe:manage:remove')")
+    @PreAuthorize("@ss.hasPermi('wuYe:checkPointManage:remove')")
     @Log(title = "巡更点管理", businessType = BusinessType.DELETE)
     @GetMapping("/delete/{checkPointManageIds}")
     public AjaxResult remove(@PathVariable Long[] checkPointManageIds) {

+ 21 - 19
ruoyi-admin/src/main/java/com/ruoyi/web/controller/checkPoint/CheckPointRecordController.java

@@ -23,18 +23,16 @@ import java.util.List;
  */
 @RestController
 @RequestMapping("/wuYe/checkPointRecord")
-public class CheckPointRecordController extends BaseController
-{
+public class CheckPointRecordController extends BaseController {
     @Autowired
     private ICheckPointRecordService checkPointRecordService;
 
-/**
- * 查询巡更点记录列表
- */
-@PreAuthorize("@ss.hasPermi('wuYe:checkPointRecord:list')")
-@GetMapping("/list")
-    public TableDataInfo list(CheckPointRecord checkPointRecord)
-    {
+    /**
+     * 查询巡更点记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('wuYe:checkPointRecord:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CheckPointRecord checkPointRecord) {
         startPage();
         List<CheckPointRecord> list = checkPointRecordService.selectCheckPointRecordList(checkPointRecord);
         return getDataTable(list);
@@ -46,8 +44,7 @@ public class CheckPointRecordController extends BaseController
     @PreAuthorize("@ss.hasPermi('wuYe:checkPointRecord:export')")
     @Log(title = "巡更点记录", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, CheckPointRecord checkPointRecord)
-    {
+    public void export(HttpServletResponse response, CheckPointRecord checkPointRecord) {
         List<CheckPointRecord> list = checkPointRecordService.selectCheckPointRecordList(checkPointRecord);
         ExcelUtil<CheckPointRecord> util = new ExcelUtil<CheckPointRecord>(CheckPointRecord.class);
         util.exportExcel(response, list, "巡更点记录数据");
@@ -58,8 +55,7 @@ public class CheckPointRecordController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('wuYe:checkPointRecord:query')")
     @GetMapping(value = "/{checkPointRecordId}")
-    public AjaxResult getInfo(@PathVariable("checkPointRecordId") Long checkPointRecordId)
-    {
+    public AjaxResult getInfo(@PathVariable("checkPointRecordId") Long checkPointRecordId) {
         return success(checkPointRecordService.selectCheckPointRecordByCheckPointRecordId(checkPointRecordId));
     }
 
@@ -69,8 +65,7 @@ public class CheckPointRecordController extends BaseController
     @PreAuthorize("@ss.hasPermi('wuYe:checkPointRecord:add')")
     @Log(title = "巡更点记录", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody CheckPointRecord checkPointRecord)
-    {
+    public AjaxResult add(@RequestBody CheckPointRecord checkPointRecord) {
         return toAjax(checkPointRecordService.insertCheckPointRecord(checkPointRecord));
     }
 
@@ -80,8 +75,7 @@ public class CheckPointRecordController extends BaseController
     @PreAuthorize("@ss.hasPermi('wuYe:checkPointRecord:edit')")
     @Log(title = "巡更点记录", businessType = BusinessType.UPDATE)
     @PostMapping("/put")
-    public AjaxResult edit(@RequestBody CheckPointRecord checkPointRecord)
-    {
+    public AjaxResult edit(@RequestBody CheckPointRecord checkPointRecord) {
         return toAjax(checkPointRecordService.updateCheckPointRecord(checkPointRecord));
     }
 
@@ -91,8 +85,16 @@ public class CheckPointRecordController extends BaseController
     @PreAuthorize("@ss.hasPermi('wuYe:checkPointRecord:remove')")
     @Log(title = "巡更点记录", businessType = BusinessType.DELETE)
     @GetMapping("/delete/{checkPointRecordIds}")
-    public AjaxResult remove(@PathVariable Long[] checkPointRecordIds)
-    {
+    public AjaxResult remove(@PathVariable Long[] checkPointRecordIds) {
         return toAjax(checkPointRecordService.deleteCheckPointRecordByCheckPointRecordIds(checkPointRecordIds));
     }
+
+    /**
+     * 巡更点记录首页统计
+     */
+    @PreAuthorize("@ss.hasPermi('wuYe:checkPointRecord:count')")
+    @PostMapping("/count")
+    public AjaxResult count(@RequestBody CheckPointRecord checkPointRecord) {
+        return AjaxResult.success(checkPointRecordService.getCheckPointRecordCount(checkPointRecord));
+    }
 }

+ 13 - 3
ruoyi-common/pom.xml

@@ -16,7 +16,17 @@
     </description>
 
     <dependencies>
-
+        <!--通用工具hutool-->
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>5.7.21</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.9.0</version>
+        </dependency>
         <!-- Spring框架基本的核心工具 -->
         <dependency>
             <groupId>org.springframework</groupId>
@@ -52,13 +62,13 @@
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-lang3</artifactId>
         </dependency>
-  
+
         <!-- JSON工具类 -->
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-databind</artifactId>
         </dependency>
-        
+
         <!-- 阿里JSON解析器 -->
         <dependency>
             <groupId>com.alibaba.fastjson2</groupId>

+ 2 - 2
ruoyi-system/src/main/java/com/ruoyi/system/domain/checkPoint/CheckPointManage.java

@@ -30,8 +30,8 @@ public class CheckPointManage extends BaseEntity
     private String checkType;
 
     /** 巡更时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "巡更时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @JsonFormat(pattern = "HH:mm:ss")
+    @Excel(name = "巡更时间", width = 30, dateFormat = "HH:mm:ss")
     private Date checkTime;
 
     /** 巡更路线 */

+ 19 - 7
ruoyi-system/src/main/java/com/ruoyi/system/domain/checkPoint/CheckPointRecord.java

@@ -34,8 +34,8 @@ public class CheckPointRecord extends BaseEntity
     private String checkType;
 
     /** 巡更时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "巡更时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @JsonFormat(pattern = "HH:mm:ss")
+    @Excel(name = "巡更时间", width = 30, dateFormat = "HH:mm:ss")
     private Date checkTime;
 
     /** 巡更路线 */
@@ -53,6 +53,10 @@ public class CheckPointRecord extends BaseEntity
     /** 巡更人姓名 */
     @Excel(name = "巡更人姓名")
     private String checkUserName;
+    /**
+     * 巡更人手机号
+     */
+    private String checkUsePhone;
 
     /** 巡更人id */
     @Excel(name = "巡更人id")
@@ -66,16 +70,24 @@ public class CheckPointRecord extends BaseEntity
     @Excel(name = "巡更结果详情")
     private String checkResultDetails;
 
-    /** 巡更结果记录时间 */
-    @Excel(name = "巡更结果记录时间")
+    /** 巡更结果照片 */
+    @Excel(name = "巡更结果照片")
     private String checkResultPhoto;
 
     /** 巡更时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "巡更时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "巡更时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date checkResultTime;
 
-    public void setCheckPointRecordId(Long checkPointRecordId) 
+    public String getCheckUsePhone() {
+        return checkUsePhone;
+    }
+
+    public void setCheckUsePhone(String checkUsePhone) {
+        this.checkUsePhone = checkUsePhone;
+    }
+
+    public void setCheckPointRecordId(Long checkPointRecordId)
     {
         this.checkPointRecordId = checkPointRecordId;
     }

+ 7 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/CheckPointManageMapper.java

@@ -37,6 +37,13 @@ public interface CheckPointManageMapper
      */
     public int insertCheckPointManage(CheckPointManage checkPointManage);
 
+    /**
+     * 批量新增
+     * @param checkPointManage
+     * @return
+     */
+    public int batchCheckPointManage(List<CheckPointManage> checkPointManage);
+
     /**
      * 修改巡更点管理
      * 

+ 7 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ICheckPointManageService.java

@@ -37,6 +37,13 @@ public interface ICheckPointManageService
      */
     public int insertCheckPointManage(CheckPointManage checkPointManage);
 
+    /**
+     * 批量新增
+     * @param checkPointManage
+     * @return
+     */
+    public int batchCheckPointManage(List<CheckPointManage> checkPointManage);
+
     /**
      * 修改巡更点管理
      * 

+ 8 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ICheckPointRecordService.java

@@ -1,5 +1,6 @@
 package com.ruoyi.system.service;
 
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.system.domain.checkPoint.CheckPointRecord;
 
 import java.util.List;
@@ -60,4 +61,11 @@ public interface ICheckPointRecordService
      * @return 结果
      */
     public int deleteCheckPointRecordByCheckPointRecordId(Long checkPointRecordId);
+
+    /**
+     * 巡更点记录首页统计
+     * @param checkPointRecord
+     * @return
+     */
+    public AjaxResult getCheckPointRecordCount(CheckPointRecord checkPointRecord);
 }

+ 13 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CheckPointManageServiceImpl.java

@@ -58,6 +58,19 @@ public class CheckPointManageServiceImpl implements ICheckPointManageService
         return checkPointManageMapper.insertCheckPointManage(checkPointManage);
     }
 
+    /**
+     * 批量新增
+     * @param checkPointManage
+     * @return
+     */
+    @Override
+    public int batchCheckPointManage(List<CheckPointManage> checkPointManage) {
+        for (CheckPointManage pointManage : checkPointManage) {
+            pointManage.setCreateTime(DateUtils.getNowDate());
+        }
+        return checkPointManageMapper.batchCheckPointManage(checkPointManage);
+    }
+
     /**
      * 修改巡更点管理
      * 

+ 27 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CheckPointRecordServiceImpl.java

@@ -1,5 +1,6 @@
 package com.ruoyi.system.service.impl;
 
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.system.domain.checkPoint.CheckPointRecord;
 import com.ruoyi.system.mapper.CheckPointRecordMapper;
@@ -7,7 +8,9 @@ import com.ruoyi.system.service.ICheckPointRecordService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 巡更点记录Service业务层处理
@@ -94,4 +97,28 @@ public class CheckPointRecordServiceImpl implements ICheckPointRecordService
     {
         return checkPointRecordMapper.deleteCheckPointRecordByCheckPointRecordId(checkPointRecordId);
     }
+
+    /**
+     * 巡更点记录首页统计
+     * @param checkPointRecord
+     * @return
+     */
+    @Override
+    public AjaxResult getCheckPointRecordCount(CheckPointRecord checkPointRecord) {
+        Map<String,Object> resultMap = new HashMap<>(3);
+        resultMap.put("巡更点",0);
+        resultMap.put("已巡更",0);
+        resultMap.put("未巡更",0);
+        checkPointRecord.setCreateTime(DateUtils.getNowDate());
+        //查询出今日所有巡更点记录
+        List<CheckPointRecord> checkPointRecords = checkPointRecordMapper.selectCheckPointRecordList(checkPointRecord);
+        if (checkPointRecords != null && checkPointRecords.size() > 0){
+            //判断巡更时间不为null的代表已经巡更
+            resultMap.put("巡更点",checkPointRecords.size());
+            long checkCount = checkPointRecords.stream().filter(e -> e.getCheckResultTime() != null).count();
+            resultMap.put("已巡更",checkCount);
+            resultMap.put("未巡更",checkPointRecords.size()-checkCount);
+        }
+        return AjaxResult.success(resultMap);
+    }
 }

+ 44 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/Task.java

@@ -0,0 +1,44 @@
+package com.ruoyi.system.service.impl;
+
+
+import com.google.gson.Gson;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.system.domain.checkPoint.CheckPointManage;
+import com.ruoyi.system.domain.checkPoint.CheckPointRecord;
+import com.ruoyi.system.mapper.CheckPointManageMapper;
+import com.ruoyi.system.mapper.CheckPointRecordMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * 定时任务
+* @author tang
+ */
+@Component
+public class Task {
+    @Autowired
+    private CheckPointManageMapper checkPointManageMapper;
+    private CheckPointRecordMapper checkPointRecordMapper;
+    private static final Gson GSON = new Gson();
+    /***
+     *每日巡更记录的定时任务
+     * 每天23点执行
+     */
+    @Async
+    @Scheduled(cron = "0 0 23 * * ? ")
+    public void popover() throws Exception {
+        CheckPointManage checkPointManage = new CheckPointManage();
+        List<CheckPointManage> checkPointManages = checkPointManageMapper.selectCheckPointManageList(checkPointManage);
+        if (checkPointManages != null && checkPointManages.size() > 0){
+            for (CheckPointManage pointManage : checkPointManages) {
+                CheckPointRecord checkPointRecord = GSON.fromJson(GSON.toJson(pointManage), CheckPointRecord.class);
+                checkPointRecord.setCreateTime(DateUtils.getNowDate());
+                checkPointRecordMapper.insertCheckPointRecord(checkPointRecord);
+            }
+        }
+    }
+}

+ 6 - 0
ruoyi-system/src/main/resources/mapper/system/CheckPointManageMapper.xml

@@ -88,6 +88,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where check_point_manage_id = #{checkPointManageId}
     </update>
 
+    <insert id="batchCheckPointManage">
+        insert into check_point_manage( check_type, check_time, check_address,createTime) values
+        <foreach item="item" index="index" collection="list" separator=",">
+            ( #{item.checkType}, #{item.checkTime}, #{item.checkAddress},#{item.createTime})
+        </foreach>
+    </insert>
     <delete id="deleteCheckPointManageByCheckPointManageId" parameterType="Long">
         delete from check_point_manage where check_point_manage_id = #{checkPointManageId}
     </delete>

+ 7 - 1
ruoyi-system/src/main/resources/mapper/system/CheckPointRecordMapper.xml

@@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="userName"    column="user_name"    />
         <result property="useId"    column="use_id"    />
         <result property="checkUserName"    column="check_user_name"    />
+        <result property="checkUsePhone"    column="check_user_phone"    />
         <result property="checkUseId"    column="check_use_id"    />
         <result property="checkResult"    column="check_result"    />
         <result property="checkResultDetails"    column="check_result_details"    />
@@ -27,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectCheckPointRecordVo">
-        select check_point_record_id, check_point_manage_id, date_time_num, check_type, check_time, check_address, user_name, use_id, check_user_name, check_use_id, check_result, check_result_details, check_result_photo, check_result_time, create_by, create_time, update_by, update_time, remark from check_point_record
+        select check_point_record_id, check_point_manage_id, check_user_phone,date_time_num, check_type, check_time, check_address, user_name, use_id, check_user_name, check_use_id, check_result, check_result_details, check_result_photo, check_result_time, create_by, create_time, update_by, update_time, remark from check_point_record
     </sql>
 
     <select id="selectCheckPointRecordList" parameterType="CheckPointRecord" resultMap="CheckPointRecordResult">
@@ -41,11 +42,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="userName != null  and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
             <if test="useId != null "> and use_id = #{useId}</if>
             <if test="checkUserName != null  and checkUserName != ''"> and check_user_name like concat('%', #{checkUserName}, '%')</if>
+            <if test="checkUsePhone != null  and checkUsePhone != ''"> and check_user_phone = #{checkUsePhone}</if>
             <if test="checkUseId != null "> and check_use_id = #{checkUseId}</if>
             <if test="checkResult != null  and checkResult != ''"> and check_result = #{checkResult}</if>
             <if test="checkResultDetails != null  and checkResultDetails != ''"> and check_result_details = #{checkResultDetails}</if>
             <if test="checkResultPhoto != null  and checkResultPhoto != ''"> and check_result_photo = #{checkResultPhoto}</if>
             <if test="checkResultTime != null "> and check_result_time = #{checkResultTime}</if>
+            <if test="createTime != null "> and date_format(create_time,'%Y%m%d') =date_format(#{createTime},'%Y%m%d') </if>
         </where>
     </select>
     
@@ -65,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="userName != null">user_name,</if>
             <if test="useId != null">use_id,</if>
             <if test="checkUserName != null">check_user_name,</if>
+            <if test="checkUsePhone != null">check_user_phone,</if>
             <if test="checkUseId != null">check_use_id,</if>
             <if test="checkResult != null">check_result,</if>
             <if test="checkResultDetails != null">check_result_details,</if>
@@ -85,6 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="userName != null">#{userName},</if>
             <if test="useId != null">#{useId},</if>
             <if test="checkUserName != null">#{checkUserName},</if>
+            <if test="checkUsePhone != null">#{checkUsePhone},</if>
             <if test="checkUseId != null">#{checkUseId},</if>
             <if test="checkResult != null">#{checkResult},</if>
             <if test="checkResultDetails != null">#{checkResultDetails},</if>
@@ -109,6 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="userName != null">user_name = #{userName},</if>
             <if test="useId != null">use_id = #{useId},</if>
             <if test="checkUserName != null">check_user_name = #{checkUserName},</if>
+            <if test="checkUsePhone != null">check_user_phone = #{checkUsePhone},</if>
             <if test="checkUseId != null">check_use_id = #{checkUseId},</if>
             <if test="checkResult != null">check_result = #{checkResult},</if>
             <if test="checkResultDetails != null">check_result_details = #{checkResultDetails},</if>