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 = "å¤å¶åå§è®°å½æ¨¡æ¿") 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 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); } } 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)); } 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)); } 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)); } 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)); } 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)); } 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)); } 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)); } 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); } 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); 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; 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) { // è·åå° æ£éªé¡¹åç±»+æ£éªé¡¹+æ£éªåé¡¹çæ¼æ¥,å¦ææ¨¡æ¿éçä¿¡æ¯è·æ¥å£è¿åçæ£éªé¡¹ä¿¡æ¯è½å¤å¹é åå±ç¤ºåºæ¥ // 循ç¯è¡æ°å¤ææ¯å¦ 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) { // 夿æ¯å¦æmcåå¹¶åå æ ¼ 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为nullï¼åé¢å¤è·³è¿ç¬¬äºä¸ªï¼ for (int i = 1; i < xwpfTables.size() - (deviceList == null ? 1 : 2); i++) { // å建ä¸ä¸ªHashSetæ¥åå¨å¯ä¸çå符串ï¼è¿éåºäº"â"åå²åç第äºé¨åï¼ Set<String> set1 = new HashSet<>(); // å建ä¸ä¸ªHashMapæ¥å卿¯ä¸ªå¯ä¸å符串åå ¶å¯¹åºçåå æ ¼ä½ç½®ä¿¡æ¯ 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("â"); // 妿åå²åç第äºé¨åæ¯æ°çï¼å³ä¹åæªåºç°è¿ï¼ï¼åæ·»å å°set1å¹¶å建ä½ç½®ä¿¡æ¯map 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++) { // å建ä¸ä¸ªHashSetæ¥åå¨å¯ä¸çå符串ï¼è¿éåºäº"â"åå²åç第äºé¨åï¼ Set<String> set1 = new HashSet<>(); // å建ä¸ä¸ªHashMapæ¥å卿¯ä¸ªå¯ä¸å符串åå ¶å¯¹åºçåå æ ¼ä½ç½®ä¿¡æ¯ 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("â"); // 妿åå²åç第äºé¨åæ¯æ°çï¼å³ä¹åæªåºç°è¿ï¼ï¼åæ·»å å°set1å¹¶å建ä½ç½®ä¿¡æ¯map 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); } } 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); //æ¥è¯¢ææè®°å½æ¨¡çå»é 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> inspect-server/src/main/resources/static/report-template.docxBinary files differ
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ç³»ç»å¯å¨æå<=====================>"); } } 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)); 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 // //////////////////////////////////////////////////////////////////// âââ âââââââ ââââââââââââ âââ ââââââââ âââââââââââââ âââ ââââââââââââââââââââââ âââ ââââââââââââââââââââââ ââââââââââââââ âââ âââââââââââ ââââââââââââââ âââââââââââ 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; } } 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; 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; 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; /** * å缩解åå·¥å ·ç±» */ 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; } } /** * è§£å * @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; } } } 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) 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); /** * æ¥è¯¢åªçæèåid * @param roleId * @return */ List<Long> selectIsRersonalMenu(@Param("roleId") Long roleId); } 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); } 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) { // æ¥è¯¢åªçæèåid 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 @@ /** * æ¯å¦ä¸ºparent_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) 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 ç»æ ruoyi-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml
@@ -26,6 +26,14 @@ group by sm.menu_id </select> <!-- æ¥è¯¢åªçæèåid --> <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>