cnas-server/src/main/java/com/yuanchu/mom/controller/CertificationController.java
@@ -28,7 +28,6 @@ @ApiOperation(value = "èµè´¨è¯´æ-æ¥è¯¢èµè´¨æç»å表") @PostMapping("/getCertificationDetail") @ValueAuth public Result getCertificationDetail(@RequestBody Map<String, Object> data) throws Exception { Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class); Certification certification = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), Certification.class); cnas-server/src/main/java/com/yuanchu/mom/controller/DeviceController.java
@@ -118,14 +118,18 @@ return Result.success(deviceService.selectDevicePrincipal()); } @ApiOperation(value = "éè¿è®¾å¤åç±»è·å设å¤å表") @ApiOperation(value = "éè¿é¡¹ç®è·å设å¤å表") @PostMapping("/selectDeviceByCategory") @ValueAuth @ApiImplicitParams({ @ApiImplicitParam(name = "category", value = "设å¤åç±»", dataTypeClass = String.class), }) public Result selectDeviceByCategory(String category) { return Result.success(deviceService.selectDeviceByCategory(category)); public Result selectDeviceByCategory(String inspectionItem, String inspectionItemSubclass) { return Result.success(deviceService.selectDeviceByCategory(inspectionItem, inspectionItemSubclass)); } @ApiOperation(value = "éè¿è®¾å¤ç¼å·è·å设å¤å表") @PostMapping("/selectDeviceByCode") @ValueAuth public Result selectDeviceByCode(String code) { return Result.success(deviceService.selectDeviceByCode(code)); } } cnas-server/src/main/java/com/yuanchu/mom/pojo/Certification.java
@@ -39,7 +39,6 @@ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime firstTime; @ValueTableShow(7) @ApiModelProperty(value = "æè¿é¢åæ¶é´") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime recentlyTime; @@ -54,20 +53,19 @@ private Integer createUser; @ValueTableShow(9) @ApiModelProperty(value = "å建人") @ApiModelProperty(value = "æ´æ°äºº") private String createUserName; @ApiModelProperty(value = "ä¿®æ¹äººid") @TableField(fill = FieldFill.INSERT_UPDATE) private Integer updateUser; @ValueTableShow(10) @ApiModelProperty(value = "å建æ¶é´") @ValueTableShow(7) @ApiModelProperty(value = "æè¿é¢åæ¶é´") @TableField(fill = FieldFill.INSERT) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime createTime; @ApiModelProperty(value = "æ´æ°æ¶é´") @TableField(fill = FieldFill.INSERT_UPDATE) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime updateTime; cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureTestObject.java
@@ -25,9 +25,20 @@ private Integer id; @ValueTableShow(1) @ApiModelProperty(value = "æ ·ååç§°") @ApiModelProperty(value = "åºæ") private Integer laboratory; @TableField(exist = false) private Integer laboratory_id; @ValueTableShow(1) @ApiModelProperty(value = "æ£éªå¯¹è±¡") private String specimenName; @ValueTableShow(2) @ApiModelProperty(value = "对象代å·") private String code; @ApiModelProperty(value = "å建人id") @TableField(fill = FieldFill.INSERT) private Integer createUser; cnas-server/src/main/java/com/yuanchu/mom/service/DeviceService.java
@@ -29,7 +29,9 @@ List<Device> selectDevicePrincipal(); List<Device> selectDeviceByCategory(String category); List<Device> selectDeviceByCategory(String inspectionItem, String inspectionItemSubclass); Device selectDeviceByCode(String code); } cnas-server/src/main/java/com/yuanchu/mom/service/impl/DeviceServiceImpl.java
@@ -1,5 +1,6 @@ package com.yuanchu.mom.service.impl; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -8,12 +9,15 @@ import com.yuanchu.mom.common.PrintChina; import com.yuanchu.mom.dto.DeviceDto; import com.yuanchu.mom.mapper.DeviceMapper; import com.yuanchu.mom.mapper.StructureItemParameterMapper; import com.yuanchu.mom.pojo.Device; import com.yuanchu.mom.pojo.StructureItemParameter; import com.yuanchu.mom.service.DeviceService; import com.yuanchu.mom.utils.QueryWrappers; import lombok.AllArgsConstructor; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -28,6 +32,8 @@ private GetLook getLook; private DeviceMapper deviceMapper; private StructureItemParameterMapper structureItemParameterMapper; @Override public Map<String, Object> selectDeviceParameter(Page page, DeviceDto itemParameter) { @@ -76,8 +82,29 @@ } @Override public List<Device> selectDeviceByCategory(String category) { return deviceMapper.selectList(Wrappers.<Device>lambdaQuery().eq(Device::getLargeCategory, category).eq(Device::getDeviceStatus, 0)); public List<Device> selectDeviceByCategory(String inspectionItem, String inspectionItemSubclass) { Integer id; try { id = structureItemParameterMapper.selectOne(Wrappers.<StructureItemParameter>lambdaQuery().eq(StructureItemParameter::getInspectionItem, inspectionItem).eq(StructureItemParameter::getInspectionItemSubclass, inspectionItemSubclass).last("limit 1").select(StructureItemParameter::getId)).getId(); } catch (Exception e) { return null; } List<Device> devices = deviceMapper.selectList(Wrappers.<Device>lambdaQuery().eq(Device::getDeviceStatus, 0).isNotNull(Device::getInsProductIds)); List<Device> devices2 = new ArrayList<>(); for (Device device : devices) { List<Integer> ids = JSON.parseArray(device.getInsProductIds(), Integer.class); for (Integer i : ids) { if (i == id) { devices2.add(device); } } } return devices2; } @Override public Device selectDeviceByCode(String code) { return deviceMapper.selectOne(Wrappers.<Device>lambdaQuery().eq(Device::getFactoryNo, code).last("limit 1")); } } framework/src/main/java/com/yuanchu/mom/config/OpenFifer.java
@@ -72,7 +72,6 @@ // å ¨å±æ ¼å¼åå¤ç @Override protected void extendMessageConverters(List<HttpMessageConverter<?>> converters) { // è¿åç»å端å»é¤null Jackson2ObjectMapperBuilder json = Jackson2ObjectMapperBuilder.json(); MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter(); framework/src/main/java/com/yuanchu/mom/controller/InformationNotificationController.java
@@ -1,6 +1,7 @@ package com.yuanchu.mom.controller; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.yuanchu.mom.annotation.ValueAuth; import com.yuanchu.mom.mapper.InformationNotificationMapper; import com.yuanchu.mom.pojo.InformationNotification; import com.yuanchu.mom.pojo.InformationNotificationDto; @@ -33,12 +34,14 @@ @ApiOperation(value = "æ¶æ¯éç¥-æ»å¨å页æ¥è¯¢") @GetMapping("page") @ValueAuth public Result<?> getPage(Long size, Long current, String messageType) { return Result.success(informationNotificationService.getPage(new Page<>(current, size), messageType)); } @ApiOperation(value = "æ¶æ¯éç¥-æ´æ°æ¶æ¯ç¶æï¼æç»ãæ¥æ¶ï¼") @PutMapping("updateMessageStatus") @ValueAuth public Result<?> updateMessageStatus(@RequestBody InformationNotification informationNotification) { informationNotificationService.updateById(informationNotification); return Result.success(); @@ -46,6 +49,7 @@ @ApiOperation(value = "æ¶æ¯éç¥-æ è®°ææä¿¡æ¯ä¸ºå·²è¯»/å 餿æå·²è¯»æ¶æ¯") @PutMapping("informationReadOrDelete/{isMarkAllInformationRead}") @ValueAuth public Result<?> markAllInformationReadOrDeleteAllReadMessages(@PathVariable("isMarkAllInformationRead") Boolean isMarkAllInformationRead) { informationNotificationService.markAllInformationReadOrDeleteAllReadMessages(isMarkAllInformationRead); return Result.success(); @@ -53,6 +57,7 @@ @ApiOperation(value = "æ¶æ¯éç¥-å 餿°æ®") @DeleteMapping("deleteDataBasedOnId") @ValueAuth public Result<?> deleteDataBasedOnId(Integer id) { informationNotificationService.removeById(id); return Result.success(); @@ -60,12 +65,14 @@ @ApiOperation(value = "æ¶æ¯éç¥-æ¥è¯¢æ¯å¦å卿ªè¯»æ°æ®") @GetMapping("checkForUnreadData") @ValueAuth public Result<?> checkForUnreadData() { return Result.success(informationNotificationService.checkForUnreadData()); } @ApiOperation(value = "æ¶æ¯éç¥-ç¹å»è¯¦æ 触åä¿®æ¹ç¶æä¸ºå·²è¯»") @PutMapping("triggerModificationStatusToRead/{id}") @ValueAuth public Result<?> triggerModificationStatusToRead(@PathVariable("id") Integer id) { informationNotificationService.triggerModificationStatusToRead(id); return Result.success(); inspect-server/src/main/java/com/yuanchu/mom/controller/InsOrderPlanController.java
@@ -31,6 +31,7 @@ @PostMapping("/selectInsOrderPlanList") public Result selectInsOrderPlanList(@RequestBody Map<String, Object> data) throws Exception { Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class); page.setOptimizeCountSql(false); InsOrderPlanDTO insOrderPlanDTO = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), InsOrderPlanDTO.class); return Result.success(insOrderPlanService.selectInsOrderPlanList(page, insOrderPlanDTO)); } inspect-server/src/main/java/com/yuanchu/mom/controller/StandardTemplateController.java
@@ -7,6 +7,7 @@ import com.yuanchu.mom.utils.JackSonUtil; import com.yuanchu.mom.vo.Result; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.*; inspect-server/src/main/java/com/yuanchu/mom/dto/ExcelDto.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,19 @@ package com.yuanchu.mom.dto; import lombok.Data; import java.io.Serializable; @Data public class ExcelDto implements Serializable { Integer r; Integer c; Integer mc; ExcelV v; } inspect-server/src/main/java/com/yuanchu/mom/dto/ExcelMc.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,16 @@ package com.yuanchu.mom.dto; import lombok.Data; @Data public class ExcelMc { Integer r; Integer c; Integer rs; Integer cs; } inspect-server/src/main/java/com/yuanchu/mom/dto/ExcelPs.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,9 @@ package com.yuanchu.mom.dto; import lombok.Data; @Data public class ExcelPs { String value; } inspect-server/src/main/java/com/yuanchu/mom/dto/ExcelV.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,22 @@ package com.yuanchu.mom.dto; import lombok.Data; @Data public class ExcelV { String v; String ff; String fc; String fs; String ht; ExcelMc mc; ExcelPs ps; } inspect-server/src/main/java/com/yuanchu/mom/dto/SampleProductDto2.java
@@ -20,7 +20,7 @@ @ValueTableShow(value = 4, name = "æ ·ååå·") private String model; @ValueTableShow(value = 5, name = "æ ·åç¶æ") // @ValueTableShow(value = 5, name = "æ ·åç¶æ") private Integer insState; @ValueTableShow(value = 15, name = "åä½") @@ -37,7 +37,7 @@ private String inspectionItemType; @ValueTableShow(value = 11, name = "æ£éªå¼ç±»å") // @ValueTableShow(value = 11, name = "æ£éªå¼ç±»å") private String inspectionValueType; @ValueTableShow(value = 12, name = "è¦æ±å¼") inspect-server/src/main/java/com/yuanchu/mom/mapper/InsSampleMapper.java
@@ -5,11 +5,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.yuanchu.mom.dto.InsOrderPlanDTO; import com.yuanchu.mom.dto.SampleOrderDto; import com.yuanchu.mom.dto.SampleProductDto; import com.yuanchu.mom.pojo.InsSample; import com.yuanchu.mom.vo.InsOrderPlanVO; import org.apache.ibatis.annotations.Param; import java.util.List; inspect-server/src/main/java/com/yuanchu/mom/pojo/InsOrder.java
@@ -34,12 +34,18 @@ @Length(max= 255,message="ç¼ç é¿åº¦ä¸è½è¶ è¿255") private String entrustCode; @ValueTableShow(2) @Size(max= 255,message="ç¼ç é¿åº¦ä¸è½è¶ è¿255") @ApiModelProperty(value = "æ£éªç±»å«") @Length(max= 255,message="ç¼ç é¿åº¦ä¸è½è¶ è¿255") private String orderType; /** * ä¸åå®¢æ· */ @ValueTableShow(3) @Size(max= 255,message="ç¼ç é¿åº¦ä¸è½è¶ è¿255") @ApiModelProperty("ä¸å客æ·") @ApiModelProperty("姿客æ·") @Length(max= 255,message="ç¼ç é¿åº¦ä¸è½è¶ è¿255") private String custom; @@ -48,9 +54,15 @@ */ @ValueTableShow(4) @Size(max= 255,message="ç¼ç é¿åº¦ä¸è½è¶ è¿255") @ApiModelProperty("ä¸ååä½") @ApiModelProperty("å§æåä½") @Length(max= 255,message="ç¼ç é¿åº¦ä¸è½è¶ è¿255") private String company; @ValueTableShow(4) @Size(max= 255,message="ç¼ç é¿åº¦ä¸è½è¶ è¿255") @ApiModelProperty("èç³»æ¹å¼") @Length(max= 255,message="ç¼ç é¿åº¦ä¸è½è¶ è¿255") private String phone; /** * å·¥åå @@ -79,6 +91,14 @@ // @ValueTableShow(7) @ApiModelProperty("æ£éªç»æ") private Integer insResult; @ValueTableShow(7) @ApiModelProperty("æ ·åå¤çæ¹å¼") private Integer processing; @ValueTableShow(7) @ApiModelProperty("æ¯å¦çæ ·") private Integer isLeave; /** * 1ï¼æ£éªå¤ç 0ï¼å¾ å®¡æ ¸ 2ï¼éå 3ï¼æ¤é @@ -171,4 +191,10 @@ @ValueTableShow(value = 14, name = "éåçç±") private String tell; @ValueTableShow(value = 15, name = "æ¥ååéæ¹å¼") private Integer send; @ValueTableShow(value = 16, name = "æ¥æ ·æ¹å¼") private String formType; } inspect-server/src/main/java/com/yuanchu/mom/pojo/InsProductResult.java
@@ -43,6 +43,8 @@ */ private String equipValue; private String equipName; @TableField(fill = FieldFill.INSERT) private Integer createUser; inspect-server/src/main/java/com/yuanchu/mom/pojo/InsSample.java
@@ -80,11 +80,6 @@ private String model; /** * æ¯å¦çæ · 1ï¼çæ · 0ï¼ä¸çæ · */ private Integer isLeave; /** * æ£éªç¶æ(0ï¼å¾ æ£éª1:æ£éªä¸ 2:å·²æ£éª3ï¼å¾ 夿 ¸4ï¼å¤æ ¸æªéè¿5ï¼å¤æ ¸éè¿) */ private Integer insState; inspect-server/src/main/java/com/yuanchu/mom/service/InsReportService.java
@@ -1,7 +1,6 @@ package com.yuanchu.mom.service; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.yuanchu.mom.dto.InsOrderPlanDTO; import com.yuanchu.mom.dto.ReportPageDto; import com.yuanchu.mom.pojo.InsReport; import com.baomidou.mybatisplus.extension.service.IService; @@ -19,6 +18,8 @@ String wordToHtml(String path); void wordToPdf(String path); int inReport(String url, Integer id); int upReportUrl(Integer id); @@ -31,4 +32,6 @@ //æ¹å int ratifyReport(Integer id, Integer isRatify, String ratifyTell); int wordInsertUrl(Map<String, Object> map, String url); } inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java
@@ -18,6 +18,7 @@ import com.deepoove.poi.data.style.TableStyle; import com.yuanchu.mom.common.GetLook; import com.yuanchu.mom.common.PrintChina; import com.yuanchu.mom.dto.ExcelDto; import com.yuanchu.mom.dto.InsOrderPlanDTO; import com.yuanchu.mom.dto.SampleProductDto; import com.yuanchu.mom.mapper.*; @@ -31,16 +32,15 @@ import com.yuanchu.mom.utils.MatrixToImageWriter; import com.yuanchu.mom.utils.QueryWrappers; import com.yuanchu.mom.vo.InsOrderPlanVO; import org.apache.commons.io.IOUtils; import org.apache.poi.xwpf.usermodel.TableRowAlign; import org.apache.poi.xwpf.usermodel.XWPFTable; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.ResourceUtils; import javax.annotation.Resource; import java.io.FileNotFoundException; import java.io.IOException; import java.io.*; import java.nio.file.Files; import java.nio.file.Paths; import java.time.LocalDateTime; @@ -50,7 +50,6 @@ import java.util.stream.Collectors; import java.util.concurrent.CompletableFuture; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Stream; /** * æ£éªä»»å¡-ä¸å¡å®ç°å± @@ -125,11 +124,10 @@ insOrder.setId(id); InsOrder order = insOrderMapper.selectById(id); if (BeanUtil.isEmpty(order.getInsTime())) { insOrder.setInsState(1); insOrder.setInsTime(LocalDateTime.now()); insOrderMapper.updateById(insOrder); insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate().eq(InsOrderState::getInsOrderId, id).eq(InsOrderState::getLaboratory, laboratory).set(InsOrderState::getInsTime, LocalDateTime.now()).set(InsOrderState::getInsState, 1)); } insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate().eq(InsOrderState::getInsOrderId, id).eq(InsOrderState::getLaboratory, laboratory).set(InsOrderState::getInsTime, LocalDateTime.now()).set(InsOrderState::getInsState, 1)); Map<String, Object> map = insOrderService.getInsOrderAndSample(id, laboratory); Set<Integer> set = new HashSet<>(); Map<Integer, String> map2 = new HashMap<>(); @@ -201,6 +199,17 @@ } result.setEquipValue(JSON.toJSONString(ev)); } if (jo.get("equipName") != null) { JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("equipName"))); List<Map<String, Object>> ev = new ArrayList<>(); for (Object o : jsonArray2) { JSONObject equipValue = JSON.parseObject(JSON.toJSONString(o)); Map<String, Object> map = new HashMap<>(); map.put("v", JSON.parseObject(JSON.toJSONString(equipValue.get("v"))).get("v")); ev.add(map); } result.setEquipName(JSON.toJSONString(ev)); } try { JSONObject insResult = JSON.parseObject(JSON.toJSONString(jo.get("insResult"))); String ir = JSON.parseObject(JSON.toJSONString(insResult.get("v"))).get("v") + ""; @@ -251,7 +260,8 @@ @Transactional(rollbackFor = Exception.class) public int verifyPlan(Integer orderId, String laboratory, Integer type, String tell) { Integer num = (type == 1 ? 5 : 4); insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate().eq(InsOrderState::getInsOrderId, orderId).eq(InsOrderState::getLaboratory, laboratory).set(InsOrderState::getInsTime, LocalDateTime.now()).set(InsOrderState::getInsState, num).set(InsOrderState::getVerifyTell, tell).set(InsOrderState::getVerifyUser, getLook.selectPowerByMethodAndUserId(null).get("userId"))); LocalDateTime now = LocalDateTime.now(); insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate().eq(InsOrderState::getInsOrderId, orderId).eq(InsOrderState::getLaboratory, laboratory).set(InsOrderState::getInsTime, now).set(InsOrderState::getInsState, num).set(InsOrderState::getVerifyTell, tell).set(InsOrderState::getVerifyUser, getLook.selectPowerByMethodAndUserId(null).get("userId"))); List<InsOrderState> insOrderStates = insOrderStateMapper.selectList(Wrappers.<InsOrderState>lambdaQuery().eq(InsOrderState::getInsOrderId, orderId)); long count = insOrderStates.stream().filter(a -> a.getInsState() == 5).count(); if (count == insOrderStates.size() && num == 5) { @@ -266,22 +276,29 @@ List<Map<String, Object>> tables = new ArrayList<>(); Set<String> standardMethod = new HashSet<>(); Set<String> deviceSet = new HashSet<>(); Set<String> models = new HashSet<>(); AtomicReference<Integer> productSize = new AtomicReference<>(0); String[] monthNames = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; samples.forEach(a -> { models.add(a.getModel()); Set<String> templateSet = new HashSet<>(); getTemplateThing(set, map2, a); a.getInsProduct().forEach(b -> { String[] split = b.getMethod().replaceAll("]", "").replaceAll("\\[", "").replaceAll("\"", "").split(","); standardMethod.addAll(Arrays.asList(split)); for (InsProduct b : a.getInsProduct()) { standardMethod.add(b.getMethodS()); productSize.set(productSize.get() + 1); if (b.getInsProductResult() != null) { if (b.getInsProductResult().getEquipValue() != null && !Objects.equals(b.getInsProductResult().getEquipValue(), "")) { deviceSet.add(b.getInsProductResult().getEquipValue()); List<JSONObject> jsonObjects = JSON.parseArray(b.getInsProductResult().getEquipValue(), JSONObject.class); for (JSONObject jsonObject : jsonObjects) { if (!"".equals(jsonObject.get("v") + "")) { deviceSet.add(jsonObject.get("v") + ""); } } } if (b.getTemplate().size() == 0) { return; continue; } templateSet.add(JSON.toJSONString(b.getTemplate())); }); } AtomicInteger index = new AtomicInteger(); templateSet.forEach(tem -> { Set<Integer> set2 = new HashSet<>(); @@ -289,20 +306,66 @@ List<TextRenderData> text = new ArrayList<>(); RowRenderData rowRenderData; Set<String> delSet = new HashSet<>(); List<JSONObject> temp = JSON.parseArray(tem, JSONObject.class); List<ExcelDto> excelDtos = JSON.parseArray(tem, ExcelDto.class); List<ExcelDto> mcList = new ArrayList<>(); excelDtos.forEach(b -> { if (b.getV().getMc() != null && b.getV().getMc().getCs() != null && b.getV().getMc().getRs() != null) { mcList.add(b); } }); int count5 = 0; for (ExcelDto b : mcList) { for (ExcelDto excelDto : excelDtos) { for (int i = 0; i < b.getV().getMc().getCs(); i++) { for (int i2 = 0; i2 < b.getV().getMc().getRs(); i2++) { if (excelDto.getC() == b.getC() + i && excelDto.getR() == b.getR() + i2) { ExcelDto bb = JSON.parseObject(JSON.toJSONString(b), ExcelDto.class); excelDto.getV().setV(bb.getV().getV()); excelDto.getV().setPs(bb.getV().getPs()); excelDto.getV().setFc(bb.getV().getFc()); excelDto.getV().setFs(bb.getV().getFs()); excelDto.getV().setHt(bb.getV().getHt()); excelDto.setMc(count5); break; } } } } count5++; } List<JSONObject> temp = JSON.parseArray(JSON.toJSONString(excelDtos), JSONObject.class); Map<String, InsProduct> pMap = new HashMap<>(); Set<String> delRSet = new HashSet<>(); for (JSONObject jo1 : temp) { JSONObject v = JSON.parseObject(JSON.toJSONString(jo1.get("v"))); if (v.get("ps") != null) { if ("æ£éªå¼".equals(JSON.parseObject(JSON.toJSONString(v.get("ps"))).get("value") + "") || "设å¤".equals(JSON.parseObject(JSON.toJSONString(v.get("ps"))).get("value") + "")) { int count3 = 0; String str = ""; if ("æ£éªå¼".equals(JSON.parseObject(JSON.toJSONString(v.get("ps"))).get("value") + "") || "设å¤åç§°".equals(JSON.parseObject(JSON.toJSONString(v.get("ps"))).get("value") + "") || "设å¤ç¼ç ".equals(JSON.parseObject(JSON.toJSONString(v.get("ps"))).get("value") + "")) { delSet.add(jo1.get("c") + ""); continue; } if ("æ£éªå项".equals(JSON.parseObject(JSON.toJSONString(v.get("ps"))).get("value") + "")) { for (JSONObject jo2 : temp) { JSONObject v2 = JSON.parseObject(JSON.toJSONString(jo2.get("v"))); if (jo1.get("r").equals(jo2.get("r"))) { if (v2.get("ps") != null && JSON.parseObject(JSON.toJSONString(v2.get("ps"))).get("value").equals("æ£éªé¡¹")) { if (count3 == 0) { str += v2.get("v"); count3 += 1; } } else if (v2.get("ps") != null && JSON.parseObject(JSON.toJSONString(v2.get("ps"))).get("value").equals("æ£éªå项")) { if (count3 == 1) { str += v2.get("v"); count3 += 1; } } } } if (!str.equals("")) { int count2 = 0; for (InsProduct p : a.getInsProduct()) { if (v.get("v").equals(p.getInspectionItemSubclass())) { pMap.put(jo1.get("r") + "", p); for (InsProduct product : a.getInsProduct()) { if ((product.getInspectionItem() + product.getInspectionItemSubclass()).equals(str)) { pMap.put(jo1.get("r") + "", product); break; } else { count2++; @@ -312,16 +375,12 @@ delRSet.add(jo1.get("r") + ""); } } } else { if ("åæ°".equals(v.get("v"))) delSet.add(jo1.get("c") + ""); } } for (int i = 0; i < temp.size(); i++) { JSONObject jo1 = temp.get(i); if (delRSet.stream().anyMatch(e -> e.equals(jo1.get("r") + ""))) { continue; } if (delSet.stream().anyMatch(e -> e.equals(jo1.get("c") + ""))) { continue; } TextRenderData textRenderData = new TextRenderData(); if (set2.add(Integer.parseInt(jo1.get("r") + ""))) { if (text.size() > 0) { @@ -330,6 +389,12 @@ rows.add(rowRenderData); text = new ArrayList<>(); } } if (delRSet.stream().anyMatch(e -> e.equals(jo1.get("r") + ""))) { continue; } if (delSet.stream().anyMatch(e -> e.equals(jo1.get("c") + ""))) { continue; } JSONObject v = JSON.parseObject(JSON.toJSONString(jo1.get("v"))); InsProduct p = pMap.get(jo1.get("r") + ""); @@ -365,6 +430,8 @@ textRenderData.setText(a.getModel()); } else if (value.equals("æ ·ååç§°")) { textRenderData.setText(a.getSample()); } else if (value.equals("è¯éªæ¹æ³")) { textRenderData.setText(p.getMethodS()); } else { textRenderData.setText(v.get("v") == null ? "" : v.get("v") + ""); } @@ -400,7 +467,11 @@ Style style = new Style(); style.setFontFamily(v.get("ff") == null ? "微软é é»" : v.get("ff") + ""); // style.setFontSize(v.get("fs")==null?14:Integer.parseInt(v.get("fs")+"")); style.setColor(v.get("fc") == null ? "000000" : (v.get("fc") + "").replace("#", "")); if (!((v.get("fc") + "").indexOf("rgb") > -1)) { style.setColor(v.get("fc") == null ? "000000" : (v.get("fc") + "").replace("#", "")); } else { style.setColor("000000"); } textRenderData.setStyle(style); text.add(textRenderData); if (i == temp.size() - 1) { @@ -437,9 +508,15 @@ }); String url; try { url = ResourceUtils.getURL("classpath:static/report-template.docx").getPath(); InputStream inputStream = this.getClass().getResourceAsStream("/static/report-template.docx"); File file = File.createTempFile("temp", ".tmp"); OutputStream outputStream = new FileOutputStream(file); IOUtils.copy(inputStream, outputStream); url = file.getAbsolutePath(); } catch (FileNotFoundException e) { throw new ErrorException("æ¾ä¸å°æ¨¡æ¿æä»¶"); } catch (IOException e) { throw new RuntimeException(e); } StringBuilder standardMethod2 = new StringBuilder(); for (String s : standardMethod) { @@ -449,12 +526,13 @@ tables.forEach(table -> { table.put("tableSize", tables.size() + 1); }); List<Map<String, String>> deviceList = insOrderMapper.selectDeviceList(deviceSet); // List<Map<String, String>> deviceList = insOrderMapper.selectDeviceList(deviceSet); List<Map<String, String>> deviceList = new ArrayList<>(); Map<String, String> codeStr = new HashMap<>(); codeStr.put("æ¥åç¼å·", insReport.getCode()); codeStr.put("æ ·ååç§°", insOrder.getSample()); codeStr.put("è§æ ¼åå·", samples.get(0).getModel()); codeStr.put("åæ¾æ¥æ", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); codeStr.put("åæ¾æ¥æ", now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); String codePath; try { codePath = new MatrixToImageWriter().code(JackSonUtil.marshal(codeStr).replaceAll("\\{", "") @@ -462,6 +540,11 @@ } catch (Exception e) { throw new RuntimeException(e); } String modelStr = ""; for (String model : models) { modelStr += "," + model; } String finalModelStr = modelStr; ConfigureBuilder builder = Configure.builder(); builder.useSpringEL(true); XWPFTemplate template = XWPFTemplate.compile(url, builder.build()).render( @@ -476,13 +559,24 @@ put("standardMethod", standardMethod2); put("deviceList", deviceList); put("twoCode", Pictures.ofLocal(codePath).create()); put("models", finalModelStr.replace(",", "")); put("productSize", productSize); put("createTime", now.format(DateTimeFormatter.ofPattern("yyyyå¹´MMæddæ¥"))); put("createTimeEn", monthNames[now.getMonthValue() - 1] + " " + now.getDayOfMonth() + ", " + now.getYear()); put("insTime", insOrder.getInsTime().format(DateTimeFormatter.ofPattern("yyyyå¹´MMæddæ¥"))); put("insTimeEn", monthNames[insOrder.getInsTime().getMonthValue() - 1] + " " + now.getDayOfMonth() + ", " + now.getYear()); put("writeUrl", null); put("insUrl", null); put("examineUrl", null); put("ratifyUrl", null); }}); try { String name = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yy_MM_dd&HH_mm_ss")) + ".docx"; String name = insReport.getCode().replace("/", "") + ".docx"; template.writeAndClose(Files.newOutputStream(Paths.get(wordUrl + "/" + name))); insReport.setUrl("/word/" + name); insReportMapper.insert(insReport); insOrder.setState(4); // insOrder.setState(4); insOrder.setInsState(5); insOrderMapper.updateById(insOrder); } catch (IOException e) { throw new RuntimeException(e); @@ -522,9 +616,9 @@ if (insProducts.size() > 0) { String str = ""; for (InsProduct product : insProducts) { str += product.getInspectionItem()+product.getInspectionItemSubclass()+"ï¼"; str += product.getInspectionItem() + product.getInspectionItemSubclass() + "ï¼"; } throw new ErrorException("以䏿¯æªæ£éªç项ç®ï¼"+str); throw new ErrorException("以䏿¯æªæ£éªç项ç®ï¼" + str); } insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate().eq(InsOrderState::getInsOrderId, orderId).eq(InsOrderState::getLaboratory, laboratory).set(InsOrderState::getInsTime, LocalDateTime.now()).set(InsOrderState::getInsState, 3)); return 1; inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsReportServiceImpl.java
@@ -1,34 +1,37 @@ package com.yuanchu.mom.service.impl; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.deepoove.poi.XWPFTemplate; import com.deepoove.poi.data.Pictures; import com.spire.doc.Document; import com.spire.doc.FileFormat; import com.yuanchu.mom.common.GetLook; import com.yuanchu.mom.common.PrintChina; import com.yuanchu.mom.dto.InsOrderPlanDTO; import com.yuanchu.mom.dto.ReportPageDto; import com.yuanchu.mom.dto.SampleOrderDto; import com.yuanchu.mom.exception.ErrorException; import com.yuanchu.mom.mapper.InsOrderMapper; import com.yuanchu.mom.mapper.UserMapper; import com.yuanchu.mom.pojo.InsOrder; import com.yuanchu.mom.pojo.InsReport; import com.yuanchu.mom.service.InsReportService; import com.yuanchu.mom.mapper.InsReportMapper; import com.yuanchu.mom.utils.QueryWrappers; import lombok.AllArgsConstructor; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.time.LocalDateTime; import java.util.HashMap; import java.util.Map; import java.util.concurrent.CompletableFuture; /** * @author Administrator @@ -50,6 +53,12 @@ @Value("${wordUrl}") private String wordUrl; @Value("${file.path}") private String imgUrl; @Resource private InsOrderMapper insOrderMapper; @Override public Map<String, Object> pageInsReport(Page page, ReportPageDto reportPageDto) { @@ -100,6 +109,9 @@ String url = insReport.getUrl(); //æå¨ä¸ä¼ æ¥åå°å String urlS = insReport.getUrlS(); wordInsertUrl(new HashMap<String, Object>(){{ put("writeUrl", Pictures.ofLocal(imgUrl+"/"+signatureUrl).create()); }}, (urlS==null?url:urlS).replace("/word", wordUrl)); return insReportMapper.updateById(insReport); } @@ -116,6 +128,7 @@ if (isExamine==0){ //å¦æå®¡æ ¸ä¸éè¿ insReport.setState(0);//æäº¤ç¶ææ¹ä¸ºå¾ æäº¤ return insReportMapper.updateById(insReport); } //è·åå®¡æ ¸äººçç¾åå°å String signatureUrl = userMapper.selectById(insReport.getExamineUserId()).getSignatureUrl(); @@ -123,12 +136,15 @@ String url = insReport.getUrl(); //æå¨ä¸ä¼ æ¥åå°å String urlS = insReport.getUrlS(); wordInsertUrl(new HashMap<String, Object>(){{ put("examineUrl", Pictures.ofLocal(imgUrl+"/"+signatureUrl).create()); }}, (urlS==null?url:urlS).replace("/word", wordUrl)); return insReportMapper.updateById(insReport); } //æ¹å @Override @Transactional(rollbackFor = Exception.class) public int ratifyReport(Integer id, Integer isRatify, String ratifyTell) { InsReport insReport = insReportMapper.selectById(id); insReport.setIsRatify(isRatify); @@ -140,6 +156,7 @@ if (isRatify==0){ //妿æ¹åä¸éè¿ insReport.setState(0);//æäº¤ç¶ææ¹ä¸ºå¾ æäº¤ return insReportMapper.updateById(insReport); } //è·åå®¡æ ¸äººçç¾åå°å String signatureUrl = userMapper.selectById(insReport.getRatifyUserId()).getSignatureUrl(); @@ -147,9 +164,46 @@ String url = insReport.getUrl(); //æå¨ä¸ä¼ æ¥åå°å String urlS = insReport.getUrlS(); wordInsertUrl(new HashMap<String, Object>(){{ put("ratifyUrl", Pictures.ofLocal(imgUrl+"/"+signatureUrl).create()); }}, (urlS==null?url:urlS).replace("/word", wordUrl)); wordToPdf((urlS == null ? url : urlS).replace("/word", wordUrl)); InsOrder insOrder = new InsOrder(); insOrder.setId(insReportMapper.selectById(id).getInsOrderId()); insOrder.setState(4); insOrderMapper.updateById(insOrder); return insReportMapper.updateById(insReport); } @Override public int wordInsertUrl(Map<String, Object> map, String url) { XWPFTemplate template = XWPFTemplate.compile(url).render(map); try { template.writeAndClose(Files.newOutputStream(Paths.get(url))); } catch (IOException e) { throw new RuntimeException(e); } return 1; } @Override public void wordToPdf(String path) { CompletableFuture.supplyAsync(() -> { try(ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { Document document = new Document(); document.loadFromFile(path); document.saveToFile(path.replace(".docx", ".pdf"), FileFormat.PDF); System.out.println(path.replace(".docx", ".pdf")); return null; } catch (Exception e) { throw new ErrorException("转æ¢å¤±è´¥"); } }).thenAccept(res -> { }).exceptionally(e -> { e.printStackTrace(); return null; }); } } inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java
@@ -1,6 +1,5 @@ package com.yuanchu.mom.service.impl; import cn.hutool.core.bean.BeanUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -19,7 +18,6 @@ import com.yuanchu.mom.service.StandardTreeService; import com.yuanchu.mom.mapper.StandardTreeMapper; import lombok.AllArgsConstructor; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -73,7 +71,7 @@ standardProductList.setSample(standardTree.getSample()); standardProductList.setModel(standardTree.getModel()); standardProductList.setStandardMethodListId(standardMethod.getId()); standardProductList.setState(1); standardProductList.setState(0); standardProductList.setId(null); standardProductList.setCreateUser(null); standardProductList.setCreateTime(null); @@ -207,7 +205,7 @@ pl2.setSample(tree.getSample()); pl2.setModel(tree.getModel()); pl2.setStandardMethodListId(sl1.getId()); pl2.setState(1); pl2.setState(0); pl2.setId(null); pl2.setCreateUser(null); pl2.setCreateTime(null); @@ -241,7 +239,7 @@ standardProductList.setSample(tree.getSample()); standardProductList.setModel(tree.getModel()); standardProductList.setStandardMethodListId(sl2.getId()); standardProductList.setState(1); standardProductList.setState(0); standardProductList.setId(null); standardProductList.setCreateUser(null); standardProductList.setCreateTime(null); inspect-server/src/main/java/com/yuanchu/mom/vo/InsOrderPlanVO.java
@@ -38,4 +38,6 @@ private String sonLaboratory; private Integer orderUserId; } inspect-server/src/main/resources/mapper/InsOrderMapper.xml
@@ -116,7 +116,7 @@ <select id="selectSampleAndProductByOrderId" resultType="com.yuanchu.mom.dto.SampleProductDto2"> select * from ( select i.id,isa.sample_code,isa.sample,isa.model,ip.state,ip.unit,ip.inspection_item,ip.inspection_item_subclass, select i.id,isa.sample_code,isa.sample,isa.model,isa.ins_state,ip.state,ip.unit,ip.inspection_item,ip.inspection_item_subclass, ip.son_laboratory,ip.inspection_item_type,ip.inspection_value_type,ip.ask,ip.`last_value`,ip.ins_result,ipr.equip_value from ins_sample isa left join ins_order i on isa.ins_order_id = i.id inspect-server/src/main/resources/mapper/InsSampleMapper.xml
@@ -29,7 +29,7 @@ <select id="findInsSampleAndOrder" resultType="com.yuanchu.mom.vo.InsOrderPlanVO"> select * from( SELECT a.*,ios.ins_state,ios.verify_tell a.*,ios.ins_state,ios.verify_tell,isu2.order_user_id FROM ( SELECT @@ -49,7 +49,7 @@ LEFT JOIN ins_product ip ON ip.ins_sample_id = isa.id WHERE io.state = 1 AND io.ins_state != 5 # AND io.ins_state != 5 and send_time is not null and (isu.user_id = #{userId} OR isu.user_id is NULL) GROUP BY @@ -57,6 +57,7 @@ io.id ) a LEFT JOIN ins_order_state ios ON ios.ins_order_id = a.id AND ios.laboratory = a.son_laboratory left join (SELECT c.user_id order_user_id, c.ins_sample_id from (SELECT * FROM ins_sample_user ORDER BY id DESC) c GROUP BY ins_sample_id having order_user_id = #{userId}) isu2 on isu2.ins_sample_id = a.id ORDER BY a.user_id DESC, a.type DESC, @@ -150,6 +151,7 @@ ipr.ins_value, ipr.com_value, ipr.equip_value, ipr.equip_name, ip.method_s from ins_sample isa left join ins_product ip on isa.id = ip.ins_sample_id @@ -226,5 +228,6 @@ <result property="insValue" column="ins_value" jdbcType="VARCHAR"/> <result property="comValue" column="com_value" jdbcType="VARCHAR"/> <result property="equipValue" column="equip_value" jdbcType="VARCHAR"/> <result property="equipName" column="equip_name" jdbcType="VARBINARY"/> </resultMap> </mapper> inspect-server/src/main/resources/static/report-template.docxBinary files differ
user-server/src/main/java/com/yuanchu/mom/pojo/Enums.java
@@ -45,7 +45,7 @@ @ValueTableShow(3) @ApiModelProperty(value = "ä¼å 级") private Integer orderNum; private Double orderNum; /** * ç±»å user-server/src/main/java/com/yuanchu/mom/pojo/User.java
@@ -110,7 +110,7 @@ /** * ç»ç» */ @ValueTableShow(value = 14,name = "ç»ç»") // @ValueTableShow(value = 14,name = "ç»ç»") @ApiModelProperty(value = "å ³èçé¨é¨id") private String departId; user-server/src/main/java/com/yuanchu/mom/service/impl/UserServiceImp.java
@@ -94,7 +94,7 @@ @Override public User getUserNow() { Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId(null); return userMapper.selectOne(Wrappers.<User>lambdaQuery().eq(User::getId, map1.get("userId")).eq(User::getIsCustom, 1).select(User::getId, User::getCompany, User::getName, User::getCode)); return userMapper.selectOne(Wrappers.<User>lambdaQuery().eq(User::getId, map1.get("userId")).eq(User::getIsCustom, 1).select(User::getId, User::getCompany, User::getName, User::getCode, User::getPhone)); } @Override