Browse Source

Merge pull request 'V3' (#85) from V3 into master

Reviewed-on: http://git.lrdaiot.cn:9000/thing/thing_api/pulls/85
qingyuan_dev_new
夏超 1 year ago
parent
commit
6247ecd57a
  1. 2
      modules/carbon-track/src/main/java/com/thing/carbontrack/productionResult/entity/IotCarbonProductionResultEntity.java
  2. 11
      modules/carbon-track/src/main/java/com/thing/carbontrack/productionResult/service/impl/IotCarbonProductionResultServiceImpl.java
  3. 2
      modules/carbon-track/src/main/resources/mapper/IotCarbonProductionRecordMapper.xml
  4. 4
      modules/visual-design/src/main/java/com/thing/visual/board/service/impl/IotVisualManageServiceImpl.java
  5. 8
      modules/visual-design/src/main/java/com/thing/visual/component/service/impl/IotVisualComponentServiceImpl.java
  6. 12
      modules/visual-design/src/main/java/com/thing/visual/group/service/impl/IotVisualGroupServiceImpl.java
  7. 4
      modules/visual-design/src/main/java/com/thing/visual/material/service/impl/IotVisualMaterialServiceImpl.java

2
modules/carbon-track/src/main/java/com/thing/carbontrack/productionResult/entity/IotCarbonProductionResultEntity.java

@ -198,7 +198,7 @@ public class IotCarbonProductionResultEntity implements Serializable {
entity.setW_unit(info.getWUnit()); entity.setW_unit(info.getWUnit());
entity.setP_weight(info.getPWeight()); entity.setP_weight(info.getPWeight());
if(ObjectUtils.isEmpty(info.getPrDur())){ if(ObjectUtils.isEmpty(info.getPrDur())){
long prDur = (info.getEndTime().getTime() - info.getStartTime().getTime())/ (1000 * 60 * 60);
long prDur = (info.getEndTime().getTime() - info.getStartTime().getTime()+1)/ (1000 * 60 * 60*60);
entity.setPrDur((int) prDur); entity.setPrDur((int) prDur);
}else { }else {
entity.setPrDur(info.getPrDur().intValue()); entity.setPrDur(info.getPrDur().intValue());

11
modules/carbon-track/src/main/java/com/thing/carbontrack/productionResult/service/impl/IotCarbonProductionResultServiceImpl.java

@ -168,10 +168,8 @@ public class IotCarbonProductionResultServiceImpl
return new LotCarbonBaseInfoOnYear(); return new LotCarbonBaseInfoOnYear();
} }
LotCarbonBaseInfoOnYear res = LotCarbonBaseInfoOnYear.init(production); LotCarbonBaseInfoOnYear res = LotCarbonBaseInfoOnYear.init(production);
Date start = new Date(DateTimeUtils.yearStartTs());
Date end = new Date(DateTimeUtils.yearEndTs());
List<AggCarbon> aggCarbons = aggCarbon(productId, start, end);
List<AggCarbon> aggCarbons = aggCarbon(productId);
Map<String, Map<String, BigDecimal>> aggMap = AggCarbon.agg(aggCarbons); Map<String, Map<String, BigDecimal>> aggMap = AggCarbon.agg(aggCarbons);
res.setCarbonAvgMap(aggMap.get(AggCarbon.AVG)); res.setCarbonAvgMap(aggMap.get(AggCarbon.AVG));
@ -666,7 +664,7 @@ public class IotCarbonProductionResultServiceImpl
return mapper.selectListByQueryAs(queryWrapper, IotCarbonProductionResultDTO.class); return mapper.selectListByQueryAs(queryWrapper, IotCarbonProductionResultDTO.class);
} }
private List<AggCarbon> aggCarbon(Long productId, Date start, Date end) {
private List<AggCarbon> aggCarbon(Long productId) {
return mapper.selectListByQueryAs( return mapper.selectListByQueryAs(
QueryWrapper.create() QueryWrapper.create()
.select( .select(
@ -677,11 +675,6 @@ public class IotCarbonProductionResultServiceImpl
sum(IOT_CARBON_PRODUCTION_RESULT_ENTITY.F_CARBON_AVG).as(AggCarbon::getFCarbonAvg)) sum(IOT_CARBON_PRODUCTION_RESULT_ENTITY.F_CARBON_AVG).as(AggCarbon::getFCarbonAvg))
.from(IOT_CARBON_PRODUCTION_RESULT_ENTITY) .from(IOT_CARBON_PRODUCTION_RESULT_ENTITY)
.eq(IotCarbonProductionResultEntity::getM_id, productId) .eq(IotCarbonProductionResultEntity::getM_id, productId)
.between(
IotCarbonProductionResultEntity::getFinishTime,
start,
end,
Objects.nonNull(start) && Objects.nonNull(end))
.groupBy( .groupBy(
IOT_CARBON_PRODUCTION_RESULT_ENTITY.CARBON_TYPE, IOT_CARBON_PRODUCTION_RESULT_ENTITY.CARBON_TYPE,
IOT_CARBON_PRODUCTION_RESULT_ENTITY.PR_CODE), IOT_CARBON_PRODUCTION_RESULT_ENTITY.PR_CODE),

2
modules/carbon-track/src/main/resources/mapper/IotCarbonProductionRecordMapper.xml

@ -266,7 +266,7 @@
.pr_code, .pr_code,
MIN ( P.start_time ) AS start_time, MIN ( P.start_time ) AS start_time,
MAX ( P.end_time ) AS end_time, MAX ( P.end_time ) AS end_time,
SUM (P.pr_dur) as pr_dur,
MAX(P.pr_dur) as pr_dur,
aa.ID AS m_id, aa.ID AS m_id,
aa.p_weight AS "p_weight", aa.p_weight AS "p_weight",
aa.w_unit AS "w_unit", aa.w_unit AS "w_unit",

4
modules/visual-design/src/main/java/com/thing/visual/board/service/impl/IotVisualManageServiceImpl.java

@ -234,7 +234,9 @@ public class IotVisualManageServiceImpl extends BaseServiceImpl<IotVisualManageM
List<Long> menuIdList = sysMenuDTOList.stream().map(SysMenuDTO::getId).collect(Collectors.toList()); List<Long> menuIdList = sysMenuDTOList.stream().map(SysMenuDTO::getId).collect(Collectors.toList());
sysRoleMenuDao.deleteByMenuIds(menuIdList); sysRoleMenuDao.deleteByMenuIds(menuIdList);
//删除菜单表 //删除菜单表
sysMenuService.batchDelete((Long[]) menuIdList.toArray());
menuIdList.forEach(temp->{
sysMenuService.delete(temp);
});
sysLanguageDao.deleteByQuery(QueryWrapper.create().in(SysLanguageEntity::getTableId, menuIdList)); sysLanguageDao.deleteByQuery(QueryWrapper.create().in(SysLanguageEntity::getTableId, menuIdList));
} }
} }

8
modules/visual-design/src/main/java/com/thing/visual/component/service/impl/IotVisualComponentServiceImpl.java

@ -68,7 +68,7 @@ public class IotVisualComponentServiceImpl extends BaseServiceImpl<IotVisualComp
} }
wrapper.in(IotVisualComponentEntity::getGroupId,groupIdList,ObjectUtils.isNotEmpty(groupIdList)); wrapper.in(IotVisualComponentEntity::getGroupId,groupIdList,ObjectUtils.isNotEmpty(groupIdList));
wrapper.like(IotVisualComponentEntity::getName,name,StringUtils.isNotEmpty(name)); wrapper.like(IotVisualComponentEntity::getName,name,StringUtils.isNotEmpty(name));
wrapper.and(IOT_VISUAL_COMPONENT_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_COMPONENT_ENTITY.IS_DEFAULT.eq("1")));
wrapper.and(IOT_VISUAL_COMPONENT_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_COMPONENT_ENTITY.IS_DEFAULT.eq("0")));
wrapper.orderBy("iot_visual_group.sort,iot_visual_group.bs_sort,iot_visual_component.sort",true); wrapper.orderBy("iot_visual_group.sort,iot_visual_group.bs_sort,iot_visual_component.sort",true);
return wrapper; return wrapper;
} }
@ -87,7 +87,7 @@ public class IotVisualComponentServiceImpl extends BaseServiceImpl<IotVisualComp
QueryWrapper wrapper = new QueryWrapper(); QueryWrapper wrapper = new QueryWrapper();
wrapper.select(max(IOT_VISUAL_COMPONENT_ENTITY.SORT).as("sort")) wrapper.select(max(IOT_VISUAL_COMPONENT_ENTITY.SORT).as("sort"))
.from(IOT_VISUAL_COMPONENT_ENTITY).eq(IotVisualComponentEntity::getGroupId,groupId); .from(IOT_VISUAL_COMPONENT_ENTITY).eq(IotVisualComponentEntity::getGroupId,groupId);
wrapper.and(IOT_VISUAL_COMPONENT_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_COMPONENT_ENTITY.IS_DEFAULT.eq("1")));
wrapper.and(IOT_VISUAL_COMPONENT_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_COMPONENT_ENTITY.IS_DEFAULT.eq("0")));
Integer number = this.mapper.selectOneByQueryAs(wrapper,Integer.class); Integer number = this.mapper.selectOneByQueryAs(wrapper,Integer.class);
if(ObjectUtils.isEmpty(number)){ if(ObjectUtils.isEmpty(number)){
return 1; return 1;
@ -100,7 +100,7 @@ public class IotVisualComponentServiceImpl extends BaseServiceImpl<IotVisualComp
Long tenantCode = UserContext.getTenantCode(); Long tenantCode = UserContext.getTenantCode();
QueryWrapper wrapper = new QueryWrapper(); QueryWrapper wrapper = new QueryWrapper();
wrapper.eq("name","远程"); wrapper.eq("name","远程");
wrapper.and(IOT_VISUAL_GROUP_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_GROUP_ENTITY.IS_DEFAULT.eq("1")));
wrapper.and(IOT_VISUAL_GROUP_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_GROUP_ENTITY.IS_DEFAULT.eq("0")));
wrapper.orderBy("bs_sort",true); wrapper.orderBy("bs_sort",true);
return iotVisualGroupService.listAs(wrapper,GroupInfo.class); return iotVisualGroupService.listAs(wrapper,GroupInfo.class);
@ -224,7 +224,7 @@ public class IotVisualComponentServiceImpl extends BaseServiceImpl<IotVisualComp
wrapper.eq("group_id",groupId); wrapper.eq("group_id",groupId);
wrapper.orderBy("sort",true); wrapper.orderBy("sort",true);
wrapper.and(IOT_VISUAL_COMPONENT_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_COMPONENT_ENTITY.IS_DEFAULT.eq("1")));
wrapper.and(IOT_VISUAL_COMPONENT_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_COMPONENT_ENTITY.IS_DEFAULT.eq("0")));
return this.listAs(wrapper,ComponentSortInfo.class); return this.listAs(wrapper,ComponentSortInfo.class);
} }

12
modules/visual-design/src/main/java/com/thing/visual/group/service/impl/IotVisualGroupServiceImpl.java

@ -59,7 +59,7 @@ public class IotVisualGroupServiceImpl extends BaseServiceImpl<IotVisualGroupMap
} }
String businessName = MapUtils.getString(params,"businessName"); String businessName = MapUtils.getString(params,"businessName");
wrapper.eq(IotVisualGroupEntity::getType,MapUtils.getString(params,"type")); wrapper.eq(IotVisualGroupEntity::getType,MapUtils.getString(params,"type"));
wrapper.and(IOT_VISUAL_GROUP_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_GROUP_ENTITY.IS_DEFAULT.eq("1")));
wrapper.and(IOT_VISUAL_GROUP_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_GROUP_ENTITY.IS_DEFAULT.eq("0")));
wrapper.like(IotVisualGroupEntity::getBusinessName,businessName, StringUtils.isNotEmpty(businessName)); wrapper.like(IotVisualGroupEntity::getBusinessName,businessName, StringUtils.isNotEmpty(businessName));
if(null!=nameList&&nameList.size()!=1){ if(null!=nameList&&nameList.size()!=1){
wrapper.in(IotVisualGroupEntity::getName,nameList,ObjectUtils.isNotEmpty(nameList)); wrapper.in(IotVisualGroupEntity::getName,nameList,ObjectUtils.isNotEmpty(nameList));
@ -114,7 +114,7 @@ public class IotVisualGroupServiceImpl extends BaseServiceImpl<IotVisualGroupMap
QueryWrapper wrapper = new QueryWrapper(); QueryWrapper wrapper = new QueryWrapper();
wrapper.select(max(IOT_VISUAL_GROUP_ENTITY.SORT).as("sort"), max(IOT_VISUAL_GROUP_ENTITY.BS_SORT).as("bs_sort")) wrapper.select(max(IOT_VISUAL_GROUP_ENTITY.SORT).as("sort"), max(IOT_VISUAL_GROUP_ENTITY.BS_SORT).as("bs_sort"))
.from(IOT_VISUAL_GROUP_ENTITY).eq(IotVisualGroupEntity::getType,type); .from(IOT_VISUAL_GROUP_ENTITY).eq(IotVisualGroupEntity::getType,type);
wrapper.and(IOT_VISUAL_GROUP_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_GROUP_ENTITY.IS_DEFAULT.eq("1")));
wrapper.and(IOT_VISUAL_GROUP_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_GROUP_ENTITY.IS_DEFAULT.eq("0")));
if(ObjectUtils.isNotEmpty(name)){ if(ObjectUtils.isNotEmpty(name)){
wrapper.eq(IotVisualGroupEntity::getName,name); wrapper.eq(IotVisualGroupEntity::getName,name);
} }
@ -126,7 +126,7 @@ public class IotVisualGroupServiceImpl extends BaseServiceImpl<IotVisualGroupMap
//当前最大 sort 返回 //当前最大 sort 返回
wrapper.select(max(IOT_VISUAL_GROUP_ENTITY.SORT).as("sort")) wrapper.select(max(IOT_VISUAL_GROUP_ENTITY.SORT).as("sort"))
.from(IOT_VISUAL_GROUP_ENTITY).eq(IotVisualGroupEntity::getType,type); .from(IOT_VISUAL_GROUP_ENTITY).eq(IotVisualGroupEntity::getType,type);
wrapper.and(IOT_VISUAL_GROUP_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_GROUP_ENTITY.IS_DEFAULT.eq("1")));
wrapper.and(IOT_VISUAL_GROUP_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_GROUP_ENTITY.IS_DEFAULT.eq("0")));
GroupSortInfo maxSort = this.mapper.selectOneByQueryAs(wrapper,GroupSortInfo.class); GroupSortInfo maxSort = this.mapper.selectOneByQueryAs(wrapper,GroupSortInfo.class);
try { try {
sortInfo.setSort(maxSort.getSort()+1); sortInfo.setSort(maxSort.getSort()+1);
@ -208,7 +208,7 @@ public class IotVisualGroupServiceImpl extends BaseServiceImpl<IotVisualGroupMap
wrapper.select(max(IOT_VISUAL_GROUP_ENTITY.SORT).as("sort"), IOT_VISUAL_GROUP_ENTITY.NAME.as("name")) wrapper.select(max(IOT_VISUAL_GROUP_ENTITY.SORT).as("sort"), IOT_VISUAL_GROUP_ENTITY.NAME.as("name"))
.from(IOT_VISUAL_GROUP_ENTITY).eq(IotVisualGroupEntity::getType,type); .from(IOT_VISUAL_GROUP_ENTITY).eq(IotVisualGroupEntity::getType,type);
//本企业得or 默认得 //本企业得or 默认得
wrapper.and(IOT_VISUAL_GROUP_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_GROUP_ENTITY.IS_DEFAULT.eq("1")));
wrapper.and(IOT_VISUAL_GROUP_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_GROUP_ENTITY.IS_DEFAULT.eq("0")));
wrapper.eq(IotVisualGroupEntity::getName,name,StringUtils.isNotEmpty(name)); wrapper.eq(IotVisualGroupEntity::getName,name,StringUtils.isNotEmpty(name));
wrapper.groupBy(IOT_VISUAL_GROUP_ENTITY.NAME).orderBy(IOT_VISUAL_GROUP_ENTITY.SORT,true); wrapper.groupBy(IOT_VISUAL_GROUP_ENTITY.NAME).orderBy(IOT_VISUAL_GROUP_ENTITY.SORT,true);
return this.mapper.selectListByQueryAs(wrapper,NameSort.class); return this.mapper.selectListByQueryAs(wrapper,NameSort.class);
@ -282,12 +282,12 @@ public class IotVisualGroupServiceImpl extends BaseServiceImpl<IotVisualGroupMap
wrapper.select(max(IOT_VISUAL_GROUP_ENTITY.BS_SORT).as("sort"), IOT_VISUAL_GROUP_ENTITY.BUSINESS_NAME.as("name")) wrapper.select(max(IOT_VISUAL_GROUP_ENTITY.BS_SORT).as("sort"), IOT_VISUAL_GROUP_ENTITY.BUSINESS_NAME.as("name"))
.from(IOT_VISUAL_GROUP_ENTITY).eq(IotVisualGroupEntity::getType,type); .from(IOT_VISUAL_GROUP_ENTITY).eq(IotVisualGroupEntity::getType,type);
//本企业得or 默认得 //本企业得or 默认得
wrapper.and(IOT_VISUAL_GROUP_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_GROUP_ENTITY.IS_DEFAULT.eq("1")));
wrapper.and(IOT_VISUAL_GROUP_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_GROUP_ENTITY.IS_DEFAULT.eq("0")));
wrapper.eq(IotVisualGroupEntity::getName,name).groupBy(IOT_VISUAL_GROUP_ENTITY.BUSINESS_NAME).orderBy("sort",true); wrapper.eq(IotVisualGroupEntity::getName,name).groupBy(IOT_VISUAL_GROUP_ENTITY.BUSINESS_NAME).orderBy("sort",true);
}else { }else {
wrapper.select(max(IOT_VISUAL_GROUP_ENTITY.SORT).as("sort"), IOT_VISUAL_GROUP_ENTITY.NAME.as("name")) wrapper.select(max(IOT_VISUAL_GROUP_ENTITY.SORT).as("sort"), IOT_VISUAL_GROUP_ENTITY.NAME.as("name"))
.from(IOT_VISUAL_GROUP_ENTITY).eq(IotVisualGroupEntity::getType,type); .from(IOT_VISUAL_GROUP_ENTITY).eq(IotVisualGroupEntity::getType,type);
wrapper.and(IOT_VISUAL_GROUP_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_GROUP_ENTITY.IS_DEFAULT.eq("1")));
wrapper.and(IOT_VISUAL_GROUP_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_GROUP_ENTITY.IS_DEFAULT.eq("0")));
wrapper.groupBy(IOT_VISUAL_GROUP_ENTITY.NAME).orderBy(IOT_VISUAL_GROUP_ENTITY.SORT,true);; wrapper.groupBy(IOT_VISUAL_GROUP_ENTITY.NAME).orderBy(IOT_VISUAL_GROUP_ENTITY.SORT,true);;
} }
return this.mapper.selectListByQueryAs(wrapper,NameSort.class); return this.mapper.selectListByQueryAs(wrapper,NameSort.class);

4
modules/visual-design/src/main/java/com/thing/visual/material/service/impl/IotVisualMaterialServiceImpl.java

@ -211,7 +211,7 @@ public class IotVisualMaterialServiceImpl extends BaseServiceImpl<IotVisualMater
QueryWrapper wrapper = new QueryWrapper(); QueryWrapper wrapper = new QueryWrapper();
wrapper.select(max(IOT_VISUAL_MATERIAL_ENTITY.SORT).as("sort")) wrapper.select(max(IOT_VISUAL_MATERIAL_ENTITY.SORT).as("sort"))
.from(IOT_VISUAL_MATERIAL_ENTITY).eq(IotVisualMaterialEntity::getGroupId,groupId); .from(IOT_VISUAL_MATERIAL_ENTITY).eq(IotVisualMaterialEntity::getGroupId,groupId);
wrapper.and(IOT_VISUAL_MATERIAL_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_MATERIAL_ENTITY.IS_DEFAULT.eq(1)));
wrapper.and(IOT_VISUAL_MATERIAL_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_MATERIAL_ENTITY.IS_DEFAULT.eq(0)));
Integer number = this.mapper.selectOneByQueryAs(wrapper,Integer.class); Integer number = this.mapper.selectOneByQueryAs(wrapper,Integer.class);
if(ObjectUtils.isEmpty(number)){ if(ObjectUtils.isEmpty(number)){
return 1; return 1;
@ -302,7 +302,7 @@ public class IotVisualMaterialServiceImpl extends BaseServiceImpl<IotVisualMater
QueryWrapper wrapper = new QueryWrapper(); QueryWrapper wrapper = new QueryWrapper();
wrapper.eq("group_id",groupId); wrapper.eq("group_id",groupId);
wrapper.orderBy("sort",true); wrapper.orderBy("sort",true);
wrapper.and(IOT_VISUAL_MATERIAL_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_MATERIAL_ENTITY.IS_DEFAULT.eq(1)));
wrapper.and(IOT_VISUAL_MATERIAL_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_MATERIAL_ENTITY.IS_DEFAULT.eq(0)));
return this.listAs(wrapper,ComponentSortInfo.class); return this.listAs(wrapper,ComponentSortInfo.class);
} }
Loading…
Cancel
Save