|
@@ -4,29 +4,23 @@ import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import com.hotent.baseInfo.model.CostCatalogSurvey;
|
|
|
|
|
-import com.hotent.baseInfo.model.CostCatalogSurvey;
|
|
|
|
|
|
|
+import com.hotent.base.manager.impl.BaseManagerImpl;
|
|
|
import com.hotent.baseInfo.dao.CostCatalogSurveyDao;
|
|
import com.hotent.baseInfo.dao.CostCatalogSurveyDao;
|
|
|
import com.hotent.baseInfo.manager.CostCatalogSurveyManager;
|
|
import com.hotent.baseInfo.manager.CostCatalogSurveyManager;
|
|
|
-import com.hotent.base.manager.impl.BaseManagerImpl;
|
|
|
|
|
|
|
+import com.hotent.baseInfo.model.CostCatalogSurvey;
|
|
|
import com.hotent.baseInfo.req.CostBaseInfoPageReq;
|
|
import com.hotent.baseInfo.req.CostBaseInfoPageReq;
|
|
|
import com.hotent.baseInfo.resp.CostCatalogSurveyPageResp;
|
|
import com.hotent.baseInfo.resp.CostCatalogSurveyPageResp;
|
|
|
-import com.hotent.baseInfo.resp.CostCatalogSurveyPageResp;
|
|
|
|
|
-import com.hotent.config.EipConfig;
|
|
|
|
|
import com.hotent.req.IdReq;
|
|
import com.hotent.req.IdReq;
|
|
|
import com.hotent.surveyinfo.manager.CostSurveyTemplateManager;
|
|
import com.hotent.surveyinfo.manager.CostSurveyTemplateManager;
|
|
|
|
|
+import com.hotent.surveyinfo.model.CostSurveyTemplate;
|
|
|
import com.hotent.uc.exception.BaseException;
|
|
import com.hotent.uc.exception.BaseException;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
|
|
-
|
|
|
|
|
-import com.hotent.base.util.BeanUtils;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -65,23 +59,29 @@ public class CostCatalogSurveyManagerImpl extends BaseManagerImpl<CostCatalogSur
|
|
|
}
|
|
}
|
|
|
LambdaQueryWrapper<CostCatalogSurvey> queryWrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<CostCatalogSurvey> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.eq(CostCatalogSurvey::getCatalogId, req.getCatalogId());
|
|
queryWrapper.eq(CostCatalogSurvey::getCatalogId, req.getCatalogId());
|
|
|
|
|
+ queryWrapper.orderByDesc(CostCatalogSurvey::getCreateTime);
|
|
|
|
|
|
|
|
IPage<CostCatalogSurvey> page = new Page<>(req.getPageNum(), req.getPageSize());
|
|
IPage<CostCatalogSurvey> page = new Page<>(req.getPageNum(), req.getPageSize());
|
|
|
IPage<CostCatalogSurvey> respPage = this.page(page, queryWrapper);
|
|
IPage<CostCatalogSurvey> respPage = this.page(page, queryWrapper);
|
|
|
- List<String> ids = respPage.getRecords().stream().map(CostCatalogSurvey::getSurveyId).collect(Collectors.toList());
|
|
|
|
|
- if(ObjectUtil.isEmpty(ids)){
|
|
|
|
|
|
|
+ List<CostCatalogSurvey> records = respPage.getRecords();
|
|
|
|
|
+ if(ObjectUtil.isEmpty(records)){
|
|
|
return new Page<>();
|
|
return new Page<>();
|
|
|
}
|
|
}
|
|
|
- List<CostCatalogSurveyPageResp> respList = costSurveyTemplateManager.listByIds(ids).stream().map(item -> {
|
|
|
|
|
|
|
+ List<CostCatalogSurveyPageResp> respList = new ArrayList<>();
|
|
|
|
|
+ records.forEach(it ->{
|
|
|
|
|
+ CostSurveyTemplate costSurveyTemplate = costSurveyTemplateManager.getById(it.getSurveyId());
|
|
|
CostCatalogSurveyPageResp CostCatalogSurveyPageResp = new CostCatalogSurveyPageResp();
|
|
CostCatalogSurveyPageResp CostCatalogSurveyPageResp = new CostCatalogSurveyPageResp();
|
|
|
- CostCatalogSurveyPageResp.setSurveyId(item.getSurveyTemplateId().toString());
|
|
|
|
|
- LocalDateTime createTime = item.getCreateTime();
|
|
|
|
|
- CostCatalogSurveyPageResp.setYear(String.valueOf(createTime.getYear()));
|
|
|
|
|
- CostCatalogSurveyPageResp.setStatus(item.getStatus());
|
|
|
|
|
- CostCatalogSurveyPageResp.setTemplateType(item.getTemplateType());
|
|
|
|
|
- CostCatalogSurveyPageResp.setSurveyTemplateName(item.getSurveyTemplateName());
|
|
|
|
|
- return CostCatalogSurveyPageResp;
|
|
|
|
|
- }).collect(Collectors.toList());
|
|
|
|
|
|
|
+ if (costSurveyTemplate != null) {
|
|
|
|
|
+ CostCatalogSurveyPageResp.setSurveyId(costSurveyTemplate.getSurveyTemplateId().toString());
|
|
|
|
|
+ LocalDateTime createTime = costSurveyTemplate.getCreateTime();
|
|
|
|
|
+ CostCatalogSurveyPageResp.setYear(String.valueOf(createTime.getYear()));
|
|
|
|
|
+ CostCatalogSurveyPageResp.setStatus(costSurveyTemplate.getStatus());
|
|
|
|
|
+ CostCatalogSurveyPageResp.setTemplateType(costSurveyTemplate.getTemplateType());
|
|
|
|
|
+ CostCatalogSurveyPageResp.setSurveyTemplateName(costSurveyTemplate.getSurveyTemplateName());
|
|
|
|
|
+ }
|
|
|
|
|
+ CostCatalogSurveyPageResp.setId(it.getId());
|
|
|
|
|
+ respList.add(CostCatalogSurveyPageResp);
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
IPage<CostCatalogSurveyPageResp> resp = new Page<>(req.getPageNum(), req.getPageSize(), respPage.getTotal());
|
|
IPage<CostCatalogSurveyPageResp> resp = new Page<>(req.getPageNum(), req.getPageSize(), respPage.getTotal());
|
|
|
resp.setRecords(respList);
|
|
resp.setRecords(respList);
|