张天森
2022-10-08 86c38d586645e8ed14c32e1a69faf5540a27ff61
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComEventServiceImpl.java
@@ -70,8 +70,18 @@
    @Resource
    private UserService userService;
    @Resource
    private CommediateTypeService commediateTypeService;
    @Override
    public R pageByComEvent(ComEvent comEvent, Page pagination) {
    public R pageByComEvent(ComEvent comEvent, Page pagination,LoginUserInfoVO loginUserInfoVO) {
        if (nonNull(comEvent.getUserType())){
            if (comEvent.getUserType().equals(1)){
                comEvent.setRequestUserId(loginUserInfoVO.getUserId());
            }else if (comEvent.getUserType().equals(2)){
                comEvent.setSpecialistId(loginUserInfoVO.getUserId());
            }
        }
        IPage<ComEvent> list = baseMapper.pageByComEvent(comEvent, pagination);
        if (list.getRecords().size() < 1) {
            return R.ok(Collections.emptyList());
@@ -80,14 +90,18 @@
            List<ComEventResource> resourceList = comEventResourceService.list(new QueryWrapper<ComEventResource>().lambda().eq(ComEventResource::getRefId, comEvent1.getId()));
            List<ComEventRequestImageVO> comEventRequestImageVO = CopyUtil.deepCopyListObject(resourceList, ComEventRequestImageVO.class);
            comEvent1.setImages(comEventRequestImageVO);
            comEvent1.setIcon(userService.getUserInfoByUserId(comEvent1.getRequestUserId().toString()).getData().getImageUrl());
//            if (nonNull(userService.getUserInfoByUserId(comEvent1.getRequestUserId().toString()).getData().getImageUrl())){
//                comEvent1.setIcon(userService.getUserInfoByUserId(comEvent1.getRequestUserId().toString()).getData().getImageUrl());
//            }
            ComMediateType category = commediateTypeService.getById(comEvent1.getEventCategory());
            comEvent1.setEventCategoryName(category.getName());
        });
        return R.ok(list);
    }
    @Override
    public List<ComEvent> listByComEvent(ComEvent comEvent) {
        List<ComEvent> list = baseMapper.listByComEvent(comEvent);
    public List<ComEvent> listByComEvent(ComEvent comEvent,LoginUserInfoVO loginUserInfoVO) {
        List<ComEvent> list = baseMapper.listByComEvent(comEvent,null);
        if (list.size() < 1) {
            return Collections.emptyList();
        }
@@ -101,10 +115,14 @@
        if (comEvent.getRequestUserCommunity() != null) {
            ComActDO community = comActDAO.selectById(comEvent.getRequestUserCommunity());
            comEvent.setCurrentOrgName(community.getName());
            comEvent.setCurrentOrgId(community.getCommunityId().toString());
            comEvent.setCurrentProcessType(2);
        }
        if (!StringUtils.isEmpty(comEvent.getCenterId())) {
            ComSanshuoIndustryCenter center = comSanShuoIndustryCenterService.getById(comEvent.getCenterId());
            comEvent.setCurrentOrgName(center.getName());
            comEvent.setCurrentOrgId(center.getId().toString());
            comEvent.setCurrentProcessType(1);
        }
        comEvent.setUserEventStatus(2);
        comEvent.setEventProcessStatus(SanShuoEventStatusEnum.UNDO.getCode());
@@ -229,7 +247,7 @@
                || comEvent.getEventProcessStatus() == SanShuoEventStatusEnum.VALID.getCode().intValue()) {
            comEvent.setId(id);
            comEvent.setUserEventStatus(4);
            comEvent.setEventProcessStatus(SanShuoEventStatusEnum.CANCEL.getCode());
            comEvent.setEventProcessStatus(8);
            comEvent.setRevokeDes("用户手动取消");
            int flag = baseMapper.updateById(comEvent);
            return flag > 0 ? R.ok() : R.fail(ReturnMsgConstants.UPDATE_FALSE);
@@ -245,6 +263,7 @@
        ComEvent comEvent = baseMapper.selectById(id);
        ComSanshuoExpert specter = comSanShuoExpertService.getById(comEvent.getSpecialistId());
        CopyUtil.copyProperties(comEvent, comEventDetailVO);
        comEventDetailVO.setCategoryName(commediateTypeService.getById(comEventDetailVO.getEventCategory()).getName());
        List<ComEventResource> resourceList = comEventResourceService.list(new QueryWrapper<ComEventResource>().lambda().eq(ComEventResource::getRefId, id)
                .eq(ComEventResource::getStatus,1));
        List<ComEventRequestImageVO> comEventRequestImageVO = CopyUtil.deepCopyListObject(resourceList, ComEventRequestImageVO.class);
@@ -253,7 +272,7 @@
        map.put("eventDetail", comEventDetailVO);
        List<ComEventTransferRecord> transferRecord = comEventTransferRecordService.list(new QueryWrapper<ComEventTransferRecord>().lambda().eq(ComEventTransferRecord::getEventId, id));
        transferRecord.forEach(comEventTransferRecord -> {
            List<ComEventResource> list = comEventResourceService.list(new QueryWrapper<ComEventResource>().lambda().eq(ComEventResource::getTransferId, comEventTransferRecord.getId()));
            List<ComEventResource> list = comEventResourceService.list(new QueryWrapper<ComEventResource>().lambda().eq(ComEventResource::getRefId, comEvent.getId()));
            List<ComEventRequestImageVO> ImageVO = CopyUtil.deepCopyListObject(list, ComEventRequestImageVO.class);
            comEventTransferRecord.setImages(ImageVO);
        });
@@ -273,7 +292,7 @@
        ComSanshuoExpert specter = comSanShuoExpertService.getById(specterId);
        comEvent.setSpecialistAcceptTime(new Date());
        comEvent.setSpecialistName(specter.getName());
        comEvent.setEventProcessStatus(SanShuoEventStatusEnum.ACCEPT.getCode());
        comEvent.setEventProcessStatus(SanShuoEventStatusEnum.conciliation.getCode());
        int flag = baseMapper.updateById(comEvent);
        return flag > 0 ? R.ok() : R.fail(ReturnMsgConstants.UPDATE_FALSE);
    }
@@ -297,19 +316,20 @@
        List<ComEventCalculateVO> calculateList = baseMapper.calculate();
        ComEventCalculateVO comEventCalculateVO =new ComEventCalculateVO();
        comEventCalculateVO.setStatus("0");
        comEventCalculateVO.setSum(baseMapper.selectCount(new QueryWrapper<ComEvent>().lambda()).toString());
        comEventCalculateVO.setSum(baseMapper.selectCount(new QueryWrapper<ComEvent>().lambda().notIn(ComEvent::getEventProcessStatus,(9))).toString());
        calculateList.add(comEventCalculateVO);
        return R.ok(calculateList);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public R archiveRequest(ComEventArchiveVO comEventArchiveVO, LoginUserInfoVO sysUser) {
        ComEvent comEvent = baseMapper.selectById(comEventArchiveVO.getId());
        if (comEvent.getEventSucceed() == 2) {
            comEvent.setEventProcessStatus(6);
            comEvent.setEventProcessStatus(7);
        } else {
            comEvent.setEventProcessStatus(5);
            comEvent.setEventProcessStatus(6);
        }
        comEvent.setResult(comEventArchiveVO.getResult());
        baseMapper.updateById(comEvent);