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.setP_weight(info.getPWeight());
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);
}else {
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();
}
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);
res.setCarbonAvgMap(aggMap.get(AggCarbon.AVG));
@ -666,7 +664,7 @@ public class IotCarbonProductionResultServiceImpl
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(
QueryWrapper.create()
.select(
@ -677,11 +675,6 @@ public class IotCarbonProductionResultServiceImpl
sum(IOT_CARBON_PRODUCTION_RESULT_ENTITY.F_CARBON_AVG).as(AggCarbon::getFCarbonAvg))
.from(IOT_CARBON_PRODUCTION_RESULT_ENTITY)
.eq(IotCarbonProductionResultEntity::getM_id, productId)
.between(
IotCarbonProductionResultEntity::getFinishTime,
start,
end,
Objects.nonNull(start) && Objects.nonNull(end))
.groupBy(
IOT_CARBON_PRODUCTION_RESULT_ENTITY.CARBON_TYPE,
IOT_CARBON_PRODUCTION_RESULT_ENTITY.PR_CODE),

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

@ -266,7 +266,7 @@
.pr_code,
MIN ( P.start_time ) AS start_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.p_weight AS "p_weight",
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());
sysRoleMenuDao.deleteByMenuIds(menuIdList);
//删除菜单表
sysMenuService.batchDelete((Long[]) menuIdList.toArray());
menuIdList.forEach(temp->{
sysMenuService.delete(temp);
});
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.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);
return wrapper;
}
@ -87,7 +87,7 @@ public class IotVisualComponentServiceImpl extends BaseServiceImpl<IotVisualComp
QueryWrapper wrapper = new QueryWrapper();
wrapper.select(max(IOT_VISUAL_COMPONENT_ENTITY.SORT).as("sort"))
.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);
if(ObjectUtils.isEmpty(number)){
return 1;
@ -100,7 +100,7 @@ public class IotVisualComponentServiceImpl extends BaseServiceImpl<IotVisualComp
Long tenantCode = UserContext.getTenantCode();
QueryWrapper wrapper = new QueryWrapper();
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);
return iotVisualGroupService.listAs(wrapper,GroupInfo.class);
@ -224,7 +224,7 @@ public class IotVisualComponentServiceImpl extends BaseServiceImpl<IotVisualComp
wrapper.eq("group_id",groupId);
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);
}

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");
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));
if(null!=nameList&&nameList.size()!=1){
wrapper.in(IotVisualGroupEntity::getName,nameList,ObjectUtils.isNotEmpty(nameList));
@ -114,7 +114,7 @@ public class IotVisualGroupServiceImpl extends BaseServiceImpl<IotVisualGroupMap
QueryWrapper wrapper = new QueryWrapper();
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);
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)){
wrapper.eq(IotVisualGroupEntity::getName,name);
}
@ -126,7 +126,7 @@ public class IotVisualGroupServiceImpl extends BaseServiceImpl<IotVisualGroupMap
//当前最大 sort 返回
wrapper.select(max(IOT_VISUAL_GROUP_ENTITY.SORT).as("sort"))
.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);
try {
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"))
.from(IOT_VISUAL_GROUP_ENTITY).eq(IotVisualGroupEntity::getType,type);
//本企业得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.groupBy(IOT_VISUAL_GROUP_ENTITY.NAME).orderBy(IOT_VISUAL_GROUP_ENTITY.SORT,true);
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"))
.from(IOT_VISUAL_GROUP_ENTITY).eq(IotVisualGroupEntity::getType,type);
//本企业得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);
}else {
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);
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);;
}
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();
wrapper.select(max(IOT_VISUAL_MATERIAL_ENTITY.SORT).as("sort"))
.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);
if(ObjectUtils.isEmpty(number)){
return 1;
@ -302,7 +302,7 @@ public class IotVisualMaterialServiceImpl extends BaseServiceImpl<IotVisualMater
QueryWrapper wrapper = new QueryWrapper();
wrapper.eq("group_id",groupId);
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);
}
Loading…
Cancel
Save