| | |
| | | return Result.success(inspectionService.selectInspectsListById(id)); |
| | | } |
| | | |
| | | @ApiOperation(value = "䏿¥(æ´æ°æ£éªç¶æ)") |
| | | @ApiOperation(value = "ä½åºæ£éªå") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "æ£éªåid", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @PostMapping("/updateInspectsById") |
| | | public Result updateInspectsById(Integer id) { |
| | | //妿已ç»ä¸æ¥äºä¸è½å䏿¬¡ä¸æ¥ |
| | | Inspection inspection = inspectionService.getById(id); |
| | | if (ObjectUtils.isNotEmpty(inspection.getInspectionStatus())) { |
| | | return Result.fail("å·²ç»ä¸æ¥è¿äº,ä¸è½åæ¬¡ä¸æ¥!"); |
| | | } |
| | | return Result.success(inspectionService.updateInspectsById(id)); |
| | | @PostMapping("/delInspect") |
| | | public Result delInspect(Integer id) { |
| | | return Result.success(inspectionService.delInspect(id)); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | package com.yuanchu.limslaboratory.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.yuanchu.limslaboratory.pojo.Inspection; |
| | | import com.yuanchu.limslaboratory.service.PlanService; |
| | | import com.yuanchu.limslaboratory.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | |
| | | public Result distribution(Integer id, Integer userId, Integer instrumentId) { |
| | | return Result.success(planService.distribution(id, userId, instrumentId)); |
| | | } |
| | | |
| | | @ApiOperation("æ£éª") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "æ£éªé¡¹ç®id", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "value", value = "æ£éªå¼", dataTypeClass = String.class) |
| | | }) |
| | | @PostMapping("/check") |
| | | public Result check(Integer id, String value) { |
| | | return Result.success(planService.check(id, value)); |
| | | } |
| | | |
| | | @ApiOperation("䏿¥") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "æ£éªåid", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @PostMapping("/reported") |
| | | public Result reported(Integer id) { |
| | | return Result.success(planService.reported(id)); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.pojo.RawMaterial; |
| | | import com.yuanchu.limslaboratory.service.RawMaterialService; |
| | | import com.yuanchu.limslaboratory.utils.MyUtil; |
| | | import com.yuanchu.limslaboratory.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.pojo.vo.ReportVo; |
| | | import com.yuanchu.limslaboratory.service.ReportService; |
| | | import com.yuanchu.limslaboratory.utils.JackSonUtil; |
| | | import com.yuanchu.limslaboratory.utils.RedisUtil; |
| | | 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.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.HashMap; |
| | |
| | | @RestController |
| | | @RequestMapping("/report") |
| | | public class ReportController { |
| | | /** |
| | | * æå¡å¯¹è±¡ |
| | | */ |
| | | |
| | | @Resource |
| | | private ReportService reportService; |
| | | |
| | |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @ApiOperation("æäº¤") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "æ£éªæ¥åid", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @PostMapping("/submit") |
| | | public Result submit(Integer id) { |
| | | return Result.success(reportService.submit(id)); |
| | | } |
| | | |
| | | @ApiOperation("å®¡æ ¸") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "æ£éªæ¥åid", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "result", value = "å®¡æ ¸ç»è®º", dataTypeClass = String.class, required = true) |
| | | }) |
| | | @PostMapping("/check") |
| | | public Result check(@RequestHeader("token") String token, Integer id, String result) throws Exception { |
| | | Object object = RedisUtil.get(token); |
| | | Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class); |
| | | return Result.success(reportService.check((String) unmarshal.get("name"), id, result)); |
| | | } |
| | | |
| | | @ApiOperation("å é¤") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "id", value = "æ£éªæ¥åid", dataTypeClass = Integer.class, required = true) |
| | | }) |
| | | @PostMapping("/delreport") |
| | | public Result delreport(Integer id) { |
| | | return Result.success(reportService.delreport(id)); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.pojo.Inspection; |
| | | import com.yuanchu.limslaboratory.pojo.vo.InspectionVo; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.yuanchu.limslaboratory.pojo.InspectionProduct; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ç³è¯·åä¸ç©æä¸ç项ç®(InspectionProduct)è¡¨æ°æ®åºè®¿é®å± |
| | | * |
| | |
| | | */ |
| | | public interface InspectionProductMapper extends BaseMapper<InspectionProduct> { |
| | | |
| | | //æ ¹æ®é¡¹ç®idå°å·²æçæ£éªç»è®ºæ¹ä¸ºnull |
| | | void upda(Integer id); |
| | | |
| | | //æ ¹æ®æ£éªåidæ¥è¯¢æ£éªé¡¹ç®çæ£éªç»æ |
| | | List<Integer> getresult(Integer id); |
| | | |
| | | //æ ¹æ®æ£éªæ ·åidä½åºæ£éªé¡¹ç® |
| | | void updat(Integer id); |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.pojo.Report; |
| | | import com.yuanchu.limslaboratory.pojo.vo.ReportAuditingVo; |
| | | import com.yuanchu.limslaboratory.pojo.vo.ReportVo; |
| | | |
| | | /** |
| | |
| | | */ |
| | | IPage<ReportVo> selectAllReport(Page<Object> page, Integer status, String name); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ¥åå®¡æ ¸ |
| | | * @return |
| | | */ |
| | | IPage<ReportAuditingVo> selectAllReportAuditing(Page<Object> page, Integer status, String name); |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.*; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | |
| | | **/ |
| | | private Integer inspectionStatus; |
| | | |
| | | /** |
| | | * ${column.comment} |
| | | **/ |
| | | @ApiModelProperty(value = "é»è¾å é¤ æ£å¸¸>=1,å é¤<=0", hidden = true) |
| | | private Integer state; |
| | | |
| | | /** |
| | |
| | | @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") |
| | |
| | | @ApiModelProperty(value = "å
³è ç³è¯·è¡¨id") |
| | | private Integer inspectionId; |
| | | |
| | | @ApiModelProperty(value = "å®¡æ ¸æ¶é´", hidden = true) |
| | | @JsonFormat(pattern = "yyyy-MM-dd ", timezone = "GMT+8") |
| | | private Date checkTime; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | @ApiModelProperty(value = "å建æ¶é´", hidden = true) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @JsonFormat(pattern = "yyyy-MM-dd ", timezone = "GMT+8") |
| | | private Date createTime; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @JsonFormat(pattern = "yyyy-MM-dd ", timezone = "GMT+8") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Date updateTime; |
| | | |
| | | @ApiModelProperty(value = "é»è¾å é¤ æ£å¸¸>=1,å é¤<=0", hidden = true) |
| | | private Integer state; |
| | | |
| | | } |
| | | |
| | |
| | | package com.yuanchu.limslaboratory.pojo.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * æ£éªæ¥å |
| | | */ |
| | | @Data |
| | | public class ReportVo { |
| | | |
| | | @ApiModelProperty(value = "æ£éªæ¥åid") |
| | | @JsonSerialize |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "æ ·åç¼å·") |
| | | @JsonSerialize |
| | | private String materialCode; |
| | | |
| | | @ApiModelProperty(value = "æ¥ååå·") |
| | | @JsonSerialize |
| | | private String reportCode; |
| | | @ApiModelProperty(value = "ç³è¯·åå·") |
| | | |
| | | @ApiModelProperty(value = "æ£éªç³è¯·åå·") |
| | | @JsonSerialize |
| | | private String inspectionCode; |
| | | @ApiModelProperty(value = "审æ¹äºº") |
| | | |
| | | @ApiModelProperty(value = "æ ·ååç§°") |
| | | @JsonSerialize |
| | | private Integer approver; |
| | | @ApiModelProperty(value = "审æ¹ç¶æ 0ï¼å¾
æäº¤ 1ï¼å¾
å®¡æ ¸ï¼2ï¼å·²å®¡æ ¸") |
| | | @JsonSerialize |
| | | private Integer status; |
| | | private String materialName; |
| | | |
| | | @ApiModelProperty(value = "æ£éªç»è®º") |
| | | @JsonSerialize |
| | | private String conclusion; |
| | | |
| | | @ApiModelProperty(value = "审æ¹ç¶æ 0ï¼å¾
æäº¤ 1ï¼å¾
å®¡æ ¸ï¼2ï¼å·²éè¿ 3:ä¸éè¿") |
| | | @JsonSerialize |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "审æ¹äºº") |
| | | @JsonSerialize |
| | | private Integer approver; |
| | | |
| | | @ApiModelProperty(value = "å®¡æ ¸æ¶é´", hidden = true) |
| | | @JsonFormat(pattern = "yyyy-MM-dd ", timezone = "GMT+8") |
| | | private Date checkTime; |
| | | |
| | | @ApiModelProperty(value = "ç¼å¶äºº") |
| | | @JsonSerialize |
| | | private String name; |
| | |
| | | */ |
| | | InspectDetailVo selectInspectsListById(Integer id); |
| | | |
| | | |
| | | /** |
| | | * 䏿¥(æ´æ°æ£éªåæ£éªç»æ) |
| | | * ä½åºæ£éªå |
| | | * @param id |
| | | * @return |
| | | */ |
| | | boolean updateInspectsById(Integer id); |
| | | String delInspect(Integer id); |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | String distribution(Integer id, Integer userId, Integer instrumentId); |
| | | |
| | | /** |
| | | * æ£éª |
| | | * @param id |
| | | * @param value |
| | | * @return |
| | | */ |
| | | String check(Integer id, String value); |
| | | |
| | | /** |
| | | * 䏿¥ |
| | | * @param code |
| | | * @return |
| | | */ |
| | | String reported(Integer id); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | IPage<ReportVo> selectAllReport(Page<Object> page, Integer status, String name); |
| | | |
| | | /** |
| | | * æäº¤ |
| | | * @param id |
| | | * @return |
| | | */ |
| | | String submit(Integer id); |
| | | |
| | | /** |
| | | * å®¡æ ¸ |
| | | * @param name |
| | | * @param id |
| | | * @return |
| | | */ |
| | | String check(String name, Integer id, String result); |
| | | |
| | | /** |
| | | * å é¤ |
| | | * @param id |
| | | * @return |
| | | */ |
| | | String delreport(Integer id); |
| | | } |
| | | |
| | |
| | | package com.yuanchu.limslaboratory.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.limslaboratory.mapper.InspectionProductMapper; |
| | | import com.yuanchu.limslaboratory.pojo.InspectionProduct; |
| | | import com.yuanchu.limslaboratory.pojo.vo.InsProductVo; |
| | | import com.yuanchu.limslaboratory.service.InspectionProductService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | |
| | | /** |
| | | * ç³è¯·åä¸ç©æä¸ç项ç®(InspectionProduct)表æå¡å®ç°ç±» |
| | |
| | | @Service |
| | | public class InspectionProductServiceImpl extends ServiceImpl<InspectionProductMapper, InspectionProduct> implements InspectionProductService { |
| | | |
| | | @Resource |
| | | InspectionProductMapper inspectionProductMapper; |
| | | |
| | | /* //æ´æ°æ£éªé¡¹ç® |
| | | @Override |
| | | public boolean updateInsProduct(Integer userId, InspectionProduct inspectionProduct) { |
| | | //èµå¼æ£éªåid |
| | | inspectionProduct.setUserId(userId); |
| | | //å¤ææ£æµå¼æ¯å¦æ»¡è¶³æ åå¼åå
æ§å¼çè¦æ±,妿䏿»¡è¶³åæ£éªç»è®ºä¸ºä¸åæ ¼0 |
| | | String testValue = inspectionProduct.getTestValue();//æ£éªå¼ |
| | | String required = inspectionProduct.getRequired();//æ åå¼ |
| | | String internal = inspectionProduct.getInternal();//å
æ§å¼ |
| | | inspectionProduct.setTestState(checkValues(required, internal, testValue)); |
| | | //æ ¹æ®æ£éªé¡¹ç®ååå
³èçæ£éªç©æidæ¥æ¥è¯¢æ£éªé¡¹ç®çæ°æ® |
| | | LambdaUpdateWrapper<InspectionProduct> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(InspectionProduct::getInspectionMaterialId, inspectionProduct.getInspectionMaterialId()) |
| | | .eq(InspectionProduct::getName, inspectionProduct.getName()); |
| | | inspectionProductMapper.update(inspectionProduct, updateWrapper); |
| | | return true; |
| | | }*/ |
| | | |
| | | /*å¤ææ£æµå¼æ¯å¦æ»¡è¶³æ åå¼åå
æ§å¼çè¦æ±,妿䏿»¡è¶³åæ£éªç»è®ºä¸ºä¸åæ ¼*/ |
| | | private int checkValues(String standardValueStr, String controlValueStr, String detectionValueStr) { |
| | | boolean isStandardValueSatisfied = isValueSatisfied(standardValueStr, detectionValueStr); |
| | | boolean isControlValueSatisfied = isValueSatisfied(controlValueStr, detectionValueStr); |
| | | |
| | | if (isStandardValueSatisfied && isControlValueSatisfied) { |
| | | return 1; |
| | | } else { |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | private boolean isValueSatisfied(String valueStr, String detectionValueStr) { |
| | | String substring = valueStr.substring(1, 2); |
| | | if (substring.equals("=")) { |
| | | String operator = valueStr.substring(0, 2); |
| | | Double standardValue = Double.parseDouble(valueStr.substring(2)); |
| | | Double detectionValue = Double.parseDouble(detectionValueStr); |
| | | switch (operator) { |
| | | case ">=": |
| | | return detectionValue >= standardValue; |
| | | case "<=": |
| | | return detectionValue <= standardValue; |
| | | default: |
| | | return false; |
| | | } |
| | | } else { |
| | | String operator = valueStr.substring(0, 1); |
| | | Double standardValue = Double.parseDouble(valueStr.substring(1)); |
| | | Double detectionValue = Double.parseDouble(detectionValueStr); |
| | | switch (operator) { |
| | | case ">": |
| | | return detectionValue > standardValue; |
| | | case "â¥": |
| | | return detectionValue >= standardValue; |
| | | case "â¤": |
| | | return detectionValue <= standardValue; |
| | | case "<": |
| | | return detectionValue < standardValue; |
| | | case "=": |
| | | return detectionValue.equals(standardValue); |
| | | default: |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | import com.yuanchu.limslaboratory.pojo.vo.InspectDetailVo; |
| | | import com.yuanchu.limslaboratory.pojo.vo.InspectionVo; |
| | | import com.yuanchu.limslaboratory.service.*; |
| | | import com.yuanchu.limslaboratory.utils.MyUtil; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | @Resource |
| | | UserMapper userMapper; |
| | | |
| | | @Resource |
| | | ReportMapper reportMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢æ£éªç³è¯·åå表 |
| | |
| | | return inspectDetailVo; |
| | | } |
| | | |
| | | //æ´æ°æ£éªåæ£éªç»æ |
| | | //ä½åºæ£éªå |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean updateInspectsById(Integer id) { |
| | | //æ´æ°æ£éªåéé¢çæ£éªç¶æåæ£éªç»è®º |
| | | InspectDetailVo inspectDetailVo = selectInspectsListById(id); |
| | | Inspection inspection = Inspection.builder() |
| | | .id(id) |
| | | .inspectionStatus(inspectDetailVo.getInspectionStatus()) |
| | | .build(); |
| | | public String delInspect(Integer id) { |
| | | /*ä½åºæ£éªå*/ |
| | | Inspection inspection = new Inspection(); |
| | | inspection.setId(id); |
| | | inspection.setState(0); |
| | | inspectionMapper.updateById(inspection); |
| | | //çææ¥åå |
| | | Report report = new Report(); |
| | | //çææ¥ååå· |
| | | String code = MyUtil.getTimeSixNumberCode("BG","BG"); |
| | | //è·åæ£éªç»è®º |
| | | String conclusion = ""; |
| | | Inspection inspection1 = inspectionMapper.selectById(id); |
| | | if (inspection1.getInspectionStatus().equals(1)) { |
| | | conclusion = "åæ ¼"; |
| | | }else { |
| | | conclusion = "ä¸åæ ¼"; |
| | | } |
| | | report.setCode(code); |
| | | report.setStatus(0); |
| | | report.setConclusion(conclusion); |
| | | report.setInspectionId(id); |
| | | reportMapper.insert(report); |
| | | |
| | | return true; |
| | | /*ä½åºæ£éªæ ·å*/ |
| | | InspectionMaterial inspectionMaterial = inspectionMaterialMapper.selectOne(Wrappers.<InspectionMaterial>query().eq("inspection_id", id)); |
| | | inspectionMaterial.setState(0); |
| | | inspectionMaterialMapper.updateById(inspectionMaterial); |
| | | /*ä½åºæ£éªé¡¹ç®*/ |
| | | inspectionProductMapper.updat(inspectionMaterial.getId()); |
| | | return "ä½åºæå!"; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | import com.yuanchu.limslaboratory.service.NonConformanceReviewService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | |
| | | package com.yuanchu.limslaboratory.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.yuanchu.limslaboratory.mapper.*; |
| | | import com.yuanchu.limslaboratory.pojo.InspectionProduct; |
| | | import com.yuanchu.limslaboratory.pojo.Instrument; |
| | | import com.yuanchu.limslaboratory.pojo.User; |
| | | import com.yuanchu.limslaboratory.service.InstrumentService; |
| | | import com.yuanchu.limslaboratory.pojo.*; |
| | | import com.yuanchu.limslaboratory.service.PlanService; |
| | | import com.yuanchu.limslaboratory.utils.MyUtil; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | |
| | | @Resource |
| | | InstrumentMapper instrumentMapper; |
| | | |
| | | @Resource |
| | | ReportMapper reportMapper; |
| | | |
| | | @Resource |
| | | InspectionMapper inspectionMapper; |
| | | |
| | | //æ¥è¯¢æ£éªè®¡å |
| | | @Override |
| | | public List<Map<String,Object>> selectAllPlan(String code , String beginTime, String endTime,Integer status) { |
| | | return planMapper.selectAllPlan(code,beginTime,endTime,status); |
| | | public List<Map<String, Object>> selectAllPlan(String code, String beginTime, String endTime, Integer status) { |
| | | return planMapper.selectAllPlan(code, beginTime, endTime, status); |
| | | } |
| | | |
| | | //åé
-->éæ©æ£éªäºº |
| | |
| | | //åé
-->éæ©è®¾å¤ |
| | | @Override |
| | | public List<Map<String, Object>> chooseinstum() { |
| | | return null; |
| | | return instrumentMapper.chooseinstum(); |
| | | } |
| | | |
| | | //åé
人åä¸è®¾å¤ |
| | |
| | | inspectionProductMapper.updateById(inspectionProduct); |
| | | return "åé
宿!"; |
| | | } |
| | | |
| | | //æ£éª |
| | | @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); |
| | | } |
| | | return "æäº¤æå!"; |
| | | } |
| | | |
| | | //䏿¥ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public String reported(Integer id) { |
| | | /*æ´æ°æ£éªåéé¢çæ£éªç»è®º*/ |
| | | //å
夿æ£éªç»æ |
| | | List<Integer> results = inspectionProductMapper.getresult(id); |
| | | int count = 0; |
| | | for (Integer result : results) { |
| | | if (result != null && result==1) { |
| | | count++; |
| | | } |
| | | } |
| | | //妿æ£éªé¡¹ç®ä¸çç»è®ºå
å«ä¸åæ ¼åæ£éªåä¸åæ ¼ |
| | | if (results.contains(0)) { |
| | | Inspection inspection = new Inspection(); |
| | | inspection.setId(id); |
| | | inspection.setInspectionStatus(0); |
| | | inspectionMapper.updateById(inspection); |
| | | } else if (count == results.size()) { |
| | | Inspection inspection = new Inspection(); |
| | | inspection.setId(id); |
| | | inspection.setInspectionStatus(1); |
| | | inspectionMapper.updateById(inspection); |
| | | } else return "é¡¹ç®æªæ£éªå®!"; |
| | | //çææ¥åå |
| | | Report report = new Report(); |
| | | //çææ¥ååå· |
| | | String recode = MyUtil.getTimeSixNumberCode("BG", "BG"); |
| | | //è·åæ£éªç»è®º |
| | | String conclusion = ""; |
| | | Inspection inspection = inspectionMapper.selectById(id); |
| | | if (inspection.getInspectionStatus().equals(1)) { |
| | | conclusion = "åæ ¼"; |
| | | } else { |
| | | conclusion = "ä¸åæ ¼"; |
| | | } |
| | | report.setCode(recode); |
| | | report.setStatus(0); |
| | | report.setConclusion(conclusion); |
| | | report.setInspectionId(id); |
| | | reportMapper.insert(report); |
| | | return "䏿¥æå!"; |
| | | } |
| | | |
| | | |
| | | /*å¤ææ£æµå¼æ¯å¦æ»¡è¶³æ åå¼åå
æ§å¼çè¦æ±,妿䏿»¡è¶³åæ£éªç»è®ºä¸ºä¸åæ ¼*/ |
| | | private int checkValues(String standardValueStr, String controlValueStr, String detectionValueStr) { |
| | | boolean isStandardValueSatisfied = isValueSatisfied(standardValueStr, detectionValueStr); |
| | | boolean isControlValueSatisfied = isValueSatisfied(controlValueStr, detectionValueStr); |
| | | |
| | | if (isStandardValueSatisfied && isControlValueSatisfied) { |
| | | return 1; |
| | | } else { |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | private boolean isValueSatisfied(String valueStr, String detectionValueStr) { |
| | | String substring = valueStr.substring(1, 2); |
| | | if (substring.equals("=")) { |
| | | String operator = valueStr.substring(0, 2); |
| | | Double standardValue = Double.parseDouble(valueStr.substring(2)); |
| | | Double detectionValue = Double.parseDouble(detectionValueStr); |
| | | switch (operator) { |
| | | case ">=": |
| | | return detectionValue >= standardValue; |
| | | case "<=": |
| | | return detectionValue <= standardValue; |
| | | default: |
| | | return false; |
| | | } |
| | | } else { |
| | | String operator = valueStr.substring(0, 1); |
| | | Double standardValue = Double.parseDouble(valueStr.substring(1)); |
| | | Double detectionValue = Double.parseDouble(detectionValueStr); |
| | | switch (operator) { |
| | | case ">": |
| | | return detectionValue > standardValue; |
| | | case "â¥": |
| | | return detectionValue >= standardValue; |
| | | case "â¤": |
| | | return detectionValue <= standardValue; |
| | | case "<": |
| | | return detectionValue < standardValue; |
| | | case "=": |
| | | return detectionValue.equals(standardValue); |
| | | default: |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.yuanchu.limslaboratory.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.pojo.Instrument; |
| | | import com.yuanchu.limslaboratory.pojo.RawMaterial; |
| | | import com.yuanchu.limslaboratory.mapper.RawMaterialMapper; |
| | | import com.yuanchu.limslaboratory.pojo.vo.InspectionVo; |
| | | import com.yuanchu.limslaboratory.service.RawMaterialService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * |
| | | * @param materialCoding |
| | | * @param materialName |
| | | * @param condition |
| | |
| | | import com.yuanchu.limslaboratory.pojo.Report; |
| | | import com.yuanchu.limslaboratory.pojo.vo.ReportVo; |
| | | import com.yuanchu.limslaboratory.service.ReportService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | return reportMapper.selectAllReport(page, status, name); |
| | | } |
| | | |
| | | //æäº¤ |
| | | @Override |
| | | public String submit(Integer id) { |
| | | Report report = new Report(); |
| | | report.setId(id); |
| | | report.setStatus(1); |
| | | reportMapper.updateById(report); |
| | | return "æäº¤æå!"; |
| | | } |
| | | |
| | | //å®¡æ ¸ |
| | | @Override |
| | | public String check(String name, Integer id, String result) { |
| | | Report report = new Report(); |
| | | report.setId(id); |
| | | report.setApprover(name); |
| | | report.setCheckTime(new Date()); |
| | | if (result.equals("éè¿")){ |
| | | report.setStatus(2); |
| | | }else if (result.equals("ä¸éè¿")){ |
| | | report.setStatus(3); |
| | | } |
| | | reportMapper.updateById(report); |
| | | return "å®¡æ ¸æå!"; |
| | | } |
| | | |
| | | @Override |
| | | public String delreport(Integer id) { |
| | | Report report = new Report(); |
| | | report.setId(id); |
| | | report.setState(0); |
| | | reportMapper.updateById(report); |
| | | return "å 餿å!"; |
| | | } |
| | | |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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"> |
| | | select test_state |
| | | from lims_laboratory.inspection_product |
| | | where state = 1 |
| | | and inspection_material_id = (select id from lims_laboratory.inspection_material where inspection_id = #{id}) |
| | | </select> |
| | | <!--æ ¹æ®æ£éªæ ·åidä½åºæ£éªé¡¹ç®--> |
| | | <update id="updat"> |
| | | update lims_laboratory.inspection_product |
| | | set state=0 |
| | | where inspection_material_id=#{id} |
| | | </update> |
| | | </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.yuanchu.limslaboratory.mapper.PlanMapper"> |
| | | <resultMap id="selectAllPlanMap" type="map" > |
| | | <resultMap id="selectAllPlanMap" type="map"> |
| | | <id property="code" column="code"/> |
| | | <result property="id" column="id"/> |
| | | <result property="inspectionStatus" column="inspectionStatus"/> |
| | | <result property="startTime" column="startTime"/> |
| | | <result property="endTime" column="endTime"/> |
| | |
| | | <collection property="chldren" resultMap="selectAllPlanMapTowsMap" javaType="List"/> |
| | | </resultMap> |
| | | <resultMap id="selectAllPlanMapTowsMap" type="map"> |
| | | <id property="id" column="id"/> |
| | | <id property="pid" column="pid"/> |
| | | <result property="name" column="name"/> |
| | | <result property="unit" column="unit"/> |
| | | <result property="required" column="required"/> |
| | |
| | | </resultMap> |
| | | <!--æ¥è¯¢æ£éªè®¡å--> |
| | | <select id="selectAllPlan" resultMap="selectAllPlanMap"> |
| | | select ip.id, |
| | | select i.id , |
| | | i.code, |
| | | inspection_status inspectionStatus, |
| | | DATE_FORMAT(start_time,'%Y-%m-%d') startTime, |
| | | DATE_FORMAT(end_time,'%Y-%m-%d') endTime, |
| | | im.name samplename, |
| | | ip.id pid, |
| | | ip.name, |
| | | ip.unit, |
| | | required, |
| | |
| | | left join lims_laboratory.inspection_material im on ip.inspection_material_id = im.id |
| | | left join lims_laboratory.inspection i on im.inspection_id = i.id |
| | | left join lims_laboratory.user u on ip.user_id = u.id |
| | | left join lims_laboratory.instrument isu on ip.instrument_id = isu.id |
| | | left join lims_laboratory.instrument isu on ip.instrument_id = isu.id |
| | | <where> |
| | | <if test="code != null and code != null"> |
| | | and i.code like concat('%',#{code},'%') |
| | |
| | | |
| | | <!--æ¥è¯¢æ£éªæ¥å--> |
| | | <select id="selectAllReport" resultType="com.yuanchu.limslaboratory.pojo.vo.ReportVo"> |
| | | select im.code materialCode, |
| | | select r.id, |
| | | im.code materialCode, |
| | | r.code reportCode, |
| | | i.code inspectionCode, |
| | | r.approver approver, |
| | | r.status status, |
| | | r.conclusion conclusion, |
| | | u.name name |
| | | from report r |
| | | join inspection i on r.inspection_id = i.id |
| | | join user u on i.user_id = u.id |
| | | join inspection_material im on i.id = im.inspection_id |
| | | im.name materialName, |
| | | r.conclusion , |
| | | r.status , |
| | | r.approver , |
| | | check_time, |
| | | u.name |
| | | from lims_laboratory.report r |
| | | join lims_laboratory.inspection i on r.inspection_id = i.id |
| | | join lims_laboratory.user u on i.user_id = u.id |
| | | join lims_laboratory.inspection_material im on i.id = im.inspection_id |
| | | <where> |
| | | r.state = 1 |
| | | <if test="status != null"> |
| | |
| | | or r.code like concat('%', #{name}, '%') |
| | | </if> |
| | | </where> |
| | | order by r.id |
| | | </select> |
| | | |
| | | <!--æ¥è¯¢æ¥åå®¡æ ¸--> |
| | | <select id="selectAllReportAuditing" resultType="com.yuanchu.limslaboratory.pojo.vo.ReportAuditingVo"> |
| | | select im.code materialCode, |
| | | r.code reportCode, |
| | | im.name materialName, |
| | | r.status status, |
| | | r.approver approver, |
| | | DATE_FORMAT(r.`create_time`, '%Y-%m-%d') submitTime, |
| | | DATE_FORMAT(r.`check_time`, '%Y-%m-%d') checkTime |
| | | from report r |
| | | join inspection i on r.inspection_id = i.id |
| | | join inspection_material im on i.id = im.inspection_id |
| | | <where> |
| | | r.state = 1 |
| | | <if test="status == null"> |
| | | and r.status in (0, 1) |
| | | </if> |
| | | <if test="status != null"> |
| | | and r.status = #{status} |
| | | </if> |
| | | <if test="name != null and name != ''"> |
| | | and im.code like concat('%', #{name}, '%') |
| | | or i.code like concat('%', #{name}, '%') |
| | | or im.name like concat('%', #{name}, '%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | IPage<Map<String, Object>> getListInstrumentInformation(Integer conditions,Boolean whetherWhether, String numberOrNameOrSpecifications, Integer classifyId, Page<Objects> page); |
| | | |
| | | |
| | | |
| | | //åé
-->éæ©è®¾å¤ |
| | | List<Map<String, Object>> chooseinstum(); |
| | | } |
| | |
| | | <?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.InstrumentMapper"> |
| | | |
| | | <select id="getListInstrumentInformation" resultType="map"> |
| | | SELECT i.`id`, i.`equipment_code`, i.`equipment_name`, i.`specifications_models`, u.`name`, |
| | | DATE_FORMAT(DATE_ADD(i.`create_time`, INTERVAL i.`term_validity` MONTH), '%Y-%m-%d') termValidity, i.`conditions`, i.`storage_place` |
| | | DATE_FORMAT(DATE_ADD(i.`create_time`, INTERVAL i.`term_validity` MONTH), '%Y-%m-%d') termValidity, |
| | | i.`conditions`, i.`storage_place` |
| | | FROM instrument i, `user` u |
| | | WHERE i.`state` = 1 |
| | | AND i.`classify_id` = #{classifyId} |
| | | AND i.`classify_id` = #{classifyId} |
| | | <if test="conditions != null"> |
| | | AND i.`conditions` = #{conditions} |
| | | </if> |
| | | <if test="numberOrNameOrSpecifications != null and numberOrNameOrSpecifications != ''"> |
| | | AND CONCAT(i.`equipment_code`, i.`equipment_name`, i.`specifications_models`) LIKE CONCAT('%',#{numberOrNameOrSpecifications},'%') |
| | | AND CONCAT(i.`equipment_code`, i.`equipment_name`, i.`specifications_models`) LIKE |
| | | CONCAT('%',#{numberOrNameOrSpecifications},'%') |
| | | </if> |
| | | <if test="whetherWhether == true"> |
| | | AND DATE_FORMAT(DATE_ADD(i.`create_time`, INTERVAL i.`term_validity` MONTH), '%Y-%m-%d') <![CDATA[<]]> NOW() |
| | |
| | | AND i.`user_id` = u.`id` |
| | | </select> |
| | | |
| | | <!--éæ©è®¾å¤--> |
| | | <resultMap id="chooseinstumMap" type="map"> |
| | | <id property="father_name" column="father_name"/> |
| | | <collection property="father" resultMap="chooseinstumTowMap" javaType="List"/> |
| | | </resultMap> |
| | | <resultMap id="chooseinstumTowMap" type="map"> |
| | | <id property="son_name" column="son_name"/> |
| | | <collection property="chldren" 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, |
| | | equipment_name name |
| | | from lims_laboratory.instrument |
| | | left join lims_laboratory.classify c on c.id = instrument.classify_id |
| | | </select> |
| | | </mapper> |