Commit a8cdcfa2 authored by litengwei's avatar litengwei

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

parents faf5991d 08880846
......@@ -447,30 +447,19 @@ public class DataDictionaryController extends BaseController {
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/job/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "按人员岗位类型统计", notes = "按人员岗位类型统计")
public ResponseModel<Object> getPeopleJobStatistic(HttpServletRequest request, String types) {
HashMap<Object, Object> objectObjectHashMap = new HashMap<>();
try {
String[] typest = types.split(",");
for (String type : typest) {
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num");
if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE_XIN + type)) {
Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE_XIN + type);
objectObjectHashMap.put(type, obj);
} else {
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
List<MenuFrom> menus = null;
menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getCode", 0, "getName",
"getParent", null);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE_XIN + type, JSON.toJSON(menus), time);
objectObjectHashMap.put(type, menus);
}
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常!");
public ResponseModel<Object> getPeopleJobStatistic(@RequestParam(value = "bizOrgCode") String bizOrgCode) {
// QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("type", type);
// queryWrapper.orderByAsc("sort_num");
List<Map<String, Object>> list = iDataDictionaryService.getJobList(bizOrgCode);
return ResponseHelper.buildResponse(list);
}
return ResponseHelper.buildResponse(objectObjectHashMap);
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/job/statistic")
@ApiOperation(httpMethod = "GET", value = "驻站消防员饼图", notes = "驻站消防员饼图")
public ResponseModel<List<Map<String,Object>>> getUserStatistic(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode){
List<Map<String,Object>> listMap = iDataDictionaryService.listUserJobStatistic(bizOrgCode);
return ResponseHelper.buildResponse(listMap);
}
}
......@@ -5,6 +5,7 @@ import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 数据字典 Mapper 接口
......@@ -38,5 +39,5 @@ public interface DataDictionaryMapper extends BaseMapper<DataDictionary> {
public List<DataDictionary> getFirefightersJobTitle(String type);
public List<Map<String, Object>> listUserJobStatistic(@Param("bizOrgCode") String bizOrgCode);
}
......@@ -53,6 +53,8 @@ public class DataDictionary extends BaseEntity {
@TableField(exist = false)
private String treeCode;
@ApiModelProperty(value = "数量")
@TableField(exist = false)
private String num;
}
......@@ -4,6 +4,7 @@ import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
import java.util.List;
import java.util.Map;
/**
* 数据字典 服务类
......@@ -25,4 +26,9 @@ public interface IDataDictionaryService {
public List<DataDictionary> getAllChildNodes(String type,Long parent) throws Exception;
List<DataDictionary> getChildList(String type, String group);
List<Map<String, Object>> getJobList(String bizOrgCode);
List<Map<String,Object>> listUserJobStatistic(String bizOrgCode);
}
......@@ -13,10 +13,12 @@ import com.yeejoin.amos.boot.biz.common.utils.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.Collection;
import java.util.List;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
* 数据字典 服务实现类
......@@ -169,4 +171,29 @@ public class DataDictionaryServiceImpl extends BaseService<DataDictionaryDto, Da
wrapper.eq(DataDictionary::getTypeDesc,group);
return this.list(wrapper);
}
@Override
public List<Map<String, Object>> getJobList(String bizOrgCode) {
List<Map<String, Object>> list = this.baseMapper.listUserJobStatistic(bizOrgCode);
return list;
}
@Override
public List<Map<String,Object>> listUserJobStatistic(String bizOrgCode) {
List<Map<String,Object>> listMap = this.baseMapper.listUserJobStatistic(bizOrgCode);
if (!CollectionUtils.isEmpty(listMap)) {
List<Integer> list = listMap.stream().map(x -> {
int i = Integer.valueOf(String.valueOf(x.get("num")));
return i;
}).collect(Collectors.toList());
int sum = list.stream().reduce(Integer::sum).orElse(0);
listMap.stream().map(x -> {
float percent = ((float) (Integer.valueOf(String.valueOf(x.get("num"))) * 100) / sum);
BigDecimal b = new BigDecimal(percent);
x.put("percent", b.setScale(2,BigDecimal.ROUND_HALF_UP).floatValue());
return x;
}).collect(Collectors.toList());
}
return listMap;
}
}
......@@ -125,4 +125,51 @@ WHERE
WHERE
cbb.is_delete = 0 and cbb.type = #{type}
</select>
<select id="listUserJobStatistic" resultType="java.util.Map">
SELECT
d.id,
b.`name`,
count(1) AS num
FROM
(
SELECT
fp.sequence_nbr AS id,
fp.job_title AS jobTitle,
fp.job_title_code AS jobCodes
FROM
(
SELECT
*
FROM
(
SELECT
ou.sequence_nbr,
ou.biz_org_type,
ou.biz_org_name,
IFNULL( MAX( CASE WHEN cfi.field_code = 'peopleType' THEN field_value END ), '' ) AS peopleType,
ou.is_delete
FROM
cb_org_usr ou
LEFT JOIN cb_dynamic_form_instance cfi ON ou.sequence_nbr = cfi.instance_id
WHERE
ou.is_delete = '0'
GROUP BY
ou.sequence_nbr
) c
WHERE
c.peopleType = '1601'
) a
LEFT JOIN cb_firefighters_post fp ON a.sequence_nbr = fp.org_usr_id
WHERE
a.biz_org_name IS NOT NULL
AND a.is_delete = 0
AND a.biz_org_type = 'PERSON'
) d
LEFT JOIN ( SELECT `name`, `code` FROM cb_data_dictionary WHERE type = 'GWMC' ) b ON LOCATE( b.CODE, d.jobCodes ) != 0
WHERE
b.`name` IS NOT NULL
GROUP BY b.`code`
ORDER BY b.`code`
</select>
</mapper>
......@@ -35,7 +35,7 @@ public interface EquipFeignClient {
* @return
*/
@RequestMapping(value = "/stock-detail/airport/person/bind", method = RequestMethod.POST)
ResponseModel<List<Object>> stockBindEquip(@RequestBody List<Long> ids) throws InnerInvokException;
ResponseModel<List<Object>> stockBindEquip(@RequestBody List<Map<String, Number>> stocks) throws InnerInvokException;
/**
* 人员装备退装
......@@ -43,7 +43,7 @@ public interface EquipFeignClient {
* @return
*/
@RequestMapping(value = "/scrap/airport/person", method = RequestMethod.POST)
ResponseModel<Object> scrapEquip(@RequestBody String id) throws InnerInvokException;
ResponseModel<Object> scrapEquip(@RequestBody Map<String, Object> map) throws InnerInvokException;
/**
* 人员装备回库
......
......@@ -3,6 +3,9 @@ package com.yeejoin.amos.boot.module.common.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.common.api.entity.FirefightersJacket;
import java.util.List;
import java.util.Map;
/**
* 消防人员配装记录 Mapper 接口
*
......@@ -11,4 +14,6 @@ import com.yeejoin.amos.boot.module.common.api.entity.FirefightersJacket;
*/
public interface FirefightersJacketMapper extends BaseMapper<FirefightersJacket> {
List<Map<String, Object>> getPersonEquipCount();
}
......@@ -163,4 +163,10 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
Map<String, Object> getPersonType(@Param("typeCode") String typeCode);
List<Map<String, Object>> reportResult(String startTime, String endTime, String bizOrgCode);
List<Map<String, Object>> getManagePersonList(@Param("bizOrgCode") String bizOrgCode);
int getManagePersonCount(@Param("map") Map<String, Object> map);
List<Map<String, Object>> getManagePersonPage(@Param("map") Map<String, Object> map);
}
......@@ -404,4 +404,8 @@ public interface IOrgUsrService {
String reportResult(String startTime, String endTime, String bizOrgCode);
List<Map<String, Object>> getManagePersonList(String bizOrgCode);
IPage<Map<String, Object>> getManagePersonPage(String pageNum, String pageSize, String bizOrgCode, String code, String personStatus);
}
<?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.amos.boot.module.common.api.mapper.FirefightersJacketMapper">
<select id="getPersonEquipCount" resultType="java.util.Map">
SELECT
equipment_type_name AS name,
SUM(amount) AS value,
'个' AS unnit
FROM
jc_firefighters_jacket
WHERE
is_delete = 0
GROUP BY
equipment_type_name
</select>
</mapper>
......@@ -1482,4 +1482,191 @@
) AS a
GROUP BY parentId
</select>
<select id="getManagePersonList" resultType="Map">
SELECT
postName AS `name`,
count( postName ) AS `value`,
'人' AS unit,
`code`
FROM
(
SELECT
a.*,
b.NAME AS postName,
b.`code`
FROM
(
SELECT DISTINCT
u.sequence_nbr sequenceNbr,
g.*
FROM
cb_org_usr u
LEFT JOIN (
SELECT
v.`instance_id`,
max( CASE v.field_code WHEN 'fireManagementPostCode' THEN IFNULL( v.field_value_label, v.field_value ) END ) fireManagementPostCode,
max( CASE v.field_code WHEN 'fireManagementPostCode' THEN v.field_value END ) fireManagementPost,
max( CASE v.field_code WHEN 'fireManagementPostCode' THEN v.field_value_label END ) fireManagementPostName,
max( CASE v.field_code WHEN 'positionType' THEN IFNULL( v.field_value, v.field_value_label ) END ) positionType,
max( CASE v.field_code WHEN 'positionType' THEN v.field_value_label END ) positionTypeName,
max( CASE v.field_code WHEN 'peopleType' THEN v.field_value END ) peopleType
FROM
`cb_dynamic_form_instance` v
WHERE
v.group_code = 246
GROUP BY
v.`instance_id`
) g ON u.sequence_nbr = g.instance_id
WHERE
u.biz_org_type = 'person'
AND g.peopleType IN ('1601', '1602', '1603', '1604')
AND u.is_delete = 0
<if test="bizOrgCode != null and bizOrgCode != ''">
AND u.biz_org_code LIKE CONCAT(#{bizOrgCode}, '%')
</if>
GROUP BY
u.sequence_nbr,
u.biz_org_name,
u.biz_org_code
ORDER BY
u.rec_date DESC
) a
LEFT JOIN ( SELECT * FROM cb_data_dictionary WHERE type = 'XFGLGW' ) b ON LOCATE( b.CODE, a.fireManagementPost ) != 0
WHERE
a.sequenceNbr IS NOT NULL AND b.`name` IS NOT NULL
GROUP BY
sequenceNbr
) a
GROUP BY
postName
</select>
<select id="getManagePersonCount" resultType="integer">
SELECT
count(1)
FROM(
SELECT
a.sequenceNbr,
a.bizOrgName,
a.`name`,
a.fireManagementPostName,
a.personStatus
FROM
(
SELECT DISTINCT
u.sequence_nbr AS sequenceNbr,
u.person_status AS personStatus,
cf.biz_org_Name AS bizOrgName,
cf.`name` AS `name`,
g.*
FROM
cb_org_usr u
LEFT JOIN cb_firefighters cf ON cf.org_usr_id = u.sequence_nbr
LEFT JOIN (
SELECT
v.`instance_id`,
max( CASE v.field_code WHEN 'fireManagementPostCode' THEN IFNULL( v.field_value_label, v.field_value ) END ) fireManagementPostCode,
max( CASE v.field_code WHEN 'fireManagementPostCode' THEN v.field_value END ) fireManagementPost,
max( CASE v.field_code WHEN 'fireManagementPostCode' THEN v.field_value_label END ) fireManagementPostName,
max( CASE v.field_code WHEN 'positionType' THEN IFNULL( v.field_value, v.field_value_label ) END ) positionType,
max( CASE v.field_code WHEN 'positionType' THEN v.field_value_label END ) positionTypeName,
max( CASE v.field_code WHEN 'peopleType' THEN v.field_value END ) peopleType
FROM
`cb_dynamic_form_instance` v
WHERE
v.group_code = 246
GROUP BY
v.`instance_id`
) g ON u.sequence_nbr = g.instance_id
WHERE
u.biz_org_type = 'person'
AND g.peopleType IN ('1601', '1602', '1603')
AND u.is_delete = 0
<if test="map.bizOrgCode != null and map.bizOrgCode != ''">
AND u.biz_org_code LIKE CONCAT(#{map.bizOrgCode}, '%')
</if>
GROUP BY
u.sequence_nbr,
u.biz_org_name,
u.biz_org_code
ORDER BY
u.rec_date DESC
) a
LEFT JOIN ( SELECT * FROM cb_data_dictionary WHERE type = 'XFGLGW' ) b ON LOCATE( b.CODE, a.fireManagementPost ) != 0
WHERE
a.sequenceNbr IS NOT NULL AND b.`name` IS NOT NULL
<if test="map.code != null and map.code != ''">
AND FIND_IN_SET(#{map.code},a.fireManagementPost) > 0
</if>
<if test="map.personStatus != null and map.personStatus != ''">
AND a.personStatus = #{map.personStatus}
</if>
GROUP BY
a.sequenceNbr ) c
</select>
<select id="getManagePersonPage" resultType="Map">
SELECT
a.sequenceNbr,
a.bizOrgName,
a.`name`,
a.fireManagementPostName,
a.personStatus
FROM
(
SELECT DISTINCT
u.sequence_nbr AS sequenceNbr,
u.person_status AS personStatus,
cf.biz_org_Name AS bizOrgName,
cf.`name` AS `name`,
g.*
FROM
cb_org_usr u
LEFT JOIN cb_firefighters cf ON cf.org_usr_id = u.sequence_nbr
LEFT JOIN (
SELECT
v.`instance_id`,
max( CASE v.field_code WHEN 'fireManagementPostCode' THEN IFNULL( v.field_value_label, v.field_value ) END ) fireManagementPostCode,
max( CASE v.field_code WHEN 'fireManagementPostCode' THEN v.field_value END ) fireManagementPost,
max( CASE v.field_code WHEN 'fireManagementPostCode' THEN v.field_value_label END ) fireManagementPostName,
max( CASE v.field_code WHEN 'positionType' THEN IFNULL( v.field_value, v.field_value_label ) END ) positionType,
max( CASE v.field_code WHEN 'positionType' THEN v.field_value_label END ) positionTypeName,
max( CASE v.field_code WHEN 'peopleType' THEN v.field_value END ) peopleType
FROM
`cb_dynamic_form_instance` v
WHERE
v.group_code = 246
GROUP BY
v.`instance_id`
) g ON u.sequence_nbr = g.instance_id
WHERE
u.biz_org_type = 'person'
AND g.peopleType IN ('1601', '1602', '1603')
AND u.is_delete = 0
AND cf.biz_org_name is not null
<if test="map.bizOrgCode != null and map.bizOrgCode != ''">
AND u.biz_org_code LIKE CONCAT(#{map.bizOrgCode}, '%')
</if>
GROUP BY
u.sequence_nbr,
u.biz_org_name,
u.biz_org_code
ORDER BY
u.rec_date DESC
) a
LEFT JOIN ( SELECT * FROM cb_data_dictionary WHERE type = 'XFGLGW' ) b ON LOCATE( b.CODE, a.fireManagementPost ) != 0
WHERE
a.sequenceNbr IS NOT NULL AND b.`name` IS NOT NULL
<if test="map.code != null and map.code != ''">
AND FIND_IN_SET(#{map.code},a.fireManagementPost) > 0
</if>
<if test="map.personStatus != null and map.personStatus != ''">
AND a.personStatus = #{map.personStatus}
</if>
GROUP BY
a.sequenceNbr
ORDER BY a.personStatus DESC
LIMIT #{map.pageNum}, #{map.pageSize}
</select>
</mapper>
package com.yeejoin.equipmanage.common.dto;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemGroupEntity;
import com.yeejoin.equipmanage.common.entity.publics.BaseDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.List;
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
public class FireFightingSystemGroupDto extends BaseDTO<FireFightingSystemGroupEntity> {
@ApiModelProperty(value = "分组名称")
private String groupName;
@ApiModelProperty(value = "分组编码")
private String groupCode;
@ApiModelProperty(value = "展示类型:0-系统部件 1-安措")
private Integer showType;
@ApiModelProperty(value = "系统ID")
private String systemIds;
@ApiModelProperty(value = "备注")
private String remarks;
@ApiModelProperty(value = "分组排序")
private Integer sort;
@ApiModelProperty(value = "业务组织编码")
private String bizOrgCode;
@ApiModelProperty(value = "业务组织名称")
private String bizOrgName;
@ApiModelProperty(value = "系统与系统部件")
private List<SystemEquipmentRelationDto> systemEquipmentRelations;
}
package com.yeejoin.equipmanage.common.dto;
import com.yeejoin.equipmanage.common.entity.SystemEquipmentRelationEntity;
import com.yeejoin.equipmanage.common.entity.publics.BaseDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
public class SystemEquipmentRelationDto extends BaseDTO<SystemEquipmentRelationEntity> {
@ApiModelProperty(value = "系统ID")
private Long systemId;
@ApiModelProperty(value = "分组编码")
private Long equipmentId;
@ApiModelProperty(value = "类型(0:系统部件、1:安措)")
private Integer type;
@ApiModelProperty(value = "部件排序")
private Integer sort;
}
......@@ -240,4 +240,17 @@ public class Car extends BaseEntity {
@TableField(exist = false)
private Double monthTravel;
@TableField(exist = false)
private Integer pageNum;
@TableField(exist = false)
private Integer pageSize;
@TableField(exist = false)
private String equipStatusFilter;
@ApiModelProperty(value = "使用方式")
private String useType;
}
......@@ -110,4 +110,13 @@ public class Equipment extends BaseEntity {
*/
@TableField(value = "clean_type")
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
public int compareTo(EquipmentCategory o) {
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.TableName;
import com.yeejoin.equipmanage.common.entity.publics.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@Data
@Builder
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@TableName("f_fire_fighting_system_group")
@ApiModel(value = "f_fire_fighting_system_group", description = "消防系统分组")
public class FireFightingSystemGroupEntity extends BaseEntity {
@ApiModelProperty(value = "分组名称")
private String groupName;
@ApiModelProperty(value = "分组编码")
private String groupCode;
@ApiModelProperty(value = "展示类型:0-系统部件 1-安措")
private Integer displayType;
@ApiModelProperty(value = "系统ID")
private String systemIds;
@ApiModelProperty(value = "备注")
private String remarks;
@ApiModelProperty(value = "分组排序")
private Integer sort;
@ApiModelProperty(value = "业务组织编码")
private String bizOrgCode;
@ApiModelProperty(value = "业务组织名称")
private String bizOrgName;
}
package com.yeejoin.equipmanage.common.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.equipmanage.common.entity.publics.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@Data
@Builder
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@TableName("f_system_equipment_relation")
@ApiModel(value = "f_system_equipment_relation", description = "消防系统部件关系")
public class SystemEquipmentRelationEntity extends BaseEntity {
@ApiModelProperty(value = "系统ID")
private Long systemId;
@ApiModelProperty(value = "分组编码")
private Long equipmentId;
@ApiModelProperty(value = "类型(0:系统部件、1:安措)")
private Integer type;
@ApiModelProperty(value = "部件排序")
private Integer sort;
}
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筛选字段
}
package com.yeejoin.equipmanage.common.entity.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class CoreEquipmentsDto {
@ApiModelProperty(value = "装备ID")
private String id;
@ApiModelProperty(value = "装备名称")
private String name;
@ApiModelProperty(value = "装备排序")
private Integer sort;
@ApiModelProperty(value = "所属类型")
private Integer type;
}
package com.yeejoin.equipmanage.common.entity.dto;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemGroupEntity;
import com.yeejoin.equipmanage.common.entity.publics.BaseDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.List;
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
public class FireFightingSystemGroupModalDto extends BaseDTO<FireFightingSystemGroupEntity> {
@ApiModelProperty(value = "分组名称")
private String groupName;
@ApiModelProperty(value = "展示类型:0-安措 1-保护区域")
private Integer displayType;
@ApiModelProperty(value = "分组排序")
private Integer sort;
@ApiModelProperty(value = "系统装备列表")
private List<SystemEquipmentsDto> systems;
@ApiModelProperty(value = "业务组织编码")
private String bizOrgCode;
@ApiModelProperty(value = "业务组织名称")
private String bizOrgName;
}
package com.yeejoin.equipmanage.common.entity.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
@Data
@Accessors(chain = true)
public class SystemEquipmentsDto {
@ApiModelProperty(value = "系统ID")
private String id;
@ApiModelProperty(value = "系统名称")
private String name;
@ApiModelProperty(value = "系统排序")
private Integer sort;
@ApiModelProperty(value = "装备列表")
private List<CoreEquipmentsDto> equipments;
}
......@@ -22,4 +22,6 @@ public class EquipCountBySystemVO {
private Integer equipmentNum;
@ApiModelProperty(value = "单位")
private String unitName;
@ApiModelProperty(value = "图标")
private String img;
}
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 org.springframework.format.annotation.DateTimeFormat;
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)
private String productionDate; // 生产日期
@Excel(name = "采购日期")
@ExcelProperty(value = "采购日期", index = 11)
private String purchaseDate; // 采购日期
@Excel(name = "备注")
@ExcelProperty(value = "备注", index = 12)
private String remark; // 备注
}
......@@ -4,7 +4,8 @@ public enum BillContentEnum {
ZB("1", "装备", "equipment"),
CL("2", "车辆", "car"),
MHYJ("3", "灭火药剂", "extinguishing "),
RY("4", "人员", "people");
RY("4", "人员", "people"),
BPBJ("1", "备品备件", "spareEquipment");
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;
}
}
package com.yeejoin.equipmanage.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Objects;
@Getter
@AllArgsConstructor
public enum SystemGroupShowTypeEnum {
SYSTEM_EQUIPMENT(0, "系统部件"),
SECURITY_MEASURE(1, "安措");
private final Integer code;
private final String value;
public static SystemGroupShowTypeEnum getEnumByCode(Integer code) {
SystemGroupShowTypeEnum aEnum = null;
for (SystemGroupShowTypeEnum item : SystemGroupShowTypeEnum.values()) {
if (Objects.equals(item.getCode(), code)) {
aEnum = item;
break;
}
}
return aEnum;
}
}
......@@ -2,6 +2,7 @@ package com.yeejoin.equipmanage.common.vo;
import com.yeejoin.equipmanage.common.entity.EquipmentDetail;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecific;
import com.yeejoin.equipmanage.common.entity.WlSpareEquipment;
/**
* 消防设备
......@@ -13,6 +14,16 @@ public class EquipmentDate {
private EquipmentDetail equipmentDetail;
private WlSpareEquipment spareEquipment;
public WlSpareEquipment getSpareEquipment() {
return spareEquipment;
}
public void setSpareEquipment(WlSpareEquipment spareEquipment) {
this.spareEquipment = spareEquipment;
}
public EquipmentSpecific getEquipmentSpecific() {
return equipmentSpecific;
}
......
......@@ -13,7 +13,7 @@ public enum EquipTypeEnum {
/**
* 退库,回库
*/
退装("scrap", "退装"),
报废("scrap", "报废"),
回库("stock", "回库");
private String key;
......
......@@ -7,6 +7,7 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.EquipmentOnCarDto;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
import java.util.Map;
/**
* 消防人员配装记录 服务类
......@@ -16,6 +17,8 @@ import java.util.List;
*/
public interface IFirefightersJacketService {
List<Map<String, Object>> getPersonEquipCount();
ResponseModel<Page<Object>> getAirEquipSpecificPage(EquipSpecificDto equipSpecificDto, int current, int size);
boolean saveOrUpdateBatch(Long firefightersId, List<EquipmentOnCarDto> equipmentOnCarDtos);
......
......@@ -583,4 +583,29 @@ public class OrgPersonController extends BaseController {
public ResponseModel getPersonImage(@PathVariable String id) {
return ResponseHelper.buildResponse(iOrgUsrService.getPersonImg(id));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/manage/statistic", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "设备平台管理人员统计", notes = "设备平台管理人员统计")
public ResponseModel getManagePersonList() {
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = reginParams.getPersonIdentity().getCompanyBizOrgCode();
return ResponseHelper.buildResponse(iOrgUsrService.getManagePersonList(bizOrgCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/manage/page", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "设备平台管理人员分页列表", notes = "设备平台管理人员分页列表")
public ResponseModel<Object> getManagePersonPage(@RequestParam(value = "code") String code,
@RequestParam(value = "personStatus") String personStatus,
@RequestParam(value = "bizOrgCode") String bizOrgCode,
@RequestParam(value = "pageNum") String pageNum,
@RequestParam(value = "pageSize") String pageSize) {
if (StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = reginParams.getPersonIdentity().getCompanyBizOrgCode();
}
IPage<Map<String, Object>> mapIPage = iOrgUsrService.getManagePersonPage(bizOrgCode, code, personStatus, pageNum, pageSize);
return ResponseHelper.buildResponse(mapIPage);
}
}
......@@ -821,6 +821,32 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return orgUsr.getPersonImg();
}
@Override
public List<Map<String, Object>> getManagePersonList(String bizOrgCode) {
return this.baseMapper.getManagePersonList(bizOrgCode);
}
@Override
public IPage<Map<String, Object>> getManagePersonPage(String bizOrgCode, String code, String personStatus, String pageNum, String pageSize) {
Map<String, Object> map = new HashMap<>();
map.put("bizOrgCode", bizOrgCode);
map.put("code", code);
map.put("personStatus", personStatus);
IPage<Map<String, Object>> pageBean = null;
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE);
} else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
pageBean.setTotal(orgUsrMapper.getManagePersonCount(map));
map.put("pageNum", (pageBean.getCurrent() - 1) * pageBean.getSize());
map.put("pageSize", pageBean.getSize());
List<Map<String, Object>> list = orgUsrMapper.getManagePersonPage(map);
pageBean.setRecords(list);
return pageBean;
}
public List<FormValue> getFormValueDetail(Long id) throws Exception {
// 动态表单数据
List<DynamicFormInstanceDto> list = alertFormValueServiceImpl.listByCalledId(id);
......
......@@ -1585,4 +1585,33 @@ public class CarController extends AbstractBaseController {
}
return iCarService.getBizOrgName(orgCode);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/tankAndFireCar/statistic", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "车辆统计-获取归属单位下拉框值", notes = "车辆统计-获取归属单位下拉框值")
public List<Map<String, String>> getTankAndFireCarNum() {
ReginParams reginParams = JSONObject.parseObject(redisUtils
.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(),
ReginParams.class);
String code = null;
if (reginParams != null && reginParams.getCompany() !=null && !ObjectUtils.isEmpty(reginParams.getCompany().getOrgCode())) {
code = reginParams.getPersonIdentity().getBizOrgCode();
}
return iCarService.getTankAndFireCarNum(code);
}
/**
* 卡片列表分页查询API
*
* @return
*/
@RequestMapping(value = "/carListByPage", method = RequestMethod.POST)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "卡片列表分页查询API", notes = "卡片列表分页查询API")
public Page<Map<String, String>> carListByPage(@RequestBody Car car) {
Page<Map<String, String>> carListByPage = iCarService.carListByPage(car, new Page<>(car.getPageNum(), car.getPageSize()));
return carListByPage;
}
}
......@@ -599,6 +599,18 @@ public class EquipmentController extends AbstractBaseController {
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")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
......
package com.yeejoin.equipmanage.controller;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......@@ -128,6 +129,9 @@ public class EquipmentDetailController extends AbstractBaseController {
@Value("${iot.code.prefix.have.used:20210003,20210004,20210005}")
private String haveUsedIotPrefix;
@Autowired
private WlSpareEquipmentService wlSpareEquipmentService;
/**
* 新增
*
......@@ -191,6 +195,10 @@ public class EquipmentDetailController extends AbstractBaseController {
}
EquipmentDetailController controllerProxy = SpringUtils.getBean(EquipmentDetailController.class);
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;
}
......
package com.yeejoin.equipmanage.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.equipmanage.common.dto.EquipmentSpecificDto;
import com.yeejoin.equipmanage.common.entity.EquipQrcodeRecord;
import com.yeejoin.equipmanage.common.entity.Equipment;
import com.yeejoin.equipmanage.common.entity.EquipmentDetail;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecific;
import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.dto.EquipmentSpecificDTO;
import com.yeejoin.equipmanage.common.entity.dto.SourceNameListDTO;
import com.yeejoin.equipmanage.common.entity.vo.ComplementCodeVO;
......@@ -37,6 +37,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -81,6 +82,9 @@ public class EquipmentSpecificController extends AbstractBaseController {
@Autowired
IotFeign iotFeign;
@Autowired
private RedisUtils redisUtils;
/**
* 补码页面分页
*
......@@ -263,6 +267,9 @@ public class EquipmentSpecificController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "列表分页查询", notes = "列表分页查询")
public IPage<EquipmentOnCarVo> onCarVoIPage(@RequestBody EquipmentSpecificDto equipmentSpecificDto) {
ReginParams ReginParams = getSelectedOrgInfo();
String bizOrgCode= ReginParams.getPersonIdentity().getBizOrgCode();
equipmentSpecificDto.setBizOrgCode(bizOrgCode);
return equipmentSpecificSerivce.onCarVoIPage(equipmentSpecificDto);
}
......@@ -603,4 +610,43 @@ public class EquipmentSpecificController extends AbstractBaseController {
return list;
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/fire/equip/statistic")
@ApiOperation(httpMethod = "GET", value = "根据装备分类code获取装备list", notes = "根据装备分类code获取装备list")
public List<Map<String, Object>> getFireEquipStatistic(){
ReginParams reginParams = JSONObject.parseObject(redisUtils
.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(),
ReginParams.class);
String bizOrgCode = null;
if (reginParams != null && reginParams.getCompany() !=null && !org.apache.commons.lang3.ObjectUtils.isEmpty(reginParams.getCompany().getOrgCode())) {
bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
}
return equipmentSpecificMapper.getFireEquipStatistic(bizOrgCode);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/fire/equip/list")
@ApiOperation(httpMethod = "GET", value = "根据装备分类code获取装备list", notes = "根据装备分类code获取装备list")
public IPage<Map<String, Object>> getFireEquipListByDefineCode(@RequestParam(value = "code") String code,
@RequestParam(value = "equipStatus") String equipStatus,
@RequestParam(value = "bizOrgCode") String bizOrgCode,
@RequestParam(value = "pageNum") String pageNum,
@RequestParam(value = "pageSize") String pageSize){
if (StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = JSONObject.parseObject(redisUtils
.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(),
ReginParams.class);
if (reginParams != null && reginParams.getCompany() !=null && !org.apache.commons.lang3.ObjectUtils.isEmpty(reginParams.getCompany().getOrgCode())) {
bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
}
}
Page<Map<String, Object>> pageBean;
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE);
} else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
return equipmentSpecificSerivce.getFireEquipListByDefineCode(code, equipStatus, bizOrgCode, pageBean);
}
}
package com.yeejoin.equipmanage.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
......@@ -132,6 +134,16 @@ public class FireFightingSystemController extends AbstractBaseController {
return fireFightingSystemService.getEquipCountBySystemId(systemId);
}
@RequestMapping(value = "/getEquipCountPageBySystemId", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("根据系统id查询分组设备数量")
public Page<EquipCountBySystemVO> getEquipCountPageBySystemId(@RequestParam("systemId") Long systemId,
@RequestParam(value = "pageNumber", required = false) Integer pageNumber,
@RequestParam(value = "pageSize", required = false) Integer pageSize
) {
return fireFightingSystemService.getEquipCountPageBySystemId(systemId, pageNumber, pageSize);
}
@RequestMapping(value = "/getOneById", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("通过id查询消防系统信息")
......@@ -855,6 +867,24 @@ public class FireFightingSystemController extends AbstractBaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "消防系统列表查询(不分页)", notes = "下拉使用")
@GetMapping(value = "/systems")
public List<FireFightingSystemEntity> systems(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode) {
if (StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
}
}
Wrapper<FireFightingSystemEntity> wrapper = Wrappers.<FireFightingSystemEntity>lambdaQuery()
.likeRight(FireFightingSystemEntity::getBizOrgCode, bizOrgCode)
.isNotNull(FireFightingSystemEntity::getName)
.isNotNull(FireFightingSystemEntity::getSystemType);
return fireFightingSystemService.list(wrapper);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "消防系统树和消防建筑树", notes = "树菜单")
@GetMapping(value = "/getBuildingTreeAndSystemTree")
public Map<String, List> getBuildingTreeAndSystemTree(RequestBaseDto dto) {
......
package com.yeejoin.equipmanage.controller;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemEntity;
import com.yeejoin.equipmanage.common.entity.dto.FireFightingSystemGroupModalDto;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.service.FireFightingSystemGroupService;
import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@Slf4j
@RestController
@Api(tags = "消防系统分组")
@RequestMapping(value = "/fire-fighting-system-group")
public class FireFightingSystemGroupController extends BaseController {
@Autowired
private FireFightingSystemGroupService fireFightingSystemGroupService;
@ApiOperation(value = "消防系统列表查询(未绑定分组的系统)", notes = "下拉使用")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/systems")
public ResponseModel systems(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode) {
if (StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
}
}
return CommonResponseUtil.success(fireFightingSystemGroupService.selectUnboundSystems(bizOrgCode));
}
@RequestMapping(value = "/save-or-update", method = {RequestMethod.PUT, RequestMethod.POST})
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "PUT", value = "添加/更新分组", notes = "添加/更新分组")
public ResponseModel save(@RequestBody FireFightingSystemGroupModalDto dto) {
if (!(Objects.nonNull(dto.getGroupName()) && Objects.nonNull(dto.getDisplayType()) && Objects.nonNull(dto.getSystems()))) {
return CommonResponseUtil.failure("非法参数");
}
ReginParams reginParams = getSelectedOrgInfo();
dto.setBizOrgCode(reginParams.getPersonIdentity().getCompanyBizOrgCode());
dto.setBizOrgName(reginParams.getPersonIdentity().getCompanyName());
return CommonResponseUtil.success(fireFightingSystemGroupService.saveOrUpdate(dto));
}
@PutMapping(value = "/update-group-sort")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "PUT", value = "更新分组展示顺序", notes = "更新分组展示顺序")
public ResponseModel updateGroupSort(@RequestParam("groupIds") String groupIds) {
if (Objects.isNull(groupIds) || groupIds.isEmpty()) {
return CommonResponseUtil.failure("非法参数");
}
List<Long> ids = Arrays.stream(groupIds.split(",")).map(Long::valueOf).mapToLong(Long::longValue).boxed().collect(Collectors.toList());
fireFightingSystemGroupService.updateGroupSort(ids);
return CommonResponseUtil.success();
}
@PostMapping(value = "/update-system-sort/{groupId}")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "更新系统展示顺序", notes = "更新系统展示顺序")
public ResponseModel updateSystemSort(@PathVariable Long groupId, @RequestBody List<Long> systemIds) {
if (Objects.isNull(systemIds) || systemIds.isEmpty()) {
return CommonResponseUtil.failure("非法参数");
}
fireFightingSystemGroupService.updateSystemSort(groupId, systemIds);
return CommonResponseUtil.success();
}
@GetMapping(value = "/list")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询分组列表", notes = "查询分组列表")
public ResponseModel list(@RequestParam(required = false) String bizOrgCode) {
if (StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = reginParams.getPersonIdentity().getCompanyBizOrgCode();
}
return CommonResponseUtil.success(fireFightingSystemGroupService.listGroup(bizOrgCode));
}
@DeleteMapping(value = "/{id}")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "DELETE", value = "删除分组", notes = "删除分组")
public ResponseModel deteleGroup(@PathVariable("id") Long id) {
fireFightingSystemGroupService.deleteGroup(id);
return CommonResponseUtil.success();
}
}
......@@ -27,6 +27,7 @@ import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
*
......@@ -222,9 +223,9 @@ public class ScrapController extends AbstractBaseController {
@RequestMapping(value = "/airport/person", method = RequestMethod.POST)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "机场人员装备退装接口", notes = "人员装备报废", produces = "application/json;charset=UTF-8")
public ResponseModel scrapOnPerson(@RequestBody String id) {
public ResponseModel scrapOnPerson(@RequestBody Map<String, Object> map) {
try {
iScrapService.scrapOnPerson(Long.valueOf(id));
iScrapService.scrapOnPerson(map, getUserInfo());
} catch (Exception e) {
return CommonResponseUtil.failure("人员装备报废失败!");
}
......
......@@ -215,10 +215,10 @@ public class StockDetailController {
@RequestMapping(value = "/airport/person/bind", method = RequestMethod.POST)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "人员装备列装接口", notes = "人员装备列装", produces = "application/json;charset=UTF-8")
public ResponseModel loadOnPerson(@RequestBody List<String> ids) {
public ResponseModel loadOnPerson(@RequestBody List<Map<String, Number>> stocks) {
List<StockDetail> stockDetails = null;
if (0 < ids.size()) {
stockDetails = iStockDetailService.loadOnPerson(ids);
if (!stocks.isEmpty()) {
stockDetails = iStockDetailService.loadOnPerson(stocks);
}
return CommonResponseUtil.success(stockDetails);
}
......
package com.yeejoin.equipmanage.controller;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil;
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.enums.SingleEnum;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.mapper.WlSpareEquipmentMapper;
import com.yeejoin.equipmanage.service.IEquipmentCategoryService;
import com.yeejoin.equipmanage.service.WlSpareEquipmentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ClassPathResource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.util.UriUtils;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@Api(tags = "设备平台备品备件管理api")
@RequestMapping(value = "/wl-spare-equipment", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class WlSpareEquipmentController extends BaseController {
@Autowired
WlSpareEquipmentService wlSpareEquipmentService;
@Autowired
WlSpareEquipmentMapper wlSpareEquipmentMapper;
@Autowired
IEquipmentCategoryService equipmentCategoryService;
@Value("${equipment.hierarchy}")
private String hierarchy;
@RequestMapping(value = "/saveOrUpdateSpareEquipment", method = RequestMethod.POST)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "新增/编辑", notes = "新增/编辑")
public ResponseModel<WlSpareEquipment> saveOrUpdateSpareEquipment(@RequestBody WlSpareEquipment wlSpareEquipment) {
WlSpareEquipment data = wlSpareEquipmentService.saveOrUpdateSpareEquipment(wlSpareEquipment, getSelectedOrgInfo());
return CommonResponseUtil.success(data);
}
@RequestMapping(value = "/deleteByIds", method = RequestMethod.DELETE)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "DELETE", value = "删除", notes = "删除")
public ResponseModel deleteByIds(@RequestBody List<Long> ids) {
wlSpareEquipmentService.deleteByIds(ids);
return CommonResponseUtil.success();
}
@RequestMapping(value = "/getById", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "详情", notes = "详情")
public ResponseModel<WlSpareEquipment> getById(@RequestParam Long id) {
ReginParams selectedOrgInfo = getSelectedOrgInfo();
WlSpareEquipment wlSpareEquipment = wlSpareEquipmentService.getById(id);
wlSpareEquipment.setAgencyId(selectedOrgInfo.getPersonIdentity().getCompanyId());
return CommonResponseUtil.success(wlSpareEquipment);
}
@RequestMapping(value = "/listByPage", method = RequestMethod.POST)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "列表分页查询", notes = "列表分页查询")
public ResponseModel listByPage(@RequestBody WlSpareEquipment wlSpareEquipment) {
String[] result = hierarchy.split(",");
Map<Integer, Integer> map = new HashMap<>();
for (int i = 0; i < result.length; i++) {
map.put(i, Integer.valueOf(result[i]));
}
if (StringUtil.isNotEmpty(wlSpareEquipment.getEquipmentClassificationCode())) {
QueryWrapper<EquipmentCategory> equipmentCategoryQueryWrapper = new QueryWrapper<>();
equipmentCategoryQueryWrapper.eq("code", wlSpareEquipment.getEquipmentClassificationCode());
equipmentCategoryQueryWrapper.eq("industry_code", wlSpareEquipment.getIndustryCode());
List<EquipmentCategory> equipmentCategoryList = equipmentCategoryService.list(equipmentCategoryQueryWrapper);
if (CollectionUtils.isEmpty(equipmentCategoryList)) {
throw new RuntimeException("装备定义code有误");
}
EquipmentCategory equipmentCategory = equipmentCategoryList.get(0);
int inhierarchy = 1;
int flag = 0;
for (int i = 0; i < result.length + 1; i++) {
//进来先判断是否默认就是空,如果为空第一层
if (equipmentCategory.getParentId() == null) {
//判断是否是最下面的子节点
if (i >= 4) {
inhierarchy = 8;
} else {
inhierarchy = map.get(i);
}
flag = i;
break;
} else {
//查找到循环几次为空
equipmentCategory = equipmentCategoryService.getById(equipmentCategory.getParentId());
}
}
if (flag == 0) {
String classificationCode = wlSpareEquipment.getEquipmentClassificationCode().replaceAll("0+$", "");
return CommonResponseUtil.success(wlSpareEquipmentService.listByPage(wlSpareEquipment, new Page<>(wlSpareEquipment.getPageNum(), wlSpareEquipment.getPageSize()), inhierarchy, classificationCode));
} else {
String classificationCode = wlSpareEquipment.getEquipmentClassificationCode().replaceAll("0+$", "");
return CommonResponseUtil.success(wlSpareEquipmentService.listByPage(wlSpareEquipment, new Page<>(wlSpareEquipment.getPageNum(), wlSpareEquipment.getPageSize()), inhierarchy, classificationCode.length() % 2 == 0 ? classificationCode : classificationCode + "0"));
}
}
Page<WlSpareEquipment> wlSpareEquipmentPage = wlSpareEquipmentService.listByPage(wlSpareEquipment, new Page<>(wlSpareEquipment.getPageNum(), wlSpareEquipment.getPageSize()), 0, null);
return CommonResponseUtil.success(wlSpareEquipmentPage);
}
/**
* 下载模板
*
* @return
* @Since 2021-3-10
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/downTemplate")
@ApiOperation(httpMethod = "GET", value = "下载模板", notes = "下载模板")
public void downTemplate(HttpServletResponse response) {
// 使用ClassPathResource加载模板文件
try (InputStream inputStream = new ClassPathResource("template/消防装备备品备件导入模板.xlsx").getInputStream()) {
// 对文件名进行URL编码
String encodedFilename = UriUtils.encode("消防装备备品备件导入模板.xlsx", StandardCharsets.UTF_8);
// 设置响应的内容类型为Excel文件的MIME类型
response.setContentType(String.valueOf(MediaType.parseMediaType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")));
// 设置Content-Disposition头信息,指定文件名
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + encodedFilename);
// 将输入流的内容复制到响应的输出流
byte[] buffer = new byte[1024];
int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) {
response.getOutputStream().write(buffer, 0, bytesRead);
}
} catch (IOException e) {
e.printStackTrace();
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "数据导出", notes = "数据导出")
@PostMapping(value = "/export")
public void export(HttpServletResponse response, @RequestBody WlSpareEquipment dto) {
List<WlSpareEquipment> exportList = new ArrayList<>();
String[] result = hierarchy.split(",");
Map<Integer, Integer> map = new HashMap<>();
for (int i = 0; i < result.length; i++) {
map.put(i, Integer.valueOf(result[i]));
}
if (StringUtil.isNotEmpty(dto.getEquipmentClassificationCode())) {
QueryWrapper<EquipmentCategory> equipmentCategoryQueryWrapper = new QueryWrapper<>();
equipmentCategoryQueryWrapper.eq("code", dto.getEquipmentClassificationCode());
equipmentCategoryQueryWrapper.eq("industry_code", dto.getIndustryCode());
List<EquipmentCategory> equipmentCategoryList = equipmentCategoryService.list(equipmentCategoryQueryWrapper);
if (CollectionUtils.isEmpty(equipmentCategoryList)) {
throw new RuntimeException("装备定义code有误");
}
EquipmentCategory equipmentCategory = equipmentCategoryList.get(0);
int inhierarchy = 1;
int flag = 0;
for (int i = 0; i < result.length + 1; i++) {
//进来先判断是否默认就是空,如果为空第一层
if (equipmentCategory.getParentId() == null) {
//判断是否是最下面的子节点
if (i >= 4) {
inhierarchy = 8;
} else {
inhierarchy = map.get(i);
}
flag = i;
break;
} else {
//查找到循环几次为空
equipmentCategory = equipmentCategoryService.getById(equipmentCategory.getParentId());
}
}
if (flag == 0) {
String classificationCode = dto.getEquipmentClassificationCode().replaceAll("0+$", "");
exportList = wlSpareEquipmentService.exportList(dto, inhierarchy, classificationCode);
} else {
String classificationCode = dto.getEquipmentClassificationCode().replaceAll("0+$", "");
exportList = wlSpareEquipmentService.exportList(dto, inhierarchy, classificationCode.length() % 2 == 0 ? classificationCode : classificationCode + "0");
}
} else {
exportList = wlSpareEquipmentService.exportList(dto, 0, null);
}
List<WlSpareEquipmentExportVo> exportVoList = new ArrayList<>();
exportList.forEach(item -> {
WlSpareEquipmentExportVo exportVo = new WlSpareEquipmentExportVo();
BeanUtils.copyProperties(item, exportVo, "single");
exportVo.setSingle(SingleEnum.DXGL.getKey().equals(item.getSingle()) ? "单项管理" : "批量管理");
exportVo.setWarehouseStructure(item.getWarehouseStructureCode());
exportVo.setProductionDate(DateUtil.format(item.getProductionDate(), DatePattern.NORM_DATE_PATTERN));
exportVo.setPurchaseDate(DateUtil.format(item.getPurchaseDate(), DatePattern.NORM_DATE_PATTERN));
exportVoList.add(exportVo);
});
ExcelUtil.createTemplate(response, "消防装备备品备件", "备品备件信息", exportVoList, WlSpareEquipmentExportVo.class, null, false);
}
/**
* 设备信息导入
*
* @return
*/
@PostMapping(value = "/uploadList")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "导入", notes = "导入")
public ResponseModel uploadList(MultipartFile file) {
try {
// 设置导入参数
ImportParams params = new ImportParams();
params.setTitleRows(0); // 标题行数
params.setHeadRows(1); // 表头行数
// 导入数据
List<WlSpareEquipmentExportVo> list = ExcelImportUtil.importExcel(file.getInputStream(), WlSpareEquipmentExportVo.class, params);
// 处理导入的数据,例如保存到数据库中
wlSpareEquipmentService.saveImportBatch(list, getSelectedOrgInfo());
// JSON.toJSONString(list)
return CommonResponseUtil.success();
} catch (IOException e) {
e.printStackTrace();
return CommonResponseUtil.failure("导入失败");
} catch (Exception e) {
e.printStackTrace();
}
return CommonResponseUtil.success();
}
/**
* 获取装备类型和统计值
*
* @throws Exception
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取装备类型和统计值", notes = "获取装备类型和统计值")
@GetMapping(value = "/getEquipmentTypeAndCount/tree")
public ResponseModel getEquipmentTypeAndCount(@RequestParam(required = false) String bizOrgCode) throws Exception {
if (StrUtil.isEmpty(bizOrgCode)) {
bizOrgCode = getSelectedOrgInfo().getPersonIdentity().getCompanyBizOrgCode();
}
return CommonResponseUtil.success(wlSpareEquipmentService.getEquipmentTypeAndCount(bizOrgCode));
}
@RequestMapping(value = "/countSpareEquip", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "卡片 - 根据装备定义分组数量统计", notes = "卡片 - 根据装备定义分组数量统计")
public ResponseModel<List<Map<String, Object>>> countSpareEquip(@RequestParam(required = false) String bizOrgCode) {
if (StrUtil.isEmpty(bizOrgCode)) {
bizOrgCode = getSelectedOrgInfo().getPersonIdentity().getCompanyBizOrgCode();
}
List<Map<String, Object>> resultMap = wlSpareEquipmentService.countSpareEquip(bizOrgCode);
return CommonResponseUtil.success(resultMap);
}
}
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.Car;
import com.yeejoin.equipmanage.common.entity.CarProperty;
import com.yeejoin.equipmanage.common.entity.vo.CarIndexVo;
import com.yeejoin.equipmanage.common.entity.vo.CarPropertyVo;
......@@ -39,4 +41,7 @@ public interface CarPropertyMapper extends BaseMapper<CarProperty> {
List<Map<String, String>> selectIndexByTime(String carStartIndexKey);
List<Map<String, String>> getTankAndFireCarNum(@Param("bizOrgCode") String bizOrgCode);
Page<Map<String, String>> carListByPage(@Param("page")Page<Car> page, @Param("dto") Car car);
}
......@@ -29,6 +29,8 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
int getEquipmentSpeCount(Map<String, Object> map);
List<Map<String, Object>> getEquipmentCount(@Param("bizOrgCode") String bizOrgCode);
IPage<ComplementCodeVO> selectEquipmentSpecific(Page page, EquipmentSpecificDTO equipmentSpecificDTO);
/**
......@@ -334,4 +336,12 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
List<Map<String, Object>> selectZJEquipmentSpecificWWXByIds(String bussIds);
List<Map<String, Object>> getFireEquipStatistic(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getFireEquipListByDefineCode(@Param("offset") long offset, @Param("size") long size, @Param("bizOrgCode") String bizOrgCode, @Param("code") String code, @Param("equipStatus") String equipStatus);
int count(@Param("bizOrgCode") String bizOrgCode, @Param("code") String code, @Param("equipStatus") String equipStatus);
Integer selectEquipmentCountBySystemId(@Param("systemId") Long systemId);
}
package com.yeejoin.equipmanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemGroupEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface FireFightingSystemGroupMapper extends BaseMapper<FireFightingSystemGroupEntity> {
}
......@@ -53,6 +53,8 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
*/
List<EquipCountBySystemVO> getEquipCountBySystemId(Long systemId);
Page<EquipCountBySystemVO> getEquipCountPageBySystemId(@Param("page") Page<Object> page, @Param("systemId") Long systemId);
/**
* 保存
*
......
package com.yeejoin.equipmanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.equipmanage.common.entity.SystemEquipmentRelationEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SystemEquipmentRelationMapper extends BaseMapper<SystemEquipmentRelationEntity> {
}
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.List;
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);
List<Map<String, Object>> countSpareEquip(@Param("bizOrgCode") String bizOrgCode);
List<WlSpareEquipment> exportList(@Param("dto") WlSpareEquipment dto,
@Param("hierarchy") int hierarchy,
@Param("codeHead") String codeHead);
}
package com.yeejoin.equipmanage.service;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemGroupEntity;
import com.yeejoin.equipmanage.common.entity.dto.FireFightingSystemGroupModalDto;
import java.util.List;
public interface FireFightingSystemGroupService extends IService<FireFightingSystemGroupEntity> {
/**
* 获取未绑定分组的系统列表
*/
JSONArray selectUnboundSystems(String bizOrgCode);
/**
* 保存分组
*
* @param fireFightingSystemGroupModalDto 分组信息
*/
Boolean saveOrUpdate(FireFightingSystemGroupModalDto fireFightingSystemGroupModalDto);
/**
* 更新分组排序
*/
void updateGroupSort(List<Long> groupIds);
/**
* 更新系统排序
*/
void updateSystemSort(Long groupId, List<Long> systemIds);
/**
* 获取分组
*
* @param bizOrgCode 业务组织编码
* @return 分组列表
*/
JSONArray listGroup(String bizOrgCode);
/**
* 删除分组
*/
void deleteGroup(Long groupId);
}
......@@ -214,5 +214,7 @@ public interface ICarService extends IService<Car> {
*/
void updateCarQrCode(List<Map<String, String>> carIds, String status);
List<Map<String, String>> getTankAndFireCarNum(String bizOrgCode);
Page<Map<String, String>> carListByPage(Car car, Page<Car> objectPage);
}
......@@ -128,4 +128,7 @@ public interface IEquipmentService extends IService<Equipment> {
EquipmentVo getEquipBySpecific(Long equipmentSpecificId);
List<Equipment> getAllByCode(String id);
List<Equipment> categoryList();
}
......@@ -10,14 +10,16 @@ import com.yeejoin.equipmanage.common.datasync.vo.FireEquipmentVO;
import com.yeejoin.equipmanage.common.dto.EquipmentSpecificDto;
import com.yeejoin.equipmanage.common.dto.FireFightingSystemDto;
import com.yeejoin.equipmanage.common.dto.UserDto;
import com.yeejoin.equipmanage.common.entity.Car;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecific;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex;
import com.yeejoin.equipmanage.common.entity.dto.EquipTypeAmountPageDTO;
import com.yeejoin.equipmanage.common.entity.dto.EquipmentSpecificDTO;
import com.yeejoin.equipmanage.common.entity.vo.*;
import com.yeejoin.equipmanage.common.vo.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.RequestParam;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
......@@ -324,6 +326,6 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
List<Map<String, Object>> getZJScrapStatics(String bizOrgCode);
Page<Map<String, Object>> getFireEquipListByDefineCode(String code, String equipStatus, String bizOrgCode, Page<Map<String, Object>> pageBean);
}
......@@ -60,6 +60,14 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
List<EquipCountBySystemVO> getEquipCountBySystemId(Long systemId);
/**
* 根据系统id查询分组设备数量
*
* @param systemId
* @return
*/
Page<EquipCountBySystemVO> getEquipCountPageBySystemId(Long systemId, Integer pageNumber, Integer pageSize);
/**
* 保存
*
* @param vo
......
......@@ -10,6 +10,7 @@ import com.yeejoin.equipmanage.common.entity.ScrapDetail;
import com.yeejoin.equipmanage.common.entity.SystemDic;
import java.util.List;
import java.util.Map;
/**
* 服务类
......@@ -29,7 +30,7 @@ public interface IScrapService extends IService<Scrap> {
void scrapOnCar(Long id);
void scrapOnPerson(Long id);
void scrapOnPerson(Map<String, Object> map, AgencyUserModel agencyUserModel);
void delPerson(Long id);
}
......@@ -24,7 +24,7 @@ public interface IStockDetailService extends IService<StockDetail> {
IPage<StockDetail> pagePlaceEquip(Page<StockDetail> pageBean, Long equipmentDetailId, Long warehouseStructureId);
List<StockDetail> loadOnPerson(List<String> ids);
List<StockDetail> loadOnPerson(List<Map<String, Number>> stocks);
StockDetail unloadPerson(Map<String, Object> map);
......
package com.yeejoin.equipmanage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.equipmanage.common.entity.SystemEquipmentRelationEntity;
public interface SystemEquipmentRelationService extends IService<SystemEquipmentRelationEntity> {
}
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);
List<Map<String, Object>> countSpareEquip(String bizOrgCode);
List<WlSpareEquipment> exportList(WlSpareEquipment dto, int hierarchy, String codeHead);
}
......@@ -881,9 +881,9 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
Optional.ofNullable(dto.getInstanceId()).orElseThrow(() -> new BadRequest("instanceId参数不能为空"));
Optional.ofNullable(dto.getGroupType()).orElseThrow(() -> new BadRequest("groupType参数不能为空"));
// 由于前端并未使用分页组件,导致展示不全,所以未免产生歧义此处展示所有
if ("allBuilding".equalsIgnoreCase(dto.getGroupType())) {
page.setSize(1000);
}
// if ("allBuilding".equalsIgnoreCase(dto.getGroupType())) {
// page.setSize(1000);
// }
// 根据不同的groupType 查询分页
PageOperation targetOperation = PageOperatorFactory
.getOperation(dto.getGroupType())
......
......@@ -1840,6 +1840,16 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
}
}
@Override
public List<Map<String, String>> getTankAndFireCarNum(String bizOrgCode){
return carPropertyMapper.getTankAndFireCarNum(bizOrgCode);
}
@Override
public Page<Map<String, String>> carListByPage(Car car, Page<Car> page) {
return carPropertyMapper.carListByPage(page, car);
}
class LossParams {
private Long carId;
......
package com.yeejoin.equipmanage.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......@@ -18,6 +19,7 @@ import com.yeejoin.equipmanage.service.IEquipmentDetailService;
import com.yeejoin.equipmanage.service.IEquipmentIndexService;
import com.yeejoin.equipmanage.service.IEquipmentService;
import com.yeejoin.equipmanage.service.IUnitService;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -347,6 +349,49 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
}
@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 (int i = 0; i <list.size(); i++) {
Equipment equipment = list.get(i);
EquipmentCategory equipmentCategory = categoryMap.get(equipment.getCategoryId());
String categoryCode = equipment.getCode();
// 移除非消耗性设备
if (Objects.isNull(equipmentCategory) || !Objects.equals(equipmentCategory.getIndustryCode(), "2") || categoryCode.charAt(0) == '2' || categoryCode.charAt(0) == '9') {
list.remove(equipment);
i--;
continue;
}
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);
}
}
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) {
EquipmentAppVO equipmentApp = new EquipmentAppVO();
//设备信息参数
......
......@@ -1985,6 +1985,16 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
log.info(String.format("发送eqm转kafka消息失败:%s", exp.getMessage()));
}
// idxFeign.handleEquipNotScrapWhenExpired(String.valueOf(e.get("id")), String.valueOf(e.get("bizOrgCode")), String.valueOf(e.get("bizOrgName")));
// 发送消息,message监听,转发给中心级
Map<String, Object> mapZxj = new HashMap<>();
mapZxj.put("topic", "equip/scrap/put");
mapZxj.put("data", map);
try {
emqKeeper.getMqttClient().publish("equip/scrap/put/zxj", JSON.toJSONString(mapZxj).getBytes(), 1, false);
} catch (MqttException exp) {
log.info(String.format("发送eqm消息,message根据该消息转发为kafka消息,失败信息:%s", exp.getMessage()));
}
}
}
......@@ -2252,5 +2262,13 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
return equipmentSpecificMapper.getZJScrapStatics(bizOrgCode);
}
@Override
public Page<Map<String, Object>> getFireEquipListByDefineCode(String code, String equipStatus, String bizOrgCode, Page<Map<String, Object>> pageBean) {
List<Map<String, Object>> list = equipmentSpecificMapper.getFireEquipListByDefineCode(pageBean.offset(), pageBean.getSize(), bizOrgCode, code, equipStatus);
int count = equipmentSpecificMapper.count(bizOrgCode, code, equipStatus);
pageBean.setRecords(list);
pageBean.setTotal(count);
return pageBean;
}
}
package com.yeejoin.equipmanage.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.component.robot.BadRequest;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemEntity;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemGroupEntity;
import com.yeejoin.equipmanage.common.entity.SystemEquipmentRelationEntity;
import com.yeejoin.equipmanage.common.entity.dto.CoreEquipmentsDto;
import com.yeejoin.equipmanage.common.entity.dto.FireFightingSystemGroupModalDto;
import com.yeejoin.equipmanage.common.entity.dto.SystemEquipmentsDto;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificMapper;
import com.yeejoin.equipmanage.mapper.FireFightingSystemGroupMapper;
import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper;
import com.yeejoin.equipmanage.service.FireFightingSystemGroupService;
import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import com.yeejoin.equipmanage.service.SystemEquipmentRelationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
@Service
public class FireFightingSystemGroupServiceImpl extends ServiceImpl<FireFightingSystemGroupMapper, FireFightingSystemGroupEntity> implements FireFightingSystemGroupService {
@Autowired
private FireFightingSystemGroupMapper fireFightingSystemGroupMapper;
@Autowired
private SystemEquipmentRelationService systemEquipmentRelationService;
@Autowired
private FireFightingSystemMapper fireFightingSystemMapper;
@Autowired
private EquipmentSpecificMapper equipmentSpecificMapper;
@Autowired
private IFireFightingSystemService fireFightingSystemService;
/**
* 获取消防系统列表
*
* @param bizOrgCode bizOrgCode
*/
@Override
public JSONArray selectUnboundSystems(String bizOrgCode) {
Wrapper<FireFightingSystemEntity> wrapper = Wrappers.<FireFightingSystemEntity>lambdaQuery()
.likeRight(FireFightingSystemEntity::getBizOrgCode, bizOrgCode)
.isNotNull(FireFightingSystemEntity::getName)
.isNotNull(FireFightingSystemEntity::getSystemType);
List<FireFightingSystemEntity> systems = fireFightingSystemService.list(wrapper);
List<Long> systemIds = systems.stream().map(FireFightingSystemEntity::getId).collect(Collectors.toList());
if (!systemIds.isEmpty()) {
List<FireFightingSystemGroupEntity> entities = this.list();
List<String> list = entities.stream().map(FireFightingSystemGroupEntity::getSystemIds).collect(Collectors.toList());
List<Long> boundedSystemIds = list.stream().flatMap(s -> Arrays.stream(s.split(","))).map(Long::parseLong).collect(Collectors.toList());
systemIds.removeAll(boundedSystemIds);
}
JSONArray result = new JSONArray();
for (FireFightingSystemEntity system : systems) {
Map<String, Object> jsonObject = new HashMap<>();
jsonObject.put("id", system.getId());
jsonObject.put("name", system.getName());
if (!systemIds.contains(system.getId())) {
// isBound: 是否已绑定分组
jsonObject.put("isBound", true);
} else {
jsonObject.put("isBound", false);
}
result.add(jsonObject);
}
return result;
}
/**
* 保存分组
*
* @param fireFightingSystemGroupModalDto 分组信息
* @return 分组信息
*/
@Override
@Transactional
public Boolean saveOrUpdate(FireFightingSystemGroupModalDto fireFightingSystemGroupModalDto) {
if (!(Objects.nonNull(fireFightingSystemGroupModalDto.getGroupName()) && Objects.nonNull(fireFightingSystemGroupModalDto.getDisplayType()) && Objects.nonNull(fireFightingSystemGroupModalDto.getSystems()))) {
throw new BadRequest("无效参数!");
}
// 分组名称唯一性校验
if (Objects.isNull(fireFightingSystemGroupModalDto.getId())) {
Integer count = fireFightingSystemGroupMapper.selectCount(
Wrappers.<FireFightingSystemGroupEntity>lambdaQuery()
.eq(FireFightingSystemGroupEntity::getGroupName, fireFightingSystemGroupModalDto.getGroupName())
);
if (count > 0) {
throw new BadRequest("当前分组已存在!");
}
}
List<SystemEquipmentsDto> systems = fireFightingSystemGroupModalDto.getSystems();
// 更新数据前先清理解绑的系统与相关关系表的数据
if (Objects.nonNull(fireFightingSystemGroupModalDto.getId())) {
FireFightingSystemGroupEntity entity = fireFightingSystemGroupMapper.selectById(fireFightingSystemGroupModalDto.getId());
List<String> systemIds = Arrays.asList(entity.getSystemIds().split(","));
systemEquipmentRelationService.remove(
Wrappers.<SystemEquipmentRelationEntity>lambdaQuery()
.in(SystemEquipmentRelationEntity::getSystemId, systemIds)
);
}
String[] sortedSystemIds = new String[systems.size()];
for (SystemEquipmentsDto system : systems) {
// 系统重排序
sortedSystemIds[system.getSort()] = system.getId();
// 构建系统与装备关系
List<CoreEquipmentsDto> equipments = system.getEquipments();
List<SystemEquipmentRelationEntity> relationEntities = equipments.stream()
.map(equipment -> SystemEquipmentRelationEntity.builder()
.systemId(Long.valueOf(system.getId()))
.equipmentId(Long.valueOf(equipment.getId()))
.type(equipment.getType())
.sort(equipment.getSort())
.build()
).collect(Collectors.toList());
if (!systemEquipmentRelationService.saveBatch(relationEntities)) {
throw new BadRequest("保存分组关系失败!");
}
}
// 分组信息入库
FireFightingSystemGroupEntity fireFightingSystemGroupEntity = FireFightingSystemGroupEntity.builder()
.groupName(fireFightingSystemGroupModalDto.getGroupName())
.groupCode(new StringBuilder(String.valueOf(System.currentTimeMillis())).reverse().toString())
.displayType(fireFightingSystemGroupModalDto.getDisplayType())
.systemIds(String.join(",", sortedSystemIds))
.remarks("")
.sort(Objects.nonNull(fireFightingSystemGroupModalDto.getSort()) ? fireFightingSystemGroupModalDto.getSort() : 0)
.bizOrgName(fireFightingSystemGroupModalDto.getBizOrgName())
.bizOrgCode(fireFightingSystemGroupModalDto.getBizOrgCode())
.build();
if (Objects.nonNull(fireFightingSystemGroupModalDto.getId())) {
fireFightingSystemGroupEntity.setId(Long.valueOf(fireFightingSystemGroupModalDto.getId()));
}
return this.saveOrUpdate(fireFightingSystemGroupEntity);
}
/**
* 更新分组排序
*
* @param groupIds 分组ID
*/
@Override
@Transactional
public void updateGroupSort(List<Long> groupIds) {
if (Objects.isNull(groupIds) || groupIds.isEmpty()) {
throw new BadRequest("无效参数!");
}
Collection<FireFightingSystemGroupEntity> entities = this.listByIds(groupIds);
for (int i = 0; i < groupIds.size(); i++) {
final int sort = i;
entities.stream().filter(entity -> entity.getId().equals(groupIds.get(sort))).findFirst().ifPresent(entity -> entity.setSort(sort));
}
this.updateBatchById(entities);
}
/**
* 更新系统排序
*
* @param groupId 分组ID
* @param systemIds 系统ID
*/
@Override
public void updateSystemSort(Long groupId, List<Long> systemIds) {
if (Objects.isNull(groupId) || Objects.isNull(systemIds)) {
throw new BadRequest("无效参数!");
}
FireFightingSystemGroupEntity entity = this.getById(groupId);
if (Objects.isNull(entity)) {
throw new BadRequest("分组不存在!");
}
String systemIdsStr = systemIds.stream().map(String::valueOf).collect(Collectors.joining(","));
entity.setSystemIds(systemIdsStr);
this.updateById(entity);
}
/**
* 获取分组
*
* @param bizOrgCode 业务组织编码
* @return 分组列表
*/
@Override
@SuppressWarnings("unchecked")
public JSONArray listGroup(String bizOrgCode) {
List<FireFightingSystemGroupEntity> groupEntities = fireFightingSystemGroupMapper.selectList(
Wrappers.<FireFightingSystemGroupEntity>lambdaQuery()
.likeRight(FireFightingSystemGroupEntity::getBizOrgCode, bizOrgCode)
.orderByAsc(FireFightingSystemGroupEntity::getSort, FireFightingSystemGroupEntity::getCreateDate)
);
List<Long> systemIds = groupEntities.stream().map(FireFightingSystemGroupEntity::getSystemIds).map(s -> s.split(",")).flatMap(Arrays::stream).map(Long::parseLong).collect(Collectors.toList());
if (systemIds.isEmpty()) {
return new JSONArray();
}
// List to Map -> key: systemId, value: FireFightingSystemEntity
Map<Long, FireFightingSystemEntity> systemMap = fireFightingSystemMapper.selectList(
Wrappers.<FireFightingSystemEntity>lambdaQuery()
.in(FireFightingSystemEntity::getId, systemIds)
).stream().map(fireFightingSystemEntity -> new HashMap<Long, FireFightingSystemEntity>() {{
put(fireFightingSystemEntity.getId(), fireFightingSystemEntity);
}}).collect(Collectors.toMap(map -> map.keySet().iterator().next(), map -> map.values().iterator().next()));
// List to Map -> key: equipmentId, value: List<SystemEquipmentRelationEntity>
Map<Long, List<SystemEquipmentRelationEntity>> systemEquipmentMap = new HashMap<>();
List<SystemEquipmentRelationEntity> systemEquipmentRelationEntities = systemEquipmentRelationService.list(
Wrappers.<SystemEquipmentRelationEntity>lambdaQuery()
.in(SystemEquipmentRelationEntity::getSystemId, systemIds)
);
for (SystemEquipmentRelationEntity systemEquipmentRelation : systemEquipmentRelationEntities) {
if (systemEquipmentMap.containsKey(systemEquipmentRelation.getSystemId())) {
systemEquipmentMap.get(systemEquipmentRelation.getSystemId()).add(systemEquipmentRelation);
} else {
List<SystemEquipmentRelationEntity> list = new ArrayList<>();
list.add(systemEquipmentRelation);
systemEquipmentMap.put(systemEquipmentRelation.getSystemId(), list);
}
}
// List to Map -> key: systemId@equipmentId, value: 装备定义数量Map
List<Map<String, Object>> equipmentCountList = equipmentSpecificMapper.getEquipmentCount(bizOrgCode);
Map<String, Map<String, Object>> equipmentCountMap = new HashMap<>();
for (Map<String, Object> map : equipmentCountList) {
String equipmentId = map.getOrDefault("equipmentId", "").toString();
String systemId = map.getOrDefault("systemId", "").toString();
String[] ids = systemId.split(",");
for (String id : ids) {
String uniqueKey = id + "@" + equipmentId;
if (equipmentCountMap.containsKey(uniqueKey)) {
Map<String, Object> objectMap = equipmentCountMap.get(uniqueKey);
objectMap.put("count", Long.parseLong(map.getOrDefault("count", "0").toString()) + Long.parseLong(objectMap.getOrDefault("count", 0).toString()));
}
equipmentCountMap.put(uniqueKey, map);
}
}
// 构建分组对象
JSONArray groups = new JSONArray();
for (FireFightingSystemGroupEntity groupEntity : groupEntities) {
JSONObject group = new JSONObject();
JSONArray systems = new JSONArray();
group.put("id", groupEntity.getId());
group.put("groupName", groupEntity.getGroupName());
group.put("displayType", groupEntity.getDisplayType());
group.put("sort", groupEntity.getSort());
group.put("systems", systems);
List<Long> entitySystemIds = Arrays.stream(groupEntity.getSystemIds().split(",")).map(Long::parseLong).collect(Collectors.toList());
int size = entitySystemIds.size();
for (int i = 0; i < size; i++) {
Long systemId = entitySystemIds.get(i);
JSONObject system = new JSONObject();
FireFightingSystemEntity systemEntity = systemMap.get(systemId);
List<SystemEquipmentRelationEntity> relationEntities = Objects.nonNull(systemEquipmentMap.get(systemId)) ? systemEquipmentMap.get(systemId) : new ArrayList<>();
system.put("id", systemId);
system.put("code", systemEntity.getCode());
system.put("typeCode", systemEntity.getSystemTypeCode());
system.put("name", systemEntity.getName());
system.put("systemState", systemEntity.getSystemStatus());
system.put("systemRunState", systemEntity.getSystemRunState());
system.put("protectObject", systemEntity.getProObject());
system.put("systemDesc", systemEntity.getSystemDescribe());
system.put("sort", i);
List<Map<String, Object>> equipments = new ArrayList<>();
for (SystemEquipmentRelationEntity relationEntity : relationEntities) {
Long equipmentId = relationEntity.getEquipmentId();
if (equipmentCountMap.containsKey(systemId + "@" + equipmentId)) {
Map<String, Object> equipmentMap = equipmentCountMap.get(systemId + "@" + equipmentId);
Map<String, Object> equipment = new HashMap<>();
equipment.put("id", equipmentMap.get("equipmentId"));
equipment.put("name", equipmentMap.get("equipmentName"));
equipment.put("num", Integer.valueOf(equipmentMap.getOrDefault("count", "0").toString()));
equipment.put("unit", equipmentMap.get("unit"));
equipment.put("sort", relationEntity.getSort());
equipment.put("type", relationEntity.getType());
equipments.add(equipment);
}
}
system.put("equipments", equipments);
systems.add(system);
}
groups.add(group);
}
return groups;
}
/**
* 删除分组
*
* @param groupId
*/
@Override
@Transactional
public void deleteGroup(Long groupId) {
FireFightingSystemGroupEntity groupEntity = fireFightingSystemGroupMapper.selectById(groupId);
if (Objects.isNull(groupEntity)) {
throw new BadRequest("分组不存在");
}
String systemIds = groupEntity.getSystemIds();
List<Long> systemIdList = Arrays.stream(systemIds.split(",")).map(Long::parseLong).collect(Collectors.toList());
// 删除映射关系
systemEquipmentRelationService.remove(
Wrappers.<SystemEquipmentRelationEntity>lambdaQuery()
.in(!systemIdList.isEmpty(), SystemEquipmentRelationEntity::getSystemId, systemIdList)
);
// 删除分组
fireFightingSystemGroupMapper.deleteById(groupId);
}
}
......@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.base.Joiner;
......@@ -65,6 +66,7 @@ import java.net.NetworkInterface;
import java.net.SocketException;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
......@@ -96,6 +98,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Autowired
EquipmentSpecificAlarmMapper equipmentSpecificAlarmMapper;
@Autowired
EquipmentSpecificAlarmLogMapper equipmentSpecificAlarmLogMapper;
@Autowired
private SourceSceneMapper sourceSceneMapper;
@Value("${equipment.fire.systemid}")
private String fireSystemId;
......@@ -189,6 +193,12 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
@Override
public Page<EquipCountBySystemVO> getEquipCountPageBySystemId(Long systemId, Integer pageNumber, Integer pageSize) {
return this.baseMapper.getEquipCountPageBySystemId(new Page(pageNumber, pageSize), systemId);
}
@Override
public List<EquiplistSpecificBySystemVO>
getEquiplistBySystemId(Long systemId) {
return this.baseMapper.getEquiplistBySystemId(systemId);
......@@ -1143,7 +1153,24 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override
public List<AlarmDataVO> getSystemById(Long id) {
return this.baseMapper.getSystemById(id);
List<AlarmDataVO> list = this.baseMapper.getSystemById(id);
// 部件总数
Integer equipmentCount = equipmentSpecificMapper.selectCount(
Wrappers.<EquipmentSpecific>lambdaQuery()
.eq(EquipmentSpecific::getSystemId, id)
.eq(EquipmentSpecific::getSingle, true)
);
// 未复归设备
List<EquipmentSpecificAlarmLog> equipSpecIds = equipmentSpecificAlarmLogMapper.selectList(
Wrappers.<EquipmentSpecificAlarmLog>lambdaQuery()
.select(EquipmentSpecificAlarmLog::getEquipmentSpecificId)
.like(EquipmentSpecificAlarmLog::getSystemIds, id)
.eq(EquipmentSpecificAlarmLog::getStatus, "1")
);
int count = (int) equipSpecIds.stream().map(EquipmentSpecificAlarmLog::getEquipmentSpecificId).distinct().count();
list.add(new AlarmDataVO("部件总数", equipmentCount + " 个", false));
list.add(new AlarmDataVO("未复归设备", count + " 个", false));
return list;
}
@Override
......
......@@ -72,6 +72,7 @@ public class ScrapServiceImpl extends ServiceImpl<ScrapMapper, Scrap> implements
scrap.setBillCode(stockBillService.generateQrCode("BF"));
scrap.setBillType(type);
scrap.setStatus(TaskStatusEnum.INPROGRESS.getCode());
scrap.setUserId(Long.valueOf(agencyUserModel.getUserId()));
scrap.setCreatorName(agencyUserModel.getRealName());
scrapService.save(scrap);
for (ScrapDetail scrapDetail : list) {
......@@ -312,15 +313,20 @@ public class ScrapServiceImpl extends ServiceImpl<ScrapMapper, Scrap> implements
}
@Override
public void scrapOnPerson(Long id) {
// QueryWrapper<StockDetail> queryWrapper = new QueryWrapper<>();
// StockDetail stockDetail = stockDetailService.getOne(queryWrapper.eq("equipment_specific_id", id));
@Transactional
public void scrapOnPerson(Map<String, Object> map, AgencyUserModel agencyUserModel) {
Long id = Long.valueOf(map.get("stockDetailId").toString());
double amount = Double.parseDouble(map.get("amount").toString());
StockDetail stockDetail = stockDetailService.getById(id);
if (null == stockDetail) {
throw new RuntimeException("id为"+ id + "的StockDetail实体不存在!");
}
stockDetail.setStatus(String.valueOf(EquipStatusEnum.SCRAP.getCode()));
stockDetailService.updateById(stockDetail);
// 添加报废流程
ScrapDetail scrapDetail = new ScrapDetail();
scrapDetail.setStockDetailId(stockDetail.getId());
scrapDetail.setAmount(amount);
this.create(Collections.singletonList(scrapDetail), BillContentEnum.ZB.getCode(), agencyUserModel);
}
@Override
......
......@@ -144,15 +144,20 @@ public class StockDetailServiceImpl extends ServiceImpl<StockDetailMapper, Stock
}
@Override
public List<StockDetail> loadOnPerson(List<String> ids) {
public List<StockDetail> loadOnPerson(List<Map<String, Number>> stocks) {
List<StockDetail> list = new ArrayList<>();
ids.forEach(x -> {
StockDetail stockDetail = this.baseMapper.selectById(Long.valueOf(x));
stocks.forEach(x -> {
StockDetail stockDetail = this.baseMapper.selectById(Long.valueOf(x.get("stockDetailId").toString()));
if (null == stockDetail) {
throw new RuntimeException("id 为"+ x + "的StockDetail不存在 !");
}
double stockAmount = stockDetail.getAmount() - Double.parseDouble(x.get("amount").toString());
if (stockAmount < 0) {
throw new RuntimeException("库存不足");
} else if (stockAmount == 0) {
stockDetail.setStatus(String.valueOf(EquipStatusEnum.LOAD.getCode()));
stockDetail.setAmount(Math.abs(stockDetail.getAmount() - 1.0));
}
stockDetail.setAmount(stockAmount);
this.baseMapper.updateById(stockDetail);
list.add(stockDetail);
});
......@@ -196,12 +201,14 @@ public class StockDetailServiceImpl extends ServiceImpl<StockDetailMapper, Stock
@Override
public StockDetail unloadPerson(Map<String, Object> map) {
// Long structureId = Long.valueOf(String.valueOf(map.get("warehouseStructureId")));
Long stockDetailId = Long.valueOf(String.valueOf(map.get("stockDetailId")));
double amount = Double.parseDouble(String.valueOf(map.get("amount")));
if (amount == 0) {
throw new RuntimeException("数量不能为空");
}
StockDetail stockDetail = this.baseMapper.selectById(stockDetailId);
stockDetail.setStatus(String.valueOf(EquipStatusEnum.REPERTORY.getCode()));//陈浩修改,原本退装枚举值所对应的jcs逻辑是回库,现确定为在位状态
// stockDetail.setWarehouseStructureId(structureId);
stockDetail.setAmount(stockDetail.getAmount() + 1.0);
stockDetail.setAmount(stockDetail.getAmount() + amount);
this.baseMapper.updateById(stockDetail);
return stockDetail;
}
......
package com.yeejoin.equipmanage.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.equipmanage.common.entity.SystemEquipmentRelationEntity;
import com.yeejoin.equipmanage.mapper.SystemEquipmentRelationMapper;
import com.yeejoin.equipmanage.service.SystemEquipmentRelationService;
import org.springframework.stereotype.Service;
@Service
public class SystemEquipmentRelationServiceImpl extends ServiceImpl<SystemEquipmentRelationMapper, SystemEquipmentRelationEntity> implements SystemEquipmentRelationService {
}
package com.yeejoin.equipmanage.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.vo.WlSpareEquipmentExportVo;
import com.yeejoin.equipmanage.common.enums.BillContentEnum;
import com.yeejoin.equipmanage.common.enums.FileTypeEnum;
import com.yeejoin.equipmanage.common.enums.SingleEnum;
import com.yeejoin.equipmanage.mapper.EquipmentCategoryMapper;
import com.yeejoin.equipmanage.mapper.UnitMapper;
import com.yeejoin.equipmanage.mapper.WarehouseStructureMapper;
import com.yeejoin.equipmanage.mapper.WlSpareEquipmentMapper;
import com.yeejoin.equipmanage.service.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class WlSpareEquipmentServiceImpl extends ServiceImpl<WlSpareEquipmentMapper, WlSpareEquipment>
implements WlSpareEquipmentService {
@Autowired
WlSpareEquipmentMapper wlSpareEquipmentMapper;
@Autowired
IEquipmentCategoryService iEquipmentCategoryService;
@Value("${equipment.type}")
String equipmentCategoryLeftTypeCode;
@Autowired
private Sequence sequence;
@Autowired
private IUploadFileService iUploadFileService;
@Autowired
private EquipmentServiceImpl equipmentService;
@Autowired
private EquipmentCategoryMapper equipmentCategoryMapper;
@Autowired
IManufacturerInfoService iManufacturerInfoService;
@Autowired
WarehouseStructureMapper warehouseStructureMapper;
@Autowired
UnitMapper unitMapper;
@Override
public WlSpareEquipment saveOrUpdateSpareEquipment(WlSpareEquipment wlSpareEquipment, ReginParams reginParams) {
wlSpareEquipment.setBizOrgName(reginParams.getPersonIdentity().getCompanyName());
wlSpareEquipment.setBizOrgCode(reginParams.getPersonIdentity().getCompanyBizOrgCode());
if (Objects.nonNull(wlSpareEquipment.getWarehouseStructureId())) {
WarehouseStructure warehouseStructure = warehouseStructureMapper.selectById(wlSpareEquipment.getWarehouseStructureId());
wlSpareEquipment.setWarehouseStructureCode(warehouseStructure.getCode());
}
if (ObjectUtils.isEmpty(wlSpareEquipment.getId())) {
wlSpareEquipmentMapper.insert(wlSpareEquipment);
} else {
wlSpareEquipmentMapper.updateById(wlSpareEquipment);
QueryWrapper<UploadFile> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(UploadFile::getObjectType, BillContentEnum.BPBJ.getKey())
.eq(UploadFile::getObjectId, wlSpareEquipment.getId());
iUploadFileService.remove(queryWrapper);
}
saveUploadFile(wlSpareEquipment);
return wlSpareEquipment;
}
/**
* 插入文件信息
*/
private void saveUploadFile(WlSpareEquipment wlSpareEquipment) {
List<UploadFile> fileList = new ArrayList<>();
fileList.addAll(fillFileList(wlSpareEquipment.getImg(), wlSpareEquipment.getId(), FileTypeEnum.image.toString()));
fileList.addAll(fillFileList(wlSpareEquipment.getVideo(), wlSpareEquipment.getId(), FileTypeEnum.video.toString()));
fileList.addAll(fillFileList(wlSpareEquipment.getCertification(), wlSpareEquipment.getId(), FileTypeEnum.certificate.toString()));
fileList.addAll(fillFileList(wlSpareEquipment.getInstruction(), wlSpareEquipment.getId(), FileTypeEnum.instruction.toString()));
fileList.addAll(fillFileList(wlSpareEquipment.getQuality(), wlSpareEquipment.getId(), FileTypeEnum.quality.toString()));
fileList.addAll(fillFileList(wlSpareEquipment.getOperation(), wlSpareEquipment.getId(), FileTypeEnum.operation.toString()));
iUploadFileService.saveBatch(fileList);
}
private List<UploadFile> fillFileList(List<UploadFile> list, Long id, String type) {
if (list == null) {
return new ArrayList<UploadFile>();
}
list.forEach(item -> {
item.setUrl(item.getUrl());
item.setId(sequence.nextId());
item.setFileType(type);
item.setObjectType(BillContentEnum.BPBJ.getKey());
item.setObjectId(id);
});
return list;
}
@Override
public int deleteByIds(List<Long> ids) {
LambdaUpdateWrapper<WlSpareEquipment> updateWrapper = new LambdaUpdateWrapper<>();
// 设置更新条件,例如:根据主键 id 列表进行更新
updateWrapper.in(WlSpareEquipment::getId, ids);
// 设置更新内容,例如:将字段 field1 的值更新为 newValue
updateWrapper.set(WlSpareEquipment::getIsDelete, true);
return wlSpareEquipmentMapper.update(null, updateWrapper);
}
@Override
public WlSpareEquipment getById(Long id) {
WlSpareEquipment wlSpareEquipment = wlSpareEquipmentMapper.selectById(id);
wlSpareEquipment.setImg(getEquipFileList(id, FileTypeEnum.image.toString()));
wlSpareEquipment.setVideo(getEquipFileList(id, FileTypeEnum.video.toString()));
wlSpareEquipment.setCertification(getEquipFileList(id, FileTypeEnum.certificate.toString()));
wlSpareEquipment.setInstruction(getEquipFileList(id, FileTypeEnum.instruction.toString()));
wlSpareEquipment.setQuality(getEquipFileList(id, FileTypeEnum.quality.toString()));
wlSpareEquipment.setOperation(getEquipFileList(id, FileTypeEnum.operation.toString()));
return wlSpareEquipment;
}
private List<UploadFile> getEquipFileList(Long id, String type) {
List<UploadFile> list = iUploadFileService.list(new QueryWrapper<UploadFile>().eq("object_id", id)
.eq("object_type", BillContentEnum.BPBJ.getKey()).eq("file_type", type));
list.forEach(item -> {
item.setUrl(item.getUrl());
});
return list;
}
@Override
public Page<WlSpareEquipment> listByPage(WlSpareEquipment dto, Page page, int hierarchy, String codeHead) {
Page<WlSpareEquipment> wlSpareEquipmentPage = wlSpareEquipmentMapper.listByPage(page, dto, hierarchy, codeHead);
List<WlSpareEquipment> records = wlSpareEquipmentPage.getRecords();
for (WlSpareEquipment record : records) {
record.setImg(getEquipFileList(record.getId(), FileTypeEnum.image.toString()));
}
wlSpareEquipmentPage.setRecords(records);
return wlSpareEquipmentPage;
}
@Override
public void saveImportBatch(List<WlSpareEquipmentExportVo> list, ReginParams reginParams) {
List<String> equipModelCodeList = new ArrayList<>();
List<String> warehouseStructureList = new ArrayList<>();
List<String> unitList = new ArrayList<>();
list.stream().forEach(item -> {
if (StrUtil.isEmpty(item.getEquipModelCode())) {
throw new BadRequest("装备编码(从装备定义中获取)项不能为空");
}
equipModelCodeList.add(item.getEquipModelCode());
warehouseStructureList.add(item.getWarehouseStructure());
unitList.add(item.getUnit());
});
// 装备定义数据
LambdaQueryWrapper<Equipment> wrapper = new LambdaQueryWrapper<>();
wrapper.in(Equipment::getCode, equipModelCodeList);
List<Equipment> equipmentList = equipmentService.list(wrapper);
// 装备定义
Map<String, Equipment> equipmentMap = new HashMap<>();
// 装备分类IDs
List<Long> equipCategoryIds = new ArrayList<>();
equipmentList.stream().forEach(item -> {
equipmentMap.put(item.getCode(), item);
equipCategoryIds.add(item.getCategoryId());
});
// 装备分类数据
LambdaQueryWrapper<EquipmentCategory> categoryWrapper = new LambdaQueryWrapper<>();
categoryWrapper.in(EquipmentCategory::getId, equipCategoryIds);
Map<Long, EquipmentCategory> categoryMap = equipmentCategoryMapper.selectList(categoryWrapper).stream().collect(Collectors.toMap(EquipmentCategory::getId, t -> t));
// 生产厂家数据
List<ManufacturerInfo> manufacturerInfos = iManufacturerInfoService.list();
Map<String, ManufacturerInfo> manufacturerMap = manufacturerInfos.stream().collect(Collectors.toMap(ManufacturerInfo::getName, t -> t));
// 存放位置
LambdaQueryWrapper<WarehouseStructure> warehouseLambda = new LambdaQueryWrapper<>();
warehouseLambda.in(WarehouseStructure::getCode, warehouseStructureList);
Map<String, WarehouseStructure> structureMap = warehouseStructureMapper.selectList(warehouseLambda).stream().collect(Collectors.toMap(WarehouseStructure::getCode, t -> t));
// 单位
LambdaQueryWrapper<Unit> unitLambda = new LambdaQueryWrapper<>();
unitLambda.in(Unit::getName, unitList);
unitLambda.groupBy(Unit::getName);
Map<String, Long> unitMap = unitMapper.selectList(unitLambda).stream().collect(Collectors.toMap(Unit::getName, Unit::getId));
List<WlSpareEquipment> saveList = new ArrayList<>();
list.forEach(item -> {
Equipment equipment = equipmentMap.get(item.getEquipModelCode());
EquipmentCategory equipmentCategory = categoryMap.get(equipment.getCategoryId());
ManufacturerInfo manufacturerInfo = manufacturerMap.get(item.getManufacturer());
WarehouseStructure warehouseStructure = structureMap.get(item.getWarehouseStructure());
Long unitId = unitMap.get(item.getUnit());
WlSpareEquipment wlSpareEquipment = new WlSpareEquipment();
BeanUtils.copyProperties(item, wlSpareEquipment);
if (ObjectUtils.isNotEmpty(equipment)) {
wlSpareEquipment.setEquipModelId(equipment.getId());
wlSpareEquipment.setEquipModelName(equipment.getName());
}
if (ObjectUtils.isNotEmpty(equipmentCategory)) {
wlSpareEquipment.setEquipCategoryId(equipmentCategory.getId());
wlSpareEquipment.setEquipCategoryCode(equipmentCategory.getCode());
wlSpareEquipment.setEquipCategoryName(equipmentCategory.getName());
}
if (ObjectUtils.isNotEmpty(manufacturerInfo)) {
wlSpareEquipment.setManufacturerId(manufacturerInfo.getId());
}
if (ObjectUtils.isNotEmpty(warehouseStructure)) {
wlSpareEquipment.setWarehouseStructureId(warehouseStructure.getId());
wlSpareEquipment.setWarehouseStructure(warehouseStructure.getName());
wlSpareEquipment.setWarehouseStructureCode(warehouseStructure.getCode());
}
wlSpareEquipment.setBizOrgName(reginParams.getPersonIdentity().getCompanyName());
wlSpareEquipment.setBizOrgCode(reginParams.getPersonIdentity().getCompanyBizOrgCode());
wlSpareEquipment.setSingle(SingleEnum.DXGL.getName().equals(item.getSingle()) ? SingleEnum.DXGL.getKey() : SingleEnum.PLGL.getKey());
wlSpareEquipment.setUnitId(unitId);
saveList.add(wlSpareEquipment);
});
this.saveBatch(saveList);
}
@Override
public void subtractNum(Long id, Float num) {
WlSpareEquipment wlSpareEquipment = this.getById(id);
if (num > wlSpareEquipment.getStockNum()) {
throw new BadRequest("使用数量大于备品备件库存数量");
}
wlSpareEquipment.setStockNum(wlSpareEquipment.getStockNum() - num);
this.updateById(wlSpareEquipment);
}
@Override
public List<EquipmentCategory> getEquipmentTypeAndCount(String bizOrgCode) {
return refreshEquipmentTypeAndCount(bizOrgCode);
}
public List<EquipmentCategory> refreshEquipmentTypeAndCount(String bizOrgCode) {
List<EquipmentCategory> responseList = this.typeList();
if (responseList == null || responseList.size() < 1) {
return null;
}
List<EquipmentCategory> equipmentTypeList = responseList.stream()
.filter(i -> !i.getCode().startsWith("2") && "2".equals(i.getIndustryCode()))
.filter(m -> !m.getCode().startsWith("9306") && "2".equals(m.getIndustryCode()))
.collect(Collectors.toList());
List<EquipmentCategory> list = typeListTree(equipmentTypeList, bizOrgCode);
return list;
}
public List<EquipmentCategory> typeList() {
return iEquipmentCategoryService.getEquipmentCategoryList(Integer.valueOf(equipmentCategoryLeftTypeCode));
}
public List<EquipmentCategory> typeListTree(List<EquipmentCategory> equipmentCategorys, String bizOrgCode) {
LambdaQueryWrapper<WlSpareEquipment> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(WlSpareEquipment::getIsDelete, 0);
queryWrapper.gt(WlSpareEquipment::getStockNum, 0);
queryWrapper.likeRight(WlSpareEquipment::getBizOrgCode, bizOrgCode);
List<WlSpareEquipment> wlSpareEquipments = wlSpareEquipmentMapper.selectList(queryWrapper);
Map<Long, Integer> resultMap = wlSpareEquipments.stream()
.collect(Collectors.groupingBy(WlSpareEquipment::getEquipCategoryId, Collectors.summingInt(e -> 1)));
List<EquipmentCategory> list = new ArrayList<>();
Map<String, List<EquipmentCategory>> tmpMap = new HashMap<String, List<EquipmentCategory>>();
equipmentCategorys.forEach(action -> {
action.setCount(Double.parseDouble(resultMap.getOrDefault(action.getId(), 0) + ""));
if (action.getParentId() == null) {
list.add(action);
} else {
if (tmpMap.get(action.getParentId().toString()) == null) {
ArrayList<EquipmentCategory> tmplist = new ArrayList<EquipmentCategory>();
tmplist.add(action);
tmpMap.put(action.getParentId().toString(), tmplist);
} else {
if (!tmpMap.get(action.getParentId().toString()).contains(action)) {
tmpMap.get(action.getParentId().toString()).add(action);
}
}
}
});
getChildren(list, tmpMap);
list.forEach(this::accumulateCount);
List<EquipmentCategory> collect = list.stream().filter(t -> t.getCount() > 0).collect(Collectors.toList());
return collect;
}
public int accumulateCount(EquipmentCategory node) {
int totalCount = (int) Math.round(node.getCount());
for (EquipmentCategory child : node.getChildren()) {
totalCount += accumulateCount(child);
}
node.setCount((double) totalCount);
return totalCount;
}
private void getChildren(List<EquipmentCategory> list, Map<String, List<EquipmentCategory>> tmpMap) {
for (EquipmentCategory equipmentCategory : list) {
if (tmpMap.get(equipmentCategory.getId().toString()) != null
&& tmpMap.get(equipmentCategory.getId().toString()).size() > 0) {
List<EquipmentCategory> equipcliss = tmpMap.get(equipmentCategory.getId().toString());
equipmentCategory.setHasLowerClassification(true);
equipmentCategory.setChildren(equipcliss);
getChildren(equipcliss, tmpMap);
}
}
}
@Override
public List<Map<String, Object>> countSpareEquip(String bizOrgCode) {
return wlSpareEquipmentMapper.countSpareEquip(bizOrgCode);
}
@Override
public List<WlSpareEquipment> exportList(WlSpareEquipment dto, int hierarchy, String codeHead) {
return wlSpareEquipmentMapper.exportList(dto, hierarchy, codeHead);
}
}
......@@ -3,9 +3,11 @@ package com.yeejoin.amos.boot.module.jcs.biz.controller;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
......@@ -174,6 +176,16 @@ public class FirefightersJacketController extends BaseController {
}
/**
* 分页查询设备数量(调用装备接口)
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "人员装备数量")
@RequestMapping(value = "/person-equip-count", method = RequestMethod.GET)
public ResponseModel<List<Map<String, Object>>> getPersonEquipCount() {
return ResponseHelper.buildResponse(iFirefightersJacketService.getPersonEquipCount());
}
/**
* 分页查询设备列表(调用装备接口)
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
......
......@@ -36,6 +36,13 @@ public class FirefightersJacketServiceImpl extends BaseService<FirefightersJacke
@Autowired
private EquipFeignClient equipFeignClient;
@Autowired
private FirefightersJacketMapper firefightersJacketMapper;
@Override
public List<Map<String, Object>> getPersonEquipCount() {
return firefightersJacketMapper.getPersonEquipCount();
}
@Override
public ResponseModel<Page<Object>> getAirEquipSpecificPage(EquipSpecificDto equipSpecificDto, int current, int size) {
......@@ -47,9 +54,15 @@ public class FirefightersJacketServiceImpl extends BaseService<FirefightersJacke
@Override
public boolean saveOrUpdateBatch(Long firefightersId, List<EquipmentOnCarDto> equipmentOnCarDtos) {
List<Long> ids = equipmentOnCarDtos.stream().map(EquipmentOnCarDto::getStockDetailId).collect(Collectors.toList());
List<Object> result = equipFeignClient.stockBindEquip(ids).getResult();
if (result.size() > 0) {
List<Map<String, Number>> stocks = new ArrayList<>();
for (EquipmentOnCarDto dto : equipmentOnCarDtos) {
stocks.add(new HashMap<String, Number>() {{
this.put("stockDetailId", dto.getStockDetailId());
this.put("amount", dto.getAmount());
}});
}
List<Object> result = equipFeignClient.stockBindEquip(stocks).getResult();
if (!result.isEmpty()) {
List<FirefightersJacket> firefightersJackets = new ArrayList<>();
equipmentOnCarDtos.forEach(x -> {
FirefightersJacket firefightersJacket = new FirefightersJacket();
......@@ -70,11 +83,13 @@ public class FirefightersJacketServiceImpl extends BaseService<FirefightersJacke
@Override
public boolean update(String type, FirefightersJacket firefightersJacket) {
ResponseModel<Object> objectResponseModel = null;
if (EquipTypeEnum.退装.getKey().equals(type)) {
objectResponseModel = equipFeignClient.scrapEquip(String.valueOf(firefightersJacket.getStockDetailId()));
} else if (EquipTypeEnum.回库.getKey().equals(type)) {
Map<String, Object> map = new HashMap<>();
map.put("firefightersId", firefightersJacket.getFirefightersId());
map.put("stockDetailId", firefightersJacket.getStockDetailId());
map.put("amount", firefightersJacket.getAmount());
if (EquipTypeEnum.报废.getKey().equals(type)) {
objectResponseModel = equipFeignClient.scrapEquip(map);
} else if (EquipTypeEnum.回库.getKey().equals(type)) {
objectResponseModel = equipFeignClient.stockEquip(map);
}
if (ValidationUtil.isEmpty(objectResponseModel)){
......
......@@ -51,7 +51,14 @@ public class FirestationJacketServiceImpl extends BaseService<FirestationJacketD
@Override
public boolean saveOrUpdateBatch(Long firefightersId, List<EquipmentOnCarDto> equipmentOnCarDtos) {
List<Long> ids = equipmentOnCarDtos.stream().map(EquipmentOnCarDto::getStockDetailId).collect(Collectors.toList());
List<Object> result = equipFeignClient.stockBindEquip(ids).getResult();
List<Map<String, Number>> stocks = new ArrayList<>();
for (EquipmentOnCarDto dto : equipmentOnCarDtos) {
stocks.add(new HashMap<String, Number>() {{
this.put("id", dto.getStockDetailId());
this.put("amount", dto.getAmount());
}});
}
List<Object> result = equipFeignClient.stockBindEquip(stocks).getResult();
if (result.size() > 0) {
List<FirestationJacket> firefightersJackets = new ArrayList<>();
equipmentOnCarDtos.forEach(x -> {
......@@ -73,11 +80,13 @@ public class FirestationJacketServiceImpl extends BaseService<FirestationJacketD
@Override
public boolean update(String type, FirestationJacket firestationJacket) {
ResponseModel<Object> objectResponseModel = null;
if (EquipTypeEnum.退装.getKey().equals(type)) {
objectResponseModel = equipFeignClient.scrapEquip(String.valueOf(firestationJacket.getStockDetailId()));
} else if (EquipTypeEnum.回库.getKey().equals(type)) {
Map<String, Object> map = new HashMap<>();
map.put("firefightersId", firestationJacket.getFirefightersId());
map.put("stockDetailId", firestationJacket.getStockDetailId());
map.put("amount", firestationJacket.getAmount());
if (EquipTypeEnum.报废.getKey().equals(type)) {
objectResponseModel = equipFeignClient.scrapEquip(map);
} else if (EquipTypeEnum.回库.getKey().equals(type)) {
objectResponseModel = equipFeignClient.stockEquip(map);
}
if (ValidationUtil.isEmpty(objectResponseModel)){
......@@ -87,6 +96,7 @@ public class FirestationJacketServiceImpl extends BaseService<FirestationJacketD
return true;
}
@Override
public ResponseModel<Object> getEquipByStockDetailId(Long stockDetailId) {
return equipFeignClient.getAirEquipSpecificDetail(stockDetailId);
......
//package com.yeejoin.amos.knowledgebase.config;
//
//import com.baomidou.mybatisplus.core.toolkit.Sequence;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
///**
// * @author 杨博超
// * @ClassName Config
// * @Deacription TODO
// **/
//@Configuration
//public class Config {
//
// @Bean
// public Sequence sequence() {
// return new Sequence();
// }
//}
......@@ -1127,4 +1127,51 @@
ALTER TABLE `wl_equipment_specific` ADD COLUMN `type_code` VARCHAR (50) NULL COMMENT '指标类型编码';
</sql>
</changeSet>
<changeSet author="keyong" id="168623557">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_equipment_specific_index" columnName="event_address"/>
</not>
</preConditions>
<comment>新增属性字段event_address</comment>
<sql>
alter table `wl_equipment_specific_index` add column `event_address` varchar(250) DEFAULT NULL COMMENT '信号的索引键key,用于唯一索引信号';
</sql>
</changeSet>
<changeSet author="keyong" id="168623599">
<preConditions onFail="MARK_RAN">
<tableExists tableName="wl_car" />
</preConditions>
<comment>新增属性数据</comment>
<sql>
alter table `wl_car` add column `max_speed` double(10,2) DEFAULT NULL COMMENT '速度阈值';
alter table `wl_car` add column `phone` varchar(50) DEFAULT NULL COMMENT '联系电话';
alter table `wl_car` add column `driver` varchar(250) DEFAULT NULL COMMENT '司机';
</sql>
</changeSet>
<changeSet author="keyong" id="168623588">
<preConditions onFail="MARK_RAN">
<tableExists tableName="wl_equipment_category" />
</preConditions>
<comment>新增属性数据</comment>
<sql>
INSERT INTO `wl_equipment_category`(`id`, `parent_id`, `code`, `name`, `is_consumptive`, `description`, `remark`, `create_date`, `industry_code`, `image`) VALUES (860, '123', '21030000', '消防坦克', 0, NULL, '初始导入', '2024-05-23 15:59:42', '2', NULL);
DELETE FROM `wl_equipment_category` WHERE id = 759;
</sql>
</changeSet>
<changeSet author="keyong" id="1694056788">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_car" columnName="use_type"/>
</not>
</preConditions>
<comment>新增字段 type_code</comment>
<sql>
alter table `wl_car` add column `use_type` varchar(20) DEFAULT '自购' COMMENT '使用方式';
UPDATE `wl_car` wc SET wc.use_type = '自购';
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -109,4 +109,69 @@
-- AND DATE_SUB(CURDATE( ), INTERVAL 7 DAY ) > update_date
</select>
<select id="getTankAndFireCarNum" resultType="Map">
SELECT
*
FROM
(
SELECT
'消防车' AS `name`,
count( 1 ) AS `value`,
'辆' AS unit,
IFNULL(( SELECT IFNULL( shbz_img, img ) AS img FROM wl_equipment WHERE `code` LIKE CONCAT( '21010000', '%' ) LIMIT 1 ), '') AS icon,
'2101' as code
FROM
`wl_car` wc
LEFT JOIN wl_equipment we ON we.`id` = wc.equipment_id
LEFT JOIN wl_equipment_category wec ON wec.id = we.category_id
WHERE
LEFT ( wec.`code`, 4 ) = '2101'
<if test="bizOrgCode != null and bizOrgCode != ''">
AND wc.biz_org_code like concat (#{bizOrgCode},'%')
</if>
UNION ALL
SELECT
'消防坦克' AS `name`,
count( 1 ) AS `value`,
'辆' AS unit,
IFNULL(( SELECT IFNULL( img, shbz_img ) AS img FROM wl_equipment WHERE `code` LIKE CONCAT( '21030000', '%' ) LIMIT 1 ), '') AS icon,
'2103' as code
FROM
`wl_car` wc
LEFT JOIN wl_equipment we ON we.`id` = wc.equipment_id
LEFT JOIN wl_equipment_category wec ON wec.id = we.category_id
WHERE
LEFT ( wec.`code`, 4 ) = '2103'
<if test="bizOrgCode != null and bizOrgCode != ''">
AND wc.biz_org_code like concat (#{bizOrgCode},'%')
</if>
) a
</select>
<select id="carListByPage" resultType="java.util.Map">
SELECT
wc.`name` AS `name`,
wc.biz_org_code AS bizOrgCode,
wc.biz_org_name AS bizOrgName,
wec.`name` AS categoryName,
wc.equip_status AS equipStatus,
wc.id AS id,
wec.`code` AS `code`
FROM
wl_car wc
LEFT JOIN wl_equipment we ON we.`id` = wc.equipment_id
LEFT JOIN wl_equipment_category wec ON wec.id = we.category_id
<where>
<if test="dto.bizOrgCode != null and dto.bizOrgCode != ''">
wc.biz_org_code like concat (#{dto.bizOrgCode},'%')
</if>
<if test="dto.code != null and dto.code != ''">
AND wec.code like concat (#{dto.code},'%')
</if>
<if test="dto.equipStatusFilter != null and dto.equipStatusFilter != ''">
AND wc.equip_status = #{dto.equipStatusFilter}
</if>
ORDER BY wc.equip_status DESC
</where>
</select>
</mapper>
......@@ -109,6 +109,27 @@
AND code like CONCAT('%',#{code},'%')
</if>
</select>
<select id="getEquipmentCount" resultType="Map">
SELECT
we.id AS equipmentId,
we.name AS equipmentName,
wesp.system_id AS systemId,
count(1) AS count,
u.name AS unit
FROM
wl_equipment_specific wesp
LEFT JOIN wl_equipment_detail wsd ON wesp.equipment_detail_id = wsd.id
LEFT JOIN wl_equipment we ON wsd.equipment_id = we.id
LEFT JOIN wl_unit u on u.id = we.unit_id
<where>
we.id IS NOT NULL AND wesp.system_id IS NOT NULL
<if test="bizOrgCode != null and bizOrgCode != ''">
AND wesp.biz_org_code like concat(#{bizOrgCode},'%')
</if>
</where>
GROUP BY
we.code, wesp.system_id
</select>
<select id="selectEquipmentSpecific" resultMap="ComplementCode">
SELECT
wesp.id id,
......@@ -2881,6 +2902,91 @@
</if>
</select>
<select id="getFireEquipStatistic" resultType="Map">
SELECT
a.`name` AS `name`,
wes.equipment_code AS `code`,
COUNT(1) AS `value`,
IFNULL(wu.`name`, '') AS unit,
IFNULL(IF(a.shbz_img IS NOT NULL, a.shbz_img, a.img), '') AS icon
FROM
wl_equipment_specific wes
LEFT JOIN (SELECT id, `code`, `name`, img, shbz_img, unit_id FROM wl_equipment WHERE LEFT(`code`, 1) IN (1, 3, 4, 5, 6, 7, 8)) a ON a.`code` = wes.equipment_code
LEFT JOIN wl_unit wu ON wu.id = a.unit_id
WHERE
a.`name` IS NOT NULL
<if test="bizOrgCode != null and bizOrgCode != ''">
AND wes.biz_org_code like concat (#{bizOrgCode},'%')
</if>
GROUP BY
wes.equipment_code
</select>
<select id="getFireEquipListByDefineCode" resultType="Map">
SELECT
wes.id AS specificId,
a.`name` AS `typeName`,
wes.biz_org_name AS bizOrgName,
wes.biz_org_code AS bizOrgCode,
wes.`name` AS `name`,
wes.equip_status AS equipStatus
FROM
wl_equipment_specific wes
LEFT JOIN (SELECT id, `code`, `name`, img, shbz_img, unit_id FROM wl_equipment WHERE LEFT(`code`, 1) IN (1, 3, 4, 5, 6, 7, 8)) a ON a.`code` = wes.equipment_code
<where>
<if test="code != null and code != ''">
wes.equipment_code = #{code}
</if>
<if test="equipStatus != null and equipStatus != ''">
AND wes.equip_status = #{equipStatus}
</if>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND wes.biz_org_code like concat (#{bizOrgCode},'%')
</if>
ORDER BY wes.equip_status DESC
</where>
LIMIT #{offset}, #{size}
</select>
<select id="count" resultType="Integer">
SELECT
count(1)
FROM
wl_equipment_specific wes
LEFT JOIN (SELECT id, `code`, `name`, img, shbz_img, unit_id FROM wl_equipment WHERE LEFT(`code`, 1) IN (1, 3, 4, 5, 6, 7, 8)) a ON a.`code` = wes.equipment_code
<where>
<if test="code != null and code != ''">
wes.equipment_code = #{code}
</if>
<if test="equipStatus != null and equipStatus != ''">
AND wes.equip_status = #{equipStatus}
</if>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND wes.biz_org_code like concat (#{bizOrgCode},'%')
</if>
</where>
</select>
<select id="selectEquipmentCountBySystemId" resultType="int">
SELECT
es.id,
es.name,
es.biz_org_name bizOrgName,
es.code,
es.position,
ed.standard,
DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE ) AS dayNum
FROM
wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON ed.id = es.equipment_detail_id
LEFT JOIN wl_equipment e ON ed.equipment_id = e.id
LEFT JOIN wl_stock_detail sd ON sd.equipment_detail_id = ed.id
WHERE
ed.production_date IS NOT NULL
AND e.expiry_date IS NOT NULL
<if test="bussIds != null and bussIds != ''">
And find_in_set(es.id, #{bussIds}) > 0
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -14,6 +14,7 @@
<result property="equipmentName" column="equipment_name"></result>
<result property="equipmentNum" column="num"></result>
<result property="unitName" column="unit_name"></result>
<result property="img" column="img"></result>
</resultMap>
<resultMap id="CategoryAmountList" type="com.yeejoin.equipmanage.common.entity.vo.EquipTypeImgAmountVO">
<result column="id" property="id"></result>
......@@ -95,9 +96,28 @@
<select id="getEquipCountBySystemId" resultMap="EquipCountBySystemId">
SELECT
wle.id equipment_id,
det.NAME equipment_name,
wle.NAME equipment_name,
count(spe.id) num,
unit.name unit_name,
wle.shbz_img img,
cate.NAME AS equipmentCateGoryName
FROM
wl_equipment_specific AS spe
LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id
LEFT JOIN wl_equipment AS wle ON wle.id = det.equipment_id
LEFT JOIN wl_equipment_category cate ON cate.id = wle.category_id
LEFT JOIN wl_unit as unit ON wle.unit_id = unit.id
where
find_in_set(#{systemId},spe.system_id) and spe.single = true
group by wle.id
</select>
<select id="getEquipCountPageBySystemId" resultMap="EquipCountBySystemId">
SELECT
wle.id equipment_id,
wle.NAME equipment_name,
count(spe.id) num,
unit.name unit_name,
wle.shbz_img img,
cate.NAME AS equipmentCateGoryName
FROM
wl_equipment_specific AS spe
......@@ -719,7 +739,17 @@
f_fire_fighting_system fffs
LEFT JOIN wl_equipment_category wlec ON fffs.system_type = wlec.id
left join wl_manufacturer_info wlmi on wlmi.id=fffs.maintenance_unit
left join wl_manufacturer_info wlmi1 on wlmi1.id=fffs.construction_unit) a where a.id=#{id} order by sort
left join wl_manufacturer_info wlmi1 on wlmi1.id=fffs.construction_unit
UNION ALL
SELECT
fffs.id,
'保护区域' AS `key`,
pro_object AS value,
false as isHref,
9 as sort
FROM
f_fire_fighting_system fffs
) a where a.id=#{id} order by sort
</select>
<select id="getEquipmentAlarmBySystemIdOrSourceIdVO"
resultType="com.yeejoin.equipmanage.common.entity.vo.EquipmentAlarmBySystemIdOrSourceIdVO">
......@@ -2070,6 +2100,7 @@
<select id="getColaCategoryAmountEquList" resultMap="CategoryAmountList">
SELECT
......@@ -2104,7 +2135,9 @@
wled.code as eqtype,
wles.biz_org_code as bizOrgCode,
wles.biz_org_name as bizOrgName,
wles.equip_status as equipStatus
wles.equip_status as equipStatus,
wec.industry_code as industryCode,
wle.is_iot as wleIsIot
FROM
(select id,name,qr_code,code ,iot_code ,biz_org_code,team_id ,biz_org_name,create_date ,equipment_detail_id ,system_id,equip_status from wl_equipment_specific) wles
LEFT JOIN (select id,amount,status,equipment_specific_id,warehouse_structure_id from wl_stock_detail ) wlsd on wlsd.equipment_specific_id = wles.id
......@@ -2119,9 +2152,7 @@
and LEFT (wle.CODE, #{hierarchy}) = #{codeHead}
<!-- and wec.`code` like concat(#{codeHead}, '%')-->
</if>
<if test="equipTypeAmountPage.industryCode!=null">
and wec.industry_code = #{equipTypeAmountPage.industryCode}
</if>
<if test="equipTypeAmountPage.teamId!=null">
and wles.team_id = #{equipTypeAmountPage.teamId}
</if>
......@@ -2146,9 +2177,7 @@
<if test="equipTypeAmountPage.status == 1">
and wlsd.warehouse_structure_id is null
</if>
<if test="equipTypeAmountPage.isIot!=null">
and wle.is_iot=#{equipTypeAmountPage.isIot}
</if>
<if test="equipTypeAmountPage.status == 0">
and wlsd.warehouse_structure_id is not null
</if>
......@@ -2171,9 +2200,18 @@
<if test="equipTypeAmountPage.bizOrgCode!=null and equipTypeAmountPage.bizOrgCode!=''">
AND wles.biz_org_code LIKE CONCAT(#{equipTypeAmountPage.bizOrgCode},'%')
</if>
group by wles.id
having 1 = 1
<if test="equipTypeAmountPage.industryCode!=null">
AND industryCode = #{equipTypeAmountPage.industryCode}
</if>
<if test="equipTypeAmountPage.isIot!=null">
AND wleIsIot = #{equipTypeAmountPage.isIot}
</if>
order by createDate DESC
</select>
<select id="listByBizOrgCode" resultType="java.util.Map">
SELECT
form_group_id typeId,
......
<?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>
<if test="dto.equipModelId != null">
AND `equip_model_id` = #{dto.equipModelId}
</if>
</where>
ORDER BY create_date DESC
</select>
<select id="countSpareEquip" resultType="java.util.Map">
select
a.equip_model_name AS `name`,
sum( a.stock_num ) AS `value`,
a.unit AS unit,
IFNULL( ifnull( b.img, b.shbz_img ), '' ) AS icon,
a.equip_model_id AS equipmentModelId,
a.equip_model_code AS equipmentModelCode
FROM
wl_spare_equipment a
LEFT JOIN wl_equipment b ON b.id = a.equip_model_id
<where>
a.is_delete = 0
<if test="bizOrgCode != '' and bizOrgCode != null">
AND a.`biz_org_code` LIKE concat(#{bizOrgCode}, '%')
</if>
</where>
GROUP BY
a.equip_model_id
HAVING
sum( a.stock_num ) != 0
</select>
<select id="exportList" 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>
<if test="dto.equipModelId != null">
AND `equip_model_id` = #{dto.equipModelId}
</if>
</where>
ORDER BY create_date DESC
</select>
</mapper>
......@@ -249,7 +249,7 @@ public class KafkaConsumerService {
*
* @param message 消息
*/
@KafkaListener(id = "consumerSingle", 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) {
JSONObject messageObj = JSONObject.fromObject(message);
try {
......
......@@ -100,7 +100,7 @@ emqx.max-inflight=1000
kafka.topics=JKXT2BP-XFZX-Topic
#\u9700\u8981\u76D1\u542C\u5F97eqm\u6D88\u606F\u4E3B\u9898 \u6839\u636E\u662F\u5426\u662F\u4E2D\u5FC3\u6781\u548C\u7AD9\u7AEF\u9009\u62E9\u9700\u8981\u76D1\u542C\u5F97\u4E3B\u9898\u8FDB\u884C\u914D\u7F6E emq.iot.created,
emq.topic=emq.xf.created,emq.iot.created,emq.patrol.created,emq.sign.created,emq.bussSign.created,emq.user.created,emq.risk.created,emq.mcb.zxj,emq.scrap.qrcode.put
emq.topic=emq.xf.created,emq.iot.created,emq.patrol.created,emq.sign.created,emq.bussSign.created,emq.user.created,emq.risk.created,emq.mcb.zxj,emq.scrap.qrcode.put,equip/scrap/put/zxj
##\u4E2D\u5FC3\u7EA7\u914D\u7F6E\u914D\u7F6E
##\u9700\u8981\u76D1\u542C\u5F97kafka\u6D88\u606F\u4E3B\u9898 \u6839\u636E\u662F\u5426\u662F\u4E2D\u5FC3\u6781\u548C\u7AD9\u7AEF\u9009\u62E9\u9700\u8981\u76D1\u542C\u5F97\u4E3B\u9898\u8FDB\u884C\u914D\u7F6E
......@@ -114,3 +114,5 @@ kafka.auto-startup=false
#浜嬩欢鍛婅瀵规帴Kafka涓婚
queue.kafka.eventAlarm.topics=JKXT2BP-GJ-Topic-site
kafka.station.groupId=shaoxing
......@@ -80,4 +80,10 @@
"emqTopic": "emq.risk.qrcode.put",
"akkaTopic": "JKXT2BP-XFZX-Topic"
}
,
{
"code": "scrapPut",
"emqTopic": "equip/scrap/put/zxj",
"akkaTopic": "JKXT2BP-XFYY-Topic"
}
]
\ No newline at end of file
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