Commit 6f798a50 authored by 李秀明's avatar 李秀明

Merge remote-tracking branch 'origin/develop_dl' into develop_dl

parents c403cf5a fb16570d
...@@ -110,4 +110,13 @@ public class Equipment extends BaseEntity { ...@@ -110,4 +110,13 @@ public class Equipment extends BaseEntity {
*/ */
@TableField(value = "clean_type") @TableField(value = "clean_type")
private String cleanType = "0"; private String cleanType = "0";
@TableField(exist = false)
private Long equipCategoryId; // 装备分类id
@TableField(exist = false)
private String equipCategoryName; // 装备分类名称
@TableField(exist = false)
private String equipCategoryCode; // 装备分类编码
} }
...@@ -100,4 +100,29 @@ public class EquipmentCategory extends BaseEntity implements TreeNode<EquipmentC ...@@ -100,4 +100,29 @@ public class EquipmentCategory extends BaseEntity implements TreeNode<EquipmentC
public int compareTo(EquipmentCategory o) { public int compareTo(EquipmentCategory o) {
return getId().compareTo(o.getId()); return getId().compareTo(o.getId());
} }
public void addCountToParent() {
if (parentId != 0) {
EquipmentCategory parent = findParent(this);
if (parent != null) {
parent.setCount(parent.getCount() + this.getCount());
parent.addCountToParent();
}
}
}
private EquipmentCategory findParent(EquipmentCategory node) {
for (EquipmentCategory child : children) {
if (child.getId().equals(node.getParentId())) {
return child;
} else {
EquipmentCategory parent = findParent(child);
if (parent != null) {
return parent;
}
}
}
return null;
}
} }
package com.yeejoin.equipmanage.common.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.equipmanage.common.entity.publics.BaseEntity;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("wl_spare_equipment")
@ApiModel(value = "WlSpareEquipment对象", description = "设备平台备品备件管理")
public class WlSpareEquipment extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
@TableField("name")
private String name; // 装备名称
@TableField("equip_model_id")
private Long equipModelId; // 装备定义id
@TableField("equip_model_name")
private String equipModelName; // 装备定义名称
@TableField("equip_model_code")
private String equipModelCode; // 装备定义编码
@TableField("equip_category_id")
private Long equipCategoryId; // 装备分类id
@TableField("equip_category_name")
private String equipCategoryName; // 装备分类名称
@TableField("equip_category_code")
private String equipCategoryCode; // 装备分类编码
@TableField("stock_num")
private Float stockNum; // 库存数量
@TableField("manufacturer")
private String manufacturer; // 生产厂家
@TableField("manufacturer_id")
private Long manufacturerId; // 生产厂家id
@TableField("standard")
private String standard; // 规格
@TableField("brand")
private String brand; // 品牌
@TableField("production_date")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date productionDate; // 生产日期
@TableField("purchase_date")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date purchaseDate; // 采购日期
@TableField("warehouse_structure_id")
private Long warehouseStructureId; // 存储位置id
@TableField("warehouse_structure_code")
private String warehouseStructureCode; // 存储位置code
@TableField("warehouse_structure")
private String warehouseStructure; // 存储位置
@TableField("position")
private String position; // 存储位置详情描述
@TableField("unit")
private String unit; // 计量单位
@TableField("unit_id")
private Long unitId; // 计量单位id
@TableField("remark")
private String remark; // 备注
@TableField("biz_org_name")
private String bizOrgName; // 机构名称
@TableField("biz_org_code")
private String bizOrgCode; // 机构编码
@TableField("single")
private Integer single; // 管理方式(默认单件)
@TableField("is_delete")
private Boolean isDelete = false; // 是否删除 0-否 1-是
@TableField(exist = false)
private List<UploadFile> img;
@TableField(exist = false)
private List<UploadFile> video;
@TableField(exist = false)
private List<UploadFile> certification;
@TableField(exist = false)
private List<UploadFile> instruction;
@TableField(exist = false)
private List<EquProperty> equPropertyList;
@TableField(exist = false)
private List<UploadFile> quality;
@TableField(exist = false)
private List<UploadFile> operation;
@TableField(exist = false)
private String agencyId;
@TableField(exist = false)
private Integer pageNum;
@TableField(exist = false)
private Integer pageSize;
@TableField(exist = false)
private String equipmentClassificationCode;
@TableField(exist = false)
private String industryCode;
@TableField(exist = false)
private String code; // 装备定义code筛选字段
}
...@@ -79,4 +79,7 @@ public class EquipTypeImgAmountVO { ...@@ -79,4 +79,7 @@ public class EquipTypeImgAmountVO {
@ApiModelProperty(value = "日常运维") @ApiModelProperty(value = "日常运维")
private String equip; private String equip;
@ApiModelProperty(value = "系统IDs")
private String systemId;
} }
package com.yeejoin.equipmanage.common.entity.vo;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
@Data
public class WlSpareEquipmentExportVo {
@Excel(name = "装备名称")
@ExcelProperty(value = "装备名称", index = 0)
private String name; // 装备名称
@Excel(name = "装备编码(从装备定义中获取)")
@ExcelProperty(value = "装备编码(从装备定义中获取)", index = 1)
private String equipModelCode;
@Excel(name = "管理方式(单项管理/批量管理)")
@ExcelProperty(value = "管理方式(单项管理/批量管理)", index = 2)
private String single;
@Excel(name = "数量")
@ExcelProperty(value = "数量", index = 3)
private Float stockNum; // 库存数量
@Excel(name = "计量单位")
@ExcelProperty(value = "计量单位", index = 4)
private String unit; // 计量单位
@Excel(name = "规格型号")
@ExcelProperty(value = "规格型号", index = 5)
private String standard; // 规格型号
@Excel(name = "品牌")
@ExcelProperty(value = "品牌", index = 6)
private String brand; // 品牌
@Excel(name = "生产厂家名称")
@ExcelProperty(value = "生产厂家名称", index = 7)
private String manufacturer; // 生产厂家
@Excel(name = "存放位置(建筑或房间编码)")
@ExcelProperty(value = "存放位置(建筑或房间编码)", index = 8)
private String warehouseStructure; // 存储位置
@Excel(name = "位置信息")
@ExcelProperty(value = "位置信息", index = 9)
private String position; // 存储位置详情描述
@Excel(name = "生产日期")
@ExcelProperty(value = "生产日期", index = 10)
@JsonFormat(pattern = "yyyy-MM-dd")
private Date productionDate; // 生产日期
@Excel(name = "采购日期")
@JsonFormat(pattern = "yyyy-MM-dd")
@ExcelProperty(value = "采购日期", index = 11)
private Date purchaseDate; // 采购日期
@Excel(name = "备注")
@ExcelProperty(value = "备注", index = 12)
private String remark; // 备注
}
...@@ -4,7 +4,8 @@ public enum BillContentEnum { ...@@ -4,7 +4,8 @@ public enum BillContentEnum {
ZB("1", "装备", "equipment"), ZB("1", "装备", "equipment"),
CL("2", "车辆", "car"), CL("2", "车辆", "car"),
MHYJ("3", "灭火药剂", "extinguishing "), MHYJ("3", "灭火药剂", "extinguishing "),
RY("4", "人员", "people"); RY("4", "人员", "people"),
BPBJ("1", "备品备件", "spareEquipment");
private String name; private String name;
......
package com.yeejoin.equipmanage.common.enums;
public enum SingleEnum {
PLGL("批量管理", 0),
DXGL("单项管理", 1);
SingleEnum(String name, Integer key) {
this.name = name;
this.key = key;
}
private String name;
private Integer key;
public String getName() {
return name;
}
public Integer getKey() {
return key;
}
}
...@@ -2,6 +2,7 @@ package com.yeejoin.equipmanage.common.vo; ...@@ -2,6 +2,7 @@ package com.yeejoin.equipmanage.common.vo;
import com.yeejoin.equipmanage.common.entity.EquipmentDetail; import com.yeejoin.equipmanage.common.entity.EquipmentDetail;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecific; import com.yeejoin.equipmanage.common.entity.EquipmentSpecific;
import com.yeejoin.equipmanage.common.entity.WlSpareEquipment;
/** /**
* 消防设备 * 消防设备
...@@ -13,6 +14,16 @@ public class EquipmentDate { ...@@ -13,6 +14,16 @@ public class EquipmentDate {
private EquipmentDetail equipmentDetail; private EquipmentDetail equipmentDetail;
private WlSpareEquipment spareEquipment;
public WlSpareEquipment getSpareEquipment() {
return spareEquipment;
}
public void setSpareEquipment(WlSpareEquipment spareEquipment) {
this.spareEquipment = spareEquipment;
}
public EquipmentSpecific getEquipmentSpecific() { public EquipmentSpecific getEquipmentSpecific() {
return equipmentSpecific; return equipmentSpecific;
} }
......
...@@ -599,6 +599,18 @@ public class EquipmentController extends AbstractBaseController { ...@@ -599,6 +599,18 @@ public class EquipmentController extends AbstractBaseController {
return iEquipmentService.listByCategoryId(categoryId); return iEquipmentService.listByCategoryId(categoryId);
} }
/**
* 装备分类定义数据API【全量】
*
* @return
*/
@RequestMapping(value = "/equipList", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "装备分类定义数据API【全量】", notes = "装备分类定义数据API【全量】")
public List<Equipment> categoryList() {
return iEquipmentService.categoryList();
}
@RequestMapping(value = "/listLike/{code}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8") @RequestMapping(value = "/listLike/{code}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询") @ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
......
package com.yeejoin.equipmanage.controller; package com.yeejoin.equipmanage.controller;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...@@ -127,6 +128,9 @@ public class EquipmentDetailController extends AbstractBaseController { ...@@ -127,6 +128,9 @@ public class EquipmentDetailController extends AbstractBaseController {
@Value("${iot.code.prefix.have.used:20210003,20210004,20210005}") @Value("${iot.code.prefix.have.used:20210003,20210004,20210005}")
private String haveUsedIotPrefix; private String haveUsedIotPrefix;
@Autowired
private WlSpareEquipmentService wlSpareEquipmentService;
/** /**
* 新增 * 新增
* *
...@@ -190,6 +194,10 @@ public class EquipmentDetailController extends AbstractBaseController { ...@@ -190,6 +194,10 @@ public class EquipmentDetailController extends AbstractBaseController {
} }
EquipmentDetailController controllerProxy = SpringUtils.getBean(EquipmentDetailController.class); EquipmentDetailController controllerProxy = SpringUtils.getBean(EquipmentDetailController.class);
controllerProxy.refreshCount(vo.getBizOrgCode()); controllerProxy.refreshCount(vo.getBizOrgCode());
WlSpareEquipment spareEquipment = equipmentDate.getSpareEquipment();
if (ObjectUtil.isNotEmpty(spareEquipment) && ObjectUtil.isNotEmpty(spareEquipment.getId())) {
wlSpareEquipmentService.subtractNum(spareEquipment.getId(), Float.valueOf(vo.getNum()));
}
return date; return date;
} }
......
package com.yeejoin.equipmanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.equipmanage.common.entity.WlSpareEquipment;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
public interface WlSpareEquipmentMapper extends BaseMapper<WlSpareEquipment> {
Page<WlSpareEquipment> listByPage(@Param("page") Page page,
@Param("dto") WlSpareEquipment dto,
@Param("hierarchy") int hierarchy,
@Param("codeHead") String codeHead);
Map<String, Object> countSpareEquip(@Param("bizOrgCode") String bizOrgCode);
}
...@@ -128,4 +128,7 @@ public interface IEquipmentService extends IService<Equipment> { ...@@ -128,4 +128,7 @@ public interface IEquipmentService extends IService<Equipment> {
EquipmentVo getEquipBySpecific(Long equipmentSpecificId); EquipmentVo getEquipBySpecific(Long equipmentSpecificId);
List<Equipment> getAllByCode(String id); List<Equipment> getAllByCode(String id);
List<Equipment> categoryList();
} }
package com.yeejoin.equipmanage.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.equipmanage.common.entity.EquipmentCategory;
import com.yeejoin.equipmanage.common.entity.WlSpareEquipment;
import com.yeejoin.equipmanage.common.entity.vo.WlSpareEquipmentExportVo;
import com.yeejoin.equipmanage.common.vo.EquipmentDate;
import java.util.List;
import java.util.Map;
public interface WlSpareEquipmentService {
/**
* 新增/编辑
*/
WlSpareEquipment saveOrUpdateSpareEquipment(WlSpareEquipment wlSpareEquipment, ReginParams reginParams);
/**
* 删除
*/
int deleteByIds(List<Long> ids);
WlSpareEquipment getById(Long id);
Page<WlSpareEquipment> listByPage(WlSpareEquipment dto, Page page, int hierarchy, String codeHead);
void saveImportBatch(List<WlSpareEquipmentExportVo> list, ReginParams reginParams);
void subtractNum(Long id, Float num);
List<EquipmentCategory> getEquipmentTypeAndCount(String bizOrgCode);
Map<String, Object> countSpareEquip(String bizOrgCode);
}
...@@ -710,25 +710,23 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -710,25 +710,23 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
@Override @Override
public List<PointTreeVo> getBuildTreeNot(String bizOrgCode) { public List<PointTreeVo> getBuildTreeNot(String bizOrgCode) {
List<PointTreeVo> responses = this.baseMapper.getBuildList(bizOrgCode,null); List<PointTreeVo> responses = this.baseMapper.getBuildList(bizOrgCode, null);
List<PointTreeVo> treeList = new ArrayList<>(); Map<Long, PointTreeVo> nodeMap = responses.parallelStream().collect(Collectors.toMap(PointTreeVo::getSequenceNbr, t -> t));
List<PointTreeVo> treeList = responses.parallelStream()
.filter(node -> node.getParentId() == null || node.getParentId() == -1)
.map(node -> buildTree(node, nodeMap))
.collect(Collectors.toList());
return treeList;
}
for (PointTreeVo tree : responses) { private PointTreeVo buildTree(PointTreeVo node, Map<Long, PointTreeVo> nodeMap) {
if (tree.getParentId() == null || tree.getParentId() == -1) { if (node.getChildren() == null) {
treeList.add(tree); node.setChildren(new ArrayList<>());
}
for (PointTreeVo treeNode : responses) {
if (tree.getSequenceNbr().equals(treeNode.getParentId())) {
if (tree.getChildren() == null) {
tree.setChildren(new ArrayList<>());
}
tree.getChildren().add(treeNode);
}
}
} }
nodeMap.values().parallelStream()
.filter(childNode -> childNode.getParentId().equals(node.getSequenceNbr()))
return treeList; .forEach(childNode -> node.getChildren().add(buildTree(childNode, nodeMap)));
return node;
} }
@Override @Override
......
package com.yeejoin.equipmanage.service.impl; package com.yeejoin.equipmanage.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...@@ -18,6 +19,7 @@ import com.yeejoin.equipmanage.service.IEquipmentDetailService; ...@@ -18,6 +19,7 @@ import com.yeejoin.equipmanage.service.IEquipmentDetailService;
import com.yeejoin.equipmanage.service.IEquipmentIndexService; import com.yeejoin.equipmanage.service.IEquipmentIndexService;
import com.yeejoin.equipmanage.service.IEquipmentService; import com.yeejoin.equipmanage.service.IEquipmentService;
import com.yeejoin.equipmanage.service.IUnitService; import com.yeejoin.equipmanage.service.IUnitService;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -347,6 +349,41 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment ...@@ -347,6 +349,41 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
} }
@Override @Override
public List<Equipment> categoryList() {
List<Equipment> list = this.list();
Map<String, List<EquipmentIndex>> equipmentIndexMap = iEquipmentIndexService.list().stream()
.collect(Collectors.groupingBy(EquipmentIndex::getEquipmentId));
Map<Long, Unit> unitMap = iUnitService.list().stream().collect(Collectors.toMap(Unit::getId, t -> t));
Map<Long, EquipmentCategory> categoryMap = equipmentCategoryMapper.selectList(null).stream().collect(Collectors.toMap(EquipmentCategory::getId, t -> t));
for (Equipment equipment : list) {
List<EquipmentIndex> quotaList = equipmentIndexMap.get(equipment.getId().toString());
List<EquProperty> properList = new ArrayList<EquProperty>();
if (CollUtil.isNotEmpty(quotaList)) {
for (EquipmentIndex equipmentIndex : quotaList) {
EquProperty equProperty = new EquProperty();
equProperty.setEquipmentIndexId(equipmentIndex.getId());
equProperty.setPerfQuotaName(equipmentIndex.getPerfQuotaName());
equProperty.setEquipmentIndexName(equipmentIndex.getPerfQuotaName());
equProperty.setGroupName(equipmentIndex.getGroupName());
equProperty.setValue(equipmentIndex.getPerfValue());
equProperty.setUnitName(equipmentIndex.getUnitName());
equProperty.setEquipmentIndexKey(equipmentIndex.getPerfQuotaDefinitionId());
properList.add(equProperty);
}
}
EquipmentCategory equipmentCategory = categoryMap.get(equipment.getCategoryId());
if (ObjectUtils.isNotEmpty(equipmentCategory)) {
equipment.setEquipCategoryId(equipmentCategory.getId());
equipment.setEquipCategoryCode(equipmentCategory.getCode());
equipment.setEquipCategoryName(equipmentCategory.getName());
}
equipment.setEquPropertyList(properList);
equipment.setUnit(unitMap.get(equipment.getUnitId()));
}
return list;
}
@Override
public EquipmentAppVO getEquipmentAppMessage(String qrCode) { public EquipmentAppVO getEquipmentAppMessage(String qrCode) {
EquipmentAppVO equipmentApp = new EquipmentAppVO(); EquipmentAppVO equipmentApp = new EquipmentAppVO();
//设备信息参数 //设备信息参数
......
package com.yeejoin.equipmanage.service.impl; package com.yeejoin.equipmanage.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
...@@ -1010,11 +1011,31 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1010,11 +1011,31 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
} }
IPage<EquipTypeImgAmountVO> list = fireFightingSystemMapper IPage<EquipTypeImgAmountVO> list = fireFightingSystemMapper
.getColaCategoryAmountEquList(equipTypeAmountPage.getPage(), hierarchy, codeHead, equipTypeAmountPage); .getColaCategoryAmountEquList(equipTypeAmountPage.getPage(), hierarchy, codeHead, equipTypeAmountPage);
ArrayList<String> systemIds = new ArrayList<>();
list.getRecords().forEach(x -> { list.getRecords().forEach(x -> {
if (!x.getEqtype().startsWith("4") && StringUtil.isNotEmpty(x.getAmount())) { if (!x.getEqtype().startsWith("4") && StringUtil.isNotEmpty(x.getAmount())) {
x.setAmount(x.getAmount().split("\\.")[0]); x.setAmount(x.getAmount().split("\\.")[0]);
} }
if (StringUtil.isNotEmpty(x.getSystemId())) {
List<String> systemId = Arrays.asList(x.getSystemId().split(","));
systemIds.addAll(systemId);
}
}); });
if (CollUtil.isNotEmpty(systemIds)) {
LambdaQueryWrapper<FireFightingSystemEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.in(FireFightingSystemEntity::getId, systemIds);
List<FireFightingSystemEntity> fireSystemList = fireFightingSystemMapper.selectList(wrapper);
Map<String, String> systemNameMap = fireSystemList.stream().collect(Collectors.toMap(t -> t.getId().toString(), FireFightingSystemEntity::getName));
list.getRecords().parallelStream().forEach(item -> {
if (StringUtil.isNotEmpty(item.getSystemId())) {
ArrayList<String> systemNames = new ArrayList<>();
List<String> systemIdList = Arrays.asList(item.getSystemId().split(","));
systemIdList.parallelStream().forEach(id -> systemNames.add(systemNameMap.getOrDefault(id, "")));
String join = String.join(",", systemNames);
item.setSystemName(join);
}
});
}
return list; return list;
} }
......
...@@ -2101,7 +2101,7 @@ ...@@ -2101,7 +2101,7 @@
<select id="getColaCategoryAmountEquList" resultMap="CategoryAmountList"> <select id="getColaCategoryAmountEquList" resultMap="CategoryAmountList">
select * from (
SELECT SELECT
wles.id, wles.id,
wles.qr_code, wles.qr_code,
...@@ -2113,8 +2113,7 @@ ...@@ -2113,8 +2113,7 @@
concat_ws('-',wlws.full_name,wled.area) as full_name, concat_ws('-',wlws.full_name,wled.area) as full_name,
wlws.name as belongBuildName, wlws.name as belongBuildName,
wlun.NAME unitName, wlun.NAME unitName,
(SELECT GROUP_CONCAT(fem.name) FROM `f_fire_fighting_system` fem WHERE find_in_set(fem.id,wles.system_id)) wles.system_id as systemId,
as systemName,
wlsd.amount, wlsd.amount,
wlsd.id as stockDetailId, wlsd.id as stockDetailId,
'equipment' as type, 'equipment' as type,
...@@ -2195,13 +2194,12 @@ ...@@ -2195,13 +2194,12 @@
<if test="equipTypeAmountPage.iotCode!=null and equipTypeAmountPage.iotCode!=''"> <if test="equipTypeAmountPage.iotCode!=null and equipTypeAmountPage.iotCode!=''">
AND wles.iot_code LIKE CONCAT('%',#{equipTypeAmountPage.iotCode},'%') AND wles.iot_code LIKE CONCAT('%',#{equipTypeAmountPage.iotCode},'%')
</if> </if>
)s1 WHERE 1=1
<if test="equipTypeAmountPage.warehouseStructureName!=null and equipTypeAmountPage.warehouseStructureName!=''"> <if test="equipTypeAmountPage.warehouseStructureName!=null and equipTypeAmountPage.warehouseStructureName!=''">
AND s1.full_name LIKE CONCAT('%',#{equipTypeAmountPage.warehouseStructureName},'%') AND concat_ws('-',wlws.full_name,wled.area) LIKE CONCAT('%',#{equipTypeAmountPage.warehouseStructureName},'%')
</if> </if>
<if test="equipTypeAmountPage.bizOrgCode!=null and equipTypeAmountPage.bizOrgCode!=''"> <if test="equipTypeAmountPage.bizOrgCode!=null and equipTypeAmountPage.bizOrgCode!=''">
AND s1.bizOrgCode LIKE CONCAT(#{equipTypeAmountPage.bizOrgCode},'%') AND wles.biz_org_code LIKE CONCAT(#{equipTypeAmountPage.bizOrgCode},'%')
</if> </if>
order by createDate DESC order by createDate DESC
</select> </select>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.equipmanage.mapper.WlSpareEquipmentMapper">
<select id="listByPage" resultType="com.yeejoin.equipmanage.common.entity.WlSpareEquipment">
SELECT
*
FROM wl_spare_equipment
<where>
is_delete = 0
AND stock_num > 0
<if test="dto.bizOrgCode != null and dto.bizOrgCode != ''">
AND `biz_org_code` LIKE concat(#{dto.bizOrgCode}, '%')
</if>
<if test="dto.name != null and dto.name != ''">
AND `name` LIKE CONCAT('%', #{dto.name}, '%')
</if>
<if test="dto.code != null and dto.code != ''">
AND `equip_model_code` LIKE concat('%', #{dto.code}, '%')
</if>
<if test="codeHead != null and codeHead != ''">
AND LEFT (equip_model_code, #{hierarchy}) = #{codeHead}
</if>
<if test="dto.manufacturerId != null">
AND manufacturer_id = #{dto.manufacturerId}
</if>
<if test="dto.warehouseStructureId != null">
AND warehouse_structure_id = #{dto.warehouseStructureId}
</if>
</where>
ORDER BY create_date DESC
</select>
<select id="countSpareEquip" resultType="java.util.Map">
select
sum(stock_num) AS spareEquipNum
FROM
wl_spare_equipment
<where>
is_delete = 0
<if test="bizOrgCode != '' and bizOrgCode != null">
AND `biz_org_code` LIKE concat(#{bizOrgCode}, '%')
</if>
</where>
</select>
</mapper>
...@@ -40,33 +40,33 @@ public class KafkaConsumerService { ...@@ -40,33 +40,33 @@ public class KafkaConsumerService {
@Value("classpath:/json/commonMessage.json") @Value("classpath:/json/commonMessage.json")
private Resource commonMessage; private Resource commonMessage;
/** // /**
* 批量消费kafka消息 // * 批量消费kafka消息
* Kafka消息转emq // * Kafka消息转emq
* // *
* @param consumerRecords messages // * @param consumerRecords messages
* @param ack ack // * @param ack ack
*/ // */
@KafkaListener(id = "consumerSingle", groupId = "zhTestGroup", topics = "#{'${kafka.topics}'.split(',')}") // @KafkaListener(id = "consumerSingle", groupId = "zhTestGroup", topics = "#{'${kafka.topics}'.split(',')}")
public void listen1(List<ConsumerRecord<String, String>> consumerRecords, Acknowledgment ack) { // public void listen1(List<ConsumerRecord<String, String>> consumerRecords, Acknowledgment ack) {
try { // try {
for (ConsumerRecord<String, String> consumerRecord : consumerRecords) { // for (ConsumerRecord<String, String> consumerRecord : consumerRecords) {
Optional<?> kafkaMessage = Optional.ofNullable(consumerRecord.value()); // Optional<?> kafkaMessage = Optional.ofNullable(consumerRecord.value());
if (kafkaMessage.isPresent()) { // if (kafkaMessage.isPresent()) {
JSONObject messageObj = JSONObject.fromObject(kafkaMessage.get()); // JSONObject messageObj = JSONObject.fromObject(kafkaMessage.get());
if (messageObj.has(TOPIC)) { // if (messageObj.has(TOPIC)) {
emqKeeper.getMqttClient().publish(messageObj.optString(TOPIC), messageObj.getJSONObject(DATA).toString() // emqKeeper.getMqttClient().publish(messageObj.optString(TOPIC), messageObj.getJSONObject(DATA).toString()
.getBytes(StandardCharsets.UTF_8), 0, false); // .getBytes(StandardCharsets.UTF_8), 0, false);
} // }
log.info("kafka消费zhTestGroup消息{}", messageObj); // log.info("kafka消费zhTestGroup消息{}", messageObj);
} // }
} // }
} catch (Exception e) { // } catch (Exception e) {
log.error("kafka失败,当前失败的批次: data:{}, {}", consumerRecords, e); // log.error("kafka失败,当前失败的批次: data:{}, {}", consumerRecords, e);
} finally { // } finally {
ack.acknowledge(); // ack.acknowledge();
} // }
} // }
/** /**
* 批量消费kafka消息 * 批量消费kafka消息
...@@ -244,29 +244,29 @@ public class KafkaConsumerService { ...@@ -244,29 +244,29 @@ public class KafkaConsumerService {
// } // }
///** /**
// * 消费单条消息,topics 可以监听多个topic,如:topics = {"topic1", "topic2"} * 消费单条消息,topics 可以监听多个topic,如:topics = {"topic1", "topic2"}
// * *
// * @param message 消息 * @param message 消息
// */ */
//@KafkaListener(id = "consumerSingle", groupId = "zhTestGroup", topics = "#{'${kafka.topics}'.split(',')}", concurrency = "2") @KafkaListener(id = "consumerSingle", groupId = "${kafka.station.groupId}", topics = "#{'${kafka.topics}'.split(',')}", concurrency = "2")
//public void consumerSingle(String message, Acknowledgment ack) { public void consumerSingle(String message, Acknowledgment ack) {
// JSONObject messageObj = JSONObject.fromObject(message); JSONObject messageObj = JSONObject.fromObject(message);
// try { try {
// String topic = null; String topic = null;
// JSONObject data = null; JSONObject data = null;
// if (messageObj.has("topic")) { if (messageObj.has("topic")) {
// topic = messageObj.getString("topic"); topic = messageObj.getString("topic");
// data = messageObj.getJSONObject("data"); data = messageObj.getJSONObject("data");
// emqKeeper.getMqttClient().publish(topic, data.toString().getBytes(StandardCharsets.UTF_8), 0, false); emqKeeper.getMqttClient().publish(topic, data.toString().getBytes(StandardCharsets.UTF_8), 0, false);
// ack.acknowledge(); ack.acknowledge();
// log.info("消息转发成功" + messageObj); log.info("消息转发成功" + messageObj);
// } }
// } catch (Exception e) { } catch (Exception e) {
// log.error("消息转发失败" + e.getMessage(), e); log.error("消息转发失败" + e.getMessage(), e);
// } }
//} }
//
///** ///**
// * 省级消息转发 // * 省级消息转发
......
...@@ -114,3 +114,5 @@ kafka.auto-startup=false ...@@ -114,3 +114,5 @@ kafka.auto-startup=false
#浜嬩欢鍛婅瀵规帴Kafka涓婚 #浜嬩欢鍛婅瀵规帴Kafka涓婚
queue.kafka.eventAlarm.topics=JKXT2BP-GJ-Topic-site queue.kafka.eventAlarm.topics=JKXT2BP-GJ-Topic-site
kafka.station.groupId=shaoxing
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment