| | |
| | | package com.ruoyi.basic.controller; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.poi.excel.ExcelUtil; |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.common.core.domain.entity.SysDictData; |
| | | import com.ruoyi.system.service.ISysDictTypeService; |
| | | import com.ruoyi.basic.dto.PageTestObjectDto; |
| | | import com.ruoyi.basic.dto.ProductDTO1; |
| | | import com.ruoyi.basic.excel.StructureTestObjectData; |
| | | import com.ruoyi.basic.excel.StructureTestObjectListener; |
| | | import com.ruoyi.basic.pojo.Product; |
| | | import com.ruoyi.basic.pojo.StandardTemplate; |
| | | import com.ruoyi.basic.pojo.StructureItemParameter; |
| | | import com.ruoyi.basic.pojo.StructureTestObject; |
| | | import com.ruoyi.basic.service.CapacityScopeService; |
| | | import com.ruoyi.basic.service.ProductService; |
| | | import com.ruoyi.basic.service.StandardTemplateService; |
| | | import com.ruoyi.basic.service.StructureItemParameterService; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.concurrent.atomic.AtomicReference; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * æ£éªé¡¹ç®åæ°(StructureItemParameter)表æ§å¶å± |
| | |
| | | |
| | | private StructureItemParameterService structureItemParameterService; |
| | | |
| | | private ISysDictTypeService dictTypeService; |
| | | |
| | | private StandardTemplateService standardTemplateService; |
| | | |
| | | @ApiOperation(value = "è·åé¡¹ç®æ£éªåæ°å表") |
| | | @GetMapping("/selectItemParameterList") |
| | |
| | | @PostMapping("/importEquipData") |
| | | @Transactional |
| | | public Result importEquipData(@RequestParam("file") MultipartFile file) throws Exception { |
| | | InputStream inputStream = file.getInputStream(); |
| | | List<StructureItemParameter> lists = new ArrayList<>(); |
| | | AtomicReference<String> sample = new AtomicReference<>(); |
| | | ExcelUtil.readBySax(inputStream, -1, (i, l, list1) -> { |
| | | if (l == 1) { |
| | | sample.set(list1.get(1) + ""); |
| | | } |
| | | if (l >= 1) { |
| | | StructureItemParameter str = new StructureItemParameter(); |
| | | // æµè¯å¯¹è±¡ |
| | | if (list1.get(1) == null) { |
| | | str.setSample(null); |
| | | } else { |
| | | String brand = (String) list1.get(1); |
| | | StringBuilder builder = new StringBuilder(); |
| | | builder.append("["); |
| | | // 产å |
| | | if (ObjectUtil.isNotEmpty(list1.get(2))) { |
| | | String production = (String) list1.get(2); |
| | | if (!production.contains("ï¼")) { |
| | | builder.append(String.format("[\"%s\",\"%s\"]", brand, production)); |
| | | } else { |
| | | Arrays.stream(production.split("ï¼")).forEach(item -> { |
| | | builder.append(String.format("[\"%s\",\"%s\"],", brand, item)); |
| | | }); |
| | | builder.deleteCharAt(builder.length() - 1); |
| | | } |
| | | } else { |
| | | builder.append("["); |
| | | builder.append(String.format("\"%s\"", brand)); |
| | | builder.append("]"); |
| | | } |
| | | builder.append("]"); |
| | | str.setSample(builder.toString()); |
| | | } |
| | | // æ£éªé¡¹ |
| | | str.setInspectionItem(list1.get(4).toString().trim()); |
| | | // æ£éªé¡¹è±æ |
| | | if (list1.get(5) != null) { |
| | | str.setInspectionItemEn(list1.get(5).toString()); |
| | | } |
| | | // æ£éªå项 |
| | | if (list1.get(6) == null) { |
| | | str.setInspectionItemSubclass(null); |
| | | } else { |
| | | str.setInspectionItemSubclass(list1.get(6).toString().trim()); |
| | | } |
| | | // æ£éªåé¡¹è±æ |
| | | if (list1.get(7) == null) { |
| | | str.setInspectionItemSubclassEn(null); |
| | | } else { |
| | | str.setInspectionItemSubclassEn(String.valueOf(list1.get(7).toString())); |
| | | } |
| | | // æ£éªé¡¹åç±» |
| | | if (list1.get(22) != null && list1.get(22) != "") { |
| | | str.setInspectionItemClass(list1.get(22).toString().trim()); |
| | | } else { |
| | | str.setInspectionItemClass(null); |
| | | } |
| | | // æ£éªé¡¹åç±»è±æ |
| | | if (list1.get(23) != null && list1.get(23) != "") { |
| | | str.setInspectionItemClassEn(list1.get(23) + ""); |
| | | } else { |
| | | str.setInspectionItemClassEn(null); |
| | | } |
| | | |
| | | LambdaQueryWrapper<StructureItemParameter> wrapper = Wrappers.lambdaQuery(StructureItemParameter.class) |
| | | .eq(StructureItemParameter::getInspectionItem, str.getInspectionItem()) |
| | | .eq(StructureItemParameter::getSample, str.getSample()) |
| | | |
| | | .last("limit 1"); |
| | | // 夿æ¯å¦ææ£éªé¡¹ç±»å |
| | | if (ObjectUtils.isNotEmpty(str.getInspectionItemClass())) { |
| | | wrapper.eq(StructureItemParameter::getInspectionItemClass, str.getInspectionItemClass()); |
| | | } |
| | | |
| | | // 夿æ¯å¦ææ£éªå项 |
| | | if (ObjectUtils.isNotEmpty(str.getInspectionItemSubclass())) { |
| | | wrapper.eq(StructureItemParameter::getInspectionItemSubclass, str.getInspectionItemSubclass()); |
| | | } |
| | | StructureItemParameter db_str = structureItemParameterService.getOne(wrapper); |
| | | if (ObjectUtils.isNotEmpty(db_str)) { |
| | | str.setId(db_str.getId()); |
| | | } |
| | | // æ¹æ³åç§° |
| | | if (list1.get(8) == null) { |
| | | str.setMethod(null); |
| | | } else { |
| | | StringBuffer buffer = new StringBuffer(); |
| | | String input = list1.get(8).toString(); |
| | | buffer.append("["); |
| | | String[] values = input.split("ï¼"); |
| | | for (String value : values) { |
| | | buffer.append("\"").append(value.trim()).append("\","); |
| | | } |
| | | buffer.deleteCharAt(buffer.length() - 1); |
| | | buffer.append("]"); |
| | | str.setMethod(buffer.toString()); |
| | | } |
| | | // è¯éªå®¤ |
| | | if (list1.get(9) == null) { |
| | | str.setSonLaboratory(null); |
| | | } else { |
| | | str.setSonLaboratory(list1.get(9).toString()); |
| | | } |
| | | // 计éåä½ |
| | | if (list1.get(10) == null) { |
| | | str.setUnit(null); |
| | | } else { |
| | | str.setUnit(list1.get(10).toString()); |
| | | } |
| | | // è¦æ±å¼ |
| | | if (list1.get(11) == null) { |
| | | str.setAskTell(null); |
| | | } else { |
| | | str.setAskTell(list1.get(11).toString()); |
| | | } |
| | | // è¦æ±æè¿° |
| | | if (list1.get(12) == null) { |
| | | str.setAsk(null); |
| | | } else { |
| | | str.setAsk(list1.get(12).toString()); |
| | | } |
| | | // åä»· |
| | | if (list1.get(13) == null) { |
| | | str.setPrice(null); |
| | | } else { |
| | | str.setPrice(list1.get(13) + ""); |
| | | } |
| | | // å·¥æ¶ç³»æ° |
| | | if (list1.get(14) == null) { |
| | | str.setManHour(null); |
| | | } else { |
| | | str.setManHour(Double.valueOf(list1.get(14).toString())); |
| | | } |
| | | // å·¥æ¶åç» |
| | | if (list1.get(15) == null) { |
| | | str.setManHourGroup(null); |
| | | } else { |
| | | str.setManHourGroup(list1.get(15).toString()); |
| | | } |
| | | // é¢è®¡å®ææ¶é´ |
| | | if (list1.get(16) == null) { |
| | | str.setManDay(null); |
| | | } else { |
| | | str.setManDay(Integer.valueOf(list1.get(16).toString())); |
| | | } |
| | | // æ°æ®ç±»å |
| | | String jy; |
| | | if (list1.get(17).toString().equals("éééç±»å")) { |
| | | jy = "0"; |
| | | } else { |
| | | jy = "1"; |
| | | } |
| | | str.setInspectionItemType(jy); |
| | | // æ£éªé¡¹ç±»å |
| | | String validateValueType = list1.get(18).toString(); |
| | | if (ObjectUtils.isNotEmpty(validateValueType)) { |
| | | List<SysDictData> enums = dictTypeService.selectDictDataByName("æ£éªå¼ç±»å") |
| | | .stream().filter(sysDictData -> sysDictData.getDictLabel().equals(validateValueType)).collect(Collectors.toList()); |
| | | str.setInspectionValueType(enums.get(0).getDictValue()); |
| | | } |
| | | int bsm; |
| | | //ç¹æ®æ è¯ |
| | | if (list1.get(19).toString().equals("å¦")) { |
| | | bsm = 0; |
| | | } else { |
| | | bsm = 1; |
| | | } |
| | | str.setBsm(bsm + ""); |
| | | // æ°ååå
¸ |
| | | if (list1.get(20) != null) { |
| | | str.setDic(list1.get(20) + ""); |
| | | } else { |
| | | str.setDic(null); |
| | | } |
| | | // åå§è®°å½æ¨¡æ¿ |
| | | StandardTemplate standTempIdByName = standardTemplateService.getStandTempIdByName(String.valueOf(list1.get(21))); |
| | | if (standTempIdByName != null) { |
| | | str.setTemplateId(standTempIdByName.getId()); |
| | | } else { |
| | | str.setTemplateId(null); |
| | | } |
| | | try { |
| | | if (list1.get(24) != null) { |
| | | str.setLaboratory(list1.get(24) + ""); |
| | | } |
| | | } catch (Exception e) { |
| | | } |
| | | |
| | | // æ¡ä»¶ |
| | | if (list1.get(25) == null) { |
| | | str.setRadiusList(null); |
| | | } else { |
| | | StringBuffer buffer = new StringBuffer(); |
| | | String input = list1.get(25).toString(); |
| | | buffer.append("["); |
| | | String[] values = input.split("ï¼"); |
| | | for (String value : values) { |
| | | buffer.append("\"").append(value.trim()).append("\","); |
| | | } |
| | | buffer.deleteCharAt(buffer.length() - 1); |
| | | buffer.append("]"); |
| | | str.setRadiusList(buffer.toString()); |
| | | } |
| | | //æ¶è´¹æ å |
| | | if (list1.get(26) == null) { |
| | | str.setRates(null); |
| | | } else { |
| | | str.setRates(list1.get(26) + ""); |
| | | } |
| | | |
| | | lists.add(str); |
| | | } |
| | | }); |
| | | // structureItemParameterService.removeNoSample(sample.get()); |
| | | // å¦ææ°æ®åºéé¢çæ°æ®åå¨é£ä¹å°±æ§è¡æ´æ°æ·è´æä½ |
| | | try { |
| | | structureItemParameterService.saveOrUpdateBatch(lists); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("æå¡ç«¯æ¥é"); |
| | | } |
| | | structureItemParameterService.importEquipData(file); |
| | | return Result.success(); |
| | | } |
| | | |
| | |
| | | |
| | | List<TestItemDto> getItemTree(); |
| | | |
| | | int removeNoSample(@Param("sample") String sample); |
| | | |
| | | /** |
| | | * æ¥è¯¢è®¾å¤ä¿¡æ¯ |
| | | * @param managementNumberList |
| | | * @return |
| | | */ |
| | | List<Integer> selectDeviceIdsByNumber(@Param("managementNumberList") List<String> managementNumberList); |
| | | } |
| | | |
| | |
| | | @ApiModelProperty(value = "设å¤id") |
| | | private String deviceIds; |
| | | |
| | | @ApiModelProperty(value = "æ½æ£ç±»å, 1:æåº¦, 2:å£åº¦, 3:年度") |
| | | private String spotCheckType; |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.basic.pojo.StructureItemParameter; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | public interface StructureItemParameterService extends IService<StructureItemParameter> { |
| | | void removeNoSample(String sample); |
| | | |
| | | /** |
| | | * 导å
¥æ£éªé¡¹ç® |
| | | * @param file |
| | | */ |
| | | void importEquipData(MultipartFile file) throws IOException; |
| | | } |
| | |
| | | package com.ruoyi.basic.service.impl; |
| | | |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.poi.excel.ExcelUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.mapper.StructureItemParameterMapper; |
| | | import com.ruoyi.basic.pojo.StandardTemplate; |
| | | import com.ruoyi.basic.pojo.StructureItemParameter; |
| | | import com.ruoyi.basic.service.StandardTemplateService; |
| | | import com.ruoyi.basic.service.StructureItemParameterService; |
| | | import com.ruoyi.common.core.domain.entity.SysDictData; |
| | | import com.ruoyi.system.service.ISysDictTypeService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.concurrent.atomic.AtomicReference; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | @AllArgsConstructor |
| | |
| | | |
| | | @Resource |
| | | private StructureItemParameterMapper structureItemParameterMapper; |
| | | @Resource |
| | | private ISysDictTypeService dictTypeService; |
| | | @Resource |
| | | private StandardTemplateService standardTemplateService; |
| | | |
| | | /** |
| | | * |
| | | * @param file |
| | | */ |
| | | @Override |
| | | public void removeNoSample(String sample) { |
| | | structureItemParameterMapper.removeNoSample("\""+sample+"\""); |
| | | public void importEquipData(MultipartFile file) throws IOException { |
| | | InputStream inputStream = file.getInputStream(); |
| | | List<StructureItemParameter> lists = new ArrayList<>(); |
| | | AtomicReference<String> sample = new AtomicReference<>(); |
| | | ExcelUtil.readBySax(inputStream, -1, (i, l, list1) -> { |
| | | if (l == 1) { |
| | | sample.set(list1.get(1) + ""); |
| | | } |
| | | if (l >= 1) { |
| | | StructureItemParameter str = new StructureItemParameter(); |
| | | // æµè¯å¯¹è±¡ |
| | | if (list1.get(1) == null) { |
| | | str.setSample(null); |
| | | } else { |
| | | String brand = (String) list1.get(1); |
| | | StringBuilder builder = new StringBuilder(); |
| | | builder.append("["); |
| | | // 产å |
| | | if (ObjectUtil.isNotEmpty(list1.get(2))) { |
| | | String production = (String) list1.get(2); |
| | | if (!production.contains("ï¼")) { |
| | | builder.append(String.format("[\"%s\",\"%s\"]", brand, production)); |
| | | } else { |
| | | Arrays.stream(production.split("ï¼")).forEach(item -> { |
| | | builder.append(String.format("[\"%s\",\"%s\"],", brand, item)); |
| | | }); |
| | | builder.deleteCharAt(builder.length() - 1); |
| | | } |
| | | } else { |
| | | builder.append("["); |
| | | builder.append(String.format("\"%s\"", brand)); |
| | | builder.append("]"); |
| | | } |
| | | builder.append("]"); |
| | | str.setSample(builder.toString()); |
| | | } |
| | | // æ£éªé¡¹ |
| | | str.setInspectionItem(list1.get(4).toString().trim()); |
| | | // æ£éªé¡¹è±æ |
| | | if (list1.get(5) != null) { |
| | | str.setInspectionItemEn(list1.get(5).toString()); |
| | | } |
| | | // æ£éªå项 |
| | | if (list1.get(6) == null) { |
| | | str.setInspectionItemSubclass(null); |
| | | } else { |
| | | str.setInspectionItemSubclass(list1.get(6).toString().trim()); |
| | | } |
| | | // æ£éªåé¡¹è±æ |
| | | if (list1.get(7) == null) { |
| | | str.setInspectionItemSubclassEn(null); |
| | | } else { |
| | | str.setInspectionItemSubclassEn(String.valueOf(list1.get(7).toString())); |
| | | } |
| | | // æ£éªé¡¹åç±» |
| | | if (list1.get(22) != null && list1.get(22) != "") { |
| | | str.setInspectionItemClass(list1.get(22).toString().trim()); |
| | | } else { |
| | | str.setInspectionItemClass(null); |
| | | } |
| | | // æ£éªé¡¹åç±»è±æ |
| | | if (list1.get(23) != null && list1.get(23) != "") { |
| | | str.setInspectionItemClassEn(list1.get(23) + ""); |
| | | } else { |
| | | str.setInspectionItemClassEn(null); |
| | | } |
| | | |
| | | LambdaQueryWrapper<StructureItemParameter> wrapper = Wrappers.lambdaQuery(StructureItemParameter.class) |
| | | .eq(StructureItemParameter::getInspectionItem, str.getInspectionItem()) |
| | | .eq(StructureItemParameter::getSample, str.getSample()) |
| | | |
| | | .last("limit 1"); |
| | | // 夿æ¯å¦ææ£éªé¡¹ç±»å |
| | | if (ObjectUtils.isNotEmpty(str.getInspectionItemClass())) { |
| | | wrapper.eq(StructureItemParameter::getInspectionItemClass, str.getInspectionItemClass()); |
| | | } |
| | | |
| | | // 夿æ¯å¦ææ£éªå项 |
| | | if (ObjectUtils.isNotEmpty(str.getInspectionItemSubclass())) { |
| | | wrapper.eq(StructureItemParameter::getInspectionItemSubclass, str.getInspectionItemSubclass()); |
| | | } |
| | | StructureItemParameter db_str = this.getOne(wrapper); |
| | | if (ObjectUtils.isNotEmpty(db_str)) { |
| | | str.setId(db_str.getId()); |
| | | } |
| | | // æ¹æ³åç§° |
| | | if (list1.get(8) == null) { |
| | | str.setMethod(null); |
| | | } else { |
| | | StringBuffer buffer = new StringBuffer(); |
| | | String input = list1.get(8).toString(); |
| | | buffer.append("["); |
| | | String[] values = input.split("ï¼"); |
| | | for (String value : values) { |
| | | buffer.append("\"").append(value.trim()).append("\","); |
| | | } |
| | | buffer.deleteCharAt(buffer.length() - 1); |
| | | buffer.append("]"); |
| | | str.setMethod(buffer.toString()); |
| | | } |
| | | // è¯éªå®¤ |
| | | if (list1.get(9) == null) { |
| | | str.setSonLaboratory(null); |
| | | } else { |
| | | str.setSonLaboratory(list1.get(9).toString()); |
| | | } |
| | | // 计éåä½ |
| | | if (list1.get(10) == null) { |
| | | str.setUnit(null); |
| | | } else { |
| | | str.setUnit(list1.get(10).toString()); |
| | | } |
| | | // è¦æ±å¼ |
| | | if (list1.get(11) == null) { |
| | | str.setAskTell(null); |
| | | } else { |
| | | str.setAskTell(list1.get(11).toString()); |
| | | } |
| | | // è¦æ±æè¿° |
| | | if (list1.get(12) == null) { |
| | | str.setAsk(null); |
| | | } else { |
| | | str.setAsk(list1.get(12).toString()); |
| | | } |
| | | // åä»· |
| | | if (list1.get(13) == null) { |
| | | str.setPrice(null); |
| | | } else { |
| | | str.setPrice(list1.get(13) + ""); |
| | | } |
| | | // å·¥æ¶ç³»æ° |
| | | if (list1.get(14) == null) { |
| | | str.setManHour(null); |
| | | } else { |
| | | str.setManHour(Double.valueOf(list1.get(14).toString())); |
| | | } |
| | | // å·¥æ¶åç» |
| | | if (list1.get(15) == null) { |
| | | str.setManHourGroup(null); |
| | | } else { |
| | | str.setManHourGroup(list1.get(15).toString()); |
| | | } |
| | | // é¢è®¡å®ææ¶é´ |
| | | if (list1.get(16) == null) { |
| | | str.setManDay(null); |
| | | } else { |
| | | str.setManDay(Integer.valueOf(list1.get(16).toString())); |
| | | } |
| | | // æ°æ®ç±»å |
| | | String jy; |
| | | if (list1.get(17).toString().equals("éééç±»å")) { |
| | | jy = "0"; |
| | | } else { |
| | | jy = "1"; |
| | | // ç»å®è®¾å¤ |
| | | if (list1.get(28) == null) { |
| | | str.setRates(null); |
| | | } else { |
| | | // æ¥è¯¢è®¾å¤ä¿¡æ¯ |
| | | List<String> managementNumberList = StrUtil.split(list1.get(28).toString(), 'ï¼'); |
| | | if (CollectionUtils.isNotEmpty(managementNumberList)) { |
| | | List<Integer> deviceIds = structureItemParameterMapper.selectDeviceIdsByNumber(managementNumberList); |
| | | if (CollectionUtils.isNotEmpty(deviceIds)) { |
| | | str.setDeviceIds(CollUtil.join(deviceIds, ",")); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | str.setInspectionItemType(jy); |
| | | // æ£éªé¡¹ç±»å |
| | | String validateValueType = list1.get(18).toString(); |
| | | if (ObjectUtils.isNotEmpty(validateValueType)) { |
| | | List<SysDictData> enums = dictTypeService.selectDictDataByName("æ£éªå¼ç±»å") |
| | | .stream().filter(sysDictData -> sysDictData.getDictLabel().equals(validateValueType)).collect(Collectors.toList()); |
| | | str.setInspectionValueType(enums.get(0).getDictValue()); |
| | | } |
| | | int bsm; |
| | | //ç¹æ®æ è¯ |
| | | if (list1.get(19).toString().equals("å¦")) { |
| | | bsm = 0; |
| | | } else { |
| | | bsm = 1; |
| | | } |
| | | str.setBsm(bsm + ""); |
| | | // æ°ååå
¸ |
| | | if (list1.get(20) != null) { |
| | | str.setDic(list1.get(20) + ""); |
| | | } else { |
| | | str.setDic(null); |
| | | } |
| | | // åå§è®°å½æ¨¡æ¿ |
| | | StandardTemplate standTempIdByName = standardTemplateService.getStandTempIdByName(String.valueOf(list1.get(21))); |
| | | if (standTempIdByName != null) { |
| | | str.setTemplateId(standTempIdByName.getId()); |
| | | } else { |
| | | str.setTemplateId(null); |
| | | } |
| | | try { |
| | | if (list1.get(24) != null) { |
| | | str.setLaboratory(list1.get(24) + ""); |
| | | } |
| | | } catch (Exception e) { |
| | | } |
| | | |
| | | // æ¡ä»¶ |
| | | if (list1.get(25) == null) { |
| | | str.setRadiusList(null); |
| | | } else { |
| | | StringBuffer buffer = new StringBuffer(); |
| | | String input = list1.get(25).toString(); |
| | | buffer.append("["); |
| | | String[] values = input.split("ï¼"); |
| | | for (String value : values) { |
| | | buffer.append("\"").append(value.trim()).append("\","); |
| | | } |
| | | buffer.deleteCharAt(buffer.length() - 1); |
| | | buffer.append("]"); |
| | | str.setRadiusList(buffer.toString()); |
| | | } |
| | | //æ¶è´¹æ å |
| | | if (list1.get(26) == null) { |
| | | str.setRates(null); |
| | | } else { |
| | | str.setRates(list1.get(26) + ""); |
| | | } |
| | | // æ½æ ·ç±»å |
| | | String spotCheckType = list1.get(27).toString(); |
| | | if (ObjectUtils.isNotEmpty(spotCheckType)) { |
| | | List<SysDictData> enums = dictTypeService.selectDictDataByName("æ½æ£ç±»å") |
| | | .stream().filter(sysDictData -> sysDictData.getDictLabel().equals(spotCheckType)).collect(Collectors.toList()); |
| | | str.setSpotCheckType(enums.get(0).getDictValue()); |
| | | } |
| | | lists.add(str); |
| | | } |
| | | }); |
| | | try { |
| | | this.saveOrUpdateBatch(lists); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("æå¡ç«¯æ¥é"); |
| | | } |
| | | } |
| | | } |
| | |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.basic.mapper.StructureItemParameterMapper"> |
| | | <delete id="removeNoSample"> |
| | | delete |
| | | from structure_item_parameter |
| | | where sample like concat('%', #{sample}, '%') |
| | | </delete> |
| | | |
| | | <select id="selectItemParameterList" resultType="com.ruoyi.basic.pojo.StructureItemParameter"> |
| | | select * from (select A.id, |
| | | inspection_item, |
| | |
| | | code, |
| | | radius_list, |
| | | rates, |
| | | device_ids |
| | | device_ids, |
| | | spot_check_type |
| | | from (select *, |
| | | CASE |
| | | WHEN INSTR(sample, ',') > 0 THEN |
| | |
| | | from structure_test_object sto |
| | | left join product p on p.object_id = sto.id |
| | | </select> |
| | | <select id="selectDeviceIdsByNumber" resultType="java.lang.Integer"> |
| | | select id from device |
| | | where management_number in |
| | | <foreach item="item" collection="managementNumberList" open="(" separator="),(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </select> |
| | | |
| | | <resultMap id="itemDto" type="com.ruoyi.basic.dto.TestItemDto"> |
| | | <result column="sId" property="id"/> |
| | |
| | | List<Map<String, Object>> treeDevice(@Param("deviceName") String deviceName); |
| | | |
| | | DeviceDto selectDeviceByCode(Integer id); |
| | | |
| | | /** |
| | | * æ¥è¯¢å°è¾¾æ ¡åæææç设å¤-æå5天 |
| | | * @return |
| | | */ |
| | | List<Device> selectOverdueDevice(); |
| | | } |
| | | |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | import com.ruoyi.common.utils.WxCpUtils; |
| | | import com.ruoyi.device.dto.DeviceRecordDto; |
| | | import com.ruoyi.device.mapper.DeviceMapper; |
| | | import com.ruoyi.device.mapper.DeviceRecordMapper; |
| | | import com.ruoyi.device.pojo.Device; |
| | | import com.ruoyi.device.pojo.DeviceRecord; |
| | | import com.ruoyi.system.mapper.UserMapper; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | |
| | | */ |
| | | @Component |
| | | public class DeviceRecordSchedule { |
| | | |
| | | @Resource |
| | | private DeviceMapper deviceMapper; |
| | | @Resource |
| | | private DeviceRecordMapper deviceRecordMapper; |
| | | @Resource |
| | |
| | | * æéå¡«å设å¤ä½¿ç¨è®°å½ |
| | | */ |
| | | // @Scheduled(cron = "0/5 * * * * *") |
| | | @Scheduled(cron = "0 0 9 * * 6") // æ¯å¨å
æ§è¡ä¸æ¬¡ |
| | | // @Scheduled(cron = "0 0 9 * * 6") // æ¯å¨å
æ§è¡ä¸æ¬¡ |
| | | public void task1() { |
| | | // æ¥è¯¢æªå¡«åç设å¤ä½¿ç¨è®°å½ |
| | | List<DeviceRecordDto> deviceRecords = deviceRecordMapper.selectNotFilled(); |
| | |
| | | |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¯å¤©9ç¹æ§è¡ä¸æ¬¡ é¤äºææå¤© |
| | | * 夿æ¯å¦æè®¾å¤å°è¾¾æ ¡åæææ |
| | | */ |
| | | // @Scheduled(cron = "0/5 * * * * *") |
| | | // @Scheduled(cron = "0 0 9 * * 1-6") // æ¯å¤©9ç¹æ§è¡ä¸æ¬¡ é¤äºææå¤© |
| | | public void task2() { |
| | | // æ¥è¯¢å°è¾¾æ ¡åæææç设å¤-æå5天 |
| | | List<Device> deviceList = deviceMapper.selectOverdueDevice(); |
| | | Map<Integer, List<Device>> userPersonIdMap = deviceList.stream().collect(Collectors.groupingBy(Device::getEquipmentManager)); |
| | | userPersonIdMap.forEach((userId, recordList) -> { |
| | | threadPoolTaskExecutor.execute(() -> { |
| | | // ä¼ä¸å¾®ä¿¡éç¥å¡«å设å¤ä½¿ç¨è®°å½ |
| | | User user = userMapper.selectById(userId); |
| | | String message = ""; |
| | | message += "设å¤ä½¿ç¨è®°å½æªå¡«åæééç¥"; |
| | | for (Device deviceRecord : recordList) { |
| | | message += "\n设å¤åç§°ç¼å·: " + deviceRecord.getDeviceName() + "-" + deviceRecord.getManagementNumber(); |
| | | message += "\nå§æç¼å·: " + deviceRecord.getSampleCode(); |
| | | message += "\n"; |
| | | } |
| | | message += "\n请å»å¡«å设å¤ä½¿ç¨è®°å½"; |
| | | |
| | | //åéä¼ä¸å¾®ä¿¡æ¶æ¯éç¥ |
| | | try { |
| | | WxCpUtils.inform(user.getAccount(), message, null); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | } |
| | |
| | | <resultMap id="deviceNameMap" type="map"> |
| | | <result property="value" column="id"/> |
| | | <result property="label" column="device_name"/> |
| | | <result property="activationDate" column="activation_date"/> |
| | | <result property="managementNumber" column="management_number"/> |
| | | </resultMap> |
| | | |
| | |
| | | case when d.storage_point is null || d.storage_point ='' then 'å
¶ä»' else d.storage_point end as storage_point, |
| | | d.device_name, |
| | | d.management_number, |
| | | null as value |
| | | null as value, |
| | | d.activation_date |
| | | from device d |
| | | LEFT JOIN laboratory l ON l.id = d.subordinate_departments_id |
| | | <where> |
| | |
| | | and device_name like concat('%',#{deviceName},'%') |
| | | </if> |
| | | </where> |
| | | order by l.laboratory_name desc, d.storage_point desc |
| | | </select> |
| | | |
| | | <select id="selectDeviceByCode" resultType="com.ruoyi.device.dto.DeviceDto"> |
| | |
| | | u1.name, |
| | | u2.name |
| | | </select> |
| | | |
| | | <!-- æ¥è¯¢å°è¾¾æ ¡åæææç设å¤-æå5天 --> |
| | | <select id="selectOverdueDevice" resultType="com.ruoyi.device.pojo.Device"> |
| | | SELECT * |
| | | FROM device |
| | | WHERE |
| | | -- çéåº activation_date å¨å½åæ¥æåäºå¤©å
çæ°æ® |
| | | activation_date BETWEEN now() AND now() + INTERVAL 5 DAY |
| | | -- çéåº activation_date å·²ç»è¶
è¿å½åæ¥æçæ°æ® |
| | | OR activation_date < now() |
| | | </select> |
| | | </mapper> |
| | |
| | | @Resource |
| | | private ManageRecordIntervalsTotalService manageRecordIntervalsTotalService; |
| | | |
| | | @Scheduled(cron = "0 0 2 1 1 ?") //æ¯å¹´1æ1å·2ç¹ |
| | | // @Scheduled(cron = "0 0 2 1 1 ?") //æ¯å¹´1æ1å·2ç¹ |
| | | public void manageRecordTotal() { |
| | | ManageRecordTotal manageRecordTotal = new ManageRecordTotal(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | |
| | | @Resource |
| | | private InternalImplementDetailService internalImplementDetailService; |
| | | |
| | | |
| | | @Resource |
| | | private UserMapper userMapper; |
| | | @Value("${file.path}") |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | * æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author |
| | | * @author |
| | | * @since 2024-11-11 09:33:47 |
| | | */ |
| | | @Service |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | * æä»¶ä¿®è®¢ç³è¯·å®¡æ¹è®°å½ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author |
| | | * @author |
| | | * @since 2024-11-14 10:29:18 |
| | | */ |
| | | @Service |
| | |
| | | OutputStream outputStream = new FileOutputStream(file); |
| | | IOUtils.copy(inputStream, outputStream); |
| | | url = file.getAbsolutePath(); |
| | | inputStream.close(); |
| | | outputStream.close(); |
| | | } catch (FileNotFoundException e) { |
| | | throw new ErrorException("æ¾ä¸å°æ¨¡æ¿æä»¶"); |
| | | } catch (IOException e) { |
| | |
| | | * ä½åºæä»¶ééè®°å½ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author |
| | | * @author |
| | | * @since 2024-11-13 01:27:22 |
| | | */ |
| | | @Service |
| | |
| | | OutputStream outputStream = new FileOutputStream(file); |
| | | IOUtils.copy(inputStream, outputStream); |
| | | url = file.getAbsolutePath(); |
| | | inputStream.close(); |
| | | outputStream.close(); |
| | | } catch (FileNotFoundException e) { |
| | | throw new ErrorException("æ¾ä¸å°æ¨¡æ¿æä»¶"); |
| | | } catch (IOException e) { |
| | |
| | | * æä»¶å®¡æ¹è®°å½(å«ä¿®è®¢å忬¡å®¡æ¹è®°å½) æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author |
| | | * @author |
| | | * @since 2024-11-12 02:31:36 |
| | | */ |
| | | @Service |
| | |
| | | OutputStream outputStream = new FileOutputStream(file); |
| | | IOUtils.copy(inputStream, outputStream); |
| | | url = file.getAbsolutePath(); |
| | | inputStream.close(); |
| | | outputStream.close(); |
| | | } catch (FileNotFoundException e) { |
| | | throw new ErrorException("æ¾ä¸å°æ¨¡æ¿æä»¶"); |
| | | } catch (IOException e) { |
| | |
| | | OutputStream outputStream = new FileOutputStream(file); |
| | | IOUtils.copy(inputStream, outputStream); |
| | | url = file.getAbsolutePath(); |
| | | inputStream.close(); |
| | | outputStream.close(); |
| | | } catch (FileNotFoundException e) { |
| | | throw new ErrorException("æ¾ä¸å°æ¨¡æ¿æä»¶"); |
| | | } catch (IOException e) { |
| | |
| | | OutputStream outputStream = new FileOutputStream(file); |
| | | IOUtils.copy(inputStream, outputStream); |
| | | url = file.getAbsolutePath(); |
| | | inputStream.close(); |
| | | outputStream.close(); |
| | | } catch (FileNotFoundException e) { |
| | | throw new ErrorException("æ¾ä¸å°æ¨¡æ¿æä»¶"); |
| | | } catch (IOException e) { |
| | |
| | | OutputStream outputStream = new FileOutputStream(file); |
| | | IOUtils.copy(inputStream, outputStream); |
| | | url = file.getAbsolutePath(); |
| | | inputStream.close(); |
| | | outputStream.close(); |
| | | } catch (FileNotFoundException e) { |
| | | throw new ErrorException("æ¾ä¸å°æ¨¡æ¿æä»¶"); |
| | | } catch (IOException e) { |
| | |
| | | OutputStream outputStream = new FileOutputStream(file); |
| | | IOUtils.copy(inputStream, outputStream); |
| | | url = file.getAbsolutePath(); |
| | | inputStream.close(); |
| | | outputStream.close(); |
| | | } catch (FileNotFoundException e) { |
| | | throw new ErrorException("æ¾ä¸å°æ¨¡æ¿æä»¶"); |
| | | } catch (IOException e) { |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | * 管çè¯å®¡æ¥å æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author |
| | | * @author |
| | | * @since 2024-11-12 04:44:39 |
| | | */ |
| | | @Service |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | * 人åè½å æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author |
| | | * @author |
| | | * @since 2024-10-10 11:26:18 |
| | | */ |
| | | @Service |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | * ä»»èææè®°å½ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author |
| | | * @author |
| | | * @since 2024-10-09 10:48:17 |
| | | */ |
| | | @Service |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | private ThreadPoolTaskExecutor threadPoolTaskExecutor; |
| | | |
| | | /** |
| | | * æéå¡«å设å¤ä½¿ç¨è®°å½ |
| | | * æéå¡«å人åå¹è®è®°å½ |
| | | */ |
| | | // @Scheduled(cron = "0/5 * * * * *") |
| | | @Scheduled(cron = "0 0 9 1 * *") // æ¯æä¸å·æ§è¡ |
| | | // @Scheduled(cron = "0 0 9 1,15 * *") // æ¯æä¸å·æ§è¡ |
| | | public void task1() { |
| | | // æ¥è¯¢å½æå¹è®è®¡å |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.M"); |
| | |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢æ£éªæ¥ååæ¾ç»è®°å表") |
| | | @GetMapping("/pageProcessReport") |
| | | public Result pageProcessReport(ProcessReport processReport , Page page) { |
| | | public Result pageProcessReport(ProcessReportDto processReport , Page page) { |
| | | return Result.success(processReportService.pageProcessReport(page, processReport)); |
| | | } |
| | | |
| | |
| | | |
| | | @ApiOperation(value = "å¯¼åºæ£éªæ¥ååæ¾ç»è®°è¡¨") |
| | | @GetMapping("/exportProcessReport") |
| | | public void exportProcessReport(String ids, HttpServletResponse response) { |
| | | List<Integer> list = Arrays.stream(ids.split(",")) |
| | | .map(Integer::parseInt) |
| | | .collect(Collectors.toList()); |
| | | processReportService.exportProcessReport(list, response); |
| | | public void exportProcessReport(ProcessReportDto dto, HttpServletResponse response) { |
| | | processReportService.exportProcessReport(dto, response); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.process.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.process.pojo.QualitySupervise; |
| | | import com.ruoyi.process.pojo.QualitySuperviseManagementReview; |
| | | import com.ruoyi.process.service.QualitySuperviseManagementReviewService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¨éçç£ç®¡çè¯å®¡è¾å
¥ææ å端æ§å¶å¨ |
| | | * </p> |
| | | * |
| | | * @author |
| | | * @since 2025-05-07 10:46:11 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/managementReview") |
| | | @Api(tags = "è´¨éçç£ç®¡çè¯å®¡è¾å
¥ææ") |
| | | @AllArgsConstructor |
| | | public class QualitySuperviseManagementReviewController { |
| | | |
| | | private QualitySuperviseManagementReviewService qualitySuperviseManagementReviewService; |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "å页æ¥è¯¢") |
| | | @GetMapping("/pageManagementReview") |
| | | public Result<IPage<QualitySuperviseManagementReview>> pageManagementReview(QualitySuperviseManagementReview managementReview, Page page) { |
| | | return Result.success(qualitySuperviseManagementReviewService.pageManagementReview(page, managementReview)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æä¿®æ¹ |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "æ°å¢æä¿®æ¹") |
| | | @PostMapping("/saveOrUpdateManagementReview") |
| | | public Result saveOrUpdateManagementReview(@RequestBody QualitySuperviseManagementReview managementReview) { |
| | | return Result.success(qualitySuperviseManagementReviewService.saveOrUpdate(managementReview)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "å é¤") |
| | | @DeleteMapping("/deleteManagementReview") |
| | | public Result deleteManagementReview(Integer managementReviewId) { |
| | | return Result.success(qualitySuperviseManagementReviewService.removeById(managementReviewId)); |
| | | } |
| | | |
| | | /** |
| | | * å¯¼åº |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "导åº") |
| | | @GetMapping("/exportManagementReview") |
| | | public void exportManagementReview(Integer managementReviewId,HttpServletResponse response) { |
| | | qualitySuperviseManagementReviewService.exportManagementReview(managementReviewId, response); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.process.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.ruoyi.process.pojo.ProcessDeal; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author zhuo |
| | | * @Date 2025/4/23 |
| | | */ |
| | | @Data |
| | | public class ProcessDealDto extends ProcessDeal { |
| | | @ApiModelProperty("åºå·") |
| | | private String indexs; |
| | | |
| | | @ApiModelProperty("æ¶é´") |
| | | private String dealTimeStr; |
| | | } |
| | |
| | | package com.ruoyi.process.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.deepoove.poi.data.PictureRenderData; |
| | | import com.ruoyi.process.pojo.ProcessReport; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | //å¯¼åº |
| | | public class ProcessReportDto { |
| | | public class ProcessReportDto extends ProcessReport { |
| | | |
| | | private List<Integer> ids; |
| | | |
| | | @ApiModelProperty("åé人å§å") |
| | | private String sendUserName; |
| | | |
| | | @ApiModelProperty("åé人å°å") |
| | | private String sendUserUrl; |
| | | |
| | | @ApiModelProperty("åé人ç¾å") |
| | | private PictureRenderData sendUserRender; |
| | | |
| | | @ApiModelProperty("ç¾æ¶ç¾å") |
| | | private PictureRenderData signatoryRender; |
| | | |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.process.dto.ProcessDealDto; |
| | | import com.ruoyi.process.pojo.ProcessDeal; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | |
| | | IPage<ProcessDeal> pageProcessDeal(Page page, @Param("ew") QueryWrapper<ProcessDeal> queryWrappers); |
| | | |
| | | List<ProcessDeal> selectDeal(@Param("id") Integer id); |
| | | List<ProcessDealDto> selectDeal(@Param("id") Integer id); |
| | | |
| | | } |
| | |
| | | |
| | | Set<String> selectDeviceNumber(@Param("inspectionOrderId") Integer inspectionOrderId); |
| | | |
| | | List<Integer> selectDeviceIdsByNumbers(@Param("orderDeviceNumbers") Set<String> orderDeviceNumbers); |
| | | List<Integer> selectDeviceIdsByNumbers(@Param("deviceNumbers") Set<String> deviceNumbers); |
| | | |
| | | IPage<ProcessOrderDevice> deviceRecordPage(@Param("deviceId") Integer deviceId, @Param("page") Page page, @Param("sampleCode") String sampleCode, @Param("managementNumber") String managementNumber); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.process.dto.ProcessReportDto; |
| | | import com.ruoyi.process.pojo.ProcessReport; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | */ |
| | | public interface ProcessReportMapper extends BaseMapper<ProcessReport> { |
| | | |
| | | IPage<ProcessReport> pageProcessReport(Page page, @Param("ew") QueryWrapper<ProcessReport> queryWrappers); |
| | | IPage<ProcessReportDto> pageProcessReport(Page page, @Param("ew") QueryWrapper<ProcessReportDto> queryWrappers); |
| | | |
| | | List<ProcessReport> getIds(@Param("ids") List<Integer> ids); |
| | | List<ProcessReportDto> exportProcessReport(); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.process.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.process.pojo.QualitySuperviseManagementReview; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¨éçç£ç®¡çè¯å®¡è¾å
¥ææ Mapper æ¥å£ |
| | | * </p> |
| | | * |
| | | * @author |
| | | * @since 2025-05-07 10:46:11 |
| | | */ |
| | | public interface QualitySuperviseManagementReviewMapper extends BaseMapper<QualitySuperviseManagementReview> { |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * @param page |
| | | * @return |
| | | */ |
| | | IPage<QualitySuperviseManagementReview> pageManagementReview(@Param("page") Page page, @Param("ew") QueryWrapper<QualitySuperviseManagementReview> ew); |
| | | } |
| | |
| | | |
| | | @ApiModelProperty("å
³èçæ ·åæ¥æ¶id") |
| | | private Integer processSampleId; |
| | | |
| | | @ApiModelProperty("åºå·") |
| | | @TableField(select = false,exist = false) |
| | | private String indexs; |
| | | } |
| | |
| | | |
| | | @ApiModelProperty("åé人") |
| | | private Integer sendUser; |
| | | |
| | | @TableField(select = false,exist = false) |
| | | private String sendUserName; |
| | | |
| | | @ApiModelProperty("ç¾æ¶äºº") |
| | | private String signatory; |
| | | |
| | | |
| | | @TableField(select = false,exist = false) |
| | | private String signatoryUrl; |
| | | |
| | | @TableField(select = false,exist = false) |
| | | private String signatoryName; |
| | | |
| | | @ApiModelProperty("夿³¨") |
| | | private String remark; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.process.pojo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¨éçç£ç®¡çè¯å®¡è¾å
¥ææ |
| | | * </p> |
| | | * |
| | | * @author |
| | | * @since 2025-05-07 10:46:11 |
| | | */ |
| | | @Getter |
| | | @Setter |
| | | @TableName("cnas_quality_supervise_management_review") |
| | | @ApiModel(value = "QualitySuperviseManagementReview对象", description = "è´¨éçç£ç®¡çè¯å®¡è¾å
¥ææ") |
| | | public class QualitySuperviseManagementReview implements Serializable { |
| | | |
| | | @TableId(value = "management_review_id", type = IdType.AUTO) |
| | | private Integer managementReviewId; |
| | | |
| | | @ApiModelProperty("æä»¶åç§°") |
| | | private String fileName; |
| | | |
| | | @ApiModelProperty("计åå
容") |
| | | private String implementationContent; |
| | | |
| | | @ApiModelProperty("卿å
容") |
| | | private String dynamicContent; |
| | | |
| | | @ApiModelProperty("çç£äºº") |
| | | private String supervisor; |
| | | |
| | | @ApiModelProperty("è´¨éè¯å®¡æ¥æ") |
| | | private LocalDate superviseDate; |
| | | |
| | | @ApiModelProperty("å建人") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Integer createUser; |
| | | |
| | | @ApiModelProperty("å建æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹äºº") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Integer updateUser; |
| | | |
| | | @ApiModelProperty("ä¿®æ¹æ¶é´") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private LocalDateTime updateTime; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.process.dto.ProcessReportDto; |
| | | import com.ruoyi.process.pojo.ProcessReport; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | */ |
| | | public interface ProcessReportService extends IService<ProcessReport> { |
| | | |
| | | IPage<ProcessReport> pageProcessReport(Page page, ProcessReport processReport); |
| | | IPage<ProcessReportDto> pageProcessReport(Page page, ProcessReportDto processReport); |
| | | |
| | | void exportProcessReport(List<Integer> ids, HttpServletResponse response); |
| | | void exportProcessReport(ProcessReportDto dto, HttpServletResponse response); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.process.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.process.pojo.QualitySuperviseManagementReview; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¨éçç£ç®¡çè¯å®¡è¾å
¥ææ æå¡ç±» |
| | | * </p> |
| | | * |
| | | * @author |
| | | * @since 2025-05-07 10:46:11 |
| | | */ |
| | | public interface QualitySuperviseManagementReviewService extends IService<QualitySuperviseManagementReview> { |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * @param page |
| | | * @param managementReview |
| | | * @return |
| | | */ |
| | | IPage<QualitySuperviseManagementReview> pageManagementReview(Page page, QualitySuperviseManagementReview managementReview); |
| | | |
| | | /** |
| | | * å¯¼åº |
| | | * @param managementReviewId |
| | | * @param response |
| | | */ |
| | | void exportManagementReview(Integer managementReviewId, HttpServletResponse response); |
| | | } |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | import cn.hutool.core.lang.UUID; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.deepoove.poi.XWPFTemplate; |
| | |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | import com.ruoyi.common.utils.QueryWrappers; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.SignatureImageUtil; |
| | | import com.ruoyi.framework.exception.ErrorException; |
| | | import com.ruoyi.inspect.util.HackLoopTableRenderPolicy; |
| | | import com.ruoyi.process.dto.ProcessReportDto; |
| | | import com.ruoyi.process.mapper.ProcessReportMapper; |
| | | import com.ruoyi.process.pojo.ProcessReport; |
| | | import com.ruoyi.process.service.ProcessReportService; |
| | | import com.ruoyi.system.mapper.UserMapper; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.poi.xwpf.usermodel.*; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | @Resource |
| | | private ProcessReportMapper processReportMapper; |
| | | |
| | | |
| | | @Value("${wordUrl}") |
| | | private String wordUrl; |
| | | @Value("${file.path}") |
| | | private String imgUrl; |
| | | |
| | | @Resource |
| | | private UserMapper userMapper; |
| | | |
| | | @Override |
| | | public IPage<ProcessReport> pageProcessReport(Page page, ProcessReport processReport) { |
| | | //todo ä»
çæ |
| | | IPage<ProcessReport> processReportIPage = processReportMapper.pageProcessReport(page, QueryWrappers.queryWrappers(processReport)); |
| | | // for (ProcessReport record : processReportIPage.getRecords()) { |
| | | // List<String> name = new ArrayList<>(); |
| | | // for (String s : record.getSignatory().split(",")) { |
| | | // User user = userMapper.selectById(Integer.parseInt(s)); |
| | | // name.add(user.getName()); |
| | | // } |
| | | // String signatoryName = name.stream().collect(Collectors.joining(",")); |
| | | // record.setSignatoryName(signatoryName); |
| | | // } |
| | | public IPage<ProcessReportDto> pageProcessReport(Page page, ProcessReportDto processReport) { |
| | | IPage<ProcessReportDto> processReportIPage = processReportMapper.pageProcessReport(page, QueryWrappers.queryWrappers(processReport)); |
| | | |
| | | return processReportIPage; |
| | | } |
| | | |
| | | @Override |
| | | public void exportProcessReport(List<Integer> ids, HttpServletResponse response) { |
| | | List<ProcessReport> processReports = processReportMapper.getIds(ids); |
| | | // for (ProcessReport record : processReports) { |
| | | // List<String> name = new ArrayList<>(); |
| | | // if(StringUtils.isNotBlank(record.getSignatory())){ |
| | | // for (String s : record.getSignatory().split(",")) { |
| | | // User user = userMapper.selectById(Integer.parseInt(s)); |
| | | // name.add(user.getName()); |
| | | // } |
| | | // String signatoryName = name.stream().collect(Collectors.joining(",")); |
| | | // record.setSignatoryName(signatoryName); |
| | | // } |
| | | // } |
| | | public void exportProcessReport(ProcessReportDto dto, HttpServletResponse response) { |
| | | List<ProcessReportDto> processReports = processReportMapper.exportProcessReport(); |
| | | for (ProcessReportDto processReport : processReports) { |
| | | // åé人çæç¾åå¾ç |
| | | processReport.setSendUserRender(StringUtils.isNotBlank(processReport.getSendUserUrl()) |
| | | ? Pictures.ofLocal(imgUrl + "/" + processReport.getSendUserUrl()).create() : null); |
| | | |
| | | // ç¾æ¶äººçæå¾ç |
| | | processReport.setSignatoryRender(StringUtils.isNotBlank(processReport.getSignatory()) |
| | | ? Pictures.ofStream(SignatureImageUtil.saveImageToFile(processReport.getSignatory())).create() : null); |
| | | } |
| | | |
| | | // è·åè·¯å¾ |
| | | InputStream inputStream = this.getClass().getResourceAsStream("/static/report-deal.docx"); |
| | | Configure configure = Configure.builder() |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | import com.ruoyi.framework.exception.ErrorException; |
| | | import com.ruoyi.inspect.util.HackLoopTableRenderPolicy; |
| | | import com.ruoyi.inspect.util.UserUtils; |
| | | import com.ruoyi.process.dto.ProcessDealDto; |
| | | import com.ruoyi.process.mapper.InspectionOrderMapper; |
| | | import com.ruoyi.process.mapper.ProcessDealMapper; |
| | | import com.ruoyi.process.mapper.ProcessSampleMapper; |
| | |
| | | |
| | | @Override |
| | | public void exportProcessTotaldeal(Integer id, HttpServletResponse response) { |
| | | List<ProcessDeal> sampleDealDtos = processDealMapper.selectDeal(id); |
| | | List<ProcessDealDto> sampleDealDtos = processDealMapper.selectDeal(id); |
| | | ProcessTotaldeal processTotaldeal = processTotaldealMapper.selectById(id); |
| | | |
| | | // è·åè·¯å¾ |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | if (qualityMonitorDetailsId == null) { |
| | | throw new ErrorException("缺å°çæ§è¯¦æ
id"); |
| | | } |
| | | QualityMonitorDetails qualityMonitorDetails = qualityMonitorDetailsService.getOne(Wrappers.<QualityMonitorDetails>lambdaUpdate() |
| | | .eq(QualityMonitorDetails::getQualityMonitorDetailsId, qualityMonitorDetailsId)); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | Integer userId =SecurityUtils.getUserId().intValue(); |
| | | |
| | | String contentType = file.getContentType(); |
| | | String urlString; |
| | | String pathName; |
| | | try { |
| | |
| | | urlString = realpath + "/" + pathName; |
| | | file.transferTo(new File(urlString)); |
| | | |
| | | wordInsertUrl(new HashMap<String, Object>() {{ |
| | | put("writeUrl", UserUtils.getFinalUserSignatureUrl(userId)); |
| | | put("writeDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(now)).create()); |
| | | }}, wordUrl + "/" + pathName.replace("/word", wordUrl)); |
| | | // 夿æ¯å¦æ¯pdf |
| | | if (!contentType.contains("pdf")) { |
| | | wordInsertUrl(new HashMap<String, Object>() {{ |
| | | put("writeUrl", UserUtils.getFinalUserSignatureUrl(userId)); |
| | | put("writeDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(now)).create()); |
| | | }}, wordUrl + "/" + pathName.replace("/word", wordUrl)); |
| | | } |
| | | |
| | | qualityMonitorDetailsService.update(Wrappers.<QualityMonitorDetails>lambdaUpdate() |
| | | .eq(QualityMonitorDetails::getQualityMonitorDetailsId, qualityMonitorDetailsId) |
| | |
| | | |
| | | // æ·»å æ¹å人 |
| | | QualityMonitorDetails details = qualityMonitorDetailsMapper.selectById(qualityMonitorDetails.getQualityMonitorDetailsId()); |
| | | if (StringUtils.isNotBlank(details.getFinishReportUrl())) { |
| | | if (StringUtils.isNotBlank(details.getFinishReportUrl()) && !details.getFinishReportUrl().contains(".pdf")) { |
| | | wordInsertUrl(new HashMap<String, Object>() {{ |
| | | put("ratifyUrl", UserUtils.getFinalUserSignatureUrl(userId)); |
| | | put("ratifyDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(now)).create()); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.process.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.deepoove.poi.XWPFTemplate; |
| | | import com.deepoove.poi.config.Configure; |
| | | import com.deepoove.poi.config.ConfigureBuilder; |
| | | import com.deepoove.poi.data.Pictures; |
| | | import com.ruoyi.common.utils.QueryWrappers; |
| | | import com.ruoyi.framework.exception.ErrorException; |
| | | import com.ruoyi.process.dto.QualitySuperviseDetailsCorrectDto; |
| | | import com.ruoyi.process.pojo.QualitySuperviseDetailsCorrect; |
| | | import com.ruoyi.process.pojo.QualitySuperviseManagementReview; |
| | | import com.ruoyi.process.mapper.QualitySuperviseManagementReviewMapper; |
| | | import com.ruoyi.process.service.QualitySuperviseManagementReviewService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.HashMap; |
| | | |
| | | /** |
| | | * <p> |
| | | * è´¨éçç£ç®¡çè¯å®¡è¾å
¥ææ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author |
| | | * @since 2025-05-07 10:46:11 |
| | | */ |
| | | @Service |
| | | public class QualitySuperviseManagementReviewServiceImpl extends ServiceImpl<QualitySuperviseManagementReviewMapper, QualitySuperviseManagementReview> implements QualitySuperviseManagementReviewService { |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * @param page |
| | | * @param managementReview |
| | | * @return |
| | | */ |
| | | @Override |
| | | public IPage<QualitySuperviseManagementReview> pageManagementReview(Page page, QualitySuperviseManagementReview managementReview) { |
| | | return baseMapper.pageManagementReview(page, QueryWrappers.queryWrappers(managementReview)); |
| | | } |
| | | |
| | | /** |
| | | * å¯¼åº |
| | | * @param managementReviewId |
| | | * @param response |
| | | */ |
| | | @Override |
| | | public void exportManagementReview(Integer managementReviewId, HttpServletResponse response) { |
| | | QualitySuperviseManagementReview managementReview = baseMapper.selectById(managementReviewId); |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyå¹´MMæddæ¥"); |
| | | |
| | | // è·åè·¯å¾ |
| | | InputStream inputStream = this.getClass().getResourceAsStream("/static/supervise-management-eview.docx"); |
| | | ConfigureBuilder builder = Configure.builder(); |
| | | builder.useSpringEL(true); |
| | | XWPFTemplate template = XWPFTemplate.compile(inputStream, builder.build()).render( |
| | | new HashMap<String, Object>() {{ |
| | | put("managementReview", managementReview); |
| | | put("superviseDateStr", managementReview.getSuperviseDate() == null ? null : managementReview.getSuperviseDate().format(formatter)); |
| | | }}); |
| | | |
| | | try { |
| | | response.setContentType("application/msword"); |
| | | String fileName = URLEncoder.encode( |
| | | managementReview.getFileName(), "UTF-8"); |
| | | response.setHeader("Content-disposition", |
| | | "attachment;filename=" + fileName + ".docx"); |
| | | OutputStream os = response.getOutputStream(); |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | | } |
| | | } |
| | | } |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | public void exportSuperviseDetailRecord(Integer superviseDetailsId, HttpServletResponse response) { |
| | | QualitySuperviseDetailsRecord recordDto = qualitySuperviseDetailsRecordMapper.selectSuperviseDetailRecord(superviseDetailsId); |
| | | |
| | | //è·åææ¯è´è´£äººçç¾åå°å |
| | | String ratifyUrl = null; |
| | | if (recordDto.getRatifyUserId() != null) { |
| | | ratifyUrl = userMapper.selectById(recordDto.getRatifyUserId()).getSignatureUrl(); |
| | | if (StringUtils.isBlank(ratifyUrl)) { |
| | | throw new ErrorException("æ¾ä¸å°ææ¯è´è´£äººçç¾å"); |
| | | } |
| | | // æ¥è¯¢æ£æµäººå |
| | | User tserUser = new User(); |
| | | if (StringUtils.isNotBlank(recordDto.getTestMember())) { |
| | | tserUser = userMapper.selectOne(Wrappers.<User>lambdaQuery() |
| | | .eq(User::getName, recordDto.getTestMember()) |
| | | .last("limit 1")); |
| | | } |
| | | |
| | | // è·åè·¯å¾ |
| | | InputStream inputStream = this.getClass().getResourceAsStream("/static/supervision-detail-record.docx"); |
| | | ConfigureBuilder builder = Configure.builder(); |
| | | builder.useSpringEL(true); |
| | | String finalRatifyUrl = ratifyUrl; |
| | | User finalTserUser = tserUser; |
| | | XWPFTemplate template = XWPFTemplate.compile(inputStream, builder.build()).render( |
| | | new HashMap<String, Object>() {{ |
| | | put("supervision", recordDto); |
| | | put("testMemberUrl", UserUtils.getFinalUserSignatureUrl(finalTserUser.getId())); |
| | | put("supervisoruUrl", UserUtils.getFinalUserSignatureUrl(recordDto.getSupervisor())); |
| | | put("technicalDirectorUrl", StringUtils.isNotBlank(finalRatifyUrl) ? Pictures.ofLocal(imgUrl + "/" + finalRatifyUrl).create() : null); |
| | | put("technicalDirectorUrl", UserUtils.getFinalUserSignatureUrl(recordDto.getRatifyUserId())); |
| | | put("technicalDirectorDateUrl", recordDto.getRatifyTime() != null ? |
| | | Pictures.ofStream(DateImageUtil.createDateImage(recordDto.getRatifyTime())).create() : null); |
| | | }}); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | package com.ruoyi.process.task; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | import com.ruoyi.common.utils.WxCpUtils; |
| | | import com.ruoyi.process.mapper.QualitySuperviseDetailsMapper; |
| | | import com.ruoyi.process.mapper.QualitySuperviseDetailsRecordMapper; |
| | | import com.ruoyi.process.mapper.QualitySuperviseManagementReviewMapper; |
| | | import com.ruoyi.process.pojo.QualitySuperviseDetails; |
| | | import com.ruoyi.process.pojo.QualitySuperviseDetailsRecord; |
| | | import com.ruoyi.process.pojo.QualitySuperviseManagementReview; |
| | | import com.ruoyi.system.mapper.UserMapper; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * å¹è®è®¡åä½¿ç¨æéè®°å½æé |
| | | * è´¨éçç£å¡«åæé |
| | | */ |
| | | @Component |
| | | public class QualitySuperviseSchedule { |
| | |
| | | private UserMapper userMapper; |
| | | @Resource |
| | | private ThreadPoolTaskExecutor threadPoolTaskExecutor; |
| | | @Resource |
| | | private QualitySuperviseManagementReviewMapper qualitySuperviseManagementReviewMapper; |
| | | @Resource |
| | | private QualitySuperviseDetailsRecordMapper qualitySuperviseDetailsRecordMapper; |
| | | |
| | | /** |
| | | * æéå¡«å设å¤ä½¿ç¨è®°å½ |
| | | * è´¨éçç£å¡«åæé |
| | | */ |
| | | // @Scheduled(cron = "0/5 * * * * *") |
| | | @Scheduled(cron = "0 0 9 1 * *") // æ¯æ1å·æ§è¡ |
| | | // @Scheduled(cron = "0 0 9 1 * *") // æ¯æ1å·æ§è¡ |
| | | public void task1() { |
| | | // æ¥è¯¢å½æçç£è®¡å |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.M"); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * æ¯æ28å·èªå¨çæè´¨éçç£æ»ç» |
| | | */ |
| | | // @Scheduled(cron = "0/5 * * * * *") |
| | | // @Scheduled(cron = "0 0 9 28 * *") // æ¯æ28å·æ§è¡ |
| | | public void task2() { |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | // æ¥è¯¢å½æçç£è®¡å |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.M"); |
| | | String format = now.format(formatter); |
| | | List<QualitySuperviseDetails> qualitySuperviseDetails = qualitySuperviseDetailsMapper.selectList(Wrappers.<QualitySuperviseDetails>lambdaQuery() |
| | | .eq(QualitySuperviseDetails::getSuperviseTime, format)); |
| | | |
| | | // æ ¹æ®å®æçç£å卿çç£åºå |
| | | Map<String, List<QualitySuperviseDetails>> superviseReasonMap = qualitySuperviseDetails.stream().collect(Collectors.groupingBy(QualitySuperviseDetails::getSuperviseReason)); |
| | | |
| | | // è·åå½ææ¥æ |
| | | DateTimeFormatter formatter2 = DateTimeFormatter.ofPattern("yyyyå¹´MMæ"); |
| | | String format2 = now.format(formatter2); |
| | | |
| | | // è·å计åå
容 |
| | | String implementationSupervisee = ""; |
| | | List<QualitySuperviseDetails> implementationList = superviseReasonMap.get("宿çç£"); |
| | | if (CollectionUtils.isNotEmpty(implementationList)) { |
| | | // è·å宿çç£äººåä¿¡æ¯ |
| | | List<String> collect = implementationList.stream().map(QualitySuperviseDetails::getSupervisee).collect(Collectors.toList()); |
| | | implementationSupervisee = CollUtil.join(collect, ","); |
| | | } |
| | | String implementationContent = "å·¥ä½ä¸ä¸¥æ ¼æç
§å¹´åº¦è´¨éçç£å·¥ä½è®¡åè¿è¡æ§è¡ã{}对{}è¿è¡ä¸æ¬¡å®æçç£ãå¨çç£è¿ç¨ä¸ï¼æ²¡æåç°ä¸ç¬¦åçç°è±¡ãæ£éªåè½çç»çæç
§è§å®çè¦æ±è¿è¡è®¾å¤çæä½ï¼å¯¹äºæ åè½çè®°ï¼æä½¿ç¨ç设å¤å卿 ¡å卿å
ï¼è½æ¸
æ¥å®æ´ççè®°å½åå§æ°æ®å¹¶åºå
·æ¥åï¼å¨è¯éªç¯å¢æ¹é¢ï¼è½å¤ä¸¥æ ¼çæç
§æ åæ§è¡ã"; |
| | | String formatImplementationContent = StrUtil.format(implementationContent, format2, implementationSupervisee); |
| | | |
| | | //è·å卿å
容 |
| | | String dynamicSupervisee = ""; |
| | | List<QualitySuperviseDetails> dynamicList = superviseReasonMap.get("卿çç£"); |
| | | if (CollectionUtils.isNotEmpty(dynamicList)) { |
| | | List<String> collect = dynamicList.stream() |
| | | .map(details -> StrUtil.format("对{}卿çç£1次å¨çç£è¿ç¨ä¸", details.getSupervisee())).collect(Collectors.toList()); |
| | | dynamicSupervisee = CollUtil.join(collect, "ï¼"); |
| | | } |
| | | String dynamicContent = "å¨ä¿è¯è´¨éçç£è®¡åçåæ¶ï¼ä¹åææç
§é¢å¯¼è¦æ±å 强ä¸å®æçç£å¨ä½ã{}份{}ï¼æ²¡æåç°ä¸ç¬¦åçç°è±¡ãæ£éªåè½çç»çæç
§è§å®çè¦æ±è¿è¡è®¾å¤çæä½ï¼å¯¹äºæ åè½çè®°ï¼æä½¿ç¨ç设å¤å卿 ¡å卿å
ï¼è½æ¸
æ¥å®æ´ççè®°å½åå§æ°æ®å¹¶åºå
·æ¥åï¼å¨è¯éªç¯å¢æ¹é¢ï¼è½å¤ä¸¥æ ¼çæç
§æ åæ§è¡ã"; |
| | | String formatdynamicContent = StrUtil.format(dynamicContent, format2, dynamicSupervisee); |
| | | |
| | | // è·åçç£åä¿¡æ¯ |
| | | QualitySuperviseDetails superviseDetails = qualitySuperviseDetails.get(0); |
| | | QualitySuperviseDetailsRecord detailsRecord = qualitySuperviseDetailsRecordMapper.selectOne(Wrappers.<QualitySuperviseDetailsRecord>lambdaQuery() |
| | | .eq(QualitySuperviseDetailsRecord::getSuperviseDetailsId, superviseDetails.getSuperviseDetailsId()) |
| | | .last("limit 1")); |
| | | String supervisor = detailsRecord.getSupervisor(); |
| | | |
| | | // å建è¯å®¡å¯¹è±¡ |
| | | QualitySuperviseManagementReview managementReview = new QualitySuperviseManagementReview(); |
| | | String yearDate = now.format(DateTimeFormatter.ofPattern("yyyyå¹´")); |
| | | String monthDate = now.format(DateTimeFormatter.ofPattern("MMæ")); |
| | | managementReview.setFileName(StrUtil.format("{}管çè¯å®¡è¾å
¥ææï¼{}ï¼_{}", yearDate, supervisor, monthDate)); |
| | | managementReview.setImplementationContent(formatImplementationContent); |
| | | managementReview.setDynamicContent(formatdynamicContent); |
| | | managementReview.setSupervisor(supervisor); |
| | | managementReview.setSuperviseDate(LocalDate.now()); |
| | | qualitySuperviseManagementReviewMapper.insert(managementReview); |
| | | } |
| | | |
| | | } |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectDeal" resultType="com.ruoyi.process.pojo.ProcessDeal"> |
| | | <select id="selectDeal" resultType="com.ruoyi.process.dto.ProcessDealDto"> |
| | | select ROW_NUMBER() OVER (ORDER BY id) AS indexs, |
| | | id, |
| | | sample_name, |
| | |
| | | sample_supplier, |
| | | num, |
| | | deal_method, |
| | | deal_time |
| | | DATE_FORMAT(deal_time, '%Y-%m-%d') dealTimeStr |
| | | from cnas_process_deal |
| | | where totaldeal_id = #{id} |
| | | </select> |
| | |
| | | <result column="update_user" property="updateUser"/> |
| | | <result column="update_time" property="updateTime"/> |
| | | </resultMap> |
| | | <select id="pageProcessReport" resultType="com.ruoyi.process.pojo.ProcessReport"> |
| | | <select id="pageProcessReport" resultType="com.ruoyi.process.dto.ProcessReportDto"> |
| | | select * from (select cpr.* , |
| | | u1.name sendUserName |
| | | from cnas_process_report cpr |
| | |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | <select id="getIds" resultType="com.ruoyi.process.pojo.ProcessReport"> |
| | | <select id="exportProcessReport" resultType="com.ruoyi.process.dto.ProcessReportDto"> |
| | | select ROW_NUMBER() OVER (ORDER BY cpr.id) AS indexs, |
| | | cpr.* , |
| | | u1.name sendUserName |
| | | u1.signature_url sendUserUrl |
| | | from cnas_process_report cpr |
| | | left join user u1 on send_user=u1.id |
| | | where 1=1 |
| | | and cpr.id in |
| | | <foreach collection="ids" separator="," item="id" open="(" close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.process.mapper.QualitySuperviseManagementReviewMapper"> |
| | | |
| | | |
| | | <select id="pageManagementReview" resultType="com.ruoyi.process.pojo.QualitySuperviseManagementReview"> |
| | | select * |
| | | from cnas_quality_supervise_management_review |
| | | <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | Configure configure = Configure.builder() |
| | | .bind("feCalibrationSchedule", new HackLoopTableRenderPolicy()) |
| | | .build(); |
| | | FeCalibrationSchedule feCalibrationSchedule = size > 0 ? feCalibrationSchedules.get(0) : null; |
| | | XWPFTemplate template = XWPFTemplate.compile(inputStream, configure).render( |
| | | new HashMap<String, Object>() {{ |
| | | put("feCalibrationSchedule", feCalibrationSchedules); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | * 设æ½åç¯å¢æ¡ä»¶-设æ½åç¯å¢æ¡ä»¶è¦æ±-ç
§åº¦è®°å½è¡¨ æå¡å®ç°ç±» |
| | | * </p> |
| | | * |
| | | * @author |
| | | * @author |
| | | * @since 2024-11-07 04:15:57 |
| | | */ |
| | | @Service |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | * è·å温度湿度 |
| | | */ |
| | | // @Scheduled(cron = "0/5 * * * * *") |
| | | @Scheduled(cron = "0 0 9 * * 1-6") // æ¯å¤©9ç¹æ§è¡ä¸æ¬¡ é¤äºææå¤© |
| | | // @Scheduled(cron = "0 0 9 * * 1-6") // æ¯å¤©9ç¹æ§è¡ä¸æ¬¡ é¤äºææå¤© |
| | | public void task1() { |
| | | checkLaboratoriesSchedule(); |
| | | // æ ¹æ®æ¶é´éåºï¼è·åå°ææ°ç䏿¡æ°æ® |
| | |
| | | * è·å温度湿度 |
| | | */ |
| | | // @Scheduled(cron = "0/5 * * * * *") |
| | | @Scheduled(cron = "0 0 14 * * 1-5") // æ¯å¤©14ç¹æ§è¡ä¸æ¬¡ é¤äºææå
忿天 |
| | | // @Scheduled(cron = "0 0 14 * * 1-5") // æ¯å¤©14ç¹æ§è¡ä¸æ¬¡ é¤äºææå
忿天 |
| | | public void task2() { |
| | | |
| | | // æ£æ¥å®éªå®¤æ¯å¦æä»»å¡ å¦ææ²¡ææ°å¢ä»»å¡ |
| | |
| | | * è·å温度湿度 |
| | | */ |
| | | // @Scheduled(cron = "0/5 * * * * *") |
| | | @Scheduled(cron = "0 0 9 * * 7") // |
| | | // @Scheduled(cron = "0 0 9 * * 7") // |
| | | public void task3() { |
| | | checkLaboratoriesSchedule(); |
| | | |
| | |
| | | * |
| | | */ |
| | | // @Scheduled(cron = "0/5 * * * * *") |
| | | @Scheduled(cron = "0 0 16 * * 1-6") // æ¯å¤©15ç¹æ§è¡ä¸æ¬¡ é¤äºææå¤© |
| | | // @Scheduled(cron = "0 0 16 * * 1-6") // æ¯å¤©15ç¹æ§è¡ä¸æ¬¡ é¤äºææå¤© |
| | | public void affirmTempHum() { |
| | | // æ¥è¯¢ææ¥æä½æ¯æªå¡«åååç |
| | | List<FeTempHumRecordDto> feTempHumRecordList = feTempHumRecordMapper.selectNoaffirm(LocalDate.now()); |
| | |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢å½åæ¶é´æ¯å¦æ²¡æè¯¥æ£æµé¡¹çæ½æ ·è®¡å") |
| | | @PostMapping("/judgeNotSpotCheckOrder") |
| | | public Result<?> judgeNotSpotCheckOrder(@RequestBody InsPlaceOrderDto insPlaceOrderDto) { |
| | | return insOrderService.judgeNotSpotCheckOrder(insPlaceOrderDto.getSampleList(), insPlaceOrderDto.getInsOrder()); |
| | | } |
| | | |
| | | } |
| | |
| | | @ApiOperation(value = "ä¿åæ£éªå
容") |
| | | @PostMapping("/saveInsContext") |
| | | public Result<?> saveInsContext(@RequestBody SaveInsContextDto saveInsContextDto) { |
| | | Map<String, Object> param2 = JSON.parseObject(saveInsContextDto.getParam(), Map.class); |
| | | insOrderPlanService.saveInsContext(param2, saveInsContextDto.getCurrentTable(), saveInsContextDto.getSampleId(), saveInsContextDto.getOrderId(), saveInsContextDto.getSonLaboratory()); |
| | | insOrderPlanService.saveInsContext(saveInsContextDto); |
| | | return Result.success(); |
| | | } |
| | | |
| | |
| | | @GetMapping("/getBindingProductByProductId") |
| | | public Result<List<InsProduct>> getBindingProductByProductId(Integer productId) { |
| | | return Result.success(insProductService.list(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getBindingProductId, productId))); |
| | | .eq(InsProduct::getBindingProductId, productId) |
| | | .orderByAsc(InsProduct::getSort))); |
| | | } |
| | | |
| | | |
| | |
| | | @ApiModelProperty("æ£éªé¡¹ç®") |
| | | private List<InsProduct> insProduct; |
| | | |
| | | // private List<BushingDto> bushing; |
| | | |
| | | @ApiModelProperty("åæ ·åé
ç½®") |
| | | private List<SampleProductDto> childSampleList; |
| | | |
| | |
| | | |
| | | @ApiModelProperty("è¾
å©çº¿è¯é
ç½®") |
| | | private InsulatingDto auxiliaryWireCore; |
| | | |
| | | // private SheathDto sheath; |
| | | |
| | | @ApiModelProperty("æ£éªäºº") |
| | | private String checkName; |
| | |
| | | package com.ruoyi.inspect.dto; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * ä¿å模æ¿ä¼ å |
| | | */ |
| | | @Data |
| | | //ä¿åæ£éªå
å®¹ä¼ å |
| | | public class SaveInsContextDto { |
| | | |
| | | //模æ¿å
容 |
| | | @ApiModelProperty("模æ¿å
容") |
| | | private String param; |
| | | //å½å模æ¿id |
| | | |
| | | @ApiModelProperty("å½å模æ¿id") |
| | | private Integer currentTable; |
| | | //å½åæ ·åid |
| | | |
| | | @ApiModelProperty("å½åæ ·åid") |
| | | private Integer sampleId; |
| | | //å½å订åid |
| | | |
| | | @ApiModelProperty("å½å订åid") |
| | | private Integer orderId; |
| | | //åè¯éªå®¤ |
| | | |
| | | @ApiModelProperty("åè¯éªå®¤") |
| | | private String sonLaboratory; |
| | | |
| | | @ApiModelProperty("æ¯å¦æ²¡ææ£éªå¼") |
| | | private Integer isNoTestValue; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.pojo.StructureTestObject; |
| | | import com.ruoyi.inspect.dto.CostStatisticsDto; |
| | | import com.ruoyi.inspect.dto.SampleOrderDto; |
| | | import com.ruoyi.inspect.dto.SampleProductDto2; |
| | | import com.ruoyi.inspect.dto.SampleProductExportDto; |
| | |
| | | * @return |
| | | */ |
| | | List<SampleOrderDto> getInsOrderExportByIds(@Param("orderIds") List<String> orderIds); |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åæ¶é´æ¯å¦æè¯¥æ£æµé¡¹çæ½æ ·è®¡å订å |
| | | * @param itmeId æ ·åId |
| | | * @param startTime å¼å§æ¶é´ |
| | | * @param endTime ç»ææ¶é´ |
| | | * @return |
| | | */ |
| | | Integer selectNotSpotCheckOrder(@Param("itmeId") Integer itmeId, @Param("startTime") String startTime, @Param("endTime") String endTime); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.inspect.dto.InsOrderPlanDTO; |
| | | import com.ruoyi.inspect.dto.InsOrderPlanProductDto; |
| | | import com.ruoyi.inspect.dto.SaveInsContextDto; |
| | | import com.ruoyi.inspect.pojo.InsOrderFactoryVerify; |
| | | import com.ruoyi.inspect.pojo.InsOrderFile; |
| | | import com.ruoyi.inspect.pojo.InsProduct; |
| | |
| | | |
| | | boolean claimInsOrderPlan(InsOrderPlanDTO entity); |
| | | |
| | | void saveInsContext(Map<String, Object> insContext,Integer currentTable,Integer sampleId,Integer orderId,String sonLaboratory); |
| | | void saveInsContext(SaveInsContextDto saveInsContextDto); |
| | | |
| | | Map<String, Object> doInsOrder(Integer id, String laboratory); |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.basic.pojo.StandardProductList; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.inspect.pojo.InsOrder; |
| | | import com.ruoyi.inspect.pojo.InsSample; |
| | | import com.ruoyi.inspect.pojo.InsUnqualifiedRetestProduct; |
| | |
| | | * @param insSample |
| | | */ |
| | | void updateSampleModel(InsSample insSample); |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åæ¶é´æ¯å¦æ²¡æè¯¥æ£æµé¡¹çæ½æ ·è®¡å |
| | | * @param sampleList |
| | | * @param insOrder |
| | | * @return |
| | | */ |
| | | Result judgeNotSpotCheckOrder(List<SampleProductDto> sampleList, InsOrder insOrder); |
| | | } |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("导åºå¤±è´¥"); |
| | |
| | | template.write(os); |
| | | os.flush(); |
| | | os.close(); |
| | | inputStream.close(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveInsContext(Map<String, Object> insContext, Integer currentTable, Integer currentSampleId, Integer orderId, String sonLaboratory) { |
| | | public void saveInsContext(SaveInsContextDto saveInsContextDto) { |
| | | Map<String, Object> insContext = JSON.parseObject(saveInsContextDto.getParam(), Map.class); |
| | | Integer userId = SecurityUtils.getUserId().intValue(); |
| | | InsSample insSample = insSampleMapper.selectById(currentSampleId); |
| | | InsSample insSample = insSampleMapper.selectById(saveInsContextDto.getSampleId()); |
| | | insContext.forEach((k, v) -> { |
| | | JSONObject jo = JSON.parseObject(JSON.toJSONString(v)); |
| | | InsProduct insProduct = new InsProduct(); |
| | | insProduct.setId(Integer.parseInt(k)); |
| | | InsProduct product = insProductMapper.selectById(insProduct.getId()); |
| | | if (currentTable.equals(product.getTemplateId()) && currentSampleId.equals(product.getInsSampleId())) { |
| | | if (saveInsContextDto.getCurrentTable().equals(product.getTemplateId()) && saveInsContextDto.getSampleId().equals(product.getInsSampleId())) { |
| | | List<InsProductResult> oldResults = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery() |
| | | .eq(InsProductResult::getInsProductId, insProduct.getId())); |
| | | InsProductResult newResult = new InsProductResult(); |
| | |
| | | // æ·»å å·¥æ¶ |
| | | // 夿æ¯å¦åªæ¯åä¸è®¡ç®å¼, åä¸è®¡ç®å¼å®é
没æå¡«å |
| | | if (StringUtils.isNotBlank(newResult.getInsValue()) && !newResult.getInsValue().equals("[]")) { |
| | | InsProduct finalInsProduct = insProductMapper.selectById(product.getId()); |
| | | threadPoolTaskExecutor.execute(() -> { |
| | | InsProduct finalInsProduct = insProductMapper.selectById(product.getId()); |
| | | InsOrder insOrder = insOrderMapper.selectById(insSample.getInsOrderId()); |
| | | this.addAuxiliary(userId, finalInsProduct, insOrder); |
| | | }); |
| | | } else { |
| | | // 夿æ¯å¦æ¯æ²¡ææ£éªå¼çå
容 |
| | | if (saveInsContextDto.getIsNoTestValue() != null && saveInsContextDto.getIsNoTestValue() == 1) { |
| | | threadPoolTaskExecutor.execute(() -> { |
| | | InsProduct finalInsProduct = insProductMapper.selectById(product.getId()); |
| | | InsOrder insOrder = insOrderMapper.selectById(insSample.getInsOrderId()); |
| | | this.addAuxiliary(userId, finalInsProduct, insOrder); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | } |
| | | }); |
| | | String sampleIdStr = insContext.keySet().stream().findFirst().orElse(null); |
| | | if (sampleIdStr != null) { |
| | | int count = insProductMapper.selectInsProductCountByOrderId(orderId); |
| | | int count = insProductMapper.selectInsProductCountByOrderId(saveInsContextDto.getOrderId()); |
| | | if (count == 0) { |
| | | insOrderStateMapper.update(new InsOrderState(), Wrappers.<InsOrderState>lambdaUpdate() |
| | | .eq(InsOrderState::getInsOrderId, orderId) |
| | | .eq(InsOrderState::getLaboratory, sonLaboratory) |
| | | .eq(InsOrderState::getInsOrderId, saveInsContextDto.getOrderId()) |
| | | .eq(InsOrderState::getLaboratory, saveInsContextDto.getSonLaboratory()) |
| | | .set(InsOrderState::getInsState, 2)); |
| | | } |
| | | } |
| | |
| | | */ |
| | | 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() |
| | |
| | | // 5.åéæ¶æ¯éç¥ç»å¤æ ¸äºº |
| | | // æ¥è¯¢å½åäººä¿¡æ¯ |
| | | Integer userId = SecurityUtils.getUserId().intValue(); |
| | | Map<String, String> userMap = insProductMapper.selectUserById(verifyUser); |
| | | String userName = userMap.get("name"); |
| | | String userName = insProductMapper.selectUserById(userId).get("name"); |
| | | // æ¥è¯¢åéäººä¿¡æ¯ |
| | | String sendUserAccount = userMap.get("account"); |
| | | String sendUserAccount = insProductMapper.selectUserById(verifyUser).get("account"); |
| | | InformationNotification info = new InformationNotification(); |
| | | info.setCreateUser(userName); |
| | | info.setMessageType("2"); |
| | |
| | | * @param ifsInventoryQuantity |
| | | * @param order |
| | | */ |
| | | private void addAnalysis(List<InsProduct> productList, IfsInventoryQuantity ifsInventoryQuantity, InsOrder order, String userName) { |
| | | private void addAnalysis(List<InsProduct> productList, IfsInventoryQuantity ifsInventoryQuantity, InsOrder order, String sendUserAccount) { |
| | | for (InsProduct insProduct : productList) { |
| | | // 夿æ¯å¦æ¯æ°å¼ç±»å |
| | | if (insProduct.getInspectionValueType().equals("1") && insProduct.getInsResult().equals(1)) { |
| | | List<InsProductDeviationWarningDetail> insProductAnalysisDtoList = insProductMapper.selectAnalysis(insProduct, ifsInventoryQuantity.getSupplierName()); |
| | | |
| | | if (insProductAnalysisDtoList.size() < 5) { |
| | | if (insProductAnalysisDtoList.size() < 10) { |
| | | continue; |
| | | } |
| | | |
| | |
| | | message += "\næ£éªé¡¹: " + insProduct.getInspectionItem() + insProduct.getInspectionItemSubclass(); |
| | | message += "\nåå·®è¶
è¿äº 10%"; |
| | | // åéç»æäº¤äºº |
| | | WxCpUtils.inform(userName, message, null); |
| | | |
| | | // todo: åéç»æ£æµä¸å¿ä¸»ä»»(åºå®æ») |
| | | WxCpUtils.inform("ZT-004704", message, null); |
| | | // WxCpUtils.inform(sendUserAccount, message, null); |
| | | // |
| | | // // todo: åéç»æ£æµä¸å¿ä¸»ä»»(åºå®æ») |
| | | // WxCpUtils.inform("ZT-004704", message, null); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("åå·®é¢è¦ä¼ä¸å¾®ä¿¡éç¥æ¥é"); |
| | |
| | | insReportMapper.delete(Wrappers.<InsReport>lambdaQuery() |
| | | .eq(InsReport::getInsOrderId, insOrder.getId())); |
| | | insReportMapper.insert(insReport); |
| | | |
| | | inputStream.close(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | insReportMapper.delete(Wrappers.<InsReport>lambdaQuery() |
| | | .eq(InsReport::getInsOrderId, insOrder.getId())); |
| | | insReportMapper.insert(insReport); |
| | | inputStream.close(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | |
| | | // ä¿åå°éä»¶éé¢ |
| | | uploadFile(insOrderId, multipartFile); |
| | | try { |
| | | inputStream.close(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper; |
| | | import com.ruoyi.basic.mapper.StandardProductListMapper; |
| | | import com.ruoyi.basic.mapper.StructureItemParameterMapper; |
| | | import com.ruoyi.basic.pojo.IfsInventoryQuantity; |
| | | import com.ruoyi.basic.pojo.StandardProductList; |
| | | import com.ruoyi.basic.pojo.StructureItemParameter; |
| | | import com.ruoyi.basic.pojo.StructureTestObject; |
| | | import com.ruoyi.common.constant.InsOrderTypeConstants; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | import com.ruoyi.common.numgen.NumberGenerator; |
| | | import com.ruoyi.common.utils.*; |
| | |
| | | import com.ruoyi.inspect.service.InsProductService; |
| | | import com.ruoyi.inspect.service.InsSampleService; |
| | | import com.ruoyi.inspect.vo.InsOrderPrintingVo; |
| | | import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHoursTemporary; |
| | | import com.ruoyi.performance.service.AuxiliaryOutputWorkingHoursTemporaryService; |
| | | import com.ruoyi.system.mapper.UserMapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | private IfsApiUtils ifsApiUtils; |
| | | private SpotCheckQuarterItemMapper spotCheckQuarterItemMapper; |
| | | private StandardProductListMapper standardProductListMapper; |
| | | private AuxiliaryOutputWorkingHoursTemporaryService auxiliaryOutputWorkingHoursTemporaryService; |
| | | private StructureItemParameterMapper structureItemParameterMapper; |
| | | |
| | | |
| | | |
| | | //è·åæ£éªä¸åæ°æ® |
| | | @Override |
| | | public IPage<SampleOrderDto> selectInsOrderParameter(IPage<InsOrder> page, SampleOrderDto sampleOrderDto) { |
| | | //todo: åªçæå¤æå
¨é¨,个人,ç»ç»çæé |
| | | String laboratory = null; |
| | | // 夿æ¯å¦æ¯å
¨é¨ |
| | | String isOrderAll = null; |
| | |
| | | spotCheckQuarterItemMapper.updateById(spotCheckQuarterItem); |
| | | } |
| | | |
| | | // åå»ºå·¥æ¶æå |
| | | // ç¼åæ ·åid, ç¼å·map |
| | | // addWorkingHoursTemporary(userId, insSamples, ids, order); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | /** |
| | | * åå»ºå·¥æ¶æå |
| | | * @param userId |
| | | * @param insSamples |
| | | * @param ids |
| | | * @param order |
| | | */ |
| | | private void addWorkingHoursTemporary(Integer userId, List<InsSample> insSamples, List<Integer> ids, InsOrder order) { |
| | | Map<Integer, String> sampleMap = insSamples.stream().collect(Collectors.toMap(InsSample::getId, InsSample::getSampleCode)); |
| | | List<InsProduct> insProductList = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() |
| | | .in(InsProduct::getInsSampleId, ids) |
| | | .eq(InsProduct::getState, 1)); |
| | | List<AuxiliaryOutputWorkingHoursTemporary> outputWorkingHours = insProductList.stream().map(insProduct -> { |
| | | AuxiliaryOutputWorkingHoursTemporary auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHoursTemporary(); |
| | | auxiliaryOutputWorkingHours.setInspectionItemClass(insProduct.getInspectionItemClass());//æ£æµé¡¹åç±» |
| | | auxiliaryOutputWorkingHours.setInspectionItem(insProduct.getInspectionItem());//æ£æµç¶é¡¹ |
| | | auxiliaryOutputWorkingHours.setInspectionItemSubclass(insProduct.getInspectionItemSubclass());//æ£æµå项 |
| | | auxiliaryOutputWorkingHours.setSample(sampleMap.get(insProduct.getInsSampleId()));//æ ·åç¼å· |
| | | auxiliaryOutputWorkingHours.setOrderId(order.getId());//订åid |
| | | auxiliaryOutputWorkingHours.setOrderNo(order.getEntrustCode());//éå çå§æåå· |
| | | auxiliaryOutputWorkingHours.setWorkTime(insProduct.getManHour());//éå çå·¥æ¶ |
| | | auxiliaryOutputWorkingHours.setAmount(1);//éå çæ°é |
| | | auxiliaryOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime()) ? auxiliaryOutputWorkingHours.getOvertimeWorkTime() : BigDecimal.ZERO).add(ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime()) ? auxiliaryOutputWorkingHours.getWorkTime() : BigDecimal.ZERO));//产éå·¥æ¶ |
| | | auxiliaryOutputWorkingHours.setManHourGroup(insProduct.getManHourGroup());//å·¥æ¶åç» |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | auxiliaryOutputWorkingHours.setDateTime(LocalDateTime.now().toLocalDate().atStartOfDay().format(formatters));//æ¥æ |
| | | LocalDateTime localDateTime = LocalDateTime.now(); |
| | | DateTime parse = DateUtil.parse(localDateTime.format(formatter)); |
| | | auxiliaryOutputWorkingHours.setWeekDay(getWeek(localDateTime.format(formatters)));//ææ |
| | | auxiliaryOutputWorkingHours.setWeek(String.valueOf(DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1))));//卿¬¡ |
| | | auxiliaryOutputWorkingHours.setCheck(userId);//æ£æµäºº |
| | | auxiliaryOutputWorkingHours.setPrice(insProduct.getPrice());//åä»· |
| | | auxiliaryOutputWorkingHours.setSampleId(insProduct.getInsSampleId());//æ ·åid |
| | | auxiliaryOutputWorkingHours.setInsProductId(insProduct.getId());//æ£éªé¡¹id |
| | | |
| | | return auxiliaryOutputWorkingHours; |
| | | }).collect(Collectors.toList()); |
| | | auxiliaryOutputWorkingHoursTemporaryService.saveBatch(outputWorkingHours); |
| | | } |
| | | |
| | | public static String getWeek(String dayStr) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | |
| | | default: |
| | | return "æªç¥"; |
| | | } |
| | | } |
| | | |
| | | |
| | | // å¦æä½ ä½¿ç¨ Java 8+ï¼ä¹å¯ä»¥ç¨ Stream API ç®å代ç ï¼ |
| | | public List<StandardProductList> findMissingItemsWithStream(List<StandardProductList> standardList, |
| | | List<InsProduct> insList) { |
| | | Set<Integer> insIds = insList.stream() |
| | | .map(InsProduct::getStructureItemParameterId) |
| | | .collect(Collectors.toSet()); |
| | | |
| | | return standardList.stream() |
| | | .filter(product -> !insIds.contains(product.getStructureItemParameterId())) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | // ä¿®æ¹æ£éªé¡¹ |
| | | for (SampleProductDto sampleProductDto : insOrderUpdateDto.getSampleProduct()) { |
| | | insSampleService.update(Wrappers.<InsSample>lambdaUpdate() |
| | | .eq(InsSample::getId, sampleProductDto.getId()) |
| | | .set(InsSample::getSpecialStandardMethod, sampleProductDto.getSpecialStandardMethod())); |
| | | |
| | | insProductService.updateBatchById(sampleProductDto.getInsProduct()); |
| | | } |
| | | |
| | |
| | | .set(InsSample::getModel, insSample.getModel())); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åæ¶é´æ¯å¦æ²¡æè¯¥æ£æµé¡¹çæ½æ ·è®¡å |
| | | * @param sampleList |
| | | * @param insOrder |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result judgeNotSpotCheckOrder(List<SampleProductDto> sampleList, InsOrder insOrder) { |
| | | // todo: ä¸åå¤ææ½æ ·è®¡åçå¯ä¸æ§ |
| | | if (insOrder.getQuarterItemId() != null) { |
| | | Long quarterItemCount = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery() |
| | | .eq(InsOrder::getQuarterItemId, insOrder.getQuarterItemId()) |
| | | .notIn(InsOrder::getState, -1 ,2 ,3)); |
| | | if (quarterItemCount > 0) { |
| | | throw new ErrorException("è¯¥æ½æ ·è®¡å已被ç»å®è¿"); |
| | | } |
| | | } |
| | | |
| | | // 夿æ¯å¦æ¯æ½æ ·æ£æµ |
| | | if (insOrder.getOrderType().equals(InsOrderTypeConstants.SPOT_CHECK)) { |
| | | Set<String> monthMessageSet = new HashSet<>(); |
| | | Set<String> quarterMessageSet = new HashSet<>(); |
| | | Set<String> yearMessageSet = new HashSet<>(); |
| | | |
| | | String formatTime = "yyyy-MM-dd HH:mm:ss"; |
| | | // æ¥è¯¢å½åæææ ·åçæ£éªé¡¹ |
| | | for (SampleProductDto sampleProductDto : sampleList) { |
| | | List<StandardProductList> standardProductList = getProductTreeBySampleId(sampleProductDto.getId()); |
| | | |
| | | Set<Integer> insIds = sampleProductDto.getInsProduct().stream() |
| | | .map(InsProduct::getStructureItemParameterId) |
| | | .collect(Collectors.toSet()); |
| | | |
| | | List<StandardProductList> productLists = standardProductList.stream() |
| | | .filter(product -> !insIds.contains(product.getStructureItemParameterId())) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // æ¥è¯¢æ£éªé¡¹åºç¡è¡¨, æ¥è¯¢æ¯å¦ææåº¦, å£åº¦, å¹´åº¦çæ£éªé¡¹ |
| | | List<StructureItemParameter> itemParameterList = structureItemParameterMapper.selectList(Wrappers.<StructureItemParameter>lambdaQuery() |
| | | .in(StructureItemParameter::getId, productLists.stream().map(StandardProductList::getStructureItemParameterId).collect(Collectors.toList()))); |
| | | |
| | | for (StructureItemParameter item : itemParameterList) { |
| | | if (StringUtils.isNotBlank(item.getSpotCheckType())) { |
| | | switch (item.getSpotCheckType()) { |
| | | case "1": // æåº¦ |
| | | // æ¥è¯¢å½ææ¯å¦æè¯¥æ£æµé¡¹çæ½æ ·è®¡å |
| | | // 彿å¼å§æ¶é´ |
| | | DateTime monthStart = DateUtil.beginOfMonth(DateUtil.date()); |
| | | String monthStartTime = monthStart.toString(formatTime); |
| | | // å½æç»ææ¶é´ |
| | | DateTime monthEnd = DateUtil.endOfMonth(DateUtil.date()); |
| | | String monthEndTime = monthEnd.toString(formatTime); |
| | | Integer count = insOrderMapper.selectNotSpotCheckOrder(item.getId(), monthStartTime, monthEndTime); |
| | | if (count == 0) { |
| | | String monthMessage = item.getInspectionItemClass() + |
| | | item.getInspectionItem() + |
| | | item.getInspectionItemSubclass(); |
| | | monthMessageSet.add(monthMessage); |
| | | } |
| | | break; |
| | | case "2": // å£åº¦ |
| | | DateTime quarterStart = DateUtil.beginOfQuarter(DateUtil.date()); |
| | | String quarterStartTime = quarterStart.toString(formatTime); |
| | | // å½æç»ææ¶é´ |
| | | DateTime quarterEnd = DateUtil.endOfQuarter(DateUtil.date()); |
| | | String quarterEndTime = quarterEnd.toString(formatTime); |
| | | Integer quarterCount = insOrderMapper.selectNotSpotCheckOrder(item.getId(), quarterStartTime, quarterEndTime); |
| | | if (quarterCount == 0) { |
| | | String quarterMessage = item.getInspectionItemClass() + |
| | | item.getInspectionItem() + |
| | | item.getInspectionItemSubclass(); |
| | | quarterMessageSet.add(quarterMessage); |
| | | } |
| | | |
| | | break; |
| | | case "3": // 年度 |
| | | DateTime yearStart = DateUtil.beginOfQuarter(DateUtil.date()); |
| | | String yearStartTime = yearStart.toString(formatTime); |
| | | // å½æç»ææ¶é´ |
| | | DateTime yearEnd = DateUtil.endOfQuarter(DateUtil.date()); |
| | | String yearEndTime = yearEnd.toString(formatTime); |
| | | Integer yearCount = insOrderMapper.selectNotSpotCheckOrder(item.getId(), yearStartTime, yearEndTime); |
| | | if (yearCount == 0) { |
| | | String yearMessage = item.getInspectionItemClass() + |
| | | item.getInspectionItem() + |
| | | item.getInspectionItemSubclass(); |
| | | yearMessageSet.add(yearMessage); |
| | | } |
| | | |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | String message = ""; |
| | | if (CollectionUtils.isNotEmpty(monthMessageSet)) { |
| | | message += StrUtil.format("<p>æ£éªé¡¹<span style=\"color: red\">{}</span>å½æè¿æªè¿è¡æ½æ ·æ£æµ, 请æ¥çæ¯å¦éè¦æ·»å å½åæ£éªé¡¹</p>", CollUtil.join(monthMessageSet, ", ")); |
| | | } |
| | | |
| | | if (CollectionUtils.isNotEmpty(quarterMessageSet)) { |
| | | message += StrUtil.format("<p>æ£éªé¡¹<span style=\"color: red\">{}</span>å½åå£åº¦è¿æªè¿è¡æ½æ ·æ£æµ, è¯·çæ¯å¦éè¦æ·»å å½åæ£éªé¡¹</p>", CollUtil.join(quarterMessageSet, ", ")); |
| | | } |
| | | |
| | | if (CollectionUtils.isNotEmpty(yearMessageSet)) { |
| | | message += StrUtil.format("<p>æ£éªé¡¹<span style=\"color: red\">{}</span>ä»å¹´è¿æªè¿è¡æ½æ ·æ£æµ, è¯·çæ¯å¦éè¦æ·»å å½åæ£éªé¡¹</p>", CollUtil.join(yearMessageSet, ", ")); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(message)) { |
| | | return Result.success(false, message); |
| | | } |
| | | } |
| | | return Result.success(true); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | product.setTemplate(null); |
| | | product.setStyle(null); |
| | | return product; |
| | | }).collect(Collectors.toList()); |
| | | }).sorted((o1, o2) -> (o1.getSort() == null ? 0 : o1.getSort()) |
| | | - (o2.getSort() == null ? 0 : o2.getSort())).collect(Collectors.toList()); |
| | | return insProducts; |
| | | } |
| | | |
| | |
| | | GROUP BY io.id,type |
| | | order by type desc,io.id desc |
| | | </select> |
| | | |
| | | <!-- æ¥è¯¢å½åæ¶é´æ¯å¦æè¯¥æ£æµé¡¹çæ½æ ·è®¡å订å --> |
| | | <select id="selectNotSpotCheckOrder" resultType="java.lang.Integer"> |
| | | select count(*) |
| | | from (select io.id |
| | | from ins_product ip |
| | | left join ins_sample is2 on is2.id = ip.ins_sample_id |
| | | left join ins_order io on io.id = is2.ins_order_id |
| | | left join spot_check_quarter_item scqi on scqi.quarter_item_id = io.quarter_item_id |
| | | where io.quarter_item_id is not null |
| | | and scqi.spot_check_time between #{startTime} and #{endTime} |
| | | and ip.structure_item_parameter_id = #{itmeId} |
| | | group by io.id) a |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import org.springframework.core.io.ClassPathResource; |
| | | |
| | | import javax.imageio.ImageIO; |
| | | import java.awt.*; |
| | | import java.awt.font.FontRenderContext; |
| | | import java.awt.geom.Rectangle2D; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.*; |
| | | |
| | | /** |
| | | * @Author zhuo |
| | | * @Date 2025/5/7 |
| | | */ |
| | | public class SignatureImageUtil { |
| | | |
| | | /** |
| | | * æ ¹æ®ä¸æå¯¼åºç¾åå¾ç |
| | | * @param text |
| | | * @return |
| | | * @throws IOException |
| | | * @throws FontFormatException |
| | | */ |
| | | public static InputStream saveImageToFile(String text){ |
| | | // è·ååä½åº |
| | | Font font = null; |
| | | try (InputStream is = new ClassPathResource("/ttf/signature.ttf").getInputStream()) { |
| | | font = Font.createFont(Font.TRUETYPE_FONT, is).deriveFont(50f); |
| | | } catch (FontFormatException | IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | int width = 100; // å¾çç宽度 |
| | | int height = 50; // å¾ççé«åº¦ |
| | | |
| | | BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); |
| | | Graphics2D g2d = image.createGraphics(); |
| | | |
| | | g2d.setFont(font); |
| | | |
| | | // 设置æåé¢è²ä¸ºé»è² |
| | | g2d.setColor(Color.black); |
| | | |
| | | // 设置æåå¨å¾çä¸çä½ç½® |
| | | FontRenderContext context = g2d.getFontRenderContext(); |
| | | Rectangle2D bounds = font.getStringBounds(text, context); |
| | | double x = (width - bounds.getWidth()) / 2; |
| | | double y = (height - bounds.getHeight()) / 2; |
| | | double ascent = -bounds.getY(); |
| | | double baseY = y + ascent; |
| | | g2d.drawString(text, (int) x, (int) baseY); |
| | | g2d.dispose(); |
| | | |
| | | ByteArrayOutputStream os = new ByteArrayOutputStream(); |
| | | |
| | | try { |
| | | ImageIO.write(image, "png", os); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | return new ByteArrayInputStream(os.toByteArray()); |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * todo:æ¨éç¾¤æ¶æ¯ |
| | | * æ¨éç¾¤æ¶æ¯ |
| | | * |
| | | * @param webHook ä¼ä¸å¾®ä¿¡æºå¨äººå°å |
| | | * @param content æ°æ® |