|
@@ -2,7 +2,6 @@ package com.jeeplus.test.klgBase.question.service;
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -15,42 +14,27 @@ import com.jeeplus.sys.service.dto.UserDTO;
|
|
|
import com.jeeplus.sys.utils.StringUtils;
|
|
|
import com.jeeplus.sys.utils.UserUtils;
|
|
|
import com.jeeplus.test.editor.domain.EditorFiles;
|
|
|
-import com.jeeplus.test.editor.mapper.EditorFilesMapper;
|
|
|
import com.jeeplus.test.editor.service.EditorFilesService;
|
|
|
import com.jeeplus.test.editor.service.dto.EditorFilesDTO;
|
|
|
-import com.jeeplus.test.finance.invoice.domain.*;
|
|
|
-import com.jeeplus.test.finance.invoice.service.dto.FinanceInvoiceBaseDTO;
|
|
|
-import com.jeeplus.test.finance.invoice.service.dto.FinanceInvoiceDTO;
|
|
|
-import com.jeeplus.test.finance.invoice.service.dto.FinanceInvoiceDetailDTO;
|
|
|
-import com.jeeplus.test.finance.invoice.service.dto.FinanceInvoiceReceivablesDTO;
|
|
|
-import com.jeeplus.test.finance.invoice.service.mapstruct.*;
|
|
|
import com.jeeplus.test.klgBase.question.domain.KlgBaseDispose;
|
|
|
import com.jeeplus.test.klgBase.question.domain.KlgBaseQuestions;
|
|
|
+import com.jeeplus.test.klgBase.question.domain.KlgBaseQuestionsFocus;
|
|
|
import com.jeeplus.test.klgBase.question.domain.KlgBaseReply;
|
|
|
import com.jeeplus.test.klgBase.question.mapper.KlgBaseDisposeMapper;
|
|
|
+import com.jeeplus.test.klgBase.question.mapper.KlgBaseQuestionsFocusMapper;
|
|
|
import com.jeeplus.test.klgBase.question.mapper.KlgBaseQuestionsMapper;
|
|
|
import com.jeeplus.test.klgBase.question.mapper.KlgBaseReplyMapper;
|
|
|
import com.jeeplus.test.klgBase.question.service.dto.KlgBaseQuestionsDTO;
|
|
|
import com.jeeplus.test.klgBase.question.service.mapstruct.KlgBaseDisposeWrapper;
|
|
|
import com.jeeplus.test.klgBase.question.service.mapstruct.KlgBaseQuestionsWrapper;
|
|
|
import com.jeeplus.test.klgBase.question.service.mapstruct.KlgBaseReplyWrapper;
|
|
|
-import com.jeeplus.test.oss.domain.WorkAttachment;
|
|
|
import com.jeeplus.test.oss.service.OssService;
|
|
|
-import com.jeeplus.test.program.configuration.projectList.domain.ProgramAuditAssessPeople;
|
|
|
-import com.jeeplus.test.program.configuration.projectList.service.mapstruct.ProgramAuditAssessPeopleWrapper;
|
|
|
-import com.jeeplus.test.workContract.service.dto.WorkAttachmentDto;
|
|
|
-import org.flowable.editor.language.json.converter.util.CollectionUtils;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.math.BigDecimal;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
-import java.util.concurrent.atomic.AtomicInteger;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
@Service
|
|
|
@Transactional
|
|
|
public class KlgBaseQuestionsService extends ServiceImpl<KlgBaseQuestionsMapper, KlgBaseQuestions> {
|
|
@@ -73,6 +57,9 @@ public class KlgBaseQuestionsService extends ServiceImpl<KlgBaseQuestionsMapper,
|
|
|
@Resource
|
|
|
private EditorFilesService editorFilesService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private KlgBaseQuestionsFocusMapper klgBaseQuestionsFocusMapper;
|
|
|
+
|
|
|
public IPage<KlgBaseQuestionsDTO> findList(Page<KlgBaseQuestionsDTO> page, KlgBaseQuestionsDTO klgBaseQuestionsDTO) throws Exception{
|
|
|
QueryWrapper<KlgBaseQuestions> queryWrapper = QueryWrapperGenerator.buildQueryCondition ( KlgBaseQuestionsWrapper.INSTANCE.toEntity(klgBaseQuestionsDTO), KlgBaseQuestions.class );
|
|
|
queryWrapper.eq("kbq.del_flag","0");
|
|
@@ -86,6 +73,11 @@ public class KlgBaseQuestionsService extends ServiceImpl<KlgBaseQuestionsMapper,
|
|
|
queryWrapper.eq("kbq.status","2").or().eq("kbq.status","5");
|
|
|
}
|
|
|
}
|
|
|
+ if (ObjectUtil.isNotEmpty(klgBaseQuestionsDTO.getCreateBy())){
|
|
|
+ if(StringUtils.isNotBlank(klgBaseQuestionsDTO.getCreateBy().getId())){
|
|
|
+ queryWrapper.eq("kbq.create_by",klgBaseQuestionsDTO.getCreateBy().getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
IPage<KlgBaseQuestionsDTO> list = klgBaseQuestionsMapper.findList(page, queryWrapper);
|
|
|
list.getRecords().stream().forEach(item->{
|
|
@@ -106,6 +98,45 @@ public class KlgBaseQuestionsService extends ServiceImpl<KlgBaseQuestionsMapper,
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+ public IPage<KlgBaseQuestionsDTO> findListFocus(Page<KlgBaseQuestionsDTO> page, KlgBaseQuestionsDTO klgBaseQuestionsDTO) throws Exception{
|
|
|
+ QueryWrapper<KlgBaseQuestions> queryWrapper = QueryWrapperGenerator.buildQueryCondition ( KlgBaseQuestionsWrapper.INSTANCE.toEntity(klgBaseQuestionsDTO), KlgBaseQuestions.class );
|
|
|
+ queryWrapper.eq("kbq.del_flag","0");
|
|
|
+ queryWrapper.orderByDesc("kbq.create_date");
|
|
|
+ if (ObjectUtil.isNotEmpty(klgBaseQuestionsDTO)){
|
|
|
+ if(ObjectUtil.isNotEmpty(klgBaseQuestionsDTO.getCreateDateBegin())&&ObjectUtil.isNotEmpty(klgBaseQuestionsDTO.getCreateDateEnd())){
|
|
|
+ queryWrapper.between("kbq.create_date",klgBaseQuestionsDTO.getCreateDateBegin(),klgBaseQuestionsDTO.getCreateDateEnd());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(klgBaseQuestionsDTO.getStatus())) {
|
|
|
+ if ("2".equals(klgBaseQuestionsDTO.getStatus())){
|
|
|
+ queryWrapper.eq("kbq.status","2").or().eq("kbq.status","5");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isNotEmpty(klgBaseQuestionsDTO.getCreateBy())){
|
|
|
+ if(StringUtils.isNotBlank(klgBaseQuestionsDTO.getCreateBy().getId())){
|
|
|
+ queryWrapper.eq("kbq.create_by",klgBaseQuestionsDTO.getCreateBy().getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ queryWrapper.eq("kbqf.user_id",UserUtils.getCurrentUserDTO().getId());
|
|
|
+ }
|
|
|
+ IPage<KlgBaseQuestionsDTO> list = klgBaseQuestionsMapper.findListFocus(page, queryWrapper);
|
|
|
+ list.getRecords().stream().forEach(item->{
|
|
|
+ if(StringUtils.isNotBlank(item.getDisposeBy())) {
|
|
|
+ String disposeByName = new String();
|
|
|
+ String[] split = item.getDisposeBy().split(",");
|
|
|
+ for (int i = 0; i < split.length; i++) {
|
|
|
+ User user = userMapper.selectById(split[i]);
|
|
|
+ if (i != split.length-1) {
|
|
|
+ disposeByName = disposeByName + user.getName() + ",";
|
|
|
+ } else {
|
|
|
+ disposeByName = disposeByName + user.getName();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ item.setDisposeByName(disposeByName);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
public KlgBaseQuestionsDTO queryById(String id) {
|
|
|
|
|
|
KlgBaseQuestionsDTO klgBaseQuestionsDTO = klgBaseQuestionsMapper.queryById(id);
|
|
@@ -215,4 +246,21 @@ public class KlgBaseQuestionsService extends ServiceImpl<KlgBaseQuestionsMapper,
|
|
|
klgBaseQuestionsMapper.update(klgBaseQuestions, new QueryWrapper<KlgBaseQuestions>().lambda().eq(KlgBaseQuestions::getId, klgBaseQuestions.getId()));
|
|
|
return "操作成功";
|
|
|
}
|
|
|
+
|
|
|
+ public ResponseEntity focusByIds(String idList) {
|
|
|
+ String ids[] =idList.split(",");
|
|
|
+ UserDTO currentUserDTO = UserUtils.getCurrentUserDTO();
|
|
|
+ for (String id : ids) {
|
|
|
+ List<KlgBaseQuestionsFocus> klgBaseQuestionsFoci = klgBaseQuestionsFocusMapper.selectList(new QueryWrapper<KlgBaseQuestionsFocus>().lambda()
|
|
|
+ .eq(KlgBaseQuestionsFocus::getUserId, currentUserDTO.getId())
|
|
|
+ .eq(KlgBaseQuestionsFocus::getQuestionId, id));
|
|
|
+ if(CollectionUtil.isEmpty(klgBaseQuestionsFoci)){
|
|
|
+ KlgBaseQuestionsFocus klgBaseQuestionsFocus = new KlgBaseQuestionsFocus();
|
|
|
+ klgBaseQuestionsFocus.setQuestionId(id);
|
|
|
+ klgBaseQuestionsFocus.setUserId(currentUserDTO.getId());
|
|
|
+ klgBaseQuestionsFocusMapper.insert(klgBaseQuestionsFocus);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ResponseEntity.ok ("关注成功");
|
|
|
+ }
|
|
|
}
|