市场法规清单导出重复数据合并
This commit is contained in:
+46
-1
@@ -1360,7 +1360,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ModelAndView exportExcelByClause(Map<String, Object> parameterMap) {
|
private ModelAndView exportExcelByClause(Map<String, Object> parameterMap) {
|
||||||
List<LawsHomeAdvancedSearchClauseVO> advancedSearchClause = getAdvancedSearchClause(parameterMap);
|
List<LawsHomeAdvancedSearchClauseVO> advancedSearchClause = getAdvancedSearchClauseExport(parameterMap);
|
||||||
List<Map<String, Object>> list = new ArrayList<>();
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
|
||||||
// 标准sheet页
|
// 标准sheet页
|
||||||
@@ -1586,6 +1586,51 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
|||||||
return lawsHomeAdvancedSearchClauseVOList;
|
return lawsHomeAdvancedSearchClauseVOList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<LawsHomeAdvancedSearchClauseVO> getAdvancedSearchClauseExport(Map<String, Object> parameterMap) {
|
||||||
|
List<LawsHomeAdvancedSearchClauseVO> lawsHomeAdvancedSearchClauseVOList = new ArrayList<>();
|
||||||
|
List<Map<String, Object>> data = documentSplitService.queryDocumentSplitDetailByHomeListExport(parameterMap);
|
||||||
|
// 过滤已发布数据
|
||||||
|
List<String> infoIdList = data.stream().map(v -> String.valueOf(v.get("info_id")))
|
||||||
|
.distinct().collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(infoIdList)){
|
||||||
|
return lawsHomeAdvancedSearchClauseVOList;
|
||||||
|
}
|
||||||
|
List<SarFileSplitInfoEO> list = sarFileSplitInfoService.list(new LambdaQueryWrapper<SarFileSplitInfoEO>()
|
||||||
|
.in(SarFileSplitInfoEO::getId, infoIdList).isNull(SarFileSplitInfoEO::getPublishBeforeId));
|
||||||
|
List<String> idList = list.stream().map(v -> v.getId()).collect(Collectors.toList());
|
||||||
|
// 根据info_id分组
|
||||||
|
if (!data.isEmpty()){
|
||||||
|
Map<String, List<Map<String, Object>>> groupMap =
|
||||||
|
data.stream().collect(Collectors.groupingBy(v -> String.valueOf(v.get("info_id"))));
|
||||||
|
groupMap.forEach((k, v) -> {
|
||||||
|
if (!idList.contains(k)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 封装数据
|
||||||
|
SarFileSplitInfoEO sarFileSplitInfoEO = sarFileSplitInfoService.queryById(k);
|
||||||
|
if (!Objects.isNull(sarFileSplitInfoEO)){
|
||||||
|
LawsDomesticStandard lawsDomesticStandard =
|
||||||
|
lawsDomesticStandardService.getOne(new LambdaQueryWrapper<LawsDomesticStandard>()
|
||||||
|
.select(LawsDomesticStandard::getStandardNumber,
|
||||||
|
LawsDomesticStandard::getStandardName)
|
||||||
|
.eq(LawsDomesticStandard::getId, sarFileSplitInfoEO.getStandardId()));
|
||||||
|
if (!Objects.isNull(lawsDomesticStandard)){
|
||||||
|
LawsHomeAdvancedSearchClauseVO lawsHomeAdvancedSearchClauseVO =
|
||||||
|
new LawsHomeAdvancedSearchClauseVO();
|
||||||
|
lawsHomeAdvancedSearchClauseVO.setStandardId(sarFileSplitInfoEO.getStandardId());
|
||||||
|
lawsHomeAdvancedSearchClauseVO.setStandardNumber(lawsDomesticStandard.getStandardNumber());
|
||||||
|
lawsHomeAdvancedSearchClauseVO.setStandardName(lawsDomesticStandard.getStandardName());
|
||||||
|
lawsHomeAdvancedSearchClauseVO.setStandardNumberAndName(
|
||||||
|
lawsDomesticStandard.getStandardNumber() + " " + lawsDomesticStandard.getStandardName());
|
||||||
|
lawsHomeAdvancedSearchClauseVO.setClauseList(v);
|
||||||
|
lawsHomeAdvancedSearchClauseVOList.add(lawsHomeAdvancedSearchClauseVO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return lawsHomeAdvancedSearchClauseVOList;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean updateLawsDomesticStandardToEs(String resourceType, String ids,String opType) {
|
private boolean updateLawsDomesticStandardToEs(String resourceType, String ids,String opType) {
|
||||||
// 批量操作
|
// 批量操作
|
||||||
// 从第0个下标开始
|
// 从第0个下标开始
|
||||||
|
|||||||
+17
-17
@@ -101,28 +101,28 @@ public class LawsMarketStandardDetail implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 新生产车实施日期
|
* 新生产车实施日期
|
||||||
*/
|
*/
|
||||||
@Excel(name = "新生产车实施日期", width = 15)
|
@Excel(name = "新生产车实施日期", width = 15, mergeVertical = true, mergeRely = 1)
|
||||||
@ApiModelProperty(value = "新生产车实施日期")
|
@ApiModelProperty(value = "新生产车实施日期")
|
||||||
private String newProductImplDate;
|
private String newProductImplDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新认证车实施日期
|
* 新认证车实施日期
|
||||||
*/
|
*/
|
||||||
@Excel(name = "新认证车实施日期", width = 15)
|
@Excel(name = "新认证车实施日期", width = 15, mergeVertical = true, mergeRely = 1)
|
||||||
@ApiModelProperty(value = "新认证车实施日期")
|
@ApiModelProperty(value = "新认证车实施日期")
|
||||||
private String newAuthImplDate;
|
private String newAuthImplDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注册日期
|
* 注册日期
|
||||||
*/
|
*/
|
||||||
@Excel(name = "注册日期", width = 15)
|
@Excel(name = "注册日期", width = 15, mergeVertical = true, mergeRely = 1)
|
||||||
@ApiModelProperty(value = "注册日期")
|
@ApiModelProperty(value = "注册日期")
|
||||||
private String registrationDate;
|
private String registrationDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 国家
|
* 国家
|
||||||
*/
|
*/
|
||||||
@Excel(name = "适用国家/地区", width = 15,dicCode = "market_state")
|
@Excel(name = "适用国家/地区", width = 15,dicCode = "market_state", mergeVertical = true, mergeRely = 1)
|
||||||
@NotBlank(message = "适用国家/地区不能为空")
|
@NotBlank(message = "适用国家/地区不能为空")
|
||||||
@ApiModelProperty(value = "国家")
|
@ApiModelProperty(value = "国家")
|
||||||
@Dict(dicCode = "market_state")
|
@Dict(dicCode = "market_state")
|
||||||
@@ -131,7 +131,7 @@ public class LawsMarketStandardDetail implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 适用车型
|
* 适用车型
|
||||||
*/
|
*/
|
||||||
@Excel(name = "适用车型", width = 15, dicCode = "applicable_vehicle_type")
|
@Excel(name = "适用车型", width = 15, dicCode = "applicable_vehicle_type", mergeVertical = true, mergeRely = 1)
|
||||||
@Dict(dicCode = "applicable_vehicle_type")
|
@Dict(dicCode = "applicable_vehicle_type")
|
||||||
@ApiModelProperty(value = "适用车型")
|
@ApiModelProperty(value = "适用车型")
|
||||||
private String applicableVehicle;
|
private String applicableVehicle;
|
||||||
@@ -141,21 +141,21 @@ public class LawsMarketStandardDetail implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "认证对象")
|
@ApiModelProperty(value = "认证对象")
|
||||||
@Dict(dicCode = "authentication_object")
|
@Dict(dicCode = "authentication_object")
|
||||||
@Excel(name = "认证对象", width = 15, dicCode = "authentication_object")
|
@Excel(name = "认证对象", width = 15, dicCode = "authentication_object", mergeVertical = true, mergeRely = 1)
|
||||||
private String authenticationObject;
|
private String authenticationObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 认证交付物
|
* 认证交付物
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "认证交付物")
|
@ApiModelProperty(value = "认证交付物")
|
||||||
@Excel(name = "认证交付物", width = 15)
|
@Excel(name = "认证交付物", width = 15, mergeVertical = true, mergeRely = 1)
|
||||||
private String certifyTheDeliverables;
|
private String certifyTheDeliverables;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类型
|
* 类型
|
||||||
*/
|
*/
|
||||||
@Dict(dicCode = "type")
|
@Dict(dicCode = "type")
|
||||||
@Excel(name = "类型", width = 15, dicCode = "type")
|
@Excel(name = "类型", width = 15, dicCode = "type", mergeVertical = true, mergeRely = 1)
|
||||||
@ApiModelProperty(value = "类型")
|
@ApiModelProperty(value = "类型")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ public class LawsMarketStandardDetail implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@Dict(dicCode = "dynamic_type")
|
@Dict(dicCode = "dynamic_type")
|
||||||
@ApiModelProperty(value = "动力类型")
|
@ApiModelProperty(value = "动力类型")
|
||||||
@Excel(name = "动力类型", width = 15, dicCode = "dynamic_type")
|
@Excel(name = "动力类型", width = 15, dicCode = "dynamic_type", mergeVertical = true, mergeRely = 1)
|
||||||
private String dynamicType;
|
private String dynamicType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -173,7 +173,7 @@ public class LawsMarketStandardDetail implements Serializable {
|
|||||||
@Dict(dictTable = "sys_depart", dicCode = "id", dicText = "depart_name")
|
@Dict(dictTable = "sys_depart", dicCode = "id", dicText = "depart_name")
|
||||||
@ApiModelProperty(value = "主控部门")
|
@ApiModelProperty(value = "主控部门")
|
||||||
@NotBlank(message = "主控部门不能为空")
|
@NotBlank(message = "主控部门不能为空")
|
||||||
@Excel(name = "主控部门", width = 15,dictTable = "sys_depart", dicCode = "id", dicText = "depart_name")
|
@Excel(name = "主控部门", width = 15,dictTable = "sys_depart", dicCode = "id", dicText = "depart_name", mergeVertical = true, mergeRely = 1)
|
||||||
private String mainDept;
|
private String mainDept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -182,7 +182,7 @@ public class LawsMarketStandardDetail implements Serializable {
|
|||||||
@ApiModelProperty(value = "主控部门专业模块")
|
@ApiModelProperty(value = "主控部门专业模块")
|
||||||
@NotBlank(message = "主控部门专业模块不能为空")
|
@NotBlank(message = "主控部门专业模块不能为空")
|
||||||
@Dict(dicCode = "professional_module")
|
@Dict(dicCode = "professional_module")
|
||||||
@Excel(name = "主控部门专业模块", width = 15, dicCode = "professional_module")
|
@Excel(name = "主控部门专业模块", width = 15, dicCode = "professional_module", mergeVertical = true, mergeRely = 1)
|
||||||
private String mainDeptProfMode;
|
private String mainDeptProfMode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -190,14 +190,14 @@ public class LawsMarketStandardDetail implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@Dict(dictTable = "sys_depart", dicCode = "id", dicText = "depart_name")
|
@Dict(dictTable = "sys_depart", dicCode = "id", dicText = "depart_name")
|
||||||
@ApiModelProperty(value = "关联部门")
|
@ApiModelProperty(value = "关联部门")
|
||||||
@Excel(name = "关联部门", width = 15,dictTable = "sys_depart", dicCode = "id", dicText = "depart_name")
|
@Excel(name = "关联部门", width = 15,dictTable = "sys_depart", dicCode = "id", dicText = "depart_name", mergeVertical = true, mergeRely = 1)
|
||||||
private String associateDept;
|
private String associateDept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关联部门专业模块
|
* 关联部门专业模块
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "关联部门专业模块")
|
@ApiModelProperty(value = "关联部门专业模块")
|
||||||
@Excel(name = "关联部门专业模块", width = 15, dicCode = "professional_module")
|
@Excel(name = "关联部门专业模块", width = 15, dicCode = "professional_module", mergeVertical = true, mergeRely = 1)
|
||||||
@Dict(dicCode = "professional_module")
|
@Dict(dicCode = "professional_module")
|
||||||
private String associateDeptProfMode;
|
private String associateDeptProfMode;
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ public class LawsMarketStandardDetail implements Serializable {
|
|||||||
* 批量限制
|
* 批量限制
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "批量限制")
|
@ApiModelProperty(value = "批量限制")
|
||||||
@Excel(name = "批量限制", width = 15, dicCode = "batch_restriction")
|
@Excel(name = "批量限制", width = 15, dicCode = "batch_restriction", mergeVertical = true, mergeRely = 1)
|
||||||
@Dict(dicCode = "batch_restriction")
|
@Dict(dicCode = "batch_restriction")
|
||||||
private String batchLimit;
|
private String batchLimit;
|
||||||
|
|
||||||
@@ -214,7 +214,7 @@ public class LawsMarketStandardDetail implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@Dict(dicCode = "automatic_driving_level")
|
@Dict(dicCode = "automatic_driving_level")
|
||||||
@ApiModelProperty(value = "自动驾驶等级")
|
@ApiModelProperty(value = "自动驾驶等级")
|
||||||
@Excel(name = "自动驾驶等级", width = 15,dicCode = "automatic_driving_level")
|
@Excel(name = "自动驾驶等级", width = 15,dicCode = "automatic_driving_level", mergeVertical = true, mergeRely = 1)
|
||||||
private String autopilotLevel;
|
private String autopilotLevel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -222,13 +222,13 @@ public class LawsMarketStandardDetail implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@Dict(dicCode = "requirement_type")
|
@Dict(dicCode = "requirement_type")
|
||||||
@ApiModelProperty(value = "要求类型")
|
@ApiModelProperty(value = "要求类型")
|
||||||
@Excel(name = "要求类型", width = 15,dicCode = "requirement_type")
|
@Excel(name = "要求类型", width = 15,dicCode = "requirement_type", mergeVertical = true, mergeRely = 1)
|
||||||
private String requireType;
|
private String requireType;
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "备注")
|
@ApiModelProperty(value = "备注")
|
||||||
@Excel(name = "备注", width = 15)
|
@Excel(name = "备注", width = 15, mergeVertical = true, mergeRely = 1)
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+30
-3
@@ -39,6 +39,7 @@ import org.springframework.web.servlet.ModelAndView;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
@@ -310,11 +311,11 @@ public class LawsMarketStandardServiceImpl extends ServiceImpl<LawsMarketStandar
|
|||||||
LambdaQueryWrapper<LawsMarketStandardDetail> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<LawsMarketStandardDetail> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.in(LawsMarketStandardDetail::getManifestId, listIds);
|
wrapper.in(LawsMarketStandardDetail::getManifestId, listIds);
|
||||||
wrapper.orderByDesc(LawsMarketStandardDetail::getStandardNumber);
|
wrapper.orderByDesc(LawsMarketStandardDetail::getStandardNumber);
|
||||||
wrapper.orderByDesc(LawsMarketStandardDetail::getCreateTime);
|
|
||||||
listLawsMarketStandardDetail = lawsMarketStandardDetailService.list(wrapper);
|
listLawsMarketStandardDetail = lawsMarketStandardDetailService.list(wrapper);
|
||||||
}
|
}
|
||||||
listLawsMarketStandardDetail = listLawsMarketStandardDetail.stream()
|
if(!CollectionUtils.isEmpty(listLawsMarketStandardDetail)){
|
||||||
.sorted(Comparator.comparing(LawsMarketStandardDetail::getStandardNumber).reversed()).collect(Collectors.toList());
|
replaceNullFieldsWithOne(listLawsMarketStandardDetail);
|
||||||
|
}
|
||||||
|
|
||||||
// AutoPoi 导出Excel
|
// AutoPoi 导出Excel
|
||||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||||
@@ -329,6 +330,32 @@ public class LawsMarketStandardServiceImpl extends ServiceImpl<LawsMarketStandar
|
|||||||
return mv;
|
return mv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void replaceNullFieldsWithOne(List<LawsMarketStandardDetail> list) {
|
||||||
|
for (LawsMarketStandardDetail obj : list) {
|
||||||
|
Class<?> clazz = obj.getClass();
|
||||||
|
Field[] fields = clazz.getDeclaredFields();
|
||||||
|
// 遍历所有字段
|
||||||
|
for (Field field : fields) {
|
||||||
|
// 设置访问权限
|
||||||
|
field.setAccessible(true);
|
||||||
|
try {
|
||||||
|
Object fieldValue = field.get(obj);
|
||||||
|
// 检查字段值是否为 null 或空字符串
|
||||||
|
if (fieldValue == null || (fieldValue instanceof String && ((String) fieldValue).trim().isEmpty())) {
|
||||||
|
// 根据字段类型赋值
|
||||||
|
if (field.getType().equals(Integer.class) || field.getType().equals(int.class)) {
|
||||||
|
field.set(obj, 1);
|
||||||
|
} else if (field.getType().equals(String.class)) {
|
||||||
|
field.set(obj, "—");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result<?> deleteById(String id) {
|
public Result<?> deleteById(String id) {
|
||||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
|
|||||||
Reference in New Issue
Block a user