Merge pull request '质量计划' (#11) from yanyang into master

Reviewed-on: #11
This commit is contained in:
闫阳 2022-09-30 08:56:37 +08:00
commit e6b5583d05
33 changed files with 249 additions and 25 deletions

View File

@ -124,4 +124,10 @@ public class FactoryController {
return new Result(); 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.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.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 = 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) @ApiImplicitParam(name = "status", value = "状态", paramType = "query", dataTypeClass = Integer.class)
}) })
@PreAuthorize("@ex.hasAuthority('basic:machine:page')") @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.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.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 = 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) @ApiImplicitParam(name = "status", value = "状态", paramType = "query", dataTypeClass = Integer.class)
}) })
@PreAuthorize("@ex.hasAuthority('basic:platform:page')") @PreAuthorize("@ex.hasAuthority('basic:platform:page')")

View File

@ -1,6 +1,7 @@
package com.cnbm.basic.controller; package com.cnbm.basic.controller;
import com.cnbm.admin.annotation.LogOperation; import com.cnbm.admin.annotation.LogOperation;
import com.cnbm.basic.dto.ProductWorkingprocedureRelationDTO;
import com.cnbm.common.constant.Constant; import com.cnbm.common.constant.Constant;
import com.cnbm.common.page.PageData; import com.cnbm.common.page.PageData;
import com.cnbm.common.utils.ExcelUtils; import com.cnbm.common.utils.ExcelUtils;
@ -114,4 +115,14 @@ public class ProductFactoryRelationController {
ExcelUtils.exportExcelToTarget(response, null, list, ProductFactoryRelationExcel.class); 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.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.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 = 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) @ApiImplicitParam(name = "status", value = "状态", paramType = "query", dataTypeClass = Integer.class)
}) })
@PreAuthorize("@ex.hasAuthority('basic:unit:page')") @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.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.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 = 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) @ApiImplicitParam(name = "status", value = "状态", paramType = "query", dataTypeClass = Integer.class)
}) })
@PreAuthorize("@ex.hasAuthority('basic:workingProcedureType:page')") @PreAuthorize("@ex.hasAuthority('basic:workingProcedureType:page')")

View File

@ -6,6 +6,7 @@ import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
/** /**
@ -82,4 +83,7 @@ public class ProductDTO implements Serializable {
@ApiModelProperty(value = "版本号") @ApiModelProperty(value = "版本号")
private Integer version; 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 com.cnbm.basic.entity.ProductFactoryRelation;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* 产品-工厂 关系表 * 产品-工厂 关系表
* *
@ -12,5 +14,5 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface ProductFactoryRelationMapper extends BaseDao<ProductFactoryRelation> { 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<FeaturesProcedureDTO> getFeaturesByStageProcedure(Map<String, Object> params);
List<ProductFeaturesDTO> getFeaturesList(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; package com.cnbm.basic.service;
import com.cnbm.basic.dto.ProductWorkingprocedureRelationDTO;
import com.cnbm.common.page.PageData; import com.cnbm.common.page.PageData;
import com.cnbm.common.service.CrudService; import com.cnbm.common.service.CrudService;
import com.cnbm.basic.dto.ProductFactoryRelationDTO; import com.cnbm.basic.dto.ProductFactoryRelationDTO;
@ -25,4 +26,6 @@ public interface IProductFactoryRelationService extends CrudService<ProductFacto
void delete(Long[] ids); 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.entity.Machine;
import com.cnbm.basic.service.IMachineService; import com.cnbm.basic.service.IMachineService;
import com.cnbm.common.utils.ConvertUtils; import com.cnbm.common.utils.ConvertUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -36,8 +37,12 @@ public class MachineServiceImpl extends CrudServiceImpl<MachineMapper, Machine,
@Override @Override
public QueryWrapper<Machine> getWrapper(Map<String, Object> params){ 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<>(); 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")); wrapper.eq(ObjectUtils.isNotNull(params.get("status")), "status", params.get("status"));
return wrapper; return wrapper;

View File

@ -34,8 +34,12 @@ private PlatformMapper mapper;
@Override @Override
public QueryWrapper<Platform> getWrapper(Map<String, Object> params){ 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<>(); 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")); wrapper.eq(ObjectUtils.isNotNull(params.get("status")), "status", params.get("status"));
return wrapper; 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.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cnbm.basic.dto.ProductWorkingprocedureRelationDTO;
import com.cnbm.common.page.PageData; import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl; import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.basic.dto.ProductFactoryRelationDTO; 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.entity.ProductFactoryRelation;
import com.cnbm.basic.service.IProductFactoryRelationService; import com.cnbm.basic.service.IProductFactoryRelationService;
import com.cnbm.common.utils.ConvertUtils; 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.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -71,4 +75,13 @@ public class ProductFactoryRelationServiceImpl extends CrudServiceImpl<ProductFa
deleteBatchIds(Arrays.asList(ids)); 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 @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(ProductFeaturesDTO dto) { 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的时候就会把旧数据 全量备份到这张表 //当产品特性出现update的时候就会把旧数据 全量备份到这张表
ProductFeatures oentity = baseDao.selectById(dto.getId()); ProductFeatures oentity = baseDao.selectById(dto.getId());
ProductFeaturesHisDTO history = ConvertUtils.sourceToTarget(oentity, ProductFeaturesHisDTO.class); 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.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cnbm.basic.entity.ProductType; import com.cnbm.basic.entity.ProductType;
import com.cnbm.basic.mapper.ProductFactoryRelationMapper;
import com.cnbm.common.page.PageData; import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl; import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.basic.dto.ProductDTO; import com.cnbm.basic.dto.ProductDTO;
@ -20,6 +21,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -46,7 +48,7 @@ public class ProductServiceImpl extends CrudServiceImpl<ProductMapper, Product,
wrapper.like(StringUtils.isNotBlank(code), "code", code); wrapper.like(StringUtils.isNotBlank(code), "code", code);
wrapper.eq(ObjectUtils.isNotNull(params.get("status")), "status", params.get("status")); 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(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; return wrapper;
} }
@ -76,10 +78,18 @@ public class ProductServiceImpl extends CrudServiceImpl<ProductMapper, Product,
return productDTOPageData; return productDTOPageData;
} }
@Autowired
private ProductFactoryRelationMapper relationMapper;
@Override @Override
public ProductDTO get(Long id) { public ProductDTO get(Long id) {
Product entity = baseDao.selectById(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 @Override

View File

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

View File

@ -29,8 +29,12 @@ public class WorkingProcedureTypeServiceImpl extends CrudServiceImpl<WorkingProc
@Override @Override
public QueryWrapper<WorkingProcedureType> getWrapper(Map<String, Object> params){ 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<>(); 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")); wrapper.eq(ObjectUtils.isNotNull(params.get("status")), "status", params.get("status"));
return wrapper; 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"> <!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"> <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> </mapper>

View File

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

View File

@ -49,7 +49,7 @@ public class ControlGraphController {
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class), @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class),
@ApiImplicitParam(name = "type", value = "产品特征类型", paramType = "query", dataTypeClass = Integer.class) @ApiImplicitParam(name = "type", value = "产品特征类型", paramType = "query", dataTypeClass = Integer.class)
}) })
@PreAuthorize("@ex.hasAuthority('code:controlGraph:page')") @PreAuthorize("@ex.hasAuthority('qualityPlanning:controlGraph:page')")
public Result<PageData<ControlGraphDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ public Result<PageData<ControlGraphDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<ControlGraphDTO> page = controlGraphService.page(params); PageData<ControlGraphDTO> page = controlGraphService.page(params);
@ -58,7 +58,7 @@ public class ControlGraphController {
@GetMapping("{id}") @GetMapping("{id}")
@ApiOperation("信息") @ApiOperation("信息")
@PreAuthorize("@ex.hasAuthority('code:controlGraph:info')") @PreAuthorize("@ex.hasAuthority('qualityPlanning:controlGraph:info')")
public Result<ControlGraphDTO> get(@PathVariable("id") Long id){ public Result<ControlGraphDTO> get(@PathVariable("id") Long id){
ControlGraphDTO data = controlGraphService.get(id); ControlGraphDTO data = controlGraphService.get(id);
@ -68,7 +68,7 @@ public class ControlGraphController {
@PostMapping @PostMapping
@ApiOperation("保存") @ApiOperation("保存")
@LogOperation("保存") @LogOperation("保存")
@PreAuthorize("@ex.hasAuthority('code:controlGraph:save')") @PreAuthorize("@ex.hasAuthority('qualityPlanning:controlGraph:save')")
public Result<Long> save(@RequestBody ControlGraphDTO dto){ public Result<Long> save(@RequestBody ControlGraphDTO dto){
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
@ -81,7 +81,7 @@ public class ControlGraphController {
@PutMapping @PutMapping
@ApiOperation("修改") @ApiOperation("修改")
@LogOperation("修改") @LogOperation("修改")
@PreAuthorize("@ex.hasAuthority('code:controlGraph:update')") @PreAuthorize("@ex.hasAuthority('qualityPlanning:controlGraph:update')")
public Result<Long> update(@RequestBody ControlGraphDTO dto){ public Result<Long> update(@RequestBody ControlGraphDTO dto){
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -94,7 +94,7 @@ public class ControlGraphController {
@DeleteMapping @DeleteMapping
@ApiOperation("删除") @ApiOperation("删除")
@LogOperation("删除") @LogOperation("删除")
@PreAuthorize("@ex.hasAuthority('code:controlGraph:delete')") @PreAuthorize("@ex.hasAuthority('qualityPlanning:controlGraph:delete')")
public Result delete(@RequestBody Long[] ids){ public Result delete(@RequestBody Long[] ids){
//效验数据 //效验数据
AssertUtils.isArrayEmpty(ids, "id"); AssertUtils.isArrayEmpty(ids, "id");
@ -107,7 +107,7 @@ public class ControlGraphController {
@GetMapping("export") @GetMapping("export")
@ApiOperation("导出") @ApiOperation("导出")
@LogOperation("导出") @LogOperation("导出")
@PreAuthorize("@ex.hasAuthority('code:controlGraph:export')") @PreAuthorize("@ex.hasAuthority('qualityPlanning:controlGraph:export')")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<ControlGraphDTO> list = controlGraphService.list(params); List<ControlGraphDTO> list = controlGraphService.list(params);

View File

@ -92,6 +92,15 @@ public class InterpretationSchemeController {
return new Result<Long>().ok(dto.getId()); return new Result<Long>().ok(dto.getId());
} }
@PutMapping("batchUpdate")
@ApiOperation("批量修改")
public Result batchupdate(@RequestBody InterpretationSchemeDTO[] lists){
interpretationSchemeService.batchUpdate(lists);
return new Result();
}
@DeleteMapping @DeleteMapping
@ApiOperation("删除") @ApiOperation("删除")
@LogOperation("删除") @LogOperation("删除")
@ -121,4 +130,13 @@ public class InterpretationSchemeController {
return interpretationSchemeService.list(); return interpretationSchemeService.list();
} }
@PostMapping(value = "listByMyInterpretationSchemeId")
@ApiOperation(value = "获取判读方案列表 依据自定义判读方案id")
@ApiImplicitParams({
@ApiImplicitParam(name = "myInterpretationSchemeId", value = "自定义判读方案id", paramType = "query", required = true, dataTypeClass=Long.class)
})
public List<InterpretationSchemeDTO> listByMyInterpretationSchemeId(@ApiIgnore @RequestParam Map<String, Object> params) {
return interpretationSchemeService.listByMyInterpretationSchemeId(params);
}
} }

View File

@ -12,6 +12,7 @@ import com.cnbm.common.validator.group.DefaultGroup;
import com.cnbm.common.validator.group.UpdateGroup; import com.cnbm.common.validator.group.UpdateGroup;
import com.cnbm.qualityPlanning.dto.MyInterpretationSchemeDTO; import com.cnbm.qualityPlanning.dto.MyInterpretationSchemeDTO;
import com.cnbm.qualityPlanning.excel.MyInterpretationSchemeExcel; import com.cnbm.qualityPlanning.excel.MyInterpretationSchemeExcel;
import com.cnbm.qualityPlanning.service.IInterpretationSchemeService;
import com.cnbm.qualityPlanning.service.IMyInterpretationSchemeService; import com.cnbm.qualityPlanning.service.IMyInterpretationSchemeService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
@ -66,6 +67,9 @@ public class MyInterpretationSchemeController {
return new Result<MyInterpretationSchemeDTO>().ok(data); return new Result<MyInterpretationSchemeDTO>().ok(data);
} }
@Autowired
private IInterpretationSchemeService interpretationSchemeService;
@PostMapping @PostMapping
@ApiOperation("保存") @ApiOperation("保存")
@LogOperation("保存") @LogOperation("保存")
@ -75,6 +79,9 @@ public class MyInterpretationSchemeController {
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
myInterpretationSchemeService.save(dto); myInterpretationSchemeService.save(dto);
//System.out.println(dto.getId());
//每新增一条自定义判读方案同时对应新增十条判读方案
//interpretationSchemeService.batchInsert(dto.getId());
return new Result<Long>().ok(dto.getId()); return new Result<Long>().ok(dto.getId());
} }

View File

@ -7,12 +7,14 @@ import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.math.BigDecimal;
/** /**
* 判读方案 * 判读方案
* *
* @author why * @author why
* @since 2022-08-15 * @since 2022-09-20
*/ */
@Data @Data
@ApiModel(value = "判读方案 表DTO对象") @ApiModel(value = "判读方案 表DTO对象")
@ -39,6 +41,12 @@ public class InterpretationSchemeDTO implements Serializable {
@ApiModelProperty(value = "判读方案vaule2,(2)") @ApiModelProperty(value = "判读方案vaule2,(2)")
private Integer ruleValue2; private Integer ruleValue2;
@ApiModelProperty(value = "自定义判读方案id")
private Long myInterpretationSchemeId;
@ApiModelProperty(value = "'1 = activate, 0 = inactivate '")
private Integer flag;
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String remark; private String remark;

View File

@ -30,9 +30,6 @@ public class MyInterpretationSchemeDTO implements Serializable {
@ApiModelProperty(value = "自定义判读方案名") @ApiModelProperty(value = "自定义判读方案名")
private String name; private String name;
@ApiModelProperty(value = "判读方案id数组用逗号隔开关联 interpretation_scheme id;; eg: id1,id2,id3")
private String interpretationSchemeIds;
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String remark; private String remark;

View File

@ -1,20 +1,20 @@
package com.cnbm.qualityPlanning.entity; package com.cnbm.qualityPlanning.entity;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/** /**
* <p> * <p>
* 判读方案 * 判读方案
* </p> * </p>
* *
* @author why * @author why
* @since 2022-08-16 * @since 2022-09-20
*/ */
@Data @Data
@TableName("interpretation_scheme") @TableName("interpretation_scheme")
@ -41,6 +41,12 @@ public class InterpretationScheme implements Serializable {
@ApiModelProperty("判读方案vaule2,(2)") @ApiModelProperty("判读方案vaule2,(2)")
private Integer ruleValue2; private Integer ruleValue2;
@ApiModelProperty("自定义判读方案id")
private Long myInterpretationSchemeId;
@ApiModelProperty("'1 = activate, 0 = inactivate '")
private Integer flag;
@ApiModelProperty("备注") @ApiModelProperty("备注")
private String remark; private String remark;

View File

@ -32,9 +32,6 @@ public class MyInterpretationScheme implements Serializable {
@ApiModelProperty("自定义判读方案名") @ApiModelProperty("自定义判读方案名")
private String name; private String name;
@ApiModelProperty("判读方案id数组用逗号隔开关联 interpretation_scheme id;; eg: id1,id2,id3")
private String interpretationSchemeIds;
@ApiModelProperty("备注") @ApiModelProperty("备注")
private String remark; private String remark;

View File

@ -4,12 +4,15 @@ import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data; import lombok.Data;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.math.BigDecimal;
import java.util.Date;
/** /**
* 判读方案 * 判读方案
* *
* @author why * @author why
* @since 2022-08-15 * @since 2022-09-20
*/ */
@Data @Data
public class InterpretationSchemeExcel { public class InterpretationSchemeExcel {
@ -25,6 +28,10 @@ public class InterpretationSchemeExcel {
private Integer ruleValue1; private Integer ruleValue1;
@Excel(name = "判读方案vaule2,(2)") @Excel(name = "判读方案vaule2,(2)")
private Integer ruleValue2; private Integer ruleValue2;
@Excel(name = "自定义判读方案id")
private Long myInterpretationSchemeId;
@Excel(name = "'1 = activate, 0 = inactivate '")
private Integer flag;
@Excel(name = "备注") @Excel(name = "备注")
private String remark; private String remark;
@Excel(name = "删除标志,是否有效:1 可用 0不可用") @Excel(name = "删除标志,是否有效:1 可用 0不可用")

View File

@ -19,8 +19,6 @@ public class MyInterpretationSchemeExcel {
private Integer code; private Integer code;
@Excel(name = "自定义判读方案名") @Excel(name = "自定义判读方案名")
private String name; private String name;
@Excel(name = "判读方案id数组用逗号隔开关联 interpretation_scheme id;; eg: id1,id2,id3")
private String interpretationSchemeIds;
@Excel(name = "备注") @Excel(name = "备注")
private String remark; private String remark;
@Excel(name = "删除标志,是否有效:1 可用 0不可用") @Excel(name = "删除标志,是否有效:1 可用 0不可用")

View File

@ -6,6 +6,7 @@ import com.cnbm.qualityPlanning.entity.InterpretationScheme;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 判读方案 * 判读方案
@ -18,4 +19,8 @@ public interface InterpretationSchemeMapper extends BaseDao<InterpretationScheme
List<InterpretationSchemeDTO> list(); List<InterpretationSchemeDTO> list();
List<InterpretationSchemeDTO> listByMyInterpretationSchemeId(Map<String, Object> params);
void batchInsert(Long myInterpretationSchemeId);
} }

View File

@ -24,7 +24,13 @@ public interface IInterpretationSchemeService extends CrudService<Interpretation
void update(InterpretationSchemeDTO dto); void update(InterpretationSchemeDTO dto);
void batchUpdate(InterpretationSchemeDTO[] lists);
void delete(Long[] ids); void delete(Long[] ids);
List<InterpretationSchemeDTO> list(); List<InterpretationSchemeDTO> list();
List<InterpretationSchemeDTO> listByMyInterpretationSchemeId(Map<String, Object> params);
void batchInsert(Long myInterpretationSchemeId);
} }

View File

@ -5,6 +5,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cnbm.common.page.PageData; import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl; import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.common.utils.ConvertUtils; import com.cnbm.common.utils.ConvertUtils;
import com.cnbm.common.validator.ValidatorUtils;
import com.cnbm.common.validator.group.DefaultGroup;
import com.cnbm.common.validator.group.UpdateGroup;
import com.cnbm.qualityPlanning.dto.InterpretationSchemeDTO; import com.cnbm.qualityPlanning.dto.InterpretationSchemeDTO;
import com.cnbm.qualityPlanning.entity.InterpretationScheme; import com.cnbm.qualityPlanning.entity.InterpretationScheme;
import com.cnbm.qualityPlanning.mapper.InterpretationSchemeMapper; import com.cnbm.qualityPlanning.mapper.InterpretationSchemeMapper;
@ -64,6 +67,32 @@ public class InterpretationSchemeServiceImpl extends CrudServiceImpl<Interpretat
insert(entity); insert(entity);
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void batchInsert(Long myInterpretationSchemeId) {
/*
List<InterpretationSchemeDTO> lists= new ArrayList<>();
lists.add(InterpretationSchemeDTO.builder().code(1).ruleNum(1).ruleKey("规则一:有1点落在三倍标准差以外").myInterpretationSchemeId(myInterpretationSchemeId).build());
lists.add(InterpretationSchemeDTO.builder().code(2).ruleNum(2).ruleKey("规则二:连续x点落在管制中心线同一侧").ruleValue1(6).myInterpretationSchemeId(myInterpretationSchemeId).build());
lists.add(InterpretationSchemeDTO.builder().code(3).ruleNum(3).ruleKey("规则三:连续x点持续上升或下降").ruleValue1(6).myInterpretationSchemeId(myInterpretationSchemeId).build());
lists.add(InterpretationSchemeDTO.builder().code(4).ruleNum(4).ruleKey("规则四:连续x点交替上下跳动").ruleValue1(14).myInterpretationSchemeId(myInterpretationSchemeId).build());
lists.add(InterpretationSchemeDTO.builder().code(5).ruleNum(5).ruleKey("规则五:连续x点中有x点落在中心线同侧两倍标准差以外").ruleValue1(3).ruleValue2(2).myInterpretationSchemeId(myInterpretationSchemeId).build());
lists.add(InterpretationSchemeDTO.builder().code(6).ruleNum(6).ruleKey("规则六:连续x点中有x点落在中心线同侧一倍标准差以外").ruleValue1(5).ruleValue2(4).myInterpretationSchemeId(myInterpretationSchemeId).build());
lists.add(InterpretationSchemeDTO.builder().code(7).ruleNum(7).ruleKey("规则七:连续x点落在中心线两侧的一倍标准差以内").ruleValue1(15).myInterpretationSchemeId(myInterpretationSchemeId).build());
lists.add(InterpretationSchemeDTO.builder().code(8).ruleNum(8).ruleKey("规则八:连续x点落在中心线两侧但未在一倍标准差以内").ruleValue1(8).myInterpretationSchemeId(myInterpretationSchemeId).build());
lists.add(InterpretationSchemeDTO.builder().code(9).ruleNum(9).ruleKey("规则九:落在规格线以外").myInterpretationSchemeId(myInterpretationSchemeId).build());
lists.add(InterpretationSchemeDTO.builder().code(10).ruleNum(10).ruleKey("规则十:CPK小于目标值").myInterpretationSchemeId(myInterpretationSchemeId).build());
for(InterpretationSchemeDTO dto:lists){
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
save(dto);
}
*/
mapper.batchInsert(myInterpretationSchemeId);
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(InterpretationSchemeDTO dto) { public void update(InterpretationSchemeDTO dto) {
@ -71,6 +100,16 @@ public class InterpretationSchemeServiceImpl extends CrudServiceImpl<Interpretat
updateById(entity); updateById(entity);
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void batchUpdate(InterpretationSchemeDTO[] lists) {
for(InterpretationSchemeDTO dto:lists){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
update(dto);
}
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void delete(Long[] ids) { public void delete(Long[] ids) {
@ -85,4 +124,11 @@ public class InterpretationSchemeServiceImpl extends CrudServiceImpl<Interpretat
return list; return list;
} }
@Override
@Transactional(rollbackFor = Exception.class)
public List<InterpretationSchemeDTO> listByMyInterpretationSchemeId(Map<String, Object> params) {
List<InterpretationSchemeDTO> listByMyInterpretationSchemeId = mapper.listByMyInterpretationSchemeId(params);
return listByMyInterpretationSchemeId;
}
} }

View File

@ -10,6 +10,7 @@ import com.cnbm.qualityPlanning.entity.MyInterpretationScheme;
import com.cnbm.qualityPlanning.mapper.MyInterpretationSchemeMapper; import com.cnbm.qualityPlanning.mapper.MyInterpretationSchemeMapper;
import com.cnbm.qualityPlanning.service.IMyInterpretationSchemeService; import com.cnbm.qualityPlanning.service.IMyInterpretationSchemeService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -52,11 +53,18 @@ public class MyInterpretationSchemeServiceImpl extends CrudServiceImpl<MyInterpr
return ConvertUtils.sourceToTarget(entity, MyInterpretationSchemeDTO.class); return ConvertUtils.sourceToTarget(entity, MyInterpretationSchemeDTO.class);
} }
@Autowired
private InterpretationSchemeServiceImpl interpretationSchemeService;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void save(MyInterpretationSchemeDTO dto) { public void save(MyInterpretationSchemeDTO dto) {
MyInterpretationScheme entity = ConvertUtils.sourceToTarget(dto, MyInterpretationScheme.class); MyInterpretationScheme entity = ConvertUtils.sourceToTarget(dto, MyInterpretationScheme.class);
insert(entity); insert(entity);
//每新增一条自定义判读方案同时对应新增十条判读方案
interpretationSchemeService.batchInsert(entity.getId());
//System.out.println(dto);
//System.out.println(entity);
} }
@Override @Override

View File

@ -21,7 +21,32 @@
<select id="list" resultType="com.cnbm.qualityPlanning.dto.InterpretationSchemeDTO"> <select id="list" resultType="com.cnbm.qualityPlanning.dto.InterpretationSchemeDTO">
select * from interpretation_scheme select * from interpretation_scheme
order by id asc order by rule_num asc
</select> </select>
<select id="listByMyInterpretationSchemeId" resultType="com.cnbm.qualityPlanning.dto.InterpretationSchemeDTO">
select * from interpretation_scheme
<where>
valid = 1
<if test="myInterpretationSchemeId != null">
and my_interpretation_scheme_id=#{myInterpretationSchemeId}
</if>
</where>
order by rule_num asc
</select>
<insert id="batchInsert">
insert into interpretation_scheme(code,rule_num,rule_key,rule_value1,rule_value2,my_interpretation_scheme_id) values
(1,1,'规则一:有1点落在三倍标准差以外',null,null,#{myInterpretationSchemeId}),
(2,2,'规则二:连续x点落在管制中心线同一侧',6,null,#{myInterpretationSchemeId}),
(3,3,'规则三:连续x点持续上升或下降',6,null,#{myInterpretationSchemeId}),
(4,4,'规则四:连续x点交替上下跳动',14,null,#{myInterpretationSchemeId}),
(5,5,'规则五:连续x点中有x点落在中心线同侧两倍标准差以外',3,2,#{myInterpretationSchemeId}),
(6,6,'规则六:连续x点中有x点落在中心线同侧一倍标准差以外',5,4,#{myInterpretationSchemeId}),
(7,7,'规则七:连续x点落在中心线两侧的一倍标准差以内',15,null,#{myInterpretationSchemeId}),
(8,8,'规则八:连续x点落在中心线两侧但未在一倍标准差以内',8,null,#{myInterpretationSchemeId}),
(9,9,'规则九:落在规格线以外',null,null,#{myInterpretationSchemeId}),
(10,10,'规则十:CPK小于目标值',null,null,#{myInterpretationSchemeId})
</insert>
</mapper> </mapper>