一般检索修改

This commit is contained in:
梁琦涛
2023-11-16 17:43:15 +08:00
parent 0e721c3865
commit fe55c82048
4 changed files with 63 additions and 43 deletions
@@ -0,0 +1,47 @@
package com.jero.modules.docking.encrypt.controller;
import com.jero.modules.docking.utils.IntekeyUtils;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.io.OutputStream;
/**
* @author lqt
* @version 1.0
* @date 2023/11/7 15:22
*/
@Slf4j
@Api(tags = "加解密附件")
@RequestMapping("/encrypt")
@RestController
public class EncrygtController {
/**
* 下载附件
*
*/
@PostMapping(value = "/download")
public void view(MultipartFile file,String url, String appCode, String secretKey,String scope, HttpServletResponse response) {
try (InputStream inputStream = IntekeyUtils.DecryptFile(url, appCode, secretKey, scope, file);
OutputStream outputStream = response.getOutputStream()
) {
byte[] buf = new byte[1024];
int len;
while ((len = inputStream.read(buf)) > 0) {
outputStream.write(buf, 0, len);
}
response.flushBuffer();
}catch (Exception e){
log.error(e.getMessage());
response.setStatus(404);
e.printStackTrace();
}
}
}
@@ -1,4 +1,4 @@
package com.jero.modules.laws.common.util; package com.jero.modules.docking.utils;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -3,7 +3,6 @@ package com.jero.modules.laws.home.controller;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jero.common.api.vo.Result; import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog; import com.jero.common.aspect.annotation.AutoLog;
import com.jero.modules.laws.common.util.IntekeyUtils;
import com.jero.modules.laws.home.dto.LawsHomeNormalSearchDTO; import com.jero.modules.laws.home.dto.LawsHomeNormalSearchDTO;
import com.jero.modules.laws.home.service.ILawsHomeSearchService; import com.jero.modules.laws.home.service.ILawsHomeSearchService;
import com.jero.modules.laws.home.vo.LawsHomeNormalSearchStatisticsVO; import com.jero.modules.laws.home.vo.LawsHomeNormalSearchStatisticsVO;
@@ -11,13 +10,12 @@ import com.jero.modules.laws.home.vo.LawsHomeNormalSearchVO;
import io.swagger.annotations.Api; 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.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.io.OutputStream;
/** /**
* @author lqt * @author lqt
@@ -41,7 +39,6 @@ public class LawsHomeSearchController {
public Result<IPage<LawsHomeNormalSearchVO>> getNormalSearchTitlePage(LawsHomeNormalSearchDTO lawsHomeNormalSearchDTO, public Result<IPage<LawsHomeNormalSearchVO>> getNormalSearchTitlePage(LawsHomeNormalSearchDTO lawsHomeNormalSearchDTO,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
// todo 待开发
return Result.OK(lawsHomeSearchService.getNormalSearchTitlePage(lawsHomeNormalSearchDTO,pageNo,pageSize)); return Result.OK(lawsHomeSearchService.getNormalSearchTitlePage(lawsHomeNormalSearchDTO,pageNo,pageSize));
} }
@@ -49,7 +46,6 @@ public class LawsHomeSearchController {
@ApiOperation(value="首页-一般检索(标题)(数据统计)", notes="首页-一般检索(标题)(数据统计)") @ApiOperation(value="首页-一般检索(标题)(数据统计)", notes="首页-一般检索(标题)(数据统计)")
@GetMapping(value = "/getNormalSearchTitleCount") @GetMapping(value = "/getNormalSearchTitleCount")
public Result<LawsHomeNormalSearchStatisticsVO> getNormalSearchTitleCount(LawsHomeNormalSearchDTO lawsHomeNormalSearchDTO) { public Result<LawsHomeNormalSearchStatisticsVO> getNormalSearchTitleCount(LawsHomeNormalSearchDTO lawsHomeNormalSearchDTO) {
// todo 待开发
return Result.OK(lawsHomeSearchService.getNormalSearchTitleCount(lawsHomeNormalSearchDTO)); return Result.OK(lawsHomeSearchService.getNormalSearchTitleCount(lawsHomeNormalSearchDTO));
} }
@@ -80,27 +76,4 @@ public class LawsHomeSearchController {
// todo 待开发 // todo 待开发
return Result.OK(lawsHomeSearchService.getAdvancedSearchPage(homeNormalSearchDTO,pageNo,pageSize)); return Result.OK(lawsHomeSearchService.getAdvancedSearchPage(homeNormalSearchDTO,pageNo,pageSize));
} }
/**
* 下载附件
*
*/
@PostMapping(value = "/download")
public void view(MultipartFile file,String url, String appCode, String secretKey, String scope, HttpServletResponse response) {
try (InputStream inputStream = IntekeyUtils.DecryptFile(url, appCode, secretKey, scope, file);
OutputStream outputStream = response.getOutputStream()
) {
byte[] buf = new byte[1024];
int len;
while ((len = inputStream.read(buf)) > 0) {
outputStream.write(buf, 0, len);
}
response.flushBuffer();
}catch (Exception e){
log.error(e.getMessage());
response.setStatus(404);
e.printStackTrace();
}
}
} }
@@ -332,7 +332,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
if(CollectionUtils.isEmpty(list)){ if(CollectionUtils.isEmpty(list)){
objVO.setStatisticsCount("0"); objVO.setStatisticsCount("0");
}else{ }else{
long l = list.stream().filter(o->Arrays.asList(o.getStandardCode().split(",")).contains(dict.getValue())).count(); long l = list.stream().filter(o->Objects.equals(o.getStandardCode(),dict.getValue())).count();
objVO.setStatisticsCount(String.valueOf(l)); objVO.setStatisticsCount(String.valueOf(l));
} }
listDict.add(objVO); listDict.add(objVO);
@@ -348,7 +348,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
if(CollectionUtils.isEmpty(list)){ if(CollectionUtils.isEmpty(list)){
objVO.setStatisticsCount("0"); objVO.setStatisticsCount("0");
}else{ }else{
long l = list.stream().filter(o->Arrays.asList(o.getEnterpriseStandardState().split(",")).contains(dict.getValue())).count(); long l = list.stream().filter(o->Objects.equals(o.getEnterpriseStandardState(),dict.getValue())).count();
objVO.setStatisticsCount(String.valueOf(l)); objVO.setStatisticsCount(String.valueOf(l));
} }
listDict.add(objVO); listDict.add(objVO);
@@ -364,7 +364,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
if(CollectionUtils.isEmpty(list)){ if(CollectionUtils.isEmpty(list)){
objVO.setStatisticsCount("0"); objVO.setStatisticsCount("0");
}else{ }else{
long l = list.stream().filter(o->Arrays.asList(o.getGradeClassification().split(",")).contains(dict.getValue())).count(); long l = list.stream().filter(o->Objects.equals(o.getGradeClassification(),dict.getValue())).count();
objVO.setStatisticsCount(String.valueOf(l)); objVO.setStatisticsCount(String.valueOf(l));
} }
listDict.add(objVO); listDict.add(objVO);
@@ -383,7 +383,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
if(CollectionUtils.isEmpty(list)){ if(CollectionUtils.isEmpty(list)){
objVO.setStatisticsCount("0"); objVO.setStatisticsCount("0");
}else{ }else{
long l = list.stream().filter(o->Arrays.asList(o.getStandardClass().split(",")).contains(dict.getValue())).count(); long l = list.stream().filter(o->Objects.equals(o.getStandardClass(),dict.getValue())).count();
objVO.setStatisticsCount(String.valueOf(l)); objVO.setStatisticsCount(String.valueOf(l));
} }
listDict.add(objVO); listDict.add(objVO);
@@ -399,7 +399,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
if(CollectionUtils.isEmpty(list)){ if(CollectionUtils.isEmpty(list)){
objVO.setStatisticsCount("0"); objVO.setStatisticsCount("0");
}else{ }else{
long l = list.stream().filter(o->Arrays.asList(o.getApplicableVehicle().split(",")).contains(dict.getValue())).count(); long l = list.stream().filter(o->!StringUtils.isBlank(o.getApplicableVehicle()) && Arrays.asList(o.getApplicableVehicle().split(",")).contains(dict.getValue())).count();
objVO.setStatisticsCount(String.valueOf(l)); objVO.setStatisticsCount(String.valueOf(l));
} }
listDict.add(objVO); listDict.add(objVO);
@@ -415,7 +415,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
if(CollectionUtils.isEmpty(list)){ if(CollectionUtils.isEmpty(list)){
objVO.setStatisticsCount("0"); objVO.setStatisticsCount("0");
}else{ }else{
long l = list.stream().filter(o->Arrays.asList(o.getStandardState().split(",")).contains(dict.getValue())).count(); long l = list.stream().filter(o->Objects.equals(o.getStandardState(),dict.getValue())).count();
objVO.setStatisticsCount(String.valueOf(l)); objVO.setStatisticsCount(String.valueOf(l));
} }
listDict.add(objVO); listDict.add(objVO);
@@ -434,7 +434,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
if(CollectionUtils.isEmpty(list)){ if(CollectionUtils.isEmpty(list)){
objVO.setStatisticsCount("0"); objVO.setStatisticsCount("0");
}else{ }else{
long l = list.stream().filter(o->Arrays.asList(o.getStandardClass().split(",")).contains(dict.getValue())).count(); long l = list.stream().filter(o->Objects.equals(o.getStandardClass(),dict.getValue())).count();
objVO.setStatisticsCount(String.valueOf(l)); objVO.setStatisticsCount(String.valueOf(l));
} }
listDict.add(objVO); listDict.add(objVO);
@@ -450,7 +450,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
if(CollectionUtils.isEmpty(list)){ if(CollectionUtils.isEmpty(list)){
objVO.setStatisticsCount("0"); objVO.setStatisticsCount("0");
}else{ }else{
long l = list.stream().filter(o->Arrays.asList(o.getDynamicType().split(",")).contains(dict.getValue())).count(); long l = list.stream().filter(o->!StringUtils.isBlank(o.getDynamicType()) && Arrays.asList(o.getDynamicType().split(",")).contains(dict.getValue())).count();
objVO.setStatisticsCount(String.valueOf(l)); objVO.setStatisticsCount(String.valueOf(l));
} }
listDict.add(objVO); listDict.add(objVO);
@@ -466,7 +466,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
if(CollectionUtils.isEmpty(list)){ if(CollectionUtils.isEmpty(list)){
objVO.setStatisticsCount("0"); objVO.setStatisticsCount("0");
}else{ }else{
long l = list.stream().filter(o->Arrays.asList(o.getApplicableVehicle().split(",")).contains(dict.getValue())).count(); long l = list.stream().filter(o->!StringUtils.isBlank(o.getApplicableVehicle()) && Arrays.asList(o.getApplicableVehicle().split(",")).contains(dict.getValue())).count();
objVO.setStatisticsCount(String.valueOf(l)); objVO.setStatisticsCount(String.valueOf(l));
} }
listDict.add(objVO); listDict.add(objVO);
@@ -482,7 +482,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
if(CollectionUtils.isEmpty(list)){ if(CollectionUtils.isEmpty(list)){
objVO.setStatisticsCount("0"); objVO.setStatisticsCount("0");
}else{ }else{
long l = list.stream().filter(o->Arrays.asList(o.getStandardProperty().split(",")).contains(dict.getValue())).count(); long l = list.stream().filter(o->Objects.equals(o.getStandardProperty(),dict.getValue())).count();
objVO.setStatisticsCount(String.valueOf(l)); objVO.setStatisticsCount(String.valueOf(l));
} }
listDict.add(objVO); listDict.add(objVO);
@@ -498,7 +498,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
if(CollectionUtils.isEmpty(list)){ if(CollectionUtils.isEmpty(list)){
objVO.setStatisticsCount("0"); objVO.setStatisticsCount("0");
}else{ }else{
long l = list.stream().filter(o->Arrays.asList(o.getStandardState().split(",")).contains(dict.getValue())).count(); long l = list.stream().filter(o->Objects.equals(o.getStandardState(),dict.getValue())).count();
objVO.setStatisticsCount(String.valueOf(l)); objVO.setStatisticsCount(String.valueOf(l));
} }
listDict.add(objVO); listDict.add(objVO);