Compare commits
	
		
			35 Commits
		
	
	
		
			1173d670e4
			...
			yanyang
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 32647c035c | |||
| 9546ceec03 | |||
| 3a583ac09f | |||
| 
						 | 
					e149150b1d | ||
| 
						 | 
					3d5e5e5845 | ||
| 
						 | 
					5a9f5ee38b | ||
| 
						 | 
					7c21dfe8e1 | ||
| 
						 | 
					2bc72469a0 | ||
| 
						 | 
					cafcdd65e0 | ||
| cc5848e5cd | |||
| 445c7c0c3f | |||
| 214f0a8ec9 | |||
| 
						 | 
					74aaf857f0 | ||
| 
						 | 
					353471b1f7 | ||
| 
						 | 
					23aa6d5f89 | ||
| ea70ac4a6b | |||
| b6990dc4a0 | |||
| 
						 | 
					8b14c369fb | ||
| 
						 | 
					c1d37a3dbc | ||
| 5e32971f26 | |||
| 1ce177ab5d | |||
| 8b4e6b116e | |||
| 
						 | 
					9b545a9a03 | ||
| 
						 | 
					c75c89cab9 | ||
| 04e8cc187a | |||
| add0eea2ac | |||
| 
						 | 
					69f911c07c | ||
| 
						 | 
					5e8110ad2c | ||
| 
						 | 
					7e3e028eb0 | ||
| 37f0dbe548 | |||
| b501e8cd98 | |||
| 98baf93cff | |||
| 
						 | 
					ff63c194ee | ||
| 
						 | 
					1798ba8d1d | ||
| 
						 | 
					652812d3ba | 
@@ -2,9 +2,7 @@ package com.cnbm.basic.controller;
 | 
			
		||||
 | 
			
		||||
import com.cnbm.admin.annotation.LogOperation;
 | 
			
		||||
import com.cnbm.admin.params.IdParam;
 | 
			
		||||
import com.cnbm.basic.dto.FeaturesProcedureDTO;
 | 
			
		||||
import com.cnbm.basic.dto.FeaturesStageProcedureRelationDTO;
 | 
			
		||||
import com.cnbm.basic.dto.WorkingProcedureDTO;
 | 
			
		||||
import com.cnbm.basic.dto.*;
 | 
			
		||||
import com.cnbm.basic.entity.ProductFeatures;
 | 
			
		||||
import com.cnbm.common.constant.Constant;
 | 
			
		||||
import com.cnbm.common.page.PageData;
 | 
			
		||||
@@ -15,7 +13,6 @@ import com.cnbm.common.validator.ValidatorUtils;
 | 
			
		||||
import com.cnbm.common.validator.group.AddGroup;
 | 
			
		||||
import com.cnbm.common.validator.group.DefaultGroup;
 | 
			
		||||
import com.cnbm.common.validator.group.UpdateGroup;
 | 
			
		||||
import com.cnbm.basic.dto.ProductFeaturesDTO;
 | 
			
		||||
import com.cnbm.basic.excel.ProductFeaturesExcel;
 | 
			
		||||
import com.cnbm.basic.service.IProductFeaturesService;
 | 
			
		||||
import io.swagger.annotations.Api;
 | 
			
		||||
@@ -162,4 +159,17 @@ public class ProductFeaturesController {
 | 
			
		||||
        return new Result<List<ProductFeaturesDTO>>().ok(list);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "list")
 | 
			
		||||
    @ApiOperation(value = "获取特性列表")
 | 
			
		||||
    @LogOperation("获取特性列表")
 | 
			
		||||
    public List<ProductFeaturesDTO> list() {
 | 
			
		||||
        return productFeaturesService.list();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping("getProductFeaturesByType")
 | 
			
		||||
    @ApiOperation("根据特性类型 获取特性列表 计量型1 计数型2")
 | 
			
		||||
    public List<ProductFeaturesDTO> getProductFeaturesByType(Integer type){
 | 
			
		||||
        return productFeaturesService.getProductFeaturesByType(type);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -3,6 +3,8 @@ package com.cnbm.basic.controller;
 | 
			
		||||
import com.cnbm.admin.annotation.LogOperation;
 | 
			
		||||
import com.cnbm.admin.params.IdParam;
 | 
			
		||||
import com.cnbm.basic.dto.UnitDTO;
 | 
			
		||||
import com.cnbm.basic.dto.WorkingProcedureTypeDTO;
 | 
			
		||||
import com.cnbm.basic.entity.WorkingProcedure;
 | 
			
		||||
import com.cnbm.common.constant.Constant;
 | 
			
		||||
import com.cnbm.common.page.PageData;
 | 
			
		||||
import com.cnbm.common.utils.ExcelUtils;
 | 
			
		||||
@@ -141,4 +143,15 @@ public class WorkingProcedureController {
 | 
			
		||||
        return workingProcedureService.list();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "listByType/{typeId}")
 | 
			
		||||
    @ApiOperation(value = "根据工序类型 获取工序列表")
 | 
			
		||||
    public List<WorkingProcedure> listByType(@PathVariable("typeId") Long typeId) {
 | 
			
		||||
        return workingProcedureService.listByType(typeId);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "listWithType")
 | 
			
		||||
    @ApiOperation(value = "工序类型及对应工序列表")
 | 
			
		||||
    public List<WorkingProcedureTypeDTO> listWithType () {
 | 
			
		||||
        return workingProcedureService.listWithType();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -112,4 +112,10 @@ public class ProductFeaturesDTO implements Serializable {
 | 
			
		||||
	@ApiModelProperty(value = "版本号")
 | 
			
		||||
	private Integer version;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty(value = "工序id,关联 working_procedure 表")
 | 
			
		||||
	private Long workingProcedureId;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty(value = "工序 名,关联working_procedure表")
 | 
			
		||||
	private String workingProcedureName;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,11 +1,13 @@
 | 
			
		||||
package com.cnbm.basic.dto;
 | 
			
		||||
 | 
			
		||||
import com.cnbm.basic.entity.WorkingProcedure;
 | 
			
		||||
import io.swagger.annotations.ApiModel;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 工序类型表 表
 | 
			
		||||
@@ -59,4 +61,7 @@ public class WorkingProcedureTypeDTO implements Serializable {
 | 
			
		||||
	@ApiModelProperty(value = "版本号")
 | 
			
		||||
	private Integer version;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty(value = "工序列表")
 | 
			
		||||
	private List<WorkingProcedure> workingProcedureList;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -25,4 +25,8 @@ public interface ProductFeaturesMapper extends BaseDao<ProductFeatures> {
 | 
			
		||||
	List<ProductFeaturesDTO> getFeaturesList(Map<String, Object> params);
 | 
			
		||||
 | 
			
		||||
	String getControlGraphNameById(Long id);
 | 
			
		||||
 | 
			
		||||
	List<ProductFeaturesDTO> list();
 | 
			
		||||
 | 
			
		||||
	List<ProductFeaturesDTO> getProductFeaturesByType(Integer type);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,9 +1,13 @@
 | 
			
		||||
package com.cnbm.basic.mapper;
 | 
			
		||||
 | 
			
		||||
import com.cnbm.basic.dto.WorkingProcedureDTO;
 | 
			
		||||
import com.cnbm.basic.dto.WorkingProcedureTypeDTO;
 | 
			
		||||
import com.cnbm.common.dao.BaseDao;
 | 
			
		||||
import com.cnbm.basic.entity.WorkingProcedureType;
 | 
			
		||||
import org.apache.ibatis.annotations.Mapper;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 工序类型表 表
 | 
			
		||||
 *
 | 
			
		||||
@@ -12,5 +16,6 @@ import org.apache.ibatis.annotations.Mapper;
 | 
			
		||||
 */
 | 
			
		||||
@Mapper
 | 
			
		||||
public interface WorkingProcedureTypeMapper extends BaseDao<WorkingProcedureType> {
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
    List<WorkingProcedureTypeDTO> list();
 | 
			
		||||
}
 | 
			
		||||
@@ -1,5 +1,6 @@
 | 
			
		||||
package com.cnbm.basic.service;
 | 
			
		||||
 | 
			
		||||
import com.cnbm.basic.dto.FactoryDTO;
 | 
			
		||||
import com.cnbm.basic.dto.FeaturesProcedureDTO;
 | 
			
		||||
import com.cnbm.basic.dto.FeaturesStageProcedureRelationDTO;
 | 
			
		||||
import com.cnbm.common.page.PageData;
 | 
			
		||||
@@ -34,4 +35,8 @@ public interface IProductFeaturesService extends CrudService<ProductFeatures, Pr
 | 
			
		||||
    void batchUpdate(ProductFeaturesDTO[] lists);
 | 
			
		||||
 | 
			
		||||
    List<ProductFeaturesDTO> getFeaturesList(Map<String, Object> params);
 | 
			
		||||
 | 
			
		||||
    List<ProductFeaturesDTO> list();
 | 
			
		||||
 | 
			
		||||
    List<ProductFeaturesDTO> getProductFeaturesByType(Integer type);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,5 +1,6 @@
 | 
			
		||||
package com.cnbm.basic.service;
 | 
			
		||||
 | 
			
		||||
import com.cnbm.basic.dto.WorkingProcedureTypeDTO;
 | 
			
		||||
import com.cnbm.common.page.PageData;
 | 
			
		||||
import com.cnbm.common.service.CrudService;
 | 
			
		||||
import com.cnbm.basic.dto.WorkingProcedureDTO;
 | 
			
		||||
@@ -30,4 +31,8 @@ public interface IWorkingProcedureService extends CrudService<WorkingProcedure,
 | 
			
		||||
    List<WorkingProcedureDTO> getWorkingProcedureByProductId(Long productId);
 | 
			
		||||
 | 
			
		||||
    List<WorkingProcedureDTO> list();
 | 
			
		||||
 | 
			
		||||
    List<WorkingProcedure> listByType(Long typeId);
 | 
			
		||||
 | 
			
		||||
    List<WorkingProcedureTypeDTO> listWithType();
 | 
			
		||||
}
 | 
			
		||||
@@ -3,6 +3,7 @@ package com.cnbm.basic.service.impl;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
			
		||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 | 
			
		||||
import com.cnbm.admin.utils.BaseSupportUtils;
 | 
			
		||||
import com.cnbm.basic.dto.MachineDTO;
 | 
			
		||||
import com.cnbm.basic.dto.ProductTypeDTO;
 | 
			
		||||
import com.cnbm.basic.entity.ProductType;
 | 
			
		||||
@@ -67,6 +68,7 @@ public class FactoryServiceImpl extends CrudServiceImpl<FactoryMapper, Factory,
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void save(FactoryDTO dto) {
 | 
			
		||||
        Factory entity = ConvertUtils.sourceToTarget(dto, Factory.class);
 | 
			
		||||
        BaseSupportUtils.setCommonField(entity);
 | 
			
		||||
        insert(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -74,6 +76,7 @@ public class FactoryServiceImpl extends CrudServiceImpl<FactoryMapper, Factory,
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void update(FactoryDTO dto) {
 | 
			
		||||
        Factory entity = ConvertUtils.sourceToTarget(dto, Factory.class);
 | 
			
		||||
        BaseSupportUtils.setUpdateCommonField(entity);
 | 
			
		||||
        updateById(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,7 @@ package com.cnbm.basic.service.impl;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
			
		||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 | 
			
		||||
import com.cnbm.admin.utils.BaseSupportUtils;
 | 
			
		||||
import com.cnbm.basic.dto.ProductFeaturesDTO;
 | 
			
		||||
import com.cnbm.common.page.PageData;
 | 
			
		||||
import com.cnbm.common.service.impl.CrudServiceImpl;
 | 
			
		||||
@@ -64,6 +65,7 @@ public class FeaturesStageProcedureRelationServiceImpl extends CrudServiceImpl<F
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void save(FeaturesStageProcedureRelationDTO dto) {
 | 
			
		||||
        FeaturesStageProcedureRelation entity = ConvertUtils.sourceToTarget(dto, FeaturesStageProcedureRelation.class);
 | 
			
		||||
        BaseSupportUtils.setCommonField(entity);
 | 
			
		||||
        insert(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -71,6 +73,7 @@ public class FeaturesStageProcedureRelationServiceImpl extends CrudServiceImpl<F
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void update(FeaturesStageProcedureRelationDTO dto) {
 | 
			
		||||
        FeaturesStageProcedureRelation entity = ConvertUtils.sourceToTarget(dto, FeaturesStageProcedureRelation.class);
 | 
			
		||||
        BaseSupportUtils.setUpdateCommonField(entity);
 | 
			
		||||
        updateById(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -86,6 +89,7 @@ public class FeaturesStageProcedureRelationServiceImpl extends CrudServiceImpl<F
 | 
			
		||||
    public void batchInsert(FeaturesStageProcedureRelationDTO[] lists) {
 | 
			
		||||
        for(FeaturesStageProcedureRelationDTO dto:lists){
 | 
			
		||||
            ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
 | 
			
		||||
            BaseSupportUtils.setCommonField(dto);
 | 
			
		||||
            save(dto);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
			
		||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 | 
			
		||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
			
		||||
import com.cnbm.admin.utils.BaseSupportUtils;
 | 
			
		||||
import com.cnbm.basic.entity.Platform;
 | 
			
		||||
import com.cnbm.common.page.PageData;
 | 
			
		||||
import com.cnbm.common.service.impl.CrudServiceImpl;
 | 
			
		||||
@@ -95,6 +96,7 @@ public class MachineServiceImpl  extends CrudServiceImpl<MachineMapper, Machine,
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void save(MachineDTO dto) {
 | 
			
		||||
        Machine entity = ConvertUtils.sourceToTarget(dto, Machine.class);
 | 
			
		||||
        BaseSupportUtils.setCommonField(entity);
 | 
			
		||||
        insert(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -102,6 +104,7 @@ public class MachineServiceImpl  extends CrudServiceImpl<MachineMapper, Machine,
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void update(MachineDTO dto) {
 | 
			
		||||
        Machine entity = ConvertUtils.sourceToTarget(dto, Machine.class);
 | 
			
		||||
        BaseSupportUtils.setUpdateCommonField(entity);
 | 
			
		||||
        updateById(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,7 @@ package com.cnbm.basic.service.impl;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
			
		||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 | 
			
		||||
import com.cnbm.admin.utils.BaseSupportUtils;
 | 
			
		||||
import com.cnbm.common.page.PageData;
 | 
			
		||||
import com.cnbm.common.service.impl.CrudServiceImpl;
 | 
			
		||||
import com.cnbm.basic.dto.MeasureToolDTO;
 | 
			
		||||
@@ -61,6 +62,7 @@ public class MeasureToolServiceImpl extends CrudServiceImpl<MeasureToolMapper, M
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void save(MeasureToolDTO dto) {
 | 
			
		||||
        MeasureTool entity = ConvertUtils.sourceToTarget(dto, MeasureTool.class);
 | 
			
		||||
        BaseSupportUtils.setCommonField(entity);
 | 
			
		||||
        insert(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -68,6 +70,7 @@ public class MeasureToolServiceImpl extends CrudServiceImpl<MeasureToolMapper, M
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void update(MeasureToolDTO dto) {
 | 
			
		||||
        MeasureTool entity = ConvertUtils.sourceToTarget(dto, MeasureTool.class);
 | 
			
		||||
        BaseSupportUtils.setUpdateCommonField(entity);
 | 
			
		||||
        updateById(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,7 @@ package com.cnbm.basic.service.impl;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
			
		||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 | 
			
		||||
import com.cnbm.admin.utils.BaseSupportUtils;
 | 
			
		||||
import com.cnbm.basic.dto.FactoryDTO;
 | 
			
		||||
import com.cnbm.common.page.PageData;
 | 
			
		||||
import com.cnbm.common.service.impl.CrudServiceImpl;
 | 
			
		||||
@@ -64,6 +65,7 @@ private PlatformMapper mapper;
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void save(PlatformDTO dto) {
 | 
			
		||||
        Platform entity = ConvertUtils.sourceToTarget(dto, Platform.class);
 | 
			
		||||
        BaseSupportUtils.setCommonField(entity);
 | 
			
		||||
        insert(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -71,6 +73,7 @@ private PlatformMapper mapper;
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void update(PlatformDTO dto) {
 | 
			
		||||
        Platform entity = ConvertUtils.sourceToTarget(dto, Platform.class);
 | 
			
		||||
        BaseSupportUtils.setUpdateCommonField(entity);
 | 
			
		||||
        updateById(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@ package com.cnbm.basic.service.impl;
 | 
			
		||||
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
			
		||||
import com.cnbm.admin.utils.BaseSupportUtils;
 | 
			
		||||
import com.cnbm.basic.dto.ProductWorkingprocedureRelationDTO;
 | 
			
		||||
import com.cnbm.common.page.PageData;
 | 
			
		||||
import com.cnbm.common.service.impl.CrudServiceImpl;
 | 
			
		||||
@@ -58,6 +59,7 @@ public class ProductFactoryRelationServiceImpl extends CrudServiceImpl<ProductFa
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void save(ProductFactoryRelationDTO dto) {
 | 
			
		||||
        ProductFactoryRelation entity = ConvertUtils.sourceToTarget(dto, ProductFactoryRelation.class);
 | 
			
		||||
        BaseSupportUtils.setCommonField(entity);
 | 
			
		||||
        insert(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -65,6 +67,7 @@ public class ProductFactoryRelationServiceImpl extends CrudServiceImpl<ProductFa
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void update(ProductFactoryRelationDTO dto) {
 | 
			
		||||
        ProductFactoryRelation entity = ConvertUtils.sourceToTarget(dto, ProductFactoryRelation.class);
 | 
			
		||||
        BaseSupportUtils.setUpdateCommonField(entity);
 | 
			
		||||
        updateById(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -80,6 +83,7 @@ public class ProductFactoryRelationServiceImpl extends CrudServiceImpl<ProductFa
 | 
			
		||||
    public void batchInsertFactory(ProductFactoryRelationDTO[] lists) {
 | 
			
		||||
        for(ProductFactoryRelationDTO dto:lists){
 | 
			
		||||
            ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
 | 
			
		||||
            BaseSupportUtils.setCommonField(dto);
 | 
			
		||||
            save(dto);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@ package com.cnbm.basic.service.impl;
 | 
			
		||||
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
			
		||||
import com.cnbm.admin.utils.BaseSupportUtils;
 | 
			
		||||
import com.cnbm.common.page.PageData;
 | 
			
		||||
import com.cnbm.common.service.impl.CrudServiceImpl;
 | 
			
		||||
import com.cnbm.basic.dto.ProductFeaturesHisDTO;
 | 
			
		||||
@@ -55,6 +56,7 @@ public class ProductFeaturesHisServiceImpl extends CrudServiceImpl<ProductFeatur
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void save(ProductFeaturesHisDTO dto) {
 | 
			
		||||
        ProductFeaturesHis entity = ConvertUtils.sourceToTarget(dto, ProductFeaturesHis.class);
 | 
			
		||||
        BaseSupportUtils.setCommonField(entity);
 | 
			
		||||
        insert(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -62,6 +64,7 @@ public class ProductFeaturesHisServiceImpl extends CrudServiceImpl<ProductFeatur
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void update(ProductFeaturesHisDTO dto) {
 | 
			
		||||
        ProductFeaturesHis entity = ConvertUtils.sourceToTarget(dto, ProductFeaturesHis.class);
 | 
			
		||||
        BaseSupportUtils.setUpdateCommonField(entity);
 | 
			
		||||
        updateById(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
			
		||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 | 
			
		||||
import com.cnbm.admin.params.IdParam;
 | 
			
		||||
import com.cnbm.admin.utils.BaseSupportUtils;
 | 
			
		||||
import com.cnbm.basic.dto.*;
 | 
			
		||||
import com.cnbm.basic.entity.ProductFeaturesHis;
 | 
			
		||||
import com.cnbm.basic.entity.ProductWorkingprocedureRelation;
 | 
			
		||||
@@ -64,7 +65,9 @@ public class ProductFeaturesServiceImpl extends CrudServiceImpl<ProductFeaturesM
 | 
			
		||||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void save(ProductFeaturesDTO dto) {
 | 
			
		||||
 | 
			
		||||
        ProductFeatures entity = ConvertUtils.sourceToTarget(dto, ProductFeatures.class);
 | 
			
		||||
        BaseSupportUtils.setCommonField(entity);
 | 
			
		||||
        insert(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -92,6 +95,7 @@ public class ProductFeaturesServiceImpl extends CrudServiceImpl<ProductFeaturesM
 | 
			
		||||
        productFeaturesHisServiceImpl.save(history);
 | 
			
		||||
        //更新
 | 
			
		||||
        ProductFeatures entity = ConvertUtils.sourceToTarget(dto, ProductFeatures.class);
 | 
			
		||||
        BaseSupportUtils.setUpdateCommonField(entity);
 | 
			
		||||
        updateById(entity);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
@@ -145,6 +149,7 @@ public class ProductFeaturesServiceImpl extends CrudServiceImpl<ProductFeaturesM
 | 
			
		||||
        for(ProductFeaturesDTO dto:lists){
 | 
			
		||||
            //效验数据
 | 
			
		||||
            ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
 | 
			
		||||
            BaseSupportUtils.setUpdateCommonField(dto);
 | 
			
		||||
            update(dto);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
@@ -154,4 +159,19 @@ public class ProductFeaturesServiceImpl extends CrudServiceImpl<ProductFeaturesM
 | 
			
		||||
        List<ProductFeaturesDTO> list = mapper.getFeaturesList(params);
 | 
			
		||||
        return list;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public List<ProductFeaturesDTO> list() {
 | 
			
		||||
        List<ProductFeaturesDTO> list = mapper.list();
 | 
			
		||||
        return list;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public List<ProductFeaturesDTO> getProductFeaturesByType(Integer type) {
 | 
			
		||||
        List<ProductFeaturesDTO> listByType = mapper.getProductFeaturesByType(type);
 | 
			
		||||
        return listByType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
			
		||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 | 
			
		||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
			
		||||
import com.cnbm.admin.utils.BaseSupportUtils;
 | 
			
		||||
import com.cnbm.basic.entity.ProductType;
 | 
			
		||||
import com.cnbm.basic.mapper.ProductFactoryRelationMapper;
 | 
			
		||||
import com.cnbm.common.page.PageData;
 | 
			
		||||
@@ -96,6 +97,7 @@ public class ProductServiceImpl extends CrudServiceImpl<ProductMapper, Product,
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public IdVo add(ProductDTO dto) {
 | 
			
		||||
        Product entity = ConvertUtils.sourceToTarget(dto, Product.class);
 | 
			
		||||
        BaseSupportUtils.setCommonField(entity);
 | 
			
		||||
        insert(entity);
 | 
			
		||||
        //返回新增产品id
 | 
			
		||||
        return IdVo.builder().id(entity.getId()).build();
 | 
			
		||||
@@ -105,6 +107,7 @@ public class ProductServiceImpl extends CrudServiceImpl<ProductMapper, Product,
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void update(ProductDTO dto) {
 | 
			
		||||
        Product entity = ConvertUtils.sourceToTarget(dto, Product.class);
 | 
			
		||||
        BaseSupportUtils.setUpdateCommonField(entity);
 | 
			
		||||
        updateById(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 | 
			
		||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
			
		||||
import com.cnbm.admin.dto.SysDictDataDTO;
 | 
			
		||||
import com.cnbm.admin.entity.SysDictDataEntity;
 | 
			
		||||
import com.cnbm.admin.utils.BaseSupportUtils;
 | 
			
		||||
import com.cnbm.basic.dto.FactoryDTO;
 | 
			
		||||
import com.cnbm.common.constant.Constant;
 | 
			
		||||
import com.cnbm.common.page.PageData;
 | 
			
		||||
@@ -68,6 +69,7 @@ public class ProductTypeServiceImpl extends CrudServiceImpl<ProductTypeMapper, P
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void save(ProductTypeDTO dto) {
 | 
			
		||||
        ProductType entity = ConvertUtils.sourceToTarget(dto, ProductType.class);
 | 
			
		||||
        BaseSupportUtils.setCommonField(entity);
 | 
			
		||||
        insert(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -75,6 +77,7 @@ public class ProductTypeServiceImpl extends CrudServiceImpl<ProductTypeMapper, P
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void update(ProductTypeDTO dto) {
 | 
			
		||||
        ProductType entity = ConvertUtils.sourceToTarget(dto, ProductType.class);
 | 
			
		||||
        BaseSupportUtils.setUpdateCommonField(entity);
 | 
			
		||||
        updateById(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
			
		||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 | 
			
		||||
 | 
			
		||||
import com.cnbm.admin.utils.BaseSupportUtils;
 | 
			
		||||
import com.cnbm.basic.dto.ProductFeaturesDTO;
 | 
			
		||||
import com.cnbm.basic.dto.SequenceDTO;
 | 
			
		||||
import com.cnbm.basic.dto.WorkingProcedureDTO;
 | 
			
		||||
@@ -85,6 +86,7 @@ public class ProductWorkingprocedureRelationServiceImpl extends CrudServiceImpl<
 | 
			
		||||
                Integer lastSequence = lastDto.getSequence();
 | 
			
		||||
                entity.setSequence(lastSequence + 1);
 | 
			
		||||
            }
 | 
			
		||||
            BaseSupportUtils.setCommonField(entity);
 | 
			
		||||
            insert(entity);
 | 
			
		||||
        }
 | 
			
		||||
        else{
 | 
			
		||||
@@ -96,6 +98,7 @@ public class ProductWorkingprocedureRelationServiceImpl extends CrudServiceImpl<
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void update(ProductWorkingprocedureRelationDTO dto) {
 | 
			
		||||
        ProductWorkingprocedureRelation entity = ConvertUtils.sourceToTarget(dto, ProductWorkingprocedureRelation.class);
 | 
			
		||||
        BaseSupportUtils.setUpdateCommonField(entity);
 | 
			
		||||
        updateById(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -143,6 +146,7 @@ public class ProductWorkingprocedureRelationServiceImpl extends CrudServiceImpl<
 | 
			
		||||
    public void batchInsertWorkingprocedure(ProductWorkingprocedureRelationDTO[] lists) {
 | 
			
		||||
        for(ProductWorkingprocedureRelationDTO dto:lists){
 | 
			
		||||
            ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
 | 
			
		||||
            BaseSupportUtils.setCommonField(dto);
 | 
			
		||||
            save(dto);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@ package com.cnbm.basic.service.impl;
 | 
			
		||||
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
			
		||||
import com.cnbm.admin.utils.BaseSupportUtils;
 | 
			
		||||
import com.cnbm.common.page.PageData;
 | 
			
		||||
import com.cnbm.common.service.impl.CrudServiceImpl;
 | 
			
		||||
import com.cnbm.basic.dto.ShiftDTO;
 | 
			
		||||
@@ -60,6 +61,7 @@ public class ShiftServiceImpl extends CrudServiceImpl<ShiftMapper, Shift, ShiftD
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void save(ShiftDTO dto) {
 | 
			
		||||
        Shift entity = ConvertUtils.sourceToTarget(dto, Shift.class);
 | 
			
		||||
        BaseSupportUtils.setCommonField(entity);
 | 
			
		||||
        insert(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -67,6 +69,7 @@ public class ShiftServiceImpl extends CrudServiceImpl<ShiftMapper, Shift, ShiftD
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void update(ShiftDTO dto) {
 | 
			
		||||
        Shift entity = ConvertUtils.sourceToTarget(dto, Shift.class);
 | 
			
		||||
        BaseSupportUtils.setUpdateCommonField(entity);
 | 
			
		||||
        updateById(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@ package com.cnbm.basic.service.impl;
 | 
			
		||||
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
			
		||||
import com.cnbm.admin.utils.BaseSupportUtils;
 | 
			
		||||
import com.cnbm.common.page.PageData;
 | 
			
		||||
import com.cnbm.common.service.impl.CrudServiceImpl;
 | 
			
		||||
import com.cnbm.basic.dto.TeamDTO;
 | 
			
		||||
@@ -60,6 +61,7 @@ public class TeamServiceImpl extends CrudServiceImpl<TeamMapper, Team, TeamDTO>
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void save(TeamDTO dto) {
 | 
			
		||||
        Team entity = ConvertUtils.sourceToTarget(dto, Team.class);
 | 
			
		||||
        BaseSupportUtils.setCommonField(entity);
 | 
			
		||||
        insert(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -67,6 +69,7 @@ public class TeamServiceImpl extends CrudServiceImpl<TeamMapper, Team, TeamDTO>
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void update(TeamDTO dto) {
 | 
			
		||||
        Team entity = ConvertUtils.sourceToTarget(dto, Team.class);
 | 
			
		||||
        BaseSupportUtils.setUpdateCommonField(entity);
 | 
			
		||||
        updateById(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,7 @@ package com.cnbm.basic.service.impl;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
			
		||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 | 
			
		||||
import com.cnbm.admin.utils.BaseSupportUtils;
 | 
			
		||||
import com.cnbm.basic.dto.FactoryDTO;
 | 
			
		||||
import com.cnbm.common.page.PageData;
 | 
			
		||||
import com.cnbm.common.service.impl.CrudServiceImpl;
 | 
			
		||||
@@ -64,6 +65,7 @@ public class UnitServiceImpl extends CrudServiceImpl<UnitMapper, Unit, UnitDTO>
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void save(UnitDTO dto) {
 | 
			
		||||
        Unit entity = ConvertUtils.sourceToTarget(dto, Unit.class);
 | 
			
		||||
        BaseSupportUtils.setCommonField(entity);
 | 
			
		||||
        insert(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -71,6 +73,7 @@ public class UnitServiceImpl extends CrudServiceImpl<UnitMapper, Unit, UnitDTO>
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void update(UnitDTO dto) {
 | 
			
		||||
        Unit entity = ConvertUtils.sourceToTarget(dto, Unit.class);
 | 
			
		||||
        BaseSupportUtils.setUpdateCommonField(entity);
 | 
			
		||||
        updateById(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3,12 +3,15 @@ package com.cnbm.basic.service.impl;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
			
		||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 | 
			
		||||
import com.cnbm.admin.utils.BaseSupportUtils;
 | 
			
		||||
import com.cnbm.basic.dto.UnitDTO;
 | 
			
		||||
import com.cnbm.basic.dto.WorkingProcedureTypeDTO;
 | 
			
		||||
import com.cnbm.basic.entity.Machine;
 | 
			
		||||
import com.cnbm.basic.entity.ProductWorkingprocedureRelation;
 | 
			
		||||
import com.cnbm.basic.entity.WorkingProcedureType;
 | 
			
		||||
import com.cnbm.basic.mapper.ProductWorkingprocedureRelationMapper;
 | 
			
		||||
import com.cnbm.basic.mapper.UnitMapper;
 | 
			
		||||
import com.cnbm.basic.mapper.WorkingProcedureTypeMapper;
 | 
			
		||||
import com.cnbm.common.page.PageData;
 | 
			
		||||
import com.cnbm.common.service.impl.CrudServiceImpl;
 | 
			
		||||
import com.cnbm.basic.dto.WorkingProcedureDTO;
 | 
			
		||||
@@ -105,6 +108,7 @@ public class WorkingProcedureServiceImpl extends CrudServiceImpl<WorkingProcedur
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void save(WorkingProcedureDTO dto) {
 | 
			
		||||
        WorkingProcedure entity = ConvertUtils.sourceToTarget(dto, WorkingProcedure.class);
 | 
			
		||||
        BaseSupportUtils.setCommonField(entity);
 | 
			
		||||
        insert(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -112,6 +116,7 @@ public class WorkingProcedureServiceImpl extends CrudServiceImpl<WorkingProcedur
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void update(WorkingProcedureDTO dto) {
 | 
			
		||||
        WorkingProcedure entity = ConvertUtils.sourceToTarget(dto, WorkingProcedure.class);
 | 
			
		||||
        BaseSupportUtils.setUpdateCommonField(entity);
 | 
			
		||||
        updateById(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -153,11 +158,36 @@ public class WorkingProcedureServiceImpl extends CrudServiceImpl<WorkingProcedur
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private WorkingProcedureMapper workingProcedureMapper;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private WorkingProcedureTypeMapper workingProcedureTypeMapper;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public List<WorkingProcedureDTO> list() {
 | 
			
		||||
        List<WorkingProcedureDTO> list =  workingProcedureMapper.list();
 | 
			
		||||
 | 
			
		||||
        return list;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public List<WorkingProcedure> listByType(Long typeId) {
 | 
			
		||||
        QueryWrapper<WorkingProcedure> wrapper = new QueryWrapper<>();
 | 
			
		||||
        wrapper.eq(ObjectUtils.isNotNull(typeId), "working_procedure_type_id", typeId);
 | 
			
		||||
        List<WorkingProcedure> listOfType = workingProcedureMapper.selectList(wrapper);
 | 
			
		||||
 | 
			
		||||
        return listOfType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public List<WorkingProcedureTypeDTO> listWithType () {
 | 
			
		||||
        List<WorkingProcedureTypeDTO> workingProcedureTypeDTOList = workingProcedureTypeMapper.list();
 | 
			
		||||
        for(WorkingProcedureTypeDTO workingProcedureTypeDTO: workingProcedureTypeDTOList){
 | 
			
		||||
            List<WorkingProcedure> workingProcedureList = listByType(workingProcedureTypeDTO.getId());
 | 
			
		||||
            if(workingProcedureList!=null & workingProcedureList.size() > 0)
 | 
			
		||||
            workingProcedureTypeDTO.setWorkingProcedureList(workingProcedureList);
 | 
			
		||||
        }
 | 
			
		||||
        return workingProcedureTypeDTOList;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -3,6 +3,7 @@ package com.cnbm.basic.service.impl;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
			
		||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 | 
			
		||||
import com.cnbm.admin.utils.BaseSupportUtils;
 | 
			
		||||
import com.cnbm.common.page.PageData;
 | 
			
		||||
import com.cnbm.common.service.impl.CrudServiceImpl;
 | 
			
		||||
import com.cnbm.basic.dto.WorkingProcedureTypeDTO;
 | 
			
		||||
@@ -59,6 +60,7 @@ public class WorkingProcedureTypeServiceImpl extends CrudServiceImpl<WorkingProc
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void save(WorkingProcedureTypeDTO dto) {
 | 
			
		||||
        WorkingProcedureType entity = ConvertUtils.sourceToTarget(dto, WorkingProcedureType.class);
 | 
			
		||||
        BaseSupportUtils.setCommonField(entity);
 | 
			
		||||
        insert(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -66,6 +68,7 @@ public class WorkingProcedureTypeServiceImpl extends CrudServiceImpl<WorkingProc
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void update(WorkingProcedureTypeDTO dto) {
 | 
			
		||||
        WorkingProcedureType entity = ConvertUtils.sourceToTarget(dto, WorkingProcedureType.class);
 | 
			
		||||
        BaseSupportUtils.setUpdateCommonField(entity);
 | 
			
		||||
        updateById(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -73,4 +73,18 @@
 | 
			
		||||
    <select id="getControlGraphNameById" resultType="String">
 | 
			
		||||
        select name from control_graph where id = #{id}
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <select id="list" resultType="com.cnbm.basic.dto.ProductFeaturesDTO">
 | 
			
		||||
        select * from product_features
 | 
			
		||||
        order by id asc
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <select id="getProductFeaturesByType" resultType="com.cnbm.basic.dto.ProductFeaturesDTO">
 | 
			
		||||
        select * from product_features
 | 
			
		||||
        <where>
 | 
			
		||||
            valid = 1 AND type = #{type}
 | 
			
		||||
        </where>
 | 
			
		||||
        order by id asc
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
 
 | 
			
		||||
@@ -3,8 +3,9 @@
 | 
			
		||||
<mapper namespace="com.cnbm.basic.mapper.WorkingProcedureMapper">
 | 
			
		||||
 | 
			
		||||
    <select id="list" resultType="com.cnbm.basic.dto.WorkingProcedureDTO">
 | 
			
		||||
        select * from working_procedure
 | 
			
		||||
        order by id asc
 | 
			
		||||
        select wp.*,wpt.name as workingProcedureTypeName from working_procedure wp
 | 
			
		||||
        LEFT JOIN working_procedure_type wpt ON wp.working_procedure_type_id=wpt.id
 | 
			
		||||
        order by wp.id asc
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,10 @@
 | 
			
		||||
<?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.cnbm.basic.mapper.WorkingProcedureTypeMapper">
 | 
			
		||||
 | 
			
		||||
    <select id="list" resultType="com.cnbm.basic.dto.WorkingProcedureTypeDTO">
 | 
			
		||||
        select * from working_procedure_type
 | 
			
		||||
        order by id asc
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
@@ -86,4 +86,61 @@
 | 
			
		||||
        </dependency>
 | 
			
		||||
    </dependencies>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    <build>
 | 
			
		||||
        <finalName>${project.artifactId}</finalName>
 | 
			
		||||
        <plugins>
 | 
			
		||||
            <plugin>
 | 
			
		||||
                <groupId>org.springframework.boot</groupId>
 | 
			
		||||
                <artifactId>spring-boot-maven-plugin</artifactId>
 | 
			
		||||
                <version>2.5.12</version>
 | 
			
		||||
                <configuration>
 | 
			
		||||
                    <!--指定运行main函数的包-->
 | 
			
		||||
                    <mainClass>com.cnbm.YmApplication</mainClass>
 | 
			
		||||
                    <!--开启分层编译支持-->
 | 
			
		||||
                    <layers>
 | 
			
		||||
                        <enabled>true</enabled>
 | 
			
		||||
                        <configuration>${project.basedir}/src/main/resources/layers.xml</configuration>
 | 
			
		||||
                    </layers>
 | 
			
		||||
                    <excludes>
 | 
			
		||||
                        <exclude>
 | 
			
		||||
                            <groupId>org.projectlombok</groupId>
 | 
			
		||||
                            <artifactId>lombok</artifactId>
 | 
			
		||||
                        </exclude>
 | 
			
		||||
                    </excludes>
 | 
			
		||||
                </configuration>
 | 
			
		||||
                <executions>
 | 
			
		||||
                    <execution>
 | 
			
		||||
                        <goals>
 | 
			
		||||
                            <goal>repackage</goal>
 | 
			
		||||
                        </goals>
 | 
			
		||||
                    </execution>
 | 
			
		||||
                </executions>
 | 
			
		||||
            </plugin>
 | 
			
		||||
            <plugin>
 | 
			
		||||
                <groupId>org.apache.maven.plugins</groupId>
 | 
			
		||||
                <artifactId>maven-surefire-plugin</artifactId>
 | 
			
		||||
                <configuration>
 | 
			
		||||
                    <skipTests>true</skipTests>
 | 
			
		||||
                </configuration>
 | 
			
		||||
            </plugin>
 | 
			
		||||
            <plugin>
 | 
			
		||||
                <groupId>com.spotify</groupId>
 | 
			
		||||
                <artifactId>docker-maven-plugin</artifactId>
 | 
			
		||||
                <version>${docker.plugin.version}</version>
 | 
			
		||||
                <configuration>
 | 
			
		||||
                    <imageName>ym-pass/${project.artifactId}</imageName>
 | 
			
		||||
                    <dockerDirectory>${project.basedir}/</dockerDirectory>
 | 
			
		||||
                    <resources>
 | 
			
		||||
                        <resource>
 | 
			
		||||
                            <targetPath>/</targetPath>
 | 
			
		||||
                            <directory>${project.build.directory}</directory>
 | 
			
		||||
                            <include>${project.build.finalName}.jar</include>
 | 
			
		||||
                        </resource>
 | 
			
		||||
                    </resources>
 | 
			
		||||
                </configuration>
 | 
			
		||||
            </plugin>
 | 
			
		||||
        </plugins>
 | 
			
		||||
    </build>
 | 
			
		||||
</project>
 | 
			
		||||
@@ -21,14 +21,11 @@ import springfox.documentation.spi.service.contexts.SecurityContext;
 | 
			
		||||
import springfox.documentation.spring.web.plugins.Docket;
 | 
			
		||||
import springfox.documentation.spring.web.plugins.WebFluxRequestHandlerProvider;
 | 
			
		||||
import springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider;
 | 
			
		||||
 | 
			
		||||
import java.lang.reflect.Field;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.stream.Collectors;
 | 
			
		||||
 | 
			
		||||
import static com.google.common.collect.Lists.newArrayList;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author weihongyang
 | 
			
		||||
 * @Date 2022/6/21 10:56 AM
 | 
			
		||||
@@ -128,6 +125,7 @@ public class SwaggerConfig {
 | 
			
		||||
                .securitySchemes(Arrays.asList(new ApiKey("token", "token", "header")));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Bean
 | 
			
		||||
    public Docket processInspectionApi() {
 | 
			
		||||
        return new Docket(DocumentationType.SWAGGER_2)
 | 
			
		||||
 
 | 
			
		||||
@@ -33,9 +33,9 @@ spring:
 | 
			
		||||
      enabled: true
 | 
			
		||||
  redis:
 | 
			
		||||
    database: 2
 | 
			
		||||
    host: redis.picaiba.com
 | 
			
		||||
    port: 6380
 | 
			
		||||
    password: '@WSXcde3'   # 密码(默认为空)
 | 
			
		||||
    host: 127.0.0.1
 | 
			
		||||
    port: 6379
 | 
			
		||||
    password: ''   # 密码(默认为空)
 | 
			
		||||
    timeout: 6000ms  # 连接超时时长(毫秒)
 | 
			
		||||
    jedis:
 | 
			
		||||
      pool:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										27
									
								
								ym-gateway/src/main/resources/layers.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								ym-gateway/src/main/resources/layers.xml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
			
		||||
<layers xmlns="http://www.springframework.org/schema/boot/layers"
 | 
			
		||||
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 | 
			
		||||
        xsi:schemaLocation="http://www.springframework.org/schema/boot/layers
 | 
			
		||||
            https://www.springframework.org/schema/boot/layers/layers.xsd">
 | 
			
		||||
    <application>
 | 
			
		||||
        <into layer="spring-boot-loader">
 | 
			
		||||
            <include>org/springframework/boot/loader/**</include>
 | 
			
		||||
        </into>
 | 
			
		||||
        <into layer="application" />
 | 
			
		||||
    </application>
 | 
			
		||||
    <dependencies>
 | 
			
		||||
        <into layer="snapshot-dependencies">
 | 
			
		||||
            <include>*:*:*SNAPSHOT</include>
 | 
			
		||||
        </into>
 | 
			
		||||
        <into layer="company-dependencies">
 | 
			
		||||
            <include>com.cnbm:*</include>
 | 
			
		||||
        </into>
 | 
			
		||||
        <into layer="dependencies"/>
 | 
			
		||||
    </dependencies>
 | 
			
		||||
    <layerOrder>
 | 
			
		||||
        <layer>dependencies</layer>
 | 
			
		||||
        <layer>spring-boot-loader</layer>
 | 
			
		||||
        <layer>snapshot-dependencies</layer>
 | 
			
		||||
        <layer>company-dependencies</layer>
 | 
			
		||||
        <layer>application</layer>
 | 
			
		||||
    </layerOrder>
 | 
			
		||||
</layers>
 | 
			
		||||
@@ -19,7 +19,7 @@ public class CodeGenerator {
 | 
			
		||||
 | 
			
		||||
    @Test
 | 
			
		||||
    public void test(){
 | 
			
		||||
        mybatisPlusGenerator(new String[]{"inspection_sheet"});
 | 
			
		||||
        mybatisPlusGenerator(new String[]{"unit"});
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void mybatisPlusGenerator(String[] include){
 | 
			
		||||
 
 | 
			
		||||
@@ -51,7 +51,6 @@ public class InspectionSheetController {
 | 
			
		||||
    @PreAuthorize("@ex.hasAuthority('code:inspectionSheet:page')")
 | 
			
		||||
    public Result<PageData<InspectionSheetDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
 | 
			
		||||
        PageData<InspectionSheetDTO> page = inspectionSheetService.page(params);
 | 
			
		||||
 | 
			
		||||
        return new Result<PageData<InspectionSheetDTO>>().ok(page);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -60,7 +59,6 @@ public class InspectionSheetController {
 | 
			
		||||
    @PreAuthorize("@ex.hasAuthority('code:inspectionSheet:info')")
 | 
			
		||||
    public Result<InspectionSheetDTO> get(@PathVariable("id") Long id){
 | 
			
		||||
        InspectionSheetDTO data = inspectionSheetService.get(id);
 | 
			
		||||
 | 
			
		||||
        return new Result<InspectionSheetDTO>().ok(data);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -71,7 +69,6 @@ public class InspectionSheetController {
 | 
			
		||||
    public Result<Long> save(@RequestBody InspectionSheetDTO dto){
 | 
			
		||||
        //效验数据
 | 
			
		||||
        ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            inspectionSheetService.save(dto);
 | 
			
		||||
        }catch (Exception e){
 | 
			
		||||
@@ -86,9 +83,7 @@ public class InspectionSheetController {
 | 
			
		||||
    public Result<Long> update(@RequestBody InspectionSheetDTO dto){
 | 
			
		||||
        //效验数据
 | 
			
		||||
        ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
 | 
			
		||||
 | 
			
		||||
        inspectionSheetService.update(dto);
 | 
			
		||||
 | 
			
		||||
        return new Result<Long>().ok(dto.getId());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -99,9 +94,7 @@ public class InspectionSheetController {
 | 
			
		||||
    public Result delete(@RequestBody Long[] ids){
 | 
			
		||||
        //效验数据
 | 
			
		||||
        AssertUtils.isArrayEmpty(ids, "id");
 | 
			
		||||
 | 
			
		||||
        inspectionSheetService.delete(ids);
 | 
			
		||||
 | 
			
		||||
        return new Result();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -111,8 +104,6 @@ public class InspectionSheetController {
 | 
			
		||||
    @PreAuthorize("@ex.hasAuthority('code:inspectionSheet:export')")
 | 
			
		||||
    public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
 | 
			
		||||
        List<InspectionSheetDTO> list = inspectionSheetService.list(params);
 | 
			
		||||
 | 
			
		||||
        ExcelUtils.exportExcelToTarget(response, null, list, InspectionSheetExcel.class);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -31,7 +31,7 @@ import java.util.Map;
 | 
			
		||||
 * 单位 表  前端控制器
 | 
			
		||||
 *
 | 
			
		||||
 * @author why
 | 
			
		||||
 * @since  2022-06-30
 | 
			
		||||
 * @since  2023-01-12
 | 
			
		||||
 */
 | 
			
		||||
@RestController
 | 
			
		||||
@RequestMapping("/code/unit")
 | 
			
		||||
@@ -68,26 +68,26 @@ public class UnitController {
 | 
			
		||||
    @ApiOperation("保存")
 | 
			
		||||
    @LogOperation("保存")
 | 
			
		||||
    @PreAuthorize("@ex.hasAuthority('code:unit:save')")
 | 
			
		||||
    public Result save(@RequestBody UnitDTO dto){
 | 
			
		||||
    public Result<Long> save(@RequestBody UnitDTO dto){
 | 
			
		||||
        //效验数据
 | 
			
		||||
        ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
 | 
			
		||||
 | 
			
		||||
        unitService.save(dto);
 | 
			
		||||
 | 
			
		||||
        return new Result();
 | 
			
		||||
        return new Result<Long>().ok(dto.getId());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PutMapping
 | 
			
		||||
    @ApiOperation("修改")
 | 
			
		||||
    @LogOperation("修改")
 | 
			
		||||
    @PreAuthorize("@ex.hasAuthority('code:unit:update')")
 | 
			
		||||
    public Result update(@RequestBody UnitDTO dto){
 | 
			
		||||
    public Result<Long> update(@RequestBody UnitDTO dto){
 | 
			
		||||
        //效验数据
 | 
			
		||||
        ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
 | 
			
		||||
 | 
			
		||||
        unitService.update(dto);
 | 
			
		||||
 | 
			
		||||
        return new Result();
 | 
			
		||||
        return new Result<Long>().ok(dto.getId());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @DeleteMapping
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@ import java.math.BigDecimal;
 | 
			
		||||
 * 单位 表
 | 
			
		||||
 *
 | 
			
		||||
 * @author why
 | 
			
		||||
 * @since  2022-06-30
 | 
			
		||||
 * @since  2023-01-12
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@ApiModel(value = "单位 表DTO对象")
 | 
			
		||||
@@ -23,8 +23,8 @@ public class UnitDTO implements Serializable {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty(value = "ID")
 | 
			
		||||
	private BigDecimal id;
 | 
			
		||||
	@ApiModelProperty(value = "")
 | 
			
		||||
	private Long id;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty(value = "单位 名")
 | 
			
		||||
	private String name;
 | 
			
		||||
@@ -33,19 +33,19 @@ public class UnitDTO implements Serializable {
 | 
			
		||||
	private String code;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty(value = "单位类型,1 可计数,2 不可计数")
 | 
			
		||||
	private BigDecimal type;
 | 
			
		||||
	private Integer type;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty(value = "1 可用,0 不可用")
 | 
			
		||||
	private BigDecimal status;
 | 
			
		||||
	private Integer status;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty(value = "备注")
 | 
			
		||||
	private String remark;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty(value = "删除标志,是否有效:1 可用 0不可用")
 | 
			
		||||
	private BigDecimal valid;
 | 
			
		||||
	private Integer valid;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty(value = "创建人")
 | 
			
		||||
	private BigDecimal creatorId;
 | 
			
		||||
	@ApiModelProperty(value = "")
 | 
			
		||||
	private Long creatorId;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty(value = "创建人姓名")
 | 
			
		||||
	private String creatorName;
 | 
			
		||||
@@ -53,8 +53,8 @@ public class UnitDTO implements Serializable {
 | 
			
		||||
	@ApiModelProperty(value = "创建时间")
 | 
			
		||||
	private LocalDateTime createTime;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty(value = "更新人")
 | 
			
		||||
	private BigDecimal updaterId;
 | 
			
		||||
	@ApiModelProperty(value = "")
 | 
			
		||||
	private Long updaterId;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty(value = "更新人姓名")
 | 
			
		||||
	private String updaterName;
 | 
			
		||||
@@ -63,6 +63,6 @@ public class UnitDTO implements Serializable {
 | 
			
		||||
	private LocalDateTime updateTime;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty(value = "版本号")
 | 
			
		||||
	private BigDecimal version;
 | 
			
		||||
	private Integer version;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
package com.cnbm.generator.code.entity;
 | 
			
		||||
 | 
			
		||||
import com.baomidou.mybatisplus.annotation.TableLogic;
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.math.BigDecimal;
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import io.swagger.annotations.ApiModel;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
@@ -13,7 +13,7 @@ import lombok.Data;
 | 
			
		||||
 * </p>
 | 
			
		||||
 *
 | 
			
		||||
 * @author why
 | 
			
		||||
 * @since 2022-06-30
 | 
			
		||||
 * @since 2023-01-12
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@ApiModel(value = "Unit对象", description = "单位 表")
 | 
			
		||||
@@ -21,8 +21,7 @@ public class Unit implements Serializable {
 | 
			
		||||
 | 
			
		||||
    private static final long serialVersionUID = 1L;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty("ID")
 | 
			
		||||
    private BigDecimal id;
 | 
			
		||||
    private Long id;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty("单位 名")
 | 
			
		||||
    private String name;
 | 
			
		||||
@@ -31,19 +30,19 @@ public class Unit implements Serializable {
 | 
			
		||||
    private String code;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty("单位类型,1 可计数,2 不可计数")
 | 
			
		||||
    private BigDecimal type;
 | 
			
		||||
    private Integer type;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty("1 可用,0 不可用")
 | 
			
		||||
    private BigDecimal status;
 | 
			
		||||
    private Integer status;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty("备注")
 | 
			
		||||
    private String remark;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty("删除标志,是否有效:1 可用 0不可用")
 | 
			
		||||
    private BigDecimal valid;
 | 
			
		||||
    @TableLogic
 | 
			
		||||
    private Integer valid;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty("创建人")
 | 
			
		||||
    private BigDecimal creatorId;
 | 
			
		||||
    private Long creatorId;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty("创建人姓名")
 | 
			
		||||
    private String creatorName;
 | 
			
		||||
@@ -51,8 +50,7 @@ public class Unit implements Serializable {
 | 
			
		||||
    @ApiModelProperty("创建时间")
 | 
			
		||||
    private LocalDateTime createTime;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty("更新人")
 | 
			
		||||
    private BigDecimal updaterId;
 | 
			
		||||
    private Long updaterId;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty("更新人姓名")
 | 
			
		||||
    private String updaterName;
 | 
			
		||||
@@ -61,7 +59,7 @@ public class Unit implements Serializable {
 | 
			
		||||
    private LocalDateTime updateTime;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty("版本号")
 | 
			
		||||
    private BigDecimal version;
 | 
			
		||||
    private Integer version;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -12,37 +12,37 @@ import java.util.Date;
 | 
			
		||||
 * 单位 表
 | 
			
		||||
 *
 | 
			
		||||
 * @author why
 | 
			
		||||
 * @since  2022-06-30
 | 
			
		||||
 * @since  2023-01-12
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
public class UnitExcel {
 | 
			
		||||
    @Excel(name = "ID")
 | 
			
		||||
    private BigDecimal id;
 | 
			
		||||
    @Excel(name = "")
 | 
			
		||||
    private Long id;
 | 
			
		||||
    @Excel(name = "单位 名")
 | 
			
		||||
    private String name;
 | 
			
		||||
    @Excel(name = "单位 编码")
 | 
			
		||||
    private String code;
 | 
			
		||||
    @Excel(name = "单位类型,1 可计数,2 不可计数")
 | 
			
		||||
    private BigDecimal type;
 | 
			
		||||
    private Integer type;
 | 
			
		||||
    @Excel(name = "1 可用,0 不可用")
 | 
			
		||||
    private BigDecimal status;
 | 
			
		||||
    private Integer status;
 | 
			
		||||
    @Excel(name = "备注")
 | 
			
		||||
    private String remark;
 | 
			
		||||
    @Excel(name = "删除标志,是否有效:1 可用 0不可用")
 | 
			
		||||
    private BigDecimal valid;
 | 
			
		||||
    @Excel(name = "创建人")
 | 
			
		||||
    private BigDecimal creatorId;
 | 
			
		||||
    private Integer valid;
 | 
			
		||||
    @Excel(name = "")
 | 
			
		||||
    private Long creatorId;
 | 
			
		||||
    @Excel(name = "创建人姓名")
 | 
			
		||||
    private String creatorName;
 | 
			
		||||
    @Excel(name = "创建时间")
 | 
			
		||||
    private LocalDateTime createTime;
 | 
			
		||||
    @Excel(name = "更新人")
 | 
			
		||||
    private BigDecimal updaterId;
 | 
			
		||||
    @Excel(name = "")
 | 
			
		||||
    private Long updaterId;
 | 
			
		||||
    @Excel(name = "更新人姓名")
 | 
			
		||||
    private String updaterName;
 | 
			
		||||
    @Excel(name = "更新时间")
 | 
			
		||||
    private LocalDateTime updateTime;
 | 
			
		||||
    @Excel(name = "版本号")
 | 
			
		||||
    private BigDecimal version;
 | 
			
		||||
    private Integer version;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Mapper;
 | 
			
		||||
 * 单位 表
 | 
			
		||||
 *
 | 
			
		||||
 * @author why
 | 
			
		||||
 * @since 2022-06-30
 | 
			
		||||
 * @since 2023-01-12
 | 
			
		||||
 */
 | 
			
		||||
@Mapper
 | 
			
		||||
public interface UnitMapper extends BaseDao<Unit> {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,21 @@
 | 
			
		||||
<?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.cnbm.generator.code.mapper.UnitMapper">
 | 
			
		||||
    <resultMap type="com.cnbm.generator.code.entity.Unit" id="UnitMap">
 | 
			
		||||
            <id column="id" property="id" />
 | 
			
		||||
            <id column="name" property="name" />
 | 
			
		||||
            <id column="code" property="code" />
 | 
			
		||||
            <id column="type" property="type" />
 | 
			
		||||
            <id column="status" property="status" />
 | 
			
		||||
            <id column="remark" property="remark" />
 | 
			
		||||
            <id column="valid" property="valid" />
 | 
			
		||||
            <id column="creator_id" property="creatorId" />
 | 
			
		||||
            <id column="creator_name" property="creatorName" />
 | 
			
		||||
            <id column="create_time" property="createTime" />
 | 
			
		||||
            <id column="updater_id" property="updaterId" />
 | 
			
		||||
            <id column="updater_name" property="updaterName" />
 | 
			
		||||
            <id column="update_time" property="updateTime" />
 | 
			
		||||
            <id column="version" property="version" />
 | 
			
		||||
    </resultMap>
 | 
			
		||||
 | 
			
		||||
</mapper>
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@ import com.cnbm.generator.code.entity.Unit;
 | 
			
		||||
 * 单位 表
 | 
			
		||||
 *
 | 
			
		||||
 * @author why
 | 
			
		||||
 * @since  2022-06-30
 | 
			
		||||
 * @since  2023-01-12
 | 
			
		||||
 */
 | 
			
		||||
public interface IUnitService extends CrudService<Unit, UnitDTO> {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -15,7 +15,7 @@ import java.util.Map;
 | 
			
		||||
 * 单位 表
 | 
			
		||||
 *
 | 
			
		||||
 * @author why
 | 
			
		||||
 * @since 2022-06-30
 | 
			
		||||
 * @since 2023-01-12
 | 
			
		||||
 */
 | 
			
		||||
@Service
 | 
			
		||||
public class UnitServiceImpl extends CrudServiceImpl<UnitMapper, Unit, UnitDTO> implements IUnitService {
 | 
			
		||||
 
 | 
			
		||||
@@ -182,41 +182,6 @@ public class Main {
 | 
			
		||||
        return day;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static List<FluxTable> query(QueryDataParam param,InfluxDBClient influxDBClient){
 | 
			
		||||
        String measurement = param.getMeasurement();
 | 
			
		||||
        List<String> dropedTagName = param.getDropedTagNames();
 | 
			
		||||
        Range range = param.getRange();
 | 
			
		||||
        String bucket = param.getBucket();
 | 
			
		||||
        String tagName = param.getTag().getTagName();
 | 
			
		||||
        String tagValue = param.getTag().getTagValue();
 | 
			
		||||
        PageInfo pageInfo = param.getPageInfo();
 | 
			
		||||
 | 
			
		||||
        String flux = "from(bucket:\""+bucket+"\")";
 | 
			
		||||
        flux += "|> range(start: "+range.getBegin().toString()+",stop:"+range.getEnd().toString()+")  \n";
 | 
			
		||||
        flux += "|> filter(fn: (r) => r[\"_measurement\"] == \""+measurement+"\")  \n";
 | 
			
		||||
        flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")  \n";
 | 
			
		||||
        for(String dropName:dropedTagName){
 | 
			
		||||
            flux += "|> drop(columns: [\""+ dropName +"\"])  \n";
 | 
			
		||||
        }
 | 
			
		||||
        flux += "|> sort(columns: [\"_time\"], desc: true) \n";
 | 
			
		||||
        flux += "|> window(every: 1y) \n";
 | 
			
		||||
        if(pageInfo!=null){
 | 
			
		||||
            flux += "|> limit(n: "+pageInfo.getSize()+", offset: "+(pageInfo.getCurrent()-1)* pageInfo.getSize()+")";
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        QueryApi queryApi = influxDBClient.getQueryApi();
 | 
			
		||||
 | 
			
		||||
        List<FluxTable> tables = queryApi.query(flux);
 | 
			
		||||
        for (FluxTable fluxTable : tables) {
 | 
			
		||||
            List<FluxRecord> records = fluxTable.getRecords();
 | 
			
		||||
            for (FluxRecord fluxRecord : records) {
 | 
			
		||||
                System.out.println("time: "+fluxRecord.getTime() +"   key:"+fluxRecord.getField()+"   value: " + fluxRecord.getValueByKey("_value")+"   measurement: " + fluxRecord.getMeasurement());
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return tables;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,7 @@
 | 
			
		||||
package com.cnbm.influx.config;
 | 
			
		||||
 | 
			
		||||
import com.cnbm.influx.constant.Constant;
 | 
			
		||||
import com.cnbm.influx.param.PageInfo;
 | 
			
		||||
import com.cnbm.influx.param.QueryDataGroupByTimeParam;
 | 
			
		||||
import com.cnbm.influx.param.QueryDataParam;
 | 
			
		||||
import com.cnbm.influx.param.Range;
 | 
			
		||||
import com.cnbm.influx.param.*;
 | 
			
		||||
import com.cnbm.influx.template.Event;
 | 
			
		||||
import com.influxdb.client.InfluxDBClient;
 | 
			
		||||
import com.influxdb.client.InfluxDBClientFactory;
 | 
			
		||||
@@ -77,7 +74,7 @@ public enum InfluxClient {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * desc: 异步批量  写入数据/更新数据
 | 
			
		||||
     * desc: 异步批量  写入数据 / 更新数据
 | 
			
		||||
     * notes: 如果是更新数据,要保证time字段不能改变
 | 
			
		||||
     * auth: caixaing
 | 
			
		||||
     * */
 | 
			
		||||
@@ -102,7 +99,6 @@ public enum InfluxClient {
 | 
			
		||||
                    .time(event.getTime().toEpochMilli(), WritePrecision.MS);
 | 
			
		||||
        }
 | 
			
		||||
        writeApi.writePoint(point);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -116,14 +112,14 @@ public enum InfluxClient {
 | 
			
		||||
            Point point = null;
 | 
			
		||||
            if(event.getSampleNumber()==null){
 | 
			
		||||
                point = Point.measurement(measurement)
 | 
			
		||||
                        .addTag("transationId", event.getTransationId())
 | 
			
		||||
                        .addTag("transationId", event.getTransationId()==null ? "" : event.getTransationId())
 | 
			
		||||
                        .addTag("argName", event.getArgName())
 | 
			
		||||
                        .addField("argValue", event.getArgValue())
 | 
			
		||||
                        .time(event.getTime().toEpochMilli(), WritePrecision.MS);
 | 
			
		||||
            }else {
 | 
			
		||||
                point = Point.measurement(measurement)
 | 
			
		||||
                        .addTag("transationId", event.getTransationId())
 | 
			
		||||
                        .addTag("inspectionSheetId", event.getInspectionSheetId())
 | 
			
		||||
                        .addTag("transationId", event.getTransationId()==null ? "" : event.getTransationId())
 | 
			
		||||
                        .addTag("inspectionSheetId", event.getInspectionSheetId()==null ? "" : event.getInspectionSheetId())
 | 
			
		||||
 | 
			
		||||
//                        .addTag("batchNum", event.getBatchNum())
 | 
			
		||||
                        .addTag("sampleNumber", event.getSampleNumber())
 | 
			
		||||
@@ -141,77 +137,112 @@ public enum InfluxClient {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public List<FluxTable> query(QueryDataParam param){
 | 
			
		||||
        String measurement = param.getMeasurement();
 | 
			
		||||
        List<String> dropedTagNames = param.getDropedTagNames();
 | 
			
		||||
        Range range = param.getRange();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        String bucket = param.getBucket();
 | 
			
		||||
        PageInfo pageInfo = param.getPageInfo();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        String flux = "from(bucket:\""+bucket+"\")";
 | 
			
		||||
        flux += "|> range(start: "+range.getBegin()+",stop:"+range.getEnd()+")";
 | 
			
		||||
 | 
			
		||||
        if(param.getRange() != null){
 | 
			
		||||
            Range range = param.getRange();
 | 
			
		||||
            flux += "|> range(start: "+range.getBegin()+",stop:"+range.getEnd()+")";
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        flux += "|> filter(fn: (r) => r[\"_measurement\"] == \""+measurement+"\")";
 | 
			
		||||
 | 
			
		||||
        if(param.getTag()!=null){
 | 
			
		||||
            String tagName = param.getTag().getTagName();
 | 
			
		||||
            String tagValue = param.getTag().getTagValue();
 | 
			
		||||
            flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")";
 | 
			
		||||
        if(param.getTags()!=null && param.getTags().size()>0){
 | 
			
		||||
            for(Tag tag:param.getTags()){
 | 
			
		||||
                String tagName = tag.getTagName();
 | 
			
		||||
                String tagValue = tag.getTagValue();
 | 
			
		||||
                flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")";
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //调整时区,查询出的结果 +8个小时
 | 
			
		||||
        //flux += "|> timeShift(duration: 8h)";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        for(String dropName:dropedTagNames){
 | 
			
		||||
            flux += "|> drop(columns: [\""+dropName+"\"])";
 | 
			
		||||
        if(param.getDropedTagNames() != null){
 | 
			
		||||
            List<String> dropedTagNames = param.getDropedTagNames();
 | 
			
		||||
            for(String dropName:dropedTagNames){
 | 
			
		||||
                flux += "|> drop(columns: [\""+dropName+"\"])";
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        flux += "|> sort(columns: [\"_time\"], desc: true)";
 | 
			
		||||
        if(pageInfo!=null){
 | 
			
		||||
        if(param.getPageInfo() != null){
 | 
			
		||||
            PageInfo pageInfo = param.getPageInfo();
 | 
			
		||||
            flux += "|> limit(n: "+pageInfo.getSize()+", offset: "+(pageInfo.getCurrent()-1)* pageInfo.getSize()+")";
 | 
			
		||||
        }
 | 
			
		||||
        return queryApi.query(flux);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public List<FluxTable> queryByGroup(QueryDataParam param){
 | 
			
		||||
        String measurement = param.getMeasurement();
 | 
			
		||||
        List<String> dropedTagNames = param.getDropedTagNames();
 | 
			
		||||
        Range range = param.getRange();
 | 
			
		||||
        String bucket = param.getBucket();
 | 
			
		||||
        String tagName = param.getTag().getTagName();
 | 
			
		||||
        String tagValue = param.getTag().getTagValue();
 | 
			
		||||
        String groupName = param.getGroupName();
 | 
			
		||||
        PageInfo pageInfo = param.getPageInfo();
 | 
			
		||||
 | 
			
		||||
        String flux = "from(bucket:\""+bucket+"\")";
 | 
			
		||||
        flux += "|> range(start: "+range.getBegin()+",stop:"+range.getEnd()+")";
 | 
			
		||||
        flux += "|> filter(fn: (r) => r[\"_measurement\"] == \""+measurement+"\")";
 | 
			
		||||
        flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")";
 | 
			
		||||
        flux += "|> timeShift(duration: 8h)";
 | 
			
		||||
        flux += "|> group(columns: [\""+groupName+"\"], mode: \"except\")";
 | 
			
		||||
        for(String dropName:dropedTagNames){
 | 
			
		||||
            flux += "|> drop(columns: [\""+dropName+"\"])";
 | 
			
		||||
        }
 | 
			
		||||
        flux += "|> sort(columns: [\"_time\"], desc: true)";
 | 
			
		||||
        if(pageInfo!=null){
 | 
			
		||||
            flux += "|> limit(n: "+pageInfo.getSize()+", offset: "+(pageInfo.getCurrent()-1)* pageInfo.getSize()+")";
 | 
			
		||||
        }
 | 
			
		||||
        return queryApi.query(flux);
 | 
			
		||||
    }
 | 
			
		||||
//    public List<FluxTable> queryByGroup(QueryDataParam param){
 | 
			
		||||
//        String measurement = param.getMeasurement();
 | 
			
		||||
//        List<String> dropedTagNames = param.getDropedTagNames();
 | 
			
		||||
//        Range range = param.getRange();
 | 
			
		||||
//        String bucket = param.getBucket();
 | 
			
		||||
//
 | 
			
		||||
//
 | 
			
		||||
//
 | 
			
		||||
//        String groupName = param.getGroupName();
 | 
			
		||||
//        PageInfo pageInfo = param.getPageInfo();
 | 
			
		||||
//
 | 
			
		||||
//        String flux = "from(bucket:\""+bucket+"\")";
 | 
			
		||||
//        flux += "|> range(start: "+range.getBegin()+",stop:"+range.getEnd()+")";
 | 
			
		||||
//        flux += "|> filter(fn: (r) => r[\"_measurement\"] == \""+measurement+"\")";
 | 
			
		||||
//
 | 
			
		||||
////        String tagName = param.getTag().getTagName();
 | 
			
		||||
////        String tagValue = param.getTag().getTagValue();
 | 
			
		||||
////        flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")";
 | 
			
		||||
//        if(param.getTags()!=null && param.getTags().size()>0){
 | 
			
		||||
//            for(Tag tag:param.getTags()){
 | 
			
		||||
//                String tagName = tag.getTagName();
 | 
			
		||||
//                String tagValue = tag.getTagValue();
 | 
			
		||||
//                flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")";
 | 
			
		||||
//            }
 | 
			
		||||
//        }
 | 
			
		||||
//
 | 
			
		||||
////        flux += "|> timeShift(duration: 8h)";
 | 
			
		||||
//        flux += "|> group(columns: [\""+groupName+"\"], mode: \"except\")";
 | 
			
		||||
//        for(String dropName:dropedTagNames){
 | 
			
		||||
//            flux += "|> drop(columns: [\""+dropName+"\"])";
 | 
			
		||||
//        }
 | 
			
		||||
//        flux += "|> sort(columns: [\"_time\"], desc: true)";
 | 
			
		||||
//        if(pageInfo!=null){
 | 
			
		||||
//            flux += "|> limit(n: "+pageInfo.getSize()+", offset: "+(pageInfo.getCurrent()-1)* pageInfo.getSize()+")";
 | 
			
		||||
//        }
 | 
			
		||||
//        return queryApi.query(flux);
 | 
			
		||||
//    }
 | 
			
		||||
 | 
			
		||||
    public List<FluxTable> queryGroupByTime(QueryDataGroupByTimeParam param){
 | 
			
		||||
        String measurement = param.getMeasurement();
 | 
			
		||||
        List<String> dropedTagNames = param.getDropedTagNames();
 | 
			
		||||
        Range range = param.getRange();
 | 
			
		||||
        String bucket = param.getBucket();
 | 
			
		||||
        String tagName = param.getTag().getTagName();
 | 
			
		||||
        String tagValue = param.getTag().getTagValue();
 | 
			
		||||
 | 
			
		||||
        PageInfo pageInfo = param.getPageInfo();
 | 
			
		||||
 | 
			
		||||
        String flux = "from(bucket:\""+bucket+"\")";
 | 
			
		||||
        flux += "|> range(start: "+range.getBegin()+",stop:"+range.getEnd()+")";
 | 
			
		||||
        flux += "|> filter(fn: (r) => r[\"_measurement\"] == \""+measurement+"\")";
 | 
			
		||||
        flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")";
 | 
			
		||||
        flux += "|> timeShift(duration: 8h)";
 | 
			
		||||
 | 
			
		||||
//        String tagName = param.getTag().getTagName();
 | 
			
		||||
//        String tagValue = param.getTag().getTagValue();
 | 
			
		||||
//        flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")";
 | 
			
		||||
//        flux += "|> timeShift(duration: 8h)";
 | 
			
		||||
        if(param.getTags()!=null && param.getTags().size()>0){
 | 
			
		||||
            for(Tag tag:param.getTags()){
 | 
			
		||||
                String tagName = tag.getTagName();
 | 
			
		||||
                String tagValue = tag.getTagValue();
 | 
			
		||||
                flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")";
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        for(String dropName:dropedTagNames){
 | 
			
		||||
            flux += "|> drop(columns: [\""+dropName+"\"])";
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -15,6 +15,7 @@ import com.influxdb.query.FluxTable;
 | 
			
		||||
 | 
			
		||||
import java.time.Instant;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
@@ -69,7 +70,7 @@ public class Main {
 | 
			
		||||
        dropNames.add("transationId");
 | 
			
		||||
        dropNames.add("inspectionSheetId");
 | 
			
		||||
        queryDataParam.setDropedTagNames(dropNames);
 | 
			
		||||
        queryDataParam.setTag(new Tag("argName","forUpdate"));
 | 
			
		||||
        queryDataParam.setTags(Arrays.asList(new Tag("argName","forUpdate")));
 | 
			
		||||
        queryDataParam.setRange(new Range(DataUtils.getBeforeDate(999).toInstant(),DataUtils.getAfterDate(999).toInstant()));
 | 
			
		||||
        queryDataParam.setPageInfo(new PageInfo(1,10));
 | 
			
		||||
        List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,25 @@
 | 
			
		||||
package com.cnbm.influx.controller;
 | 
			
		||||
 | 
			
		||||
import com.cnbm.influx.template.Event;
 | 
			
		||||
import io.swagger.annotations.ApiModel;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
import java.time.Instant;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Desc: ""
 | 
			
		||||
 * @Author: caixiang
 | 
			
		||||
 * @DATE: 2022/12/9 15:53
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@ApiModel(value = "Events")
 | 
			
		||||
public class InfluxData {
 | 
			
		||||
    @ApiModelProperty("ID (transationId、argName、argValue、time 必填)")
 | 
			
		||||
    private List<Event> events;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty("measurement(相当于mysql 中的table,一台工艺设备一个measurement)")
 | 
			
		||||
    private String measurement;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
package com.cnbm.influx.controller;
 | 
			
		||||
 | 
			
		||||
import com.cnbm.common.spc.util.DataUtils;
 | 
			
		||||
import com.cnbm.common.utils.Result;
 | 
			
		||||
import com.cnbm.influx.config.InfluxClient;
 | 
			
		||||
import com.cnbm.influx.constant.Constant;
 | 
			
		||||
import com.cnbm.influx.param.PageInfo;
 | 
			
		||||
@@ -15,14 +16,12 @@ import com.influxdb.query.FluxTable;
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
import org.springframework.web.bind.annotation.PostMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestBody;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RestController;
 | 
			
		||||
 | 
			
		||||
import java.time.Instant;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Random;
 | 
			
		||||
import java.util.*;
 | 
			
		||||
 | 
			
		||||
@RestController
 | 
			
		||||
@RequestMapping("/influx")
 | 
			
		||||
@@ -30,9 +29,9 @@ public class S7DemoController {
 | 
			
		||||
    private static final Logger logger = LoggerFactory.getLogger(S7DemoController.class);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    //for 常规计量型
 | 
			
		||||
    @PostMapping("/insertDemoDataForMetering")
 | 
			
		||||
    public void insertDemoDataForMetering() throws InterruptedException {
 | 
			
		||||
    //for 常规计数型
 | 
			
		||||
    @PostMapping("/insertDemoDataForCount")
 | 
			
		||||
    public void insertDemoDataForCount() throws InterruptedException {
 | 
			
		||||
        List<Event> list = new ArrayList<>();
 | 
			
		||||
        Random r = new Random();
 | 
			
		||||
 | 
			
		||||
@@ -54,54 +53,104 @@ public class S7DemoController {
 | 
			
		||||
        InfluxClient.Client.batchInsert(list,"Weight");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping("/insertDemoOne")
 | 
			
		||||
    public void insertDemoOne() throws InterruptedException {
 | 
			
		||||
        List<Event> list = new ArrayList<>();
 | 
			
		||||
        Random r = new Random();
 | 
			
		||||
        Thread.sleep(10);
 | 
			
		||||
        Instant time = new Date().toInstant();
 | 
			
		||||
        Event event = new Event();
 | 
			
		||||
        event.setTime(time);
 | 
			
		||||
    public static void main(String[] args) throws InterruptedException {
 | 
			
		||||
        long l1 = System.currentTimeMillis();
 | 
			
		||||
        System.out.println(l1);
 | 
			
		||||
        Date date = new Date(l1);
 | 
			
		||||
        Thread.sleep(1000);
 | 
			
		||||
        Date date2 = new Date(l1);
 | 
			
		||||
        System.out.println();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping("/insertDemoOne")
 | 
			
		||||
    public void insertDemoOne(){
 | 
			
		||||
 | 
			
		||||
        List<Event> list = new ArrayList<>();
 | 
			
		||||
        Event event = new Event();
 | 
			
		||||
        event.setTime(new Date(1670554110451L).toInstant());
 | 
			
		||||
        event.setArgName("failDayDay");
 | 
			
		||||
        event.setArgValue("1");
 | 
			
		||||
        event.setArgValue("30089");
 | 
			
		||||
        event.setSampleNumber("10001");
 | 
			
		||||
        list.add(event);
 | 
			
		||||
 | 
			
		||||
        Thread.sleep(1000);
 | 
			
		||||
 | 
			
		||||
        Event event2 = new Event();
 | 
			
		||||
        event2.setTime(time);
 | 
			
		||||
 | 
			
		||||
        event2.setTime(new Date(1670555006702L).toInstant());
 | 
			
		||||
        event2.setArgName("failDayDay");
 | 
			
		||||
        event2.setArgValue("2");
 | 
			
		||||
        event2.setArgValue("40088");
 | 
			
		||||
        event2.setSampleNumber("10001");
 | 
			
		||||
        list.add(event2);
 | 
			
		||||
 | 
			
		||||
        InfluxClient.Client.batchInsert(list,"Weight");
 | 
			
		||||
    }
 | 
			
		||||
    @PostMapping("/readDemoOne")
 | 
			
		||||
    public void readDemoOne() throws InterruptedException {
 | 
			
		||||
    public void readDemoOne() {
 | 
			
		||||
        List<String> dropNames = new ArrayList<>();
 | 
			
		||||
        dropNames.add("transationId");
 | 
			
		||||
//        dropNames.add("inspectionSheetId");
 | 
			
		||||
//        dropNames.add("batchNum");
 | 
			
		||||
 | 
			
		||||
        QueryDataParam queryDataParam = new QueryDataParam();
 | 
			
		||||
        queryDataParam.setMeasurement("PID2");
 | 
			
		||||
        queryDataParam.setRange(new Range(DataUtils.getBeforeDate(999).toInstant(), DataUtils.getAfterDate(999).toInstant() ));
 | 
			
		||||
 | 
			
		||||
        queryDataParam.setDropedTagNames(dropNames);
 | 
			
		||||
        queryDataParam.setTags(Arrays.asList(new Tag("argName","LTWeight"),new Tag("inspectionSheetId","1601123134690340865")));
 | 
			
		||||
        queryDataParam.setBucket(Constant.bucket);
 | 
			
		||||
        List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping("/getFlux")
 | 
			
		||||
    public Result<Instant> getFlux() {
 | 
			
		||||
        List<String> dropNames = new ArrayList<>();
 | 
			
		||||
        dropNames.add("transationId");
 | 
			
		||||
        dropNames.add("inspectionSheetId");
 | 
			
		||||
        dropNames.add("batchNum");
 | 
			
		||||
//        dropNames.add("batchNum");
 | 
			
		||||
 | 
			
		||||
        QueryDataParam queryDataParam = new QueryDataParam();
 | 
			
		||||
        queryDataParam.setMeasurement(Constant.measurement);
 | 
			
		||||
        queryDataParam.setRange(new Range(DataUtils.getBeforeDate(999).toInstant(), DataUtils.getAfterDate(999).toInstant() ));
 | 
			
		||||
 | 
			
		||||
        queryDataParam.setDropedTagNames(dropNames);
 | 
			
		||||
        queryDataParam.setTag(new Tag("argName","failDayDay"));
 | 
			
		||||
        queryDataParam.setTags(Arrays.asList(new Tag("argName","failDayDay")));
 | 
			
		||||
        queryDataParam.setBucket(Constant.bucket);
 | 
			
		||||
        List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
 | 
			
		||||
        Instant time = query.get(0).getRecords().get(0).getTime();
 | 
			
		||||
        return new Result<Instant>().ok(time);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping("/saveFlux1")
 | 
			
		||||
    public Result<Instant> saveFlux1() {
 | 
			
		||||
 | 
			
		||||
        List<Event> list = new ArrayList<>();
 | 
			
		||||
        Event event2 = new Event();
 | 
			
		||||
        Instant instant = new Date().toInstant();
 | 
			
		||||
        event2.setTime(instant);
 | 
			
		||||
        event2.setArgName("failDayDay");
 | 
			
		||||
        event2.setArgValue("");
 | 
			
		||||
        event2.setSampleNumber("10001");
 | 
			
		||||
        list.add(event2);
 | 
			
		||||
        InfluxClient.Client.batchInsert(list,"Weight");
 | 
			
		||||
        return new Result<Instant>().ok(instant);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping("/saveFlux2")
 | 
			
		||||
    public void saveFlux2(@RequestBody TIMETest timeTest) {
 | 
			
		||||
 | 
			
		||||
        List<Event> list = new ArrayList<>();
 | 
			
		||||
        Event event2 = new Event();
 | 
			
		||||
        event2.setTime(timeTest.getTime2());
 | 
			
		||||
        event2.setArgName("failDayDay");
 | 
			
		||||
        event2.setArgValue("40091");
 | 
			
		||||
        event2.setSampleNumber("10001");
 | 
			
		||||
        list.add(event2);
 | 
			
		||||
        InfluxClient.Client.batchInsert(list,"Weight");
 | 
			
		||||
        System.out.println();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    //for 常规计数型
 | 
			
		||||
    @PostMapping("/insertDemoDataForCount")
 | 
			
		||||
    public void insertDemoDataForCount() throws InterruptedException {
 | 
			
		||||
    //for 常规计量型
 | 
			
		||||
    @PostMapping("/insertDemoDataForMetering")
 | 
			
		||||
    public void insertDemoDataForMetering() throws InterruptedException {
 | 
			
		||||
        List<Event> list = new ArrayList<>();
 | 
			
		||||
        Random r = new Random();
 | 
			
		||||
 | 
			
		||||
@@ -147,7 +196,7 @@ public class S7DemoController {
 | 
			
		||||
//    public void insertAndQuery() throws InterruptedException {
 | 
			
		||||
//        Event event = new Event();
 | 
			
		||||
//
 | 
			
		||||
////        long l = System.currentTimeMillis();
 | 
			
		||||
//        long l = System.currentTimeMillis();
 | 
			
		||||
////        System.out.println("l:"+l);
 | 
			
		||||
////        event.setTime(new Date(1669874900889l).toInstant());
 | 
			
		||||
////
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,42 @@
 | 
			
		||||
package com.cnbm.influx.controller;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import com.cnbm.common.utils.Result;
 | 
			
		||||
import com.cnbm.influx.config.InfluxClient;
 | 
			
		||||
import com.cnbm.influx.param.QueryDataParam;
 | 
			
		||||
import com.influxdb.query.FluxTable;
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
import org.springframework.web.bind.annotation.PostMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestBody;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RestController;
 | 
			
		||||
import java.util.*;
 | 
			
		||||
 | 
			
		||||
@RestController
 | 
			
		||||
@RequestMapping("/spcData")
 | 
			
		||||
public class SPCController {
 | 
			
		||||
    private static final Logger logger = LoggerFactory.getLogger(SPCController.class);
 | 
			
		||||
 | 
			
		||||
    @PostMapping("/getData")
 | 
			
		||||
    public Result getData(@RequestBody QueryDataParam param){
 | 
			
		||||
        List<FluxTable> query = InfluxClient.Client.query(param);
 | 
			
		||||
        return new Result<List<FluxTable>>().ok(query);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @PostMapping("/insertOrUpdate")
 | 
			
		||||
    public Result insertBatchForNew(@RequestBody InfluxData data){
 | 
			
		||||
        if(data.getEvents()== null || data.getMeasurement()== null){
 | 
			
		||||
            return new Result().error("传入events 或者 measurement为空");
 | 
			
		||||
        }
 | 
			
		||||
        try {
 | 
			
		||||
            InfluxClient.Client.batchInsert(data.getEvents(),data.getMeasurement());
 | 
			
		||||
        }catch (Exception e){
 | 
			
		||||
            return new Result().ok("influxdb 操作异常");
 | 
			
		||||
        }
 | 
			
		||||
        return new Result().error("成功");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,24 @@
 | 
			
		||||
package com.cnbm.influx.controller;
 | 
			
		||||
 | 
			
		||||
import com.cnbm.influx.template.Event;
 | 
			
		||||
import io.swagger.annotations.ApiModel;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
import java.time.Instant;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Desc: ""
 | 
			
		||||
 * @Author: caixiang
 | 
			
		||||
 * @DATE: 2022/12/9 15:53
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@ApiModel(value = "检验样本 DTO对象")
 | 
			
		||||
public class TIMETest {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "Events")
 | 
			
		||||
    private Instant time2;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -21,4 +21,7 @@ public class PageInfo {
 | 
			
		||||
        this.current = current;
 | 
			
		||||
        this.size = size;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public PageInfo() {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -25,7 +25,8 @@ import java.util.List;
 | 
			
		||||
@EqualsAndHashCode(callSuper = false)
 | 
			
		||||
@Accessors(chain = true)
 | 
			
		||||
public class QueryDataGroupByTimeParam extends BaseParam{
 | 
			
		||||
    private Tag tag;
 | 
			
		||||
 | 
			
		||||
    private List<Tag> tags;
 | 
			
		||||
    //查询的时候,需要忽略的字段。(transationId是唯一标识会对 最终的查询结果集产生影响)
 | 
			
		||||
    private List<String> dropedTagNames;
 | 
			
		||||
    private String bucket;
 | 
			
		||||
 
 | 
			
		||||
@@ -25,12 +25,15 @@ import java.util.List;
 | 
			
		||||
@EqualsAndHashCode(callSuper = false)
 | 
			
		||||
@Accessors(chain = true)
 | 
			
		||||
public class QueryDataParam extends BaseParam{
 | 
			
		||||
    //如果tag不传,就是查询所有
 | 
			
		||||
    private Tag tag;
 | 
			
		||||
    //如果tag不传,就是查询所有, 多条件查询influxdb数据
 | 
			
		||||
    private List<Tag> tags;
 | 
			
		||||
    //private Tag tag;
 | 
			
		||||
    //查询的时候,需要忽略的字段。(transationId是唯一标识会对 最终的查询结果集产生影响)
 | 
			
		||||
    private List<String> dropedTagNames;
 | 
			
		||||
    private String bucket;
 | 
			
		||||
    private String groupName;
 | 
			
		||||
    //private String inspectionSheetId;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public QueryDataParam() {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,9 @@ public class Range {
 | 
			
		||||
        this.end = end;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
//    public static void main(String[] args) {
 | 
			
		||||
    public Range() {
 | 
			
		||||
    }
 | 
			
		||||
    //    public static void main(String[] args) {
 | 
			
		||||
//        Date date = new Date();
 | 
			
		||||
//        System.out.println(date.toInstant().toString());
 | 
			
		||||
//    }
 | 
			
		||||
 
 | 
			
		||||
@@ -16,4 +16,7 @@ public class Tag {
 | 
			
		||||
        this.tagName = tagName;
 | 
			
		||||
        this.tagValue = tagValue;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Tag() {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										30
									
								
								ym-influx/src/main/java/com/cnbm/influx/template/Sample.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								ym-influx/src/main/java/com/cnbm/influx/template/Sample.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
package com.cnbm.influx.template;
 | 
			
		||||
 | 
			
		||||
import com.influxdb.annotations.Column;
 | 
			
		||||
import com.influxdb.annotations.Measurement;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
import javax.validation.constraints.NotNull;
 | 
			
		||||
import java.time.Instant;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Desc: "常规计量值 - entity"
 | 
			
		||||
 * @Author: caixiang
 | 
			
		||||
 * @DATE: 2022/6/25 11:13
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
public class Sample {
 | 
			
		||||
 | 
			
		||||
    private String inspectionSheetId;
 | 
			
		||||
 | 
			
		||||
    private Instant sampleTime;
 | 
			
		||||
 | 
			
		||||
    private String workingProcedureName;
 | 
			
		||||
 | 
			
		||||
    private String sampleNumber;
 | 
			
		||||
 | 
			
		||||
    private String argName;
 | 
			
		||||
 | 
			
		||||
    private String argValue;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,27 @@
 | 
			
		||||
package com.cnbm.influx.template;
 | 
			
		||||
 | 
			
		||||
import com.influxdb.annotations.Column;
 | 
			
		||||
import com.influxdb.annotations.Measurement;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
import javax.validation.constraints.NotNull;
 | 
			
		||||
import java.time.Instant;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Desc: "常规计量值 - entity"
 | 
			
		||||
 * @Author: caixiang
 | 
			
		||||
 * @DATE: 2022/6/25 11:13
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
public class SampleParam {
 | 
			
		||||
 | 
			
		||||
    private String workingProcedureName;
 | 
			
		||||
 | 
			
		||||
    //private String transationId;
 | 
			
		||||
 | 
			
		||||
    private String argName;
 | 
			
		||||
 | 
			
		||||
    private String argValue;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -7,4 +7,4 @@ package com.cnbm.processInspection.constant;
 | 
			
		||||
 */
 | 
			
		||||
public class Constant {
 | 
			
		||||
    public String measureMent = "WeightHeiHei";
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,8 +1,8 @@
 | 
			
		||||
package com.cnbm.processInspection.controller;
 | 
			
		||||
 | 
			
		||||
import com.alibaba.fastjson.JSONObject;
 | 
			
		||||
 | 
			
		||||
import com.cnbm.admin.annotation.LogOperation;
 | 
			
		||||
import com.cnbm.basic.dto.FeaturesProcedureDTO;
 | 
			
		||||
 | 
			
		||||
import com.cnbm.basic.dto.ProductFeaturesDTO;
 | 
			
		||||
import com.cnbm.common.constant.Constant;
 | 
			
		||||
import com.cnbm.common.page.PageData;
 | 
			
		||||
@@ -13,14 +13,13 @@ import com.cnbm.common.validator.ValidatorUtils;
 | 
			
		||||
import com.cnbm.common.validator.group.AddGroup;
 | 
			
		||||
import com.cnbm.common.validator.group.DefaultGroup;
 | 
			
		||||
import com.cnbm.common.validator.group.UpdateGroup;
 | 
			
		||||
import com.cnbm.influx.param.QueryDataParam;
 | 
			
		||||
import com.cnbm.influx.template.Event;
 | 
			
		||||
import com.cnbm.processInspection.dto.InspectionSampleDTO;
 | 
			
		||||
import com.cnbm.processInspection.dto.InspectionSampleDTO2;
 | 
			
		||||
import com.cnbm.processInspection.dto.InspectionSampleDTO3;
 | 
			
		||||
import com.cnbm.processInspection.dto.InspectionSheetDTO;
 | 
			
		||||
import com.cnbm.processInspection.entity.InspectionSheet;
 | 
			
		||||
import com.cnbm.processInspection.excel.InspectionSheetExcel;
 | 
			
		||||
import com.cnbm.processInspection.service.IInspectionSheetService;
 | 
			
		||||
import com.influxdb.query.FluxTable;
 | 
			
		||||
import io.swagger.annotations.Api;
 | 
			
		||||
import io.swagger.annotations.ApiImplicitParam;
 | 
			
		||||
import io.swagger.annotations.ApiImplicitParams;
 | 
			
		||||
@@ -69,7 +68,6 @@ public class InspectionSheetController {
 | 
			
		||||
    @PreAuthorize("@ex.hasAuthority('processInspection:inspectionSheet:page')")
 | 
			
		||||
    public Result<PageData<InspectionSheetDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
 | 
			
		||||
        PageData<InspectionSheetDTO> page = inspectionSheetService.page(params);
 | 
			
		||||
 | 
			
		||||
        return new Result<PageData<InspectionSheetDTO>>().ok(page);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -78,7 +76,6 @@ public class InspectionSheetController {
 | 
			
		||||
    @PreAuthorize("@ex.hasAuthority('processInspection:inspectionSheet:info')")
 | 
			
		||||
    public Result<InspectionSheetDTO> get(@PathVariable("id") Long id){
 | 
			
		||||
        InspectionSheetDTO data = inspectionSheetService.get(id);
 | 
			
		||||
 | 
			
		||||
        return new Result<InspectionSheetDTO>().ok(data);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -89,7 +86,6 @@ public class InspectionSheetController {
 | 
			
		||||
    public Result<Long> save(@RequestBody InspectionSheetDTO dto){
 | 
			
		||||
        //效验数据
 | 
			
		||||
        ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
 | 
			
		||||
 | 
			
		||||
//        try {
 | 
			
		||||
//            inspectionSheetService.saveSheet(dto);
 | 
			
		||||
//        }catch (Exception e){
 | 
			
		||||
@@ -173,11 +169,38 @@ public class InspectionSheetController {
 | 
			
		||||
        return inspectionSheetService.getFluxParamList(inspectionSheetId);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "getFluxParamList3")
 | 
			
		||||
    @ApiOperation(value = "从influxdb中获取检测参数3")
 | 
			
		||||
    List<InspectionSampleDTO3> getFluxParamList3(@RequestParam("inspectionSheetId") Long inspectionSheetId){
 | 
			
		||||
        return inspectionSheetService.getFluxParamList3(inspectionSheetId);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping("saveFluxParamList")
 | 
			
		||||
    @ApiOperation("将样本检测参数写入influxdb")
 | 
			
		||||
    public Result saveFluxParamList(@RequestBody InspectionSampleDTO[] lists){
 | 
			
		||||
    public Result saveFluxParamList(@RequestBody InspectionSampleDTO[] lists) throws InterruptedException{
 | 
			
		||||
 | 
			
		||||
        inspectionSheetService.saveFluxParamList(lists);
 | 
			
		||||
        Thread.sleep(1000);
 | 
			
		||||
        //样本数据更新后 计算检验单缺陷数不良数
 | 
			
		||||
        inspectionSheetService.calculate(Long.valueOf(lists[0].getInspectionSheetId()));
 | 
			
		||||
        return new Result();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping("saveFluxParamList2")
 | 
			
		||||
    @ApiOperation("将样本检测参数写入influxdb2")
 | 
			
		||||
    public Result saveFluxParamList2(@RequestBody InspectionSampleDTO2[] lists) throws InterruptedException{
 | 
			
		||||
        inspectionSheetService.saveFluxParamList2(lists);
 | 
			
		||||
        Thread.sleep(1000);
 | 
			
		||||
        //样本数据更新后 计算检验单缺陷数不良数
 | 
			
		||||
        inspectionSheetService.calculate(Long.valueOf(lists[0].getInspectionSheetId()));
 | 
			
		||||
        return new Result();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping("saveFluxParamList3")
 | 
			
		||||
    @ApiOperation("将样本检测参数写入influxdb3")
 | 
			
		||||
    public Result saveFluxParamList3(@RequestBody InspectionSampleDTO3[] lists) throws InterruptedException{
 | 
			
		||||
        inspectionSheetService.saveFluxParamList3(lists);
 | 
			
		||||
        Thread.sleep(1000);
 | 
			
		||||
        //样本数据更新后 计算检验单缺陷数不良数
 | 
			
		||||
        inspectionSheetService.calculate(Long.valueOf(lists[0].getInspectionSheetId()));
 | 
			
		||||
        return new Result();
 | 
			
		||||
 
 | 
			
		||||
@@ -6,13 +6,10 @@ import com.cnbm.basic.service.IProductFeaturesService;
 | 
			
		||||
import com.cnbm.common.spc.math.StandardDiviation;
 | 
			
		||||
import com.cnbm.common.spc.util.DataUtils;
 | 
			
		||||
import com.cnbm.common.vo.R;
 | 
			
		||||
import com.cnbm.influx.config.InfluxClient;
 | 
			
		||||
import com.cnbm.influx.constant.Constant;
 | 
			
		||||
import com.cnbm.influx.param.QueryDataGroupByTimeParam;
 | 
			
		||||
import com.cnbm.influx.param.QueryDataParam;
 | 
			
		||||
import com.cnbm.influx.param.Range;
 | 
			
		||||
import com.cnbm.influx.param.Tag;
 | 
			
		||||
import com.cnbm.influx.template.Event;
 | 
			
		||||
import com.cnbm.processInspection.dto.*;
 | 
			
		||||
import com.cnbm.processInspection.graphAnalyzed.forCount.c.CGraph;
 | 
			
		||||
import com.cnbm.processInspection.graphAnalyzed.forCount.np.NPGraph;
 | 
			
		||||
@@ -22,8 +19,6 @@ import com.cnbm.processInspection.graphAnalyzed.forMeterage.mr.MeanRGraph;
 | 
			
		||||
import com.cnbm.processInspection.graphAnalyzed.forMeterage.ms.MeanStandardDeviationGraph;
 | 
			
		||||
import com.cnbm.processInspection.graphAnalyzed.forMeterage.xmr.XMRGraph;
 | 
			
		||||
import com.cnbm.qualityPlanning.entity.ControlLimitDetail;
 | 
			
		||||
import com.influxdb.query.FluxRecord;
 | 
			
		||||
import com.influxdb.query.FluxTable;
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
import org.springframework.beans.BeanUtils;
 | 
			
		||||
@@ -32,11 +27,8 @@ import org.springframework.web.bind.annotation.PostMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestBody;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RestController;
 | 
			
		||||
 | 
			
		||||
import java.time.Instant;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Random;
 | 
			
		||||
 | 
			
		||||
@RestController
 | 
			
		||||
@RequestMapping("/processInspection")
 | 
			
		||||
@@ -116,6 +108,7 @@ public class ProcessInspectionController {
 | 
			
		||||
 | 
			
		||||
        return R.ok("成功",xbarSGraphData);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping("/XMRGraphTest")
 | 
			
		||||
    public R<XMRGraphData> XMRGraphTest() throws Exception {
 | 
			
		||||
        ProductFeatures productFeatures = new ProductFeatures();
 | 
			
		||||
@@ -145,48 +138,48 @@ public class ProcessInspectionController {
 | 
			
		||||
                xmrGraph.getSpecificationLimit()==null?null:xmrGraph.getSpecificationLimit(),
 | 
			
		||||
                xmrGraph.getProcessCapacity()==null?null:xmrGraph.getProcessCapacity(),
 | 
			
		||||
                (xmrGraph.getXigma()==null||xmrGraph.getTotalXigma()==null)?null:new StandardDiviation(xmrGraph.getXigma(),xmrGraph.getTotalXigma())
 | 
			
		||||
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        return R.ok("成功",xmrGraphData);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping("/getBatchs")
 | 
			
		||||
    public R<List<String>> getBatchs() throws InterruptedException {
 | 
			
		||||
        List<Event> list = new ArrayList<>();
 | 
			
		||||
        Random r = new Random();
 | 
			
		||||
        Instant instant = DataUtils.getBeforeDate(400).toInstant();
 | 
			
		||||
        List<String> res = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        QueryDataParam queryDataParam = new QueryDataParam();
 | 
			
		||||
        queryDataParam.setBucket("qgs-bucket");
 | 
			
		||||
        queryDataParam.setMeasurement("Weight");
 | 
			
		||||
        List<String> dropNames = new ArrayList<>();
 | 
			
		||||
        dropNames.add("transationId");
 | 
			
		||||
        dropNames.add("_value");
 | 
			
		||||
        dropNames.add("_start");
 | 
			
		||||
        dropNames.add("_stop");
 | 
			
		||||
        dropNames.add("_time");
 | 
			
		||||
        dropNames.add("_field");
 | 
			
		||||
        dropNames.add("_measurement");
 | 
			
		||||
        dropNames.add("inspectionSheetId");
 | 
			
		||||
        dropNames.add("argName");
 | 
			
		||||
        queryDataParam.setDropedTagNames(dropNames);
 | 
			
		||||
        queryDataParam.setTag(new Tag("argName","LTWeight"));
 | 
			
		||||
        queryDataParam.setRange(new Range(DataUtils.getBeforeDate(100).toInstant(),Instant.now()));
 | 
			
		||||
//        queryDataParam.setPageInfo(new PageInfo(1,10));
 | 
			
		||||
        List<FluxTable> query = InfluxClient.Client.queryByGroup(queryDataParam);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        for (FluxTable fluxTable : query) {
 | 
			
		||||
            List<FluxRecord> records = fluxTable.getRecords();
 | 
			
		||||
            if(records.size()!=0){
 | 
			
		||||
                res.add((String) records.get(0).getValueByKey("batchNum"));
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return R.ok(res);
 | 
			
		||||
    }
 | 
			
		||||
//    @PostMapping("/getBatchs")
 | 
			
		||||
//    public R<List<String>> getBatchs() throws InterruptedException {
 | 
			
		||||
//        List<Event> list = new ArrayList<>();
 | 
			
		||||
//        Random r = new Random();
 | 
			
		||||
//        Instant instant = DataUtils.getBeforeDate(400).toInstant();
 | 
			
		||||
//        List<String> res = new ArrayList<>();
 | 
			
		||||
//
 | 
			
		||||
//        QueryDataParam queryDataParam = new QueryDataParam();
 | 
			
		||||
//        queryDataParam.setBucket("qgs-bucket");
 | 
			
		||||
//        queryDataParam.setMeasurement("Weight");
 | 
			
		||||
//        List<String> dropNames = new ArrayList<>();
 | 
			
		||||
//        dropNames.add("transationId");
 | 
			
		||||
//        dropNames.add("_value");
 | 
			
		||||
//        dropNames.add("_start");
 | 
			
		||||
//        dropNames.add("_stop");
 | 
			
		||||
//        dropNames.add("_time");
 | 
			
		||||
//        dropNames.add("_field");
 | 
			
		||||
//        dropNames.add("_measurement");
 | 
			
		||||
//        dropNames.add("inspectionSheetId");
 | 
			
		||||
//        dropNames.add("argName");
 | 
			
		||||
//        queryDataParam.setDropedTagNames(dropNames);
 | 
			
		||||
//
 | 
			
		||||
//        queryDataParam.setTags(Arrays.asList(new Tag("argName","LTWeight")));
 | 
			
		||||
//
 | 
			
		||||
//        queryDataParam.setRange(new Range(DataUtils.getBeforeDate(100).toInstant(),Instant.now()));
 | 
			
		||||
////        queryDataParam.setPageInfo(new PageInfo(1,10));
 | 
			
		||||
//        List<FluxTable> query = InfluxClient.Client.queryByGroup(queryDataParam);
 | 
			
		||||
//
 | 
			
		||||
//
 | 
			
		||||
//        for (FluxTable fluxTable : query) {
 | 
			
		||||
//            List<FluxRecord> records = fluxTable.getRecords();
 | 
			
		||||
//            if(records.size()!=0){
 | 
			
		||||
//                res.add((String) records.get(0).getValueByKey("batchNum"));
 | 
			
		||||
//                continue;
 | 
			
		||||
//            }
 | 
			
		||||
//        }
 | 
			
		||||
//        return R.ok(res);
 | 
			
		||||
//    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @PostMapping("/NPGraphTest")
 | 
			
		||||
@@ -213,6 +206,33 @@ public class ProcessInspectionController {
 | 
			
		||||
 | 
			
		||||
        return R.ok("成功",npGraph1);
 | 
			
		||||
    }
 | 
			
		||||
    @PostMapping("/NPGraph")
 | 
			
		||||
    public R<NPGraphData> NPGraph(@RequestBody GraphArg graphArg) throws Exception {
 | 
			
		||||
 | 
			
		||||
        ProductFeatures productFeatures = setRealSampleSize(graphArg);
 | 
			
		||||
 | 
			
		||||
        if(productFeatures == null){
 | 
			
		||||
            return R.failed("检验参数异常");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        NPGraph npGraph = new NPGraph(productFeatures);
 | 
			
		||||
 | 
			
		||||
        QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();
 | 
			
		||||
//        queryDataParam.setMeasurement(Constant.measurement);
 | 
			
		||||
        queryDataParam.setMeasurement(graphArg.getProcedureName());
 | 
			
		||||
        queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() ));
 | 
			
		||||
        queryDataParam.setTimeType(graphArg.getGroupType());
 | 
			
		||||
        npGraph.initialDate(queryDataParam);
 | 
			
		||||
 | 
			
		||||
        NPGraphData npGraph1 = new NPGraphData(
 | 
			
		||||
                npGraph.getList()==null?null:npGraph.getList(),
 | 
			
		||||
                npGraph.getArgName()==null?null:npGraph.getArgName()
 | 
			
		||||
        );
 | 
			
		||||
        return R.ok("成功",npGraph1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @PostMapping("/PGraphTest")
 | 
			
		||||
    public R<PGraphData> PGraphTest() throws Exception {
 | 
			
		||||
        ProductFeatures productFeatures = new ProductFeatures();
 | 
			
		||||
@@ -293,9 +313,13 @@ public class ProcessInspectionController {
 | 
			
		||||
 | 
			
		||||
    private ProductFeatures setRealSampleSize(GraphArg graphArg){
 | 
			
		||||
        ProductFeaturesDTO productFeaturesDTO = productFeaturesService.get(graphArg.getProductFeaturesId());
 | 
			
		||||
        if(productFeaturesDTO == null){
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
        if(graphArg.getSampleSize()!=null){
 | 
			
		||||
            productFeaturesDTO.setSampleSize(graphArg.getSampleSize());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        ProductFeatures productFeatures = new ProductFeatures();
 | 
			
		||||
        BeanUtils.copyProperties(productFeaturesDTO, productFeatures);
 | 
			
		||||
        return productFeatures;
 | 
			
		||||
@@ -310,13 +334,20 @@ public class ProcessInspectionController {
 | 
			
		||||
    @PostMapping("/XbarSGraph")
 | 
			
		||||
    public R<XbarSGraphData> xbarSGraph(@RequestBody GraphArg graphArg) throws Exception {
 | 
			
		||||
        ProductFeatures productFeatures = setRealSampleSize(graphArg);
 | 
			
		||||
 | 
			
		||||
        if(productFeatures == null){
 | 
			
		||||
            return R.failed("检验参数异常");
 | 
			
		||||
        }else {
 | 
			
		||||
            if(productFeatures.getSampleSize()==null || productFeatures.getName()==null){
 | 
			
		||||
                return R.failed("ProductFeatures 参数异常");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        MeanStandardDeviationGraph meanStandardDeviationGraph = new MeanStandardDeviationGraph(productFeatures);
 | 
			
		||||
        if(graphArg.getInterpretationScheme()!=null){
 | 
			
		||||
            meanStandardDeviationGraph.isNeedInterpretation(graphArg.getInterpretationScheme());
 | 
			
		||||
        }
 | 
			
		||||
        QueryDataParam queryDataParam = new QueryDataParam();
 | 
			
		||||
        queryDataParam.setMeasurement(Constant.measurement);
 | 
			
		||||
//        queryDataParam.setMeasurement(Constant.measurement);
 | 
			
		||||
        queryDataParam.setMeasurement(graphArg.getProcedureName());
 | 
			
		||||
        queryDataParam.setRange(new Range(graphArg.getBegin().toInstant(), graphArg.getEnd().toInstant()));
 | 
			
		||||
        meanStandardDeviationGraph.initialDate(queryDataParam);
 | 
			
		||||
 | 
			
		||||
@@ -336,6 +367,13 @@ public class ProcessInspectionController {
 | 
			
		||||
    public R<XbarRGraphData> XbarRGraph(@RequestBody GraphArg graphArg) throws Exception {
 | 
			
		||||
 | 
			
		||||
        ProductFeatures productFeatures = setRealSampleSize(graphArg);
 | 
			
		||||
        if(productFeatures == null){
 | 
			
		||||
            return R.failed("检验参数异常");
 | 
			
		||||
        }else {
 | 
			
		||||
            if(productFeatures.getSampleSize()==null || productFeatures.getName()==null){
 | 
			
		||||
                return R.failed("ProductFeatures 参数异常");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        MeanRGraph meanRGraph = new MeanRGraph(productFeatures);
 | 
			
		||||
        //如果要检验,,那么set 判读方案
 | 
			
		||||
@@ -344,7 +382,9 @@ public class ProcessInspectionController {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        QueryDataParam queryDataParam = new QueryDataParam();
 | 
			
		||||
        queryDataParam.setMeasurement(Constant.measurement);
 | 
			
		||||
//        queryDataParam.setMeasurement(Constant.measurement);
 | 
			
		||||
        queryDataParam.setMeasurement(graphArg.getProcedureName());
 | 
			
		||||
 | 
			
		||||
        queryDataParam.setRange(new Range(graphArg.getBegin().toInstant(), graphArg.getEnd().toInstant()));
 | 
			
		||||
        meanRGraph.initialDate(queryDataParam);
 | 
			
		||||
 | 
			
		||||
@@ -369,7 +409,9 @@ public class ProcessInspectionController {
 | 
			
		||||
    public R<XMRGraphData> XMRGraph(@RequestBody GraphArg graphArg) throws Exception {
 | 
			
		||||
 | 
			
		||||
        ProductFeatures productFeatures = setRealSampleSize(graphArg);
 | 
			
		||||
 | 
			
		||||
        if(productFeatures == null){
 | 
			
		||||
            return R.failed("检验参数异常");
 | 
			
		||||
        }
 | 
			
		||||
        XMRGraph xmrGraph = new XMRGraph(productFeatures);
 | 
			
		||||
        //如果要检验,,那么set 判读方案
 | 
			
		||||
        if(graphArg.getInterpretationScheme()!=null){
 | 
			
		||||
@@ -377,7 +419,8 @@ public class ProcessInspectionController {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        QueryDataParam queryDataParam = new QueryDataParam();
 | 
			
		||||
        queryDataParam.setMeasurement(Constant.measurement);
 | 
			
		||||
//        queryDataParam.setMeasurement(Constant.measurement);
 | 
			
		||||
        queryDataParam.setMeasurement(graphArg.getProcedureName());
 | 
			
		||||
        queryDataParam.setRange(new Range(graphArg.getBegin().toInstant(), graphArg.getEnd().toInstant()));
 | 
			
		||||
        xmrGraph.initialDate(queryDataParam);
 | 
			
		||||
 | 
			
		||||
@@ -394,35 +437,20 @@ public class ProcessInspectionController {
 | 
			
		||||
        return R.ok("成功",xmrGraphData);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping("/NPGraph")
 | 
			
		||||
    public R<NPGraphData> NPGraph(@RequestBody GraphArg graphArg) throws Exception {
 | 
			
		||||
 | 
			
		||||
        ProductFeatures productFeatures = setRealSampleSize(graphArg);
 | 
			
		||||
 | 
			
		||||
        NPGraph npGraph = new NPGraph(productFeatures);
 | 
			
		||||
 | 
			
		||||
        QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();
 | 
			
		||||
        queryDataParam.setMeasurement(Constant.measurement);
 | 
			
		||||
        queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() ));
 | 
			
		||||
        queryDataParam.setTimeType(graphArg.getGroupType());
 | 
			
		||||
        npGraph.initialDate(queryDataParam);
 | 
			
		||||
 | 
			
		||||
        NPGraphData npGraph1 = new NPGraphData(
 | 
			
		||||
                npGraph.getList()==null?null:npGraph.getList(),
 | 
			
		||||
                npGraph.getArgName()==null?null:npGraph.getArgName()
 | 
			
		||||
        );
 | 
			
		||||
        return R.ok("成功",npGraph1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping("/PGraph")
 | 
			
		||||
    public R<PGraphData> PGraph(@RequestBody GraphArg graphArg) throws Exception {
 | 
			
		||||
 | 
			
		||||
        ProductFeatures productFeatures = setRealSampleSize(graphArg);
 | 
			
		||||
 | 
			
		||||
        if(productFeatures == null){
 | 
			
		||||
            return R.failed("检验参数异常");
 | 
			
		||||
        }
 | 
			
		||||
        PGraph pGraph = new PGraph(productFeatures);
 | 
			
		||||
 | 
			
		||||
        QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();
 | 
			
		||||
        queryDataParam.setMeasurement(Constant.measurement);
 | 
			
		||||
//        queryDataParam.setMeasurement(Constant.measurement);
 | 
			
		||||
        queryDataParam.setMeasurement(graphArg.getProcedureName());
 | 
			
		||||
        queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() ));
 | 
			
		||||
        queryDataParam.setTimeType(graphArg.getGroupType());
 | 
			
		||||
        pGraph.initialDate(queryDataParam);
 | 
			
		||||
@@ -437,11 +465,14 @@ public class ProcessInspectionController {
 | 
			
		||||
    public R<CGraphData> CGraph(@RequestBody GraphArg graphArg) throws Exception {
 | 
			
		||||
 | 
			
		||||
        ProductFeatures productFeatures = setRealSampleSize(graphArg);
 | 
			
		||||
 | 
			
		||||
        if(productFeatures == null){
 | 
			
		||||
            return R.failed("检验参数异常");
 | 
			
		||||
        }
 | 
			
		||||
        CGraph cGraph = new CGraph(productFeatures);
 | 
			
		||||
 | 
			
		||||
        QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();
 | 
			
		||||
        queryDataParam.setMeasurement(Constant.measurement);
 | 
			
		||||
//        queryDataParam.setMeasurement(Constant.measurement);
 | 
			
		||||
        queryDataParam.setMeasurement(graphArg.getProcedureName());
 | 
			
		||||
        queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() ));
 | 
			
		||||
        queryDataParam.setTimeType(graphArg.getGroupType());
 | 
			
		||||
        cGraph.initialDate(queryDataParam);
 | 
			
		||||
@@ -457,11 +488,14 @@ public class ProcessInspectionController {
 | 
			
		||||
    public R<UGraphData> UGraph(@RequestBody GraphArg graphArg) throws Exception {
 | 
			
		||||
 | 
			
		||||
        ProductFeatures productFeatures = setRealSampleSize(graphArg);
 | 
			
		||||
 | 
			
		||||
        if(productFeatures == null){
 | 
			
		||||
            return R.failed("检验参数异常");
 | 
			
		||||
        }
 | 
			
		||||
        UGraph uGraph = new UGraph(productFeatures);
 | 
			
		||||
 | 
			
		||||
        QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();
 | 
			
		||||
        queryDataParam.setMeasurement(Constant.measurement);
 | 
			
		||||
//        queryDataParam.setMeasurement(Constant.measurement);
 | 
			
		||||
        queryDataParam.setMeasurement(graphArg.getProcedureName());
 | 
			
		||||
        queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() ));
 | 
			
		||||
        queryDataParam.setTimeType(graphArg.getGroupType());
 | 
			
		||||
        uGraph.initialDate(queryDataParam);
 | 
			
		||||
 
 | 
			
		||||
@@ -2,10 +2,12 @@ package com.cnbm.processInspection.dto;
 | 
			
		||||
 | 
			
		||||
import com.cnbm.basic.entity.ProductFeatures;
 | 
			
		||||
import com.cnbm.influx.param.Range;
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonFormat;
 | 
			
		||||
import io.swagger.annotations.ApiModel;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
import javax.validation.constraints.NotNull;
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
@@ -18,15 +20,20 @@ import java.util.List;
 | 
			
		||||
@ApiModel(value = "控制图 查询参数类")
 | 
			
		||||
public class GraphArg {
 | 
			
		||||
    @ApiModelProperty(value = "检验特性Id")
 | 
			
		||||
    @NotNull(message = "检验特性Id 不能为空")
 | 
			
		||||
    private Long productFeaturesId;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "查询时间段,开始")
 | 
			
		||||
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
 | 
			
		||||
    @NotNull(message = "时间段,开始 不能为空")
 | 
			
		||||
    private Date begin;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "查询时间段,结束")
 | 
			
		||||
    @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
 | 
			
		||||
    @NotNull(message = "时间段,结束 不能为空")
 | 
			
		||||
    private Date end;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "判读方案列表")
 | 
			
		||||
    @ApiModelProperty(value = "判读方案列表,只用于 计量型")
 | 
			
		||||
    private List<InterpretationListArg> interpretationScheme;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "样本大小,不填的话用之前配置的")
 | 
			
		||||
@@ -34,4 +41,7 @@ public class GraphArg {
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "分组类别(1=年 , 2=月 , 3=日)(用于计数型控制图)")
 | 
			
		||||
    private Integer groupType;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "工序名")
 | 
			
		||||
    private String procedureName;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,40 @@
 | 
			
		||||
package com.cnbm.processInspection.dto;
 | 
			
		||||
 | 
			
		||||
import com.cnbm.influx.template.Event;
 | 
			
		||||
import io.swagger.annotations.ApiModel;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.time.Instant;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 检验样本 表
 | 
			
		||||
 *
 | 
			
		||||
 * @author yanyang
 | 
			
		||||
 * @since  2022-11-24
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@ApiModel(value = "检验样本 DTO对象")
 | 
			
		||||
public class InspectionSampleDTO2 implements Serializable {
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "工序名称,关联working_procedure表")
 | 
			
		||||
    private String workingProcedureName;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "检验单id")
 | 
			
		||||
    private String inspectionSheetId;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "检验参数")
 | 
			
		||||
    private List<Event> events;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "批次号")
 | 
			
		||||
    private String batchNum;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "取样时间")
 | 
			
		||||
    private Instant sampleTime;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "样本号")
 | 
			
		||||
    private String sampleNumber;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,37 @@
 | 
			
		||||
package com.cnbm.processInspection.dto;
 | 
			
		||||
 | 
			
		||||
import com.cnbm.influx.template.Event;
 | 
			
		||||
import com.cnbm.influx.template.SampleParam;
 | 
			
		||||
import io.swagger.annotations.ApiModel;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.time.Instant;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 检验样本 表
 | 
			
		||||
 *
 | 
			
		||||
 * @author yanyang
 | 
			
		||||
 * @since  2022-11-24
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@ApiModel(value = "检验样本 DTO3对象")
 | 
			
		||||
public class InspectionSampleDTO3 implements Serializable {
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "检验单id")
 | 
			
		||||
    private String inspectionSheetId;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "取样时间")
 | 
			
		||||
    private Instant sampleTime;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "批次号")
 | 
			
		||||
    private String batchNum;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "样本号")
 | 
			
		||||
    private String sampleNumber;
 | 
			
		||||
 | 
			
		||||
    @ApiModelProperty(value = "检验参数")
 | 
			
		||||
    private List<SampleParam> sampleParamList;
 | 
			
		||||
}
 | 
			
		||||
@@ -15,6 +15,7 @@ import com.influxdb.query.FluxTable;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -104,9 +105,9 @@ public class CGraph {
 | 
			
		||||
        List<String> dropNames = new ArrayList<>();
 | 
			
		||||
        dropNames.add("transationId");
 | 
			
		||||
        dropNames.add("inspectionSheetId");
 | 
			
		||||
        dropNames.add("batchNum");
 | 
			
		||||
//        dropNames.add("batchNum");
 | 
			
		||||
        queryDataParam.setDropedTagNames(dropNames);
 | 
			
		||||
        queryDataParam.setTag(new Tag("argName",argName));
 | 
			
		||||
        queryDataParam.setTags(Arrays.asList(new Tag("argName",argName)));
 | 
			
		||||
 | 
			
		||||
        List<FluxTable> query = InfluxClient.Client.queryGroupByTime(queryDataParam);
 | 
			
		||||
        //1. 先从fluxdb 里面提取原始数据
 | 
			
		||||
 
 | 
			
		||||
@@ -12,6 +12,7 @@ import com.influxdb.query.FluxTable;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -85,6 +86,8 @@ public class NPGraph {
 | 
			
		||||
        return totalFailNum/totalN;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * name : 初始化数据函数
 | 
			
		||||
     * desc : 从influxdb 里面读取数据,然后 加工处理成 我需要的
 | 
			
		||||
@@ -96,10 +99,10 @@ public class NPGraph {
 | 
			
		||||
        List<String> dropNames = new ArrayList<>();
 | 
			
		||||
        dropNames.add("transationId");
 | 
			
		||||
        dropNames.add("inspectionSheetId");
 | 
			
		||||
        dropNames.add("batchNum");
 | 
			
		||||
        //dropNames.add("batchNum");
 | 
			
		||||
        queryDataParam.setDropedTagNames(dropNames);
 | 
			
		||||
        queryDataParam.setTag(new Tag("argName",argName));
 | 
			
		||||
 | 
			
		||||
        queryDataParam.setTags(Arrays.asList(new Tag("argName",argName)));
 | 
			
		||||
        List<FluxTable> query = InfluxClient.Client.queryGroupByTime(queryDataParam);
 | 
			
		||||
        //1. 先从fluxdb 里面提取原始数据
 | 
			
		||||
        List<Double> originData = new ArrayList<>();
 | 
			
		||||
 
 | 
			
		||||
@@ -15,6 +15,7 @@ import com.influxdb.query.FluxTable;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -109,9 +110,9 @@ public class PGraph {
 | 
			
		||||
        List<String> dropNames = new ArrayList<>();
 | 
			
		||||
        dropNames.add("transationId");
 | 
			
		||||
        dropNames.add("inspectionSheetId");
 | 
			
		||||
        dropNames.add("batchNum");
 | 
			
		||||
        //dropNames.add("batchNum");
 | 
			
		||||
        queryDataParam.setDropedTagNames(dropNames);
 | 
			
		||||
        queryDataParam.setTag(new Tag("argName",argName));
 | 
			
		||||
        queryDataParam.setTags(Arrays.asList(new Tag("argName",argName)));
 | 
			
		||||
 | 
			
		||||
        List<FluxTable> query = InfluxClient.Client.queryGroupByTime(queryDataParam);
 | 
			
		||||
        //1. 先从fluxdb 里面提取原始数据
 | 
			
		||||
 
 | 
			
		||||
@@ -15,6 +15,7 @@ import com.influxdb.query.FluxTable;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -108,10 +109,10 @@ public class UGraph {
 | 
			
		||||
        List<String> dropNames = new ArrayList<>();
 | 
			
		||||
        dropNames.add("transationId");
 | 
			
		||||
        dropNames.add("inspectionSheetId");
 | 
			
		||||
        dropNames.add("batchNum");
 | 
			
		||||
        //dropNames.add("batchNum");
 | 
			
		||||
        queryDataParam.setDropedTagNames(dropNames);
 | 
			
		||||
        queryDataParam.setTag(new Tag("argName",argName));
 | 
			
		||||
 | 
			
		||||
        queryDataParam.setTags(Arrays.asList(new Tag("argName",argName)));
 | 
			
		||||
        List<FluxTable> query = InfluxClient.Client.queryGroupByTime(queryDataParam);
 | 
			
		||||
        //1. 先从fluxdb 里面提取原始数据
 | 
			
		||||
        //计算p bar
 | 
			
		||||
 
 | 
			
		||||
@@ -17,6 +17,7 @@ import com.influxdb.query.FluxTable;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -64,9 +65,7 @@ public class MeanRGraph {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public MeanRGraph(ProductFeatures productFeatures) throws Exception {
 | 
			
		||||
        if(productFeatures.getSampleSize()==null || productFeatures.getName()==null){
 | 
			
		||||
            throw new Exception("ProductFeatures 参数异常");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this.argName = productFeatures.getName();
 | 
			
		||||
        this.sampleSize = productFeatures.getSampleSize().intValue();
 | 
			
		||||
        this.a2 = XBarRCoefficients.getA2(sampleSize);
 | 
			
		||||
@@ -91,6 +90,7 @@ public class MeanRGraph {
 | 
			
		||||
        this.interpretationScheme = list;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * name : 初始化数据函数
 | 
			
		||||
     * desc : 从influxdb 里面读取数据,然后 加工处理成 我需要的
 | 
			
		||||
@@ -102,9 +102,9 @@ public class MeanRGraph {
 | 
			
		||||
        List<String> dropNames = new ArrayList<>();
 | 
			
		||||
        dropNames.add("transationId");
 | 
			
		||||
        dropNames.add("inspectionSheetId");
 | 
			
		||||
        dropNames.add("batchNum");
 | 
			
		||||
        //dropNames.add("batchNum");
 | 
			
		||||
        queryDataParam.setDropedTagNames(dropNames);
 | 
			
		||||
        queryDataParam.setTag(new Tag("argName",argName));
 | 
			
		||||
        queryDataParam.setTags(Arrays.asList(new Tag("argName",argName)));
 | 
			
		||||
 | 
			
		||||
        List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
 | 
			
		||||
        if(query.size() == 0){
 | 
			
		||||
@@ -116,7 +116,12 @@ public class MeanRGraph {
 | 
			
		||||
            List<FluxRecord> records = fluxTable.getRecords();
 | 
			
		||||
            for (FluxRecord fluxRecord : records) {
 | 
			
		||||
                //因为 传进去的就是Double 类型,所以取出来,自然而然就是Double
 | 
			
		||||
                originData.add(Double.parseDouble(fluxRecord.getValueByKey("_value").toString()));
 | 
			
		||||
                Object value = fluxRecord.getValueByKey("_value");
 | 
			
		||||
 | 
			
		||||
                if(value!=null){
 | 
			
		||||
                    originData.add(Double.parseDouble(value.toString()));
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -18,6 +18,7 @@ import com.influxdb.query.FluxTable;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -61,9 +62,7 @@ public class MeanStandardDeviationGraph {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public MeanStandardDeviationGraph(ProductFeatures productFeatures) throws Exception {
 | 
			
		||||
        if(productFeatures.getSampleSize()==null || productFeatures.getName()==null){
 | 
			
		||||
            throw new Exception("ProductFeatures 参数异常");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this.argName = productFeatures.getName();
 | 
			
		||||
        this.sampleSize = productFeatures.getSampleSize().intValue();
 | 
			
		||||
        this.as = XBarSCoefficients.getAS(sampleSize);
 | 
			
		||||
@@ -99,9 +98,9 @@ public class MeanStandardDeviationGraph {
 | 
			
		||||
        List<String> dropNames = new ArrayList<>();
 | 
			
		||||
        dropNames.add("transationId");
 | 
			
		||||
        dropNames.add("inspectionSheetId");
 | 
			
		||||
        dropNames.add("batchNum");
 | 
			
		||||
        //dropNames.add("batchNum");
 | 
			
		||||
        queryDataParam.setDropedTagNames(dropNames);
 | 
			
		||||
        queryDataParam.setTag(new Tag("argName",argName));
 | 
			
		||||
        queryDataParam.setTags(Arrays.asList(new Tag("argName",argName)));
 | 
			
		||||
 | 
			
		||||
        List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
 | 
			
		||||
        //1. 先从fluxdb 里面提取原始数据
 | 
			
		||||
@@ -122,6 +121,9 @@ public class MeanStandardDeviationGraph {
 | 
			
		||||
        List<Double> rArray = new ArrayList<>();
 | 
			
		||||
        for(int i=0;i<doubleListList.size();i++){
 | 
			
		||||
            Double[] doubleList = toDoubleArray(doubleListList.get(i).toArray());
 | 
			
		||||
            if(doubleList.length == 1){
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            Double xbar = Math.getMean(doubleList);
 | 
			
		||||
            Double s = Math.StandardDiviation(doubleList).getNormal();
 | 
			
		||||
 
 | 
			
		||||
@@ -15,6 +15,7 @@ import com.influxdb.query.FluxTable;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
@@ -61,9 +62,6 @@ public class XMRGraph {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public XMRGraph(ProductFeatures productFeatures) throws Exception {
 | 
			
		||||
        if(productFeatures.getSampleSize()==null || productFeatures.getName()==null){
 | 
			
		||||
            throw new Exception("ProductFeatures 参数异常");
 | 
			
		||||
        }
 | 
			
		||||
        this.argName = productFeatures.getName();
 | 
			
		||||
        this.sampleSize = 1;
 | 
			
		||||
        this.specificationLimit = new SpecificationLimit(
 | 
			
		||||
@@ -96,9 +94,9 @@ public class XMRGraph {
 | 
			
		||||
        List<String> dropNames = new ArrayList<>();
 | 
			
		||||
        dropNames.add("transationId");
 | 
			
		||||
        dropNames.add("inspectionSheetId");
 | 
			
		||||
        dropNames.add("batchNum");
 | 
			
		||||
        //dropNames.add("batchNum");
 | 
			
		||||
        queryDataParam.setDropedTagNames(dropNames);
 | 
			
		||||
        queryDataParam.setTag(new Tag("argName",argName));
 | 
			
		||||
        queryDataParam.setTags(Arrays.asList(new Tag("argName",argName)));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        List<FluxTable> query = InfluxClient.Client.query(queryDataParam);
 | 
			
		||||
 
 | 
			
		||||
@@ -7,6 +7,8 @@ import com.cnbm.common.service.CrudService;
 | 
			
		||||
import com.cnbm.influx.param.QueryDataParam;
 | 
			
		||||
import com.cnbm.influx.template.Event;
 | 
			
		||||
import com.cnbm.processInspection.dto.InspectionSampleDTO;
 | 
			
		||||
import com.cnbm.processInspection.dto.InspectionSampleDTO2;
 | 
			
		||||
import com.cnbm.processInspection.dto.InspectionSampleDTO3;
 | 
			
		||||
import com.cnbm.processInspection.dto.InspectionSheetDTO;
 | 
			
		||||
import com.cnbm.processInspection.entity.InspectionSheet;
 | 
			
		||||
import com.influxdb.query.FluxTable;
 | 
			
		||||
@@ -36,8 +38,11 @@ public interface IInspectionSheetService extends CrudService<InspectionSheet, In
 | 
			
		||||
 | 
			
		||||
//    List<Event> getFluxParamList(Map<String, Object> params);
 | 
			
		||||
    List<InspectionSampleDTO> getFluxParamList(Long inspectionSheetId);
 | 
			
		||||
    List<InspectionSampleDTO3> getFluxParamList3(Long inspectionSheetId);
 | 
			
		||||
 | 
			
		||||
    void saveFluxParamList(InspectionSampleDTO[] lists);
 | 
			
		||||
    void saveFluxParamList2(InspectionSampleDTO2[] lists);
 | 
			
		||||
    void saveFluxParamList3(InspectionSampleDTO3[] lists);
 | 
			
		||||
 | 
			
		||||
    List<ProductFeaturesDTO> getInspectionSheetFeaturesList(Map<String, Object> params);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -5,15 +5,11 @@ import com.alibaba.fastjson.JSONObject;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
			
		||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 | 
			
		||||
import com.cnbm.admin.utils.BaseSupportUtils;
 | 
			
		||||
import com.cnbm.basic.dto.ProductFeaturesDTO;
 | 
			
		||||
import com.cnbm.basic.entity.Machine;
 | 
			
		||||
import com.cnbm.basic.entity.Product;
 | 
			
		||||
import com.cnbm.basic.entity.Shift;
 | 
			
		||||
import com.cnbm.basic.entity.WorkingProcedure;
 | 
			
		||||
import com.cnbm.basic.service.impl.MachineServiceImpl;
 | 
			
		||||
import com.cnbm.basic.service.impl.ProductServiceImpl;
 | 
			
		||||
import com.cnbm.basic.service.impl.ShiftServiceImpl;
 | 
			
		||||
import com.cnbm.basic.service.impl.WorkingProcedureServiceImpl;
 | 
			
		||||
import com.cnbm.basic.dto.WorkingProcedureDTO;
 | 
			
		||||
import com.cnbm.basic.entity.*;
 | 
			
		||||
import com.cnbm.basic.service.impl.*;
 | 
			
		||||
import com.cnbm.common.page.PageData;
 | 
			
		||||
import com.cnbm.common.service.impl.CrudServiceImpl;
 | 
			
		||||
import com.cnbm.common.spc.util.DataUtils;
 | 
			
		||||
@@ -22,14 +18,18 @@ import com.cnbm.influx.config.InfluxClient;
 | 
			
		||||
import com.cnbm.influx.param.PageInfo;
 | 
			
		||||
import com.cnbm.influx.param.QueryDataParam;
 | 
			
		||||
import com.cnbm.influx.param.Range;
 | 
			
		||||
 | 
			
		||||
import com.cnbm.influx.param.Tag;
 | 
			
		||||
import com.cnbm.influx.template.Event;
 | 
			
		||||
import com.cnbm.influx.template.Sample;
 | 
			
		||||
import com.cnbm.influx.template.SampleParam;
 | 
			
		||||
import com.cnbm.processInspection.dto.InspectionSampleDTO;
 | 
			
		||||
import com.cnbm.processInspection.dto.InspectionSampleDTO2;
 | 
			
		||||
import com.cnbm.processInspection.dto.InspectionSampleDTO3;
 | 
			
		||||
import com.cnbm.processInspection.dto.InspectionSheetDTO;
 | 
			
		||||
import com.cnbm.processInspection.entity.InspectionSheet;
 | 
			
		||||
import com.cnbm.processInspection.mapper.InspectionSheetMapper;
 | 
			
		||||
import com.cnbm.processInspection.service.IInspectionSheetService;
 | 
			
		||||
import com.google.gson.JsonObject;
 | 
			
		||||
import com.influxdb.query.FluxRecord;
 | 
			
		||||
import com.influxdb.query.FluxTable;
 | 
			
		||||
import org.apache.commons.lang3.StringUtils;
 | 
			
		||||
@@ -40,10 +40,8 @@ import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestBody;
 | 
			
		||||
 | 
			
		||||
import javax.annotation.Resource;
 | 
			
		||||
import java.time.Instant;
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.time.ZoneId;
 | 
			
		||||
import java.time.ZoneOffset;
 | 
			
		||||
import java.time.*;
 | 
			
		||||
import java.time.format.DateTimeFormatter;
 | 
			
		||||
import java.util.*;
 | 
			
		||||
import java.util.stream.Collectors;
 | 
			
		||||
 | 
			
		||||
@@ -68,6 +66,10 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private ShiftServiceImpl shiftService;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private ProductFeaturesServiceImpl productFeaturesService;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public QueryWrapper<InspectionSheet> getWrapper(Map<String, Object> params) {
 | 
			
		||||
        Long id = (Long) params.get("id");
 | 
			
		||||
@@ -76,6 +78,12 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
 | 
			
		||||
        String batchNumber = (String) params.get("batchNumber");
 | 
			
		||||
 | 
			
		||||
        QueryWrapper<InspectionSheet> wrapper = new QueryWrapper<>();
 | 
			
		||||
        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
 | 
			
		||||
        if( ObjectUtils.isNotNull(params.get("startTime")) &&  ObjectUtils.isNotNull(params.get("endTime"))){
 | 
			
		||||
            LocalDateTime startTime = LocalDate.parse(params.get("startTime").toString(),df).atStartOfDay();
 | 
			
		||||
            LocalDateTime endTime = LocalDate.parse(params.get("endTime").toString(),df).atStartOfDay();
 | 
			
		||||
            wrapper.between(startTime!=null && endTime!=null,"create_time", startTime, endTime);
 | 
			
		||||
        }
 | 
			
		||||
        wrapper.like(ObjectUtils.isNotNull(id), "id", id);
 | 
			
		||||
        wrapper.like(StringUtils.isNotBlank(inspectionSite), "inspection_stage", inspectionSite);
 | 
			
		||||
        wrapper.like(StringUtils.isNotBlank(orderNumber), "order_number", orderNumber);
 | 
			
		||||
@@ -132,9 +140,12 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
 | 
			
		||||
    public InspectionSheetDTO get(Long id) {
 | 
			
		||||
        InspectionSheet entity = baseDao.selectById(id);
 | 
			
		||||
        InspectionSheetDTO dto = ConvertUtils.sourceToTarget(entity, InspectionSheetDTO.class);
 | 
			
		||||
        WorkingProcedure workingProcedure = workingProcedureService.selectById(dto.getWorkingProcedureId());
 | 
			
		||||
        if(workingProcedure!=null){
 | 
			
		||||
            dto.setWorkingProcedureName(workingProcedure.getName());
 | 
			
		||||
 | 
			
		||||
        if(dto.getWorkingProcedureId()!=null) {
 | 
			
		||||
            WorkingProcedure workingProcedure = workingProcedureService.selectById(dto.getWorkingProcedureId());
 | 
			
		||||
            if (workingProcedure != null) {
 | 
			
		||||
                dto.setWorkingProcedureName(workingProcedure.getName());
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return dto;
 | 
			
		||||
    }
 | 
			
		||||
@@ -149,11 +160,21 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
 | 
			
		||||
        params.put("inspectionStage", dto.getInspectionStage());
 | 
			
		||||
        List<ProductFeaturesDTO> inspectionSheetFeaturesList = getInspectionSheetFeaturesList(params);
 | 
			
		||||
        if (inspectionSheetFeaturesList != null && inspectionSheetFeaturesList.size() != 0) {
 | 
			
		||||
            //分组样本数=样本大小=检验特性分组数的最大值
 | 
			
		||||
            Integer numbersOfSamples = inspectionSheetFeaturesList.stream().max(Comparator.comparing(ProductFeaturesDTO::getSampleSize)).get().getSampleSize();
 | 
			
		||||
            if (numbersOfSamples != null) {
 | 
			
		||||
                dto.setNumberOfGroupedSamples(numbersOfSamples);
 | 
			
		||||
                dto.setNumberOfSamples(numbersOfSamples);
 | 
			
		||||
            //分组样本数 = 样本大小 = 检验特性分组数的最大值
 | 
			
		||||
            //Integer numbersOfSamples = inspectionSheetFeaturesList.stream().max(Comparator.comparing(ProductFeaturesDTO::getSampleSize)).get().getSampleSize();
 | 
			
		||||
            //过滤计量型特性
 | 
			
		||||
            List<ProductFeaturesDTO> featuresList = inspectionSheetFeaturesList.stream().filter(s-> s.getSampleSize()!=null && s.getType()==1).collect(Collectors.toList());
 | 
			
		||||
            if(featuresList != null && featuresList.size() != 0) {
 | 
			
		||||
                Integer numbersOfSamples = featuresList.stream().max(Comparator.comparing(ProductFeaturesDTO::getSampleSize)).get().getSampleSize();
 | 
			
		||||
                if (numbersOfSamples != null) {
 | 
			
		||||
                    dto.setNumberOfGroupedSamples(numbersOfSamples);
 | 
			
		||||
                    dto.setNumberOfSamples(numbersOfSamples);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            //若只有计数型特性,样本大小默认为1
 | 
			
		||||
            else{
 | 
			
		||||
                dto.setNumberOfGroupedSamples(1);
 | 
			
		||||
                dto.setNumberOfSamples(1);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        /*
 | 
			
		||||
@@ -171,6 +192,7 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
 | 
			
		||||
        //InspectionSheet entity = ConvertUtils.sourceToTarget(dto, InspectionSheet.class);
 | 
			
		||||
        InspectionSheet entity =  new InspectionSheet();
 | 
			
		||||
        BeanUtils.copyProperties(dto, entity);
 | 
			
		||||
        BaseSupportUtils.setCommonField(entity);
 | 
			
		||||
        return entity;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -178,6 +200,7 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void update(InspectionSheetDTO dto) {
 | 
			
		||||
        InspectionSheet entity = ConvertUtils.sourceToTarget(dto, InspectionSheet.class);
 | 
			
		||||
        BaseSupportUtils.setUpdateCommonField(entity);
 | 
			
		||||
        updateById(entity);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -209,7 +232,7 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
 | 
			
		||||
            queryDataParam.setMeasurement(workingProcedureName);
 | 
			
		||||
            //queryDataParam.setInspectionSheetId(inspectionSheetId);
 | 
			
		||||
            queryDataParam.setBucket("qgs-bucket");
 | 
			
		||||
            queryDataParam.setTag(new Tag("inspectionSheetId", inspectionSheetId));
 | 
			
		||||
            queryDataParam.setTags(Arrays.asList(new Tag("inspectionSheetId", inspectionSheetId)));
 | 
			
		||||
            List<String> dropNames = new ArrayList<>();
 | 
			
		||||
            dropNames.add("transationId");
 | 
			
		||||
            queryDataParam.setDropedTagNames(dropNames);
 | 
			
		||||
@@ -252,13 +275,16 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
 | 
			
		||||
                list.add(sampleDTO);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return list;
 | 
			
		||||
        //返回先按时间排序 再按样本号排序
 | 
			
		||||
        List<InspectionSampleDTO> sortedList = list.stream()
 | 
			
		||||
                .sorted(Comparator.comparing(InspectionSampleDTO::getSampleTime).thenComparing(InspectionSampleDTO::getSampleNumber))
 | 
			
		||||
                .collect(Collectors.toList());
 | 
			
		||||
        return sortedList;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void saveFluxParamList(InspectionSampleDTO[] lists) {
 | 
			
		||||
    public void saveFluxParamList(InspectionSampleDTO[] lists){
 | 
			
		||||
        for (InspectionSampleDTO dto : lists) {
 | 
			
		||||
            //String jsonData = {"workingProcedureName":"test","inspectionSheetId":"116","param1":"0.47","param2":"0.687","param2":"0.53"};
 | 
			
		||||
            String workingProcedureName = dto.getWorkingProcedureName();
 | 
			
		||||
            String inspectionSheetId = dto.getInspectionSheetId();
 | 
			
		||||
//            String batchNum = dto.getBatchNum();
 | 
			
		||||
@@ -286,6 +312,14 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
 | 
			
		||||
//        calculate(Long.valueOf(lists[0].getInspectionSheetId()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void saveFluxParamList2(InspectionSampleDTO2[] lists){
 | 
			
		||||
        for (InspectionSampleDTO2 dto : lists) {
 | 
			
		||||
            String workingProcedureName = dto.getWorkingProcedureName();
 | 
			
		||||
            InfluxClient.Client.batchInsert(dto.getEvents(), workingProcedureName);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private Event newEvent(Instant time, String inspectionSheetId, String argName, String argValue, String sampleNo) {
 | 
			
		||||
        Event event = new Event();
 | 
			
		||||
        event.setInspectionSheetId(inspectionSheetId);
 | 
			
		||||
@@ -315,111 +349,162 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
 | 
			
		||||
    //计算并更新检验单缺陷数不良数
 | 
			
		||||
    @Override
 | 
			
		||||
    public void calculate(Long inspectionSheetId) {
 | 
			
		||||
        List<InspectionSampleDTO> sampleDTOList = getFluxParamList(inspectionSheetId);
 | 
			
		||||
        List<InspectionSampleDTO3> sampleDTOList = getFluxParamList3(inspectionSheetId);
 | 
			
		||||
        if (sampleDTOList != null || sampleDTOList.size() > 0) {
 | 
			
		||||
            //缺陷
 | 
			
		||||
            Integer numberOfDefects = 0;
 | 
			
		||||
            //不良
 | 
			
		||||
            Integer defectiveQuantity = 0;
 | 
			
		||||
 | 
			
		||||
            //获取的产品特性参照值
 | 
			
		||||
            InspectionSheetDTO dto = get(inspectionSheetId);
 | 
			
		||||
            Map<String, Object> params2 = new HashMap<>();
 | 
			
		||||
            params2.put("productId", dto.getProductId());
 | 
			
		||||
            params2.put("workingProcedureId", dto.getWorkingProcedureId());
 | 
			
		||||
            params2.put("inspectionStage", dto.getInspectionStage());
 | 
			
		||||
            List<ProductFeaturesDTO> featuresList = getInspectionSheetFeaturesList(params2);
 | 
			
		||||
            Long productId = get(inspectionSheetId).getProductId();
 | 
			
		||||
            List<ProductFeaturesDTO> featuresList = productFeaturesService.getProductFeaturesByProductId(productId);
 | 
			
		||||
            Map<String, ProductFeaturesDTO> featureMap = featuresList.stream().collect(Collectors.groupingBy(ProductFeaturesDTO::getName, Collectors.collectingAndThen(Collectors.toList(), f -> f.get(0))));
 | 
			
		||||
            //循环每个样本组
 | 
			
		||||
            for (InspectionSampleDTO sampleDTO : sampleDTOList) {
 | 
			
		||||
            for (InspectionSampleDTO3 sampleDTO : sampleDTOList) {
 | 
			
		||||
                //该样本的缺陷数
 | 
			
		||||
                Integer eventDefects = 0;
 | 
			
		||||
                //该样本的属性列表
 | 
			
		||||
                String jsonData = sampleDTO.getJsonData();
 | 
			
		||||
                JSONObject json = JSON.parseObject(jsonData);
 | 
			
		||||
                for (ProductFeaturesDTO feature : featuresList) {
 | 
			
		||||
                    String v = (String)json.get(feature.getName());
 | 
			
		||||
                    if (!Objects.equals(v, "") && v != null) {
 | 
			
		||||
                List<SampleParam> sampleParamList = sampleDTO.getSampleParamList();
 | 
			
		||||
                for(SampleParam sampleParam : sampleParamList){
 | 
			
		||||
                    String argName = sampleParam.getArgName();
 | 
			
		||||
                    String argValue = sampleParam.getArgValue();
 | 
			
		||||
                    ProductFeaturesDTO feature = featureMap.get(argName);
 | 
			
		||||
                    //属性值非空 对应产品特性非空
 | 
			
		||||
                    if(!Objects.equals(argValue, "") && argValue != null && feature!=null){
 | 
			
		||||
                        //1 计量型;2 计数型
 | 
			
		||||
                        if (feature.getType() == 1) {
 | 
			
		||||
                            Double featureValue = Double.valueOf(v);
 | 
			
		||||
                            Double featureValue = Double.valueOf(argValue);
 | 
			
		||||
                            if (featureValue > feature.getUsl() || featureValue < feature.getLsl()) {
 | 
			
		||||
                                eventDefects = eventDefects + 1;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        if (feature.getType() == 2) {
 | 
			
		||||
                            Integer featureValue = Integer.valueOf(v);
 | 
			
		||||
                            if (featureValue == 1) {
 | 
			
		||||
                            Double featureValue = Double.valueOf(argValue);
 | 
			
		||||
                            if (featureValue == 0) {
 | 
			
		||||
                                eventDefects = eventDefects + 1;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    if (eventDefects != 0) {
 | 
			
		||||
                        numberOfDefects = numberOfDefects + eventDefects;
 | 
			
		||||
                        defectiveQuantity = defectiveQuantity + 1;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                //该样本是否有缺陷
 | 
			
		||||
                if (eventDefects != 0) {
 | 
			
		||||
                    numberOfDefects = numberOfDefects + eventDefects;
 | 
			
		||||
                    defectiveQuantity = defectiveQuantity + 1;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            InspectionSheetDTO updateDto = new InspectionSheetDTO();
 | 
			
		||||
            updateDto.setId(inspectionSheetId);
 | 
			
		||||
            updateDto.setNumberOfDefects(numberOfDefects);
 | 
			
		||||
            updateDto.setDefectiveQuantity(defectiveQuantity);
 | 
			
		||||
            BaseSupportUtils.setUpdateCommonField(updateDto);
 | 
			
		||||
            update(updateDto);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
        /*
 | 
			
		||||
        //获取该检验单的所有样本数据
 | 
			
		||||
        List<Event> eventList = getFluxParamList(inspectionSheetId);
 | 
			
		||||
        if (eventList != null || eventList.size() > 0) {
 | 
			
		||||
            //根据样本号分组
 | 
			
		||||
            Map<String, List<Event>> map = eventList.stream().collect(Collectors.groupingBy(Event::getSampleNumber));
 | 
			
		||||
            //获取的产品特性参照值
 | 
			
		||||
            InspectionSheetDTO dto = get(inspectionSheetId);
 | 
			
		||||
            Map<String, Object> params2 = new HashMap<>();
 | 
			
		||||
            params2.put("productId", dto.getProductId());
 | 
			
		||||
            params2.put("workingProcedureId", dto.getWorkingProcedureId());
 | 
			
		||||
            params2.put("inspectionStage", dto.getInspectionStage());
 | 
			
		||||
            //缺陷
 | 
			
		||||
            Integer numberOfDefects = 0;
 | 
			
		||||
            //不良
 | 
			
		||||
            Integer defectiveQuantity = 0;
 | 
			
		||||
 | 
			
		||||
            List<ProductFeaturesDTO> featuresList = getInspectionSheetFeaturesList(params2);
 | 
			
		||||
            //循环每个样本组
 | 
			
		||||
            for (Map.Entry<String, List<Event>> entry : map.entrySet()) {
 | 
			
		||||
                //该样本的缺陷数
 | 
			
		||||
                Integer eventDefects = 0;
 | 
			
		||||
                //该样本的属性列表
 | 
			
		||||
                List<Event> eventList1 = entry.getValue();
 | 
			
		||||
                for (Event event : eventList1) {
 | 
			
		||||
                    String featureName = event.getArgName();
 | 
			
		||||
                    ProductFeaturesDTO feature = featuresList.stream().filter(u -> u.getName().equals(featureName)).findAny().orElse(null);
 | 
			
		||||
                    if (feature != null && !Objects.equals(event.getArgValue(), "") && event.getArgValue() != null) {
 | 
			
		||||
                        //1 计量型;2 计数型
 | 
			
		||||
                        if (feature.getType() == 1) {
 | 
			
		||||
                            Double featureValue = Double.valueOf(event.getArgValue());
 | 
			
		||||
                            if (featureValue > feature.getUsl() || featureValue < feature.getLsl()) {
 | 
			
		||||
                                eventDefects = eventDefects + 1;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        if (feature.getType() == 2) {
 | 
			
		||||
                            Integer featureValue = Integer.valueOf(event.getArgValue());
 | 
			
		||||
                            if (featureValue == 1) {
 | 
			
		||||
                                eventDefects = eventDefects + 1;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    if (eventDefects != 0) {
 | 
			
		||||
                        numberOfDefects = numberOfDefects + eventDefects;
 | 
			
		||||
                        defectiveQuantity = defectiveQuantity + 1;
 | 
			
		||||
                    }
 | 
			
		||||
    @Override
 | 
			
		||||
    public void saveFluxParamList3(InspectionSampleDTO3[] lists){
 | 
			
		||||
        for (InspectionSampleDTO3 dto : lists) {
 | 
			
		||||
            String inspectionSheetId = dto.getInspectionSheetId();
 | 
			
		||||
            Instant eventTime = dto.getSampleTime();
 | 
			
		||||
            String sampleNumber = dto.getSampleNumber();
 | 
			
		||||
 | 
			
		||||
            List<SampleParam> sampleParamList = dto.getSampleParamList();
 | 
			
		||||
            for(SampleParam sampleParam : sampleParamList){
 | 
			
		||||
                String workingProcedureName = sampleParam.getWorkingProcedureName();
 | 
			
		||||
                String paramName = sampleParam.getArgName();
 | 
			
		||||
                String paramValue = sampleParam.getArgValue();
 | 
			
		||||
                Event event = newEvent(eventTime, inspectionSheetId, paramName, paramValue, sampleNumber);
 | 
			
		||||
                InfluxClient.Client.insert(event, workingProcedureName);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<InspectionSampleDTO3> getFluxParamList3(Long id) {
 | 
			
		||||
        List<Sample> sampleList = new ArrayList<>();
 | 
			
		||||
        //获取influx查询参数
 | 
			
		||||
        InspectionSheetDTO dto = get(id);
 | 
			
		||||
        if(dto!=null){
 | 
			
		||||
            //检验单-单一工序
 | 
			
		||||
            if(dto.getWorkingProcedureName()!=null){
 | 
			
		||||
                String workingProcedureName = dto.getWorkingProcedureName();
 | 
			
		||||
                sampleList = getEventList(id.toString(),workingProcedureName);
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
            //检验单-所有工序
 | 
			
		||||
            else {
 | 
			
		||||
                List<WorkingProcedureDTO> workingProcedureDTOList = workingProcedureService.getWorkingProcedureByProductId(dto.getProductId());
 | 
			
		||||
                for(WorkingProcedureDTO workingProcedureDTO:workingProcedureDTOList){
 | 
			
		||||
                    List<Sample> sampleList1 = getEventList(id.toString(),workingProcedureDTO.getName());
 | 
			
		||||
                    sampleList.addAll(sampleList1);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            InspectionSheetDTO updateDto = new InspectionSheetDTO();
 | 
			
		||||
            updateDto.setId(inspectionSheetId);
 | 
			
		||||
            updateDto.setNumberOfDefects(numberOfDefects);
 | 
			
		||||
            updateDto.setDefectiveQuantity(defectiveQuantity);
 | 
			
		||||
            update(updateDto);
 | 
			
		||||
        }
 | 
			
		||||
    }*/
 | 
			
		||||
        List<InspectionSampleDTO3> list = new ArrayList<>();
 | 
			
		||||
        if (sampleList != null || sampleList.size() > 0) {
 | 
			
		||||
            //根据样本号分组
 | 
			
		||||
            Map<String, List<Sample>> map = sampleList.stream().collect(Collectors.groupingBy(Sample::getSampleNumber));
 | 
			
		||||
            for (Map.Entry<String, List<Sample>> entry : map.entrySet()) {
 | 
			
		||||
                String sampleNumber = entry.getKey();
 | 
			
		||||
                List<Sample> samples = entry.getValue();
 | 
			
		||||
                InspectionSampleDTO3 sampleDTO = new InspectionSampleDTO3();
 | 
			
		||||
                sampleDTO.setSampleNumber(sampleNumber);
 | 
			
		||||
                sampleDTO.setSampleTime(samples.get(0).getSampleTime());
 | 
			
		||||
                sampleDTO.setBatchNum(dto.getBatchNumber());
 | 
			
		||||
                sampleDTO.setInspectionSheetId(samples.get(0).getInspectionSheetId());
 | 
			
		||||
                List<SampleParam> sampleParamList = new ArrayList<>();
 | 
			
		||||
                for(Sample sample:samples){
 | 
			
		||||
                    SampleParam sampleParam = new SampleParam();
 | 
			
		||||
                    sampleParam.setArgName(sample.getArgName());
 | 
			
		||||
                    sampleParam.setArgValue(sample.getArgValue());
 | 
			
		||||
                    sampleParam.setWorkingProcedureName(sample.getWorkingProcedureName());
 | 
			
		||||
                    sampleParamList.add(sampleParam);
 | 
			
		||||
                }
 | 
			
		||||
                sampleDTO.setSampleParamList(sampleParamList);
 | 
			
		||||
                list.add(sampleDTO);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        //返回先按时间排序 再按样本号排序
 | 
			
		||||
        List<InspectionSampleDTO3> sortedList = list.stream()
 | 
			
		||||
                .sorted(Comparator.comparing(InspectionSampleDTO3::getSampleTime).thenComparing(InspectionSampleDTO3::getSampleNumber))
 | 
			
		||||
                .collect(Collectors.toList());
 | 
			
		||||
        return sortedList;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private List<Sample> getEventList(String inspectionSheetId, String workingProcedureName) {
 | 
			
		||||
        List<Sample> sampleList = new ArrayList<>();
 | 
			
		||||
        QueryDataParam queryDataParam = new QueryDataParam();
 | 
			
		||||
        queryDataParam.setMeasurement(workingProcedureName);
 | 
			
		||||
        queryDataParam.setBucket("qgs-bucket");
 | 
			
		||||
        queryDataParam.setTags(Arrays.asList(new Tag("inspectionSheetId", inspectionSheetId)));
 | 
			
		||||
        List<String> dropNames = new ArrayList<>();
 | 
			
		||||
        dropNames.add("transationId");
 | 
			
		||||
        queryDataParam.setDropedTagNames(dropNames);
 | 
			
		||||
        queryDataParam.setRange(new Range(DataUtils.getBeforeDate(999).toInstant(), DataUtils.getAfterDate(999).toInstant()));
 | 
			
		||||
        queryDataParam.setPageInfo(new PageInfo(1, 10));
 | 
			
		||||
        List<FluxTable> fluxTableList = InfluxClient.Client.query(queryDataParam);
 | 
			
		||||
        for (FluxTable fluxTable : fluxTableList) {
 | 
			
		||||
            List<FluxRecord> records = fluxTable.getRecords(); // 获取实际的记录操作
 | 
			
		||||
            for (FluxRecord fluxRecord : records) {
 | 
			
		||||
                Instant time = fluxRecord.getTime();
 | 
			
		||||
                String argName = (String) fluxRecord.getValueByKey("argName");
 | 
			
		||||
                String argValue = (String) fluxRecord.getValueByKey("_value");
 | 
			
		||||
                String sampleNo = (String) fluxRecord.getValueByKey("sampleNumber");
 | 
			
		||||
                sampleList.add(newSample(time, inspectionSheetId, workingProcedureName, argName, argValue, sampleNo));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return sampleList;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private Sample newSample(Instant time, String inspectionSheetId, String workingProcedureName, String argName, String argValue, String sampleNo) {
 | 
			
		||||
        Sample sample = new Sample();
 | 
			
		||||
        sample.setInspectionSheetId(inspectionSheetId);
 | 
			
		||||
        sample.setWorkingProcedureName(workingProcedureName);
 | 
			
		||||
        sample.setSampleTime(time);
 | 
			
		||||
        sample.setSampleNumber(sampleNo);
 | 
			
		||||
        sample.setArgName(argName);
 | 
			
		||||
        sample.setArgValue(argValue);
 | 
			
		||||
        return sample;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -83,9 +83,10 @@
 | 
			
		||||
    </select>
 | 
			
		||||
 | 
			
		||||
    <select id="getInspectionSheetFeaturesList" resultType="com.cnbm.basic.dto.ProductFeaturesDTO">
 | 
			
		||||
        select pf.*
 | 
			
		||||
        select pf.*,fspr.working_procedure_id AS workingProcedureId,wp.name AS workingProcedureName
 | 
			
		||||
        from features_stage_procedure_relation fspr
 | 
			
		||||
        LEFT JOIN product_features pf ON pf.id=fspr.product_features_id
 | 
			
		||||
        LEFT JOIN working_procedure wp ON fspr.working_procedure_id=wp.id
 | 
			
		||||
        <where>
 | 
			
		||||
            pf.valid = 1 and fspr.valid = 1
 | 
			
		||||
            <if test="productId != null">
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,6 @@
 | 
			
		||||
package com.cnbm.qualityPlanning.entity;
 | 
			
		||||
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -20,6 +21,13 @@ public class XMRPoint extends Point {
 | 
			
		||||
    //xbar 不满足 的 判读方案
 | 
			
		||||
    private Set<Integer> rsUnsatisfiedRules;
 | 
			
		||||
 | 
			
		||||
    public XMRPoint(Integer position, Double value, Double x, Double rs) {
 | 
			
		||||
        super(position,value);
 | 
			
		||||
        this.x = x;
 | 
			
		||||
        this.rs = rs;
 | 
			
		||||
        xUnsatisfiedRules = new HashSet<Integer>();
 | 
			
		||||
        rsUnsatisfiedRules = new HashSet<Integer>();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void setValueToTest(Double value){
 | 
			
		||||
        setValueForInterpretation(value);
 | 
			
		||||
@@ -57,11 +65,7 @@ public class XMRPoint extends Point {
 | 
			
		||||
        this.rs = rs;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public XMRPoint(Integer position, Double value, Double x, Double rs) {
 | 
			
		||||
        super(position,value);
 | 
			
		||||
        this.x = x;
 | 
			
		||||
        this.rs = rs;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Integer getPosition() {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
package com.cnbm.qualityPlanning.entity;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
 | 
			
		||||
@@ -21,7 +22,14 @@ public class XbarRPoint extends Point {
 | 
			
		||||
    private Set<Integer> rUnsatisfiedRules;
 | 
			
		||||
    //xbar 不满足 的 判读方案
 | 
			
		||||
    private Set<Integer> xbarUnsatisfiedRules;
 | 
			
		||||
 | 
			
		||||
    public XbarRPoint(Integer position, Double value, Double xbar, Double r, List<Double> data) {
 | 
			
		||||
        super(position,value);
 | 
			
		||||
        this.xbar = xbar;
 | 
			
		||||
        this.r = r;
 | 
			
		||||
        this.data = data;
 | 
			
		||||
        rUnsatisfiedRules = new HashSet<Integer>();
 | 
			
		||||
        xbarUnsatisfiedRules = new HashSet<Integer>();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void setValueToTest(Double value){
 | 
			
		||||
        setValueForInterpretation(value);
 | 
			
		||||
@@ -68,12 +76,7 @@ public class XbarRPoint extends Point {
 | 
			
		||||
        this.r = r;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public XbarRPoint(Integer position, Double value, Double xbar, Double r, List<Double> data) {
 | 
			
		||||
        super(position,value);
 | 
			
		||||
        this.xbar = xbar;
 | 
			
		||||
        this.r = r;
 | 
			
		||||
        this.data = data;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Integer getPosition() {
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,7 @@ package com.cnbm.qualityPlanning.entity;
 | 
			
		||||
import io.swagger.models.auth.In;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
 | 
			
		||||
@@ -20,12 +21,21 @@ public class XbarSPoint extends Point {
 | 
			
		||||
    public XbarSPoint(Integer position, Double value) {
 | 
			
		||||
        super(position, value);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //s    不满足 的 判读方案
 | 
			
		||||
    private Set<Integer> sUnsatisfiedRules;
 | 
			
		||||
    //xbar 不满足 的 判读方案
 | 
			
		||||
    private Set<Integer> xbarUnsatisfiedRules;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public XbarSPoint(Integer position, Double value, Double xbar, Double s, Double r,List<Double> data) {
 | 
			
		||||
        super(position,value);
 | 
			
		||||
        this.xbar = xbar;
 | 
			
		||||
        this.s = s;
 | 
			
		||||
        this.r = r;
 | 
			
		||||
        this.data = data;
 | 
			
		||||
        sUnsatisfiedRules = new HashSet<Integer>();
 | 
			
		||||
        xbarUnsatisfiedRules = new HashSet<Integer>();
 | 
			
		||||
    }
 | 
			
		||||
    private void setValueToTest(Double value){
 | 
			
		||||
        setValueForInterpretation(value);
 | 
			
		||||
    }
 | 
			
		||||
@@ -78,13 +88,7 @@ public class XbarSPoint extends Point {
 | 
			
		||||
        this.r = r;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public XbarSPoint(Integer position, Double value, Double xbar, Double s, Double r,List<Double> data) {
 | 
			
		||||
        super(position,value);
 | 
			
		||||
        this.xbar = xbar;
 | 
			
		||||
        this.s = s;
 | 
			
		||||
        this.r = r;
 | 
			
		||||
        this.data = data;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Integer getPosition() {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user