质量计划

This commit is contained in:
2022-09-30 08:54:33 +08:00
parent 7abcafb93d
commit a3cc4df25c
33 changed files with 249 additions and 25 deletions

View File

@@ -124,4 +124,10 @@ public class FactoryController {
return new Result();
}
@PostMapping(value = "list")
@ApiOperation(value = "获取工厂列表")
@LogOperation("获取工厂列表")
public List<FactoryDTO> list() {
return factoryService.list();
}
}

View File

@@ -48,6 +48,8 @@ public class MachineController {
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class),
@ApiImplicitParam(name = "name", value = "名称", paramType = "query", dataTypeClass = String.class),
@ApiImplicitParam(name = "code", value = "编码", paramType = "query", dataTypeClass = String.class),
@ApiImplicitParam(name = "status", value = "状态", paramType = "query", dataTypeClass = Integer.class)
})
@PreAuthorize("@ex.hasAuthority('basic:machine:page')")

View File

@@ -48,6 +48,8 @@ public class PlatformController {
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class),
@ApiImplicitParam(name = "name", value = "名称", paramType = "query", dataTypeClass = String.class),
@ApiImplicitParam(name = "code", value = "编码", paramType = "query", dataTypeClass = String.class),
@ApiImplicitParam(name = "status", value = "状态", paramType = "query", dataTypeClass = Integer.class)
})
@PreAuthorize("@ex.hasAuthority('basic:platform:page')")

View File

@@ -1,6 +1,7 @@
package com.cnbm.basic.controller;
import com.cnbm.admin.annotation.LogOperation;
import com.cnbm.basic.dto.ProductWorkingprocedureRelationDTO;
import com.cnbm.common.constant.Constant;
import com.cnbm.common.page.PageData;
import com.cnbm.common.utils.ExcelUtils;
@@ -114,4 +115,14 @@ public class ProductFactoryRelationController {
ExcelUtils.exportExcelToTarget(response, null, list, ProductFactoryRelationExcel.class);
}
@PostMapping("batchInsertFactory")
@ApiOperation("添加多个工厂关联")
@LogOperation("添加多个工厂关联")
public Result batchInsertFactory(@RequestBody ProductFactoryRelationDTO[] lists){
productFactoryRelationService.batchInsertFactory(lists);
return new Result();
}
}

View File

@@ -50,6 +50,8 @@ public class UnitController {
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class),
@ApiImplicitParam(name = "name", value = "名称", paramType = "query", dataTypeClass = String.class),
@ApiImplicitParam(name = "code", value = "编码", paramType = "query", dataTypeClass = String.class),
@ApiImplicitParam(name = "status", value = "状态", paramType = "query", dataTypeClass = Integer.class)
})
@PreAuthorize("@ex.hasAuthority('basic:unit:page')")

View File

@@ -49,6 +49,8 @@ public class WorkingProcedureTypeController {
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class),
@ApiImplicitParam(name = "name", value = "名称", paramType = "query", dataTypeClass = String.class),
@ApiImplicitParam(name = "code", value = "编码", paramType = "query", dataTypeClass = String.class),
@ApiImplicitParam(name = "status", value = "状态", paramType = "query", dataTypeClass = Integer.class)
})
@PreAuthorize("@ex.hasAuthority('basic:workingProcedureType:page')")

View File

@@ -6,6 +6,7 @@ import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
/**
@@ -82,4 +83,7 @@ public class ProductDTO implements Serializable {
@ApiModelProperty(value = "版本号")
private Integer version;
@ApiModelProperty(value = "工厂")
private List<Long> factoryList;
}

View File

@@ -4,6 +4,8 @@ import com.cnbm.common.dao.BaseDao;
import com.cnbm.basic.entity.ProductFactoryRelation;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 产品-工厂 关系表
*
@@ -12,5 +14,5 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface ProductFactoryRelationMapper extends BaseDao<ProductFactoryRelation> {
List<Long> getFactoryListByProductId(Long productId);
}

View File

@@ -23,4 +23,6 @@ public interface ProductFeaturesMapper extends BaseDao<ProductFeatures> {
List<FeaturesProcedureDTO> getFeaturesByStageProcedure(Map<String, Object> params);
List<ProductFeaturesDTO> getFeaturesList(Map<String, Object> params);
String getControlGraphNameById(Long id);
}

View File

@@ -1,5 +1,6 @@
package com.cnbm.basic.service;
import com.cnbm.basic.dto.ProductWorkingprocedureRelationDTO;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.CrudService;
import com.cnbm.basic.dto.ProductFactoryRelationDTO;
@@ -25,4 +26,6 @@ public interface IProductFactoryRelationService extends CrudService<ProductFacto
void delete(Long[] ids);
void batchInsertFactory(ProductFactoryRelationDTO[] lists);
}

View File

@@ -12,6 +12,7 @@ import com.cnbm.basic.mapper.MachineMapper;
import com.cnbm.basic.entity.Machine;
import com.cnbm.basic.service.IMachineService;
import com.cnbm.common.utils.ConvertUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -36,8 +37,12 @@ public class MachineServiceImpl extends CrudServiceImpl<MachineMapper, Machine,
@Override
public QueryWrapper<Machine> getWrapper(Map<String, Object> params){
String name = (String)params.get("name");
String code = (String)params.get("code");
QueryWrapper<Machine> wrapper = new QueryWrapper<>();
wrapper.like(StringUtils.isNotBlank(name), "name", name);
wrapper.like(StringUtils.isNotBlank(code), "code", code);
wrapper.eq(ObjectUtils.isNotNull(params.get("status")), "status", params.get("status"));
return wrapper;

View File

@@ -34,8 +34,12 @@ private PlatformMapper mapper;
@Override
public QueryWrapper<Platform> getWrapper(Map<String, Object> params){
String name = (String)params.get("name");
String code = (String)params.get("code");
QueryWrapper<Platform> wrapper = new QueryWrapper<>();
wrapper.like(StringUtils.isNotBlank(name), "name", name);
wrapper.like(StringUtils.isNotBlank(code), "code", code);
wrapper.eq(ObjectUtils.isNotNull(params.get("status")), "status", params.get("status"));
return wrapper;

View File

@@ -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.basic.dto.ProductWorkingprocedureRelationDTO;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.basic.dto.ProductFactoryRelationDTO;
@@ -9,6 +10,9 @@ import com.cnbm.basic.mapper.ProductFactoryRelationMapper;
import com.cnbm.basic.entity.ProductFactoryRelation;
import com.cnbm.basic.service.IProductFactoryRelationService;
import com.cnbm.common.utils.ConvertUtils;
import com.cnbm.common.validator.ValidatorUtils;
import com.cnbm.common.validator.group.AddGroup;
import com.cnbm.common.validator.group.DefaultGroup;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -71,4 +75,13 @@ public class ProductFactoryRelationServiceImpl extends CrudServiceImpl<ProductFa
deleteBatchIds(Arrays.asList(ids));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void batchInsertFactory(ProductFactoryRelationDTO[] lists) {
for(ProductFactoryRelationDTO dto:lists){
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
save(dto);
}
}
}

View File

@@ -74,6 +74,16 @@ public class ProductFeaturesServiceImpl extends CrudServiceImpl<ProductFeaturesM
@Override
@Transactional(rollbackFor = Exception.class)
public void update(ProductFeaturesDTO dto) {
//若控制图配置为“单值移动极差”样本量为1
// if (dto.getControlGraphName()=="单值移动极差"){
// dto.setSampleSize(1);
// }
if(dto.getControlGraphId()!=null){
String controlGraphName = mapper.getControlGraphNameById(dto.getControlGraphId());
if((controlGraphName!=null) && (controlGraphName.equals("单值移动极差"))) {
dto.setSampleSize(1);
}
}
//当产品特性出现update的时候就会把旧数据 全量备份到这张表
ProductFeatures oentity = baseDao.selectById(dto.getId());
ProductFeaturesHisDTO history = ConvertUtils.sourceToTarget(oentity, ProductFeaturesHisDTO.class);

View File

@@ -5,6 +5,7 @@ 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.basic.entity.ProductType;
import com.cnbm.basic.mapper.ProductFactoryRelationMapper;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.basic.dto.ProductDTO;
@@ -20,6 +21,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
@@ -46,7 +48,7 @@ public class ProductServiceImpl extends CrudServiceImpl<ProductMapper, Product,
wrapper.like(StringUtils.isNotBlank(code), "code", code);
wrapper.eq(ObjectUtils.isNotNull(params.get("status")), "status", params.get("status"));
wrapper.eq(ObjectUtils.isNotNull(params.get("product_type_id")), "product_type_id", params.get("product_type_id"));
wrapper.eq(StringUtils.isNotBlank(inspection_stage), "inspection_stage", inspection_stage);
wrapper.like(StringUtils.isNotBlank(inspection_stage), "inspection_stage", inspection_stage);
return wrapper;
}
@@ -76,10 +78,18 @@ public class ProductServiceImpl extends CrudServiceImpl<ProductMapper, Product,
return productDTOPageData;
}
@Autowired
private ProductFactoryRelationMapper relationMapper;
@Override
public ProductDTO get(Long id) {
Product entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, ProductDTO.class);
ProductDTO dto = ConvertUtils.sourceToTarget(entity, ProductDTO.class);
List<Long> factoryList = relationMapper.getFactoryListByProductId(id);
dto.setFactoryList(factoryList);
//return ConvertUtils.sourceToTarget(entity, ProductDTO.class);
return dto;
}
@Override

View File

@@ -11,6 +11,7 @@ import com.cnbm.basic.entity.Unit;
import com.cnbm.basic.mapper.UnitMapper;
import com.cnbm.basic.service.IUnitService;
import com.cnbm.common.utils.ConvertUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -33,8 +34,12 @@ public class UnitServiceImpl extends CrudServiceImpl<UnitMapper, Unit, UnitDTO>
@Override
public QueryWrapper<Unit> getWrapper(Map<String, Object> params){
String name = (String)params.get("name");
String code = (String)params.get("code");
QueryWrapper<Unit> wrapper = new QueryWrapper<>();
wrapper.like(StringUtils.isNotBlank(name), "name", name);
wrapper.like(StringUtils.isNotBlank(code), "code", code);
wrapper.eq(ObjectUtils.isNotNull(params.get("status")), "status", params.get("status"));
return wrapper;

View File

@@ -29,8 +29,12 @@ public class WorkingProcedureTypeServiceImpl extends CrudServiceImpl<WorkingProc
@Override
public QueryWrapper<WorkingProcedureType> getWrapper(Map<String, Object> params){
String name = (String)params.get("name");
String code = (String)params.get("code");
QueryWrapper<WorkingProcedureType> wrapper = new QueryWrapper<>();
wrapper.like(StringUtils.isNotBlank(name), "name", name);
wrapper.like(StringUtils.isNotBlank(code), "code", code);
wrapper.eq(ObjectUtils.isNotNull(params.get("status")), "status", params.get("status"));
return wrapper;

View File

@@ -2,4 +2,9 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cnbm.basic.mapper.ProductFactoryRelationMapper">
<select id="getFactoryListByProductId" resultType="Long">
select factory_id from product_factory_relation
where product_id = #{productId}
</select>
</mapper>

View File

@@ -69,4 +69,8 @@
</where>
order by pf.id asc
</select>
<select id="getControlGraphNameById" resultType="String">
select name from control_graph where id = #{id}
</select>
</mapper>