diff --git a/ym-baisc/src/main/java/com/cnbm/basic/controller/FeaturesStageProcedureRelationController.java b/ym-baisc/src/main/java/com/cnbm/basic/controller/FeaturesStageProcedureRelationController.java index 02145ea..f8fcd0d 100644 --- a/ym-baisc/src/main/java/com/cnbm/basic/controller/FeaturesStageProcedureRelationController.java +++ b/ym-baisc/src/main/java/com/cnbm/basic/controller/FeaturesStageProcedureRelationController.java @@ -125,4 +125,18 @@ public class FeaturesStageProcedureRelationController { 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 params){ + + featuresStageProcedureRelationService.deleteByStageProcedure(params); + + return new Result(); + } + } \ No newline at end of file diff --git a/ym-baisc/src/main/java/com/cnbm/basic/controller/ProductFeaturesController.java b/ym-baisc/src/main/java/com/cnbm/basic/controller/ProductFeaturesController.java index 2b72f4d..89e4387 100644 --- a/ym-baisc/src/main/java/com/cnbm/basic/controller/ProductFeaturesController.java +++ b/ym-baisc/src/main/java/com/cnbm/basic/controller/ProductFeaturesController.java @@ -2,6 +2,8 @@ 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.entity.ProductFeatures; import com.cnbm.common.constant.Constant; @@ -110,11 +112,15 @@ public class ProductFeaturesController { @GetMapping("export") @ApiOperation("导出") @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')") public void export(@ApiIgnore @RequestParam Map params, HttpServletResponse response) throws Exception { - List list = productFeaturesService.list(params); + List list = productFeaturesService.getFeaturesList(params); - ExcelUtils.exportExcelToTarget(response, null, list, ProductFeaturesExcel.class); + ExcelUtils.exportExcelToTarget(response, "ProductFeatures", list, ProductFeaturesExcel.class); } @PostMapping("getProductFeaturesByProductId") @@ -125,13 +131,34 @@ public class ProductFeaturesController { } @PostMapping("getFeaturesByStageProcedure") - @ApiOperation("查询产品特性 依据工序id 检验阶段") + @ApiOperation("查询依据工序id 检验阶段") @ApiImplicitParams({ - @ApiImplicitParam(name = "inspectionStage", value = "检测阶段", paramType = "query", dataTypeClass = Integer.class), - @ApiImplicitParam(name = "workingProcedureId", value = "工序", paramType = "query", dataTypeClass = Long.class) + @ApiImplicitParam(name = "productId", 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> getFeaturesByStageProcedure(@ApiIgnore @RequestParam Map params){ - List list = productFeaturesService.getFeaturesByStageProcedure(params); + public Result> getFeaturesByStageProcedure(@ApiIgnore @RequestParam Map params){ + List list = productFeaturesService.getFeaturesByStageProcedure(params); + return new Result>().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> getFeaturesList(@ApiIgnore @RequestParam Map params){ + List list = productFeaturesService.getFeaturesList(params); return new Result>().ok(list); } diff --git a/ym-baisc/src/main/java/com/cnbm/basic/controller/ProductWorkingprocedureRelationController.java b/ym-baisc/src/main/java/com/cnbm/basic/controller/ProductWorkingprocedureRelationController.java index 4c84451..baab046 100644 --- a/ym-baisc/src/main/java/com/cnbm/basic/controller/ProductWorkingprocedureRelationController.java +++ b/ym-baisc/src/main/java/com/cnbm/basic/controller/ProductWorkingprocedureRelationController.java @@ -1,6 +1,9 @@ package com.cnbm.basic.controller; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; 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.page.PageData; import com.cnbm.common.utils.ExcelUtils; @@ -75,7 +78,12 @@ public class ProductWorkingprocedureRelationController { productWorkingprocedureRelationService.save(dto); - return new Result(); + if(ObjectUtils.isNotNull(dto.getWorkingProcedureId())) { + return new Result(); + } + else{ + return new Result().error(1,"该工艺已经绑定"); + } } @PutMapping @@ -133,4 +141,30 @@ public class ProductWorkingprocedureRelationController { 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(); + } + } \ No newline at end of file diff --git a/ym-baisc/src/main/java/com/cnbm/basic/dto/FeaturesProcedureDTO.java b/ym-baisc/src/main/java/com/cnbm/basic/dto/FeaturesProcedureDTO.java new file mode 100644 index 0000000..e2f95ae --- /dev/null +++ b/ym-baisc/src/main/java/com/cnbm/basic/dto/FeaturesProcedureDTO.java @@ -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; +} diff --git a/ym-baisc/src/main/java/com/cnbm/basic/dto/ProductWorkingprocedureRelationDTO.java b/ym-baisc/src/main/java/com/cnbm/basic/dto/ProductWorkingprocedureRelationDTO.java index 3315aa5..acaf675 100644 --- a/ym-baisc/src/main/java/com/cnbm/basic/dto/ProductWorkingprocedureRelationDTO.java +++ b/ym-baisc/src/main/java/com/cnbm/basic/dto/ProductWorkingprocedureRelationDTO.java @@ -42,6 +42,30 @@ public class ProductWorkingprocedureRelationDTO implements Serializable { @ApiModelProperty(value = "1 可用,0 不可用") 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 = "备注") private String remark; diff --git a/ym-baisc/src/main/java/com/cnbm/basic/dto/SequenceDTO.java b/ym-baisc/src/main/java/com/cnbm/basic/dto/SequenceDTO.java new file mode 100644 index 0000000..7b7cbef --- /dev/null +++ b/ym-baisc/src/main/java/com/cnbm/basic/dto/SequenceDTO.java @@ -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; +} diff --git a/ym-baisc/src/main/java/com/cnbm/basic/entity/FeaturesStageProcedureRelation.java b/ym-baisc/src/main/java/com/cnbm/basic/entity/FeaturesStageProcedureRelation.java index 55c8447..7ed2f20 100644 --- a/ym-baisc/src/main/java/com/cnbm/basic/entity/FeaturesStageProcedureRelation.java +++ b/ym-baisc/src/main/java/com/cnbm/basic/entity/FeaturesStageProcedureRelation.java @@ -40,7 +40,6 @@ public class FeaturesStageProcedureRelation implements Serializable { private String remark; @ApiModelProperty("删除标志,是否有效:1 可用 0不可用") - @TableLogic private Integer valid; @ApiModelProperty("创建人") diff --git a/ym-baisc/src/main/java/com/cnbm/basic/entity/ProductWorkingprocedureRelation.java b/ym-baisc/src/main/java/com/cnbm/basic/entity/ProductWorkingprocedureRelation.java index 96b373e..cda7360 100644 --- a/ym-baisc/src/main/java/com/cnbm/basic/entity/ProductWorkingprocedureRelation.java +++ b/ym-baisc/src/main/java/com/cnbm/basic/entity/ProductWorkingprocedureRelation.java @@ -38,6 +38,30 @@ public class ProductWorkingprocedureRelation implements Serializable { @ApiModelProperty("1 可用,0 不可用") 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("备注") private String remark; diff --git a/ym-baisc/src/main/java/com/cnbm/basic/excel/ProductWorkingprocedureRelationExcel.java b/ym-baisc/src/main/java/com/cnbm/basic/excel/ProductWorkingprocedureRelationExcel.java index 7895780..aa36c31 100644 --- a/ym-baisc/src/main/java/com/cnbm/basic/excel/ProductWorkingprocedureRelationExcel.java +++ b/ym-baisc/src/main/java/com/cnbm/basic/excel/ProductWorkingprocedureRelationExcel.java @@ -23,6 +23,22 @@ public class ProductWorkingprocedureRelationExcel { private Integer sequence; @Excel(name = "1 可用,0 不可用") 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 = "备注") private String remark; @Excel(name = "删除标志,是否有效:1 可用 0不可用") diff --git a/ym-baisc/src/main/java/com/cnbm/basic/mapper/FeaturesStageProcedureRelationMapper.java b/ym-baisc/src/main/java/com/cnbm/basic/mapper/FeaturesStageProcedureRelationMapper.java index 6130d77..40b5ca4 100644 --- a/ym-baisc/src/main/java/com/cnbm/basic/mapper/FeaturesStageProcedureRelationMapper.java +++ b/ym-baisc/src/main/java/com/cnbm/basic/mapper/FeaturesStageProcedureRelationMapper.java @@ -17,4 +17,5 @@ import java.util.Map; @Mapper public interface FeaturesStageProcedureRelationMapper extends BaseDao { + void deleteByStageProcedure(Map params); } \ No newline at end of file diff --git a/ym-baisc/src/main/java/com/cnbm/basic/mapper/ProductFeaturesMapper.java b/ym-baisc/src/main/java/com/cnbm/basic/mapper/ProductFeaturesMapper.java index f6b414e..8423663 100644 --- a/ym-baisc/src/main/java/com/cnbm/basic/mapper/ProductFeaturesMapper.java +++ b/ym-baisc/src/main/java/com/cnbm/basic/mapper/ProductFeaturesMapper.java @@ -1,5 +1,7 @@ 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.common.dao.BaseDao; import com.cnbm.basic.entity.ProductFeatures; @@ -18,5 +20,7 @@ import java.util.Map; public interface ProductFeaturesMapper extends BaseDao { List getProductFeaturesByProductId(Long id); - List getFeaturesByStageProcedure(Map params); + List getFeaturesByStageProcedure(Map params); + + List getFeaturesList(Map params); } \ No newline at end of file diff --git a/ym-baisc/src/main/java/com/cnbm/basic/mapper/ProductWorkingprocedureRelationMapper.java b/ym-baisc/src/main/java/com/cnbm/basic/mapper/ProductWorkingprocedureRelationMapper.java index 2d12555..d455c1a 100644 --- a/ym-baisc/src/main/java/com/cnbm/basic/mapper/ProductWorkingprocedureRelationMapper.java +++ b/ym-baisc/src/main/java/com/cnbm/basic/mapper/ProductWorkingprocedureRelationMapper.java @@ -1,9 +1,12 @@ package com.cnbm.basic.mapper; +import com.cnbm.basic.dto.ProductWorkingprocedureRelationDTO; import com.cnbm.common.dao.BaseDao; import com.cnbm.basic.entity.ProductWorkingprocedureRelation; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 工序 表 * @@ -12,5 +15,5 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ProductWorkingprocedureRelationMapper extends BaseDao { - + List getWorkingprocedureByProductId(Long productId); } \ No newline at end of file diff --git a/ym-baisc/src/main/java/com/cnbm/basic/service/IFeaturesStageProcedureRelationService.java b/ym-baisc/src/main/java/com/cnbm/basic/service/IFeaturesStageProcedureRelationService.java index dc143f4..a82bb68 100644 --- a/ym-baisc/src/main/java/com/cnbm/basic/service/IFeaturesStageProcedureRelationService.java +++ b/ym-baisc/src/main/java/com/cnbm/basic/service/IFeaturesStageProcedureRelationService.java @@ -26,4 +26,6 @@ public interface IFeaturesStageProcedureRelationService extends CrudService params); } diff --git a/ym-baisc/src/main/java/com/cnbm/basic/service/IProductFeaturesService.java b/ym-baisc/src/main/java/com/cnbm/basic/service/IProductFeaturesService.java index be7b49b..224dde9 100644 --- a/ym-baisc/src/main/java/com/cnbm/basic/service/IProductFeaturesService.java +++ b/ym-baisc/src/main/java/com/cnbm/basic/service/IProductFeaturesService.java @@ -1,5 +1,6 @@ package com.cnbm.basic.service; +import com.cnbm.basic.dto.FeaturesProcedureDTO; import com.cnbm.basic.dto.FeaturesStageProcedureRelationDTO; import com.cnbm.common.page.PageData; import com.cnbm.common.service.CrudService; @@ -28,5 +29,9 @@ public interface IProductFeaturesService extends CrudService getProductFeaturesByProductId(Long id); - List getFeaturesByStageProcedure(Map params); + List getFeaturesByStageProcedure(Map params); + + void batchUpdate(ProductFeaturesDTO[] lists); + + List getFeaturesList(Map params); } \ No newline at end of file diff --git a/ym-baisc/src/main/java/com/cnbm/basic/service/IProductWorkingprocedureRelationService.java b/ym-baisc/src/main/java/com/cnbm/basic/service/IProductWorkingprocedureRelationService.java index 1a7c13e..75c7936 100644 --- a/ym-baisc/src/main/java/com/cnbm/basic/service/IProductWorkingprocedureRelationService.java +++ b/ym-baisc/src/main/java/com/cnbm/basic/service/IProductWorkingprocedureRelationService.java @@ -1,5 +1,6 @@ package com.cnbm.basic.service; +import com.cnbm.basic.dto.SequenceDTO; import com.cnbm.basic.dto.WorkingProcedureDTO; import com.cnbm.common.page.PageData; import com.cnbm.common.service.CrudService; @@ -29,4 +30,8 @@ public interface IProductWorkingprocedureRelationService extends CrudService getWorkingprocedureByProductId(Long productId); void batchInsertWorkingprocedure(ProductWorkingprocedureRelationDTO[] lists); + + void sequenceUp(SequenceDTO sequenceDTO); + + void sequenceDown(SequenceDTO sequenceDTO); } \ No newline at end of file diff --git a/ym-baisc/src/main/java/com/cnbm/basic/service/impl/FeaturesStageProcedureRelationServiceImpl.java b/ym-baisc/src/main/java/com/cnbm/basic/service/impl/FeaturesStageProcedureRelationServiceImpl.java index 78fe2bd..942ed6e 100644 --- a/ym-baisc/src/main/java/com/cnbm/basic/service/impl/FeaturesStageProcedureRelationServiceImpl.java +++ b/ym-baisc/src/main/java/com/cnbm/basic/service/impl/FeaturesStageProcedureRelationServiceImpl.java @@ -90,4 +90,12 @@ public class FeaturesStageProcedureRelationServiceImpl extends CrudServiceImpl params){ + + mapper.deleteByStageProcedure(params); + } + + } \ No newline at end of file diff --git a/ym-baisc/src/main/java/com/cnbm/basic/service/impl/ProductFeaturesServiceImpl.java b/ym-baisc/src/main/java/com/cnbm/basic/service/impl/ProductFeaturesServiceImpl.java index b56d544..ee0965e 100644 --- a/ym-baisc/src/main/java/com/cnbm/basic/service/impl/ProductFeaturesServiceImpl.java +++ b/ym-baisc/src/main/java/com/cnbm/basic/service/impl/ProductFeaturesServiceImpl.java @@ -4,19 +4,19 @@ 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.basic.dto.FeaturesStageProcedureRelationDTO; -import com.cnbm.basic.dto.ProductFeaturesHisDTO; -import com.cnbm.basic.dto.WorkingProcedureDTO; +import com.cnbm.basic.dto.*; import com.cnbm.basic.entity.ProductFeaturesHis; import com.cnbm.basic.entity.ProductWorkingprocedureRelation; import com.cnbm.basic.entity.WorkingProcedure; import com.cnbm.common.page.PageData; import com.cnbm.common.service.impl.CrudServiceImpl; -import com.cnbm.basic.dto.ProductFeaturesDTO; import com.cnbm.basic.mapper.ProductFeaturesMapper; import com.cnbm.basic.entity.ProductFeatures; import com.cnbm.basic.service.IProductFeaturesService; 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.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -124,8 +124,24 @@ public class ProductFeaturesServiceImpl extends CrudServiceImpl getFeaturesByStageProcedure(Map params){ - List list = mapper.getFeaturesByStageProcedure(params); + public List getFeaturesByStageProcedure(Map params){ + List 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 getFeaturesList(Map params){ + List list = mapper.getFeaturesList(params); return list; } } \ No newline at end of file diff --git a/ym-baisc/src/main/java/com/cnbm/basic/service/impl/ProductWorkingprocedureRelationServiceImpl.java b/ym-baisc/src/main/java/com/cnbm/basic/service/impl/ProductWorkingprocedureRelationServiceImpl.java index fa05a40..06c3518 100644 --- a/ym-baisc/src/main/java/com/cnbm/basic/service/impl/ProductWorkingprocedureRelationServiceImpl.java +++ b/ym-baisc/src/main/java/com/cnbm/basic/service/impl/ProductWorkingprocedureRelationServiceImpl.java @@ -3,6 +3,9 @@ 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.basic.dto.ProductFeaturesDTO; +import com.cnbm.basic.dto.SequenceDTO; import com.cnbm.basic.dto.WorkingProcedureDTO; import com.cnbm.basic.entity.WorkingProcedure; 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.group.AddGroup; import com.cnbm.common.validator.group.DefaultGroup; +import com.cnbm.common.validator.group.UpdateGroup; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; /** * 工序 表 @@ -34,6 +36,9 @@ import java.util.Map; @Service public class ProductWorkingprocedureRelationServiceImpl extends CrudServiceImpl implements IProductWorkingprocedureRelationService { + @Autowired + private ProductWorkingprocedureRelationMapper mapper; + @Override public QueryWrapper getWrapper(Map params){ String id = (String)params.get("id"); @@ -59,11 +64,32 @@ public class ProductWorkingprocedureRelationServiceImpl extends CrudServiceImpl< return ConvertUtils.sourceToTarget(entity, ProductWorkingprocedureRelationDTO.class); } + @Override @Transactional(rollbackFor = Exception.class) public void save(ProductWorkingprocedureRelationDTO dto) { - ProductWorkingprocedureRelation entity = ConvertUtils.sourceToTarget(dto, ProductWorkingprocedureRelation.class); - insert(entity); + //判断数据是否已经绑定过 + QueryWrapper 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 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 @@ -80,6 +106,7 @@ public class ProductWorkingprocedureRelationServiceImpl extends CrudServiceImpl< deleteBatchIds(Arrays.asList(ids)); } + /* @Autowired private WorkingProcedureServiceImpl workingProcedureServiceImpl; @@ -103,6 +130,13 @@ public class ProductWorkingprocedureRelationServiceImpl extends CrudServiceImpl< } return dtoList; } + */ + + @Override + public List getWorkingprocedureByProductId(Long productId){ + List list= mapper.getWorkingprocedureByProductId(productId); + return list; + } @Override @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 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 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); + } + } } \ No newline at end of file diff --git a/ym-baisc/src/main/resources/mapper/FeaturesStageProcedureRelationMapper.xml b/ym-baisc/src/main/resources/mapper/FeaturesStageProcedureRelationMapper.xml index 26ccbce..d53dc3a 100644 --- a/ym-baisc/src/main/resources/mapper/FeaturesStageProcedureRelationMapper.xml +++ b/ym-baisc/src/main/resources/mapper/FeaturesStageProcedureRelationMapper.xml @@ -17,4 +17,12 @@ + + diff --git a/ym-baisc/src/main/resources/mapper/ProductFeaturesMapper.xml b/ym-baisc/src/main/resources/mapper/ProductFeaturesMapper.xml index e667d73..ae09175 100644 --- a/ym-baisc/src/main/resources/mapper/ProductFeaturesMapper.xml +++ b/ym-baisc/src/main/resources/mapper/ProductFeaturesMapper.xml @@ -14,12 +14,33 @@ order by p.id asc + + + + diff --git a/ym-baisc/src/main/resources/mapper/ProductWorkingprocedureRelationMapper.xml b/ym-baisc/src/main/resources/mapper/ProductWorkingprocedureRelationMapper.xml index 4fc60af..b6e4747 100644 --- a/ym-baisc/src/main/resources/mapper/ProductWorkingprocedureRelationMapper.xml +++ b/ym-baisc/src/main/resources/mapper/ProductWorkingprocedureRelationMapper.xml @@ -2,4 +2,19 @@ + + diff --git a/ym-process-inspection/src/main/java/com/cnbm/processInspection/controller/InspectionSheetController.java b/ym-process-inspection/src/main/java/com/cnbm/processInspection/controller/InspectionSheetController.java index c371460..bc08129 100644 --- a/ym-process-inspection/src/main/java/com/cnbm/processInspection/controller/InspectionSheetController.java +++ b/ym-process-inspection/src/main/java/com/cnbm/processInspection/controller/InspectionSheetController.java @@ -10,9 +10,11 @@ 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.processInspection.dto.InspectionSheetDTO; 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; @@ -140,4 +142,16 @@ public class InspectionSheetController { 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 getFluxParamList(@ApiIgnore @RequestParam Map params){ + return inspectionSheetService.getFluxParamList(params); + } + } \ No newline at end of file diff --git a/ym-process-inspection/src/main/java/com/cnbm/processInspection/service/IInspectionSheetService.java b/ym-process-inspection/src/main/java/com/cnbm/processInspection/service/IInspectionSheetService.java index 54f9c11..529e55b 100644 --- a/ym-process-inspection/src/main/java/com/cnbm/processInspection/service/IInspectionSheetService.java +++ b/ym-process-inspection/src/main/java/com/cnbm/processInspection/service/IInspectionSheetService.java @@ -2,8 +2,10 @@ package com.cnbm.processInspection.service; import com.cnbm.common.page.PageData; import com.cnbm.common.service.CrudService; +import com.cnbm.influx.param.QueryDataParam; import com.cnbm.processInspection.dto.InspectionSheetDTO; import com.cnbm.processInspection.entity.InspectionSheet; +import com.influxdb.query.FluxTable; import java.util.List; import java.util.Map; @@ -27,5 +29,7 @@ public interface IInspectionSheetService extends CrudService list(Map params); + + List getFluxParamList(Map params); } \ No newline at end of file diff --git a/ym-process-inspection/src/main/java/com/cnbm/processInspection/service/impl/InspectionSheetServiceImpl.java b/ym-process-inspection/src/main/java/com/cnbm/processInspection/service/impl/InspectionSheetServiceImpl.java index ea1167b..712e05e 100644 --- a/ym-process-inspection/src/main/java/com/cnbm/processInspection/service/impl/InspectionSheetServiceImpl.java +++ b/ym-process-inspection/src/main/java/com/cnbm/processInspection/service/impl/InspectionSheetServiceImpl.java @@ -14,16 +14,23 @@ import com.cnbm.basic.service.impl.WorkingProcedureServiceImpl; import com.cnbm.common.page.PageData; import com.cnbm.common.service.impl.CrudServiceImpl; 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.entity.InspectionSheet; import com.cnbm.processInspection.mapper.InspectionSheetMapper; import com.cnbm.processInspection.service.IInspectionSheetService; +import com.influxdb.query.FluxTable; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.time.Instant; import java.util.Arrays; +import java.util.Date; import java.util.List; import java.util.Map; @@ -144,4 +151,20 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl list = mapper.list(params); return list; } + + @Override + public List getFluxParamList(Map 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 list = InfluxClient.Client.query(queryDataParam); + return list; + } } \ No newline at end of file