From d3767d594de66cb5f9d1294931acefea1866f783 Mon Sep 17 00:00:00 2001
From: renkang <8417338+k94314517@user.noreply.gitee.com>
Date: 星期五, 24 一月 2025 18:24:25 +0800
Subject: [PATCH] 客户资料 巡检任务业务

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwWorkorderServiceImpl.java |   52 ++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwWorkorderServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwWorkorderServiceImpl.java
index 4346ef6..58d10e9 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwWorkorderServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwWorkorderServiceImpl.java
@@ -1,5 +1,6 @@
 package com.doumee.service.business.impl;
 
+import com.alibaba.fastjson.JSONObject;
 import com.doumee.biz.system.SystemDictDataBiz;
 import com.doumee.core.constants.ResponseStatus;
 import com.doumee.core.exception.BusinessException;
@@ -16,7 +17,9 @@
 import com.doumee.dao.business.vo.YwWorkorderDataVO;
 import com.doumee.dao.system.MultifileMapper;
 import com.doumee.dao.system.SystemUserMapper;
+import com.doumee.dao.system.join.NoticesJoinMapper;
 import com.doumee.dao.system.model.Multifile;
+import com.doumee.dao.system.model.Notices;
 import com.doumee.dao.system.model.SystemUser;
 import com.doumee.service.business.YwWorkorderService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -60,6 +63,9 @@
     private YwBuildingMapper ywBuildingMapper;
     @Autowired
     private YwFloorMapper ywFloorMapper;
+    @Autowired
+    private NoticesJoinMapper noticesJoinMapper;
+
 
     @Override
     @Transactional(rollbackFor = {BusinessException.class,Exception.class})
@@ -194,6 +200,30 @@
         update.setDispatchInfo(ywWorkorder.getDispatchInfo());
         update.setDealUserId(ywWorkorder.getDealUserId());
         ywWorkorderMapper.updateById(update);
+
+        //娣诲姞寰呭姙淇℃伅
+        Notices notices = new Notices();
+        notices.setCreateDate(new Date());
+        notices.setCreator(update.getEditor());
+        notices.setIsdeleted(Constants.ZERO);
+        notices.setParam1(DateUtil.formatDate(model.getCreateDate(),"yyyy-MM-dd"));
+        notices.setTitle("宸ュ崟寰呭姙");
+        notices.setObjId(update.getId());
+        notices.setObjType(Constants.TWO);
+        notices.setType(notices.getObjType());
+        notices.setUserId(ywWorkorder.getDealUserId());
+        notices.setStatus(Constants.ZERO);
+        //鏁寸悊json鏁版嵁
+        Map<String,Object> jsonMap = new HashMap<>();
+        jsonMap.put("key1", model.getBuildingName()+"/"+model.getFloorName());
+        jsonMap.put("key2", DateUtil.getFomartDate(model.getCreateDate(),"yyyy-MM-dd HH:mm:ss"));
+        jsonMap.put("key3", Constants.equalsInteger(model.getAreaType(),Constants.ZERO)?"瀹ゅ唴缁翠慨":"鍏叡鍖哄煙");
+        jsonMap.put("key4", model.getCategoryParentName()+"/"+model.getCategoryName());
+        notices.setParam2(JSONObject.toJSONString(jsonMap));
+        notices.setParam3(Constants.ZERO+"");
+        noticesJoinMapper.insert(notices);
+
+
         dealLogBiz(model,Constants.YwLogType.WORKORDER_DISPATCH,ywWorkorder.getLoginUserInfo().getRealname(),user.getRealname());//璁板綍鏂板缓鏃ュ織
     }
     @Override
@@ -220,6 +250,17 @@
         update.setDealDate(update.getEditDate());
         update.setDealInfo(ywWorkorder.getDealInfo());
         ywWorkorderMapper.updateById(update);
+
+
+        //鏍囪寰呭姙宸插鐞�
+        noticesJoinMapper.update(null,new UpdateWrapper<Notices>().lambda()
+                .set(Notices::getStatus,Constants.ONE)
+                .set(Notices::getParam3,Constants.TWO)
+                .eq(Notices::getIsdeleted,Constants.ZERO)
+                .eq(Notices::getObjType,Constants.TWO)
+                .eq(Notices::getObjId,update.getId())
+        );
+
 
         List<Multifile> fileList = new ArrayList<>();
         if(ywWorkorder.getDealFileList()!=null && ywWorkorder.getDealFileList().size()>0){
@@ -330,8 +371,9 @@
                 .selectAs(Company::getName,YwWorkorder::getDealUserCompany)
                 .select("t3.realname",YwWorkorder::getCreatorName)
                 .select("t3.mobile",YwWorkorder::getCreatorMobile)
-                .select("t9.name",YwWorkorder::getCreatorCompany)
-                .selectAs(Category::getName,YwWorkorder::getCategoryName)
+                .select("c.name",YwWorkorder::getCreatorCompany)
+                .select("ct.name",YwWorkorder::getCategoryName)
+                .select("ct1.name",YwWorkorder::getCategoryParentName)
                 .selectAs(YwRoom::getName,YwWorkorder::getRoomName)
                 .selectAs(YwRoom::getRoomNum,YwWorkorder::getRoomNum)
                 .selectAs(YwFloor::getName,YwWorkorder::getFloorName)
@@ -345,7 +387,9 @@
                 .leftJoin(YwFloor.class,YwFloor::getId,YwWorkorder::getFloorId)
                 .leftJoin(YwBuilding.class,YwBuilding::getId,YwWorkorder::getBuildingId)
                 .leftJoin(YwProject.class,YwProject::getId,YwWorkorder::getProjectId)
-                .leftJoin(" company t9 on t9.id = t1.company_id  ")
+                .leftJoin(" company c on c.id = t1.company_id  ")
+                .leftJoin(" category ct on ct.id = t.cate_id  ")
+                .leftJoin(" category ct1 on ct1.id = ct.PARENT_ID  ")
                 .eq(YwWorkorder::getId,id);
         YwWorkorder model = ywWorkorderMapper.selectJoinOne(YwWorkorder.class,queryWrapper);
         initFiles(model);//璇诲彇闄勪欢淇℃伅
@@ -551,7 +595,7 @@
                 .eq(Constants.equalsInteger(dto.getQueryType(),Constants.THREE),YwWorkorder::getRoomId,dto.getQueryId()));
         if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(list)){
             ywWorkorderDataVO.setAmount(list.size());
-            ywWorkorderDataVO.setMonthAmount(list.stream().filter(i-> DateUtil.formatDate(i.getSubmitDate(),"yyyy-MM").equals(DateUtil.formatDate(new Date(),"yyyy-MM"))).collect(Collectors.toList()).size());
+            ywWorkorderDataVO.setMonthAmount(list.stream().filter(i-> DateUtil.formatDate(i.getCreateDate(),"yyyy-MM").equals(DateUtil.formatDate(new Date(),"yyyy-MM"))).collect(Collectors.toList()).size());
             ywWorkorderDataVO.setWaitDealAmount(list.stream().filter(i-> Constants.equalsInteger(i.getDealStatus(),Constants.ONE)).collect(Collectors.toList()).size());
             ywWorkorderDataVO.setWaitAssignAmount(list.stream().filter(i-> Constants.equalsInteger(i.getDealStatus(),Constants.ZERO)).collect(Collectors.toList()).size());
         }

--
Gitblit v1.9.3