|
@@ -0,0 +1,133 @@
|
|
|
|
+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;
|
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import com.google.common.collect.Lists;
|
|
|
|
+import com.jeeplus.core.query.QueryWrapperGenerator;
|
|
|
|
+import com.jeeplus.sys.domain.User;
|
|
|
|
+import com.jeeplus.sys.service.dto.UserDTO;
|
|
|
|
+import com.jeeplus.sys.utils.StringUtils;
|
|
|
|
+import com.jeeplus.sys.utils.UserUtils;
|
|
|
|
+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.KlgBaseReply;
|
|
|
|
+import com.jeeplus.test.klgBase.question.mapper.KlgBaseDisposeMapper;
|
|
|
|
+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> {
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private KlgBaseQuestionsMapper klgBaseQuestionsMapper;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private KlgBaseDisposeMapper klgBaseDisposeMapper;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private KlgBaseReplyMapper klgBaseReplyMapper;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private OssService ossService;
|
|
|
|
+
|
|
|
|
+ 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");
|
|
|
|
+ queryWrapper.orderByDesc("kbq.create_date");
|
|
|
|
+ return klgBaseQuestionsMapper.findList(page,queryWrapper);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public KlgBaseQuestionsDTO queryById(String id) {
|
|
|
|
+
|
|
|
|
+ KlgBaseQuestionsDTO klgBaseQuestionsDTO = klgBaseQuestionsMapper.queryById(id);
|
|
|
|
+
|
|
|
|
+ return klgBaseQuestionsDTO;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public String saveForm(KlgBaseQuestionsDTO klgBaseQuestionsDTO) throws Exception{
|
|
|
|
+ KlgBaseQuestions klgBaseQuestions = KlgBaseQuestionsWrapper.INSTANCE.toEntity(klgBaseQuestionsDTO);
|
|
|
|
+ this.saveOrUpdate(klgBaseQuestions);
|
|
|
|
+ if (ObjectUtil.isNotEmpty(klgBaseQuestionsDTO)) {
|
|
|
|
+ //附件
|
|
|
|
+ ossService.saveOrUpdateFileList(klgBaseQuestionsDTO.getWorkAttachmentDtoList(),klgBaseQuestions.getId(),"klg_question");
|
|
|
|
+ //处理人
|
|
|
|
+ if(CollectionUtil.isNotEmpty(klgBaseQuestionsDTO.getKlgBaseDisposeDTOList())){
|
|
|
|
+ klgBaseDisposeMapper.delete(new QueryWrapper<KlgBaseDispose>().lambda().eq(KlgBaseDispose::getQuestionId,klgBaseQuestions.getId()));
|
|
|
|
+ klgBaseQuestionsDTO.getKlgBaseDisposeDTOList().stream().forEach(item->{
|
|
|
|
+ KlgBaseDispose klgBaseDispose = KlgBaseDisposeWrapper.INSTANCE.toEntity(item);
|
|
|
|
+ klgBaseDisposeMapper.insert(klgBaseDispose);
|
|
|
|
+ });
|
|
|
|
+ }else{
|
|
|
|
+ klgBaseDisposeMapper.delete(new QueryWrapper<KlgBaseDispose>().lambda().eq(KlgBaseDispose::getQuestionId,klgBaseQuestions.getId()));
|
|
|
|
+ }
|
|
|
|
+ //回复
|
|
|
|
+ if(CollectionUtil.isNotEmpty(klgBaseQuestionsDTO.getKlgBaseReplyDTOList())){
|
|
|
|
+ String maxSortByQues = klgBaseQuestionsMapper.getMaxSortByQues(klgBaseQuestions.getId());
|
|
|
|
+ klgBaseQuestionsDTO.getKlgBaseReplyDTOList().stream().forEach((item)->{
|
|
|
|
+ KlgBaseReply klgBaseReply = KlgBaseReplyWrapper.INSTANCE.toEntity(item);
|
|
|
|
+ if (StringUtils.isNotBlank(klgBaseReply.getId())) {
|
|
|
|
+ klgBaseReplyMapper.updateById(klgBaseReply);
|
|
|
|
+ } else {
|
|
|
|
+ if(StringUtils.isNotBlank(maxSortByQues)) {
|
|
|
|
+ int i = Integer.parseInt(maxSortByQues);
|
|
|
|
+ klgBaseReply.setSort(String.valueOf(i+1));
|
|
|
|
+ }else{
|
|
|
|
+ klgBaseReply.setSort("0");
|
|
|
|
+ }
|
|
|
|
+ klgBaseReplyMapper.insert(klgBaseReply);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return klgBaseQuestions.getId();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public ResponseEntity saveQuestion(KlgBaseQuestionsDTO klgBaseQuestionsDTO) throws Exception{
|
|
|
|
+ this.saveForm(klgBaseQuestionsDTO);
|
|
|
|
+ return ResponseEntity.ok("保存成功");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public ResponseEntity deleteByIds(String ids) {
|
|
|
|
+ String idArray[] =ids.split(",");
|
|
|
|
+ this.removeByIds (Lists.newArrayList (idArray));
|
|
|
|
+ return ResponseEntity.ok ("删除成功");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public String updateStatusById(KlgBaseQuestionsDTO klgBaseQuestionsDTO) {
|
|
|
|
+ KlgBaseQuestions klgBaseQuestions = KlgBaseQuestionsWrapper.INSTANCE.toEntity(klgBaseQuestionsDTO);
|
|
|
|
+ klgBaseQuestionsMapper.update(klgBaseQuestions, new QueryWrapper<KlgBaseQuestions>().lambda().eq(KlgBaseQuestions::getId, klgBaseQuestions.getId()));
|
|
|
|
+ return "操作成功";
|
|
|
|
+ }
|
|
|
|
+}
|