renkang
2025-01-24 d3767d594de66cb5f9d1294931acefea1866f783
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());
        }