diff --git a/laws-modules-docking/src/main/java/com/jero/modules/docking/encrypt/controller/EncrygtController.java b/laws-modules-docking/src/main/java/com/jero/modules/docking/encrypt/controller/EncrygtController.java new file mode 100644 index 00000000..7e69be48 --- /dev/null +++ b/laws-modules-docking/src/main/java/com/jero/modules/docking/encrypt/controller/EncrygtController.java @@ -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(); + } + } +} diff --git a/laws-modules/src/main/java/com/jero/modules/laws/common/util/IntekeyUtils.java b/laws-modules-docking/src/main/java/com/jero/modules/docking/utils/IntekeyUtils.java similarity index 98% rename from laws-modules/src/main/java/com/jero/modules/laws/common/util/IntekeyUtils.java rename to laws-modules-docking/src/main/java/com/jero/modules/docking/utils/IntekeyUtils.java index 90b7d74d..55dda23d 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/common/util/IntekeyUtils.java +++ b/laws-modules-docking/src/main/java/com/jero/modules/docking/utils/IntekeyUtils.java @@ -1,4 +1,4 @@ -package com.jero.modules.laws.common.util; +package com.jero.modules.docking.utils; import org.slf4j.Logger; diff --git a/laws-modules/src/main/java/com/jero/modules/laws/home/controller/LawsHomeSearchController.java b/laws-modules/src/main/java/com/jero/modules/laws/home/controller/LawsHomeSearchController.java index 03ceaeb8..dd6f3032 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/home/controller/LawsHomeSearchController.java +++ b/laws-modules/src/main/java/com/jero/modules/laws/home/controller/LawsHomeSearchController.java @@ -3,7 +3,6 @@ package com.jero.modules.laws.home.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.jero.common.api.vo.Result; 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.service.ILawsHomeSearchService; 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.ApiOperation; import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.bind.annotation.GetMapping; +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.servlet.http.HttpServletResponse; -import java.io.InputStream; -import java.io.OutputStream; /** * @author lqt @@ -41,7 +39,6 @@ public class LawsHomeSearchController { public Result> getNormalSearchTitlePage(LawsHomeNormalSearchDTO lawsHomeNormalSearchDTO, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) { - // todo 待开发 return Result.OK(lawsHomeSearchService.getNormalSearchTitlePage(lawsHomeNormalSearchDTO,pageNo,pageSize)); } @@ -49,7 +46,6 @@ public class LawsHomeSearchController { @ApiOperation(value="首页-一般检索(标题)(数据统计)", notes="首页-一般检索(标题)(数据统计)") @GetMapping(value = "/getNormalSearchTitleCount") public Result getNormalSearchTitleCount(LawsHomeNormalSearchDTO lawsHomeNormalSearchDTO) { - // todo 待开发 return Result.OK(lawsHomeSearchService.getNormalSearchTitleCount(lawsHomeNormalSearchDTO)); } @@ -80,27 +76,4 @@ public class LawsHomeSearchController { // todo 待开发 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(); - } - } } diff --git a/laws-modules/src/main/java/com/jero/modules/laws/home/service/impl/LawsHomeSearchServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/laws/home/service/impl/LawsHomeSearchServiceImpl.java index 81123ec1..ad4d3b74 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/home/service/impl/LawsHomeSearchServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/laws/home/service/impl/LawsHomeSearchServiceImpl.java @@ -332,7 +332,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService { if(CollectionUtils.isEmpty(list)){ objVO.setStatisticsCount("0"); }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)); } listDict.add(objVO); @@ -348,7 +348,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService { if(CollectionUtils.isEmpty(list)){ objVO.setStatisticsCount("0"); }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)); } listDict.add(objVO); @@ -364,7 +364,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService { if(CollectionUtils.isEmpty(list)){ objVO.setStatisticsCount("0"); }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)); } listDict.add(objVO); @@ -383,7 +383,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService { if(CollectionUtils.isEmpty(list)){ objVO.setStatisticsCount("0"); }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)); } listDict.add(objVO); @@ -399,7 +399,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService { if(CollectionUtils.isEmpty(list)){ objVO.setStatisticsCount("0"); }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)); } listDict.add(objVO); @@ -415,7 +415,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService { if(CollectionUtils.isEmpty(list)){ objVO.setStatisticsCount("0"); }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)); } listDict.add(objVO); @@ -434,7 +434,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService { if(CollectionUtils.isEmpty(list)){ objVO.setStatisticsCount("0"); }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)); } listDict.add(objVO); @@ -450,7 +450,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService { if(CollectionUtils.isEmpty(list)){ objVO.setStatisticsCount("0"); }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)); } listDict.add(objVO); @@ -466,7 +466,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService { if(CollectionUtils.isEmpty(list)){ objVO.setStatisticsCount("0"); }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)); } listDict.add(objVO); @@ -482,7 +482,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService { if(CollectionUtils.isEmpty(list)){ objVO.setStatisticsCount("0"); }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)); } listDict.add(objVO); @@ -498,7 +498,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService { if(CollectionUtils.isEmpty(list)){ objVO.setStatisticsCount("0"); }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)); } listDict.add(objVO);