|
@@ -6,10 +6,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fdkankan.manage.common.PageInfo;
|
|
|
import com.fdkankan.manage.entity.Case;
|
|
|
+import com.fdkankan.manage.entity.FeedbackOption;
|
|
|
import com.fdkankan.manage.entity.SysUser;
|
|
|
import com.fdkankan.manage.mapper.ICaseMapper;
|
|
|
import com.fdkankan.manage.service.ICaseService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.fdkankan.manage.service.IFeedbackOptionService;
|
|
|
import com.fdkankan.manage.service.ISysUserService;
|
|
|
import com.fdkankan.manage.vo.request.CaseParam;
|
|
|
import com.fdkankan.manage.vo.response.CaseVo;
|
|
@@ -20,7 +22,9 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -36,6 +40,8 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, Case> implements I
|
|
|
|
|
|
@Autowired
|
|
|
ISysUserService sysUserService;
|
|
|
+ @Autowired
|
|
|
+ IFeedbackOptionService feedbackOptionService;
|
|
|
|
|
|
@Override
|
|
|
public Object pageList(CaseParam param) {
|
|
@@ -60,6 +66,14 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, Case> implements I
|
|
|
Page<Case> page = this.page(new Page<>(param.getPageNum(), param.getPageSize()), wrapper);
|
|
|
|
|
|
List<CaseVo> voList = new ArrayList<>();
|
|
|
+ List<JSONArray> arrayList = page.getRecords().stream().map(Case::getFeedbackOptionIds).collect(Collectors.toList());
|
|
|
+ HashSet<Integer> optionIds = new HashSet<>();
|
|
|
+ for (JSONArray jsonArray : arrayList) {
|
|
|
+ for (Object object : jsonArray) {
|
|
|
+ optionIds.add((Integer) object);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ HashMap<Integer, FeedbackOption> mapByIds = feedbackOptionService.getMapByIds(optionIds);
|
|
|
for (Case record : page.getRecords()) {
|
|
|
CaseVo vo = new CaseVo();
|
|
|
BeanUtils.copyProperties(record,vo);
|
|
@@ -67,6 +81,16 @@ public class CaseServiceImpl extends ServiceImpl<ICaseMapper, Case> implements I
|
|
|
if(sysuser != null){
|
|
|
vo.setSysUserName(sysuser.getNickName());
|
|
|
}
|
|
|
+ JSONArray feedbackOptionIds = record.getFeedbackOptionIds();
|
|
|
+ JSONArray newFeedIds = new JSONArray();
|
|
|
+ for (Object feedbackOptionId : feedbackOptionIds) {
|
|
|
+ FeedbackOption feedbackOption = mapByIds.get((Integer) feedbackOptionId);
|
|
|
+ if(feedbackOption !=null){
|
|
|
+ newFeedIds.add(feedbackOption.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ record.setFeedbackOptionIds(newFeedIds);
|
|
|
+
|
|
|
voList.add(vo);
|
|
|
}
|
|
|
|