yanghb
2024-12-17 1287337fd0b0c156ec79712f9a600ebeffefe3a6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package com.zzg.system.service.state.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzg.common.core.domain.entity.state.StateProjectNotice;
import com.zzg.system.convert.StateProjectConvert;
import com.zzg.system.domain.vo.StateProjectNoticeVO;
import com.zzg.system.mapper.state.StateProjectNoticeMapper;
import com.zzg.system.service.state.StateProjectNoticeService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
 
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
 
@Service
@RequiredArgsConstructor
public class StateProjectNoticeServiceImpl extends ServiceImpl<StateProjectNoticeMapper, StateProjectNotice> implements StateProjectNoticeService {
 
 
    @Override
    public StateProjectNoticeVO getStateProjectNoticeVO(String noticeId) {
        StateProjectNotice byId = this.getById(noticeId);
        StateProjectNoticeVO stateProjectNoticeVO = StateProjectConvert.INSTANCE.entityToStateProjectNoticeVO(byId);
//        if (byId != null) {
//            String fileUrl = byId.getFileUrl();
//            String imgUrl = byId.getImgUrl();
//
//            if (fileUrl != null && !fileUrl.isEmpty()) {
//                stateProjectNoticeVO.setFileUrlList(Arrays.asList(fileUrl.split(",")));
//            } else {
//                stateProjectNoticeVO.setFileUrlList(Collections.emptyList()); // 或根据需求设置其他默认值
//            }
//
//            if (imgUrl != null && !imgUrl.isEmpty()) {
//                stateProjectNoticeVO.setImgUrlList(Arrays.asList(imgUrl.split(",")));
//            } else {
//                stateProjectNoticeVO.setImgUrlList(Collections.emptyList()); // 或根据需求设置其他默认值
//            }
//        }
        return stateProjectNoticeVO;
    }
 
    @Override
    public Map<String, List<StateProjectNotice>> listNoticeMapByProjectIdList(List<String> projectIdList) {
        LambdaQueryWrapper<StateProjectNotice> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(StateProjectNotice::getType,2)
                .in(StateProjectNotice::getProjectId,projectIdList);
        List<StateProjectNotice> list = list(queryWrapper);
        if (CollectionUtils.isEmpty(list)){
            return Collections.emptyMap();
        }
        return list.stream().collect(Collectors.groupingBy(StateProjectNotice::getProjectId));
    }
 
 
}