feat():定时任务测试

master
jiyufei 2 months ago
parent 94da8191b6
commit f261ec9b04

@ -0,0 +1,168 @@
package jnpf.dataUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import jnpf.entity.*;
import jnpf.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
@Service
@DS("master")
public class MasterDataService {
@Autowired
private YysSupplierInformationService yysSupplierInformationService;
@Autowired
private YysSupplierClassService yysSupplierClassService;
@Autowired
private YysMaterialInformationService yysMaterialInformationService;
@Autowired
private YysMaterialClassService yysMaterialClassService;
@Autowired
private YysUnitInformationService yysUnitInformationService;
@Autowired
private YysBillMaterialService yysBillMaterialService;
@Autowired
private YysSubsetMaterialService yysSubsetMaterialService;
@Autowired
private YysInventoryQueryService yysInventoryQueryService;
@Autowired
private YysDeviceDataService yysDeviceDataService;
@Autowired
private YysDeviceWarnStatisticsService yysDeviceWarnStatisticsService;
@Autowired
private YysDeviceWarnService yysDeviceWarnService;
/**
*
**/
public List<String> getSupplierIds() {
return yysSupplierInformationService.list(new LambdaQueryWrapper<>(YysSupplierInformationEntity.class).isNull(YysSupplierInformationEntity::getDeleteMark))
.stream().map(YysSupplierInformationEntity::getSupplierId).collect(Collectors.toList());
}
public boolean saveSupplierBatch(List<YysSupplierInformationEntity> result) {
return yysSupplierInformationService.saveBatch(result);
}
/**
*
**/
public List<String> getSupplierClassIds() {
return yysSupplierClassService.list(new LambdaQueryWrapper<>(YysSupplierClassEntity.class).isNull(YysSupplierClassEntity::getDeleteMark))
.stream().map(YysSupplierClassEntity::getClassId).collect(Collectors.toList());
}
public boolean saveSupplierClassBatch(List<YysSupplierClassEntity> result) {
return yysSupplierClassService.saveBatch(result);
}
/**
*
**/
public List<String> getMaterialInfoIds() {
return yysMaterialInformationService.list(new LambdaQueryWrapper<>(YysMaterialInformationEntity.class).isNull(YysMaterialInformationEntity::getDeleteMark))
.stream().map(YysMaterialInformationEntity::getMaterialId).collect(Collectors.toList());
}
public boolean saveMaterialInfoBatch(List<YysMaterialInformationEntity> result) {
return yysMaterialInformationService.saveBatch(result);
}
/**
*
**/
public List<String> getMaterialClassIds() {
return yysMaterialClassService.list(new LambdaQueryWrapper<>(YysMaterialClassEntity.class).isNull(YysMaterialClassEntity::getDeleteMark))
.stream().map(YysMaterialClassEntity::getClassId).collect(Collectors.toList());
}
public boolean saveMaterialClassBatch(List<YysMaterialClassEntity> result) {
return yysMaterialClassService.saveBatch(result);
}
/**
*
**/
public List<String> getUnitIds() {
return yysUnitInformationService.list(new LambdaQueryWrapper<>(YysUnitInformationEntity.class).isNull(YysUnitInformationEntity::getDeleteMark))
.stream().map(YysUnitInformationEntity::getUnitId).collect(Collectors.toList());
}
public boolean saveUnitBatch(List<YysUnitInformationEntity> result) {
return yysUnitInformationService.saveBatch(result);
}
/**
*
**/
public List<String> getBillIds() {
return yysBillMaterialService.list(new LambdaQueryWrapper<>(YysBillMaterialEntity.class).isNull(YysBillMaterialEntity::getDeleteMark))
.stream().map(YysBillMaterialEntity::getId).collect(Collectors.toList());
}
public boolean saveBillBatch(List<YysBillMaterialEntity> result) {
return yysBillMaterialService.saveBatch(result);
}
public boolean saveSubsetBatch(List<YysSubsetMaterialEntity> result) {
return yysSubsetMaterialService.saveBatch(result);
}
/**
*
**/
public List<String> getInventoryIds() {
return yysInventoryQueryService.list(new LambdaQueryWrapper<>(YysInventoryQueryEntity.class).isNull(YysInventoryQueryEntity::getDeleteMark))
.stream().map(YysInventoryQueryEntity::getId).collect(Collectors.toList());
}
public boolean saveInventoryBatch(List<YysInventoryQueryEntity> result) {
return yysInventoryQueryService.saveBatch(result);
}
/***********************************分割线 数采专用*********************************************/
public List<Long> getSCDeviceDataIds() {
LambdaQueryWrapper<YysDeviceDataEntity> wrapper = new LambdaQueryWrapper<>(YysDeviceDataEntity.class);
wrapper.isNull(YysDeviceDataEntity::getDeleteMark);
List<YysDeviceDataEntity> list1 = yysDeviceDataService.list(wrapper);
return list1.stream().map(YysDeviceDataEntity::getSyncId).collect(Collectors.toList());
}
public void saveSCDeviceDataBatch(List<YysDeviceDataEntity> result) {
yysDeviceDataService.saveBatch(result);
}
public List<Long> getSCDeviceWarnIds() {
LambdaQueryWrapper<YysDeviceWarnStatisticsEntity> wrapper = new LambdaQueryWrapper<>(YysDeviceWarnStatisticsEntity.class);
wrapper.isNull(YysDeviceWarnStatisticsEntity::getDeleteMark);
List<YysDeviceWarnStatisticsEntity> list1 = yysDeviceWarnStatisticsService.list(wrapper);
return list1.stream().map(YysDeviceWarnStatisticsEntity::getSyncId).collect(Collectors.toList());
}
public boolean saveSCDeviceWarnBatch(List<YysDeviceWarnStatisticsEntity> result) {
return yysDeviceWarnStatisticsService.saveBatch(result);
}
public void syncCount(List<YysDeviceWarnStatisticsEntity> collect) {
yysDeviceWarnService.syncCount(collect);
}
}

@ -2,7 +2,9 @@ package jnpf.service;
import jnpf.model.yysdevicedata.*; import jnpf.model.yysdevicedata.*;
import jnpf.entity.*; import jnpf.entity.*;
import java.util.*; import java.util.*;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -32,7 +34,6 @@ public interface YysDeviceDataService extends IService<YysDeviceDataEntity> {
void saveOrUpdate(YysDeviceDataForm yysDeviceDataForm, String id, boolean isSave) throws Exception; void saveOrUpdate(YysDeviceDataForm yysDeviceDataForm, String id, boolean isSave) throws Exception;
List<EqmtCollectPubDataEntity> syncData(List<Long> syncIds); void syncData();
List<EqmtCollectPubDataEntity> zxcv();
} }

@ -34,6 +34,6 @@ public interface YysDeviceWarnStatisticsService extends IService<YysDeviceWarnSt
void saveOrUpdate(YysDeviceWarnStatisticsForm yysDeviceWarnStatisticsForm, String id, boolean isSave) throws Exception; void saveOrUpdate(YysDeviceWarnStatisticsForm yysDeviceWarnStatisticsForm, String id, boolean isSave) throws Exception;
List<EqmtCollectExceptMasterEntity> syncData(List<Long> syncIds); void syncData();
} }

@ -12,6 +12,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import jnpf.base.UserInfo; import jnpf.base.UserInfo;
import jnpf.base.model.ColumnDataModel; import jnpf.base.model.ColumnDataModel;
import jnpf.dataUtil.MasterDataService;
import jnpf.database.model.superQuery.SuperJsonModel; import jnpf.database.model.superQuery.SuperJsonModel;
import jnpf.entity.YysBillMaterialEntity; import jnpf.entity.YysBillMaterialEntity;
import jnpf.entity.YysSubsetMaterialEntity; import jnpf.entity.YysSubsetMaterialEntity;
@ -61,6 +62,9 @@ public class YysBillMaterialServiceImpl extends ServiceImpl<YysBillMaterialMappe
@Autowired @Autowired
private YysSubsetMaterialService yysSubsetMaterialService; private YysSubsetMaterialService yysSubsetMaterialService;
@Autowired
private MasterDataService masterDataService;
@Override @Override
public List<YysBillMaterialEntity> getList(YysBillMaterialPagination yysBillMaterialPagination) { public List<YysBillMaterialEntity> getList(YysBillMaterialPagination yysBillMaterialPagination) {
return getTypeList(yysBillMaterialPagination, yysBillMaterialPagination.getDataType()); return getTypeList(yysBillMaterialPagination, yysBillMaterialPagination.getDataType());
@ -329,8 +333,7 @@ public class YysBillMaterialServiceImpl extends ServiceImpl<YysBillMaterialMappe
@Override @Override
@DS("slave_2") @DS("slave_2")
public String syncMaterial() { public String syncMaterial() {
List<String> syncList = this.list(new LambdaQueryWrapper<>(YysBillMaterialEntity.class).isNull(YysBillMaterialEntity::getDeleteMark)) List<String> syncList = masterDataService.getBillIds();
.stream().map(YysBillMaterialEntity::getId).collect(Collectors.toList());
//母件物料 //母件物料
RowMapper<SyncMaterial> rowMapper = new BeanPropertyRowMapper<>(SyncMaterial.class); RowMapper<SyncMaterial> rowMapper = new BeanPropertyRowMapper<>(SyncMaterial.class);
String sql = "select * from v_bom_parent_rpt"; String sql = "select * from v_bom_parent_rpt";
@ -398,8 +401,8 @@ public class YysBillMaterialServiceImpl extends ServiceImpl<YysBillMaterialMappe
if (CollectionUtils.isEmpty(materialResult)) { if (CollectionUtils.isEmpty(materialResult)) {
return "没有需要同步的数据"; return "没有需要同步的数据";
} }
boolean material = this.saveBatch(materialResult); boolean material = masterDataService.saveBillBatch(materialResult);
boolean savedBatch = yysSubsetMaterialService.saveBatch(subsetResult); boolean savedBatch = masterDataService.saveSubsetBatch(subsetResult);
if (material && savedBatch) { if (material && savedBatch) {
return "同步成功"; return "同步成功";
} }

@ -2,6 +2,7 @@ package jnpf.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import jnpf.dataUtil.MasterDataService;
import jnpf.entity.*; import jnpf.entity.*;
import jnpf.mapper.YysDeviceDataMapper; import jnpf.mapper.YysDeviceDataMapper;
import jnpf.service.*; import jnpf.service.*;
@ -67,6 +68,9 @@ public class YysDeviceDataServiceImpl extends ServiceImpl<YysDeviceDataMapper, Y
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Autowired
private MasterDataService masterDataService;
@Override @Override
public List<YysDeviceDataEntity> getList(YysDeviceDataPagination yysDeviceDataPagination) { public List<YysDeviceDataEntity> getList(YysDeviceDataPagination yysDeviceDataPagination) {
@ -316,7 +320,8 @@ public class YysDeviceDataServiceImpl extends ServiceImpl<YysDeviceDataMapper, Y
@Override @Override
@DS("slave_1") @DS("slave_1")
public List<EqmtCollectPubDataEntity> syncData(List<Long> syncIds) { public void syncData() {
List<Long> syncIds = masterDataService.getSCDeviceDataIds();
List<EqmtCollectPubDataEntity> result = Lists.newArrayList(); List<EqmtCollectPubDataEntity> result = Lists.newArrayList();
String[] lines = new String[]{"1", "2", "3", "4"}; String[] lines = new String[]{"1", "2", "3", "4"};
for (String line : lines) { for (String line : lines) {
@ -326,24 +331,35 @@ public class YysDeviceDataServiceImpl extends ServiceImpl<YysDeviceDataMapper, Y
result.addAll(this.jdbcTemplate.query(sql, rowMapper)); result.addAll(this.jdbcTemplate.query(sql, rowMapper));
} }
if (CollectionUtils.isEmpty(syncIds)) { if (CollectionUtils.isEmpty(syncIds)) {
return result; return;
}
//过滤出已经生成的
return result.stream().filter(obj -> !syncIds.contains(obj.getId())).collect(Collectors.toList());
} }
result = result.stream().filter(obj -> !syncIds.contains(obj.getId())).collect(Collectors.toList());
@Override List<YysDeviceDataEntity> collect = result.stream().map(obj -> {
@DS("slave_1") String mainId = RandomUtil.uuId();
public List<EqmtCollectPubDataEntity> zxcv() { YysDeviceDataEntity entity = new YysDeviceDataEntity();
List<EqmtCollectPubDataEntity> result = Lists.newArrayList(); entity.setId(mainId);
String[] lines = new String[]{"1", "2", "3", "4"}; entity.setProductionLine(obj.getLine());
for (String line : lines) { entity.setProductionTime(obj.getGmtCreate());
String childTable = "eqmt_collect_data_sc_" + line; entity.setCreatorTime(obj.getCreateTime());
String sql = "select b.*," + line + " as line from " + childTable + " a left join eqmt_collect_pub_data b on a.eqmt_id = b.eqmt_id"; entity.setProductionModels(obj.getProductType());
RowMapper<EqmtCollectPubDataEntity> rowMapper = new BeanPropertyRowMapper<>(EqmtCollectPubDataEntity.class); entity.setProductionName(obj.getProductTypeName());
result.addAll(this.jdbcTemplate.query(sql, rowMapper)); entity.setProductionSpeed(String.valueOf(obj.getSpeed()));
} entity.setProductionNum(String.valueOf(obj.getTotalProductQty()));
//过滤出已经生成的 entity.setDayNum(String.valueOf(obj.getIntradayProductQty()));
return result; entity.setDayQualifiedNum(String.valueOf(obj.getIntradayOkQty()));
entity.setDayBadNum(String.valueOf(obj.getIntradayNgQty()));
entity.setDayPassRate(obj.getIntradayYieldRate());
entity.setDayOnTime(String.valueOf(obj.getIntradayEqmtRunTime()));
entity.setDayLoadingTime(String.valueOf(obj.getIntradayEqmtWorkTime()));
entity.setDayStopTime(String.valueOf(obj.getIntradayEqmtStopTime()));
entity.setDayStopNum(String.valueOf(obj.getIntradayEqmtStopTimes()));
entity.setOee(obj.getOee());
entity.setSyncId(obj.getId());
entity.setCreatorUserId(userProvider.get().getUserId());
return entity;
}).collect(Collectors.toList());
//批量存储
masterDataService.saveSCDeviceDataBatch(collect);
} }
} }

@ -2,6 +2,7 @@ package jnpf.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import jnpf.dataUtil.MasterDataService;
import jnpf.entity.*; import jnpf.entity.*;
import jnpf.mapper.YysDeviceWarnStatisticsMapper; import jnpf.mapper.YysDeviceWarnStatisticsMapper;
import jnpf.service.*; import jnpf.service.*;
@ -21,6 +22,7 @@ import java.lang.reflect.Field;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import java.util.concurrent.CompletableFuture;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import jnpf.model.QueryModel; import jnpf.model.QueryModel;
@ -67,6 +69,9 @@ public class YysDeviceWarnStatisticsServiceImpl extends ServiceImpl<YysDeviceWar
@Autowired @Autowired
private UserProvider userProvider; private UserProvider userProvider;
@Autowired
private MasterDataService masterDataService;
@Override @Override
public List<YysDeviceWarnStatisticsEntity> getList(YysDeviceWarnStatisticsPagination yysDeviceWarnStatisticsPagination) { public List<YysDeviceWarnStatisticsEntity> getList(YysDeviceWarnStatisticsPagination yysDeviceWarnStatisticsPagination) {
return getTypeList(yysDeviceWarnStatisticsPagination, yysDeviceWarnStatisticsPagination.getDataType()); return getTypeList(yysDeviceWarnStatisticsPagination, yysDeviceWarnStatisticsPagination.getDataType());
@ -313,7 +318,9 @@ public class YysDeviceWarnStatisticsServiceImpl extends ServiceImpl<YysDeviceWar
@Override @Override
@DS("slave_1") @DS("slave_1")
public List<EqmtCollectExceptMasterEntity> syncData(List<Long> syncIds) { public void syncData() {
List<Long> syncIds = masterDataService.getSCDeviceWarnIds();
List<EqmtCollectExceptMasterEntity> result = Lists.newArrayList(); List<EqmtCollectExceptMasterEntity> result = Lists.newArrayList();
String[] lines = new String[]{"1", "2", "3", "4"}; String[] lines = new String[]{"1", "2", "3", "4"};
for (String line : lines) { for (String line : lines) {
@ -323,9 +330,30 @@ public class YysDeviceWarnStatisticsServiceImpl extends ServiceImpl<YysDeviceWar
result.addAll(this.jdbcTemplate.query(sql, rowMapper)); result.addAll(this.jdbcTemplate.query(sql, rowMapper));
} }
if (CollectionUtils.isEmpty(syncIds)) { if (CollectionUtils.isEmpty(syncIds)) {
return result; return;
} }
//过滤出已经生成的 //过滤出已经生成的
return result.stream().filter(obj -> !syncIds.contains(obj.getId())).collect(Collectors.toList()); result = result.stream().filter(obj -> !syncIds.contains(obj.getId())).collect(Collectors.toList());
List<YysDeviceWarnStatisticsEntity> collect = result.stream().map(obj -> {
String mainId = RandomUtil.uuId();
YysDeviceWarnStatisticsEntity entity = new YysDeviceWarnStatisticsEntity();
entity.setId(mainId);
entity.setDeviceName(obj.getLine());
entity.setProductionTime(obj.getGmtCreate());
entity.setCreatorTime(obj.getCreateTime());
entity.setRegisterAddress(obj.getRegistorAddress());
entity.setWarnDetails(obj.getExceptMessage());
entity.setWarnType(obj.getExceptTypeName());
entity.setSyncId(obj.getId());
entity.setCreatorUserId(userProvider.get().getUserId());
return entity;
}).collect(Collectors.toList());
//批量存储
boolean b = masterDataService.saveSCDeviceWarnBatch(collect);
//存储成功之后 统计数量
if (b) {
CompletableFuture.runAsync(() -> masterDataService.syncCount(collect));
}
} }
} }

@ -1,8 +1,8 @@
package jnpf.service.impl; package jnpf.service.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -11,6 +11,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import jnpf.base.UserInfo; import jnpf.base.UserInfo;
import jnpf.base.model.ColumnDataModel; import jnpf.base.model.ColumnDataModel;
import jnpf.dataUtil.MasterDataService;
import jnpf.database.model.superQuery.SuperJsonModel; import jnpf.database.model.superQuery.SuperJsonModel;
import jnpf.entity.YysInventoryQueryEntity; import jnpf.entity.YysInventoryQueryEntity;
import jnpf.mapper.YysInventoryQueryMapper; import jnpf.mapper.YysInventoryQueryMapper;
@ -57,6 +58,9 @@ public class YysInventoryQueryServiceImpl extends ServiceImpl<YysInventoryQueryM
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Autowired
private MasterDataService masterDataService;
@Override @Override
public List<YysInventoryQueryEntity> getList(YysInventoryQueryPagination yysInventoryQueryPagination) { public List<YysInventoryQueryEntity> getList(YysInventoryQueryPagination yysInventoryQueryPagination) {
return getTypeList(yysInventoryQueryPagination, yysInventoryQueryPagination.getDataType()); return getTypeList(yysInventoryQueryPagination, yysInventoryQueryPagination.getDataType());
@ -309,15 +313,17 @@ public class YysInventoryQueryServiceImpl extends ServiceImpl<YysInventoryQueryM
} }
@Override @Override
@DS("slave_2")
public String syncInventory() { public String syncInventory() {
List<String> syncList = this.list(new LambdaQueryWrapper<>(YysInventoryQueryEntity.class).isNull(YysInventoryQueryEntity::getDeleteMark)) List<String> syncList = masterDataService.getInventoryIds();
.stream().map(YysInventoryQueryEntity::getId).collect(Collectors.toList());
RowMapper<SyncInventoryQuery> rowMapper = new BeanPropertyRowMapper<>(SyncInventoryQuery.class); RowMapper<SyncInventoryQuery> rowMapper = new BeanPropertyRowMapper<>(SyncInventoryQuery.class);
String sql = "select * from CurrentStock"; String sql = "select * from CurrentStock";
List<SyncInventoryQuery> query = this.jdbcTemplate.query(sql, rowMapper); List<SyncInventoryQuery> query = this.jdbcTemplate.query(sql, rowMapper);
if (CollectionUtils.isEmpty(query)) { if (CollectionUtils.isEmpty(query)) {
return "远程库存信息为空"; return "远程库存信息为空";
} }
//过滤出同步过的
query = query.stream().filter(obj -> !syncList.contains(obj.getAutoId())).collect(Collectors.toList());
//物料表数据 不从自己库取数据,防止自己库未同步,从而取不到数据 //物料表数据 不从自己库取数据,防止自己库未同步,从而取不到数据
RowMapper<MaterialInformationSync> materialMapper = new BeanPropertyRowMapper<>(MaterialInformationSync.class); RowMapper<MaterialInformationSync> materialMapper = new BeanPropertyRowMapper<>(MaterialInformationSync.class);
String materialSql = "select * from dbo.Inventory"; String materialSql = "select * from dbo.Inventory";
@ -345,7 +351,7 @@ public class YysInventoryQueryServiceImpl extends ServiceImpl<YysInventoryQueryM
if (CollectionUtils.isEmpty(result)) { if (CollectionUtils.isEmpty(result)) {
return "没有需要同步的数据"; return "没有需要同步的数据";
} }
boolean b = this.saveBatch(result); boolean b = masterDataService.saveInventoryBatch(result);
if (b) { if (b) {
return "同步成功"; return "同步成功";
} }

@ -12,6 +12,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import jnpf.base.UserInfo; import jnpf.base.UserInfo;
import jnpf.base.model.ColumnDataModel; import jnpf.base.model.ColumnDataModel;
import jnpf.dataUtil.MasterDataService;
import jnpf.database.model.superQuery.SuperJsonModel; import jnpf.database.model.superQuery.SuperJsonModel;
import jnpf.entity.YysMaterialClassEntity; import jnpf.entity.YysMaterialClassEntity;
import jnpf.mapper.YysMaterialClassMapper; import jnpf.mapper.YysMaterialClassMapper;
@ -57,6 +58,9 @@ public class YysMaterialClassServiceImpl extends ServiceImpl<YysMaterialClassMap
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Autowired
private MasterDataService masterDataService;
@Override @Override
public List<YysMaterialClassEntity> getList(YysMaterialClassPagination yysMaterialClassPagination) { public List<YysMaterialClassEntity> getList(YysMaterialClassPagination yysMaterialClassPagination) {
return getTypeList(yysMaterialClassPagination, yysMaterialClassPagination.getDataType()); return getTypeList(yysMaterialClassPagination, yysMaterialClassPagination.getDataType());
@ -318,8 +322,7 @@ public class YysMaterialClassServiceImpl extends ServiceImpl<YysMaterialClassMap
return "远程物料分类信息为空"; return "远程物料分类信息为空";
} }
//过滤出同步过的 //过滤出同步过的
List<String> list = this.list(new LambdaQueryWrapper<>(YysMaterialClassEntity.class).isNull(YysMaterialClassEntity::getDeleteMark)) List<String> list = masterDataService.getMaterialClassIds();
.stream().map(YysMaterialClassEntity::getClassId).collect(Collectors.toList());
//顶级分类 //顶级分类
Map<String, String> topCollect = query.stream() Map<String, String> topCollect = query.stream()
.filter(obj -> obj.getCInvCCode().equals("1")) .filter(obj -> obj.getCInvCCode().equals("1"))
@ -362,7 +365,7 @@ public class YysMaterialClassServiceImpl extends ServiceImpl<YysMaterialClassMap
if (CollectionUtils.isEmpty(result)) { if (CollectionUtils.isEmpty(result)) {
return "没有需要同步的数据"; return "没有需要同步的数据";
} }
boolean b = this.saveBatch(result); boolean b = masterDataService.saveMaterialClassBatch(result);
if (b) { if (b) {
return "同步成功"; return "同步成功";
} }

@ -3,6 +3,7 @@ package jnpf.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import jnpf.dataUtil.MasterDataService;
import jnpf.entity.*; import jnpf.entity.*;
import jnpf.mapper.YysMaterialInformationMapper; import jnpf.mapper.YysMaterialInformationMapper;
import jnpf.model.yyssupplierclass.SupplierClassSync; import jnpf.model.yyssupplierclass.SupplierClassSync;
@ -70,6 +71,9 @@ public class YysMaterialInformationServiceImpl extends ServiceImpl<YysMaterialIn
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Autowired
private MasterDataService masterDataService;
@Override @Override
public List<YysMaterialInformationEntity> getList(YysMaterialInformationPagination yysMaterialInformationPagination) { public List<YysMaterialInformationEntity> getList(YysMaterialInformationPagination yysMaterialInformationPagination) {
return getTypeList(yysMaterialInformationPagination, yysMaterialInformationPagination.getDataType()); return getTypeList(yysMaterialInformationPagination, yysMaterialInformationPagination.getDataType());
@ -341,8 +345,7 @@ public class YysMaterialInformationServiceImpl extends ServiceImpl<YysMaterialIn
return "远程物料信息为空"; return "远程物料信息为空";
} }
//过滤出同步过的 //过滤出同步过的
List<String> list = this.list(new LambdaQueryWrapper<>(YysMaterialInformationEntity.class).isNull(YysMaterialInformationEntity::getDeleteMark)) List<String> list = masterDataService.getMaterialInfoIds();
.stream().map(YysMaterialInformationEntity::getMaterialId).collect(Collectors.toList());
List<YysMaterialInformationEntity> result = Lists.newArrayList(); List<YysMaterialInformationEntity> result = Lists.newArrayList();
for (MaterialInformationSync sync : query) { for (MaterialInformationSync sync : query) {
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(list) && list.contains(sync.getCInvCode())) { if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(list) && list.contains(sync.getCInvCode())) {
@ -369,7 +372,7 @@ public class YysMaterialInformationServiceImpl extends ServiceImpl<YysMaterialIn
if (CollectionUtils.isEmpty(result)) { if (CollectionUtils.isEmpty(result)) {
return "没有需要同步的数据"; return "没有需要同步的数据";
} }
boolean b = this.saveBatch(result); boolean b = masterDataService.saveMaterialInfoBatch(result);
if (b) { if (b) {
return "同步成功"; return "同步成功";
} }

@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import jnpf.base.UserInfo; import jnpf.base.UserInfo;
import jnpf.base.model.ColumnDataModel; import jnpf.base.model.ColumnDataModel;
import jnpf.dataUtil.MasterDataService;
import jnpf.database.model.superQuery.SuperJsonModel; import jnpf.database.model.superQuery.SuperJsonModel;
import jnpf.entity.YysSupplierClassEntity; import jnpf.entity.YysSupplierClassEntity;
import jnpf.mapper.YysSupplierClassMapper; import jnpf.mapper.YysSupplierClassMapper;
@ -55,6 +56,9 @@ public class YysSupplierClassServiceImpl extends ServiceImpl<YysSupplierClassMap
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Autowired
private MasterDataService masterDataService;
@Override @Override
public List<YysSupplierClassEntity> getList(YysSupplierClassPagination yysSupplierClassPagination) { public List<YysSupplierClassEntity> getList(YysSupplierClassPagination yysSupplierClassPagination) {
return getTypeList(yysSupplierClassPagination, yysSupplierClassPagination.getDataType()); return getTypeList(yysSupplierClassPagination, yysSupplierClassPagination.getDataType());
@ -315,9 +319,7 @@ public class YysSupplierClassServiceImpl extends ServiceImpl<YysSupplierClassMap
if (org.apache.commons.collections4.CollectionUtils.isEmpty(query)) { if (org.apache.commons.collections4.CollectionUtils.isEmpty(query)) {
return "远程供应商分类信息为空"; return "远程供应商分类信息为空";
} }
List<String> list = this.list(new LambdaQueryWrapper<>(YysSupplierClassEntity.class).isNull(YysSupplierClassEntity::getDeleteMark)) List<String> list = masterDataService.getSupplierClassIds();
.stream().map(YysSupplierClassEntity::getClassId).collect(Collectors.toList());
//顶级分类 //顶级分类
Map<String, String> collect = query.stream() Map<String, String> collect = query.stream()
.filter(obj -> obj.getIVCGrade().equals("1")) .filter(obj -> obj.getIVCGrade().equals("1"))
@ -348,7 +350,7 @@ public class YysSupplierClassServiceImpl extends ServiceImpl<YysSupplierClassMap
if (CollectionUtils.isEmpty(collect1)) { if (CollectionUtils.isEmpty(collect1)) {
return "没有需要同步的数据"; return "没有需要同步的数据";
} }
boolean b = this.saveBatch(collect1); boolean b = masterDataService.saveSupplierClassBatch(collect1);
if (b) { if (b) {
return "同步成功"; return "同步成功";
} }

@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import jnpf.base.UserInfo; import jnpf.base.UserInfo;
import jnpf.base.model.ColumnDataModel; import jnpf.base.model.ColumnDataModel;
import jnpf.dataUtil.MasterDataService;
import jnpf.database.model.superQuery.SuperJsonModel; import jnpf.database.model.superQuery.SuperJsonModel;
import jnpf.entity.YysSupplierInformationEntity; import jnpf.entity.YysSupplierInformationEntity;
import jnpf.mapper.YysSupplierInformationMapper; import jnpf.mapper.YysSupplierInformationMapper;
@ -54,6 +55,9 @@ public class YysSupplierInformationServiceImpl extends ServiceImpl<YysSupplierIn
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Autowired
private MasterDataService masterDataService;
@Override @Override
public List<YysSupplierInformationEntity> getList(YysSupplierInformationPagination yysSupplierInformationPagination) { public List<YysSupplierInformationEntity> getList(YysSupplierInformationPagination yysSupplierInformationPagination) {
return getTypeList(yysSupplierInformationPagination, yysSupplierInformationPagination.getDataType()); return getTypeList(yysSupplierInformationPagination, yysSupplierInformationPagination.getDataType());
@ -315,8 +319,7 @@ public class YysSupplierInformationServiceImpl extends ServiceImpl<YysSupplierIn
return "远程供应商信息为空"; return "远程供应商信息为空";
} }
//过滤出同步过的 //过滤出同步过的
List<String> list = this.list(new LambdaQueryWrapper<>(YysSupplierInformationEntity.class).isNull(YysSupplierInformationEntity::getDeleteMark)) List<String> list = masterDataService.getSupplierIds();
.stream().map(YysSupplierInformationEntity::getSupplierId).collect(Collectors.toList());
List<YysSupplierInformationEntity> result = Lists.newArrayList(); List<YysSupplierInformationEntity> result = Lists.newArrayList();
for (SupplierInfoSync sync : query) { for (SupplierInfoSync sync : query) {
if (CollectionUtils.isNotEmpty(list) && list.contains(sync.getCVenCode())) { if (CollectionUtils.isNotEmpty(list) && list.contains(sync.getCVenCode())) {
@ -339,7 +342,7 @@ public class YysSupplierInformationServiceImpl extends ServiceImpl<YysSupplierIn
if (CollectionUtils.isEmpty(result)) { if (CollectionUtils.isEmpty(result)) {
return "没有需要同步的数据"; return "没有需要同步的数据";
} }
boolean b = this.saveBatch(result); boolean b = masterDataService.saveSupplierBatch(result);
if (b) { if (b) {
return "同步成功"; return "同步成功";
} }

@ -3,6 +3,7 @@ package jnpf.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import jnpf.dataUtil.MasterDataService;
import jnpf.entity.*; import jnpf.entity.*;
import jnpf.mapper.YysUnitInformationMapper; import jnpf.mapper.YysUnitInformationMapper;
import jnpf.model.yyssupplierinformation.SupplierInfoSync; import jnpf.model.yyssupplierinformation.SupplierInfoSync;
@ -70,6 +71,9 @@ public class YysUnitInformationServiceImpl extends ServiceImpl<YysUnitInformatio
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Autowired
private MasterDataService masterDataService;
@Override @Override
public List<YysUnitInformationEntity> getList(YysUnitInformationPagination yysUnitInformationPagination) { public List<YysUnitInformationEntity> getList(YysUnitInformationPagination yysUnitInformationPagination) {
return getTypeList(yysUnitInformationPagination, yysUnitInformationPagination.getDataType()); return getTypeList(yysUnitInformationPagination, yysUnitInformationPagination.getDataType());
@ -327,8 +331,7 @@ public class YysUnitInformationServiceImpl extends ServiceImpl<YysUnitInformatio
collect = groupSyncs.stream().collect(Collectors.toMap(UnitGroupSync::getCGroupCode, UnitGroupSync::getCGroupName)); collect = groupSyncs.stream().collect(Collectors.toMap(UnitGroupSync::getCGroupCode, UnitGroupSync::getCGroupName));
} }
//过滤出同步过的 //过滤出同步过的
List<String> list = this.list(new LambdaQueryWrapper<>(YysUnitInformationEntity.class).isNull(YysUnitInformationEntity::getDeleteMark)) List<String> list = masterDataService.getUnitIds();
.stream().map(YysUnitInformationEntity::getUnitId).collect(Collectors.toList());
List<YysUnitInformationEntity> result = Lists.newArrayList(); List<YysUnitInformationEntity> result = Lists.newArrayList();
for (UnitInfoSync sync : query) { for (UnitInfoSync sync : query) {
if (CollectionUtils.isNotEmpty(list) && list.contains(sync.getCComunitCode())) { if (CollectionUtils.isNotEmpty(list) && list.contains(sync.getCComunitCode())) {
@ -349,7 +352,7 @@ public class YysUnitInformationServiceImpl extends ServiceImpl<YysUnitInformatio
if (CollectionUtils.isEmpty(result)) { if (CollectionUtils.isEmpty(result)) {
return "没有需要同步的数据"; return "没有需要同步的数据";
} }
boolean b = this.saveBatch(result); boolean b = masterDataService.saveUnitBatch(result);
if (b) { if (b) {
return "同步成功"; return "同步成功";
} }

@ -575,4 +575,12 @@ public class YysDayWorkController {
return ActionResult.success(yysDayWorkService.cancelFrozen(id)); return ActionResult.success(yysDayWorkService.cancelFrozen(id));
} }
@Operation(summary = "同步生产状态")
@GetMapping("/syncDayWork")
public ActionResult syncDayWork() {
yysDayWorkService.syncDayWork();
return ActionResult.success();
}
} }

@ -15,22 +15,27 @@ import jnpf.model.yysdevicedata.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.*; import java.util.*;
import jnpf.annotation.JnpfField; import jnpf.annotation.JnpfField;
import jnpf.base.vo.PageListVO; import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO; import jnpf.base.vo.PaginationVO;
import jnpf.base.vo.DownloadVO; import jnpf.base.vo.DownloadVO;
import jnpf.config.ConfigValueUtil; import jnpf.config.ConfigValueUtil;
import jnpf.base.entity.ProvinceEntity; import jnpf.base.entity.ProvinceEntity;
import java.io.IOException; import java.io.IOException;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import jnpf.engine.entity.FlowTaskEntity; import jnpf.engine.entity.FlowTaskEntity;
import jnpf.exception.WorkFlowException; import jnpf.exception.WorkFlowException;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
/** /**
* yysDeviceData * yysDeviceData
*
* @ V3.5 * @ V3.5
* @ https://www.jnpfsoft.com * @ https://www.jnpfsoft.com
* @ JNPF * @ JNPF
@ -52,7 +57,6 @@ public class YysDeviceDataController {
private YysDeviceDataService yysDeviceDataService; private YysDeviceDataService yysDeviceDataService;
/** /**
* *
* *
@ -81,6 +85,7 @@ public class YysDeviceDataController {
vo.setPagination(page); vo.setPagination(page);
return ActionResult.success(vo); return ActionResult.success(vo);
} }
/** /**
* *
* *
@ -101,8 +106,10 @@ public class YysDeviceDataController {
} }
return ActionResult.success("创建成功"); return ActionResult.success("创建成功");
} }
/** /**
* *
*
* @param id * @param id
* @param yysDeviceDataForm * @param yysDeviceDataForm
* @return * @return
@ -130,8 +137,10 @@ public class YysDeviceDataController {
return ActionResult.fail("更新失败,数据不存在"); return ActionResult.fail("更新失败,数据不存在");
} }
} }
/** /**
* *
*
* @param id * @param id
* @return * @return
*/ */
@ -146,9 +155,11 @@ public class YysDeviceDataController {
} }
return ActionResult.success("删除成功"); return ActionResult.success("删除成功");
} }
/** /**
* () * ()
* 使- * 使-
*
* @param id * @param id
* @return * @return
*/ */
@ -166,9 +177,11 @@ public class YysDeviceDataController {
yysDeviceDataMap = generaterSwapUtil.swapDataDetail(yysDeviceDataMap, YysDeviceDataConstant.getFormData(), "591585418722415045", false); yysDeviceDataMap = generaterSwapUtil.swapDataDetail(yysDeviceDataMap, YysDeviceDataConstant.getFormData(), "591585418722415045", false);
return ActionResult.success(yysDeviceDataMap); return ActionResult.success(yysDeviceDataMap);
} }
/** /**
* () * ()
* 使- * 使-
*
* @param id * @param id
* @return * @return
*/ */
@ -187,10 +200,11 @@ public class YysDeviceDataController {
return ActionResult.success(yysDeviceDataMap); return ActionResult.success(yysDeviceDataMap);
} }
@Operation(summary = "信息") @Operation(summary = "同步数采库")
@GetMapping("/zxcv") @GetMapping("/syncData")
public ActionResult zxcv(){ public ActionResult syncData() {
return ActionResult.success(yysDeviceDataService.zxcv()); yysDeviceDataService.syncData();
return ActionResult.success();
} }
} }

@ -15,22 +15,27 @@ import jnpf.model.yysdevicewarnstatistics.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.*; import java.util.*;
import jnpf.annotation.JnpfField; import jnpf.annotation.JnpfField;
import jnpf.base.vo.PageListVO; import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO; import jnpf.base.vo.PaginationVO;
import jnpf.base.vo.DownloadVO; import jnpf.base.vo.DownloadVO;
import jnpf.config.ConfigValueUtil; import jnpf.config.ConfigValueUtil;
import jnpf.base.entity.ProvinceEntity; import jnpf.base.entity.ProvinceEntity;
import java.io.IOException; import java.io.IOException;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import jnpf.engine.entity.FlowTaskEntity; import jnpf.engine.entity.FlowTaskEntity;
import jnpf.exception.WorkFlowException; import jnpf.exception.WorkFlowException;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
/** /**
* yysDeviceWarnStatistics * yysDeviceWarnStatistics
*
* @ V3.5 * @ V3.5
* @ https://www.jnpfsoft.com * @ https://www.jnpfsoft.com
* @ JNPF * @ JNPF
@ -52,7 +57,6 @@ public class YysDeviceWarnStatisticsController {
private YysDeviceWarnStatisticsService yysDeviceWarnStatisticsService; private YysDeviceWarnStatisticsService yysDeviceWarnStatisticsService;
/** /**
* *
* *
@ -81,6 +85,7 @@ public class YysDeviceWarnStatisticsController {
vo.setPagination(page); vo.setPagination(page);
return ActionResult.success(vo); return ActionResult.success(vo);
} }
/** /**
* *
* *
@ -101,8 +106,10 @@ public class YysDeviceWarnStatisticsController {
} }
return ActionResult.success("创建成功"); return ActionResult.success("创建成功");
} }
/** /**
* *
*
* @param id * @param id
* @param yysDeviceWarnStatisticsForm * @param yysDeviceWarnStatisticsForm
* @return * @return
@ -130,8 +137,10 @@ public class YysDeviceWarnStatisticsController {
return ActionResult.fail("更新失败,数据不存在"); return ActionResult.fail("更新失败,数据不存在");
} }
} }
/** /**
* *
*
* @param id * @param id
* @return * @return
*/ */
@ -146,9 +155,11 @@ public class YysDeviceWarnStatisticsController {
} }
return ActionResult.success("删除成功"); return ActionResult.success("删除成功");
} }
/** /**
* () * ()
* 使- * 使-
*
* @param id * @param id
* @return * @return
*/ */
@ -166,9 +177,11 @@ public class YysDeviceWarnStatisticsController {
yysDeviceWarnStatisticsMap = generaterSwapUtil.swapDataDetail(yysDeviceWarnStatisticsMap, YysDeviceWarnStatisticsConstant.getFormData(), "591593765148299845", false); yysDeviceWarnStatisticsMap = generaterSwapUtil.swapDataDetail(yysDeviceWarnStatisticsMap, YysDeviceWarnStatisticsConstant.getFormData(), "591593765148299845", false);
return ActionResult.success(yysDeviceWarnStatisticsMap); return ActionResult.success(yysDeviceWarnStatisticsMap);
} }
/** /**
* () * ()
* 使- * 使-
*
* @param id * @param id
* @return * @return
*/ */
@ -187,4 +200,11 @@ public class YysDeviceWarnStatisticsController {
return ActionResult.success(yysDeviceWarnStatisticsMap); return ActionResult.success(yysDeviceWarnStatisticsMap);
} }
@Operation(summary = "同步数采设备预警库")
@GetMapping("/syncData")
public ActionResult syncData() {
yysDeviceWarnStatisticsService.syncData();
return ActionResult.success();
}
} }

@ -64,40 +64,40 @@ public class YysTaskHandler {
//每十分钟执行一次 //每十分钟执行一次
@XxlJob("syncDeviceData") @XxlJob("syncDeviceData")
public void syncDeviceData() { public void syncDeviceData() {
//查询表中数据 // //查询表中数据
LambdaQueryWrapper<YysDeviceDataEntity> wrapper = new LambdaQueryWrapper<>(YysDeviceDataEntity.class); // LambdaQueryWrapper<YysDeviceDataEntity> wrapper = new LambdaQueryWrapper<>(YysDeviceDataEntity.class);
wrapper.isNull(YysDeviceDataEntity::getDeleteMark); // wrapper.isNull(YysDeviceDataEntity::getDeleteMark);
List<YysDeviceDataEntity> list1 = yysDeviceDataService.list(wrapper); // List<YysDeviceDataEntity> list1 = yysDeviceDataService.list(wrapper);
List<EqmtCollectPubDataEntity> list = yysDeviceDataService.syncData(list1.stream().map(YysDeviceDataEntity::getSyncId).collect(Collectors.toList())); // List<EqmtCollectPubDataEntity> list = yysDeviceDataService.syncData(list1.stream().map(YysDeviceDataEntity::getSyncId).collect(Collectors.toList()));
if (CollectionUtils.isEmpty(list)) { // if (CollectionUtils.isEmpty(list)) {
return; // return;
} // }
List<YysDeviceDataEntity> collect = list.stream().map(obj -> { // List<YysDeviceDataEntity> collect = list.stream().map(obj -> {
String mainId = RandomUtil.uuId(); // String mainId = RandomUtil.uuId();
YysDeviceDataEntity entity = new YysDeviceDataEntity(); // YysDeviceDataEntity entity = new YysDeviceDataEntity();
entity.setId(mainId); // entity.setId(mainId);
entity.setProductionLine(obj.getLine()); // entity.setProductionLine(obj.getLine());
entity.setProductionTime(obj.getGmtCreate()); // entity.setProductionTime(obj.getGmtCreate());
entity.setCreatorTime(obj.getCreateTime()); // entity.setCreatorTime(obj.getCreateTime());
entity.setProductionModels(obj.getProductType()); // entity.setProductionModels(obj.getProductType());
entity.setProductionName(obj.getProductTypeName()); // entity.setProductionName(obj.getProductTypeName());
entity.setProductionSpeed(String.valueOf(obj.getSpeed())); // entity.setProductionSpeed(String.valueOf(obj.getSpeed()));
entity.setProductionNum(String.valueOf(obj.getTotalProductQty())); // entity.setProductionNum(String.valueOf(obj.getTotalProductQty()));
entity.setDayNum(String.valueOf(obj.getIntradayProductQty())); // entity.setDayNum(String.valueOf(obj.getIntradayProductQty()));
entity.setDayQualifiedNum(String.valueOf(obj.getIntradayOkQty())); // entity.setDayQualifiedNum(String.valueOf(obj.getIntradayOkQty()));
entity.setDayBadNum(String.valueOf(obj.getIntradayNgQty())); // entity.setDayBadNum(String.valueOf(obj.getIntradayNgQty()));
entity.setDayPassRate(obj.getIntradayYieldRate()); // entity.setDayPassRate(obj.getIntradayYieldRate());
entity.setDayOnTime(String.valueOf(obj.getIntradayEqmtRunTime())); // entity.setDayOnTime(String.valueOf(obj.getIntradayEqmtRunTime()));
entity.setDayLoadingTime(String.valueOf(obj.getIntradayEqmtWorkTime())); // entity.setDayLoadingTime(String.valueOf(obj.getIntradayEqmtWorkTime()));
entity.setDayStopTime(String.valueOf(obj.getIntradayEqmtStopTime())); // entity.setDayStopTime(String.valueOf(obj.getIntradayEqmtStopTime()));
entity.setDayStopNum(String.valueOf(obj.getIntradayEqmtStopTimes())); // entity.setDayStopNum(String.valueOf(obj.getIntradayEqmtStopTimes()));
entity.setOee(obj.getOee()); // entity.setOee(obj.getOee());
entity.setSyncId(obj.getId()); // entity.setSyncId(obj.getId());
entity.setCreatorUserId(userProvider.get().getUserId()); // entity.setCreatorUserId(userProvider.get().getUserId());
return entity; // return entity;
}).collect(Collectors.toList()); // }).collect(Collectors.toList());
//批量存储 // //批量存储
yysDeviceDataService.saveBatch(collect); // yysDeviceDataService.saveBatch(collect);
} }
@ -108,33 +108,33 @@ public class YysTaskHandler {
@XxlJob("syncDeviceWarnData") @XxlJob("syncDeviceWarnData")
public void syncDeviceWarnData() { public void syncDeviceWarnData() {
//查询表中数据 //查询表中数据
LambdaQueryWrapper<YysDeviceWarnStatisticsEntity> wrapper = new LambdaQueryWrapper<>(YysDeviceWarnStatisticsEntity.class); // LambdaQueryWrapper<YysDeviceWarnStatisticsEntity> wrapper = new LambdaQueryWrapper<>(YysDeviceWarnStatisticsEntity.class);
wrapper.isNull(YysDeviceWarnStatisticsEntity::getDeleteMark); // wrapper.isNull(YysDeviceWarnStatisticsEntity::getDeleteMark);
List<YysDeviceWarnStatisticsEntity> list1 = yysDeviceWarnStatisticsService.list(wrapper); // List<YysDeviceWarnStatisticsEntity> list1 = yysDeviceWarnStatisticsService.list(wrapper);
List<EqmtCollectExceptMasterEntity> list = yysDeviceWarnStatisticsService.syncData(list1.stream().map(YysDeviceWarnStatisticsEntity::getSyncId).collect(Collectors.toList())); // List<EqmtCollectExceptMasterEntity> list = yysDeviceWarnStatisticsService.syncData(list1.stream().map(YysDeviceWarnStatisticsEntity::getSyncId).collect(Collectors.toList()));
if (CollectionUtils.isEmpty(list)) { // if (CollectionUtils.isEmpty(list)) {
return; // return;
} // }
List<YysDeviceWarnStatisticsEntity> collect = list.stream().map(obj -> { // List<YysDeviceWarnStatisticsEntity> collect = list.stream().map(obj -> {
String mainId = RandomUtil.uuId(); // String mainId = RandomUtil.uuId();
YysDeviceWarnStatisticsEntity entity = new YysDeviceWarnStatisticsEntity(); // YysDeviceWarnStatisticsEntity entity = new YysDeviceWarnStatisticsEntity();
entity.setId(mainId); // entity.setId(mainId);
entity.setDeviceName(obj.getLine()); // entity.setDeviceName(obj.getLine());
entity.setProductionTime(obj.getGmtCreate()); // entity.setProductionTime(obj.getGmtCreate());
entity.setCreatorTime(obj.getCreateTime()); // entity.setCreatorTime(obj.getCreateTime());
entity.setRegisterAddress(obj.getRegistorAddress()); // entity.setRegisterAddress(obj.getRegistorAddress());
entity.setWarnDetails(obj.getExceptMessage()); // entity.setWarnDetails(obj.getExceptMessage());
entity.setWarnType(obj.getExceptTypeName()); // entity.setWarnType(obj.getExceptTypeName());
entity.setSyncId(obj.getId()); // entity.setSyncId(obj.getId());
entity.setCreatorUserId(userProvider.get().getUserId()); // entity.setCreatorUserId(userProvider.get().getUserId());
return entity; // return entity;
}).collect(Collectors.toList()); // }).collect(Collectors.toList());
//批量存储 // //批量存储
boolean result = yysDeviceWarnStatisticsService.saveBatch(collect); // boolean result = yysDeviceWarnStatisticsService.saveBatch(collect);
//存储成功之后 统计数量 // //存储成功之后 统计数量
if (result) { // if (result) {
CompletableFuture.runAsync(() -> yysDeviceWarnService.syncCount(collect)); // CompletableFuture.runAsync(() -> yysDeviceWarnService.syncCount(collect));
} // }
} }
/** /**

@ -115,17 +115,17 @@
<h2>绑定物料列表</h2> <h2>绑定物料列表</h2>
</div> </div>
<el-table :data="dataForm.data" size="mini"> <el-table :data="dataForm.data" size="mini">
<el-table-column label="设备编码"> <el-table-column label="序号">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.deviceCode }} {{ scope.row.deviceCode }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="母件编码"> <el-table-column label="产品编码">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.materialId }} {{ scope.row.materialId }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="母件名称"> <el-table-column label="产品名称">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.materialName }} {{ scope.row.materialName }}
</template> </template>

Loading…
Cancel
Save