From 146edfb05602373ad5b36771e1ede1e395d8ab62 Mon Sep 17 00:00:00 2001 From: chenrui <1187576398@qq.com> Date: 星期四, 27 二月 2025 14:53:26 +0800 Subject: [PATCH] Merge branch 'dev' of http://114.132.189.42:9002/r/lims-ruoyi-after into dev_cr --- ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java | 14 cnas-process/src/main/java/com/ruoyi/process/controller/ProcessEvaluateController.java | 2 inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderMapper.java | 2 basic-server/src/main/java/com/ruoyi/basic/controller/StandardTemplateController.java | 3 cnas-process/src/main/java/com/ruoyi/process/controller/ProcessMethodSearchNewController.java | 2 ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java | 2 inspect-server/src/main/resources/mapper/InsOrderMapper.xml | 2 basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTemplateServiceImpl.java | 23 inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java | 10 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java | 71 ++- ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java | 16 + ruoyi-common/src/main/java/com/ruoyi/common/utils/GZipUtil.java | 63 ++++ cnas-process/src/main/java/com/ruoyi/process/mapper/ProcessReportMapper.java | 2 inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java | 444 ++++++++++++++++++----------- ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java | 7 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java | 4 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java | 16 + ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleMenu.java | 17 + cnas-process/src/main/java/com/ruoyi/process/controller/ProcessReportController.java | 11 cnas-process/src/main/java/com/ruoyi/process/controller/ProcessTotalSampleController.java | 11 ruoyi-admin/src/main/resources/banner.txt | 31 - ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml | 12 inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderStandardTemplate.java | 5 cnas-process/src/main/java/com/ruoyi/process/controller/ProcessComplainController.java | 7 cnas-process/src/main/java/com/ruoyi/process/controller/ProcessMethodVerifyController.java | 2 ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java | 41 +- inspect-server/src/main/resources/static/report-template.docx | 0 cnas-process/src/main/java/com/ruoyi/process/controller/ProcessDealController.java | 4 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java | 56 ++- cnas-process/src/main/java/com/ruoyi/process/controller/ProcessTotaldealController.java | 11 30 files changed, 570 insertions(+), 321 deletions(-) diff --git a/basic-server/src/main/java/com/ruoyi/basic/controller/StandardTemplateController.java b/basic-server/src/main/java/com/ruoyi/basic/controller/StandardTemplateController.java index 55cb2a9..50b1b89 100644 --- a/basic-server/src/main/java/com/ruoyi/basic/controller/StandardTemplateController.java +++ b/basic-server/src/main/java/com/ruoyi/basic/controller/StandardTemplateController.java @@ -56,8 +56,7 @@ @ApiOperation(value = "缂栬緫妯℃澘缂栧埗") @GetMapping("/getEditTemplatePreparation") public Result<?> getEditTemplatePreparation(@RequestParam("id") Integer id) { - StandardTemplate byId = standardTemplateService.getById(id); - return Result.success(byId.getThing()); + return Result.success(standardTemplateService.getStandTempThingById(id)); } @ApiOperation(value = "澶嶅埗鍘熷璁板綍妯℃澘") diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTemplateServiceImpl.java b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTemplateServiceImpl.java index f1f3ba4..e94a9ec 100644 --- a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTemplateServiceImpl.java +++ b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTemplateServiceImpl.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.numgen.NumberGenerator; +import com.ruoyi.common.utils.GZipUtil; import com.ruoyi.common.utils.QueryWrappers; import com.ruoyi.basic.mapper.StandardTemplateMapper; import com.ruoyi.basic.pojo.StandardTemplate; @@ -45,12 +46,19 @@ StandardTemplate::getNumber); standardTemplate.setNumber(giveCode); } + if (StringUtils.isNotBlank(standardTemplate.getThing())) { + standardTemplate.setThing(GZipUtil.compress(standardTemplate.getThing())); + } else { + standardTemplate.setThing(null); + } return standardTemplateMapper.insert(standardTemplate); } @Override public int upStandardTemplate(StandardTemplate standardTemplate) { - if(standardTemplate.getThing().equals("")){ + if (StringUtils.isNotBlank(standardTemplate.getThing())) { + standardTemplate.setThing(GZipUtil.compress(standardTemplate.getThing())); + } else { standardTemplate.setThing(null); } return standardTemplateMapper.updateById(standardTemplate); @@ -74,19 +82,8 @@ if(standardTemplate==null){ return null; }else{ - return standardTemplate.getThing(); + return GZipUtil.uncompress(standardTemplate.getThing()); } - // 鏌ヨ鍘嬬缉鍚庣殑鏁版嵁 -// String thing = standardTemplateMapper.selectCompressThing(templateId); -// if (StringUtils.isNotBlank(thing)) { -// try { -// return DecompressMySQLData.decompress(java.util.Base64.getDecoder().decode(thing)); -// } catch (Exception e) { -// throw new RuntimeException(e); -// } -// } else { -// return null; -// } } @Override diff --git a/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessComplainController.java b/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessComplainController.java index 5c060ec..e5c9add 100644 --- a/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessComplainController.java +++ b/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessComplainController.java @@ -48,7 +48,7 @@ } @ApiOperation(value = "鎶曡瘔璇︽儏") - @PostMapping("/getProcessComplain") + @GetMapping("/getProcessComplain") public Result getProcessComplain(Long id) { return Result.success(processComplainService.getProcessComplain(id)); } @@ -60,9 +60,8 @@ } @ApiOperation(value = "瀵煎嚭鍒楄〃") - @PostMapping("/exportProcessComplain") - public void exportProcessComplain(@RequestBody Map<String, Object> data,HttpServletResponse response) throws Exception { - ProcessComplain processComplain = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), ProcessComplain.class); + @GetMapping("/exportProcessComplain") + public void exportProcessComplain(ProcessComplain processComplain,HttpServletResponse response) throws Exception { processComplainService.exportProcessComplain(processComplain,response); } } diff --git a/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessDealController.java b/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessDealController.java index a178f1b..15ac088 100644 --- a/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessDealController.java +++ b/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessDealController.java @@ -29,7 +29,7 @@ private ProcessDealService processDealService; @ApiOperation(value = "鏌ヨ妫�娴嬫垨鏍″噯鐗╁搧鐨勫缃鎯�") - @PostMapping("/pageProcessDeal") + @GetMapping("/pageProcessDeal") public Result pageProcessDeal(ProcessDeal processDeal, Page page) throws Exception { return Result.success(processDealService.pageProcessDeal(page, processDeal)); } @@ -53,7 +53,7 @@ } @ApiOperation(value = "鏌ョ湅妫�娴嬫垨鏍″噯鐗╁搧鐨勫缃�") - @PostMapping("/getProcessDeal") + @GetMapping("/getProcessDeal") public Result getProcessDeal(Integer id) { return Result.success(processDealService.getById(id)); } diff --git a/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessEvaluateController.java b/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessEvaluateController.java index e00885d..840c072 100644 --- a/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessEvaluateController.java +++ b/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessEvaluateController.java @@ -30,7 +30,7 @@ private ProcessEvaluateService processEvaluateService; @ApiOperation(value = "鏌ヨ娴嬮噺涓嶇‘瀹氬害鐨勮瘎瀹氬垪琛�") - @PostMapping("/pageProcessEvaluate") + @GetMapping("/pageProcessEvaluate") public Result pageProcessEvaluate(ProcessEvaluate processEvaluate,Page page) throws Exception { return Result.success(processEvaluateService.pageProcessEvaluate(page, processEvaluate)); } diff --git a/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessMethodSearchNewController.java b/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessMethodSearchNewController.java index 9539d5a..7ba9d7d 100644 --- a/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessMethodSearchNewController.java +++ b/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessMethodSearchNewController.java @@ -78,7 +78,7 @@ * @return */ @ApiOperation(value = "瀵煎叆鏍囧噯鏌ユ柊") - @GetMapping("/importMethodSearchNew") + @PostMapping("/importMethodSearchNew") public Result importMethodSearchNew(MultipartFile file){ return Result.success(processMethodSearchNewService.importMethodSearchNew(file)); } diff --git a/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessMethodVerifyController.java b/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessMethodVerifyController.java index 4fa44bc..d265511 100644 --- a/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessMethodVerifyController.java +++ b/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessMethodVerifyController.java @@ -47,7 +47,7 @@ * @return */ @ApiOperation(value = "鏍囧噯鏂规硶鏇存柊楠岃瘉鍒楄〃") - @PostMapping("/pagesMethodVerify") + @GetMapping("/pagesMethodVerify") public Result<IPage<ProcessMethodVerify>> pagesMethodVerify(ProcessMethodVerifyDto methodVerifyDto,Page page) throws Exception { return Result.success(processMethodVerifyService.pagesMethodVerify(page, methodVerifyDto)); } diff --git a/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessReportController.java b/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessReportController.java index a657183..a773397 100644 --- a/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessReportController.java +++ b/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessReportController.java @@ -7,10 +7,7 @@ import com.ruoyi.process.service.ProcessReportService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.Map; @@ -32,7 +29,7 @@ private ProcessReportService processReportService; @ApiOperation(value = "鏌ヨ妫�楠屾姤鍛婂彂鏀剧櫥璁板垪琛�") - @PostMapping("/pageProcessReport") + @GetMapping("/pageProcessReport") public Result pageProcessReport(ProcessReport processReport , Page page) throws Exception { return Result.success(processReportService.pageProcessReport(page, processReport)); } @@ -44,13 +41,13 @@ } @ApiOperation(value = "鍒犻櫎妫�楠屾姤鍛婂彂鏀剧櫥璁�") - @PostMapping("/delProcessReport") + @DeleteMapping("/delProcessReport") public Result delProcessReport(Long id) { return Result.success(processReportService.removeById(id)); } @ApiOperation(value = "鏌ョ湅妫�楠屾姤鍛婂彂鏀剧櫥璁拌鎯�") - @PostMapping("/getProcessReport") + @GetMapping("/getProcessReport") public Result getProcessReport(Long id) { return Result.success(processReportService.getById(id)); } diff --git a/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessTotalSampleController.java b/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessTotalSampleController.java index 8af7003..cf6b5a0 100644 --- a/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessTotalSampleController.java +++ b/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessTotalSampleController.java @@ -35,19 +35,24 @@ @ApiOperation(value = "鎻愪氦鏍峰搧鎺ユ敹") @PostMapping("/submitProcessTotalSample") - public Result submitProcessTotalSample(Integer id) { + public Result submitProcessTotalSample(@RequestBody Map<String, Object> param) { + Integer id = (Integer) param.get("id"); return Result.success(processTotalSampleService.submitProcessTotalSample(id)); } @ApiOperation(value = "瀹℃牳鏍峰搧鎺ユ敹") @PostMapping("/checkProcessTotalSample") - public Result checkProcessTotalSample(Integer id, String state) { + public Result checkProcessTotalSample(@RequestBody Map<String, Object> param) { + Integer id = (Integer) param.get("id"); + String state = (String) param.get("state"); return Result.success(processTotalSampleService.checkProcessTotalSample(id, state)); } @ApiOperation(value = "鎵瑰噯鏍峰搧鎺ユ敹") @PostMapping("/ratifyProcessTotalSample") - public Result ratifyProcessTotalSample(Integer id,String state) { + public Result ratifyProcessTotalSample(@RequestBody Map<String, Object> param) { + Integer id = (Integer) param.get("id"); + String state = (String) param.get("state"); return Result.success(processTotalSampleService.ratifyProcessTotalSample(id,state)); } diff --git a/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessTotaldealController.java b/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessTotaldealController.java index 88826c0..6d3380d 100644 --- a/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessTotaldealController.java +++ b/cnas-process/src/main/java/com/ruoyi/process/controller/ProcessTotaldealController.java @@ -35,19 +35,24 @@ @ApiOperation(value = "鎻愪氦妫�娴嬫垨鏍″噯鐗╁搧鐨勫缃�") @PostMapping("/submitProcessTotaldeal") - public Result submitProcessTotaldeal(Integer id) { + public Result submitProcessTotaldeal(@RequestBody Map<String, Integer> param) { + Integer id = param.get("id"); return Result.success(processTotaldealService.submitProcessTotaldeal(id)); } @ApiOperation(value = "瀹℃牳妫�娴嬫垨鏍″噯鐗╁搧鐨勫缃�") @PostMapping("/checkProcessTotaldeal") - public Result checkProcessTotaldeal(Integer id, String state) { + public Result checkProcessTotaldeal(@RequestBody Map<String, Object> param) { + Integer id = (Integer) param.get("id"); + String state = (String) param.get("state"); return Result.success(processTotaldealService.checkProcessTotaldeal(id, state)); } @ApiOperation(value = "鎵瑰噯妫�娴嬫垨鏍″噯鐗╁搧鐨勫缃�") @PostMapping("/ratifyProcessTotaldeal") - public Result ratifyProcessTotaldeal(Integer id,String state) { + public Result ratifyProcessTotaldeal(@RequestBody Map<String, Object> param) { + Integer id = (Integer) param.get("id"); + String state = (String) param.get("state"); return Result.success(processTotaldealService.ratifyProcessTotaldeal(id,state)); } diff --git a/cnas-process/src/main/java/com/ruoyi/process/mapper/ProcessReportMapper.java b/cnas-process/src/main/java/com/ruoyi/process/mapper/ProcessReportMapper.java index 86e6aaf..f44efbf 100644 --- a/cnas-process/src/main/java/com/ruoyi/process/mapper/ProcessReportMapper.java +++ b/cnas-process/src/main/java/com/ruoyi/process/mapper/ProcessReportMapper.java @@ -21,5 +21,5 @@ IPage<ProcessReport> pageProcessReport(Page page, @Param("ew") QueryWrapper<ProcessReport> queryWrappers); - List<ProcessReport> getIds(List<Integer> ids); + List<ProcessReport> getIds(@Param("ids") List<Integer> ids); } diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderMapper.java index 36ff9d0..96a5ca8 100644 --- a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderMapper.java +++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderMapper.java @@ -38,7 +38,7 @@ List<CostStatisticsDto> selectCostStatistics2(@Param("ew") QueryWrapper<CostStatisticsDto> ew); - List<Map<String, String>> selectDeviceList(@Param("names") Set<String> names); + List<Map<String, String>> selectDeviceList(@Param("managementNumbers") Set<String> managementNumbers); List<SampleDefectsFatherVo> selectSampleDefects(Page page, @Param("inspectionItems") String inspectionItems, @Param("orderNumber") String orderNumber); Long getCount(@Param("inspectionItems") String inspectionItems, @Param("orderNumber") String orderNumber); diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderStandardTemplate.java b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderStandardTemplate.java index 921d222..e682cf6 100644 --- a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderStandardTemplate.java +++ b/inspect-server/src/main/java/com/ruoyi/inspect/pojo/InsOrderStandardTemplate.java @@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.time.LocalDateTime; import java.util.Date; /** @@ -44,11 +45,11 @@ @TableField(fill = FieldFill.INSERT) @ApiModelProperty("鍒涘缓鏃堕棿") - private Date createTime; + private LocalDateTime createTime; @TableField(fill = FieldFill.INSERT_UPDATE) @ApiModelProperty("淇敼鏃堕棿") - private Date updateTime; + private LocalDateTime updateTime; @ApiModelProperty("妯℃澘缂栧彿") private String number; diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java index ca01fca..66ce538 100644 --- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java +++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java @@ -34,7 +34,6 @@ import com.ruoyi.common.constant.InsOrderTypeConstants; import com.ruoyi.common.core.domain.entity.Custom; import com.ruoyi.common.core.domain.entity.InformationNotification; -import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.domain.entity.User; import com.ruoyi.common.utils.*; import com.ruoyi.framework.exception.ErrorException; @@ -42,6 +41,7 @@ import com.ruoyi.inspect.mapper.*; import com.ruoyi.inspect.pojo.*; import com.ruoyi.inspect.service.*; +import com.ruoyi.inspect.util.HackLoopTableRenderPolicy; import com.ruoyi.inspect.vo.InsOrderPlanTaskSwitchVo; import com.ruoyi.inspect.vo.InsOrderPlanVO; import com.ruoyi.performance.mapper.AuxiliaryOutputWorkingHoursMapper; @@ -55,6 +55,7 @@ import com.ruoyi.system.service.InformationNotificationService; import org.apache.commons.lang3.StringUtils; import org.apache.poi.xwpf.usermodel.*; +import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Value; import org.springframework.mock.web.MockMultipartFile; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @@ -590,8 +591,27 @@ return insSampleUserMapper.insert(insSampleUser); } + /** + * 鏌ヨ妯℃澘鍐呭 + * @param order + * @param insProducts + */ private void getTemplateThing(InsOrder order, List<InsProduct> insProducts) { Set<Integer> set = new HashSet<>(); + // 妫�楠岄」鍒嗙被+妫�楠岄」+妫�楠屽瓙椤圭殑鎷兼帴 + List<String> itemNameList = insProducts.stream().map(insProduct -> { + String itemName = ""; + if (StringUtils.isNotBlank(insProduct.getInspectionItemClass())) { + itemName += insProduct.getInspectionItemClass().trim(); + } + if (StringUtils.isNotBlank(insProduct.getInspectionItem())) { + itemName += insProduct.getInspectionItem().trim(); + } + if (StringUtils.isNotBlank(insProduct.getInspectionItemSubclass())) { + itemName += insProduct.getInspectionItemSubclass().trim(); + } + return itemName; + }).collect(Collectors.toList()); // 鏌ヨ璁㈠崟鐘舵�佸垽鏂槸鍚︽槸鏌ュ巻鍙叉ā鏉� if (order.getIsFirstSubmit() != null && order.getIsFirstSubmit().equals(1)) { InsOrderState insOrderState = insOrderStateMapper.selectOne(Wrappers.<InsOrderState>lambdaQuery() @@ -611,7 +631,11 @@ .eq(InsOrderStandardTemplate::getInsOrderId, order.getId())); thing = one.getThing(); if (StrUtil.isNotEmpty(thing)) { + thing = GZipUtil.uncompress(thing); JSONObject sheet = JSON.parseObject(JSON.toJSONString(JSON.parseArray(JSON.toJSONString(JSON.parseObject(thing).get("data"))).get(0))); + // 娓呴櫎娌℃湁鍏宠仈鐨勬楠岄」 + eliminateItem(sheet, itemNameList); + JSONObject config = JSON.parseObject(JSON.toJSONString(sheet.get("config"))); List<JSONObject> cellData = JSON.parseArray(JSON.toJSONString(sheet.get("celldata")), JSONObject.class); Map<String, Object> style = new HashMap<>(); @@ -636,6 +660,8 @@ } if (StrUtil.isNotEmpty(thing)) { JSONObject sheet = JSON.parseObject(JSON.toJSONString(JSON.parseArray(JSON.toJSONString(JSON.parseObject(thing).get("data"))).get(0))); + // 娓呴櫎娌℃湁鍏宠仈鐨勬楠岄」 + eliminateItem(sheet, itemNameList); JSONObject config = JSON.parseObject(JSON.toJSONString(sheet.get("config"))); List<JSONObject> cellData = JSON.parseArray(JSON.toJSONString(sheet.get("celldata")), JSONObject.class); Map<String, Object> style = new HashMap<>(); @@ -646,6 +672,90 @@ product.setTemplateName(standardTemplateService.getStandTempNameById(product.getTemplateId())); } } + } + + /** + * 娓呴櫎娌℃湁浣跨敤鐨勬楠岄」 + * @param sheet + * @param itemNameList + */ + private static void eliminateItem(JSONObject sheet, List<String> itemNameList) { + // 鑾峰彇鍒� 妫�楠岄」鍒嗙被+妫�楠岄」+妫�楠屽瓙椤圭殑鎷兼帴,濡傛灉妯℃澘閲岀殑淇℃伅璺熸帴鍙h繑鍥炵殑妫�楠岄」淇℃伅鑳藉鍖归厤鍒欏睍绀哄嚭鏉� + + // 寰幆琛屾暟鍒ゆ柇鏄惁 + JSONArray dataListJSONArray = sheet.getJSONArray("data"); + + // 娣诲姞鍧愭爣map + Map<String, String> coordinatesMap = new HashMap<>(); + + // 闇�瑕佺Щ闄ょ殑绱㈠紩 + List<Integer> deleteIndex = new ArrayList<>(); + // 寰幆鍒� + for (int r = 0; r < dataListJSONArray.size(); r++) { + JSONArray dataList = dataListJSONArray.getJSONArray(r); + // 寰幆琛� + String itemName = ""; + // 鍒ゆ柇鏄惁鏄剧ず + boolean isShow = false; + + for (int c = 0; c < dataList.size(); c++) { + // 鏌ヨ鎵规敞 + JSONObject jsonObject = dataList.getJSONObject(c); + try { + if (jsonObject.getJSONObject("ps").getString("value").equals("妫�楠岄」鍒嗙被")) { + String value = jsonObject.getString("v").trim(); + itemName += value; + // 娣诲姞鍧愭爣 + String coordinates = coordinatesJoint(r, c); + coordinatesMap.put(coordinates, value); + isShow = true; + } else if (jsonObject.getJSONObject("ps").getString("value").equals("妫�楠岄」")) { + String value = jsonObject.getString("v").trim(); + itemName += value; + // 娣诲姞鍧愭爣 + String coordinates = coordinatesJoint(r, c); + coordinatesMap.put(coordinates, value); + isShow = true; + } else if (jsonObject.getJSONObject("ps").getString("value").equals("妫�楠屽瓙椤�")) { + String value = jsonObject.getString("v").trim(); + itemName += value; + // 娣诲姞鍧愭爣 + String coordinates = coordinatesJoint(r, c); + coordinatesMap.put(coordinates, value); + isShow = true; + } + } catch (Exception e) { + // 鍒ゆ柇鏄惁鏈塵c鍚堝苟鍗曞厓鏍� + if (jsonObject != null && jsonObject.getJSONObject("mc") != null) { + // 鏌ヨ鍧愭爣杩涜娣诲姞 + String value = coordinatesMap.get(coordinatesJoint(jsonObject.getJSONObject("mc").getInteger("r"), jsonObject.getJSONObject("mc").getInteger("c"))); + if (StringUtils.isNotBlank(value) && !itemName.contains(value)) { + itemName += value; + } + } + } + } + // 鍒ゆ柇璇ヨ鍗曟槸鍚︽湁鏀规楠岄」, 娌℃湁鍓旈櫎 + if (isShow) { + if (!itemNameList.contains(itemName)) { + dataListJSONArray.remove(r); + r--; + } + } + } + } + + + /** + * 鍧愭爣鎷兼帴 + * @param r 妯潗鏍� + * @param c 绾靛潗鏍� + * @return + */ + private static String coordinatesJoint(int r, int c) { + String coordinates = ""; + coordinates = "r:" + r + ",c:" + c; + return coordinates; } @Override @@ -1880,6 +1990,8 @@ put("seal1", null); }}); try { + // 淇敼鎹㈣鍜屽悎骞堕棶棰� + updaeMerge(template.getXWPFDocument(), true); String name = insReport.getCode().replace("/", "") + "-J.docx"; template.writeAndClose(Files.newOutputStream(Paths.get(wordUrl + "/" + name))); insReport.setUrl("/word/" + name); @@ -1894,8 +2006,6 @@ } catch (IOException e) { throw new RuntimeException(e); } - // 淇敼鎹㈣鍜屽悎骞堕棶棰� - updaeMerge(insReport, null, true); } /** @@ -2263,10 +2373,19 @@ tables.forEach(table -> { table.put("tableSize", tables.size() + 1); }); + // 璁惧淇℃伅 List<Map<String, String>> deviceList = null; - if (deviceSet.size() != 0) { + if (CollectionUtils.isNotEmpty(deviceSet)) { deviceList = insOrderMapper.selectDeviceList(deviceSet); } + if (CollectionUtils.isNotEmpty(deviceList)) { + int count = 1; + for (Map<String, String> stringMap : deviceList) { + stringMap.put("index", String.valueOf(count)); + count++; + } + } + Map<String, String> codeStr = new HashMap<>(); codeStr.put("鎶ュ憡缂栧彿", insReport.getCode()); codeStr.put("鏍峰搧鍚嶇О", insOrder.getSample()); @@ -2274,7 +2393,6 @@ codeStr.put("鍙戞斁鏃ユ湡", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); String modelStr = CollUtil.join(models, "\n"); - String finalModelStr = modelStr; // 妫�娴嬬被鍨� String orderType = null; @@ -2288,11 +2406,10 @@ String formType = iSysDictTypeService.selectLabelByDict(DictDataConstants.FORM_TYPE, insOrder.getFormType()); // 鏍峰搧鐘舵�� - String sampleStatus = iSysDictTypeService.selectLabelByDict(DictDataConstants.SAMPLE_STATUS_LIST, insOrder.getSampleStatus());; + String sampleStatus = iSysDictTypeService.selectLabelByDict(DictDataConstants.SAMPLE_STATUS_LIST, insOrder.getSampleStatus()); + ; - ConfigureBuilder builder = Configure.builder(); - builder.useSpringEL(true); - List<Map<String, String>> finalDeviceList = deviceList; + // 鍏徃淇℃伅 Custom custom = customMapper.selectById(insOrder.getCompanyId()); // 鏌ヨ鍒ゆ柇鏄惁鏈変笉鍒ゅ畾椤圭洰,鍜屽叏閮芥槸鍒ゅ畾椤� @@ -2382,12 +2499,18 @@ environment = (ObjectUtils.isNotEmpty(insOrder.getTemperature()) ? insOrder.getTemperature() + "鈩� " : "") + (ObjectUtils.isNotEmpty(insOrder.getHumidity()) ? insOrder.getHumidity() + "%" : ""); String finalEnvironment = environment; LocalDateTime finalSendTime = sendTime; - String finalResultCh = resultCh; String finalResultEn = resultEn; String finalOrderType = orderType; + List<Map<String, String>> finalDeviceList = deviceList; + String finalModelStr = modelStr; + InputStream inputStream = this.getClass().getResourceAsStream("/static/report-template.docx"); - XWPFTemplate template = XWPFTemplate.compile(inputStream, builder.build()).render( + Configure configure = Configure.builder() + .bind("deviceList", new HackLoopTableRenderPolicy()) + .build(); + + XWPFTemplate template = XWPFTemplate.compile(inputStream, configure).render( new HashMap<String, Object>() {{ put("order", insOrder); put("report", insReport); @@ -2422,6 +2545,8 @@ put("sampleStatus", sampleStatus); }}); try { + // 淇敼鎹㈣鍜屽悎骞堕棶棰� + updaeMerge(template.getXWPFDocument(), false); String name = insReport.getCode().replace("/", "") + ".docx"; template.writeAndClose(Files.newOutputStream(Paths.get(wordUrl + "/" + name))); insReport.setUrl("/word/" + name); @@ -2434,8 +2559,6 @@ } catch (IOException e) { throw new RuntimeException(e); } - // 淇敼鎹㈣鍜屽悎骞堕棶棰� - updaeMerge(insReport, deviceList, false); } /** @@ -2506,188 +2629,165 @@ /** * 鍚堝苟鍗曞厓鏍� - * @param insReport - * @param deviceList */ - private void updaeMerge(InsReport insReport, List<Map<String, String>> deviceList, boolean isSmall) { + private void updaeMerge(XWPFDocument document, boolean isSmall) { // 澶勭悊鍚堝苟鍗曞厓鏍肩殑闂 - String path = wordUrl + insReport.getUrl().replaceFirst("/word", ""); - try { - // 鑾峰彇鏂囨。涓殑鎵�鏈夎〃鏍� - FileInputStream stream = new FileInputStream(path); - XWPFDocument document = new XWPFDocument(stream); - List<XWPFTable> xwpfTables = document.getTables(); - // 閬嶅巻琛ㄦ牸锛屼絾璺宠繃绗竴涓〃鏍硷紙濡傛灉deviceList涓簄ull锛屽垯棰濆璺宠繃绗簩涓級 - for (int i = 1; i < xwpfTables.size() - (deviceList == null ? 1 : 2); i++) { - // 鍒涘缓涓�涓狧ashSet鏉ュ瓨鍌ㄥ敮涓�鐨勫瓧绗︿覆锛堣繖閲屽熀浜�"鈭�"鍒嗗壊鍚庣殑绗簩閮ㄥ垎锛� - Set<String> set1 = new HashSet<>(); - // 鍒涘缓涓�涓狧ashMap鏉ュ瓨鍌ㄦ瘡涓敮涓�瀛楃涓插強鍏跺搴旂殑鍗曞厓鏍间綅缃俊鎭� - Map<String, Map<String, Integer>> maps = new HashMap<>(); - // 閬嶅巻褰撳墠琛ㄦ牸鐨勬墍鏈夎 - for (int j = 0; j < xwpfTables.get(i).getRows().size(); j++) { - // 閬嶅巻褰撳墠琛岀殑鎵�鏈夊崟鍏冩牸 - for (int k = 0; k < xwpfTables.get(i).getRows().get(j).getTableCells().size(); k++) { - // 妫�鏌ュ崟鍏冩牸鏂囨湰涓槸鍚﹀寘鍚�"鈭�" - if (xwpfTables.get(i).getRows().get(j).getTableCells().get(k).getText().indexOf("鈭�") > -1) { - String[] split = xwpfTables.get(i).getRows().get(j).getTableCells().get(k).getText().split("鈭�"); - // 濡傛灉鍒嗗壊鍚庣殑绗簩閮ㄥ垎鏄柊鐨勶紙鍗充箣鍓嶆湭鍑虹幇杩囷級锛屽垯娣诲姞鍒皊et1骞跺垱寤轰綅缃俊鎭痬ap - if (set1.add(split[1])) { - Map<String, Integer> map = new HashMap<>(); - // 瀛樺偍璧峰琛屻�佽捣濮嬪垪銆佺粨鏉熻锛堝綋鍓嶈锛夈�佺粨鏉熷垪锛堝綋鍓嶅垪锛� - map.put("sr", j); - map.put("sc", k); - map.put("er", j + 0); - map.put("ec", k + 0); - maps.put(split[1], map); - } else { - // 濡傛灉宸插瓨鍦紝鍒欐洿鏂扮粨鏉熻鎴栫粨鏉熷垪 - Map<String, Integer> map1 = maps.get(split[1]); - if (j == map1.get("sr")) { - map1.put("ec", map1.get("ec") + 1); - } else if (k == map1.get("sc")) { - map1.put("er", map1.get("er") + 1); - } + // 鑾峰彇鏂囨。涓殑鎵�鏈夎〃鏍� + List<XWPFTable> xwpfTables = document.getTables(); + // 閬嶅巻琛ㄦ牸 + for (int i = 1; i < xwpfTables.size(); i++) { + // 鍒涘缓涓�涓狧ashSet鏉ュ瓨鍌ㄥ敮涓�鐨勫瓧绗︿覆锛堣繖閲屽熀浜�"鈭�"鍒嗗壊鍚庣殑绗簩閮ㄥ垎锛� + Set<String> set1 = new HashSet<>(); + // 鍒涘缓涓�涓狧ashMap鏉ュ瓨鍌ㄦ瘡涓敮涓�瀛楃涓插強鍏跺搴旂殑鍗曞厓鏍间綅缃俊鎭� + Map<String, Map<String, Integer>> maps = new HashMap<>(); + // 閬嶅巻褰撳墠琛ㄦ牸鐨勬墍鏈夎 + for (int j = 0; j < xwpfTables.get(i).getRows().size(); j++) { + // 閬嶅巻褰撳墠琛岀殑鎵�鏈夊崟鍏冩牸 + for (int k = 0; k < xwpfTables.get(i).getRows().get(j).getTableCells().size(); k++) { + // 妫�鏌ュ崟鍏冩牸鏂囨湰涓槸鍚﹀寘鍚�"鈭�" + if (xwpfTables.get(i).getRows().get(j).getTableCells().get(k).getText().indexOf("鈭�") > -1) { + String[] split = xwpfTables.get(i).getRows().get(j).getTableCells().get(k).getText().split("鈭�"); + // 濡傛灉鍒嗗壊鍚庣殑绗簩閮ㄥ垎鏄柊鐨勶紙鍗充箣鍓嶆湭鍑虹幇杩囷級锛屽垯娣诲姞鍒皊et1骞跺垱寤轰綅缃俊鎭痬ap + if (set1.add(split[1])) { + Map<String, Integer> map = new HashMap<>(); + // 瀛樺偍璧峰琛屻�佽捣濮嬪垪銆佺粨鏉熻锛堝綋鍓嶈锛夈�佺粨鏉熷垪锛堝綋鍓嶅垪锛� + map.put("sr", j); + map.put("sc", k); + map.put("er", j + 0); + map.put("ec", k + 0); + maps.put(split[1], map); + } else { + // 濡傛灉宸插瓨鍦紝鍒欐洿鏂扮粨鏉熻鎴栫粨鏉熷垪 + Map<String, Integer> map1 = maps.get(split[1]); + if (j == map1.get("sr")) { + map1.put("ec", map1.get("ec") + 1); + } else if (k == map1.get("sc")) { + map1.put("er", map1.get("er") + 1); } - // 鍒ゆ柇灏忛珮鎶ュ憡杩樻槸澶ф姤鍛� - if (isSmall) { - // 鑾峰彇鍗曞厓鏍� - XWPFTableCell cell = xwpfTables.get(i).getRows().get(j).getTableCells().get(k); - XWPFParagraph paragraph = cell.getParagraphArray(0); - String originalText = paragraph.getText(); - String newText = originalText.split("鈭�")[0]; - List<XWPFRun> runs = paragraph.getRuns(); - for (XWPFRun run : runs) { - run.setText("", 0); // 娓呯┖ run 涓殑鏂囨湰 - } - if (!runs.isEmpty()) { - XWPFRun run = runs.get(0); - run.setText(newText); - - // 澶嶅埗鏍峰紡 - run.setFontFamily(paragraph.getRuns().get(0).getFontFamily()); - run.setFontSize(paragraph.getRuns().get(0).getFontSize()); - run.setBold(paragraph.getRuns().get(0).isBold()); - run.setItalic(paragraph.getRuns().get(0).isItalic()); - run.setUnderline(paragraph.getRuns().get(0).getUnderline()); - run.setColor(paragraph.getRuns().get(0).getColor()); - } - - cell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER); - paragraph.setAlignment(ParagraphAlignment.CENTER); - } else { - // 绉婚櫎鍖呭惈"鈭�"鐨勬钀斤紝骞堕噸鏂拌缃崟鍏冩牸鏂囨湰鍜屾牱寮� - String str = xwpfTables.get(i).getRows().get(j).getTableCells().get(k).getText().split("鈭�")[0]; - xwpfTables.get(i).getRows().get(j).getTableCells().get(k).removeParagraph(0); - xwpfTables.get(i).getRows().get(j).getTableCells().get(k).setText(str); - xwpfTables.get(i).getRows().get(j).getTableCells().get(k).setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER); - xwpfTables.get(i).getRows().get(j).getTableCells().get(k).getParagraphArray(0).setAlignment(ParagraphAlignment.CENTER); + } + // 鍒ゆ柇灏忛珮鎶ュ憡杩樻槸澶ф姤鍛� + if (isSmall) { + // 鑾峰彇鍗曞厓鏍� + XWPFTableCell cell = xwpfTables.get(i).getRows().get(j).getTableCells().get(k); + XWPFParagraph paragraph = cell.getParagraphArray(0); + String originalText = paragraph.getText(); + String newText = originalText.split("鈭�")[0]; + List<XWPFRun> runs = paragraph.getRuns(); + for (XWPFRun run : runs) { + run.setText("", 0); // 娓呯┖ run 涓殑鏂囨湰 } + if (!runs.isEmpty()) { + XWPFRun run = runs.get(0); + run.setText(newText); + + // 澶嶅埗鏍峰紡 + run.setFontFamily(paragraph.getRuns().get(0).getFontFamily()); + run.setFontSize(paragraph.getRuns().get(0).getFontSize()); + run.setBold(paragraph.getRuns().get(0).isBold()); + run.setItalic(paragraph.getRuns().get(0).isItalic()); + run.setUnderline(paragraph.getRuns().get(0).getUnderline()); + run.setColor(paragraph.getRuns().get(0).getColor()); + } + + cell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER); + paragraph.setAlignment(ParagraphAlignment.CENTER); + } else { + // 绉婚櫎鍖呭惈"鈭�"鐨勬钀斤紝骞堕噸鏂拌缃崟鍏冩牸鏂囨湰鍜屾牱寮� + String str = xwpfTables.get(i).getRows().get(j).getTableCells().get(k).getText().split("鈭�")[0]; + xwpfTables.get(i).getRows().get(j).getTableCells().get(k).removeParagraph(0); + xwpfTables.get(i).getRows().get(j).getTableCells().get(k).setText(str); + xwpfTables.get(i).getRows().get(j).getTableCells().get(k).setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER); + xwpfTables.get(i).getRows().get(j).getTableCells().get(k).getParagraphArray(0).setAlignment(ParagraphAlignment.CENTER); } } } + } - // 鍗曞厓鏍兼帓搴�, 閬垮厤鏍煎紡閿欎贡 - List<Map.Entry<String, Map<String, Integer>>> entries = new ArrayList<>(maps.entrySet()); - entries.sort((o1, o2) -> o1.getValue().get("sc") - o2.getValue().get("sc")); + // 鍗曞厓鏍兼帓搴�, 閬垮厤鏍煎紡閿欎贡 + List<Map.Entry<String, Map<String, Integer>>> entries = new ArrayList<>(maps.entrySet()); + entries.sort((o1, o2) -> o1.getValue().get("sc") - o2.getValue().get("sc")); - // 鎸夌収椤哄簭娣诲姞杩涢泦鍚� - List<String> list = new ArrayList<>(); - for (Map.Entry<String, Map<String, Integer>> entry : entries) { - list.add(entry.getKey()); - } + // 鎸夌収椤哄簭娣诲姞杩涢泦鍚� + List<String> list = new ArrayList<>(); + for (Map.Entry<String, Map<String, Integer>> entry : entries) { + list.add(entry.getKey()); + } - for (int a = list.size() - 1; a >= 0; a--) { - Map<String, Integer> v = maps.get(list.get(a)); - for (int j = 0; j < v.get("er") - v.get("sr") + 1; j++) { - if (v.get("ec") > v.get("sc")) { - try { - TableTools.mergeCellsHorizonal(xwpfTables.get(i), v.get("sr") + j, v.get("sc"), v.get("ec")); - } catch (Exception e) { - } - } - } - if (v.get("er") > v.get("sr")) { + for (int a = list.size() - 1; a >= 0; a--) { + Map<String, Integer> v = maps.get(list.get(a)); + for (int j = 0; j < v.get("er") - v.get("sr") + 1; j++) { + if (v.get("ec") > v.get("sc")) { try { - TableTools.mergeCellsVertically(xwpfTables.get(i), v.get("sc"), v.get("sr"), v.get("er")); + TableTools.mergeCellsHorizonal(xwpfTables.get(i), v.get("sr") + j, v.get("sc"), v.get("ec")); } catch (Exception e) { } } } + if (v.get("er") > v.get("sr")) { + try { + TableTools.mergeCellsVertically(xwpfTables.get(i), v.get("sc"), v.get("sr"), v.get("er")); + } catch (Exception e) { + } + } } - FileOutputStream fileOutputStream = new FileOutputStream(path); - document.write(fileOutputStream); - fileOutputStream.close(); - } catch (FileNotFoundException e) { - throw new RuntimeException(e); - } catch (IOException e) { - throw new RuntimeException(e); } + //澶勭悊涓嫳鏂囨崲琛岀殑闂 - try { - FileInputStream stream1 = new FileInputStream(path); - XWPFDocument document1 = new XWPFDocument(stream1); - List<XWPFTable> xwpfTables1 = document1.getTables(); - for (int i = 1; i < xwpfTables1.size() - (deviceList == null ? 1 : 2); i++) { - for (int j = 0; j < xwpfTables1.get(i).getRows().size(); j++) { - for (int k = 0; k < xwpfTables1.get(i).getRows().get(j).getTableCells().size(); k++) { - if (xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).getText().contains("@")) { - if (isSmall) { - // 鑾峰彇鍘熸湁娈佃惤鐨勭涓�涓� XWPFRun - String text = xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).getText(); - XWPFParagraph oldParagraph = xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).getParagraphs().get(0); - XWPFRun oldRun = oldParagraph.getRuns().get(0); - // 淇濆瓨鍘熸湁鏍峰紡 - String fontFamily = oldRun.getFontFamily(); - int fontSize = oldRun.getFontSize(); - boolean isBold = oldRun.isBold(); - boolean isItalic = oldRun.isItalic(); - boolean isUnderline = oldRun.getUnderline() != UnderlinePatterns.NONE; - // 鍒犻櫎鍘熸湁娈佃惤 - xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).removeParagraph(0); - // 娣诲姞鏂版钀� - XWPFParagraph newParagraph = xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).addParagraph(); - XWPFRun newRun = newParagraph.createRun(); - // 搴旂敤淇濆瓨鐨勬牱寮� - newRun.setFontFamily(fontFamily); - newRun.setFontSize(fontSize); - newRun.setBold(isBold); - newRun.setItalic(isItalic); - if (isUnderline) { - newRun.setUnderline(UnderlinePatterns.SINGLE); - } - // 璁剧疆鏂版枃鏈� - String[] split = text.split("@"); - newRun.setText(split[0]); - if (split.length > 1) { - newRun.addBreak(); - newRun.setText(split[1]); - } - // 璁剧疆娈佃惤瀵归綈鏂瑰紡 - newParagraph.setAlignment(ParagraphAlignment.CENTER); - } else { - String text = xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).getText(); - String[] split = text.split("@"); - xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).removeParagraph(0); - XWPFParagraph xwpfParagraph = xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).addParagraph(); - XWPFRun run = xwpfParagraph.createRun(); - run.setText(split[0]); - if (ObjectUtils.isNotNull(split[1])) { - run.addBreak(); - run.setText(split[1]); - } - xwpfParagraph.setAlignment(ParagraphAlignment.CENTER); + + List<XWPFTable> xwpfTables1 = document.getTables(); + for (int i = 1; i < xwpfTables1.size(); i++) { + for (int j = 0; j < xwpfTables1.get(i).getRows().size(); j++) { + for (int k = 0; k < xwpfTables1.get(i).getRows().get(j).getTableCells().size(); k++) { + if (xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).getText().contains("@")) { + if (isSmall) { + // 鑾峰彇鍘熸湁娈佃惤鐨勭涓�涓� XWPFRun + String text = xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).getText(); + XWPFParagraph oldParagraph = xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).getParagraphs().get(0); + XWPFRun oldRun = oldParagraph.getRuns().get(0); + // 淇濆瓨鍘熸湁鏍峰紡 + String fontFamily = oldRun.getFontFamily(); + int fontSize = oldRun.getFontSize(); + boolean isBold = oldRun.isBold(); + boolean isItalic = oldRun.isItalic(); + boolean isUnderline = oldRun.getUnderline() != UnderlinePatterns.NONE; + // 鍒犻櫎鍘熸湁娈佃惤 + xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).removeParagraph(0); + // 娣诲姞鏂版钀� + XWPFParagraph newParagraph = xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).addParagraph(); + XWPFRun newRun = newParagraph.createRun(); + // 搴旂敤淇濆瓨鐨勬牱寮� + newRun.setFontFamily(fontFamily); + newRun.setFontSize(fontSize); + newRun.setBold(isBold); + newRun.setItalic(isItalic); + if (isUnderline) { + newRun.setUnderline(UnderlinePatterns.SINGLE); } + // 璁剧疆鏂版枃鏈� + String[] split = text.split("@"); + newRun.setText(split[0]); + if (split.length > 1) { + newRun.addBreak(); + newRun.setText(split[1]); + } + // 璁剧疆娈佃惤瀵归綈鏂瑰紡 + newParagraph.setAlignment(ParagraphAlignment.CENTER); + } else { + String text = xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).getText(); + String[] split = text.split("@"); + xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).removeParagraph(0); + XWPFParagraph xwpfParagraph = xwpfTables1.get(i).getRows().get(j).getTableCells().get(k).addParagraph(); + XWPFRun run = xwpfParagraph.createRun(); + run.setText(split[0]); + if (ObjectUtils.isNotNull(split[1])) { + run.addBreak(); + run.setText(split[1]); + } + xwpfParagraph.setAlignment(ParagraphAlignment.CENTER); } } } } - FileOutputStream fileOutputStream1 = new FileOutputStream(path); - document1.write(fileOutputStream1); - fileOutputStream1.close(); - } catch (FileNotFoundException e) { - throw new RuntimeException(e); - } catch (IOException e) { - throw new RuntimeException(e); } } diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java index 87188f4..30bbed5 100644 --- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java +++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java @@ -444,16 +444,6 @@ Map<String, Object> map = new HashMap<>(); InsOrder insOrder = insOrderMapper.selectById(id); List<SampleProductDto> list = insSampleMapper.getInsOrderAndSample(id, laboratory); - for (SampleProductDto sampleProductDto : list) { - List<Integer> ids = sampleProductDto.getInsProduct().stream().map(InsProduct::getId).collect(Collectors.toList()); - List<InsProductUser> insProductUsers = insProductUserMapper.selectList(Wrappers.<InsProductUser>lambdaQuery() - .in(InsProductUser::getInsProductId, ids)); - if (CollectionUtils.isNotEmpty(insProductUsers)) { - List<Integer> userIds = insProductUsers.stream().map(InsProductUser::getCreateUser).distinct().collect(Collectors.toList()); - String collect = userMapper.selectBatchIds(userIds).stream().map(User::getName).collect(Collectors.joining(",")); - sampleProductDto.setCheckName(collect); - } - } map.put("insOrder", insOrder); map.put("sampleProduct", list); //鏌ヨ鎵�鏈夎褰曟ā鐗堝幓閲� diff --git a/inspect-server/src/main/resources/mapper/InsOrderMapper.xml b/inspect-server/src/main/resources/mapper/InsOrderMapper.xml index 2cc6e8d..2eb8e88 100644 --- a/inspect-server/src/main/resources/mapper/InsOrderMapper.xml +++ b/inspect-server/src/main/resources/mapper/InsOrderMapper.xml @@ -241,7 +241,7 @@ latest_traceability from device where device.management_number in - <foreach collection="names" index="index" open="(" separator="," close=")" item="val"> + <foreach collection="managementNumbers" index="index" open="(" separator="," close=")" item="val"> #{val} </foreach> </select> diff --git a/inspect-server/src/main/resources/static/report-template.docx b/inspect-server/src/main/resources/static/report-template.docx index 446e3f9..9301eeb 100644 --- a/inspect-server/src/main/resources/static/report-template.docx +++ b/inspect-server/src/main/resources/static/report-template.docx Binary files differ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java index 7a63aa3..affa7b7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java @@ -14,7 +14,7 @@ { public static void main(String[] args) { -// System.setProperty("spring.devtools.restart.enabled", "false"); SpringApplication.run(RuoYiApplication.class, args); + System.out.println("<=====================>LIMS绯荤粺鍚姩鎴愬姛<=====================>"); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java index 3102a89..61914fa 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java @@ -1,6 +1,8 @@ package com.ruoyi.web.controller.system; import java.util.List; + +import com.ruoyi.common.core.domain.TreeSelect; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; @@ -72,6 +74,8 @@ public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) { List<SysMenu> menus = menuService.selectMenuList(getUserId()); + // 娣诲姞鍙湅鎴� + menuService.addIsRersonal(menus, roleId); AjaxResult ajax = AjaxResult.success(); ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId)); ajax.put("menus", menuService.buildMenuTreeSelect(menus)); diff --git a/ruoyi-admin/src/main/resources/banner.txt b/ruoyi-admin/src/main/resources/banner.txt index 0931cb8..69ed967 100644 --- a/ruoyi-admin/src/main/resources/banner.txt +++ b/ruoyi-admin/src/main/resources/banner.txt @@ -1,24 +1,7 @@ -Application Version: ${ruoyi.version} -Spring Boot Version: ${spring-boot.version} -//////////////////////////////////////////////////////////////////// -// _ooOoo_ // -// o8888888o // -// 88" . "88 // -// (| ^_^ |) // -// O\ = /O // -// ____/`---'\____ // -// .' \\| |// `. // -// / \\||| : |||// \ // -// / _||||| -:- |||||- \ // -// | | \\\ - /// | | // -// | \_| ''\---/'' | | // -// \ .-\__ `-` ___/-. / // -// ___`. .' /--.--\ `. . ___ // -// ."" '< `.___\_<|>_/___.' >'"". // -// | | : `- \`.;`\ _ /`;.`/ - ` : | | // -// \ \ `-. \_ __\ /__ _/ .-` / / // -// ========`-.____`-.___\_____/___.-`____.-'======== // -// `=---=' // -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // -// 浣涚淇濅綉 姘镐笉瀹曟満 姘告棤BUG // -//////////////////////////////////////////////////////////////////// \ No newline at end of file + +鈻堚枅鈥� 鈻堚枅鈥佲枅鈻堚枅鈥� 鈻堚枅鈻堚�佲枅鈻堚枅鈻堚枅鈻堚枅鈥� +鈻堚枅鈥� 鈻堚枅鈥佲枅鈻堚枅鈻堚�� 鈻堚枅鈻堚枅鈥佲枅鈻堚�佲�佲�佲�佲�佲�� +鈻堚枅鈥� 鈻堚枅鈥佲枅鈻堚�佲枅鈻堚枅鈻堚�佲枅鈻堚�佲枅鈻堚枅鈻堚枅鈻堚枅鈥� +鈻堚枅鈥� 鈻堚枅鈥佲枅鈻堚�佲�佲枅鈻堚�佲�佲枅鈻堚�佲�佲�佲�佲�佲�佲枅鈻堚�� +鈻堚枅鈻堚枅鈻堚枅鈻堚�佲枅鈻堚�佲枅鈻堚�� 鈥佲�佲�� 鈻堚枅鈥佲枅鈻堚枅鈻堚枅鈻堚枅鈥� +鈥佲�佲�佲�佲�佲�佲�佲�佲�佲�佲�佲�佲�佲�� 鈥佲�佲�佲�佲�佲�佲�佲�佲�佲�佲�� diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java index e4785df..33818ce 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/TreeSelect.java @@ -27,6 +27,9 @@ /** 鏄惁鍙互閫夋嫨浠呯湅鎴�, 0:鍚�, 1:鏄� */ private Integer isRersonalButton; + /** 鏄惁纭鍙湅鎴�, 0:鍚�, 1:鏄� */ + private Integer isRersonal; + /** 鑺傜偣绂佺敤 */ private boolean disabled = false; @@ -52,6 +55,7 @@ this.id = menu.getMenuId(); this.label = menu.getMenuName(); this.isRersonalButton = menu.getIsRersonalButton(); + this.isRersonal = menu.getIsRersonal(); this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); } @@ -95,7 +99,7 @@ this.children = children; } - public Integer geIsRersonalButton() + public Integer getIsRersonalButton() { return isRersonalButton; } @@ -104,4 +108,14 @@ { this.isRersonalButton = isRersonalButton; } + + public Integer getIsRersonal() + { + return isRersonal; + } + + public void setIsRersonal(Integer isRersonalButton) + { + this.isRersonal = isRersonal; + } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java index eb77b98..ac1b3fc 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysMenu.java @@ -69,6 +69,10 @@ /** 鏄惁鍙互閫夋嫨浠呯湅鎴�, 0:鍚�, 1:鏄� */ private Integer isRersonalButton; + + /** 浠呯湅鎴�, 0:鍚�, 1:鏄� */ + private Integer isRersonal; + /** 瀛愯彍鍗� */ private List<SysMenu> children = new ArrayList<SysMenu>(); @@ -249,6 +253,16 @@ this.isRersonalButton = isRersonalButton; } + public Integer getIsRersonal() + { + return isRersonal; + } + + public void setIsRersonal(Integer isRersonal) + { + this.isRersonal = isRersonal; + } + public List<SysMenu> getChildren() { return children; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java index 488d49c..eb339b3 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java @@ -12,7 +12,7 @@ /** * 瑙掕壊琛� sys_role - * + * * @author ruoyi */ public class SysRole extends BaseEntity @@ -57,6 +57,9 @@ /** 鑿滃崟缁� */ private Long[] menuIds; + + /** 鍙湅鎴戣彍鍗曠粍 */ + private Long[] isRersonalMenuIds; /** 閮ㄩ棬缁勶紙鏁版嵁鏉冮檺锛� */ private Long[] deptIds; @@ -199,6 +202,17 @@ this.menuIds = menuIds; } + + public Long[] getIsRersonalMenuIds() + { + return isRersonalMenuIds; + } + + public void setIsRersonalMenuIds(Long[] isRersonalMenuIds) + { + this.isRersonalMenuIds = isRersonalMenuIds; + } + public Long[] getDeptIds() { return deptIds; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/GZipUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/GZipUtil.java new file mode 100644 index 0000000..da8cc61 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/GZipUtil.java @@ -0,0 +1,63 @@ +package com.ruoyi.common.utils; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.util.zip.GZIPInputStream; +import java.util.zip.GZIPOutputStream; + +/** + * 鍘嬬缉瑙e帇宸ュ叿绫� + */ +public class GZipUtil { + + + /** + * 鍘嬬缉 + * @param str + * @return + */ + public static String compress(String str) { + if (str == null || str.trim().length() == 0) { + return null; + } + + try (ByteArrayOutputStream out = new ByteArrayOutputStream(); + GZIPOutputStream gzip = new GZIPOutputStream(out)) { + gzip.write(str.getBytes("utf-8")); + gzip.close(); + + return new String(out.toByteArray(), "iso-8859-1"); + } catch (Exception e) { + e.printStackTrace(); + return str; + } + + } + + /** + * 瑙e帇 + * @param str + * @return + */ + public static String uncompress(String str) { + if (str == null || str.trim().length() == 0) { + return null; + } + + try (ByteArrayOutputStream out = new ByteArrayOutputStream(); + ByteArrayInputStream in = new ByteArrayInputStream(str.getBytes("iso-8859-1"))){ + GZIPInputStream ungzip = new GZIPInputStream(in); + byte[] buffer = new byte[1024]; + int n; + while ((n = ungzip.read(buffer)) >= 0) { + out.write(buffer, 0, n); + } + + return new String(out.toByteArray(), "utf-8"); + } catch (Exception e) { + e.printStackTrace(); + return str; + } + + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleMenu.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleMenu.java index de10a74..2248916 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleMenu.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysRoleMenu.java @@ -5,16 +5,19 @@ /** * 瑙掕壊鍜岃彍鍗曞叧鑱� sys_role_menu - * + * * @author ruoyi */ public class SysRoleMenu { /** 瑙掕壊ID */ private Long roleId; - + /** 鑿滃崟ID */ private Long menuId; + + /** 鏄惁鍙湅鎴�0鍚�, 1鏄� */ + private Integer isRersonal; public Long getRoleId() { @@ -36,6 +39,16 @@ this.menuId = menuId; } + public Integer getIsRersonal() + { + return isRersonal; + } + + public void setIsRersonal(Integer isRersonal) + { + this.isRersonal = isRersonal; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java index 9551bd1..48a71da 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysRoleMenuMapper.java @@ -51,4 +51,11 @@ * @return */ SysRoleVo selectRoleMenu(@Param("permsName") String permsName, @Param("userId") Long userId); + + /** + * 鏌ヨ鍙湅鎴戣彍鍗昳d + * @param roleId + * @return + */ + List<Long> selectIsRersonalMenu(@Param("roleId") Long roleId); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java index 7d60696..ec0278c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysMenuService.java @@ -8,14 +8,14 @@ /** * 鑿滃崟 涓氬姟灞� - * + * * @author ruoyi */ public interface ISysMenuService { /** * 鏍规嵁鐢ㄦ埛鏌ヨ绯荤粺鑿滃崟鍒楄〃 - * + * * @param userId 鐢ㄦ埛ID * @return 鑿滃崟鍒楄〃 */ @@ -23,7 +23,7 @@ /** * 鏍规嵁鐢ㄦ埛鏌ヨ绯荤粺鑿滃崟鍒楄〃 - * + * * @param menu 鑿滃崟淇℃伅 * @param userId 鐢ㄦ埛ID * @return 鑿滃崟鍒楄〃 @@ -32,7 +32,7 @@ /** * 鏍规嵁鐢ㄦ埛ID鏌ヨ鏉冮檺 - * + * * @param userId 鐢ㄦ埛ID * @return 鏉冮檺鍒楄〃 */ @@ -40,7 +40,7 @@ /** * 鏍规嵁瑙掕壊ID鏌ヨ鏉冮檺 - * + * * @param roleId 瑙掕壊ID * @return 鏉冮檺鍒楄〃 */ @@ -48,7 +48,7 @@ /** * 鏍规嵁鐢ㄦ埛ID鏌ヨ鑿滃崟鏍戜俊鎭� - * + * * @param userId 鐢ㄦ埛ID * @return 鑿滃崟鍒楄〃 */ @@ -56,7 +56,7 @@ /** * 鏍规嵁瑙掕壊ID鏌ヨ鑿滃崟鏍戜俊鎭� - * + * * @param roleId 瑙掕壊ID * @return 閫変腑鑿滃崟鍒楄〃 */ @@ -64,7 +64,7 @@ /** * 鏋勫缓鍓嶇璺敱鎵�闇�瑕佺殑鑿滃崟 - * + * * @param menus 鑿滃崟鍒楄〃 * @return 璺敱鍒楄〃 */ @@ -72,7 +72,7 @@ /** * 鏋勫缓鍓嶇鎵�闇�瑕佹爲缁撴瀯 - * + * * @param menus 鑿滃崟鍒楄〃 * @return 鏍戠粨鏋勫垪琛� */ @@ -80,7 +80,7 @@ /** * 鏋勫缓鍓嶇鎵�闇�瑕佷笅鎷夋爲缁撴瀯 - * + * * @param menus 鑿滃崟鍒楄〃 * @return 涓嬫媺鏍戠粨鏋勫垪琛� */ @@ -88,7 +88,7 @@ /** * 鏍规嵁鑿滃崟ID鏌ヨ淇℃伅 - * + * * @param menuId 鑿滃崟ID * @return 鑿滃崟淇℃伅 */ @@ -96,7 +96,7 @@ /** * 鏄惁瀛樺湪鑿滃崟瀛愯妭鐐� - * + * * @param menuId 鑿滃崟ID * @return 缁撴灉 true 瀛樺湪 false 涓嶅瓨鍦� */ @@ -104,7 +104,7 @@ /** * 鏌ヨ鑿滃崟鏄惁瀛樺湪瑙掕壊 - * + * * @param menuId 鑿滃崟ID * @return 缁撴灉 true 瀛樺湪 false 涓嶅瓨鍦� */ @@ -112,7 +112,7 @@ /** * 鏂板淇濆瓨鑿滃崟淇℃伅 - * + * * @param menu 鑿滃崟淇℃伅 * @return 缁撴灉 */ @@ -120,7 +120,7 @@ /** * 淇敼淇濆瓨鑿滃崟淇℃伅 - * + * * @param menu 鑿滃崟淇℃伅 * @return 缁撴灉 */ @@ -128,7 +128,7 @@ /** * 鍒犻櫎鑿滃崟绠$悊淇℃伅 - * + * * @param menuId 鑿滃崟ID * @return 缁撴灉 */ @@ -136,9 +136,16 @@ /** * 鏍¢獙鑿滃崟鍚嶇О鏄惁鍞竴 - * + * * @param menu 鑿滃崟淇℃伅 * @return 缁撴灉 */ public boolean checkMenuNameUnique(SysMenu menu); + + /** + * 娣诲姞鍙湅鎴� + * @param menus + * @param roleId + */ + void addIsRersonal(List<SysMenu> menus, Long roleId); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java index 78a7830..9c4a707 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java @@ -27,7 +27,7 @@ /** * 鑿滃崟 涓氬姟灞傚鐞� - * + * * @author ruoyi */ @Service @@ -46,7 +46,7 @@ /** * 鏍规嵁鐢ㄦ埛鏌ヨ绯荤粺鑿滃崟鍒楄〃 - * + * * @param userId 鐢ㄦ埛ID * @return 鑿滃崟鍒楄〃 */ @@ -58,7 +58,7 @@ /** * 鏌ヨ绯荤粺鑿滃崟鍒楄〃 - * + * * @param menu 鑿滃崟淇℃伅 * @return 鑿滃崟鍒楄〃 */ @@ -81,7 +81,7 @@ /** * 鏍规嵁鐢ㄦ埛ID鏌ヨ鏉冮檺 - * + * * @param userId 鐢ㄦ埛ID * @return 鏉冮檺鍒楄〃 */ @@ -102,7 +102,7 @@ /** * 鏍规嵁瑙掕壊ID鏌ヨ鏉冮檺 - * + * * @param roleId 瑙掕壊ID * @return 鏉冮檺鍒楄〃 */ @@ -123,7 +123,7 @@ /** * 鏍规嵁鐢ㄦ埛ID鏌ヨ鑿滃崟 - * + * * @param userId 鐢ㄦ埛鍚嶇О * @return 鑿滃崟鍒楄〃 */ @@ -144,7 +144,7 @@ /** * 鏍规嵁瑙掕壊ID鏌ヨ鑿滃崟鏍戜俊鎭� - * + * * @param roleId 瑙掕壊ID * @return 閫変腑鑿滃崟鍒楄〃 */ @@ -157,7 +157,7 @@ /** * 鏋勫缓鍓嶇璺敱鎵�闇�瑕佺殑鑿滃崟 - * + * * @param menus 鑿滃崟鍒楄〃 * @return 璺敱鍒楄〃 */ @@ -215,7 +215,7 @@ /** * 鏋勫缓鍓嶇鎵�闇�瑕佹爲缁撴瀯 - * + * * @param menus 鑿滃崟鍒楄〃 * @return 鏍戠粨鏋勫垪琛� */ @@ -243,7 +243,7 @@ /** * 鏋勫缓鍓嶇鎵�闇�瑕佷笅鎷夋爲缁撴瀯 - * + * * @param menus 鑿滃崟鍒楄〃 * @return 涓嬫媺鏍戠粨鏋勫垪琛� */ @@ -256,7 +256,7 @@ /** * 鏍规嵁鑿滃崟ID鏌ヨ淇℃伅 - * + * * @param menuId 鑿滃崟ID * @return 鑿滃崟淇℃伅 */ @@ -268,7 +268,7 @@ /** * 鏄惁瀛樺湪鑿滃崟瀛愯妭鐐� - * + * * @param menuId 鑿滃崟ID * @return 缁撴灉 */ @@ -281,7 +281,7 @@ /** * 鏌ヨ鑿滃崟浣跨敤鏁伴噺 - * + * * @param menuId 鑿滃崟ID * @return 缁撴灉 */ @@ -294,7 +294,7 @@ /** * 鏂板淇濆瓨鑿滃崟淇℃伅 - * + * * @param menu 鑿滃崟淇℃伅 * @return 缁撴灉 */ @@ -306,7 +306,7 @@ /** * 淇敼淇濆瓨鑿滃崟淇℃伅 - * + * * @param menu 鑿滃崟淇℃伅 * @return 缁撴灉 */ @@ -318,7 +318,7 @@ /** * 鍒犻櫎鑿滃崟绠$悊淇℃伅 - * + * * @param menuId 鑿滃崟ID * @return 缁撴灉 */ @@ -330,7 +330,7 @@ /** * 鏍¢獙鑿滃崟鍚嶇О鏄惁鍞竴 - * + * * @param menu 鑿滃崟淇℃伅 * @return 缁撴灉 */ @@ -347,8 +347,25 @@ } /** + * 娣诲姞鍙湅鎴� + * @param menus + * @param roleId + */ + @Override + public void addIsRersonal(List<SysMenu> menus, Long roleId) { + // 鏌ヨ鍙湅鎴戣彍鍗昳d + List<Long> menuIds = roleMenuMapper.selectIsRersonalMenu(roleId); + for (SysMenu menu : menus) { + if (menuIds.contains(menu.getMenuId())) { + menu.setIsRersonal(1); + } + } + + } + + /** * 鑾峰彇璺敱鍚嶇О - * + * * @param menu 鑿滃崟淇℃伅 * @return 璺敱鍚嶇О */ @@ -364,7 +381,7 @@ /** * 鑾峰彇璺敱鍚嶇О锛屽娌℃湁閰嶇疆璺敱鍚嶇О鍒欏彇璺敱鍦板潃 - * + * * @param routerName 璺敱鍚嶇О * @param path 璺敱鍦板潃 * @return 璺敱鍚嶇О锛堥┘宄版牸寮忥級 @@ -377,7 +394,7 @@ /** * 鑾峰彇璺敱鍦板潃 - * + * * @param menu 鑿滃崟淇℃伅 * @return 璺敱鍦板潃 */ @@ -405,7 +422,7 @@ /** * 鑾峰彇缁勪欢淇℃伅 - * + * * @param menu 鑿滃崟淇℃伅 * @return 缁勪欢淇℃伅 */ @@ -429,7 +446,7 @@ /** * 鏄惁涓鸿彍鍗曞唴閮ㄨ烦杞� - * + * * @param menu 鑿滃崟淇℃伅 * @return 缁撴灉 */ @@ -441,7 +458,7 @@ /** * 鏄惁涓哄唴閾剧粍浠� - * + * * @param menu 鑿滃崟淇℃伅 * @return 缁撴灉 */ @@ -452,7 +469,7 @@ /** * 鏄惁涓簆arent_view缁勪欢 - * + * * @param menu 鑿滃崟淇℃伅 * @return 缁撴灉 */ @@ -463,7 +480,7 @@ /** * 鏍规嵁鐖惰妭鐐圭殑ID鑾峰彇鎵�鏈夊瓙鑺傜偣 - * + * * @param list 鍒嗙被琛� * @param parentId 浼犲叆鐨勭埗鑺傜偣ID * @return String @@ -486,7 +503,7 @@ /** * 閫掑綊鍒楄〃 - * + * * @param list 鍒嗙被琛� * @param t 瀛愯妭鐐� */ @@ -532,7 +549,7 @@ /** * 鍐呴摼鍩熷悕鐗规畩瀛楃鏇挎崲 - * + * * @return 鏇挎崲鍚庣殑鍐呴摼鍩熷悕 */ public String innerLinkReplaceEach(String path) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java index e432bb1..b8b8a86 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java @@ -5,6 +5,9 @@ import java.util.HashSet; import java.util.List; import java.util.Set; + +import com.baomidou.mybatisplus.core.toolkit.ArrayUtils; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -27,7 +30,7 @@ /** * 瑙掕壊 涓氬姟灞傚鐞� - * + * * @author ruoyi */ @Service @@ -47,7 +50,7 @@ /** * 鏍规嵁鏉′欢鍒嗛〉鏌ヨ瑙掕壊鏁版嵁 - * + * * @param role 瑙掕壊淇℃伅 * @return 瑙掕壊鏁版嵁闆嗗悎淇℃伅 */ @@ -60,7 +63,7 @@ /** * 鏍规嵁鐢ㄦ埛ID鏌ヨ瑙掕壊 - * + * * @param userId 鐢ㄦ埛ID * @return 瑙掕壊鍒楄〃 */ @@ -85,7 +88,7 @@ /** * 鏍规嵁鐢ㄦ埛ID鏌ヨ鏉冮檺 - * + * * @param userId 鐢ㄦ埛ID * @return 鏉冮檺鍒楄〃 */ @@ -106,7 +109,7 @@ /** * 鏌ヨ鎵�鏈夎鑹� - * + * * @return 瑙掕壊鍒楄〃 */ @Override @@ -117,7 +120,7 @@ /** * 鏍规嵁鐢ㄦ埛ID鑾峰彇瑙掕壊閫夋嫨妗嗗垪琛� - * + * * @param userId 鐢ㄦ埛ID * @return 閫変腑瑙掕壊ID鍒楄〃 */ @@ -129,7 +132,7 @@ /** * 閫氳繃瑙掕壊ID鏌ヨ瑙掕壊 - * + * * @param roleId 瑙掕壊ID * @return 瑙掕壊瀵硅薄淇℃伅 */ @@ -141,7 +144,7 @@ /** * 鏍¢獙瑙掕壊鍚嶇О鏄惁鍞竴 - * + * * @param role 瑙掕壊淇℃伅 * @return 缁撴灉 */ @@ -159,7 +162,7 @@ /** * 鏍¢獙瑙掕壊鏉冮檺鏄惁鍞竴 - * + * * @param role 瑙掕壊淇℃伅 * @return 缁撴灉 */ @@ -177,7 +180,7 @@ /** * 鏍¢獙瑙掕壊鏄惁鍏佽鎿嶄綔 - * + * * @param role 瑙掕壊淇℃伅 */ @Override @@ -191,7 +194,7 @@ /** * 鏍¢獙瑙掕壊鏄惁鏈夋暟鎹潈闄� - * + * * @param roleIds 瑙掕壊id */ @Override @@ -214,7 +217,7 @@ /** * 閫氳繃瑙掕壊ID鏌ヨ瑙掕壊浣跨敤鏁伴噺 - * + * * @param roleId 瑙掕壊ID * @return 缁撴灉 */ @@ -226,7 +229,7 @@ /** * 鏂板淇濆瓨瑙掕壊淇℃伅 - * + * * @param role 瑙掕壊淇℃伅 * @return 缁撴灉 */ @@ -241,7 +244,7 @@ /** * 淇敼淇濆瓨瑙掕壊淇℃伅 - * + * * @param role 瑙掕壊淇℃伅 * @return 缁撴灉 */ @@ -258,7 +261,7 @@ /** * 淇敼瑙掕壊鐘舵�� - * + * * @param role 瑙掕壊淇℃伅 * @return 缁撴灉 */ @@ -270,7 +273,7 @@ /** * 淇敼鏁版嵁鏉冮檺淇℃伅 - * + * * @param role 瑙掕壊淇℃伅 * @return 缁撴灉 */ @@ -288,7 +291,7 @@ /** * 鏂板瑙掕壊鑿滃崟淇℃伅 - * + * * @param role 瑙掕壊瀵硅薄 */ public int insertRoleMenu(SysRole role) @@ -301,7 +304,16 @@ SysRoleMenu rm = new SysRoleMenu(); rm.setRoleId(role.getRoleId()); rm.setMenuId(menuId); + // 鍒ゆ柇鏄惁鏈夊彧鐪嬫垜鏉冮檺 + if (ArrayUtils.isNotEmpty(role.getIsRersonalMenuIds())) { + for (Long isRersonalMenuId : role.getIsRersonalMenuIds()) { + if (isRersonalMenuId.equals(menuId)) { + rm.setIsRersonal(1); + } + } + } list.add(rm); + } if (list.size() > 0) { @@ -336,7 +348,7 @@ /** * 閫氳繃瑙掕壊ID鍒犻櫎瑙掕壊 - * + * * @param roleId 瑙掕壊ID * @return 缁撴灉 */ @@ -353,7 +365,7 @@ /** * 鎵归噺鍒犻櫎瑙掕壊淇℃伅 - * + * * @param roleIds 闇�瑕佸垹闄ょ殑瑙掕壊ID * @return 缁撴灉 */ @@ -380,7 +392,7 @@ /** * 鍙栨秷鎺堟潈鐢ㄦ埛瑙掕壊 - * + * * @param userRole 鐢ㄦ埛鍜岃鑹插叧鑱斾俊鎭� * @return 缁撴灉 */ @@ -392,7 +404,7 @@ /** * 鎵归噺鍙栨秷鎺堟潈鐢ㄦ埛瑙掕壊 - * + * * @param roleId 瑙掕壊ID * @param userIds 闇�瑕佸彇娑堟巿鏉冪殑鐢ㄦ埛鏁版嵁ID * @return 缁撴灉 @@ -405,7 +417,7 @@ /** * 鎵归噺閫夋嫨鎺堟潈鐢ㄦ埛瑙掕壊 - * + * * @param roleId 瑙掕壊ID * @param userIds 闇�瑕佹巿鏉冪殑鐢ㄦ埛鏁版嵁ID * @return 缁撴灉 diff --git a/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml index 2f71cd4..72e5b85 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml @@ -26,6 +26,14 @@ group by sm.menu_id </select> + <!-- 鏌ヨ鍙湅鎴戣彍鍗昳d --> + <select id="selectIsRersonalMenu" resultType="java.lang.Long"> + select menu_id + from sys_role_menu + where role_id = #{roleId} + and is_rersonal = 1 + </select> + <delete id="deleteRoleMenuByRoleId" parameterType="Long"> delete from sys_role_menu where role_id=#{roleId} </delete> @@ -38,9 +46,9 @@ </delete> <insert id="batchRoleMenu"> - insert into sys_role_menu(role_id, menu_id) values + insert into sys_role_menu(role_id, menu_id, is_rersonal) values <foreach item="item" index="index" collection="list" separator=","> - (#{item.roleId},#{item.menuId}) + (#{item.roleId},#{item.menuId},#{item.isRersonal}) </foreach> </insert> -- Gitblit v1.9.3