Browse Source

Merge pull request 'V3' (#88) from V3 into qingyuan-dev

Reviewed-on: http://git.lrdaiot.cn:9000/thing/thing_api/pulls/88
qingyuan_dev_new
夏超 1 year ago
parent
commit
a7a737ca59
  1. 3
      modules/carbon-track/src/main/java/com/thing/carbontrack/bom/dto/IotCarbonBomDTO.java
  2. 3
      modules/carbon-track/src/main/java/com/thing/carbontrack/bom/entity/IotCarbonBomEntity.java
  3. 4
      modules/carbon-track/src/main/java/com/thing/carbontrack/event/standardcal/listener/ProductionResultListener.java
  4. 4
      modules/carbon-track/src/main/java/com/thing/carbontrack/productionResult/dto/AggCarbon.java
  5. 10
      modules/carbon-track/src/main/java/com/thing/carbontrack/productionResult/dto/MptDetail.java
  6. 2
      modules/carbon-track/src/main/java/com/thing/carbontrack/productionResult/entity/IotCarbonProductionResultEntity.java
  7. 12
      modules/carbon-track/src/main/java/com/thing/carbontrack/productionResult/service/impl/IotCarbonProductionResultServiceImpl.java
  8. 2
      modules/carbon-track/src/main/resources/mapper/IotCarbonBomMapper.xml
  9. 2
      modules/carbon-track/src/main/resources/mapper/IotCarbonProductionRecordMapper.xml
  10. 4
      modules/thing/src/main/java/com/thing/dashboard/dto/IotDashboardGroupDTO.java
  11. 4
      modules/thing/src/main/java/com/thing/screen/dto/IotEnterpriseDashboardDTO.java
  12. 2
      modules/thing/src/main/java/com/thing/screen/service/impl/IotEnterpriseDashboardServiceImpl.java
  13. 1
      modules/thing/src/main/java/com/thing/sys/tenant/service/impl/SysTenantDetailServiceImpl.java
  14. 8
      modules/thing/src/main/java/com/thing/thing/relation/root/service/impl/IotThingRelationRootServiceImpl.java
  15. 4
      modules/thing/src/main/resources/mapper/sys/SysMenuMapper.xml
  16. 9
      modules/visual-design/src/main/java/com/thing/visual/board/service/impl/IotVisualManageServiceImpl.java
  17. 18
      modules/visual-design/src/main/java/com/thing/visual/component/service/impl/IotVisualComponentServiceImpl.java
  18. 11
      modules/visual-design/src/main/java/com/thing/visual/configuration/service/impl/IotVisualDesignServiceImpl.java
  19. 12
      modules/visual-design/src/main/java/com/thing/visual/group/service/impl/IotVisualGroupServiceImpl.java
  20. 4
      modules/visual-design/src/main/java/com/thing/visual/material/service/impl/IotVisualMaterialServiceImpl.java

3
modules/carbon-track/src/main/java/com/thing/carbontrack/bom/dto/IotCarbonBomDTO.java

@ -37,6 +37,9 @@ public class IotCarbonBomDTO implements Serializable {
private BigDecimal weight; private BigDecimal weight;
@Schema(description = "重量重量计量单位") @Schema(description = "重量重量计量单位")
private String w_unit; private String w_unit;
@Schema(description = "重量重量计量父级描述")
private String unitStr;
@Schema(description = "原料用量") @Schema(description = "原料用量")
private BigDecimal dosage; private BigDecimal dosage;
@Schema(description = "供应商编码") @Schema(description = "供应商编码")

3
modules/carbon-track/src/main/java/com/thing/carbontrack/bom/entity/IotCarbonBomEntity.java

@ -101,4 +101,7 @@ public class IotCarbonBomEntity implements Serializable {
private BigDecimal transportUse; private BigDecimal transportUse;
//物料单耗 //物料单耗
private BigDecimal muFinalUse; private BigDecimal muFinalUse;
private String unitStr;
} }

4
modules/carbon-track/src/main/java/com/thing/carbontrack/event/standardcal/listener/ProductionResultListener.java

@ -294,6 +294,7 @@ public class ProductionResultListener {
entity = IotCarbonProductionResultEntity.initDto(production,"1", entity = IotCarbonProductionResultEntity.initDto(production,"1",
carbonReq.getMuFinalUse(),carbonReq.getTransportUse(),uintTransportTotalCarbon,uintCarbon); carbonReq.getMuFinalUse(),carbonReq.getTransportUse(),uintTransportTotalCarbon,uintCarbon);
entityList.forEach(temp->{ entityList.forEach(temp->{
temp.setW_unit(temp.getWwunit());
temp.setAcquireCarbon(temp.getAcquireCarbon().divide(new BigDecimal(production.getFinalNum()),4,RoundingMode.UP)); temp.setAcquireCarbon(temp.getAcquireCarbon().divide(new BigDecimal(production.getFinalNum()),4,RoundingMode.UP));
temp.setDosage(temp.getDosage().divide(new BigDecimal(production.getFinalNum()),4,RoundingMode.UP)); temp.setDosage(temp.getDosage().divide(new BigDecimal(production.getFinalNum()),4,RoundingMode.UP));
temp.setTransportUse(temp.getTransportUse().divide(new BigDecimal(production.getFinalNum()),4,RoundingMode.UP)); temp.setTransportUse(temp.getTransportUse().divide(new BigDecimal(production.getFinalNum()),4,RoundingMode.UP));
@ -304,6 +305,9 @@ public class ProductionResultListener {
//初始化运输结果 //初始化运输结果
entity = IotCarbonProductionResultEntity.initDto(production,"1", entity = IotCarbonProductionResultEntity.initDto(production,"1",
totalCarbon,transportTotalCarbon,carbonReq.getTransportUse(),carbonReq.getMuFinalUse()); totalCarbon,transportTotalCarbon,carbonReq.getTransportUse(),carbonReq.getMuFinalUse());
entityList.forEach(temp->{
temp.setW_unit(temp.getWwunit());
});
} }
entity.setJson(JSONObject.toJSONString(entityList)); entity.setJson(JSONObject.toJSONString(entityList));
//do update 还是 insert 产品bom来说根据 产品id工单编码类型来判断是否已存在 //do update 还是 insert 产品bom来说根据 产品id工单编码类型来判断是否已存在

4
modules/carbon-track/src/main/java/com/thing/carbontrack/productionResult/dto/AggCarbon.java

@ -65,7 +65,7 @@ public class AggCarbon {
} }
public BigDecimal getUsageAvg() { public BigDecimal getUsageAvg() {
return usageAvg == null ? null : usageAvg.setScale(2, RoundingMode.HALF_UP);
return usageAvg == null ? null : usageAvg.setScale(3, RoundingMode.HALF_UP);
} }
public BigDecimal getCarbonAvg() { public BigDecimal getCarbonAvg() {
@ -210,7 +210,7 @@ public class AggCarbon {
if (Objects.isNull(value)) { if (Objects.isNull(value)) {
return null; return null;
} }
return value.divide(count, 2, RoundingMode.HALF_UP);
return value.divide(count, 3, RoundingMode.HALF_UP);
} }
private AggCarbon add(AggCarbon other){ private AggCarbon add(AggCarbon other){

10
modules/carbon-track/src/main/java/com/thing/carbontrack/productionResult/dto/MptDetail.java

@ -56,11 +56,17 @@ public class MptDetail {
private Long num; private Long num;
private String wwunit;
public void setW_unit(String wwunit) {
this.w_unit = wwunit;
}
public MptDetail add(MptDetail other) { public MptDetail add(MptDetail other) {
if (Objects.equals(getMaterialCode(), other.getMaterialCode())) { if (Objects.equals(getMaterialCode(), other.getMaterialCode())) {
setDosage(AggUtil.sum(totalDosage(), other.totalDosage())); setDosage(AggUtil.sum(totalDosage(), other.totalDosage()));
setAcquireCarbon(AggUtil.sum(getAcquireCarbon(), other.getAcquireCarbon()));
setTransportUse(AggUtil.sum(getTransportUse(), other.getTransportUse()));
setAcquireCarbon(other.getAcquireCarbon().multiply(getDosage()));
setTransportUse(other.getTransportUse().multiply(getDosage()));
} }
return this; return this;
} }

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());

12
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));
@ -205,6 +203,7 @@ public class IotCarbonProductionResultServiceImpl
} }
List<MptDetail> details = JSONArray.parseArray(detailJson, MptDetail.class); List<MptDetail> details = JSONArray.parseArray(detailJson, MptDetail.class);
details.forEach(e -> e.setNum(item.getFinalNum())); details.forEach(e -> e.setNum(item.getFinalNum()));
detailList.addAll(details); detailList.addAll(details);
} }
@ -666,7 +665,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 +676,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/IotCarbonBomMapper.xml

@ -22,7 +22,7 @@
aa.unit, aa.unit,
aa.dosage as dosage, aa.dosage as dosage,
aa.weight, aa.weight,
aa.w_unit,
aa.w_unit as wwunit ,
aa.mu_final_use as acquireCarbon, aa.mu_final_use as acquireCarbon,
aa.supplier_name, aa.supplier_name,
aa.supplier_address, aa.supplier_address,

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/thing/src/main/java/com/thing/dashboard/dto/IotDashboardGroupDTO.java

@ -73,13 +73,13 @@ public class IotDashboardGroupDTO implements Serializable {
private Long creator; private Long creator;
@Schema(description = "创建时间") @Schema(description = "创建时间")
private Date createDate;
private Long createDate;
@Schema(description = "更新者") @Schema(description = "更新者")
private Long updater; private Long updater;
@Schema(description = "更新时间") @Schema(description = "更新时间")
private Date updateDate;
private Long updateDate;
@Schema(description = "配置菜单信息") @Schema(description = "配置菜单信息")
private SysMenuDTO sysMenuDTO; private SysMenuDTO sysMenuDTO;

4
modules/thing/src/main/java/com/thing/screen/dto/IotEnterpriseDashboardDTO.java

@ -38,11 +38,11 @@ public class IotEnterpriseDashboardDTO implements Serializable {
@Schema(description = "创建者") @Schema(description = "创建者")
private Long creator; private Long creator;
@Schema(description = "创建时间") @Schema(description = "创建时间")
private Date createDate;
private Long createDate;
@Schema(description = "更新者") @Schema(description = "更新者")
private Long updater; private Long updater;
@Schema(description = "更新时间") @Schema(description = "更新时间")
private Date updateDate;
private Long updateDate;
@Schema(description = "大屏名称") @Schema(description = "大屏名称")
private String largeScreenName; private String largeScreenName;
@Schema(description = "背景图片地址") @Schema(description = "背景图片地址")

2
modules/thing/src/main/java/com/thing/screen/service/impl/IotEnterpriseDashboardServiceImpl.java

@ -137,7 +137,7 @@ public class IotEnterpriseDashboardServiceImpl extends BaseServiceImpl<IotEnterp
public List<IotDashboardGroupDTO> dashboardList(String tenantCode) { public List<IotDashboardGroupDTO> dashboardList(String tenantCode) {
QueryWrapper wrapper = new QueryWrapper(); QueryWrapper wrapper = new QueryWrapper();
wrapper.eq("tenant_code", tenantCode, ObjectUtil.isNotEmpty(tenantCode));
wrapper.eq("tenant_code", Long.valueOf(tenantCode), ObjectUtil.isNotEmpty(tenantCode));
return ConvertUtils.sourceToTarget(iotDashboardGroupDao.selectListByQuery(wrapper),IotDashboardGroupDTO.class); return ConvertUtils.sourceToTarget(iotDashboardGroupDao.selectListByQuery(wrapper),IotDashboardGroupDTO.class);
} }

1
modules/thing/src/main/java/com/thing/sys/tenant/service/impl/SysTenantDetailServiceImpl.java

@ -694,6 +694,7 @@ public class SysTenantDetailServiceImpl extends BaseServiceImpl<SysTenantDetailM
userEntity.setMobile(tenantUser.getPhone()); userEntity.setMobile(tenantUser.getPhone());
userEntity.setTenantCode(tenantCode); userEntity.setTenantCode(tenantCode);
userEntity.setDeptId(tenantCode); userEntity.setDeptId(tenantCode);
userEntity.setUrl("overview/cgcc");
return userEntity; return userEntity;
} }

8
modules/thing/src/main/java/com/thing/thing/relation/root/service/impl/IotThingRelationRootServiceImpl.java

@ -123,6 +123,7 @@ public class IotThingRelationRootServiceImpl extends BaseServiceImpl<IotThingRel
String finalOrderField = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, orderField); String finalOrderField = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, orderField);
Comparator<ObjectNode> comparator = CompareUtils.getComparator(order, finalOrderField); //封装参数 Comparator<ObjectNode> comparator = CompareUtils.getComparator(order, finalOrderField); //封装参数
List<Pair<String, String>> pairs = buildParam(name, null,tenantCode); List<Pair<String, String>> pairs = buildParam(name, null,tenantCode);
return rootList.stream() return rootList.stream()
.filter(jsonObject -> { .filter(jsonObject -> {
boolean passesFilter = JacksonUtil.filter(jsonObject, pairs); boolean passesFilter = JacksonUtil.filter(jsonObject, pairs);
@ -133,7 +134,12 @@ public class IotThingRelationRootServiceImpl extends BaseServiceImpl<IotThingRel
} }
return passesFilter; return passesFilter;
}) })
.filter(s-> s.get(CacheNameEnum.RelationRootField.THING_RELATION_ROOT_GROUP_NAME.getField()).asText().equals(groupName))
.filter(s -> {
if(StringUtils.isNotBlank(groupName)){
return s.get(CacheNameEnum.RelationRootField.THING_RELATION_ROOT_GROUP_NAME.getField()).asText().equals(groupName);
}
return true;
} )
.sorted(comparator.thenComparing(obj -> obj.get(CacheNameEnum.RelationRootField.THING_RELATION_ROOT_ID.getField()).asLong())).toList(); .sorted(comparator.thenComparing(obj -> obj.get(CacheNameEnum.RelationRootField.THING_RELATION_ROOT_ID.getField()).asLong())).toList();
} }

4
modules/thing/src/main/resources/mapper/sys/SysMenuMapper.xml

@ -52,7 +52,7 @@
</select> </select>
<select id="getSuperAdminMenuList" resultType="com.thing.sys.biz.entity.SysMenuEntity"> <select id="getSuperAdminMenuList" resultType="com.thing.sys.biz.entity.SysMenuEntity">
select t1.*, (select lang.field_value from sys_language lang where lang.table_name='sys_menu' and lang.field_name='name'
select DISTINCT t1.*, (select lang.field_value from sys_language lang where lang.table_name='sys_menu' and lang.field_name='name'
and lang.table_id=t1.id and lang.language=#{language}) as name and lang.table_id=t1.id and lang.language=#{language}) as name
from sys_menu t1 from sys_menu t1
where t1.sa_view = 1 where t1.sa_view = 1
@ -70,7 +70,7 @@
<select id="getUserMenuList" resultType="com.thing.sys.biz.entity.SysMenuEntity"> <select id="getUserMenuList" resultType="com.thing.sys.biz.entity.SysMenuEntity">
select t3.*, (select lang.field_value from sys_language lang where lang.table_name='sys_menu' and lang.field_name='name'
select distinct t3.*, (select lang.field_value from sys_language lang where lang.table_name='sys_menu' and lang.field_name='name'
and lang.table_id=t3.id and lang.language=#{language}) as name from sys_role_user t1 and lang.table_id=t3.id and lang.language=#{language}) as name from sys_role_user t1
inner join sys_role_menu t2 on t1.role_id = t2.role_id inner join sys_role_menu t2 on t1.role_id = t2.role_id
inner join sys_menu t3 on t2.menu_id = t3.id inner join sys_menu t3 on t2.menu_id = t3.id

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

@ -17,6 +17,7 @@ import com.thing.common.core.utils.JsonProcessingUtils;
import com.thing.common.core.web.response.PageData; import com.thing.common.core.web.response.PageData;
import com.thing.common.core.web.response.Result; import com.thing.common.core.web.response.Result;
import com.thing.common.orm.service.impl.BaseServiceImpl; import com.thing.common.orm.service.impl.BaseServiceImpl;
import com.thing.common.orm.utils.IdGenerator;
import com.thing.sys.biz.dto.SysMenuDTO; import com.thing.sys.biz.dto.SysMenuDTO;
import com.thing.sys.biz.dto.SysRoleDTO; import com.thing.sys.biz.dto.SysRoleDTO;
import com.thing.sys.biz.entity.SysLanguageEntity; import com.thing.sys.biz.entity.SysLanguageEntity;
@ -116,6 +117,7 @@ public class IotVisualManageServiceImpl extends BaseServiceImpl<IotVisualManageM
wrapper.in( "id", idList,CollectionUtils.isNotEmpty(idList)); wrapper.in( "id", idList,CollectionUtils.isNotEmpty(idList));
} }
wrapper.and(IOT_VISUAL_MANAGE_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_MANAGE_ENTITY.IS_DEFAULT.eq(0))); wrapper.and(IOT_VISUAL_MANAGE_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_MANAGE_ENTITY.IS_DEFAULT.eq(0)));
wrapper.orderBy(IOT_VISUAL_MANAGE_ENTITY.CREATE_DATE,false);
return wrapper; return wrapper;
} }
@ -234,7 +236,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));
} }
} }
@ -332,8 +336,9 @@ public class IotVisualManageServiceImpl extends BaseServiceImpl<IotVisualManageM
public Result copy(Long id) { public Result copy(Long id) {
IotVisualManageDTO data =this.getByIdAs(id, IotVisualManageDTO.class); IotVisualManageDTO data =this.getByIdAs(id, IotVisualManageDTO.class);
String name = data.getName()+"_COPY"+UUID.randomUUID().toString().substring(1,5); String name = data.getName()+"_COPY"+UUID.randomUUID().toString().substring(1,5);
data.setId(null);
data.setId(IdGenerator.nextId());
data.setName(name); data.setName(name);
data.setCreateDate(System.currentTimeMillis());
this.saveDto(data); this.saveDto(data);
IotVisualDesignDTO desigDTO = iotVisualDesignService.getDetailByBoardManageId(String.valueOf(id)); IotVisualDesignDTO desigDTO = iotVisualDesignService.getDetailByBoardManageId(String.valueOf(id));
if(ObjectUtil.isNotNull(desigDTO)){ if(ObjectUtil.isNotNull(desigDTO)){

18
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);
@ -129,10 +129,12 @@ public class IotVisualComponentServiceImpl extends BaseServiceImpl<IotVisualComp
dtoPageData.getList().forEach(temp->{ dtoPageData.getList().forEach(temp->{
IotVisualGroupEntity group = iotVisualGroupService.getById(temp.getGroupId()); IotVisualGroupEntity group = iotVisualGroupService.getById(temp.getGroupId());
temp.setGroupName(group.getName());
temp.setGroupBusinessName(group.getBusinessName());
temp.setGroupSort(group.getSort());
temp.setGroupBSort(group.getBsSort());
if(ObjectUtils.isNotEmpty(group)){
temp.setGroupName(group.getName());
temp.setGroupBusinessName(group.getBusinessName());
temp.setGroupSort(group.getSort());
temp.setGroupBSort(group.getBsSort());
}
}); });
return dtoPageData; return dtoPageData;
} }
@ -224,7 +226,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);
} }

11
modules/visual-design/src/main/java/com/thing/visual/configuration/service/impl/IotVisualDesignServiceImpl.java

@ -113,12 +113,11 @@ public class IotVisualDesignServiceImpl extends BaseServiceImpl<IotVisualDesignM
QueryWrapper wrapper = new QueryWrapper(); QueryWrapper wrapper = new QueryWrapper();
wrapper.eq("board_manage_id",id); wrapper.eq("board_manage_id",id);
IotVisualDesignDTO data = this.getOneAs(wrapper, IotVisualDesignDTO.class); IotVisualDesignDTO data = this.getOneAs(wrapper, IotVisualDesignDTO.class);
IotVisualManageEntity manageEntity = iotVisualManageService.getById(id);
data.setThumbnailUrl(manageEntity.getThumbnailUrl());
data.setPageName(manageEntity.getName());
data.setPreviewUrl(manageEntity.getPreviewUrl());
if(ObjectUtil.isNotEmpty(data)){ if(ObjectUtil.isNotEmpty(data)){
IotVisualManageEntity manageEntity = iotVisualManageService.getById(id);
data.setThumbnailUrl(manageEntity.getThumbnailUrl());
data.setPageName(manageEntity.getName());
data.setPreviewUrl(manageEntity.getPreviewUrl());
if(StringUtils.isNotBlank(data.getApiSetIds())){ if(StringUtils.isNotBlank(data.getApiSetIds())){
List<Long> apiIds = Arrays.stream(data.getApiSetIds().split(",")) List<Long> apiIds = Arrays.stream(data.getApiSetIds().split(","))
.map(String::trim) // 去掉可能的空格 .map(String::trim) // 去掉可能的空格
@ -130,7 +129,7 @@ public class IotVisualDesignServiceImpl extends BaseServiceImpl<IotVisualDesignM
} }
} }
return data;
return data;
} }

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