Browse Source

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

Reviewed-on: http://git.lrdaiot.cn:9000/thing/thing_api/pulls/87
qingyuan_dev_new
夏超 1 year ago
parent
commit
3bbbad0b9f
  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. 1
      modules/carbon-track/src/main/java/com/thing/carbontrack/productionResult/service/impl/IotCarbonProductionResultServiceImpl.java
  7. 2
      modules/carbon-track/src/main/resources/mapper/IotCarbonBomMapper.xml
  8. 4
      modules/thing/src/main/java/com/thing/dashboard/dto/IotDashboardGroupDTO.java
  9. 4
      modules/thing/src/main/java/com/thing/screen/dto/IotEnterpriseDashboardDTO.java
  10. 2
      modules/thing/src/main/java/com/thing/screen/service/impl/IotEnterpriseDashboardServiceImpl.java
  11. 1
      modules/thing/src/main/java/com/thing/sys/tenant/service/impl/SysTenantDetailServiceImpl.java
  12. 4
      modules/thing/src/main/resources/mapper/sys/SysMenuMapper.xml
  13. 5
      modules/visual-design/src/main/java/com/thing/visual/board/service/impl/IotVisualManageServiceImpl.java
  14. 2
      modules/visual-design/src/main/java/com/thing/visual/component/service/impl/IotVisualComponentServiceImpl.java
  15. 3
      modules/visual-design/src/main/java/com/thing/visual/configuration/service/impl/IotVisualDesignServiceImpl.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;
} }

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

@ -203,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);
} }

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,

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;
} }

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

5
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;
} }
@ -334,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)){

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

@ -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());
if(ObjectUtils.isNotEmpty(group)){
temp.setGroupName(group.getName()); temp.setGroupName(group.getName());
temp.setGroupBusinessName(group.getBusinessName()); temp.setGroupBusinessName(group.getBusinessName());
temp.setGroupSort(group.getSort()); temp.setGroupSort(group.getSort());
temp.setGroupBSort(group.getBsSort()); temp.setGroupBSort(group.getBsSort());
}
}); });
return dtoPageData; return dtoPageData;
} }

3
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);
if(ObjectUtil.isNotEmpty(data)){
IotVisualManageEntity manageEntity = iotVisualManageService.getById(id); IotVisualManageEntity manageEntity = iotVisualManageService.getById(id);
data.setThumbnailUrl(manageEntity.getThumbnailUrl()); data.setThumbnailUrl(manageEntity.getThumbnailUrl());
data.setPageName(manageEntity.getName()); data.setPageName(manageEntity.getName());
data.setPreviewUrl(manageEntity.getPreviewUrl()); data.setPreviewUrl(manageEntity.getPreviewUrl());
if(ObjectUtil.isNotEmpty(data)){
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) // 去掉可能的空格

Loading…
Cancel
Save