| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.YwProblemMapper; |
| | | import com.doumee.dao.business.model.YwProblem; |
| | | import com.doumee.dao.system.MultifileMapper; |
| | | import com.doumee.dao.system.model.Multifile; |
| | | import com.doumee.service.business.YwProblemService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 运维问题上报信息表Service实现 |
| | |
| | | @Autowired |
| | | private YwProblemMapper ywProblemMapper; |
| | | |
| | | @Autowired |
| | | private MultifileMapper multifileMapper; |
| | | |
| | | @Override |
| | | public Integer create(YwProblem ywProblem) { |
| | | if(Objects.isNull(ywProblem) |
| | | || Objects.isNull(ywProblem.getSubmitDate()) |
| | | || StringUtils.isBlank(ywProblem.getContent()) |
| | | || StringUtils.isBlank(ywProblem.getPhone()) |
| | | || StringUtils.isBlank(ywProblem.getName()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | ywProblem.setCreateDate(new Date()); |
| | | ywProblem.setIsdeleted(Constants.ZERO); |
| | | ywProblem.setStatus(Constants.ZERO); |
| | | ywProblem.setDealStatus(Constants.ZERO); |
| | | ywProblemMapper.insert(ywProblem); |
| | | |
| | | List<Multifile> fileList = new ArrayList<>(); |
| | | if(ywProblem.getFileList()!=null && ywProblem.getFileList().size()>0){ |
| | | for (int i = 0; i < ywProblem.getFileList().size(); i++) { |
| | | Multifile multifile = ywProblem.getFileList().get(i); |
| | | if(StringUtils.isBlank(multifile.getFileurl())){ |
| | | continue; |
| | | } |
| | | multifile.setCreateDate(ywProblem.getCreateDate()); |
| | | multifile.setIsdeleted(Constants.ZERO); |
| | | multifile.setObjId(ywProblem.getId()); |
| | | multifile.setObjType(Constants.MultiFile.PROBLEM_FILE.getKey()); |
| | | multifile.setSortnum(i+1); |
| | | fileList.add(multifile); |
| | | } |
| | | } |
| | | if(fileList.size()>0){ |
| | | multifileMapper.insert(fileList); |
| | | } |
| | | |
| | | return ywProblem.getId(); |
| | | } |
| | | |
| | |
| | | } |
| | | if (pageWrap.getModel().getContent() != null) { |
| | | queryWrapper.lambda().eq(YwProblem::getContent, pageWrap.getModel().getContent()); |
| | | } |
| | | if (pageWrap.getModel().getName() != null) { |
| | | queryWrapper.lambda().ge(YwProblem::getName, Utils.Date.getStart(pageWrap.getModel().getName())); |
| | | queryWrapper.lambda().le(YwProblem::getName, Utils.Date.getEnd(pageWrap.getModel().getName())); |
| | | } |
| | | if (pageWrap.getModel().getPhone() != null) { |
| | | queryWrapper.lambda().eq(YwProblem::getPhone, pageWrap.getModel().getPhone()); |