Compare commits

...

10 Commits

Author SHA1 Message Date
32647c035c CommonField 2023-06-25 16:34:35 +08:00
9546ceec03 Merge branch 'master' of http://git.picaiba.com/CaiXiang/SPC into yanyang 2023-06-25 15:29:24 +08:00
3a583ac09f 通用作业 检验时间 2023-06-25 15:28:23 +08:00
caixiang
e149150b1d mark 2023-05-30 16:07:24 +08:00
caixiang
3d5e5e5845 mark 2023-05-30 15:52:00 +08:00
caixiang
5a9f5ee38b mark 2023-05-09 14:24:13 +08:00
caixiang
7c21dfe8e1 初定 第一版 2023-01-13 11:01:42 +08:00
caixiang
2bc72469a0 初定 第一版 2023-01-11 15:58:24 +08:00
caixiang
cafcdd65e0 初定 第一版 2023-01-09 16:57:52 +08:00
cc5848e5cd Merge pull request 'yanyang' (#19) from yanyang into master
Reviewed-on: #19
2023-01-06 16:37:27 +08:00
44 changed files with 297 additions and 159 deletions

View File

@ -3,6 +3,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.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.admin.utils.BaseSupportUtils;
import com.cnbm.basic.dto.MachineDTO; import com.cnbm.basic.dto.MachineDTO;
import com.cnbm.basic.dto.ProductTypeDTO; import com.cnbm.basic.dto.ProductTypeDTO;
import com.cnbm.basic.entity.ProductType; import com.cnbm.basic.entity.ProductType;
@ -67,6 +68,7 @@ public class FactoryServiceImpl extends CrudServiceImpl<FactoryMapper, Factory,
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void save(FactoryDTO dto) { public void save(FactoryDTO dto) {
Factory entity = ConvertUtils.sourceToTarget(dto, Factory.class); Factory entity = ConvertUtils.sourceToTarget(dto, Factory.class);
BaseSupportUtils.setCommonField(entity);
insert(entity); insert(entity);
} }
@ -74,6 +76,7 @@ public class FactoryServiceImpl extends CrudServiceImpl<FactoryMapper, Factory,
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(FactoryDTO dto) { public void update(FactoryDTO dto) {
Factory entity = ConvertUtils.sourceToTarget(dto, Factory.class); Factory entity = ConvertUtils.sourceToTarget(dto, Factory.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity); updateById(entity);
} }

View File

@ -3,6 +3,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.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.admin.utils.BaseSupportUtils;
import com.cnbm.basic.dto.ProductFeaturesDTO; import com.cnbm.basic.dto.ProductFeaturesDTO;
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;
@ -64,6 +65,7 @@ public class FeaturesStageProcedureRelationServiceImpl extends CrudServiceImpl<F
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void save(FeaturesStageProcedureRelationDTO dto) { public void save(FeaturesStageProcedureRelationDTO dto) {
FeaturesStageProcedureRelation entity = ConvertUtils.sourceToTarget(dto, FeaturesStageProcedureRelation.class); FeaturesStageProcedureRelation entity = ConvertUtils.sourceToTarget(dto, FeaturesStageProcedureRelation.class);
BaseSupportUtils.setCommonField(entity);
insert(entity); insert(entity);
} }
@ -71,6 +73,7 @@ public class FeaturesStageProcedureRelationServiceImpl extends CrudServiceImpl<F
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(FeaturesStageProcedureRelationDTO dto) { public void update(FeaturesStageProcedureRelationDTO dto) {
FeaturesStageProcedureRelation entity = ConvertUtils.sourceToTarget(dto, FeaturesStageProcedureRelation.class); FeaturesStageProcedureRelation entity = ConvertUtils.sourceToTarget(dto, FeaturesStageProcedureRelation.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity); updateById(entity);
} }
@ -86,6 +89,7 @@ public class FeaturesStageProcedureRelationServiceImpl extends CrudServiceImpl<F
public void batchInsert(FeaturesStageProcedureRelationDTO[] lists) { public void batchInsert(FeaturesStageProcedureRelationDTO[] lists) {
for(FeaturesStageProcedureRelationDTO dto:lists){ for(FeaturesStageProcedureRelationDTO dto:lists){
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
BaseSupportUtils.setCommonField(dto);
save(dto); save(dto);
} }
} }

View File

@ -4,6 +4,7 @@ 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.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cnbm.admin.utils.BaseSupportUtils;
import com.cnbm.basic.entity.Platform; import com.cnbm.basic.entity.Platform;
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;
@ -95,6 +96,7 @@ public class MachineServiceImpl extends CrudServiceImpl<MachineMapper, Machine,
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void save(MachineDTO dto) { public void save(MachineDTO dto) {
Machine entity = ConvertUtils.sourceToTarget(dto, Machine.class); Machine entity = ConvertUtils.sourceToTarget(dto, Machine.class);
BaseSupportUtils.setCommonField(entity);
insert(entity); insert(entity);
} }
@ -102,6 +104,7 @@ public class MachineServiceImpl extends CrudServiceImpl<MachineMapper, Machine,
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(MachineDTO dto) { public void update(MachineDTO dto) {
Machine entity = ConvertUtils.sourceToTarget(dto, Machine.class); Machine entity = ConvertUtils.sourceToTarget(dto, Machine.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity); updateById(entity);
} }

View File

@ -3,6 +3,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.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.admin.utils.BaseSupportUtils;
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.MeasureToolDTO; import com.cnbm.basic.dto.MeasureToolDTO;
@ -61,6 +62,7 @@ public class MeasureToolServiceImpl extends CrudServiceImpl<MeasureToolMapper, M
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void save(MeasureToolDTO dto) { public void save(MeasureToolDTO dto) {
MeasureTool entity = ConvertUtils.sourceToTarget(dto, MeasureTool.class); MeasureTool entity = ConvertUtils.sourceToTarget(dto, MeasureTool.class);
BaseSupportUtils.setCommonField(entity);
insert(entity); insert(entity);
} }
@ -68,6 +70,7 @@ public class MeasureToolServiceImpl extends CrudServiceImpl<MeasureToolMapper, M
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(MeasureToolDTO dto) { public void update(MeasureToolDTO dto) {
MeasureTool entity = ConvertUtils.sourceToTarget(dto, MeasureTool.class); MeasureTool entity = ConvertUtils.sourceToTarget(dto, MeasureTool.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity); updateById(entity);
} }

View File

@ -3,6 +3,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.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.admin.utils.BaseSupportUtils;
import com.cnbm.basic.dto.FactoryDTO; import com.cnbm.basic.dto.FactoryDTO;
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;
@ -64,6 +65,7 @@ private PlatformMapper mapper;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void save(PlatformDTO dto) { public void save(PlatformDTO dto) {
Platform entity = ConvertUtils.sourceToTarget(dto, Platform.class); Platform entity = ConvertUtils.sourceToTarget(dto, Platform.class);
BaseSupportUtils.setCommonField(entity);
insert(entity); insert(entity);
} }
@ -71,6 +73,7 @@ private PlatformMapper mapper;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(PlatformDTO dto) { public void update(PlatformDTO dto) {
Platform entity = ConvertUtils.sourceToTarget(dto, Platform.class); Platform entity = ConvertUtils.sourceToTarget(dto, Platform.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity); updateById(entity);
} }

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.admin.utils.BaseSupportUtils;
import com.cnbm.basic.dto.ProductWorkingprocedureRelationDTO; 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;
@ -58,6 +59,7 @@ public class ProductFactoryRelationServiceImpl extends CrudServiceImpl<ProductFa
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void save(ProductFactoryRelationDTO dto) { public void save(ProductFactoryRelationDTO dto) {
ProductFactoryRelation entity = ConvertUtils.sourceToTarget(dto, ProductFactoryRelation.class); ProductFactoryRelation entity = ConvertUtils.sourceToTarget(dto, ProductFactoryRelation.class);
BaseSupportUtils.setCommonField(entity);
insert(entity); insert(entity);
} }
@ -65,6 +67,7 @@ public class ProductFactoryRelationServiceImpl extends CrudServiceImpl<ProductFa
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(ProductFactoryRelationDTO dto) { public void update(ProductFactoryRelationDTO dto) {
ProductFactoryRelation entity = ConvertUtils.sourceToTarget(dto, ProductFactoryRelation.class); ProductFactoryRelation entity = ConvertUtils.sourceToTarget(dto, ProductFactoryRelation.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity); updateById(entity);
} }
@ -80,6 +83,7 @@ public class ProductFactoryRelationServiceImpl extends CrudServiceImpl<ProductFa
public void batchInsertFactory(ProductFactoryRelationDTO[] lists) { public void batchInsertFactory(ProductFactoryRelationDTO[] lists) {
for(ProductFactoryRelationDTO dto:lists){ for(ProductFactoryRelationDTO dto:lists){
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
BaseSupportUtils.setCommonField(dto);
save(dto); save(dto);
} }
} }

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.admin.utils.BaseSupportUtils;
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.ProductFeaturesHisDTO; import com.cnbm.basic.dto.ProductFeaturesHisDTO;
@ -55,6 +56,7 @@ public class ProductFeaturesHisServiceImpl extends CrudServiceImpl<ProductFeatur
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void save(ProductFeaturesHisDTO dto) { public void save(ProductFeaturesHisDTO dto) {
ProductFeaturesHis entity = ConvertUtils.sourceToTarget(dto, ProductFeaturesHis.class); ProductFeaturesHis entity = ConvertUtils.sourceToTarget(dto, ProductFeaturesHis.class);
BaseSupportUtils.setCommonField(entity);
insert(entity); insert(entity);
} }
@ -62,6 +64,7 @@ public class ProductFeaturesHisServiceImpl extends CrudServiceImpl<ProductFeatur
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(ProductFeaturesHisDTO dto) { public void update(ProductFeaturesHisDTO dto) {
ProductFeaturesHis entity = ConvertUtils.sourceToTarget(dto, ProductFeaturesHis.class); ProductFeaturesHis entity = ConvertUtils.sourceToTarget(dto, ProductFeaturesHis.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity); updateById(entity);
} }

View File

@ -4,6 +4,7 @@ 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.admin.utils.BaseSupportUtils;
import com.cnbm.basic.dto.*; import com.cnbm.basic.dto.*;
import com.cnbm.basic.entity.ProductFeaturesHis; import com.cnbm.basic.entity.ProductFeaturesHis;
import com.cnbm.basic.entity.ProductWorkingprocedureRelation; import com.cnbm.basic.entity.ProductWorkingprocedureRelation;
@ -66,6 +67,7 @@ public class ProductFeaturesServiceImpl extends CrudServiceImpl<ProductFeaturesM
public void save(ProductFeaturesDTO dto) { public void save(ProductFeaturesDTO dto) {
ProductFeatures entity = ConvertUtils.sourceToTarget(dto, ProductFeatures.class); ProductFeatures entity = ConvertUtils.sourceToTarget(dto, ProductFeatures.class);
BaseSupportUtils.setCommonField(entity);
insert(entity); insert(entity);
} }
@ -93,6 +95,7 @@ public class ProductFeaturesServiceImpl extends CrudServiceImpl<ProductFeaturesM
productFeaturesHisServiceImpl.save(history); productFeaturesHisServiceImpl.save(history);
//更新 //更新
ProductFeatures entity = ConvertUtils.sourceToTarget(dto, ProductFeatures.class); ProductFeatures entity = ConvertUtils.sourceToTarget(dto, ProductFeatures.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity); updateById(entity);
} }
@ -146,6 +149,7 @@ public class ProductFeaturesServiceImpl extends CrudServiceImpl<ProductFeaturesM
for(ProductFeaturesDTO dto:lists){ for(ProductFeaturesDTO dto:lists){
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
BaseSupportUtils.setUpdateCommonField(dto);
update(dto); update(dto);
} }
} }

View File

@ -4,6 +4,7 @@ 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.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cnbm.admin.utils.BaseSupportUtils;
import com.cnbm.basic.entity.ProductType; import com.cnbm.basic.entity.ProductType;
import com.cnbm.basic.mapper.ProductFactoryRelationMapper; import com.cnbm.basic.mapper.ProductFactoryRelationMapper;
import com.cnbm.common.page.PageData; import com.cnbm.common.page.PageData;
@ -96,6 +97,7 @@ public class ProductServiceImpl extends CrudServiceImpl<ProductMapper, Product,
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public IdVo add(ProductDTO dto) { public IdVo add(ProductDTO dto) {
Product entity = ConvertUtils.sourceToTarget(dto, Product.class); Product entity = ConvertUtils.sourceToTarget(dto, Product.class);
BaseSupportUtils.setCommonField(entity);
insert(entity); insert(entity);
//返回新增产品id //返回新增产品id
return IdVo.builder().id(entity.getId()).build(); return IdVo.builder().id(entity.getId()).build();
@ -105,6 +107,7 @@ public class ProductServiceImpl extends CrudServiceImpl<ProductMapper, Product,
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(ProductDTO dto) { public void update(ProductDTO dto) {
Product entity = ConvertUtils.sourceToTarget(dto, Product.class); Product entity = ConvertUtils.sourceToTarget(dto, Product.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity); updateById(entity);
} }

View File

@ -6,6 +6,7 @@ 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.admin.dto.SysDictDataDTO; import com.cnbm.admin.dto.SysDictDataDTO;
import com.cnbm.admin.entity.SysDictDataEntity; import com.cnbm.admin.entity.SysDictDataEntity;
import com.cnbm.admin.utils.BaseSupportUtils;
import com.cnbm.basic.dto.FactoryDTO; import com.cnbm.basic.dto.FactoryDTO;
import com.cnbm.common.constant.Constant; import com.cnbm.common.constant.Constant;
import com.cnbm.common.page.PageData; import com.cnbm.common.page.PageData;
@ -68,6 +69,7 @@ public class ProductTypeServiceImpl extends CrudServiceImpl<ProductTypeMapper, P
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void save(ProductTypeDTO dto) { public void save(ProductTypeDTO dto) {
ProductType entity = ConvertUtils.sourceToTarget(dto, ProductType.class); ProductType entity = ConvertUtils.sourceToTarget(dto, ProductType.class);
BaseSupportUtils.setCommonField(entity);
insert(entity); insert(entity);
} }
@ -75,6 +77,7 @@ public class ProductTypeServiceImpl extends CrudServiceImpl<ProductTypeMapper, P
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(ProductTypeDTO dto) { public void update(ProductTypeDTO dto) {
ProductType entity = ConvertUtils.sourceToTarget(dto, ProductType.class); ProductType entity = ConvertUtils.sourceToTarget(dto, ProductType.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity); updateById(entity);
} }

View File

@ -4,6 +4,7 @@ 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.utils.BaseSupportUtils;
import com.cnbm.basic.dto.ProductFeaturesDTO; import com.cnbm.basic.dto.ProductFeaturesDTO;
import com.cnbm.basic.dto.SequenceDTO; import com.cnbm.basic.dto.SequenceDTO;
import com.cnbm.basic.dto.WorkingProcedureDTO; import com.cnbm.basic.dto.WorkingProcedureDTO;
@ -85,6 +86,7 @@ public class ProductWorkingprocedureRelationServiceImpl extends CrudServiceImpl<
Integer lastSequence = lastDto.getSequence(); Integer lastSequence = lastDto.getSequence();
entity.setSequence(lastSequence + 1); entity.setSequence(lastSequence + 1);
} }
BaseSupportUtils.setCommonField(entity);
insert(entity); insert(entity);
} }
else{ else{
@ -96,6 +98,7 @@ public class ProductWorkingprocedureRelationServiceImpl extends CrudServiceImpl<
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(ProductWorkingprocedureRelationDTO dto) { public void update(ProductWorkingprocedureRelationDTO dto) {
ProductWorkingprocedureRelation entity = ConvertUtils.sourceToTarget(dto, ProductWorkingprocedureRelation.class); ProductWorkingprocedureRelation entity = ConvertUtils.sourceToTarget(dto, ProductWorkingprocedureRelation.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity); updateById(entity);
} }
@ -143,6 +146,7 @@ public class ProductWorkingprocedureRelationServiceImpl extends CrudServiceImpl<
public void batchInsertWorkingprocedure(ProductWorkingprocedureRelationDTO[] lists) { public void batchInsertWorkingprocedure(ProductWorkingprocedureRelationDTO[] lists) {
for(ProductWorkingprocedureRelationDTO dto:lists){ for(ProductWorkingprocedureRelationDTO dto:lists){
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
BaseSupportUtils.setCommonField(dto);
save(dto); save(dto);
} }
} }

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.admin.utils.BaseSupportUtils;
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.ShiftDTO; import com.cnbm.basic.dto.ShiftDTO;
@ -60,6 +61,7 @@ public class ShiftServiceImpl extends CrudServiceImpl<ShiftMapper, Shift, ShiftD
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void save(ShiftDTO dto) { public void save(ShiftDTO dto) {
Shift entity = ConvertUtils.sourceToTarget(dto, Shift.class); Shift entity = ConvertUtils.sourceToTarget(dto, Shift.class);
BaseSupportUtils.setCommonField(entity);
insert(entity); insert(entity);
} }
@ -67,6 +69,7 @@ public class ShiftServiceImpl extends CrudServiceImpl<ShiftMapper, Shift, ShiftD
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(ShiftDTO dto) { public void update(ShiftDTO dto) {
Shift entity = ConvertUtils.sourceToTarget(dto, Shift.class); Shift entity = ConvertUtils.sourceToTarget(dto, Shift.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity); updateById(entity);
} }

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.admin.utils.BaseSupportUtils;
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.TeamDTO; import com.cnbm.basic.dto.TeamDTO;
@ -60,6 +61,7 @@ public class TeamServiceImpl extends CrudServiceImpl<TeamMapper, Team, TeamDTO>
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void save(TeamDTO dto) { public void save(TeamDTO dto) {
Team entity = ConvertUtils.sourceToTarget(dto, Team.class); Team entity = ConvertUtils.sourceToTarget(dto, Team.class);
BaseSupportUtils.setCommonField(entity);
insert(entity); insert(entity);
} }
@ -67,6 +69,7 @@ public class TeamServiceImpl extends CrudServiceImpl<TeamMapper, Team, TeamDTO>
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(TeamDTO dto) { public void update(TeamDTO dto) {
Team entity = ConvertUtils.sourceToTarget(dto, Team.class); Team entity = ConvertUtils.sourceToTarget(dto, Team.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity); updateById(entity);
} }

View File

@ -3,6 +3,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.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.admin.utils.BaseSupportUtils;
import com.cnbm.basic.dto.FactoryDTO; import com.cnbm.basic.dto.FactoryDTO;
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;
@ -64,6 +65,7 @@ public class UnitServiceImpl extends CrudServiceImpl<UnitMapper, Unit, UnitDTO>
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void save(UnitDTO dto) { public void save(UnitDTO dto) {
Unit entity = ConvertUtils.sourceToTarget(dto, Unit.class); Unit entity = ConvertUtils.sourceToTarget(dto, Unit.class);
BaseSupportUtils.setCommonField(entity);
insert(entity); insert(entity);
} }
@ -71,6 +73,7 @@ public class UnitServiceImpl extends CrudServiceImpl<UnitMapper, Unit, UnitDTO>
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(UnitDTO dto) { public void update(UnitDTO dto) {
Unit entity = ConvertUtils.sourceToTarget(dto, Unit.class); Unit entity = ConvertUtils.sourceToTarget(dto, Unit.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity); updateById(entity);
} }

View File

@ -3,6 +3,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.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.admin.utils.BaseSupportUtils;
import com.cnbm.basic.dto.UnitDTO; import com.cnbm.basic.dto.UnitDTO;
import com.cnbm.basic.dto.WorkingProcedureTypeDTO; import com.cnbm.basic.dto.WorkingProcedureTypeDTO;
import com.cnbm.basic.entity.Machine; import com.cnbm.basic.entity.Machine;
@ -107,6 +108,7 @@ public class WorkingProcedureServiceImpl extends CrudServiceImpl<WorkingProcedur
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void save(WorkingProcedureDTO dto) { public void save(WorkingProcedureDTO dto) {
WorkingProcedure entity = ConvertUtils.sourceToTarget(dto, WorkingProcedure.class); WorkingProcedure entity = ConvertUtils.sourceToTarget(dto, WorkingProcedure.class);
BaseSupportUtils.setCommonField(entity);
insert(entity); insert(entity);
} }
@ -114,6 +116,7 @@ public class WorkingProcedureServiceImpl extends CrudServiceImpl<WorkingProcedur
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(WorkingProcedureDTO dto) { public void update(WorkingProcedureDTO dto) {
WorkingProcedure entity = ConvertUtils.sourceToTarget(dto, WorkingProcedure.class); WorkingProcedure entity = ConvertUtils.sourceToTarget(dto, WorkingProcedure.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity); updateById(entity);
} }

View File

@ -3,6 +3,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.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.admin.utils.BaseSupportUtils;
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.WorkingProcedureTypeDTO; import com.cnbm.basic.dto.WorkingProcedureTypeDTO;
@ -59,6 +60,7 @@ public class WorkingProcedureTypeServiceImpl extends CrudServiceImpl<WorkingProc
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void save(WorkingProcedureTypeDTO dto) { public void save(WorkingProcedureTypeDTO dto) {
WorkingProcedureType entity = ConvertUtils.sourceToTarget(dto, WorkingProcedureType.class); WorkingProcedureType entity = ConvertUtils.sourceToTarget(dto, WorkingProcedureType.class);
BaseSupportUtils.setCommonField(entity);
insert(entity); insert(entity);
} }
@ -66,6 +68,7 @@ public class WorkingProcedureTypeServiceImpl extends CrudServiceImpl<WorkingProc
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(WorkingProcedureTypeDTO dto) { public void update(WorkingProcedureTypeDTO dto) {
WorkingProcedureType entity = ConvertUtils.sourceToTarget(dto, WorkingProcedureType.class); WorkingProcedureType entity = ConvertUtils.sourceToTarget(dto, WorkingProcedureType.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity); updateById(entity);
} }

View File

@ -86,4 +86,61 @@
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.5.12</version>
<configuration>
<!--指定运行main函数的包-->
<mainClass>com.cnbm.YmApplication</mainClass>
<!--开启分层编译支持-->
<layers>
<enabled>true</enabled>
<configuration>${project.basedir}/src/main/resources/layers.xml</configuration>
</layers>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${docker.plugin.version}</version>
<configuration>
<imageName>ym-pass/${project.artifactId}</imageName>
<dockerDirectory>${project.basedir}/</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>
</project> </project>

View File

@ -21,14 +21,11 @@ import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.spring.web.plugins.WebFluxRequestHandlerProvider; import springfox.documentation.spring.web.plugins.WebFluxRequestHandlerProvider;
import springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider; import springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.google.common.collect.Lists.newArrayList;
/** /**
* @Author weihongyang * @Author weihongyang
* @Date 2022/6/21 10:56 AM * @Date 2022/6/21 10:56 AM
@ -128,6 +125,7 @@ public class SwaggerConfig {
.securitySchemes(Arrays.asList(new ApiKey("token", "token", "header"))); .securitySchemes(Arrays.asList(new ApiKey("token", "token", "header")));
} }
@Bean @Bean
public Docket processInspectionApi() { public Docket processInspectionApi() {
return new Docket(DocumentationType.SWAGGER_2) return new Docket(DocumentationType.SWAGGER_2)

View File

@ -33,9 +33,9 @@ spring:
enabled: true enabled: true
redis: redis:
database: 2 database: 2
host: redis.picaiba.com host: 127.0.0.1
port: 6380 port: 6379
password: '@WSXcde3' # 密码(默认为空) password: '' # 密码(默认为空)
timeout: 6000ms # 连接超时时长(毫秒) timeout: 6000ms # 连接超时时长(毫秒)
jedis: jedis:
pool: pool:

View File

@ -0,0 +1,27 @@
<layers xmlns="http://www.springframework.org/schema/boot/layers"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/boot/layers
https://www.springframework.org/schema/boot/layers/layers.xsd">
<application>
<into layer="spring-boot-loader">
<include>org/springframework/boot/loader/**</include>
</into>
<into layer="application" />
</application>
<dependencies>
<into layer="snapshot-dependencies">
<include>*:*:*SNAPSHOT</include>
</into>
<into layer="company-dependencies">
<include>com.cnbm:*</include>
</into>
<into layer="dependencies"/>
</dependencies>
<layerOrder>
<layer>dependencies</layer>
<layer>spring-boot-loader</layer>
<layer>snapshot-dependencies</layer>
<layer>company-dependencies</layer>
<layer>application</layer>
</layerOrder>
</layers>

View File

@ -19,7 +19,7 @@ public class CodeGenerator {
@Test @Test
public void test(){ public void test(){
mybatisPlusGenerator(new String[]{"inspection_sheet"}); mybatisPlusGenerator(new String[]{"unit"});
} }
public static void mybatisPlusGenerator(String[] include){ public static void mybatisPlusGenerator(String[] include){

View File

@ -51,7 +51,6 @@ public class InspectionSheetController {
@PreAuthorize("@ex.hasAuthority('code:inspectionSheet:page')") @PreAuthorize("@ex.hasAuthority('code:inspectionSheet:page')")
public Result<PageData<InspectionSheetDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ public Result<PageData<InspectionSheetDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<InspectionSheetDTO> page = inspectionSheetService.page(params); PageData<InspectionSheetDTO> page = inspectionSheetService.page(params);
return new Result<PageData<InspectionSheetDTO>>().ok(page); return new Result<PageData<InspectionSheetDTO>>().ok(page);
} }
@ -60,7 +59,6 @@ public class InspectionSheetController {
@PreAuthorize("@ex.hasAuthority('code:inspectionSheet:info')") @PreAuthorize("@ex.hasAuthority('code:inspectionSheet:info')")
public Result<InspectionSheetDTO> get(@PathVariable("id") Long id){ public Result<InspectionSheetDTO> get(@PathVariable("id") Long id){
InspectionSheetDTO data = inspectionSheetService.get(id); InspectionSheetDTO data = inspectionSheetService.get(id);
return new Result<InspectionSheetDTO>().ok(data); return new Result<InspectionSheetDTO>().ok(data);
} }
@ -71,7 +69,6 @@ public class InspectionSheetController {
public Result<Long> save(@RequestBody InspectionSheetDTO dto){ public Result<Long> save(@RequestBody InspectionSheetDTO dto){
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
try { try {
inspectionSheetService.save(dto); inspectionSheetService.save(dto);
}catch (Exception e){ }catch (Exception e){
@ -86,9 +83,7 @@ public class InspectionSheetController {
public Result<Long> update(@RequestBody InspectionSheetDTO dto){ public Result<Long> update(@RequestBody InspectionSheetDTO dto){
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
inspectionSheetService.update(dto); inspectionSheetService.update(dto);
return new Result<Long>().ok(dto.getId()); return new Result<Long>().ok(dto.getId());
} }
@ -99,9 +94,7 @@ public class InspectionSheetController {
public Result delete(@RequestBody Long[] ids){ public Result delete(@RequestBody Long[] ids){
//效验数据 //效验数据
AssertUtils.isArrayEmpty(ids, "id"); AssertUtils.isArrayEmpty(ids, "id");
inspectionSheetService.delete(ids); inspectionSheetService.delete(ids);
return new Result(); return new Result();
} }
@ -111,8 +104,6 @@ public class InspectionSheetController {
@PreAuthorize("@ex.hasAuthority('code:inspectionSheet:export')") @PreAuthorize("@ex.hasAuthority('code:inspectionSheet: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<InspectionSheetDTO> list = inspectionSheetService.list(params); List<InspectionSheetDTO> list = inspectionSheetService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, InspectionSheetExcel.class); ExcelUtils.exportExcelToTarget(response, null, list, InspectionSheetExcel.class);
} }
} }

View File

@ -31,7 +31,7 @@ import java.util.Map;
* 单位 前端控制器 * 单位 前端控制器
* *
* @author why * @author why
* @since 2022-06-30 * @since 2023-01-12
*/ */
@RestController @RestController
@RequestMapping("/code/unit") @RequestMapping("/code/unit")
@ -68,26 +68,26 @@ public class UnitController {
@ApiOperation("保存") @ApiOperation("保存")
@LogOperation("保存") @LogOperation("保存")
@PreAuthorize("@ex.hasAuthority('code:unit:save')") @PreAuthorize("@ex.hasAuthority('code:unit:save')")
public Result save(@RequestBody UnitDTO dto){ public Result<Long> save(@RequestBody UnitDTO dto){
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
unitService.save(dto); unitService.save(dto);
return new Result(); return new Result<Long>().ok(dto.getId());
} }
@PutMapping @PutMapping
@ApiOperation("修改") @ApiOperation("修改")
@LogOperation("修改") @LogOperation("修改")
@PreAuthorize("@ex.hasAuthority('code:unit:update')") @PreAuthorize("@ex.hasAuthority('code:unit:update')")
public Result update(@RequestBody UnitDTO dto){ public Result<Long> update(@RequestBody UnitDTO dto){
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
unitService.update(dto); unitService.update(dto);
return new Result(); return new Result<Long>().ok(dto.getId());
} }
@DeleteMapping @DeleteMapping

View File

@ -14,7 +14,7 @@ import java.math.BigDecimal;
* 单位 * 单位
* *
* @author why * @author why
* @since 2022-06-30 * @since 2023-01-12
*/ */
@Data @Data
@ApiModel(value = "单位 表DTO对象") @ApiModel(value = "单位 表DTO对象")
@ -23,8 +23,8 @@ public class UnitDTO implements Serializable {
@ApiModelProperty(value = "ID") @ApiModelProperty(value = "")
private BigDecimal id; private Long id;
@ApiModelProperty(value = "单位 名") @ApiModelProperty(value = "单位 名")
private String name; private String name;
@ -33,19 +33,19 @@ public class UnitDTO implements Serializable {
private String code; private String code;
@ApiModelProperty(value = "单位类型1 可计数2 不可计数") @ApiModelProperty(value = "单位类型1 可计数2 不可计数")
private BigDecimal type; private Integer type;
@ApiModelProperty(value = "1 可用0 不可用") @ApiModelProperty(value = "1 可用0 不可用")
private BigDecimal status; private Integer status;
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String remark; private String remark;
@ApiModelProperty(value = "删除标志,是否有效:1 可用 0不可用") @ApiModelProperty(value = "删除标志,是否有效:1 可用 0不可用")
private BigDecimal valid; private Integer valid;
@ApiModelProperty(value = "创建人") @ApiModelProperty(value = "")
private BigDecimal creatorId; private Long creatorId;
@ApiModelProperty(value = "创建人姓名") @ApiModelProperty(value = "创建人姓名")
private String creatorName; private String creatorName;
@ -53,8 +53,8 @@ public class UnitDTO implements Serializable {
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
@ApiModelProperty(value = "更新人") @ApiModelProperty(value = "")
private BigDecimal updaterId; private Long updaterId;
@ApiModelProperty(value = "更新人姓名") @ApiModelProperty(value = "更新人姓名")
private String updaterName; private String updaterName;
@ -63,6 +63,6 @@ public class UnitDTO implements Serializable {
private LocalDateTime updateTime; private LocalDateTime updateTime;
@ApiModelProperty(value = "版本号") @ApiModelProperty(value = "版本号")
private BigDecimal version; private Integer version;
} }

View File

@ -1,7 +1,7 @@
package com.cnbm.generator.code.entity; package com.cnbm.generator.code.entity;
import com.baomidou.mybatisplus.annotation.TableLogic;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -13,7 +13,7 @@ import lombok.Data;
* </p> * </p>
* *
* @author why * @author why
* @since 2022-06-30 * @since 2023-01-12
*/ */
@Data @Data
@ApiModel(value = "Unit对象", description = "单位 表") @ApiModel(value = "Unit对象", description = "单位 表")
@ -21,8 +21,7 @@ public class Unit implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ApiModelProperty("ID") private Long id;
private BigDecimal id;
@ApiModelProperty("单位 名") @ApiModelProperty("单位 名")
private String name; private String name;
@ -31,19 +30,19 @@ public class Unit implements Serializable {
private String code; private String code;
@ApiModelProperty("单位类型1 可计数2 不可计数") @ApiModelProperty("单位类型1 可计数2 不可计数")
private BigDecimal type; private Integer type;
@ApiModelProperty("1 可用0 不可用") @ApiModelProperty("1 可用0 不可用")
private BigDecimal status; private Integer status;
@ApiModelProperty("备注") @ApiModelProperty("备注")
private String remark; private String remark;
@ApiModelProperty("删除标志,是否有效:1 可用 0不可用") @ApiModelProperty("删除标志,是否有效:1 可用 0不可用")
private BigDecimal valid; @TableLogic
private Integer valid;
@ApiModelProperty("创建人") private Long creatorId;
private BigDecimal creatorId;
@ApiModelProperty("创建人姓名") @ApiModelProperty("创建人姓名")
private String creatorName; private String creatorName;
@ -51,8 +50,7 @@ public class Unit implements Serializable {
@ApiModelProperty("创建时间") @ApiModelProperty("创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
@ApiModelProperty("更新人") private Long updaterId;
private BigDecimal updaterId;
@ApiModelProperty("更新人姓名") @ApiModelProperty("更新人姓名")
private String updaterName; private String updaterName;
@ -61,7 +59,7 @@ public class Unit implements Serializable {
private LocalDateTime updateTime; private LocalDateTime updateTime;
@ApiModelProperty("版本号") @ApiModelProperty("版本号")
private BigDecimal version; private Integer version;
} }

View File

@ -12,37 +12,37 @@ import java.util.Date;
* 单位 * 单位
* *
* @author why * @author why
* @since 2022-06-30 * @since 2023-01-12
*/ */
@Data @Data
public class UnitExcel { public class UnitExcel {
@Excel(name = "ID") @Excel(name = "")
private BigDecimal id; private Long id;
@Excel(name = "单位 名") @Excel(name = "单位 名")
private String name; private String name;
@Excel(name = "单位 编码") @Excel(name = "单位 编码")
private String code; private String code;
@Excel(name = "单位类型1 可计数2 不可计数") @Excel(name = "单位类型1 可计数2 不可计数")
private BigDecimal type; private Integer type;
@Excel(name = "1 可用0 不可用") @Excel(name = "1 可用0 不可用")
private BigDecimal status; private Integer status;
@Excel(name = "备注") @Excel(name = "备注")
private String remark; private String remark;
@Excel(name = "删除标志,是否有效:1 可用 0不可用") @Excel(name = "删除标志,是否有效:1 可用 0不可用")
private BigDecimal valid; private Integer valid;
@Excel(name = "创建人") @Excel(name = "")
private BigDecimal creatorId; private Long creatorId;
@Excel(name = "创建人姓名") @Excel(name = "创建人姓名")
private String creatorName; private String creatorName;
@Excel(name = "创建时间") @Excel(name = "创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
@Excel(name = "更新人") @Excel(name = "")
private BigDecimal updaterId; private Long updaterId;
@Excel(name = "更新人姓名") @Excel(name = "更新人姓名")
private String updaterName; private String updaterName;
@Excel(name = "更新时间") @Excel(name = "更新时间")
private LocalDateTime updateTime; private LocalDateTime updateTime;
@Excel(name = "版本号") @Excel(name = "版本号")
private BigDecimal version; private Integer version;
} }

View File

@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Mapper;
* 单位 * 单位
* *
* @author why * @author why
* @since 2022-06-30 * @since 2023-01-12
*/ */
@Mapper @Mapper
public interface UnitMapper extends BaseDao<Unit> { public interface UnitMapper extends BaseDao<Unit> {

View File

@ -1,5 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cnbm.generator.code.mapper.UnitMapper"> <mapper namespace="com.cnbm.generator.code.mapper.UnitMapper">
<resultMap type="com.cnbm.generator.code.entity.Unit" id="UnitMap">
<id column="id" property="id" />
<id column="name" property="name" />
<id column="code" property="code" />
<id column="type" property="type" />
<id column="status" property="status" />
<id column="remark" property="remark" />
<id column="valid" property="valid" />
<id column="creator_id" property="creatorId" />
<id column="creator_name" property="creatorName" />
<id column="create_time" property="createTime" />
<id column="updater_id" property="updaterId" />
<id column="updater_name" property="updaterName" />
<id column="update_time" property="updateTime" />
<id column="version" property="version" />
</resultMap>
</mapper> </mapper>

View File

@ -8,7 +8,7 @@ import com.cnbm.generator.code.entity.Unit;
* 单位 * 单位
* *
* @author why * @author why
* @since 2022-06-30 * @since 2023-01-12
*/ */
public interface IUnitService extends CrudService<Unit, UnitDTO> { public interface IUnitService extends CrudService<Unit, UnitDTO> {

View File

@ -15,7 +15,7 @@ import java.util.Map;
* 单位 * 单位
* *
* @author why * @author why
* @since 2022-06-30 * @since 2023-01-12
*/ */
@Service @Service
public class UnitServiceImpl extends CrudServiceImpl<UnitMapper, Unit, UnitDTO> implements IUnitService { public class UnitServiceImpl extends CrudServiceImpl<UnitMapper, Unit, UnitDTO> implements IUnitService {

View File

@ -74,7 +74,7 @@ public enum InfluxClient {
} }
/** /**
* desc: 异步批量 写入数据/更新数据 * desc: 异步批量 写入数据 / 更新数据
* notes: 如果是更新数据要保证time字段不能改变 * notes: 如果是更新数据要保证time字段不能改变
* auth: caixaing * auth: caixaing
* */ * */
@ -99,7 +99,6 @@ public enum InfluxClient {
.time(event.getTime().toEpochMilli(), WritePrecision.MS); .time(event.getTime().toEpochMilli(), WritePrecision.MS);
} }
writeApi.writePoint(point); writeApi.writePoint(point);
} }
/** /**
@ -120,7 +119,7 @@ public enum InfluxClient {
}else { }else {
point = Point.measurement(measurement) point = Point.measurement(measurement)
.addTag("transationId", event.getTransationId()==null ? "" : event.getTransationId()) .addTag("transationId", event.getTransationId()==null ? "" : event.getTransationId())
.addTag("inspectionSheetId", event.getInspectionSheetId()) .addTag("inspectionSheetId", event.getInspectionSheetId()==null ? "" : event.getInspectionSheetId())
// .addTag("batchNum", event.getBatchNum()) // .addTag("batchNum", event.getBatchNum())
.addTag("sampleNumber", event.getSampleNumber()) .addTag("sampleNumber", event.getSampleNumber())
@ -181,43 +180,44 @@ public enum InfluxClient {
return queryApi.query(flux); return queryApi.query(flux);
} }
public List<FluxTable> queryByGroup(QueryDataParam param){
String measurement = param.getMeasurement();
List<String> dropedTagNames = param.getDropedTagNames();
Range range = param.getRange();
String bucket = param.getBucket();
// public List<FluxTable> queryByGroup(QueryDataParam param){
// String measurement = param.getMeasurement();
String groupName = param.getGroupName(); // List<String> dropedTagNames = param.getDropedTagNames();
PageInfo pageInfo = param.getPageInfo(); // Range range = param.getRange();
// String bucket = param.getBucket();
String flux = "from(bucket:\""+bucket+"\")"; //
flux += "|> range(start: "+range.getBegin()+",stop:"+range.getEnd()+")"; //
flux += "|> filter(fn: (r) => r[\"_measurement\"] == \""+measurement+"\")"; //
// String groupName = param.getGroupName();
// String tagName = param.getTag().getTagName(); // PageInfo pageInfo = param.getPageInfo();
// String tagValue = param.getTag().getTagValue(); //
// String flux = "from(bucket:\""+bucket+"\")";
// flux += "|> range(start: "+range.getBegin()+",stop:"+range.getEnd()+")";
// flux += "|> filter(fn: (r) => r[\"_measurement\"] == \""+measurement+"\")";
//
//// String tagName = param.getTag().getTagName();
//// String tagValue = param.getTag().getTagValue();
//// flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")";
// if(param.getTags()!=null && param.getTags().size()>0){
// for(Tag tag:param.getTags()){
// String tagName = tag.getTagName();
// String tagValue = tag.getTagValue();
// flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")"; // flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")";
if(param.getTags()!=null && param.getTags().size()>0){ // }
for(Tag tag:param.getTags()){ // }
String tagName = tag.getTagName(); //
String tagValue = tag.getTagValue(); //// flux += "|> timeShift(duration: 8h)";
flux += "|> filter(fn: (r) => r[\""+tagName+"\"] == \""+tagValue+"\")"; // flux += "|> group(columns: [\""+groupName+"\"], mode: \"except\")";
} // for(String dropName:dropedTagNames){
} // flux += "|> drop(columns: [\""+dropName+"\"])";
// }
// flux += "|> timeShift(duration: 8h)"; // flux += "|> sort(columns: [\"_time\"], desc: true)";
flux += "|> group(columns: [\""+groupName+"\"], mode: \"except\")"; // if(pageInfo!=null){
for(String dropName:dropedTagNames){ // flux += "|> limit(n: "+pageInfo.getSize()+", offset: "+(pageInfo.getCurrent()-1)* pageInfo.getSize()+")";
flux += "|> drop(columns: [\""+dropName+"\"])"; // }
} // return queryApi.query(flux);
flux += "|> sort(columns: [\"_time\"], desc: true)"; // }
if(pageInfo!=null){
flux += "|> limit(n: "+pageInfo.getSize()+", offset: "+(pageInfo.getCurrent()-1)* pageInfo.getSize()+")";
}
return queryApi.query(flux);
}
public List<FluxTable> queryGroupByTime(QueryDataGroupByTimeParam param){ public List<FluxTable> queryGroupByTime(QueryDataGroupByTimeParam param){
String measurement = param.getMeasurement(); String measurement = param.getMeasurement();

View File

@ -63,10 +63,9 @@ public class S7DemoController {
} }
@PostMapping("/insertDemoOne") @PostMapping("/insertDemoOne")
public void insertDemoOne() throws InterruptedException { public void insertDemoOne(){
List<Event> list = new ArrayList<>(); List<Event> list = new ArrayList<>();
Event event = new Event(); Event event = new Event();
event.setTime(new Date(1670554110451L).toInstant()); event.setTime(new Date(1670554110451L).toInstant());
event.setArgName("failDayDay"); event.setArgName("failDayDay");
@ -81,22 +80,9 @@ public class S7DemoController {
event2.setSampleNumber("10001"); event2.setSampleNumber("10001");
list.add(event2); list.add(event2);
InfluxClient.Client.batchInsert(list,"Weight"); InfluxClient.Client.batchInsert(list,"Weight");
// Thread.sleep(10000);
//
// List<Event> list2 = new ArrayList<>();
// Event event2 = new Event();
// event2.setTime(time);
//
// event2.setArgName("failDayDay");
// event2.setArgValue("20087");
// event2.setSampleNumber("10001");
// list2.add(event2);
//
// InfluxClient.Client.batchInsert(list2,"Weight");
} }
@PostMapping("/readDemoOne") @PostMapping("/readDemoOne")
public void readDemoOne() throws InterruptedException { public void readDemoOne() {
List<String> dropNames = new ArrayList<>(); List<String> dropNames = new ArrayList<>();
dropNames.add("transationId"); dropNames.add("transationId");
// dropNames.add("inspectionSheetId"); // dropNames.add("inspectionSheetId");
@ -114,7 +100,7 @@ public class S7DemoController {
} }
@PostMapping("/getFlux") @PostMapping("/getFlux")
public Result<Instant> getFlux() throws InterruptedException { public Result<Instant> getFlux() {
List<String> dropNames = new ArrayList<>(); List<String> dropNames = new ArrayList<>();
dropNames.add("transationId"); dropNames.add("transationId");
dropNames.add("inspectionSheetId"); dropNames.add("inspectionSheetId");
@ -133,7 +119,7 @@ public class S7DemoController {
} }
@PostMapping("/saveFlux1") @PostMapping("/saveFlux1")
public Result<Instant> saveFlux1() throws InterruptedException { public Result<Instant> saveFlux1() {
List<Event> list = new ArrayList<>(); List<Event> list = new ArrayList<>();
Event event2 = new Event(); Event event2 = new Event();
@ -146,8 +132,9 @@ public class S7DemoController {
InfluxClient.Client.batchInsert(list,"Weight"); InfluxClient.Client.batchInsert(list,"Weight");
return new Result<Instant>().ok(instant); return new Result<Instant>().ok(instant);
} }
@PostMapping("/saveFlux2") @PostMapping("/saveFlux2")
public void saveFlux2(@RequestBody TIMETest timeTest) throws InterruptedException { public void saveFlux2(@RequestBody TIMETest timeTest) {
List<Event> list = new ArrayList<>(); List<Event> list = new ArrayList<>();
Event event2 = new Event(); Event event2 = new Event();
@ -209,7 +196,7 @@ public class S7DemoController {
// public void insertAndQuery() throws InterruptedException { // public void insertAndQuery() throws InterruptedException {
// Event event = new Event(); // Event event = new Event();
// //
//// long l = System.currentTimeMillis(); // long l = System.currentTimeMillis();
//// System.out.println("l:"+l); //// System.out.println("l:"+l);
//// event.setTime(new Date(1669874900889l).toInstant()); //// event.setTime(new Date(1669874900889l).toInstant());
//// ////

View File

@ -1,13 +1,9 @@
package com.cnbm.influx.controller; package com.cnbm.influx.controller;
import com.cnbm.common.spc.util.DataUtils;
import com.cnbm.common.utils.Result; import com.cnbm.common.utils.Result;
import com.cnbm.influx.config.InfluxClient; import com.cnbm.influx.config.InfluxClient;
import com.cnbm.influx.constant.Constant;
import com.cnbm.influx.param.QueryDataParam; import com.cnbm.influx.param.QueryDataParam;
import com.cnbm.influx.param.Range;
import com.cnbm.influx.param.Tag;
import com.cnbm.influx.template.Event;
import com.influxdb.query.FluxTable; import com.influxdb.query.FluxTable;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -15,8 +11,6 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.time.Instant;
import java.util.*; import java.util.*;
@RestController @RestController
@ -24,9 +18,8 @@ import java.util.*;
public class SPCController { public class SPCController {
private static final Logger logger = LoggerFactory.getLogger(SPCController.class); private static final Logger logger = LoggerFactory.getLogger(SPCController.class);
@PostMapping("/getData") @PostMapping("/getData")
public Result getData(@RequestBody QueryDataParam param) throws InterruptedException { public Result getData(@RequestBody QueryDataParam param){
List<FluxTable> query = InfluxClient.Client.query(param); List<FluxTable> query = InfluxClient.Client.query(param);
return new Result<List<FluxTable>>().ok(query); return new Result<List<FluxTable>>().ok(query);
} }

View File

@ -21,4 +21,7 @@ public class PageInfo {
this.current = current; this.current = current;
this.size = size; this.size = size;
} }
public PageInfo() {
}
} }

View File

@ -31,7 +31,9 @@ public class QueryDataParam extends BaseParam{
//查询的时候需要忽略的字段(transationId是唯一标识会对 最终的查询结果集产生影响) //查询的时候需要忽略的字段(transationId是唯一标识会对 最终的查询结果集产生影响)
private List<String> dropedTagNames; private List<String> dropedTagNames;
private String bucket; private String bucket;
private String groupName;
//private String inspectionSheetId; //private String inspectionSheetId;
public QueryDataParam() {
}
} }

View File

@ -23,7 +23,9 @@ public class Range {
this.end = end; this.end = end;
} }
// public static void main(String[] args) { public Range() {
}
// public static void main(String[] args) {
// Date date = new Date(); // Date date = new Date();
// System.out.println(date.toInstant().toString()); // System.out.println(date.toInstant().toString());
// } // }

View File

@ -16,4 +16,7 @@ public class Tag {
this.tagName = tagName; this.tagName = tagName;
this.tagValue = tagValue; this.tagValue = tagValue;
} }
public Tag() {
}
} }

View File

@ -13,8 +13,6 @@ 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.processInspection.dto.InspectionSampleDTO; import com.cnbm.processInspection.dto.InspectionSampleDTO;
import com.cnbm.processInspection.dto.InspectionSampleDTO2; import com.cnbm.processInspection.dto.InspectionSampleDTO2;
import com.cnbm.processInspection.dto.InspectionSampleDTO3; import com.cnbm.processInspection.dto.InspectionSampleDTO3;
@ -22,7 +20,6 @@ import com.cnbm.processInspection.dto.InspectionSheetDTO;
import com.cnbm.processInspection.entity.InspectionSheet; import com.cnbm.processInspection.entity.InspectionSheet;
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;
@ -71,7 +68,6 @@ public class InspectionSheetController {
@PreAuthorize("@ex.hasAuthority('processInspection:inspectionSheet:page')") @PreAuthorize("@ex.hasAuthority('processInspection:inspectionSheet:page')")
public Result<PageData<InspectionSheetDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ public Result<PageData<InspectionSheetDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<InspectionSheetDTO> page = inspectionSheetService.page(params); PageData<InspectionSheetDTO> page = inspectionSheetService.page(params);
return new Result<PageData<InspectionSheetDTO>>().ok(page); return new Result<PageData<InspectionSheetDTO>>().ok(page);
} }
@ -80,7 +76,6 @@ public class InspectionSheetController {
@PreAuthorize("@ex.hasAuthority('processInspection:inspectionSheet:info')") @PreAuthorize("@ex.hasAuthority('processInspection:inspectionSheet:info')")
public Result<InspectionSheetDTO> get(@PathVariable("id") Long id){ public Result<InspectionSheetDTO> get(@PathVariable("id") Long id){
InspectionSheetDTO data = inspectionSheetService.get(id); InspectionSheetDTO data = inspectionSheetService.get(id);
return new Result<InspectionSheetDTO>().ok(data); return new Result<InspectionSheetDTO>().ok(data);
} }
@ -91,7 +86,6 @@ public class InspectionSheetController {
public Result<Long> save(@RequestBody InspectionSheetDTO dto){ public Result<Long> save(@RequestBody InspectionSheetDTO dto){
//效验数据 //效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
// try { // try {
// inspectionSheetService.saveSheet(dto); // inspectionSheetService.saveSheet(dto);
// }catch (Exception e){ // }catch (Exception e){
@ -195,7 +189,6 @@ public class InspectionSheetController {
@PostMapping("saveFluxParamList2") @PostMapping("saveFluxParamList2")
@ApiOperation("将样本检测参数写入influxdb2") @ApiOperation("将样本检测参数写入influxdb2")
public Result saveFluxParamList2(@RequestBody InspectionSampleDTO2[] lists) throws InterruptedException{ public Result saveFluxParamList2(@RequestBody InspectionSampleDTO2[] lists) throws InterruptedException{
inspectionSheetService.saveFluxParamList2(lists); inspectionSheetService.saveFluxParamList2(lists);
Thread.sleep(1000); Thread.sleep(1000);
//样本数据更新后 计算检验单缺陷数不良数 //样本数据更新后 计算检验单缺陷数不良数
@ -206,7 +199,6 @@ public class InspectionSheetController {
@PostMapping("saveFluxParamList3") @PostMapping("saveFluxParamList3")
@ApiOperation("将样本检测参数写入influxdb3") @ApiOperation("将样本检测参数写入influxdb3")
public Result saveFluxParamList3(@RequestBody InspectionSampleDTO3[] lists) throws InterruptedException{ public Result saveFluxParamList3(@RequestBody InspectionSampleDTO3[] lists) throws InterruptedException{
inspectionSheetService.saveFluxParamList3(lists); inspectionSheetService.saveFluxParamList3(lists);
Thread.sleep(1000); Thread.sleep(1000);
//样本数据更新后 计算检验单缺陷数不良数 //样本数据更新后 计算检验单缺陷数不良数

View File

@ -6,13 +6,10 @@ import com.cnbm.basic.service.IProductFeaturesService;
import com.cnbm.common.spc.math.StandardDiviation; import com.cnbm.common.spc.math.StandardDiviation;
import com.cnbm.common.spc.util.DataUtils; import com.cnbm.common.spc.util.DataUtils;
import com.cnbm.common.vo.R; import com.cnbm.common.vo.R;
import com.cnbm.influx.config.InfluxClient;
import com.cnbm.influx.constant.Constant; import com.cnbm.influx.constant.Constant;
import com.cnbm.influx.param.QueryDataGroupByTimeParam; import com.cnbm.influx.param.QueryDataGroupByTimeParam;
import com.cnbm.influx.param.QueryDataParam; import com.cnbm.influx.param.QueryDataParam;
import com.cnbm.influx.param.Range; import com.cnbm.influx.param.Range;
import com.cnbm.influx.param.Tag;
import com.cnbm.influx.template.Event;
import com.cnbm.processInspection.dto.*; import com.cnbm.processInspection.dto.*;
import com.cnbm.processInspection.graphAnalyzed.forCount.c.CGraph; import com.cnbm.processInspection.graphAnalyzed.forCount.c.CGraph;
import com.cnbm.processInspection.graphAnalyzed.forCount.np.NPGraph; import com.cnbm.processInspection.graphAnalyzed.forCount.np.NPGraph;
@ -22,8 +19,6 @@ import com.cnbm.processInspection.graphAnalyzed.forMeterage.mr.MeanRGraph;
import com.cnbm.processInspection.graphAnalyzed.forMeterage.ms.MeanStandardDeviationGraph; import com.cnbm.processInspection.graphAnalyzed.forMeterage.ms.MeanStandardDeviationGraph;
import com.cnbm.processInspection.graphAnalyzed.forMeterage.xmr.XMRGraph; import com.cnbm.processInspection.graphAnalyzed.forMeterage.xmr.XMRGraph;
import com.cnbm.qualityPlanning.entity.ControlLimitDetail; import com.cnbm.qualityPlanning.entity.ControlLimitDetail;
import com.influxdb.query.FluxRecord;
import com.influxdb.query.FluxTable;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@ -32,12 +27,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Random;
@RestController @RestController
@RequestMapping("/processInspection") @RequestMapping("/processInspection")
@ -227,7 +218,8 @@ public class ProcessInspectionController {
NPGraph npGraph = new NPGraph(productFeatures); NPGraph npGraph = new NPGraph(productFeatures);
QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam(); QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();
queryDataParam.setMeasurement(Constant.measurement); // queryDataParam.setMeasurement(Constant.measurement);
queryDataParam.setMeasurement(graphArg.getProcedureName());
queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() )); queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() ));
queryDataParam.setTimeType(graphArg.getGroupType()); queryDataParam.setTimeType(graphArg.getGroupType());
npGraph.initialDate(queryDataParam); npGraph.initialDate(queryDataParam);
@ -354,7 +346,8 @@ public class ProcessInspectionController {
meanStandardDeviationGraph.isNeedInterpretation(graphArg.getInterpretationScheme()); meanStandardDeviationGraph.isNeedInterpretation(graphArg.getInterpretationScheme());
} }
QueryDataParam queryDataParam = new QueryDataParam(); QueryDataParam queryDataParam = new QueryDataParam();
queryDataParam.setMeasurement(Constant.measurement); // queryDataParam.setMeasurement(Constant.measurement);
queryDataParam.setMeasurement(graphArg.getProcedureName());
queryDataParam.setRange(new Range(graphArg.getBegin().toInstant(), graphArg.getEnd().toInstant())); queryDataParam.setRange(new Range(graphArg.getBegin().toInstant(), graphArg.getEnd().toInstant()));
meanStandardDeviationGraph.initialDate(queryDataParam); meanStandardDeviationGraph.initialDate(queryDataParam);
@ -389,7 +382,9 @@ public class ProcessInspectionController {
} }
QueryDataParam queryDataParam = new QueryDataParam(); QueryDataParam queryDataParam = new QueryDataParam();
queryDataParam.setMeasurement(Constant.measurement); // queryDataParam.setMeasurement(Constant.measurement);
queryDataParam.setMeasurement(graphArg.getProcedureName());
queryDataParam.setRange(new Range(graphArg.getBegin().toInstant(), graphArg.getEnd().toInstant())); queryDataParam.setRange(new Range(graphArg.getBegin().toInstant(), graphArg.getEnd().toInstant()));
meanRGraph.initialDate(queryDataParam); meanRGraph.initialDate(queryDataParam);
@ -424,7 +419,8 @@ public class ProcessInspectionController {
} }
QueryDataParam queryDataParam = new QueryDataParam(); QueryDataParam queryDataParam = new QueryDataParam();
queryDataParam.setMeasurement(Constant.measurement); // queryDataParam.setMeasurement(Constant.measurement);
queryDataParam.setMeasurement(graphArg.getProcedureName());
queryDataParam.setRange(new Range(graphArg.getBegin().toInstant(), graphArg.getEnd().toInstant())); queryDataParam.setRange(new Range(graphArg.getBegin().toInstant(), graphArg.getEnd().toInstant()));
xmrGraph.initialDate(queryDataParam); xmrGraph.initialDate(queryDataParam);
@ -453,7 +449,8 @@ public class ProcessInspectionController {
PGraph pGraph = new PGraph(productFeatures); PGraph pGraph = new PGraph(productFeatures);
QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam(); QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();
queryDataParam.setMeasurement(Constant.measurement); // queryDataParam.setMeasurement(Constant.measurement);
queryDataParam.setMeasurement(graphArg.getProcedureName());
queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() )); queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() ));
queryDataParam.setTimeType(graphArg.getGroupType()); queryDataParam.setTimeType(graphArg.getGroupType());
pGraph.initialDate(queryDataParam); pGraph.initialDate(queryDataParam);
@ -474,7 +471,8 @@ public class ProcessInspectionController {
CGraph cGraph = new CGraph(productFeatures); CGraph cGraph = new CGraph(productFeatures);
QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam(); QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();
queryDataParam.setMeasurement(Constant.measurement); // queryDataParam.setMeasurement(Constant.measurement);
queryDataParam.setMeasurement(graphArg.getProcedureName());
queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() )); queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() ));
queryDataParam.setTimeType(graphArg.getGroupType()); queryDataParam.setTimeType(graphArg.getGroupType());
cGraph.initialDate(queryDataParam); cGraph.initialDate(queryDataParam);
@ -496,7 +494,8 @@ public class ProcessInspectionController {
UGraph uGraph = new UGraph(productFeatures); UGraph uGraph = new UGraph(productFeatures);
QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam(); QueryDataGroupByTimeParam queryDataParam = new QueryDataGroupByTimeParam();
queryDataParam.setMeasurement(Constant.measurement); // queryDataParam.setMeasurement(Constant.measurement);
queryDataParam.setMeasurement(graphArg.getProcedureName());
queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() )); queryDataParam.setRange(new Range( graphArg.getBegin().toInstant() , graphArg.getEnd().toInstant() ));
queryDataParam.setTimeType(graphArg.getGroupType()); queryDataParam.setTimeType(graphArg.getGroupType());
uGraph.initialDate(queryDataParam); uGraph.initialDate(queryDataParam);

View File

@ -41,4 +41,7 @@ public class GraphArg {
@ApiModelProperty(value = "分组类别1=年 , 2=月 , 3=日)(用于计数型控制图)") @ApiModelProperty(value = "分组类别1=年 , 2=月 , 3=日)(用于计数型控制图)")
private Integer groupType; private Integer groupType;
@ApiModelProperty(value = "工序名")
private String procedureName;
} }

View File

@ -86,6 +86,8 @@ public class NPGraph {
return totalFailNum/totalN; return totalFailNum/totalN;
} }
/** /**
* name : 初始化数据函数 * name : 初始化数据函数
* desc : 从influxdb 里面读取数据然后 加工处理成 我需要的 * desc : 从influxdb 里面读取数据然后 加工处理成 我需要的

View File

@ -116,7 +116,12 @@ public class MeanRGraph {
List<FluxRecord> records = fluxTable.getRecords(); List<FluxRecord> records = fluxTable.getRecords();
for (FluxRecord fluxRecord : records) { for (FluxRecord fluxRecord : records) {
//因为 传进去的就是Double 类型所以取出来自然而然就是Double //因为 传进去的就是Double 类型所以取出来自然而然就是Double
originData.add(Double.parseDouble(fluxRecord.getValueByKey("_value").toString())); Object value = fluxRecord.getValueByKey("_value");
if(value!=null){
originData.add(Double.parseDouble(value.toString()));
}
} }
} }

View File

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
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.admin.utils.BaseSupportUtils;
import com.cnbm.basic.dto.ProductFeaturesDTO; import com.cnbm.basic.dto.ProductFeaturesDTO;
import com.cnbm.basic.dto.WorkingProcedureDTO; import com.cnbm.basic.dto.WorkingProcedureDTO;
import com.cnbm.basic.entity.*; import com.cnbm.basic.entity.*;
@ -39,10 +40,8 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.Instant; import java.time.*;
import java.time.LocalDateTime; import java.time.format.DateTimeFormatter;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -79,6 +78,12 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
String batchNumber = (String) params.get("batchNumber"); String batchNumber = (String) params.get("batchNumber");
QueryWrapper<InspectionSheet> wrapper = new QueryWrapper<>(); QueryWrapper<InspectionSheet> wrapper = new QueryWrapper<>();
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
if( ObjectUtils.isNotNull(params.get("startTime")) && ObjectUtils.isNotNull(params.get("endTime"))){
LocalDateTime startTime = LocalDate.parse(params.get("startTime").toString(),df).atStartOfDay();
LocalDateTime endTime = LocalDate.parse(params.get("endTime").toString(),df).atStartOfDay();
wrapper.between(startTime!=null && endTime!=null,"create_time", startTime, endTime);
}
wrapper.like(ObjectUtils.isNotNull(id), "id", id); wrapper.like(ObjectUtils.isNotNull(id), "id", id);
wrapper.like(StringUtils.isNotBlank(inspectionSite), "inspection_stage", inspectionSite); wrapper.like(StringUtils.isNotBlank(inspectionSite), "inspection_stage", inspectionSite);
wrapper.like(StringUtils.isNotBlank(orderNumber), "order_number", orderNumber); wrapper.like(StringUtils.isNotBlank(orderNumber), "order_number", orderNumber);
@ -187,6 +192,7 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
//InspectionSheet entity = ConvertUtils.sourceToTarget(dto, InspectionSheet.class); //InspectionSheet entity = ConvertUtils.sourceToTarget(dto, InspectionSheet.class);
InspectionSheet entity = new InspectionSheet(); InspectionSheet entity = new InspectionSheet();
BeanUtils.copyProperties(dto, entity); BeanUtils.copyProperties(dto, entity);
BaseSupportUtils.setCommonField(entity);
return entity; return entity;
} }
@ -194,6 +200,7 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void update(InspectionSheetDTO dto) { public void update(InspectionSheetDTO dto) {
InspectionSheet entity = ConvertUtils.sourceToTarget(dto, InspectionSheet.class); InspectionSheet entity = ConvertUtils.sourceToTarget(dto, InspectionSheet.class);
BaseSupportUtils.setUpdateCommonField(entity);
updateById(entity); updateById(entity);
} }
@ -389,6 +396,7 @@ public class InspectionSheetServiceImpl extends CrudServiceImpl<InspectionSheetM
updateDto.setId(inspectionSheetId); updateDto.setId(inspectionSheetId);
updateDto.setNumberOfDefects(numberOfDefects); updateDto.setNumberOfDefects(numberOfDefects);
updateDto.setDefectiveQuantity(defectiveQuantity); updateDto.setDefectiveQuantity(defectiveQuantity);
BaseSupportUtils.setUpdateCommonField(updateDto);
update(updateDto); update(updateDto);
} }
} }