renkang
2025-01-09 cdf974d19bab00ac22fe2896eb34b920d58d74a6
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
package com.doumee.service.business.impl;
 
import com.alibaba.druid.sql.visitor.functions.Concat;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.model.LoginUserInfo;
import com.doumee.core.model.LoginUserModel;
import com.doumee.core.utils.Constants;
import com.doumee.core.utils.DateUtil;
import com.doumee.dao.business.ApproveParamMapper;
import com.doumee.dao.business.PlatformLogMapper;
import com.doumee.dao.business.YwQuickModelMapper;
import com.doumee.dao.business.model.YwQuickModel;
import com.doumee.dao.business.vo.MonthDataResponse;
import com.doumee.service.business.WorkbenchesService;
import com.github.xiaoymin.knife4j.core.util.CollectionUtils;
import io.jsonwebtoken.lang.Objects;
import io.swagger.models.auth.In;
import org.apache.tomcat.util.bcel.classfile.Constant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
 
/**
 * 审批模版配置信息表Service实现
 * @author 江蹄蹄
 * @date 2023/12/28 11:46
 */
@Service
public class WorkbenchesServiceImpl implements WorkbenchesService {
 
 
    @Autowired
    private YwQuickModelMapper ywQuickModelMapper;
 
 
 
    @Override
    public List<YwQuickModel> getYwQuickList(LoginUserInfo loginUserInfo){
        List<YwQuickModel> ywQuickModelList = ywQuickModelMapper.selectList(new QueryWrapper<YwQuickModel>().lambda()
                .eq(YwQuickModel::getIsdeleted, Constants.ZERO)
                .eq(YwQuickModel::getUserId,loginUserInfo.getId())
                .orderByAsc(YwQuickModel::getSort)
        );
        if(CollectionUtils.isEmpty(ywQuickModelList)){
            ywQuickModelList = ywQuickModelMapper.selectList(new QueryWrapper<YwQuickModel>().lambda()
                    .eq(YwQuickModel::getIsdeleted, Constants.ZERO)
                    .isNull(YwQuickModel::getUserId)
                    .orderByAsc(YwQuickModel::getSort)
            );
        }
        return ywQuickModelList;
    }
 
 
    @Override
    public void updMyYwQuickModel(List<Integer> idList, LoginUserInfo loginUserInfo){
        List<YwQuickModel> ywQuickModelList = ywQuickModelMapper.selectList(new QueryWrapper<YwQuickModel>().lambda()
                .eq(YwQuickModel::getIsdeleted, Constants.ZERO)
                .isNull(YwQuickModel::getUserId)
                .orderByAsc(YwQuickModel::getSort)
        );
        if(CollectionUtils.isEmpty(ywQuickModelList) || Constants.equalsInteger(idList.size(),ywQuickModelList.size())){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"快捷模块配置异常,请联系管理员");
        }
        ywQuickModelMapper.delete(new QueryWrapper<YwQuickModel>().lambda().eq(YwQuickModel::getUserId,loginUserInfo.getId()));
        List<YwQuickModel> newList = new ArrayList<>();
        for (int i = 0; i < idList.size(); i++) {
            Integer id = idList.get(i);
            List<YwQuickModel> ywQuickModels = ywQuickModelList.stream().filter(j->Constants.equalsInteger(j.getId(),id)).collect(Collectors.toList());
            if(CollectionUtils.isEmpty(ywQuickModels)){
                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"快捷模块配置异常,请联系管理员");
            }
            YwQuickModel ywQuickModel = ywQuickModels.get(Constants.ZERO);
            ywQuickModel.setId(null);
            ywQuickModel.setCreator(loginUserInfo.getId());
            ywQuickModel.setCreateDate(new Date());
            ywQuickModel.setSort(i+1);
            ywQuickModel.setUserId(loginUserInfo.getId());
            newList.add(ywQuickModel);
        }
        ywQuickModelMapper.insert(newList);
    }
 
 
    @Override
    public List<MonthDataResponse> getMonthNotices(String yearMonth, LoginUserInfo loginUserInfo){
        List<String> dataList = DateUtil.getDayByMonth(yearMonth);
        List<MonthDataResponse> monthDataResponseList = new ArrayList<>();
        for (String str:dataList) {
            MonthDataResponse  monthDataResponse = new MonthDataResponse();
            monthDataResponse.setWeekMsg(DateUtil.getWeek(DateUtil.StringToDate(str,"yyyy-MM-dd")).getChineseName());
            monthDataResponse.setMonthDate(str);
 
            monthDataResponseList.add(monthDataResponse);
        }
        return monthDataResponseList;
 
    }
 
 
 
 
 
 
 
 
 
 
 
}