Просмотр исходного кода

新增企业位置、h5巡检任务接口

QAQ 陈 3 месяцев назад
Родитель
Сommit
1d3f2edee5

+ 4 - 0
zhsw-common/src/main/java/com/rongwei/zhsw/system/service/SwInspectionTaskPointService.java

@@ -2,6 +2,9 @@ package com.rongwei.zhsw.system.service;
 
 import com.rongwe.zhsw.system.domain.SwInspectionTaskPointDo;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.rongwei.rwcommon.base.R;
+
+import java.util.Map;
 
 /**
 * @author libai
@@ -10,4 +13,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
 */
 public interface SwInspectionTaskPointService extends IService<SwInspectionTaskPointDo> {
 
+    R updateInspectionTask(Map<String, Object> taskPointInfo);
 }

+ 88 - 5
zhsw-common/src/main/java/com/rongwei/zhsw/system/service/impl/SwInspectionTaskPointServiceImpl.java

@@ -2,19 +2,102 @@ package com.rongwei.zhsw.system.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.rongwe.zhsw.system.domain.SwInspectionTaskPointDo;
+import com.rongwei.rwcommon.base.R;
 import com.rongwei.zhsw.system.dao.SwInspectionTaskPointDao;
 import com.rongwei.zhsw.system.service.SwInspectionTaskPointService;
 import org.springframework.stereotype.Service;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
-* @author libai
-* @description 针对表【sw_inspection_task_point(巡检任务-检查点)】的数据库操作Service实现
-* @createDate 2025-04-18 09:02:00
-*/
+ * @author libai
+ * @description 针对表【sw_inspection_task_point(巡检任务-检查点)】的数据库操作Service实现
+ * @createDate 2025-04-18 09:02:00
+ */
 @Service
 public class SwInspectionTaskPointServiceImpl extends ServiceImpl<SwInspectionTaskPointDao, SwInspectionTaskPointDo>
-    implements SwInspectionTaskPointService {
+        implements SwInspectionTaskPointService {
+
+    @Override
+    public R updateInspectionTask(Map<String, Object> taskPointInfo) {
+        if (taskPointInfo == null || !taskPointInfo.containsKey("id")) {
+            return R.error("参数错误:缺少必要的id字段");
+        }
+
+        String id = (String) taskPointInfo.get("id");
+
+        // 根据id查询检查点信息
+        SwInspectionTaskPointDo pointDo = this.getById(id);
+        if (pointDo == null) {
+            return R.error("找不到对应的检查点记录");
+        }
+
+        // 更新巡检结果
+        if (taskPointInfo.containsKey("status")) {
+            Integer status = (Integer) taskPointInfo.get("status");
+            pointDo.setInspectionresult(String.valueOf(status));
+        }
+
+        // 更新异常描述(如果有)
+        if (taskPointInfo.containsKey("ycription") && StringUtils.isNotBlank((String) taskPointInfo.get("ycription"))) {
+            pointDo.setExceptiondescription((String) taskPointInfo.get("ycription"));
+        }
+
+        // 处理照片
+        if (taskPointInfo.containsKey("photos") && taskPointInfo.get("photos") != null) {
+            List<String> photos = (List<String>) taskPointInfo.get("photos");
+            if (!photos.isEmpty()) {
+                String photoStr = processPhotos(photos);
+                pointDo.setPhotograph(photoStr);
+            }
+        }
+        // 更新数据
+        this.updateById(pointDo);
+        return R.ok("提交成功",pointDo.getPhotograph());
+    }
+
+    /**
+     * 处理照片数据,格式化为存储格式
+     *
+     * @param photos 照片URL列表
+     * @return 格式化后的照片字符串
+     */
+    private String processPhotos(List<String> photos) {
+        if (photos == null || photos.isEmpty()) {
+            return null;
+        }
+
+        return photos.stream()
+                .map(this::formatPhotoPath)
+                .collect(Collectors.joining("^_^"));
+    }
+
+    /**
+     * 格式化单个照片路径
+     *
+     * @param photoPath 照片路径
+     * @return 格式化后的照片信息
+     */
+    private String formatPhotoPath(String photoPath) {
+        if (StringUtils.isBlank(photoPath)) {
+            return "";
+        }
+
+        // 获取照片名称(最后一个斜杠后的部分)
+        String fileName = photoPath.substring(photoPath.lastIndexOf("/") + 1);
+
+        // 获取文件ID(文件名去掉后缀)
+        String fileId = fileName;
+        if (fileName.contains(".")) {
+            fileId = fileName.substring(0, fileName.lastIndexOf("."));
+        }
 
+        // 格式:fileName-;-fileId
+        return fileName + "-;-" + fileId;
+    }
 }
 
 

+ 10 - 1
zhsw-common/src/main/java/com/rongwei/zhsw/system/wechat/impl/AccountServiceImpl.java

@@ -10,6 +10,7 @@ import com.rongwei.rwcommon.base.exception.CustomException;
 import com.rongwei.rwcommon.utils.SecurityUtil;
 import com.rongwei.rwcommonentity.commonservers.domain.TenantDo;
 import com.rongwei.zhsw.system.dao.CommonBusinessDao;
+import com.rongwei.zhsw.system.dao.SwEnterpriseConfigInfoDao;
 import com.rongwei.zhsw.system.dao.SwNotificationAnnouncementDao;
 import com.rongwei.zhsw.system.dao.SysNotifyAnnounceUserDao;
 import com.rongwei.zhsw.system.service.impl.SwBillManagementUnpaidServiceImpl;
@@ -54,7 +55,8 @@ public class AccountServiceImpl implements AccountService {
     private CommonBusinessDao commonBusinessDao;
     @Autowired
     private SysNotifyAnnounceUserDao sysNotifyAnnounceUserDao;
-
+    @Autowired
+    private SwEnterpriseConfigInfoDao swEnterpriseConfigInfoDao;
     @Override
     public R bind(AccountBindVo accountBindVo) {
         log.info("开始执行户号绑定:{}", accountBindVo);
@@ -144,6 +146,13 @@ public class AccountServiceImpl implements AccountService {
         weChatHomePageVo.setDuFees(outstandingBills.stream().map(SwBillManagementUnpaidDo::getActualdue).reduce(BigDecimal::add).orElse(BigDecimal.ZERO));
         List<SwNotificationAnnouncementDo> swNotificationAnnouncementDos = swNotificationAnnouncementDao.selectShowData();
         weChatHomePageVo.setSwNotificationAnnouncementDos(swNotificationAnnouncementDos);
+        //获取企业配置信息企业地址信息
+        SwEnterpriseConfigInfoDo enterpriseConfig = swEnterpriseConfigInfoDao.selectOne(new LambdaQueryWrapper<SwEnterpriseConfigInfoDo>()
+                .eq(SwEnterpriseConfigInfoDo::getDeleted, 0)
+                .last("LIMIT 1"));
+        if (enterpriseConfig != null) {
+            weChatHomePageVo.setEnterPriseAddress(enterpriseConfig.getAddress());
+        }
         //获取微信标识
         String openId = WeChatUtils.getCurrentWeChatOpenId();
         //调用selectUserNotifyData方法获取用户消息列表

+ 6 - 5
zhsw-entity/src/main/java/com/rongwe/zhsw/system/domain/SwInspectionTaskPointDo.java

@@ -56,12 +56,13 @@ public class SwInspectionTaskPointDo extends BaseDo {
      * 巡检路线点位ID
      */
     private String inspectionroutepointid;
-    /**
-     * 巡检状态(0:正常、1:异常)
-     */
-    private String inspectionstatus;
     /**
      * 异常说明
      */
     private String exceptiondescription;
-}
+    /**
+     * 巡检说明
+     */
+    private String inspectioninstruction;
+
+}

+ 2 - 0
zhsw-entity/src/main/java/com/rongwe/zhsw/system/vo/WeChatHomePageVo.java

@@ -22,6 +22,8 @@ public class WeChatHomePageVo extends SwUserManagementDo {
     private BigDecimal duFees;
     //用水量
     private BigDecimal waterConsumption;
+    //用户所属企业地址
+    private String enterPriseAddress;
     //公告
     private List<SwNotificationAnnouncementDo> swNotificationAnnouncementDos;
     //用户消息

+ 42 - 0
zhsw-server/src/main/java/com/rongwei/zhsw/system/controller/SwInspectionTaskController.java

@@ -0,0 +1,42 @@
+package com.rongwei.zhsw.system.controller;
+
+import com.rongwei.rwcommon.base.R;
+import com.rongwei.zhsw.system.service.impl.SwInspectionTaskPointServiceImpl;
+import com.rongwei.zhsw.system.wechat.impl.OwnerServiceImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+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;
+
+import java.util.Map;
+
+/**
+ * OwnerController class
+ *
+ * @author XH
+ * @date 2025/03/07
+ */
+@RestController
+@RequestMapping("/inspectionTask")
+public class SwInspectionTaskController {
+
+    private final Logger log = LoggerFactory.getLogger(this.getClass().getName());
+
+    @Autowired
+    private SwInspectionTaskPointServiceImpl swInspectionTaskPointService;
+
+
+    /**
+     * 巡检任务-保存巡检点信息
+     *
+     * @return
+     */
+    @PostMapping("/H5TaskPointSubmit")
+    private R refreshOwner(@RequestBody Map<String, Object> taskPointInfo) {
+        return swInspectionTaskPointService.updateInspectionTask(taskPointInfo);
+    }
+
+}