未符合项-表头排序
This commit is contained in:
+85
@@ -10,6 +10,7 @@ import io.swagger.annotations.Api;
|
|||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -184,10 +185,94 @@ public class NcrTrackController {
|
|||||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||||
HttpServletRequest req) {
|
HttpServletRequest req) {
|
||||||
List<NcrTrackVO> pageInfo = iNcrTrackService.getPageInfo(ncrTrackVO);
|
List<NcrTrackVO> pageInfo = iNcrTrackService.getPageInfo(ncrTrackVO);
|
||||||
|
String orderBy = ncrTrackVO.getOrderBy();
|
||||||
|
String orderByField = ncrTrackVO.getOrderByField();
|
||||||
|
//表头排序
|
||||||
|
hearSort(ncrTrackVO, pageInfo, orderBy, orderByField);
|
||||||
|
|
||||||
Page pages = iNcrTrackService.getPages(pageNo, pageSize, pageInfo);
|
Page pages = iNcrTrackService.getPages(pageNo, pageSize, pageInfo);
|
||||||
return Result.OK(pages);
|
return Result.OK(pages);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void hearSort(NcrTrackVO ncrTrackVO, List<NcrTrackVO> pageInfo, String orderBy, String orderByField) {
|
||||||
|
if(StringUtils.isNotBlank(orderByField)) {
|
||||||
|
Collator comparator = Collator.getInstance(Locale.CHINESE);
|
||||||
|
//编号 serialNumber
|
||||||
|
if ("serialNumber".equals(orderByField)) {
|
||||||
|
if (OrderEnum.POSITIVE.getValue().equals(orderBy)) {
|
||||||
|
Collections.sort(pageInfo, (e1, e2) -> {
|
||||||
|
return comparator.compare(e1.getSerialNumber(), e2.getSerialNumber());
|
||||||
|
});
|
||||||
|
} else if (OrderEnum.REVERSE.getValue().equals(orderBy)) {
|
||||||
|
Collections.sort(pageInfo, (e1, e2) -> {
|
||||||
|
return comparator.compare(e2.getSerialNumber(), e1.getSerialNumber());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//流程类型 flowType
|
||||||
|
if ("flowType".equals(orderByField)) {
|
||||||
|
if (OrderEnum.POSITIVE.getValue().equals(orderBy)) {
|
||||||
|
Collections.sort(pageInfo, (e1, e2) -> {
|
||||||
|
return comparator.compare(e1.getFlowType(), e2.getFlowType());
|
||||||
|
});
|
||||||
|
} else if (OrderEnum.REVERSE.getValue().equals(orderBy)) {
|
||||||
|
Collections.sort(pageInfo, (e1, e2) -> {
|
||||||
|
return comparator.compare(e2.getFlowType(), e1.getFlowType());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//责任领域 dutyTerritory
|
||||||
|
if ("dutyTerritory".equals(orderByField)) {
|
||||||
|
if (OrderEnum.POSITIVE.getValue().equals(orderBy)) {
|
||||||
|
Collections.sort(pageInfo, (e1, e2) -> {
|
||||||
|
return comparator.compare(e1.getDutyTerritory(), e2.getDutyTerritory());
|
||||||
|
});
|
||||||
|
} else if (OrderEnum.REVERSE.getValue().equals(orderBy)) {
|
||||||
|
Collections.sort(pageInfo, (e1, e2) -> {
|
||||||
|
return comparator.compare(e2.getDutyTerritory(), e1.getDutyTerritory());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//问题类型 problemType
|
||||||
|
if ("problemType".equals(orderByField)) {
|
||||||
|
if (OrderEnum.POSITIVE.getValue().equals(orderBy)) {
|
||||||
|
Collections.sort(pageInfo, (e1, e2) -> {
|
||||||
|
return comparator.compare(e1.getProblemType(), e2.getProblemType());
|
||||||
|
});
|
||||||
|
} else if (OrderEnum.REVERSE.getValue().equals(orderBy)) {
|
||||||
|
Collections.sort(pageInfo, (e1, e2) -> {
|
||||||
|
return comparator.compare(e2.getProblemType(), e1.getProblemType());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//发起人 initiator
|
||||||
|
if ("initiator".equals(orderByField)) {
|
||||||
|
if (OrderEnum.POSITIVE.getValue().equals(orderBy)) {
|
||||||
|
Collections.sort(pageInfo, (e1, e2) -> {
|
||||||
|
return comparator.compare(e1.getInitiator(), e2.getInitiator());
|
||||||
|
});
|
||||||
|
} else if (OrderEnum.REVERSE.getValue().equals(orderBy)) {
|
||||||
|
Collections.sort(pageInfo, (e1, e2) -> {
|
||||||
|
return comparator.compare(e2.getInitiator(), e1.getInitiator());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//责任人 duty
|
||||||
|
if ("duty".equals(orderByField)) {
|
||||||
|
if (OrderEnum.POSITIVE.getValue().equals(orderBy)) {
|
||||||
|
Collections.sort(pageInfo, (e1, e2) -> {
|
||||||
|
return comparator.compare(e1.getDuty(), e2.getDuty());
|
||||||
|
});
|
||||||
|
} else if (OrderEnum.REVERSE.getValue().equals(orderBy)) {
|
||||||
|
Collections.sort(pageInfo, (e1, e2) -> {
|
||||||
|
return comparator.compare(e2.getDuty(), e1.getDuty());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出数据
|
* 导出数据
|
||||||
* @param request
|
* @param request
|
||||||
|
|||||||
+4
@@ -138,6 +138,8 @@ public class NcrTrackServiceImpl extends ServiceImpl<NcrTrackMapper, NcrTrackVO>
|
|||||||
if(StringUtils.isNotBlank(trackVO.getDutyTerritory())){
|
if(StringUtils.isNotBlank(trackVO.getDutyTerritory())){
|
||||||
String dutyTerritory = pull(dictItemList, trackVO.getDutyTerritory(), "duty_territory", ncrTrackVO.getCut());
|
String dutyTerritory = pull(dictItemList, trackVO.getDutyTerritory(), "duty_territory", ncrTrackVO.getCut());
|
||||||
trackVO.setDutyTerritory(dutyTerritory);
|
trackVO.setDutyTerritory(dutyTerritory);
|
||||||
|
}else{
|
||||||
|
trackVO.setDutyTerritory("");
|
||||||
}
|
}
|
||||||
//设计符合性确认
|
//设计符合性确认
|
||||||
String designPId = trackVO.getDesignPId();//流程实例id
|
String designPId = trackVO.getDesignPId();//流程实例id
|
||||||
@@ -391,6 +393,8 @@ public class NcrTrackServiceImpl extends ServiceImpl<NcrTrackMapper, NcrTrackVO>
|
|||||||
ncrTrackVO.setTitle(title);//标题
|
ncrTrackVO.setTitle(title);//标题
|
||||||
if(StringUtils.isNotBlank(flowType)){
|
if(StringUtils.isNotBlank(flowType)){
|
||||||
ncrTrackVO.setFlowType(name);//流程类型
|
ncrTrackVO.setFlowType(name);//流程类型
|
||||||
|
}else{
|
||||||
|
ncrTrackVO.setFlowType("");//流程类型
|
||||||
}
|
}
|
||||||
ncrTrackVO.setDutyTerritory(dutyTerritory);//责任领域
|
ncrTrackVO.setDutyTerritory(dutyTerritory);//责任领域
|
||||||
ncrTrackVO.setProjectName(projectName);//相关项目
|
ncrTrackVO.setProjectName(projectName);//相关项目
|
||||||
|
|||||||
Reference in New Issue
Block a user