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;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|