修改参数多值排序问题
This commit is contained in:
+2
@@ -78,4 +78,6 @@ public interface IParamsConfigDataEOService extends IService<ParamsConfigDataEO>
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<ParamsConfigDataEO> queryListByConfigIdList(List<String> configIdList);
|
List<ParamsConfigDataEO> queryListByConfigIdList(List<String> configIdList);
|
||||||
|
|
||||||
|
void handleData();
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -30,5 +30,5 @@ public interface IParamsConfigDataHistoryEOService extends IService<ParamsConfig
|
|||||||
List<ParamsConfigDataHistoryEO> queryListByConfigIdList(List<String> configIdList);
|
List<ParamsConfigDataHistoryEO> queryListByConfigIdList(List<String> configIdList);
|
||||||
|
|
||||||
int deleteByParamsCollectManifestIdList(List<String> paramsCollectManifestIdList);
|
int deleteByParamsCollectManifestIdList(List<String> paramsCollectManifestIdList);
|
||||||
|
void handleData();
|
||||||
}
|
}
|
||||||
|
|||||||
+37
-2
@@ -11,8 +11,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Propagation;
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 参数配置数据
|
* @Description: 参数配置数据
|
||||||
@@ -138,4 +137,40 @@ public class ParamsConfigDataEOServiceImpl extends ServiceImpl<ParamsConfigDataE
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void handleData() {
|
||||||
|
List<ParamsConfigDataEO> list = this.list();
|
||||||
|
Map<String, List<ParamsConfigDataEO>> map = new HashMap<>();
|
||||||
|
for (ParamsConfigDataEO prcd : list) {
|
||||||
|
String pid = prcd.getParamsCollectManifestId()+"+"+prcd.getParamsConfigId();
|
||||||
|
List<ParamsConfigDataEO> dataList = null;
|
||||||
|
if(map.containsKey(pid)){
|
||||||
|
dataList = map.get(pid);
|
||||||
|
}else{
|
||||||
|
dataList = new ArrayList<>();
|
||||||
|
}
|
||||||
|
dataList.add(prcd);
|
||||||
|
map.put(pid,dataList);
|
||||||
|
}
|
||||||
|
List<ParamsConfigDataEO> updateList = new ArrayList<>();
|
||||||
|
for (List<ParamsConfigDataEO> dataList:map.values()) {
|
||||||
|
Collections.sort(dataList, new Comparator<ParamsConfigDataEO>() {
|
||||||
|
@Override
|
||||||
|
public int compare(ParamsConfigDataEO o1, ParamsConfigDataEO o2) {
|
||||||
|
return Integer.compare(o1.getOrderNum(), o2.getOrderNum());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
int num = 0;
|
||||||
|
for (ParamsConfigDataEO prcd:dataList) {
|
||||||
|
prcd.setOrderNum(num);
|
||||||
|
updateList.add(prcd);
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(CollectionUtil.isNotEmpty(updateList)){
|
||||||
|
this.updateBatchById(updateList);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+37
-1
@@ -10,7 +10,7 @@ import com.jero.modules.cert.collect.service.IParamsConfigDataHistoryEOService;
|
|||||||
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 java.util.List;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 参数配置数据历史版本
|
* @Description: 参数配置数据历史版本
|
||||||
@@ -62,4 +62,40 @@ public class ParamsConfigDataHistoryEOServiceImpl extends ServiceImpl<ParamsConf
|
|||||||
return paramsConfigDataHistoryEOMapper.delete(queryWrapper);
|
return paramsConfigDataHistoryEOMapper.delete(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void handleData() {
|
||||||
|
List<ParamsConfigDataHistoryEO> list = this.list();
|
||||||
|
Map<String, List<ParamsConfigDataHistoryEO>> map = new HashMap<>();
|
||||||
|
for (ParamsConfigDataHistoryEO prcd : list) {
|
||||||
|
String pid = prcd.getParamsCollectManifestId()+"+"+prcd.getParamsConfigId();
|
||||||
|
List<ParamsConfigDataHistoryEO> dataList = null;
|
||||||
|
if(map.containsKey(pid)){
|
||||||
|
dataList = map.get(pid);
|
||||||
|
}else{
|
||||||
|
dataList = new ArrayList<>();
|
||||||
|
}
|
||||||
|
dataList.add(prcd);
|
||||||
|
map.put(pid,dataList);
|
||||||
|
}
|
||||||
|
List<ParamsConfigDataHistoryEO> updateList = new ArrayList<>();
|
||||||
|
for (List<ParamsConfigDataHistoryEO> dataList:map.values()) {
|
||||||
|
Collections.sort(dataList, new Comparator<ParamsConfigDataHistoryEO>() {
|
||||||
|
@Override
|
||||||
|
public int compare(ParamsConfigDataHistoryEO o1, ParamsConfigDataHistoryEO o2) {
|
||||||
|
return Integer.compare(o1.getOrderNum(), o2.getOrderNum());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
int num = 0;
|
||||||
|
for (ParamsConfigDataHistoryEO prcd:dataList) {
|
||||||
|
prcd.setOrderNum(num);
|
||||||
|
updateList.add(prcd);
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(CollectionUtil.isNotEmpty(updateList)){
|
||||||
|
this.updateBatchById(updateList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+26
@@ -6,10 +6,13 @@ import com.jero.common.api.vo.Result;
|
|||||||
import com.jero.common.aspect.annotation.AutoLog;
|
import com.jero.common.aspect.annotation.AutoLog;
|
||||||
import com.jero.common.constant.enums.CutEnum;
|
import com.jero.common.constant.enums.CutEnum;
|
||||||
import com.jero.common.system.base.controller.JeroController;
|
import com.jero.common.system.base.controller.JeroController;
|
||||||
|
import com.jero.modules.cert.collect.service.IParamsConfigDataEOService;
|
||||||
|
import com.jero.modules.cert.collect.service.IParamsConfigDataHistoryEOService;
|
||||||
import com.jero.modules.cert.report.entity.ParamsReportConfigEO;
|
import com.jero.modules.cert.report.entity.ParamsReportConfigEO;
|
||||||
import com.jero.common.system.vo.DictModel;
|
import com.jero.common.system.vo.DictModel;
|
||||||
import com.jero.modules.cert.report.entity.ParamsReportEO;
|
import com.jero.modules.cert.report.entity.ParamsReportEO;
|
||||||
import com.jero.modules.cert.report.entity.ParamsReportExportHistoryEO;
|
import com.jero.modules.cert.report.entity.ParamsReportExportHistoryEO;
|
||||||
|
import com.jero.modules.cert.report.service.IParamsReportConfigDataEOService;
|
||||||
import com.jero.modules.cert.report.service.IParamsReportConfigEOService;
|
import com.jero.modules.cert.report.service.IParamsReportConfigEOService;
|
||||||
import com.jero.modules.cert.report.service.IParamsReportEOService;
|
import com.jero.modules.cert.report.service.IParamsReportEOService;
|
||||||
import com.jero.modules.cert.report.service.IParamsReportExportHistoryEOService;
|
import com.jero.modules.cert.report.service.IParamsReportExportHistoryEOService;
|
||||||
@@ -70,6 +73,18 @@ public class ParamsReportEOController extends JeroController<ParamsReportEO, IPa
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ISysDictService sysDictService;
|
private ISysDictService sysDictService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IParamsReportConfigDataEOService paramsReportConfigDataEOService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IParamsConfigDataEOService paramsConfigDataEOService;
|
||||||
|
@Autowired
|
||||||
|
private IParamsConfigDataHistoryEOService paramsConfigDataHistoryEOService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页列表查询
|
* 分页列表查询
|
||||||
*
|
*
|
||||||
@@ -402,4 +417,15 @@ public class ParamsReportEOController extends JeroController<ParamsReportEO, IPa
|
|||||||
}
|
}
|
||||||
return Result.OK(paramsReportConfigEO);
|
return Result.OK(paramsReportConfigEO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@AutoLog(value = "上报库配置-handleData")
|
||||||
|
@ApiOperation(value="上报库配置-handleData", notes="上报库配置-handleData")
|
||||||
|
@GetMapping(value = "/handleData")
|
||||||
|
public Result<?> handleData() {
|
||||||
|
paramsReportConfigDataEOService.handleData();
|
||||||
|
paramsConfigDataEOService.handleData();
|
||||||
|
paramsConfigDataHistoryEOService.handleData();
|
||||||
|
return Result.OK();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
@@ -42,4 +42,6 @@ public interface IParamsReportConfigDataEOService extends IService<ParamsReportC
|
|||||||
|
|
||||||
|
|
||||||
List<ParamsReportConfigDataEO> queryListByCollectManifestIdList(List<String> paramsCollectManifestIdList);
|
List<ParamsReportConfigDataEO> queryListByCollectManifestIdList(List<String> paramsCollectManifestIdList);
|
||||||
|
|
||||||
|
void handleData();
|
||||||
}
|
}
|
||||||
|
|||||||
+38
-1
@@ -8,7 +8,7 @@ import com.jero.modules.cert.report.mapper.ParamsReportConfigDataEOMapper;
|
|||||||
import com.jero.modules.cert.report.service.IParamsReportConfigDataEOService;
|
import com.jero.modules.cert.report.service.IParamsReportConfigDataEOService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 上报库参数配置数据
|
* @Description: 上报库参数配置数据
|
||||||
@@ -93,4 +93,41 @@ public class ParamsReportConfigDataEOServiceImpl extends ServiceImpl<ParamsRepor
|
|||||||
queryWrapper.orderByDesc(ParamsReportConfigDataEO::getOrderNum);
|
queryWrapper.orderByDesc(ParamsReportConfigDataEO::getOrderNum);
|
||||||
return this.list(queryWrapper);
|
return this.list(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void handleData() {
|
||||||
|
List<ParamsReportConfigDataEO> list = this.list();
|
||||||
|
Map<String, List<ParamsReportConfigDataEO>> map = new HashMap<>();
|
||||||
|
for (ParamsReportConfigDataEO prcd : list) {
|
||||||
|
String pid = prcd.getParamsCollectManifestId()+"+"+prcd.getParamsConfigId();
|
||||||
|
List<ParamsReportConfigDataEO> dataList = null;
|
||||||
|
if(map.containsKey(pid)){
|
||||||
|
dataList = map.get(pid);
|
||||||
|
}else{
|
||||||
|
dataList = new ArrayList<>();
|
||||||
|
}
|
||||||
|
dataList.add(prcd);
|
||||||
|
map.put(pid,dataList);
|
||||||
|
}
|
||||||
|
List<ParamsReportConfigDataEO> updateList = new ArrayList<>();
|
||||||
|
for (List<ParamsReportConfigDataEO> dataList:map.values()) {
|
||||||
|
Collections.sort(dataList, new Comparator<ParamsReportConfigDataEO>() {
|
||||||
|
@Override
|
||||||
|
public int compare(ParamsReportConfigDataEO o1, ParamsReportConfigDataEO o2) {
|
||||||
|
return Integer.compare(o1.getOrderNum(), o2.getOrderNum());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
int num = 0;
|
||||||
|
for (ParamsReportConfigDataEO prcd:dataList) {
|
||||||
|
prcd.setOrderNum(num);
|
||||||
|
updateList.add(prcd);
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(CollectionUtil.isNotEmpty(updateList)){
|
||||||
|
this.updateBatchById(updateList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user