inspection-server/src/main/java/com/yuanchu/limslaboratory/controller/HomeController.java
@@ -1,19 +1,21 @@ package com.yuanchu.limslaboratory.controller; import com.yuanchu.limslaboratory.pojo.ProjectNum; import com.yuanchu.limslaboratory.pojo.vo.ProjectNumVo; import com.yuanchu.limslaboratory.pojo.vo.StatisticsDataVo; import com.yuanchu.limslaboratory.service.HomeService; import com.yuanchu.limslaboratory.vo.Result; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.stereotype.Service; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.List; import java.util.Map; /** * é¦é¡µ @@ -28,10 +30,40 @@ @Resource HomeService homeService; @ApiOperation("è®¡ç®æ£éªä¸æªæ£éªçååä¸é¡¹ç®çæ°éæ¥å£") @ApiOperation("è®¡ç®æ£éªä¸æªæ£éªçååä¸é¡¹ç®çæ°é") @GetMapping("/checkProjectNum") public Result checkProjectNum() { ProjectNum projectNum=homeService.checkProjectNum(); return Result.success(projectNum); ProjectNumVo projectNumVo =homeService.checkProjectNum(); return Result.success(projectNumVo); } @ApiOperation("å·²æ£éªtop3") @GetMapping("/checktop3") public Result checktop3() { List<Map<String, Object>> checktop3s =homeService.checktop3(); return Result.success(checktop3s); } @ApiOperation("æªæ£éªtop4") @GetMapping("/unchecktop4") public Result unchecktop4() { List<Map<String, Object>> unchecktop4s =homeService.unchecktop4(); return Result.success(unchecktop4s); } @ApiOperation("计ç®åææä¸æåçåæ ¼ç") @GetMapping("/qualified") public Result qualified() { StatisticsDataVo statisticsData =homeService.qualified(); return Result.success(statisticsData); } @ApiOperation("ç»è®¡") @ApiImplicitParams(value = { @ApiImplicitParam(name = "type", value = "1:æ¬å¨;2:æ¬æ;3:æ¬å¹´", dataTypeClass = Integer.class, required = true) }) @GetMapping("/turno") public Result turno(Integer type) { return Result.success(homeService.turno(type)); } } inspection-server/src/main/java/com/yuanchu/limslaboratory/controller/InspectionController.java
@@ -110,10 +110,10 @@ } @ApiOperation(value = "ä¿åæ£éªé¡¹ç®è´£ä»»äºº") @ApiImplicitParams(value = { @ApiImplicitParam(name = "id", value = "æ£éªå项ç®id", dataTypeClass = Integer.class, required = true), @ApiImplicitParam(name = "userProId", value = "责任人id", dataTypeClass = Integer.class, required = true) }) @ApiImplicitParams(value = { @ApiImplicitParam(name = "id", value = "æ£éªå项ç®id", dataTypeClass = Integer.class, required = true), @ApiImplicitParam(name = "userProId", value = "责任人id", dataTypeClass = Integer.class, required = true) }) @GetMapping("/chooseUseProId") public Result chooseUseProId(Integer id,Integer userProId) { return Result.success(inspectionService.chooseUseProId(id,userProId)); inspection-server/src/main/java/com/yuanchu/limslaboratory/controller/QualificationRateStatisticsController.java
@@ -32,19 +32,27 @@ @ApiOperation("æ¥è¯¢æ£éªæ ·ååæ ¼çç»è®¡") @GetMapping("/getTestSampleStatistics") public Result<?> getTestSampleStatistics(SelectQualificationRateDto dto){ System.out.println("getTestSampleStatistics______________>"+dto); return Result.success(service.getTestSampleStatistics(dto)); } @ApiOperation("æ¥è¯¢ä¾åºåä¸åæ ¼ç»è®¡æ¬¡æ°") @GetMapping("/getSupplierNoPassStatistics") public Result<?> getSupplierNoPassStatistics(SelectQualificationRateDto dto){ System.out.println("getSupplierNoPassStatistics++++++++++++++++>"+dto); return Result.success(service.getSupplierNoPassStatistics(dto)); } @ApiOperation("æ¥è¯¢ä¸åæ ¼é¡¹ç®ç»è®¡") @GetMapping("/getNoPassProjectStatistics") public Result<?> getNoPassProjectStatistics(SelectQualificationRateDto dto){ System.out.println("getNoPassProjectStatistics===============>"+dto); return Result.success(service.getNoPassProjectStatistics(dto)); } @ApiOperation("è·åæ ·ååç§°") @GetMapping("/getSampleOptions") public Result<?> getSampleOptions(){ return Result.success(service.getSampleOptions()); } } inspection-server/src/main/java/com/yuanchu/limslaboratory/mapper/InspectionMapper.java
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.yuanchu.limslaboratory.pojo.Inspection; import java.util.List; import java.util.Map; /** @@ -28,5 +30,47 @@ //è®¡ç®æªæ£éªçæ°é Integer seleCountUnIns(); //è·åæ£éªåæ»æ° Integer getcount(); //è·åæ£éªç»è®º,æ£éªæ°é List<Map<String, Object>> getResultNum(); //计ç®åææçåæ ¼ç Long qualified(Integer b); //计ç®åæææ£éªåæ»æ° Integer getallmater(); //è®¡ç®æåæ£éªåæ»æ° Integer getallfin(); //计ç®åææåæ ¼ç Long qualifiedfin(Integer i); //æ¥è¯¢è¯¥æ¥æçåæææ£éªæ°é Integer getMaterByDay(String time); //æ¥è¯¢è¯¥æ¥æçæåæ£éªæ°é Integer getFinByDay(String time); //æ¥è¯¢è¯¥æ¥æçåææåæ ¼æ°é Long getOkMaterByDay(String time); //æ¥è¯¢è¯¥æ¥æçæååæ ¼æ°é Long getOkFinByDay(String time); //æ¥è¯¢è¯¥æçåæææ£éªæ°é Integer getMaterByMonth(String monthofYear); //æ¥è¯¢è¯¥æçæåæ£éªæ°é Integer getFinByMonth(String monthofYear); //æ¥è¯¢è¯¥æçåææåæ ¼ç Long getOkMaterByMonth(String monthofYear); //æ¥è¯¢è¯¥æçæååæ ¼ç Long getOkFinByMonth(String monthofYear); } inspection-server/src/main/java/com/yuanchu/limslaboratory/mapper/InspectionProductMapper.java
@@ -4,6 +4,7 @@ import com.yuanchu.limslaboratory.pojo.InspectionProduct; import java.util.List; import java.util.Map; /** * ç³è¯·åä¸ç©æä¸ç项ç®(InspectionProduct)è¡¨æ°æ®åºè®¿é®å± @@ -13,8 +14,7 @@ */ public interface InspectionProductMapper extends BaseMapper<InspectionProduct> { //æ ¹æ®é¡¹ç®idå°å·²æçæ£éªç»è®ºæ¹ä¸ºnull void upda(Integer id); //æ ¹æ®æ£éªåidæ¥è¯¢æ£éªé¡¹ç®çæ£éªç»æ List<Integer> getresult(Integer id); @@ -27,5 +27,8 @@ //è®¡ç®æªæ£éªé¡¹ç®æ°é Integer seleCountUnInspro(); //æ£éªé¡¹ç®,设å¤,æ£éªå¼å§æ¶é´,æ§è¡äºº,æ£éªç»ææ¶é´ List<Map<String, Object>> getResultNum(); } inspection-server/src/main/java/com/yuanchu/limslaboratory/mapper/QualificationRateStatisticsMapper.java
@@ -1,6 +1,8 @@ package com.yuanchu.limslaboratory.mapper; import com.yuanchu.limslaboratory.pojo.Dto.SelectProjectByCodeAndNameDto; import com.yuanchu.limslaboratory.pojo.Dto.SelectQualificationRateDto; import com.yuanchu.limslaboratory.pojo.ImInfo; import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; @@ -18,5 +20,12 @@ @MapKey("id") List<Map<String, Object>>selectSupplierByCondition(@Param("dto") SelectQualificationRateDto dto); List<ImInfo>selectProjectionsByCondition(@Param("dto")SelectQualificationRateDto dto); List<ImInfo>selectProjection(@Param("list") List<SelectProjectByCodeAndNameDto> list,@Param("dto")SelectQualificationRateDto dto); @MapKey("id") List<Map<String, Object>> selectTestSamp(@Param("dto") SelectQualificationRateDto dto); List<Map<String, Object> >getSampleOptions(); } inspection-server/src/main/java/com/yuanchu/limslaboratory/pojo/Dto/SelectProjectByCodeAndNameDto.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,25 @@ package com.yuanchu.limslaboratory.pojo.Dto; import lombok.Data; import java.io.Serializable; /** * @Author å¼ å®¾ * @Date 2023/8/22 */ @Data public class SelectProjectByCodeAndNameDto implements Serializable { private String code; private String name; public SelectProjectByCodeAndNameDto() { } public SelectProjectByCodeAndNameDto(String code, String name) { this.code = code; this.name = name; } } inspection-server/src/main/java/com/yuanchu/limslaboratory/pojo/Dto/SelectQualificationRateDto.java
@@ -48,5 +48,9 @@ @ApiModelProperty(value = "ä¾åºå") private String supplier; @ApiModelProperty(value = "æ ·å") private String sample; @ApiModelProperty(value = "ç¼ç ") private String code; } inspection-server/src/main/java/com/yuanchu/limslaboratory/pojo/Dto/SeriesDto.java
@@ -13,20 +13,20 @@ public class SeriesDto implements Serializable { private String name; private List<Long> data; private List<Double> data; private String type; private String stack; //private String stack; public SeriesDto(String name, List<Long> data) { public SeriesDto(String name, List<Double> data) { this.name = name; this.data = data; this.type = "bar"; this.stack = "x"; //this.stack = "x"; } public SeriesDto(String name) { this.name = name; this.type = "bar"; this.stack = "x"; //this.stack = "x"; } } inspection-server/src/main/java/com/yuanchu/limslaboratory/pojo/ImInfo.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,35 @@ package com.yuanchu.limslaboratory.pojo; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; import java.util.Date; import java.util.List; /** * @Author å¼ å®¾ * @Date 2023/8/22 */ @Data public class ImInfo implements Serializable { private Long imId; private String imName; private String iCode; private Integer inspectionStatus; @DateTimeFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date startTime; @DateTimeFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date endTime; private List<IprInfo>iprInfos; } inspection-server/src/main/java/com/yuanchu/limslaboratory/pojo/InspectionMaterial.java
@@ -73,17 +73,13 @@ **/ private Integer state; /** * ${column.comment} **/ @TableField(fill = FieldFill.INSERT) @DateTimeFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date createTime; /** * ${column.comment} **/ @TableField(fill = FieldFill.INSERT_UPDATE) @DateTimeFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") inspection-server/src/main/java/com/yuanchu/limslaboratory/pojo/IprInfo.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,19 @@ package com.yuanchu.limslaboratory.pojo; import lombok.Data; import java.io.Serializable; /** * @Author å¼ å®¾ * @Date 2023/8/22 */ @Data public class IprInfo implements Serializable { private int iprId; private String iprName; private Integer testState; } inspection-server/src/main/java/com/yuanchu/limslaboratory/pojo/vo/LineChartVO.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,17 @@ package com.yuanchu.limslaboratory.pojo.vo; import lombok.Data; import java.util.ArrayList; import java.util.List; @Data public class LineChartVO { private List<String> xAxis = new ArrayList<>(); private List<LineSeriesVO> series = new ArrayList<>(); } inspection-server/src/main/java/com/yuanchu/limslaboratory/pojo/vo/LineSeriesVO.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,16 @@ package com.yuanchu.limslaboratory.pojo.vo; import lombok.Data; import java.util.ArrayList; import java.util.List; @Data public class LineSeriesVO { private String name; private List<Object> data =new ArrayList<>(); } inspection-server/src/main/java/com/yuanchu/limslaboratory/pojo/vo/ProjectNumVo.java
ÎļþÃû´Ó inspection-server/src/main/java/com/yuanchu/limslaboratory/pojo/ProjectNum.java ÐÞ¸Ä @@ -1,9 +1,9 @@ package com.yuanchu.limslaboratory.pojo; package com.yuanchu.limslaboratory.pojo.vo; import lombok.Data; @Data public class ProjectNum { public class ProjectNumVo { private int insNum; //å·²æ£éªçæ£éªåæ°é private int insUnNum; //æªæ£éªçæ£éªåæ°é inspection-server/src/main/java/com/yuanchu/limslaboratory/pojo/vo/StatisticsDataVo.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,18 @@ package com.yuanchu.limslaboratory.pojo.vo; import lombok.Data; import java.math.BigDecimal; @Data public class StatisticsDataVo { private BigDecimal material; //åææåæ ¼ç private BigDecimal unmaterial; //åææä¸åæ ¼ç private BigDecimal notmaterial; //åæææªæ£éªç private BigDecimal finished; //æååæ ¼ç private BigDecimal unfinished; //æåä¸åæ ¼ç private BigDecimal notfinished; //æåæªæ£éªç } inspection-server/src/main/java/com/yuanchu/limslaboratory/service/HomeService.java
@@ -1,13 +1,45 @@ package com.yuanchu.limslaboratory.service; import com.yuanchu.limslaboratory.pojo.ProjectNum; import com.yuanchu.limslaboratory.pojo.vo.LineChartVO; import com.yuanchu.limslaboratory.pojo.vo.ProjectNumVo; import com.yuanchu.limslaboratory.pojo.vo.StatisticsDataVo; import java.util.List; import java.util.Map; public interface HomeService { /** * è®¡ç®æ£éªä¸æªæ£éªçååä¸é¡¹ç®çæ°éæ¥å£ * * @return */ ProjectNum checkProjectNum(); ProjectNumVo checkProjectNum(); /** * å·²æ£éªtop3 * * @return */ List<Map<String, Object>> checktop3(); /** * æªæ£éªtop4 * * @return */ List<Map<String, Object>> unchecktop4(); /** * 计ç®åææä¸æåçåæ ¼ç * @return */ StatisticsDataVo qualified(); /** * ç»è®¡ * @param type * @return */ LineChartVO turno(Integer type); } inspection-server/src/main/java/com/yuanchu/limslaboratory/service/PlanService.java
@@ -42,7 +42,7 @@ * @param value * @return */ String check(Integer id, String value); Integer check(Integer id, String value); /** * 䏿¥ inspection-server/src/main/java/com/yuanchu/limslaboratory/service/QualificationRateStatisticsService.java
@@ -22,4 +22,6 @@ Map<String, Object> getSupplierNoPassStatistics(SelectQualificationRateDto dto); Map<String, Object> getNoPassProjectStatistics(SelectQualificationRateDto dto); List<Map<String, Object>> getSampleOptions(); } inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/HomeServiceImpl.java
@@ -1,14 +1,25 @@ package com.yuanchu.limslaboratory.service.impl; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.yuanchu.limslaboratory.mapper.InspectionMapper; import com.yuanchu.limslaboratory.mapper.InspectionProductMapper; import com.yuanchu.limslaboratory.pojo.Inspection; import com.yuanchu.limslaboratory.pojo.ProjectNum; import com.yuanchu.limslaboratory.pojo.vo.LineChartVO; import com.yuanchu.limslaboratory.pojo.vo.LineSeriesVO; import com.yuanchu.limslaboratory.pojo.vo.ProjectNumVo; import com.yuanchu.limslaboratory.pojo.vo.StatisticsDataVo; import com.yuanchu.limslaboratory.service.HomeService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.math.BigDecimal; import java.time.DayOfWeek; import java.time.LocalDate; import java.time.YearMonth; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; @Service @@ -23,16 +34,234 @@ //è®¡ç®æ£éªä¸æªæ£éªçååä¸é¡¹ç®çæ°éæ¥å£ @Override public ProjectNum checkProjectNum() { ProjectNum projectNum = new ProjectNum(); public ProjectNumVo checkProjectNum() { ProjectNumVo projectNumVo = new ProjectNumVo(); //å·²æ£éªçæ£éªåæ°é projectNum.setInsNum(inspectionMapper.seleCountIns()); projectNumVo.setInsNum(inspectionMapper.seleCountIns()); //æªæ£éªçæ£éªåæ°é projectNum.setInsUnNum(inspectionMapper.seleCountUnIns()); projectNumVo.setInsUnNum(inspectionMapper.seleCountUnIns()); //å·²æ£éªçæ£éªé¡¹ç®æ°é projectNum.setInsproNum(inspectionProductMapper.seleCountInspro()); projectNumVo.setInsproNum(inspectionProductMapper.seleCountInspro()); //æªæ£éªçæ£éªé¡¹ç®æ°é projectNum.setInsproUnNum(inspectionProductMapper.seleCountUnInspro()); return projectNum; projectNumVo.setInsproUnNum(inspectionProductMapper.seleCountUnInspro()); return projectNumVo; } //å·²æ£éªtop3 @Override public List<Map<String, Object>> checktop3() { //è·åæ£éªåæ»æ° Integer allIns = inspectionMapper.getcount(); //æ£éªç»è®º,æ£éªæ°é List<Map<String, Object>> mapList = inspectionMapper.getResultNum(); for (Map<String, Object> map : mapList) { //éåè·åæ°é Long num = (Long) map.get("num"); //计ç®ç¾åæ¯å¹¶åå ¥mapä¸ map.put("chact", getRadio(allIns, num)); } return mapList; } //æªæ£éªtpo4 @Override public List<Map<String, Object>> unchecktop4() { //æ£éªé¡¹ç®,设å¤,æ£éªå¼å§æ¶é´,æ§è¡äºº,æ£éªç»ææ¶é´ List<Map<String, Object>> mapList = inspectionProductMapper.getResultNum(); return mapList; } //计ç®åææä¸æåçåæ ¼ç @Override @Transactional(rollbackFor = Exception.class) public StatisticsDataVo qualified() { StatisticsDataVo statisticsDataVo = new StatisticsDataVo(); //åæææ£éªåæ»æ° Integer allmater = inspectionMapper.getallmater(); //åææåæ ¼ç Long mater = inspectionMapper.qualified(1); statisticsDataVo.setMaterial(getRadio(allmater, mater)); //åææä¸åæ ¼ç Long unmater = inspectionMapper.qualified(0); statisticsDataVo.setUnmaterial(getRadio(allmater, unmater)); //åæææªæ£éªç Long notmater = inspectionMapper.qualified(null); statisticsDataVo.setNotmaterial(getRadio(allmater, notmater)); //æåæ£éªåæ»æ° Integer allfin = inspectionMapper.getallfin(); //æååæ ¼ç Long finished = inspectionMapper.qualifiedfin(1); statisticsDataVo.setFinished(getRadio(allfin, finished)); //æåä¸åæ ¼ç Long unfinished = inspectionMapper.qualifiedfin(0); statisticsDataVo.setUnfinished(getRadio(allfin, unfinished)); //æåæªæ£éªç Long notfinished = inspectionMapper.qualifiedfin(null); statisticsDataVo.setNotfinished(getRadio(allfin, notfinished)); return statisticsDataVo; } //ç»è®¡ @Override @Transactional(rollbackFor = Exception.class) public LineChartVO turno(Integer type) { LineChartVO lineChartVO = new LineChartVO(); List<LineSeriesVO> series = new ArrayList<>(); //æå»ºç¬¬ä¸ä¸ªlineSeriesVO1(åæææ£éªæ°é) LineSeriesVO lineSeriesVO1 = new LineSeriesVO(); lineSeriesVO1.setName("åæææ£éªæ°é"); //æå»ºç¬¬äºä¸ªlineSeriesVO2(æåæ£éªæ°é) LineSeriesVO lineSeriesVO2 = new LineSeriesVO(); lineSeriesVO2.setName("æåæ£éªæ°é"); //æå»ºç¬¬ä¸ä¸ªlineSeriesVO3(åææåæ ¼ç) LineSeriesVO lineSeriesVO3 = new LineSeriesVO(); lineSeriesVO3.setName("åææåæ ¼ç"); //æå»ºç¬¬å个lineSeriesVO4(æååæ ¼ç) LineSeriesVO lineSeriesVO4 = new LineSeriesVO(); lineSeriesVO4.setName("æååæ ¼ç"); List<Object> list1 = new ArrayList<>(); List<Object> list2 = new ArrayList<>(); List<Object> list3 = new ArrayList<>(); List<Object> list4 = new ArrayList<>(); switch (type) { /*æ¬å¨*/ case 1: List<String> dayofWeeks = getDayofWeeks(); lineChartVO.setXAxis(dayofWeeks); for (String dayofWeek : dayofWeeks) { //æ¥è¯¢è¯¥æ¥æçåæææ£éªæ°é Integer allMaterByDay = inspectionMapper.getMaterByDay(dayofWeek); list1.add(allMaterByDay); //æ¥è¯¢è¯¥æ¥æçæåæ£éªæ°é Integer allFinByDay = inspectionMapper.getFinByDay(dayofWeek); list2.add(allFinByDay); //æ¥è¯¢è¯¥æ¥æçåææåæ ¼ç Long okMaterByDay = inspectionMapper.getOkMaterByDay(dayofWeek); list3.add(getRadio(allMaterByDay, okMaterByDay)); //æ¥è¯¢è¯¥æ¥æçæååæ ¼ç Long okFinByDay = inspectionMapper.getOkFinByDay(dayofWeek); list4.add(getRadio(allFinByDay, okFinByDay)); } break; /*æ¬æ*/ case 2: List<String> dayofMonths = getDayofMonth(); lineChartVO.setXAxis(dayofMonths); for (String dayofMonth : dayofMonths) { //æ¥è¯¢è¯¥æ¥æçåæææ£éªæ°é Integer allMaterByDay = inspectionMapper.getMaterByDay(dayofMonth); list1.add(allMaterByDay); //æ¥è¯¢è¯¥æ¥æçæåæ£éªæ°é Integer allFinByDay = inspectionMapper.getFinByDay(dayofMonth); list2.add(allFinByDay); //æ¥è¯¢è¯¥æ¥æçåææåæ ¼ç Long okMaterByDay = inspectionMapper.getOkMaterByDay(dayofMonth); list3.add(getRadio(allMaterByDay, okMaterByDay)); //æ¥è¯¢è¯¥æ¥æçæååæ ¼ç Long okFinByDay = inspectionMapper.getOkFinByDay(dayofMonth); list4.add(getRadio(allFinByDay, okFinByDay)); } break; /*æ¬å¹´*/ case 3: List<String> monthofYears = getMonthofYear(); lineChartVO.setXAxis(monthofYears); for (String monthofYear : monthofYears) { //æ¥è¯¢è¯¥æ¥æèå´å çåæææ£éªæ°é Integer allMaterByDay = inspectionMapper.getMaterByMonth(monthofYear); list1.add(allMaterByDay); //æ¥è¯¢è¯¥æ¥æçæåæ£éªæ°é Integer allFinByDay = inspectionMapper.getFinByMonth(monthofYear); list2.add(allFinByDay); //æ¥è¯¢è¯¥æ¥æçåææåæ ¼ç Long okMaterByDay = inspectionMapper.getOkMaterByMonth(monthofYear); list3.add(getRadio(allMaterByDay, okMaterByDay)); //æ¥è¯¢è¯¥æ¥æçæååæ ¼ç Long okFinByDay = inspectionMapper.getOkFinByMonth(monthofYear); list4.add(getRadio(allFinByDay, okFinByDay)); } break; } lineSeriesVO1.setData(list1); lineSeriesVO2.setData(list2); lineSeriesVO3.setData(list3); lineSeriesVO4.setData(list4); series.add(lineSeriesVO1); series.add(lineSeriesVO2); series.add(lineSeriesVO3); series.add(lineSeriesVO4); lineChartVO.setSeries(series); return lineChartVO; } /*计ç®ç¾åæ¯*/ private BigDecimal getRadio(Integer all, Long num) { if (all.intValue() == 0) { return new BigDecimal(0); } BigDecimal numBigDecimal = new BigDecimal(num); BigDecimal allBigDecimal = new BigDecimal(all); BigDecimal divide = numBigDecimal.divide(allBigDecimal, 4, BigDecimal.ROUND_HALF_UP); return divide.multiply(new BigDecimal(100)); } /*è·åæ¬å¹´æä»½listéå*/ private List<String> getMonthofYear() { // è·åå½å年份 int year = YearMonth.now().getYear(); // å建æä»½å表 List<String> months = new ArrayList<>(); // æ·»å æä»½å°å表 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM"); for (int i = 1; i <= 12; i++) { YearMonth month = YearMonth.of(year, i); String monthString = month.format(formatter); months.add(monthString); } return months; } /*è·åæ¬ææ¥ä»½listéå*/ private List<String> getDayofMonth() { // è·åå½åæ¥æ LocalDate now = LocalDate.now(); // è·åå½åæä»½ YearMonth currentMonth = YearMonth.from(now); // è·å该æçå¤©æ° int daysInMonth = currentMonth.lengthOfMonth(); // åå»ºæ¥æå表 List<String> dates = new ArrayList<>(); // æ·»å æ¥æå°å表 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); for (int i = 1; i <= daysInMonth; i++) { LocalDate date = currentMonth.atDay(i); String dateString = date.format(formatter); dates.add(dateString); } return dates; } /*è·åæ¬å¨æ¥ä»½listéå*/ private List<String> getDayofWeeks() { // è·åå½åæ¥æ LocalDate now = LocalDate.now(); // è·åæ¬å¨ç第ä¸å¤©åæåä¸å¤© LocalDate startOfWeek = now.with(DayOfWeek.MONDAY); LocalDate endOfWeek = now.with(DayOfWeek.SUNDAY); // åå»ºæ¥æå表 List<String> dates = new ArrayList<>(); // æ·»å æ¥æå°å表 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); while (!startOfWeek.isAfter(endOfWeek)) { String dateString = startOfWeek.format(formatter); dates.add(dateString); startOfWeek = startOfWeek.plusDays(1); } return dates; } } inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/PlanServiceImpl.java
@@ -10,8 +10,10 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.stream.Collectors; /** * <p> @@ -75,21 +77,24 @@ //æ£éª @Override @Transactional(rollbackFor = Exception.class) public String check(Integer id, String value) { //妿æ£éªå¼ä¸ä¸ºç©º if (StringUtils.isNotBlank(value)) { InspectionProduct inspectionProduct = inspectionProductMapper.selectById(id); //å¤ææ£æµå¼æ¯å¦æ»¡è¶³æ åå¼åå æ§å¼çè¦æ±,妿䏿»¡è¶³åæ£éªç»è®ºä¸ºä¸åæ ¼0 String required = inspectionProduct.getRequired();//æ åå¼ String internal = inspectionProduct.getInternal();//å æ§å¼ inspectionProduct.setTestValue(value); inspectionProduct.setTestState(checkValues(required, internal, value)); inspectionProductMapper.updateById(inspectionProduct); } else { //妿æ£éªå¼ä¸ºç©º,å°åæçæ£éªç»è®ºè¦ç为null inspectionProductMapper.upda(id); public Integer check(Integer id, String value) { InspectionProduct inspectionProduct = inspectionProductMapper.selectById(id); //å¤ææ£æµå¼æ¯å¦æ»¡è¶³æ åå¼åå æ§å¼çè¦æ±,妿䏿»¡è¶³åæ£éªç»è®ºä¸ºä¸åæ ¼0 String required = inspectionProduct.getRequired();//æ åå¼ String internal = inspectionProduct.getInternal();//å æ§å¼ inspectionProduct.setTestValue(value); List<Integer> list = Arrays.stream(value.split(",")).map(s -> { int values = checkValues(required, internal, s); return values; }).collect(Collectors.toList()); if (list.contains(0)) { //å¦æå ¶ä¸ä¸ä¸ªæ£éªå¼ä¸åæ ¼åè¯¥é¡¹ç®æ£éªä¸åæ ¼ inspectionProduct.setTestState(0); }else { inspectionProduct.setTestState(1); } return "æäº¤æå!"; inspectionProductMapper.updateById(inspectionProduct); return inspectionProduct.getTestState(); } //䏿¥ @@ -101,7 +106,7 @@ List<Integer> results = inspectionProductMapper.getresult(id); int count = 0; for (Integer result : results) { if (result != null && result==1) { if (result != null && result == 1) { count++; } } inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/QualificationRateStatisticsServiceImpl.java
@@ -5,8 +5,10 @@ import com.yuanchu.limslaboratory.mapper.InspectionMaterialMapper; import com.yuanchu.limslaboratory.mapper.QualificationRateStatisticsMapper; import com.yuanchu.limslaboratory.pojo.Dto.MapHandlerDto; import com.yuanchu.limslaboratory.pojo.Dto.SelectProjectByCodeAndNameDto; import com.yuanchu.limslaboratory.pojo.Dto.SelectQualificationRateDto; import com.yuanchu.limslaboratory.pojo.Dto.SeriesDto; import com.yuanchu.limslaboratory.pojo.ImInfo; import com.yuanchu.limslaboratory.pojo.InspectionMaterial; import com.yuanchu.limslaboratory.service.QualificationRateStatisticsService; import com.yuanchu.limslaboratory.utils.ArrayListUtil; @@ -15,6 +17,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.text.NumberFormat; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; @@ -30,6 +33,8 @@ @Resource private InspectionMaterialMapper inspectionMaterialMapper; private static final List<String> TYPE_LIST =Arrays.asList("åææ","æå","å§æå"); private static final List<Integer> TYPE_INT_LIST =Arrays.asList(0,1,2); @Resource private QualificationRateStatisticsMapper qualificationRateStatisticsMapper; @@ -43,16 +48,60 @@ @Override public Map<String, Object> getTestSampleStatistics(SelectQualificationRateDto dto) { System.out.println(dto); return null; Map<String, Object> mapResult = new HashMap<>(16); List<Map<String, Object>> mapList = qualificationRateStatisticsMapper.selectTestSamp(dto); if(mapList.size()<=0){ mapResult.put("noData",false); return mapResult; } mapResult.put("xAxis",TYPE_LIST); List<Map<String, Object>>list=new ArrayList<>(); Map<String, Object>mapPass=new HashMap<>(3); mapPass.put("name","åæ ¼"); mapPass.put("type","bar"); Map<String, Object>mapNoPass=new HashMap<>(3); mapNoPass.put("name","ä¸åæ ¼"); mapNoPass.put("type","bar"); List<Integer>passInteger=new ArrayList<>(); List<Integer>noPasInteger=new ArrayList<>(); AtomicInteger integerPass = new AtomicInteger(0); AtomicInteger integerNoPass = new AtomicInteger(0); for (int i = 0; i < TYPE_INT_LIST.size(); i++) { int finalI = i; mapList.stream().filter(m->Objects.equals(String.valueOf(m.get("type")),String.valueOf(TYPE_INT_LIST.get(finalI)))) .forEach(m->{ System.out.println(m.get("type")); if(Objects.equals(m.get("inspectionStatus"),0)){ integerNoPass.incrementAndGet(); } if(Objects.equals(m.get("inspectionStatus"),1)){ integerPass.incrementAndGet(); } }); passInteger.add(integerPass.get()); noPasInteger.add(integerNoPass.get()); integerPass.set(0); integerNoPass.set(0); } mapPass.put("data",passInteger); mapNoPass.put("data",noPasInteger); list.add(mapPass); list.add(mapNoPass); mapResult.put("series",list); mapResult.put("noData",true); System.out.println("æ§è¡ç»ægetTestSampleStatistics________________>"+mapResult); //System.out.println(mapResult); return mapResult; } @Override public Map<String, Object> getSupplierNoPassStatistics(SelectQualificationRateDto dto) { Map<String, Object> allMap = new HashMap<>(16); List<Map<String, Object>> mapList = qualificationRateStatisticsMapper.selectSupplierByCondition(dto); mapList.forEach(System.out::println); System.out.println("================================="); if(mapList.size()<=0){ allMap.put("noData",false); return allMap; } //å»éååºä¾åºå List<Map<String, Object>> supplierDistinct = ArrayListUtil.oneObjectsDistinctByProperty(MapHandlerDto::comparingBySupplier, mapList); List<String> supplierList = new ArrayList<String>(); @@ -60,21 +109,21 @@ supplierList.add(String.valueOf(l.get("supplier"))); }); allMap.put("xAxis", supplierList); List<SeriesDto>seriesDtoList=new ArrayList<SeriesDto>(2); SeriesDto seriesDto2=new SeriesDto("ä¸åæ ¼æ°é"); SeriesDto seriesDto=new SeriesDto("åæ ¼æ°é"); List<SeriesDto> seriesDtoList = new ArrayList<SeriesDto>(2); SeriesDto seriesDto = new SeriesDto("åæ ¼æ°é"); SeriesDto seriesDto2 = new SeriesDto("ä¸åæ ¼æ°é"); // ååºå¯¹åºåæ ¼æ°éä¸åæ ¼æ°é List<Long>pass=new ArrayList<>(); List<Long>noPass=new ArrayList<>(); AtomicLong integerPass=new AtomicLong(0L); AtomicLong integerNoPass=new AtomicLong(0L); List<Long> pass = new ArrayList<>(); List<Long> noPass = new ArrayList<>(); AtomicLong integerPass = new AtomicLong(0L); AtomicLong integerNoPass = new AtomicLong(0L); supplierList.forEach(s -> { mapList.stream() .filter(l -> Objects.equals(l.get("supplier"), s)) .forEach(l -> { if(Objects.equals(l.get("inspectionStatus"),1)){ if (Objects.equals(l.get("inspectionStatus"), 1)) { integerPass.incrementAndGet(); }else { } else { integerNoPass.incrementAndGet(); } }); @@ -83,19 +132,83 @@ integerNoPass.set(0L); integerPass.set(0L); }); seriesDto.setData(pass); seriesDto2.setData(noPass); List<Double> percentPass = new ArrayList<>(); List<Double> percentNoPass = new ArrayList<>(); for (int i = 0; i < pass.size(); i++) { long total = (pass.get(i) + noPass.get(i)); double passNO = 0.00; if (pass.get(i) != 0L) { passNO = Double.parseDouble(getPercent(pass.get(i), total).replace("%", "")); } double noPassNO = 0.00; if (noPass.get(i) != 0L) { noPassNO = Double.parseDouble(getPercent(noPass.get(i), total).replace("%", "")); } percentPass.add(passNO); percentNoPass.add(noPassNO); } seriesDto.setData(percentPass); seriesDto2.setData(percentNoPass); seriesDtoList.add(seriesDto); seriesDtoList.add(seriesDto2); System.out.println("æ°é=======>"); System.out.println(seriesDtoList); return null; allMap.put("series", seriesDtoList); allMap.put("noData",true); System.out.println("getSupplierNoPassStatisticsç»æ++++++++++++++++>"+allMap); return allMap; } @Override public Map<String, Object> getNoPassProjectStatistics(SelectQualificationRateDto dto) { return null; Map<String, Object> allMap = new HashMap<>(16); List<ImInfo> imInfos = qualificationRateStatisticsMapper.selectProjectionsByCondition(dto); List<String>NameList = new ArrayList<>(); List<SelectProjectByCodeAndNameDto>projectByCodeAndNameDtos=new ArrayList<>(); if(imInfos.size()<=0){ allMap.put("noData",false); return allMap; } imInfos.forEach(l->{ NameList.add(l.getICode()+"-"+l.getImName()); projectByCodeAndNameDtos.add(new SelectProjectByCodeAndNameDto(l.getICode(),l.getImName())); }); List<ImInfo> imInfosAll = qualificationRateStatisticsMapper.selectProjection(projectByCodeAndNameDtos,dto); int total = imInfosAll.size(); List<Integer>noPas=new ArrayList<>(); AtomicInteger i=new AtomicInteger(0); NameList.forEach(n->{ imInfos.stream() .filter(im-> Objects.equals(n,im.getICode()+"-"+im.getImName())) .forEach(im->{ i.set(im.getIprInfos().size()); }); noPas.add(i.get()); i.set(0); }); List<Map<String, Object>>doubleList=new ArrayList<>(); for (int j = 0; j < noPas.size(); j++) { Map<String, Object>map=new HashMap<>(); map.put("name",NameList.get(j)); map.put("value",Double.parseDouble(getPercent(noPas.get(j),total).replace("%",""))); doubleList.add(map); } allMap.put("legend",NameList); allMap.put("series",doubleList); allMap.put("noData",true); System.out.println("getNoPassProjectStatisticsç»æ==========================>"+allMap); return allMap; } @Override public List<Map<String, Object>> getSampleOptions() { return qualificationRateStatisticsMapper.getSampleOptions(); } } public static String getPercent(long x, long y) { double d1 = x * 1.0; double d2 = y * 1.0; NumberFormat percentInstance = NumberFormat.getPercentInstance(); // 设置ä¿çå ä½å°æ°ï¼è¿éè®¾ç½®çæ¯ä¿ç两ä½å°æ° percentInstance.setMinimumFractionDigits(2); return percentInstance.format(d1 / d2); } } inspection-server/src/main/resources/mapper/InspectionMapper.xml
@@ -42,4 +42,141 @@ where state = 1 and inspection_status is null </select> <!--è·åæ£éªåæ»æ°--> <select id="getcount" resultType="java.lang.Integer"> select count(id) from lims_laboratory.inspection where state = 1 </select> <!--æ£éªç»è®º,æ£éªæ°é--> <select id="qualified" resultType="java.lang.Long"> select count(id) from lims_laboratory.inspection where state = 1 and type = 0 <if test="b!=null "> and inspection_status = #{b} </if> <if test="b==null"> and inspection_status is null </if> </select> <!--计ç®åææä¸æåçåæ ¼ç--> <select id="getResultNum" resultType="java.util.Map"> select inspection_status result, count(id) num from lims_laboratory.inspection where state = 1 group by result order by num desc </select> <!--计ç®åæææ£éªåæ»æ°--> <select id="getallmater" resultType="java.lang.Integer"> select count(id) from lims_laboratory.inspection where state = 1 and type = 0 </select> <!--è®¡ç®æåæ£éªåæ»æ°--> <select id="getallfin" resultType="java.lang.Integer"> select count(id) from lims_laboratory.inspection where state = 1 and type in (1, 2) </select> <!--计ç®åææåæ ¼ç--> <select id="qualifiedfin" resultType="java.lang.Long"> select count(id) from lims_laboratory.inspection where state = 1 and type in (1, 2) <if test="i!=null "> and inspection_status = #{i} </if> <if test="i==null"> and inspection_status is null </if> </select> <!--æ¥è¯¢è¯¥æ¥æçåæææ£éªæ°é--> <select id="getMaterByDay" resultType="java.lang.Integer"> select count(id) from lims_laboratory.inspection where state = 1 and type = 0 and create_time = #{time} </select> <!--æ¥è¯¢è¯¥æ¥æçæåæ£éªæ°é--> <select id="getFinByDay" resultType="java.lang.Integer"> select count(id) from lims_laboratory.inspection where state = 1 and type in (1, 2) and create_time = #{time} </select> <!--æ¥è¯¢è¯¥æ¥æçåææåæ ¼æ°é--> <select id="getOkMaterByDay" resultType="java.lang.Long"> select count(id) from lims_laboratory.inspection where state = 1 and type = 0 and inspection_status = 1 and end_time = #{time} </select> <!--æ¥è¯¢è¯¥æ¥æçæååæ ¼æ°é--> <select id="getOkFinByDay" resultType="java.lang.Long"> select count(id) from lims_laboratory.inspection where state = 1 and type in (1, 2) and inspection_status = 1 and end_time = #{time} </select> <!--æ¥è¯¢è¯¥æçåæææ£éªæ°é--> <select id="getMaterByMonth" resultType="java.lang.Integer"> select count(id) from lims_laboratory.inspection where state = 1 and type = 0 and DATE_FORMAT(create_time, '%Y-%m') = #{monthofYear} </select> <!--æ¥è¯¢è¯¥æçæåæ£éªæ°é--> <select id="getFinByMonth" resultType="java.lang.Integer"> select count(id) from lims_laboratory.inspection where state = 1 and type in (1, 2) and DATE_FORMAT(create_time, '%Y-%m') = #{monthofYear} </select> <!--æ¥è¯¢è¯¥æçåææåæ ¼ç--> <select id="getOkMaterByMonth" resultType="java.lang.Long"> select count(id) from lims_laboratory.inspection where state = 1 and type = 0 and inspection_status = 1 and DATE_FORMAT(end_time, '%Y-%m') = #{monthofYear} </select> <!--æ¥è¯¢è¯¥æçæååæ ¼ç--> <select id="getOkFinByMonth" resultType="java.lang.Long"> select count(id) from lims_laboratory.inspection where state = 1 and type in (1, 2) and inspection_status = 1 and DATE_FORMAT(end_time, '%Y-%m') = #{monthofYear} </select> </mapper> inspection-server/src/main/resources/mapper/InspectionProductMapper.xml
@@ -1,12 +1,7 @@ <?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.yuanchu.limslaboratory.mapper.InspectionProductMapper"> <update id="upda"> update lims_laboratory.inspection_product set test_state=null where id = #{id} and state = 1 </update> <!--æ ¹æ®æ£éªåidæ¥è¯¢æ£éªé¡¹ç®çæ£éªç»æ--> <select id="getresult" resultType="java.lang.Integer"> @@ -37,4 +32,22 @@ where state = 1 and test_state is null </select> <!--è·åæ£éªé¡¹ç®,设å¤,æ£éªå¼å§æ¶é´,æ§è¡äºº,æ£éªç»ææ¶é´--> <select id="getResultNum" resultType="java.util.Map"> select ip.name, equipment_name instrumentname, DATE_FORMAT(start_time, '%Y-%m-%d') startTime, user.name checkname, DATE_FORMAT(end_time, '%Y-%m-%d') endTime from lims_laboratory.inspection_product ip left join lims_laboratory.inspection_material on ip.inspection_material_id = inspection_material.id left join lims_laboratory.inspection i on inspection_material.inspection_id = i.id left join lims_laboratory.instrument on ip.instrument_id = instrument.id left join lims_laboratory.user on ip.user_id = user.id where ip.state = 1 and test_state is null order by start_time limit 4 </select> </mapper> inspection-server/src/main/resources/mapper/PlanMapper.xml
@@ -8,7 +8,7 @@ <result property="inspectionStatus" column="inspectionStatus"/> <result property="startTime" column="startTime"/> <result property="endTime" column="endTime"/> <collection property="chldren" resultMap="selectAllPlanMapTowsMap" javaType="List"/> <collection property="children" resultMap="selectAllPlanMapTowsMap" javaType="List"/> </resultMap> <resultMap id="selectAllPlanMapTowsMap" type="map"> <id property="pid" column="pid"/> @@ -16,6 +16,7 @@ <result property="unit" column="unit"/> <result property="required" column="required"/> <result property="internal" column="internal"/> <result property="testValue" column="testValue"/> <result property="testState" column="testState"/> <result property="checker" column="checker"/> <result property="instrumentname" column="instrumentname"/> @@ -33,6 +34,7 @@ ip.unit, required, internal, test_value testValue, test_state testState, u.name checker, equipment_name instrumentname inspection-server/src/main/resources/mapper/QualificationRateStatisticsMapper.xml
@@ -11,7 +11,7 @@ i.end_time endTime FROM inspection i INNER JOIN inspection_material im ON i.id = im.inspection_id where (i.state = 1 AND TRUE = IFNULL(i.inspection_status, FALSE)) where (i.state = 1 AND i.inspection_status is NOT NULL and im.state=1) <if test="dto.beginDate!=null and dto.endDate!=null"> DATE_FORMAT( i.end_time, '%Y-%m-%d' ) BETWEEN #{dto.beginDate} AND #{dto.endDate} @@ -23,5 +23,154 @@ <if test="dto.supplier!=null and dto.supplier!=''"> and im.supplier=#{dto.supplier} </if> <if test="dto.sample!=null and dto.sample!=''"> and im.name=#{dto.sample} </if> <if test="dto.code!=null and dto.code!=''"> and i.code=#{dto.code} </if> </select> <select id="selectProjectionsByCondition" resultMap="ImInfoMap"> SELECT im.id imId, im.`name` imName, i.inspection_status inspectionStatus, i.start_time startTime, i.end_time endTime, ipr.id iprId, ipr.`name` iprName, ipr.test_state testState, i.code iCode, i.type type FROM inspection i, inspection_material im, inspection_product ipr WHERE i.id = im.inspection_id AND im.id = ipr.inspection_material_id AND i.state = 1 AND im.state = 1 AND ipr.state = 1 AND i.inspection_status is NOT NULL AND ipr.test_state is not null AND ipr.test_state = 0 <if test="dto.beginDate!=null and dto.endDate!=null"> DATE_FORMAT( i.end_time, '%Y-%m-%d' ) BETWEEN #{dto.beginDate} AND #{dto.endDate} AND DATE_FORMAT( i.start_time, '%Y-%m-%d' )>= #{dto.beginDate} </if> <if test="dto.type!=null"> and i.type=#{dto.type} </if> <if test="dto.supplier!=null and dto.supplier!=''"> and im.supplier=#{dto.supplier} </if> <if test="dto.sample!=null and dto.sample!=''"> and im.name=#{dto.sample} </if> <if test="dto.code!=null and dto.code!=''"> and i.code=#{dto.code} </if> </select> <select id="selectProjection" resultMap="ImInfoMap"> SELECT im.id imId FROM inspection i, inspection_material im, inspection_product ipr WHERE i.id = im.inspection_id AND im.id = ipr.inspection_material_id AND i.state = 1 AND im.state = 1 AND ipr.state = 1 AND i.inspection_status is NOT NULL AND ipr.test_state is not null <if test="dto.beginDate!=null and dto.endDate!=null"> DATE_FORMAT( i.end_time, '%Y-%m-%d' ) BETWEEN #{dto.beginDate} AND #{dto.endDate} AND DATE_FORMAT( i.start_time, '%Y-%m-%d' )>= #{dto.beginDate} </if> <if test="dto.type!=null"> and i.type=#{dto.type} </if> <if test="dto.supplier!=null and dto.supplier!=''"> and im.supplier=#{dto.supplier} </if> <if test="dto.sample!=null and dto.sample!=''"> and im.name=#{dto.sample} </if> <if test="dto.code!=null and dto.code!=''"> and i.code=#{dto.code} </if> and i.code in <foreach collection="list" item="l" open="(" close=")" separator="," > #{l.code} </foreach> and im.name in <foreach collection="list" item="l" open="(" close=")" separator=","> #{l.name} </foreach> </select> <select id="selectTestSamp" resultType="java.util.Map"> SELECT i.id, i.type, im.`name`, im.supplier, i.inspection_status inspectionStatus, i.start_time startTime, i.end_time endTime FROM inspection i INNER JOIN inspection_material im ON i.id = im.inspection_id where (i.state = 1 AND i.inspection_status is NOT NULL and im.state=1) <if test="dto.beginDate!=null and dto.endDate!=null"> DATE_FORMAT( i.end_time, '%Y-%m-%d' ) BETWEEN #{dto.beginDate} AND #{dto.endDate} AND DATE_FORMAT( i.start_time, '%Y-%m-%d' )>= #{dto.beginDate} </if> <if test="dto.type!=null"> and i.type=#{dto.type} </if> <if test="dto.supplier!=null and dto.supplier!=''"> and im.supplier=#{dto.supplier} </if> <if test="dto.sample!=null and dto.sample!=''"> and im.name=#{dto.sample} </if> <if test="dto.code!=null and dto.code!=''"> and i.code=#{dto.code} </if> </select> <select id="getSampleOptions" resultType="java.util.Map"> SELECT i.id, i.type, im.`name` name, im.supplier, i.inspection_status inspectionStatus, i.start_time startTime, i.end_time endTime, i.`code` FROM inspection i INNER JOIN inspection_material im ON i.id = im.inspection_id WHERE ( i.state = 1 AND i.inspection_status IS NOT NULL AND im.state = 1 ) </select> <resultMap id="ImInfoMap" type="com.yuanchu.limslaboratory.pojo.ImInfo"> <result property="imId" column="imId"/> <result property="iCode" column="iCode"/> <result property="imName" column="imName"/> <result property="startTime" column="startTime"/> <result property="endTime" column="endTime"/> <result property="inspectionStatus" column="inspectionStatus"/> <collection property="iprInfos" ofType="iprInfo"> <result property="iprId" column="iprId"/> <result property="iprName" column="iprName"/> <result property="testState" column="testState"/> </collection> </resultMap> </mapper> laboratory-server/src/main/resources/mapper/InstrumentMapper.xml
@@ -23,23 +23,27 @@ <!--éæ©è®¾å¤--> <resultMap id="chooseinstumMap" type="map"> <id property="father_name" column="father_name"/> <collection property="father" resultMap="chooseinstumTowMap" javaType="List"/> <id property="id" column="cid"/> <result property="name" column="father_name"/> <collection property="children" resultMap="chooseinstumTowMap" javaType="List"/> </resultMap> <resultMap id="chooseinstumTowMap" type="map"> <id property="son_name" column="son_name"/> <collection property="chldren" resultMap="chooseinstumTowsMap" javaType="List"/> <id property="id" column="cid"/> <result property="name" column="son_name"/> <collection property="children" resultMap="chooseinstumTowsMap" javaType="List"/> </resultMap> <resultMap id="chooseinstumTowsMap" type="map"> <id property="id" column="id"/> <result property="name" column="name"/> </resultMap> <select id="chooseinstum" resultMap="chooseinstumMap"> select instrument.id, father_name, son_name, select c.id cid, instrument.id, father_name , son_name , equipment_name name from lims_laboratory.instrument left join lims_laboratory.classify c on c.id = instrument.classify_id where conditions in(1,5) </select> </mapper> standard-server/src/main/java/com/yuanchu/limslaboratory/controller/ProductModelController.java
@@ -34,11 +34,7 @@ @Autowired private ProductModelService productModelService; @ApiOperation(value = "éæ©æ ·ååç§°") @GetMapping("/selectmater") public Result selectmater() { return Result.success(productModelService.selectmater()); } @ApiOperation(value = "æ·»å æ å-->鿩项ç®åç»") @GetMapping("/selectfather") standard-server/src/main/java/com/yuanchu/limslaboratory/service/ProductModelService.java
@@ -17,11 +17,7 @@ */ public interface ProductModelService extends IService<ProductModel> { /** * éæ©æ ·ååç§° * @return */ List<String> selectmater(); /** * æ·»å æ å-->鿩项ç®åç» standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/MaterialServiceImpl.java
@@ -1,10 +1,9 @@ package com.yuanchu.limslaboratory.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.yuanchu.limslaboratory.mapper.ProductModelMapper; import com.yuanchu.limslaboratory.pojo.Material; import com.yuanchu.limslaboratory.mapper.MaterialMapper; @@ -17,14 +16,11 @@ import com.yuanchu.limslaboratory.service.ProductService; import com.yuanchu.limslaboratory.service.SpecificationsService; import com.yuanchu.limslaboratory.service.StandardService; import com.yuanchu.limslaboratory.utils.MyUtil; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -106,8 +102,12 @@ List<Product> productList = productModel.stream().map(stringObjectMap -> { Product product = new Product(); product.setName(stringObjectMap.get("name").toString()); product.setFather(stringObjectMap.get("father").toString()); product.setUnit(stringObjectMap.get("unit").toString()); if (ObjectUtils.isNotEmpty(stringObjectMap.get("father"))) { product.setFather(stringObjectMap.get("father").toString()); } if (ObjectUtils.isNotEmpty(stringObjectMap.get("unit"))) { product.setUnit(stringObjectMap.get("unit").toString()); } product.setSpecifications_id(specifications.getId()); return product; }).collect(Collectors.toList()); standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/ProductModelServiceImpl.java
@@ -28,11 +28,6 @@ @Resource ProductModelMapper productModelMapper; //éæ©æ ·å @Override public List<String> selectmater() { return productModelMapper.selectmater(); } //æ·»å æ å-->鿩项ç®åç» @Override standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/SpecificationsServiceImpl.java
@@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.yuanchu.limslaboratory.mapper.ProductModelMapper; import com.yuanchu.limslaboratory.pojo.Product; import com.yuanchu.limslaboratory.pojo.Specifications; @@ -14,7 +15,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.util.ObjectUtils; import javax.annotation.Resource; import java.util.ArrayList; @@ -87,12 +87,12 @@ List<Product> productList = productModel.stream().map(stringObjectMap -> { Product product = new Product(); product.setName(stringObjectMap.get("name").toString()); try{ if (ObjectUtils.isNotEmpty(stringObjectMap.get("father"))) { product.setFather(stringObjectMap.get("father").toString()); }catch (Exception e){ product.setFather(null); } product.setUnit(stringObjectMap.get("unit").toString()); if (ObjectUtils.isNotEmpty(stringObjectMap.get("unit"))) { product.setUnit(stringObjectMap.get("unit").toString()); } product.setSpecifications_id(specifications.getId()); return product; }).collect(Collectors.toList()); standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/StandardServiceImpl.java
@@ -107,8 +107,12 @@ List<Product> productList = productModel.stream().map(stringObjectMap -> { Product product = new Product(); product.setName(stringObjectMap.get("name").toString()); product.setFather(stringObjectMap.get("father").toString()); product.setUnit(stringObjectMap.get("unit").toString()); if (ObjectUtils.isNotEmpty(stringObjectMap.get("father"))) { product.setFather(stringObjectMap.get("father").toString()); } if (ObjectUtils.isNotEmpty(stringObjectMap.get("unit"))) { product.setUnit(stringObjectMap.get("unit").toString()); } product.setSpecifications_id(specifications.getId()); return product; }).collect(Collectors.toList());