fix(征求意见): 80202
This commit is contained in:
+44
@@ -0,0 +1,44 @@
|
|||||||
|
package com.jero.modules.laws.consultation.common;
|
||||||
|
|
||||||
|
import com.jero.modules.activiti.process.fb.entity.ProcessFbConsultationList;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName: DirectoryComparator
|
||||||
|
* @Description:
|
||||||
|
* @Author: yjz
|
||||||
|
* @Date: 2023-11-03 11:24
|
||||||
|
* @Version: 1.0
|
||||||
|
**/
|
||||||
|
public class DirectoryComparator implements Comparator<ProcessFbConsultationList> {
|
||||||
|
public int compare(ProcessFbConsultationList dir1, ProcessFbConsultationList dir2) {
|
||||||
|
String sortNumber1 = dir1.getChapterNumber();
|
||||||
|
String sortNumber2 = dir2.getChapterNumber();
|
||||||
|
|
||||||
|
String[] parts1 = sortNumber1.split("\\.");
|
||||||
|
String[] parts2 = sortNumber2.split("\\.");
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
while (i < parts1.length && i < parts2.length) {
|
||||||
|
int part1 = tryParseInt(parts1[i]);
|
||||||
|
int part2 = tryParseInt(parts2[i]);
|
||||||
|
|
||||||
|
if (part1 != part2) {
|
||||||
|
return part1 - part2;
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return parts1.length - parts2.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int tryParseInt(String str) {
|
||||||
|
try {
|
||||||
|
return Integer.parseInt(str);
|
||||||
|
} catch(NumberFormatException e) {
|
||||||
|
return str.hashCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+14
-4
@@ -10,6 +10,7 @@ import com.jero.modules.activiti.process.fb.entity.ProcessFbConsultationList;
|
|||||||
import com.jero.modules.activiti.process.fb.entity.ProcessFbStandardConsultation;
|
import com.jero.modules.activiti.process.fb.entity.ProcessFbStandardConsultation;
|
||||||
import com.jero.modules.activiti.process.fb.service.IProcessFbConsultationListService;
|
import com.jero.modules.activiti.process.fb.service.IProcessFbConsultationListService;
|
||||||
import com.jero.modules.activiti.process.fb.service.IProcessFbStandardConsultationService;
|
import com.jero.modules.activiti.process.fb.service.IProcessFbStandardConsultationService;
|
||||||
|
import com.jero.modules.laws.consultation.common.DirectoryComparator;
|
||||||
import com.jero.modules.laws.consultation.service.IConsultationService;
|
import com.jero.modules.laws.consultation.service.IConsultationService;
|
||||||
import com.jero.modules.laws.consultation.vo.ProcessFbConsultationListVO;
|
import com.jero.modules.laws.consultation.vo.ProcessFbConsultationListVO;
|
||||||
import com.jero.modules.laws.standard.entity.LawsDomesticStandard;
|
import com.jero.modules.laws.standard.entity.LawsDomesticStandard;
|
||||||
@@ -123,6 +124,7 @@ public class ConsultationServiceImpl implements IConsultationService {
|
|||||||
List<ProcessFbConsultationList> list = processFbConsultationListService.list(
|
List<ProcessFbConsultationList> list = processFbConsultationListService.list(
|
||||||
new LambdaQueryWrapper<ProcessFbConsultationList>()
|
new LambdaQueryWrapper<ProcessFbConsultationList>()
|
||||||
.eq(ProcessFbConsultationList::getBusinessId, businessId));
|
.eq(ProcessFbConsultationList::getBusinessId, businessId));
|
||||||
|
list.sort(new DirectoryComparator());
|
||||||
setProperty(list);
|
setProperty(list);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@@ -191,10 +193,18 @@ public class ConsultationServiceImpl implements IConsultationService {
|
|||||||
fillProperty(processFbStandardConsultations);
|
fillProperty(processFbStandardConsultations);
|
||||||
processFbConsultationListVO.setProcessFbStandardConsultation(processFbStandardConsultations.get(0));
|
processFbConsultationListVO.setProcessFbStandardConsultation(processFbStandardConsultations.get(0));
|
||||||
LambdaQueryWrapper<ProcessFbConsultationList> queryWrapper = new LambdaQueryWrapper<ProcessFbConsultationList>()
|
LambdaQueryWrapper<ProcessFbConsultationList> queryWrapper = new LambdaQueryWrapper<ProcessFbConsultationList>()
|
||||||
.eq(ProcessFbConsultationList::getBusinessId, businessId)
|
.eq(ProcessFbConsultationList::getBusinessId, businessId);
|
||||||
.last("ORDER BY convert(chapter_number, DECIMAL), id");
|
List<ProcessFbConsultationList> list = processFbConsultationListService.list(queryWrapper);
|
||||||
IPage<ProcessFbConsultationList> page = processFbConsultationListService.page(new Page<>(pageNo, pageSize), queryWrapper);
|
list.sort(new DirectoryComparator());
|
||||||
setProperty(page.getRecords());
|
// 手动分页
|
||||||
|
IPage<ProcessFbConsultationList> page = new Page<>(pageNo ,pageSize);
|
||||||
|
page.setTotal(list.size());
|
||||||
|
page.setRecords(
|
||||||
|
list.stream()
|
||||||
|
.skip((long) (Math.max(1, pageNo) - 1) * pageSize)
|
||||||
|
.limit(pageSize)
|
||||||
|
.collect(Collectors.toList()));
|
||||||
|
setProperty(list);
|
||||||
processFbConsultationListVO.setProcessFbConsultationList(page);
|
processFbConsultationListVO.setProcessFbConsultationList(page);
|
||||||
return processFbConsultationListVO;
|
return processFbConsultationListVO;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user