| | |
| | | public ApplicationException() { |
| | | } |
| | | |
| | | public ApplicationException(String msg) { |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public String getCode() { |
| | | return code; |
| | | } |
| | |
| | | package com.yuanchu.limslaboratory.handler; |
| | | |
| | | import com.yuanchu.limslaboratory.exception.ApplicationException; |
| | | import com.yuanchu.limslaboratory.exception.AuthException; |
| | | import com.yuanchu.limslaboratory.exception.MyFileException; |
| | | import com.yuanchu.limslaboratory.utils.MyUtil; |
| | |
| | | return Result.fail(Integer.valueOf(e.getCode()),e.getMsg()); |
| | | } |
| | | |
| | | /** |
| | | * ä¸å¡å¼å¸¸ |
| | | * @param e |
| | | * @return |
| | | */ |
| | | @ExceptionHandler({ApplicationException.class }) |
| | | public Result<?> applicationError(ApplicationException e){ |
| | | return Result.fail(e.getMsg()); |
| | | } |
| | | |
| | | } |
| | |
| | | @AuthHandler(type = InterfaceType.SELECT,menuId = MenuEnums.reportForInspection,isAdd = true) |
| | | public Result<?> getMaterielName(){ |
| | | LambdaQueryWrapper<Material> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.select(Material::getId, Material::getName, Material::getCode); |
| | | wrapper.select(Material::getId, Material::getName, Material::getCode) |
| | | .eq(Material::getType,0).eq(Material::getState,1); |
| | | List<Map<String, Object>> maps = materialService.listMaps(wrapper); |
| | | return Result.success(maps); |
| | | } |
| | |
| | | |
| | | //æ¥è¯¢è¯¥æçæååæ ¼ç |
| | | Long getOkFinByMonth(String monthofYear); |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | import com.yuanchu.limslaboratory.pojo.vo.InspectDetailVo; |
| | | import com.yuanchu.limslaboratory.pojo.vo.InspectionVo; |
| | | import com.yuanchu.limslaboratory.service.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | * @since 2023-08-03 13:03:36 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class InspectionServiceImpl extends ServiceImpl<InspectionMapper, Inspection> implements InspectionService { |
| | | |
| | | @Resource |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Integer addInspect(Integer id, InspectionVo inspectionVo) throws ApplicationException { |
| | | log.info(inspectionVo.toString()); |
| | | /*æ°å¢æ£éªç³è¯·è¡¨*/ |
| | | Inspection inspection = Inspection.builder() |
| | | .startTime(inspectionVo.getStartTime()) |
| | |
| | | String required = Optional.ofNullable(p) |
| | | .map(Product::getRequired).orElse("空"); |
| | | if(Objects.equals("空",internal)||Objects.equals(required,"空")) { |
| | | throw new ApplicationException("500","项ç®çæ¬ä¸å¯ç¨"); |
| | | throw new ApplicationException("项ç®çæ¬ä¸å¯ç¨"); |
| | | } |
| | | }); |
| | | //å°æ¥è¯¢ç项ç®ä¿¡æ¯æå»ºææ£éªé¡¹ç® |
| | |
| | | package com.yuanchu.limslaboratory.service.impl; |
| | | |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | |
| | | @Resource |
| | | LinkDetectionMapper linkDetectionMapper; |
| | | |
| | | @Resource |
| | | private NonConformanceReviewMapper nonConformanceReviewMapper; |
| | | |
| | | //æ¥è¯¢æ£éªè®¡å |
| | | @Override |
| | |
| | | inspection.setInspectionStatus(0); |
| | | //æ´æ°æ£éªå |
| | | inspectionMapper.updateById(inspection); |
| | | //æ·»å ä¸åæ ¼ä¿¡æ¯å°è¯å®¡ |
| | | inspectionMapper |
| | | NonConformanceReview nonConformanceReview = new NonConformanceReview(); |
| | | LocalDateTime localDateTime = DateUtil.toLocalDateTime(DateUtil.date()); |
| | | nonConformanceReview.setCreatedTime(localDateTime); |
| | | nonConformanceReview.setUpdatedTime(localDateTime); |
| | | nonConformanceReview.set |
| | | } else if (count == results.size()) { |
| | | Inspection inspection = new Inspection(); |
| | | inspection.setId(id); |
| | |
| | | d.`specifications_models` specifications, |
| | | d.`unit`, |
| | | d.`samples_number` num, |
| | | d.specifications_models specificationsId, |
| | | experiment, |
| | | DATE_FORMAT(date_survey, '%Y-%m-%d') startTime, |
| | | DATE_FORMAT(completion_deadline, '%Y-%m-%d') endTime |
| | |
| | | material_coding mcode, |
| | | material_name name, |
| | | specifications_models specifications, |
| | | specifications_id specificationsId, |
| | | unit, |
| | | quantity num, |
| | | surveyor, |
| | |
| | | package com.yuanchu.limslaboratory.controller; |
| | | |
| | | |
| | | import cn.hutool.core.date.DateUnit; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.annotation.AuthHandler; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @ApiOperation("æ·»å 设å¤ç ç¹") |
| | | @PostMapping("/add") |
| | | @AuthHandler |
| | | public Result<?> addEquipmentPointInformation(@RequestHeader("X-Token") String token, @RequestBody EquipmentPoint equipmentPoint) throws Exception { |
| | | public Result<?> addEquipmentPointInformation(@RequestHeader("X-Token") String token, @RequestBody List<EquipmentPoint> equipmentPoints) throws Exception { |
| | | Object object = RedisUtil.get(token); |
| | | Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class); |
| | | equipmentPoint.setUserId((Integer) unmarshal.get("id")); |
| | | Integer isInsertSuccess = equipmentPointService.addEquipmentPointInformation(equipmentPoint); |
| | | if (isInsertSuccess == 1){ |
| | | return Result.success("æ·»å ã"+ equipmentPoint.getEquipmentPointName() +"ãæåï¼"); |
| | | equipmentPoints.forEach(e->{ |
| | | e.setUserId((Integer) unmarshal.get("id")); |
| | | e.setCreateTime(new Date()); |
| | | e.setUpdateTime(new Date()); |
| | | }); |
| | | if(equipmentPointService.addEquipmentPointInformation(equipmentPoints)>0){ |
| | | return Result.success("æ·»å æå"); |
| | | } |
| | | return Result.fail("æ·»å ã"+ equipmentPoint.getEquipmentPointName() +"ã失败ï¼è®¾å¤ç ç¹ç¼ç éå¤ï¼"); |
| | | return Result.fail("æ·»å 失败"); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®ä»ªå¨Idæ¥è¯¢å¯¹åºè®¾å¤ç ç¹æ°æ®") |
| | |
| | | @AuthHandler |
| | | public Result<?> getListEquipmentPointInformation(String InstrumentId) { |
| | | List<Map<String, Object>> list = equipmentPointService.getListEquipmentPointInformation(InstrumentId); |
| | | list.forEach(l->{ |
| | | l.put("instrumentId",null); |
| | | }); |
| | | return Result.success(list); |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.pojo.EquipmentPoint; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | public interface EquipmentPointMapper extends BaseMapper<EquipmentPoint> { |
| | | |
| | | List<Map<String, Object>> getListEquipmentPointInformation(String InstrumentId); |
| | | |
| | | int insertBatch(@Param("lists") List<EquipmentPoint> lists); |
| | | } |
| | |
| | | */ |
| | | public interface EquipmentPointService extends IService<EquipmentPoint> { |
| | | |
| | | Integer addEquipmentPointInformation(EquipmentPoint equipmentPoint); |
| | | Integer addEquipmentPointInformation(List<EquipmentPoint> equipmentPoint); |
| | | |
| | | List<Map<String, Object>> getListEquipmentPointInformation(String InstrumentId); |
| | | |
| | |
| | | private EquipmentPointMapper equipmentPointMapper; |
| | | |
| | | @Override |
| | | public Integer addEquipmentPointInformation(EquipmentPoint equipmentPoint) { |
| | | LambdaQueryWrapper<EquipmentPoint> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(EquipmentPoint::getEquipmentPoint, equipmentPoint.getEquipmentPoint()); |
| | | wrapper.eq(EquipmentPoint::getState, 1); |
| | | wrapper.eq(EquipmentPoint::getInstrumentId, equipmentPoint.getInstrumentId()); |
| | | wrapper.select(EquipmentPoint::getEquipmentPoint); |
| | | EquipmentPoint equipmentPoint1 = equipmentPointMapper.selectOne(wrapper); |
| | | if (ObjectUtils.isEmpty(equipmentPoint1)){ |
| | | return equipmentPointMapper.insert(equipmentPoint); |
| | | } |
| | | return 0; |
| | | public Integer addEquipmentPointInformation(List<EquipmentPoint> equipmentPoint) { |
| | | return equipmentPointMapper.insertBatch(equipmentPoint); |
| | | } |
| | | |
| | | @Override |
| | |
| | | <?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.EquipmentPointMapper"> |
| | | <insert id="insertBatch"> |
| | | insert |
| | | equipment_point (instrument_id,user_id,equipment_point,equipment_point_name,unit,descriptiveness,create_time,update_time,state) |
| | | values |
| | | <foreach collection="lists" item="l" separator=","> |
| | | (#{l.instrumentId},#{l.userId},#{l.equipmentPoint},#{l.equipmentPointName},#{l.unit},#{l.descriptiveness},#{l.createTime},#{l.updateTime},1) |
| | | </foreach> |
| | | </insert> |
| | | |
| | | <select id="getListEquipmentPointInformation" resultType="map"> |
| | | SELECT e.`id`, e.`equipment_point` equipmentPoint, e.`equipment_point_name` equipmentPointName, e.`unit`,u.`name`, DATE_FORMAT(e.`update_time`, '%Y-%m-%d') updateTime, e.`descriptiveness` |
| | | FROM equipment_point e, `user` u |
| | | SELECT e.`id`, |
| | | e.`equipment_point` equipmentPoint, |
| | | e.`equipment_point_name` equipmentPointName, |
| | | e.`unit`, |
| | | u.`name`, |
| | | DATE_FORMAT(e.`update_time`, '%Y-%m-%d') updateTime, |
| | | e.`descriptiveness` |
| | | FROM equipment_point e, |
| | | `user` u |
| | | WHERE e.`user_id` = u.`id` |
| | | AND e.`instrument_id` = #{InstrumentId} |
| | | AND e.`instrument_id` = #{InstrumentId} |
| | | </select> |
| | | </mapper> |
| | |
| | | package com.yuanchu.limslaboratory.controller; |
| | | |
| | | import com.yuanchu.limslaboratory.annotation.AuthHandler; |
| | | import com.yuanchu.limslaboratory.enums.InterfaceType; |
| | | import com.yuanchu.limslaboratory.enums.MenuEnums; |
| | | import com.yuanchu.limslaboratory.pojo.Product; |
| | | import com.yuanchu.limslaboratory.pojo.dto.StandardProductAddDto; |
| | | import com.yuanchu.limslaboratory.service.ProductService; |
| | | import com.yuanchu.limslaboratory.utils.MyUtil; |
| | | import com.yuanchu.limslaboratory.vo.Result; |
| | |
| | | Integer version1 = productService.addVersion(specificationsId,version); |
| | | return Result.success("æ·»å çæ¬"+version1+"æå"); |
| | | } |
| | | |
| | | @ApiOperation("æ æ³¨åº-ãæ·»å 项ç®") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "specificationId", value = "åå·id", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "version", value = "å½åçæ¬", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "name", value = "项ç®å", dataTypeClass = String.class, required = true), |
| | | @ApiImplicitParam(name = "father", value = "项ç®åç»", dataTypeClass = String.class, required = true), |
| | | @ApiImplicitParam(name = "unit", value = "åä½", dataTypeClass = String.class, required = true), |
| | | }) |
| | | @PostMapping("/addProduct") |
| | | @AuthHandler(type = InterfaceType.ADD,menuId = MenuEnums.index,isAdd = true) |
| | | public Result<?> addProduct(@RequestBody StandardProductAddDto dto){ |
| | | return Result.success(productService.addProduct(dto)); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.limslaboratory.pojo.Product; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.yuanchu.limslaboratory.pojo.dto.StandardProductAddDto; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | //æ ¹æ®é¡¹ç®ç¶ç±»ä¸ºç©º,项ç®å,åå·id,çæ¬æ¥è¯¢ |
| | | Map<String, Object> selNam(Integer specificationId, String exper, Integer version); |
| | | |
| | | int addProduct(Product product); |
| | | } |
| | |
| | | this.version = version; |
| | | this.specifications_id = specifications_id; |
| | | } |
| | | |
| | | public Product(String name, String father, String unit, Date createTime, Date updateTime, Integer version, Integer specifications_id) { |
| | | this.name = name; |
| | | this.father = father; |
| | | this.unit = unit; |
| | | this.createTime = createTime; |
| | | this.updateTime = updateTime; |
| | | this.version = version; |
| | | this.specifications_id = specifications_id; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.yuanchu.limslaboratory.pojo.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @Author å¼ å®¾ |
| | | * @Date 2023/9/6 |
| | | */ |
| | | @Data |
| | | public class StandardProductAddDto implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "项ç®åç»", example = "1", hidden = true) |
| | | private String father; |
| | | |
| | | @ApiModelProperty(value = "项ç®å", example = "1", hidden = true) |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "çæ¬", example = "1", hidden = true) |
| | | private String version; |
| | | |
| | | /** |
| | | * åä½ |
| | | **/ |
| | | @ApiModelProperty(value = "åä½", example = "1", hidden = true) |
| | | private String unit; |
| | | |
| | | @ApiModelProperty(value = "å
³è åå·id", example = "1", hidden = true) |
| | | private Integer specificationId; |
| | | |
| | | } |
| | |
| | | |
| | | import com.yuanchu.limslaboratory.pojo.Product; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.yuanchu.limslaboratory.pojo.dto.StandardProductAddDto; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | * @return |
| | | */ |
| | | List<Map<String,Object>> chooseProject(Integer modelId); |
| | | |
| | | String addProduct(StandardProductAddDto dto); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.yuanchu.limslaboratory.pojo.Product; |
| | | import com.yuanchu.limslaboratory.mapper.ProductMapper; |
| | | import com.yuanchu.limslaboratory.pojo.dto.StandardProductAddDto; |
| | | import com.yuanchu.limslaboratory.service.ProductService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.limslaboratory.utils.MyUtil; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | return productMapper.chooseProject(modelId); |
| | | } |
| | | |
| | | @Override |
| | | public String addProduct(StandardProductAddDto dto) { |
| | | int i = productMapper.addProduct(new Product( |
| | | dto.getName(), dto.getFather(), |
| | | dto.getUnit(), new Date(), new Date(), |
| | | Integer.parseInt(dto.getVersion()), dto.getSpecificationId())); |
| | | if(i>0) return "æ·»å æåï¼"; |
| | | 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.ProductMapper"> |
| | | <insert id="addProduct"> |
| | | insert |
| | | product (name,father,unit,state,create_time,update_time,version,specifications_id) |
| | | value (#{name},#{father},#{unit},1,#{createTime},#{updateTime},#{version},#{specifications_id}) |
| | | </insert> |
| | | <select id="selectProductByMaterialId" resultType="Map"> |
| | | select p.name, unit, required, internal |
| | | from lims_laboratory.product p, |
| | |
| | | # url: jdbc:mysql://192.168.110.209:3306/lims_laboratory?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 |
| | | # username: user |
| | | # password: 123456 |
| | | url: jdbc:mysql://192.168.65.113:3306/lims_laboratory?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 |
| | | url: jdbc:mysql://192.168.218.113:3306/lims_laboratory?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 |
| | | username: user |
| | | password: 123456 |
| | | druid: |
| | |
| | | database: 0 |
| | | # redisæå¡å¨å°åï¼é»è®¤ä¸ºlocalhostï¼ |
| | | # host: 192.168.110.209 |
| | | host: 192.168.65.113 |
| | | host: 192.168.218.113 |
| | | # redis端å£ï¼é»è®¤ä¸º6379ï¼ |
| | | port: 6379 |
| | | # redis访é®å¯ç ï¼é»è®¤ä¸ºç©ºï¼ |