This commit is contained in:
闫阳 2022-09-15 09:55:49 +08:00
parent c0ce68f5b2
commit fb65441dcc
24 changed files with 426 additions and 23 deletions

View File

@ -125,4 +125,18 @@ public class FeaturesStageProcedureRelationController {
return new Result(); return new Result();
} }
@DeleteMapping("deleteByStageProcedure")
@ApiOperation("删除 依据工序id 检验阶段")
@ApiImplicitParams({
@ApiImplicitParam(name = "productId", value = "产品", paramType = "query", dataTypeClass = Long.class),
@ApiImplicitParam(name = "inspectionStage", value = "检测阶段", paramType = "query", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "workingProcedureId", value = "工序", paramType = "query", dataTypeClass = Long.class)
})
public Result deleteByStageProcedure(@ApiIgnore @RequestParam Map<String, Object> params){
featuresStageProcedureRelationService.deleteByStageProcedure(params);
return new Result();
}
} }

View File

@ -2,6 +2,8 @@ package com.cnbm.basic.controller;
import com.cnbm.admin.annotation.LogOperation; import com.cnbm.admin.annotation.LogOperation;
import com.cnbm.admin.params.IdParam; 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.WorkingProcedureDTO;
import com.cnbm.basic.entity.ProductFeatures; import com.cnbm.basic.entity.ProductFeatures;
import com.cnbm.common.constant.Constant; import com.cnbm.common.constant.Constant;
@ -110,11 +112,15 @@ public class ProductFeaturesController {
@GetMapping("export") @GetMapping("export")
@ApiOperation("导出") @ApiOperation("导出")
@LogOperation("导出") @LogOperation("导出")
@ApiImplicitParams({
@ApiImplicitParam(name = "productId", value = "产品", paramType = "query", dataTypeClass = Long.class),
@ApiImplicitParam(name = "inspectionStage", value = "检测阶段", paramType = "query", dataTypeClass = Integer.class)
})
@PreAuthorize("@ex.hasAuthority('basic:productFeatures:export')") @PreAuthorize("@ex.hasAuthority('basic:productFeatures: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<ProductFeaturesDTO> list = productFeaturesService.list(params); List<ProductFeaturesDTO> list = productFeaturesService.getFeaturesList(params);
ExcelUtils.exportExcelToTarget(response, null, list, ProductFeaturesExcel.class); ExcelUtils.exportExcelToTarget(response, "ProductFeatures", list, ProductFeaturesExcel.class);
} }
@PostMapping("getProductFeaturesByProductId") @PostMapping("getProductFeaturesByProductId")
@ -125,13 +131,34 @@ public class ProductFeaturesController {
} }
@PostMapping("getFeaturesByStageProcedure") @PostMapping("getFeaturesByStageProcedure")
@ApiOperation("查询产品特性 依据工序id 检验阶段") @ApiOperation("查询依据工序id 检验阶段")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "inspectionStage", value = "检测阶段", paramType = "query", dataTypeClass = Integer.class), @ApiImplicitParam(name = "productId", value = "产品", paramType = "query", dataTypeClass = Long.class),
@ApiImplicitParam(name = "workingProcedureId", value = "工序", paramType = "query", dataTypeClass = Long.class) //@ApiImplicitParam(name = "workingProcedureId", value = "工序", paramType = "query", dataTypeClass = Long.class),
@ApiImplicitParam(name = "inspectionStage", value = "检测阶段", paramType = "query", dataTypeClass = Integer.class)
}) })
public Result<List<ProductFeaturesDTO>> getFeaturesByStageProcedure(@ApiIgnore @RequestParam Map<String, Object> params){ public Result<List<FeaturesProcedureDTO>> getFeaturesByStageProcedure(@ApiIgnore @RequestParam Map<String, Object> params){
List<ProductFeaturesDTO> list = productFeaturesService.getFeaturesByStageProcedure(params); List<FeaturesProcedureDTO> list = productFeaturesService.getFeaturesByStageProcedure(params);
return new Result<List<FeaturesProcedureDTO>>().ok(list);
}
@PutMapping("batchUpdate")
@ApiOperation("批量更新特性")
public Result batchUpdate(@RequestBody ProductFeaturesDTO[] lists){
productFeaturesService.batchUpdate(lists);
return new Result();
}
@PostMapping("getFeaturesList")
@ApiOperation("特性列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "productId", value = "产品", paramType = "query", dataTypeClass = Long.class),
@ApiImplicitParam(name = "inspectionStage", value = "检测阶段", paramType = "query", dataTypeClass = Integer.class)
})
public Result<List<ProductFeaturesDTO>> getFeaturesList(@ApiIgnore @RequestParam Map<String, Object> params){
List<ProductFeaturesDTO> list = productFeaturesService.getFeaturesList(params);
return new Result<List<ProductFeaturesDTO>>().ok(list); return new Result<List<ProductFeaturesDTO>>().ok(list);
} }

View File

@ -1,6 +1,9 @@
package com.cnbm.basic.controller; package com.cnbm.basic.controller;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.admin.annotation.LogOperation; import com.cnbm.admin.annotation.LogOperation;
import com.cnbm.admin.params.IdParam;
import com.cnbm.basic.dto.SequenceDTO;
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;
@ -75,7 +78,12 @@ public class ProductWorkingprocedureRelationController {
productWorkingprocedureRelationService.save(dto); productWorkingprocedureRelationService.save(dto);
return new Result(); if(ObjectUtils.isNotNull(dto.getWorkingProcedureId())) {
return new Result();
}
else{
return new Result().error(1,"该工艺已经绑定");
}
} }
@PutMapping @PutMapping
@ -133,4 +141,30 @@ public class ProductWorkingprocedureRelationController {
return new Result(); return new Result();
} }
@PutMapping("sequenceUp")
@ApiOperation("产品工序上移")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "productId", value = "产品", paramType = "query", dataTypeClass = Long.class),
// @ApiImplicitParam(name = "index", value = "产品工序序号", paramType = "query", dataTypeClass = Integer.class)
// })
public Result sequenceUp(@RequestBody SequenceDTO sequenceDTO){
productWorkingprocedureRelationService.sequenceUp(sequenceDTO);
return new Result();
}
@PutMapping("sequenceDown")
@ApiOperation("产品工序下移")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "productId", value = "产品", paramType = "query", dataTypeClass = Long.class),
// @ApiImplicitParam(name = "index", value = "产品工序序号", paramType = "query", dataTypeClass = Integer.class)
// })
public Result sequenceDown(@RequestBody SequenceDTO sequenceDTO){
productWorkingprocedureRelationService.sequenceDown(sequenceDTO);
return new Result();
}
} }

View File

@ -0,0 +1,18 @@
package com.cnbm.basic.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
@ApiModel(value = "工艺特性-工序 DTO对象")
public class FeaturesProcedureDTO implements Serializable {
@ApiModelProperty(value = "检验参数id,关联product_features表")
private Long productFeaturesId;
@ApiModelProperty(value = "工序id,关联 working_procedure 表")
private Long workingProcedureId;
}

View File

@ -42,6 +42,30 @@ public class ProductWorkingprocedureRelationDTO implements Serializable {
@ApiModelProperty(value = "1 可用0 不可用") @ApiModelProperty(value = "1 可用0 不可用")
private Integer status; private Integer status;
@ApiModelProperty(value = "node.shape")
private String shape;
@ApiModelProperty(value = "node.x")
private Integer x;
@ApiModelProperty(value = "node.y")
private Integer y;
@ApiModelProperty(value = "node.width")
private Integer width;
@ApiModelProperty(value = "node.width")
private Integer height;
@ApiModelProperty(value = "node.lable")
private String lable;
@ApiModelProperty(value = "字体颜色")
private String fontcolor;
@ApiModelProperty(value = "背景颜色")
private String backcolor;
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String remark; private String remark;

View File

@ -0,0 +1,18 @@
package com.cnbm.basic.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
@ApiModel(value = "顺序更新参数")
public class SequenceDTO implements Serializable {
@ApiModelProperty(value = "产品id")
private Long productId;
@ApiModelProperty(value = "产品工序序号")
private Integer index;
}

View File

@ -40,7 +40,6 @@ public class FeaturesStageProcedureRelation implements Serializable {
private String remark; private String remark;
@ApiModelProperty("删除标志,是否有效:1 可用 0不可用") @ApiModelProperty("删除标志,是否有效:1 可用 0不可用")
@TableLogic
private Integer valid; private Integer valid;
@ApiModelProperty("创建人") @ApiModelProperty("创建人")

View File

@ -38,6 +38,30 @@ public class ProductWorkingprocedureRelation implements Serializable {
@ApiModelProperty("1 可用0 不可用") @ApiModelProperty("1 可用0 不可用")
private Integer status; private Integer status;
@ApiModelProperty("node.shape")
private String shape;
@ApiModelProperty("node.x")
private Integer x;
@ApiModelProperty("node.y")
private Integer y;
@ApiModelProperty("node.width")
private Integer width;
@ApiModelProperty("node.width")
private Integer height;
@ApiModelProperty("node.lable")
private String lable;
@ApiModelProperty("字体颜色")
private String fontcolor;
@ApiModelProperty("背景颜色")
private String backcolor;
@ApiModelProperty("备注") @ApiModelProperty("备注")
private String remark; private String remark;

View File

@ -23,6 +23,22 @@ public class ProductWorkingprocedureRelationExcel {
private Integer sequence; private Integer sequence;
@Excel(name = "1 可用0 不可用") @Excel(name = "1 可用0 不可用")
private Integer status; private Integer status;
@Excel(name = "node.shape")
private String shape;
@Excel(name = "node.x")
private Integer x;
@Excel(name = "node.y")
private Integer y;
@Excel(name = "node.width")
private Integer width;
@Excel(name = "node.width")
private Integer height;
@Excel(name = "node.lable")
private String lable;
@Excel(name = "字体颜色")
private String fontcolor;
@Excel(name = "背景颜色")
private String backcolor;
@Excel(name = "备注") @Excel(name = "备注")
private String remark; private String remark;
@Excel(name = "删除标志,是否有效:1 可用 0不可用") @Excel(name = "删除标志,是否有效:1 可用 0不可用")

View File

@ -17,4 +17,5 @@ import java.util.Map;
@Mapper @Mapper
public interface FeaturesStageProcedureRelationMapper extends BaseDao<FeaturesStageProcedureRelation> { public interface FeaturesStageProcedureRelationMapper extends BaseDao<FeaturesStageProcedureRelation> {
void deleteByStageProcedure(Map<String, Object> params);
} }

View File

@ -1,5 +1,7 @@
package com.cnbm.basic.mapper; package com.cnbm.basic.mapper;
import com.cnbm.basic.dto.FeaturesProcedureDTO;
import com.cnbm.basic.dto.FeaturesStageProcedureRelationDTO;
import com.cnbm.basic.dto.ProductFeaturesDTO; import com.cnbm.basic.dto.ProductFeaturesDTO;
import com.cnbm.common.dao.BaseDao; import com.cnbm.common.dao.BaseDao;
import com.cnbm.basic.entity.ProductFeatures; import com.cnbm.basic.entity.ProductFeatures;
@ -18,5 +20,7 @@ import java.util.Map;
public interface ProductFeaturesMapper extends BaseDao<ProductFeatures> { public interface ProductFeaturesMapper extends BaseDao<ProductFeatures> {
List<ProductFeaturesDTO> getProductFeaturesByProductId(Long id); List<ProductFeaturesDTO> getProductFeaturesByProductId(Long id);
List<ProductFeaturesDTO> getFeaturesByStageProcedure(Map<String, Object> params); List<FeaturesProcedureDTO> getFeaturesByStageProcedure(Map<String, Object> params);
List<ProductFeaturesDTO> getFeaturesList(Map<String, Object> params);
} }

View File

@ -1,9 +1,12 @@
package com.cnbm.basic.mapper; package com.cnbm.basic.mapper;
import com.cnbm.basic.dto.ProductWorkingprocedureRelationDTO;
import com.cnbm.common.dao.BaseDao; import com.cnbm.common.dao.BaseDao;
import com.cnbm.basic.entity.ProductWorkingprocedureRelation; import com.cnbm.basic.entity.ProductWorkingprocedureRelation;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* 工序 * 工序
* *
@ -12,5 +15,5 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface ProductWorkingprocedureRelationMapper extends BaseDao<ProductWorkingprocedureRelation> { public interface ProductWorkingprocedureRelationMapper extends BaseDao<ProductWorkingprocedureRelation> {
List<ProductWorkingprocedureRelationDTO> getWorkingprocedureByProductId(Long productId);
} }

View File

@ -26,4 +26,6 @@ public interface IFeaturesStageProcedureRelationService extends CrudService<Feat
void delete(Long[] ids); void delete(Long[] ids);
void batchInsert(FeaturesStageProcedureRelationDTO[] lists); void batchInsert(FeaturesStageProcedureRelationDTO[] lists);
void deleteByStageProcedure(Map<String, Object> params);
} }

View File

@ -1,5 +1,6 @@
package com.cnbm.basic.service; package com.cnbm.basic.service;
import com.cnbm.basic.dto.FeaturesProcedureDTO;
import com.cnbm.basic.dto.FeaturesStageProcedureRelationDTO; import com.cnbm.basic.dto.FeaturesStageProcedureRelationDTO;
import com.cnbm.common.page.PageData; import com.cnbm.common.page.PageData;
import com.cnbm.common.service.CrudService; import com.cnbm.common.service.CrudService;
@ -28,5 +29,9 @@ public interface IProductFeaturesService extends CrudService<ProductFeatures, Pr
List<ProductFeaturesDTO> getProductFeaturesByProductId(Long id); List<ProductFeaturesDTO> getProductFeaturesByProductId(Long id);
List<ProductFeaturesDTO> getFeaturesByStageProcedure(Map<String, Object> params); List<FeaturesProcedureDTO> getFeaturesByStageProcedure(Map<String, Object> params);
void batchUpdate(ProductFeaturesDTO[] lists);
List<ProductFeaturesDTO> getFeaturesList(Map<String, Object> params);
} }

View File

@ -1,5 +1,6 @@
package com.cnbm.basic.service; package com.cnbm.basic.service;
import com.cnbm.basic.dto.SequenceDTO;
import com.cnbm.basic.dto.WorkingProcedureDTO; import com.cnbm.basic.dto.WorkingProcedureDTO;
import com.cnbm.common.page.PageData; import com.cnbm.common.page.PageData;
import com.cnbm.common.service.CrudService; import com.cnbm.common.service.CrudService;
@ -29,4 +30,8 @@ public interface IProductWorkingprocedureRelationService extends CrudService<Pro
List<ProductWorkingprocedureRelationDTO> getWorkingprocedureByProductId(Long productId); List<ProductWorkingprocedureRelationDTO> getWorkingprocedureByProductId(Long productId);
void batchInsertWorkingprocedure(ProductWorkingprocedureRelationDTO[] lists); void batchInsertWorkingprocedure(ProductWorkingprocedureRelationDTO[] lists);
void sequenceUp(SequenceDTO sequenceDTO);
void sequenceDown(SequenceDTO sequenceDTO);
} }

View File

@ -90,4 +90,12 @@ public class FeaturesStageProcedureRelationServiceImpl extends CrudServiceImpl<F
} }
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteByStageProcedure(Map<String, Object> params){
mapper.deleteByStageProcedure(params);
}
} }

View File

@ -4,19 +4,19 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.admin.params.IdParam; import com.cnbm.admin.params.IdParam;
import com.cnbm.basic.dto.FeaturesStageProcedureRelationDTO; import com.cnbm.basic.dto.*;
import com.cnbm.basic.dto.ProductFeaturesHisDTO;
import com.cnbm.basic.dto.WorkingProcedureDTO;
import com.cnbm.basic.entity.ProductFeaturesHis; import com.cnbm.basic.entity.ProductFeaturesHis;
import com.cnbm.basic.entity.ProductWorkingprocedureRelation; import com.cnbm.basic.entity.ProductWorkingprocedureRelation;
import com.cnbm.basic.entity.WorkingProcedure; import com.cnbm.basic.entity.WorkingProcedure;
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.ProductFeaturesDTO;
import com.cnbm.basic.mapper.ProductFeaturesMapper; import com.cnbm.basic.mapper.ProductFeaturesMapper;
import com.cnbm.basic.entity.ProductFeatures; import com.cnbm.basic.entity.ProductFeatures;
import com.cnbm.basic.service.IProductFeaturesService; import com.cnbm.basic.service.IProductFeaturesService;
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 org.apache.commons.lang3.StringUtils; 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;
@ -124,8 +124,24 @@ public class ProductFeaturesServiceImpl extends CrudServiceImpl<ProductFeaturesM
} }
@Override @Override
public List<ProductFeaturesDTO> getFeaturesByStageProcedure(Map<String, Object> params){ public List<FeaturesProcedureDTO> getFeaturesByStageProcedure(Map<String, Object> params){
List<ProductFeaturesDTO> list = mapper.getFeaturesByStageProcedure(params); List<FeaturesProcedureDTO> list = mapper.getFeaturesByStageProcedure(params);
return list;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void batchUpdate(ProductFeaturesDTO[] lists) {
for(ProductFeaturesDTO dto:lists){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
update(dto);
}
}
@Override
public List<ProductFeaturesDTO> getFeaturesList(Map<String, Object> params){
List<ProductFeaturesDTO> list = mapper.getFeaturesList(params);
return list; return list;
} }
} }

View File

@ -3,6 +3,9 @@ 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.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.basic.dto.ProductFeaturesDTO;
import com.cnbm.basic.dto.SequenceDTO;
import com.cnbm.basic.dto.WorkingProcedureDTO; import com.cnbm.basic.dto.WorkingProcedureDTO;
import com.cnbm.basic.entity.WorkingProcedure; import com.cnbm.basic.entity.WorkingProcedure;
import com.cnbm.basic.mapper.ProductMapper; import com.cnbm.basic.mapper.ProductMapper;
@ -16,14 +19,13 @@ import com.cnbm.common.utils.ConvertUtils;
import com.cnbm.common.validator.ValidatorUtils; import com.cnbm.common.validator.ValidatorUtils;
import com.cnbm.common.validator.group.AddGroup; import com.cnbm.common.validator.group.AddGroup;
import com.cnbm.common.validator.group.DefaultGroup; import com.cnbm.common.validator.group.DefaultGroup;
import com.cnbm.common.validator.group.UpdateGroup;
import org.apache.commons.lang3.StringUtils; 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;
import java.util.Arrays; import java.util.*;
import java.util.List;
import java.util.Map;
/** /**
* 工序 * 工序
@ -34,6 +36,9 @@ import java.util.Map;
@Service @Service
public class ProductWorkingprocedureRelationServiceImpl extends CrudServiceImpl<ProductWorkingprocedureRelationMapper, ProductWorkingprocedureRelation, ProductWorkingprocedureRelationDTO> implements IProductWorkingprocedureRelationService { public class ProductWorkingprocedureRelationServiceImpl extends CrudServiceImpl<ProductWorkingprocedureRelationMapper, ProductWorkingprocedureRelation, ProductWorkingprocedureRelationDTO> implements IProductWorkingprocedureRelationService {
@Autowired
private ProductWorkingprocedureRelationMapper mapper;
@Override @Override
public QueryWrapper<ProductWorkingprocedureRelation> getWrapper(Map<String, Object> params){ public QueryWrapper<ProductWorkingprocedureRelation> getWrapper(Map<String, Object> params){
String id = (String)params.get("id"); String id = (String)params.get("id");
@ -59,11 +64,32 @@ public class ProductWorkingprocedureRelationServiceImpl extends CrudServiceImpl<
return ConvertUtils.sourceToTarget(entity, ProductWorkingprocedureRelationDTO.class); return ConvertUtils.sourceToTarget(entity, ProductWorkingprocedureRelationDTO.class);
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void save(ProductWorkingprocedureRelationDTO dto) { public void save(ProductWorkingprocedureRelationDTO dto) {
ProductWorkingprocedureRelation entity = ConvertUtils.sourceToTarget(dto, ProductWorkingprocedureRelation.class); //判断数据是否已经绑定过
insert(entity); QueryWrapper<ProductWorkingprocedureRelation> wrapper = new QueryWrapper<>();
wrapper.eq(ObjectUtils.isNotNull(dto.getProductId()),"product_id",dto.getProductId())
.eq(ObjectUtils.isNotNull(dto.getWorkingProcedureId()),"working_procedure_id",dto.getWorkingProcedureId());
ProductWorkingprocedureRelation test = mapper.selectOne(wrapper);
if(Objects.isNull(test)){
ProductWorkingprocedureRelation entity = ConvertUtils.sourceToTarget(dto, ProductWorkingprocedureRelation.class);
//设置工序顺序
List<ProductWorkingprocedureRelationDTO> list = getWorkingprocedureByProductId(dto.getProductId());
if (list.isEmpty()) {
entity.setSequence(1);
} else {
ProductWorkingprocedureRelationDTO lastDto = list.get(list.size() - 1);
Integer lastSequence = lastDto.getSequence();
entity.setSequence(lastSequence + 1);
}
insert(entity);
}
else{
dto.setWorkingProcedureId(null);
}
} }
@Override @Override
@ -80,6 +106,7 @@ public class ProductWorkingprocedureRelationServiceImpl extends CrudServiceImpl<
deleteBatchIds(Arrays.asList(ids)); deleteBatchIds(Arrays.asList(ids));
} }
/*
@Autowired @Autowired
private WorkingProcedureServiceImpl workingProcedureServiceImpl; private WorkingProcedureServiceImpl workingProcedureServiceImpl;
@ -103,6 +130,13 @@ public class ProductWorkingprocedureRelationServiceImpl extends CrudServiceImpl<
} }
return dtoList; return dtoList;
} }
*/
@Override
public List<ProductWorkingprocedureRelationDTO> getWorkingprocedureByProductId(Long productId){
List<ProductWorkingprocedureRelationDTO> list= mapper.getWorkingprocedureByProductId(productId);
return list;
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -113,4 +147,51 @@ public class ProductWorkingprocedureRelationServiceImpl extends CrudServiceImpl<
} }
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void sequenceUp(SequenceDTO sequenceDTO)
{
Integer index = sequenceDTO.getIndex();
Long productId = sequenceDTO.getProductId();
//排序为最前不能再上移
if(index!= 1){
List<ProductWorkingprocedureRelationDTO> list = getWorkingprocedureByProductId(productId);
ProductWorkingprocedureRelationDTO dto = list.get(index-1);
ProductWorkingprocedureRelationDTO beforeDto = list.get(index-2);
//交换顺序
Integer dtoSequence = dto.getSequence();
Integer beforeDtoSequence = beforeDto.getSequence();
dto.setSequence(beforeDtoSequence);
beforeDto.setSequence(dtoSequence);
update(dto);
update(beforeDto);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void sequenceDown(SequenceDTO sequenceDTO)
{
Integer index = sequenceDTO.getIndex();
Long productId = sequenceDTO.getProductId();
List<ProductWorkingprocedureRelationDTO> list = getWorkingprocedureByProductId(productId);
//排序为最后不能再下移
if(index !=list.size()){
ProductWorkingprocedureRelationDTO dto = list.get(index-1);
ProductWorkingprocedureRelationDTO afterDto = list.get(index);
//交换顺序
Integer dtoSequence = dto.getSequence();
Integer afterDtoSequence = afterDto.getSequence();
dto.setSequence(afterDtoSequence);
afterDto.setSequence(dtoSequence);
update(dto);
update(afterDto);
}
}
} }

View File

@ -17,4 +17,12 @@
<id column="version" property="version" /> <id column="version" property="version" />
</resultMap> </resultMap>
<select id="deleteByStageProcedure">
delete fspr from features_stage_procedure_relation fspr
inner join product_workingprocedure_relation pwr ON pwr.working_procedure_id=fspr.working_procedure_id
where fspr.working_procedure_id = #{workingProcedureId}
and fspr.inspection_stage = #{inspectionStage}
and pwr.product_id = #{productId}
</select>
</mapper> </mapper>

View File

@ -14,12 +14,33 @@
order by p.id asc order by p.id asc
</select> </select>
<select id="getFeaturesByStageProcedure" resultType="com.cnbm.basic.dto.FeaturesProcedureDTO">
select pf.id as productFeaturesId, fspr.working_procedure_id as workingProcedureId
from features_stage_procedure_relation fspr
LEFT JOIN product_features pf ON pf.id=fspr.product_features_id
<where>
fspr.valid = 1
<if test="productId != null">
and pf.product_id = #{productId}
</if>
<if test="inspectionStage != null">
and fspr.inspection_stage = #{inspectionStage}
</if>
</where>
order by pf.id asc
</select>
<!--
<select id="getFeaturesByStageProcedure" resultType="com.cnbm.basic.dto.ProductFeaturesDTO"> <select id="getFeaturesByStageProcedure" resultType="com.cnbm.basic.dto.ProductFeaturesDTO">
select * select *
from product_features pf from product_features pf
LEFT JOIN features_stage_procedure_relation fspr ON pf.id=fspr.product_features_id LEFT JOIN features_stage_procedure_relation fspr ON pf.id=fspr.product_features_id
LEFT JOIN product_workingprocedure_relation pwr ON pwr.working_procedure_id=fspr.working_procedure_id
<where> <where>
fspr.valid = 1 fspr.valid = 1
<if test="productId != null">
and pwr.product_id = #{productId}
</if>
<if test="inspectionStage != null"> <if test="inspectionStage != null">
and fspr.inspection_stage = #{inspectionStage} and fspr.inspection_stage = #{inspectionStage}
</if> </if>
@ -29,4 +50,23 @@
</where> </where>
order by pf.id asc order by pf.id asc
</select> </select>
-->
<select id="getFeaturesList" resultType="com.cnbm.basic.dto.ProductFeaturesDTO">
select pf.*,m.name as measureToolName,u.name as unitName,c.name as controlGraphName
from product_features pf
left join features_stage_procedure_relation fspr ON pf.id=fspr.product_features_id
LEFT JOIN measure_tool m ON pf.measure_tool_id=m.id
LEFT JOIN unit u ON pf.unit_id=u.id
LEFT JOIN control_graph c ON pf.control_graph_id=c.id
<where>
fspr.valid = 1
<if test="productId != null">
and pf.product_id = #{productId}
</if>
<if test="inspectionStage != null">
and fspr.inspection_stage = #{inspectionStage}
</if>
</where>
order by pf.id asc
</select>
</mapper> </mapper>

View File

@ -2,4 +2,19 @@
<!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.ProductWorkingprocedureRelationMapper"> <mapper namespace="com.cnbm.basic.mapper.ProductWorkingprocedureRelationMapper">
<select id="getWorkingprocedureByProductId" resultType="com.cnbm.basic.dto.ProductWorkingprocedureRelationDTO">
select pwr.*, wp.name as workingProcedureName, wp.code as workingProcedureCode
from product_workingprocedure_relation pwr
LEFT JOIN working_procedure wp ON pwr.working_procedure_id=wp.id
<where>
pwr.valid = 1
<if test="productId != null">
and pwr.product_id=#{productId}
</if>
</where>
order by pwr.sequence asc
</select>
</mapper> </mapper>

View File

@ -10,9 +10,11 @@ import com.cnbm.common.validator.ValidatorUtils;
import com.cnbm.common.validator.group.AddGroup; import com.cnbm.common.validator.group.AddGroup;
import com.cnbm.common.validator.group.DefaultGroup; import com.cnbm.common.validator.group.DefaultGroup;
import com.cnbm.common.validator.group.UpdateGroup; import com.cnbm.common.validator.group.UpdateGroup;
import com.cnbm.influx.param.QueryDataParam;
import com.cnbm.processInspection.dto.InspectionSheetDTO; import com.cnbm.processInspection.dto.InspectionSheetDTO;
import com.cnbm.processInspection.excel.InspectionSheetExcel; import com.cnbm.processInspection.excel.InspectionSheetExcel;
import com.cnbm.processInspection.service.IInspectionSheetService; import com.cnbm.processInspection.service.IInspectionSheetService;
import com.influxdb.query.FluxTable;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
@ -140,4 +142,16 @@ public class InspectionSheetController {
return inspectionSheetService.list(params); return inspectionSheetService.list(params);
} }
@PostMapping(value = "getFluxParamList")
@ApiOperation(value = "从influxdb中获取检测参数")
@ApiImplicitParams({
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataTypeClass = LocalDateTime.class),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataTypeClass = LocalDateTime.class),
@ApiImplicitParam(name = "id", value = "检验单号", paramType = "query", dataTypeClass = Integer.class),
@ApiImplicitParam(name = "workingProcedureName", value = "工序名称", paramType = "query", dataTypeClass = String.class)
})
List<FluxTable> getFluxParamList(@ApiIgnore @RequestParam Map<String, Object> params){
return inspectionSheetService.getFluxParamList(params);
}
} }

View File

@ -2,8 +2,10 @@ package com.cnbm.processInspection.service;
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.influx.param.QueryDataParam;
import com.cnbm.processInspection.dto.InspectionSheetDTO; import com.cnbm.processInspection.dto.InspectionSheetDTO;
import com.cnbm.processInspection.entity.InspectionSheet; import com.cnbm.processInspection.entity.InspectionSheet;
import com.influxdb.query.FluxTable;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -28,4 +30,6 @@ public interface IInspectionSheetService extends CrudService<InspectionSheet, In
List<InspectionSheetDTO> list(Map<String, Object> params); List<InspectionSheetDTO> list(Map<String, Object> params);
List<FluxTable> getFluxParamList(Map<String, Object> params);
} }

View File

@ -14,16 +14,23 @@ import com.cnbm.basic.service.impl.WorkingProcedureServiceImpl;
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.influx.config.InfluxClient;
import com.cnbm.influx.param.QueryDataParam;
import com.cnbm.influx.param.Range;
import com.cnbm.influx.template.Event;
import com.cnbm.processInspection.dto.InspectionSheetDTO; import com.cnbm.processInspection.dto.InspectionSheetDTO;
import com.cnbm.processInspection.entity.InspectionSheet; import com.cnbm.processInspection.entity.InspectionSheet;
import com.cnbm.processInspection.mapper.InspectionSheetMapper; import com.cnbm.processInspection.mapper.InspectionSheetMapper;
import com.cnbm.processInspection.service.IInspectionSheetService; import com.cnbm.processInspection.service.IInspectionSheetService;
import com.influxdb.query.FluxTable;
import org.apache.commons.lang3.StringUtils; 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;
import java.time.Instant;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -144,4 +151,20 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
List<InspectionSheetDTO> list = mapper.list(params); List<InspectionSheetDTO> list = mapper.list(params);
return list; return list;
} }
@Override
public List<FluxTable> getFluxParamList(Map<String, Object> params){
QueryDataParam queryDataParam = new QueryDataParam();
String workingProcedureName = (String)params.get("workingProcedureName");
queryDataParam.setMeasurement(workingProcedureName);
queryDataParam.setBucket("qgs-bucket");
Instant startTime = (Instant) params.get("startTime");
Instant endTime = (Instant) params.get("endTime");
Range range = new Range(startTime,endTime);
queryDataParam.setRange(range);
List<FluxTable> list = InfluxClient.Client.query(queryDataParam);
return list;
}
} }