Commit e7f81c0b authored by chenzhao's avatar chenzhao

Merge branch 'develop_dl_plan6_temp' of…

Merge branch 'develop_dl_plan6_temp' of http://39.98.45.134:8090/moa/amos-boot-biz into develop_dl_plan6_temp
parents 5b1bef51 9e46aa4e
......@@ -6,6 +6,20 @@
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
<option name="ignoredFiles">
<set>
<option value="$PROJECT_DIR$/amos-boot-data/amos-boot-data-accessapi/pom.xml" />
<option value="$PROJECT_DIR$/amos-boot-module/amos-boot-module-api/amos-boot-module-kgd-api/pom.xml" />
<option value="$PROJECT_DIR$/amos-boot-module/amos-boot-module-biz/amos-boot-module-kgd-biz/pom.xml" />
<option value="$PROJECT_DIR$/amos-boot-system-cas/amos-boot-module-cas-api/pom.xml" />
<option value="$PROJECT_DIR$/amos-boot-system-cas/amos-boot-module-cas-biz/pom.xml" />
<option value="$PROJECT_DIR$/amos-boot-system-cas/pom.xml" />
<option value="$PROJECT_DIR$/amos-boot-system-kgd/pom.xml" />
<option value="$PROJECT_DIR$/amos-boot-system-tdc/amos-boot-module-tdc-api/pom.xml" />
<option value="$PROJECT_DIR$/amos-boot-system-tdc/amos-boot-module-tdc-biz/pom.xml" />
<option value="$PROJECT_DIR$/amos-boot-system-tdc/pom.xml" />
</set>
</option>
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/classes" />
......
......@@ -45,5 +45,16 @@
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".apt_generated">
<attributes>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path=".apt_generated_tests">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
package com.yeejoin.amos.boot.biz.common.aop;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.DepartmentBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.bo.RoleBo;
import com.yeejoin.amos.boot.biz.common.interceptors.PermissionInterceptor;
import com.yeejoin.amos.boot.biz.common.interceptors.PermissionInterceptorContext;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.ObjectUtils;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
......@@ -34,10 +25,22 @@ import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.DepartmentBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.bo.RoleBo;
import com.yeejoin.amos.boot.biz.common.interceptors.PermissionInterceptorContext;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
/**
* controller层切面 用于用户数据缓存 供 sql自动填充使用
......@@ -155,6 +158,11 @@ public class ControllerAop {
} else {
roleM = roles.get(sequenceNbr).get(0);
}
if(companyM!=null&&companyM.getRegionSeq()!=null)
{
FeignClientResult<RegionModel> result = Systemctl.regionClient.getRegion(Long.valueOf(companyM.getRegionSeq()));
company.setRegionCode(String.valueOf(result.getResult().getRegionCode()));
}
Bean.copyExistPropertis(roleM, role);
ReginParams reginParams = new ReginParams();
reginParams.setCompany(company);
......
......@@ -19,6 +19,7 @@ public class CompanyBo {
private String orgCode;
private Long parentId;
private Long sequenceNbr;
private String regionCode;
private List<CompanyBo> children;
public String getAddress() {
......@@ -116,4 +117,13 @@ public class CompanyBo {
public void setChildren(List<CompanyBo> children) {
this.children = children;
}
public String getRegionCode() {
return regionCode;
}
public void setRegionCode(String regionCode) {
this.regionCode = regionCode;
}
}
......@@ -44,4 +44,5 @@ public class BaseDto implements Serializable{
private Boolean isDelete=false;
}
......@@ -97,7 +97,7 @@ public class BusinessController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = true)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/getData", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取map", notes = "获取map")
@RestEventTrigger(value = "openapiLogEventHandler")
......
......@@ -12,6 +12,7 @@ import com.csoft.sdk.domain.response.CsoftDataApiXixianGetzhutiinfoResponse;
import com.yeejoin.amos.api.openapi.face.orm.dao.DataDictionaryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.alibaba.fastjson.JSONArray;
......@@ -57,7 +58,10 @@ public class TaBusinessServiceImpl extends BaseService<TaAccessConfigModel, TaAc
System.out.println(response.getResult());
JSONObject jsonObject = JSONObject.parseObject(response.getData());
JSONObject data = jsonObject.getJSONObject("data");
//如果不存在该企业 则直接返回null
if(ValidationUtil.isEmpty(data)){
return null;
}
//分割字符串 根据详细地址分割出 省/市/区、街道地址、小区地址
String address = data.getString("dom");
String area = address.substring(0,address.indexOf("区")+1);
......
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".apt_generated">
<attributes>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path=".apt_generated_tests">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
......@@ -9,4 +9,21 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>amos-boot-module-ccs-api</artifactId>
<dependencies>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-component-emq</artifactId>
<version>1.1.20</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -142,8 +142,8 @@ public class OrgUsrFireExcelDto extends BaseDto {
@ExcelProperty(value = "出生日期", index = 17)
@ApiModelProperty(value = "出生日期")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
// @DateTimeFormat(pattern = "yyyy-MM-dd") 此注解用于此处不起任何作用 --ky20220918
// @JsonFormat(pattern = "yyyy-MM-dd")
private String birthdayTime;
@ExplicitConstraint(indexNum = 18, sourceClass = CommonExplicitConstraint.class, method = "getMaritalStatus") //固定下拉内容
......
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.common.api.dto;
import com.yeejoin.amos.boot.module.common.api.entity.Firefighters;
import com.yeejoin.amos.boot.module.common.api.entity.FirefightersContacts;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsrAgencyUser;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -18,6 +19,9 @@ public class PeopleInfoDto {
@ApiModelProperty(value = "联系人信息")
private FirefightersContacts firefightersContacts;
@ApiModelProperty(value = "账户信息")
private OrgUsrAgencyUser orgUsrAgencyUser;
@ApiModelProperty(value = "岗位页签")
private FirefightersDataDto postEduDtoObj;
......
......@@ -24,8 +24,9 @@ public class OrgUsrAgencyUser extends BaseEntity {
/**
* 用户名
*/
@TableField("user_name")
private String userName;
@TableField("usr_name")
private String usrName;
/**
* 手机号
......@@ -57,4 +58,10 @@ public class OrgUsrAgencyUser extends BaseEntity {
@TableField("amos_user_id")
private String amosUserId;
@TableField(exist = false)
private String upPassWord;
@TableField(exist = false)
private String upAmosUser;
}
......@@ -65,6 +65,12 @@ public interface DutyPersonShiftMapper extends BaseMapper<DutyPersonShift> {
@Param("dutyDate") String dutyDate,
@Param("groupCode") String groupCode
);
List<Map<String, Object>> newStationViewDataByFieldCode(
@Param("dutyDate") String dutyDate,
@Param("groupCode") String groupCode,
@Param("fieldCode") String fieldCode
);
/**
* 利用mysql 生成连续时间区间
*
......@@ -123,7 +129,7 @@ public interface DutyPersonShiftMapper extends BaseMapper<DutyPersonShift> {
* @param instanceIds
* @return
*/
List<Map<String, Object>> getPositionStaffDutyForSpecifyDate(String dutyDate,String groupCode,String[] instanceIds,String duty);
List<Map<String, Object>> getPositionStaffDutyForSpecifyDate(String dutyDate,String groupCode,String[] instanceIds,String duty, String fieldCode);
/**
......
......@@ -50,4 +50,6 @@ public interface WaterResourceMapper extends BaseMapper<WaterResource> {
Long sequenceNbr, String equipId,String bizOrgCode, String equipCateGoryCode,List<String> ids,String companyId);
List<Map<String, Object>> getWaterTypeByBizOrgCode(String bizOrgCode);
}
Page<WaterResourceDto> pageByDefect(Page<WaterResourceDto> page, @Param("nameOrCode") String nameOrCode, @Param("bizOrgCode") String bizOrgCode);
}
......@@ -32,12 +32,14 @@ public interface IDutyCommonService {
List<Map<String, Object>> statisticsDay(String beginDate, String endDate) throws ParseException;
/**
* 新值班月视图
*
* @param beginDate
* @param endDate
* @param dutyType
* @return
* @throws ParseException
*/
List<Map<String, Object>> newStatisticsDay(String beginDate, String endDate) throws ParseException;
List<Map<String, Object>> newStatisticsDay(String beginDate, String endDate, String fieldCode) throws ParseException;
/**
* 不分页查询
*
......@@ -128,5 +130,5 @@ public interface IDutyCommonService {
*/
public void insertPersonShift(Long instanceId, List<DutyPersonShiftDto> dutyShiftList);
public Object getSchedulingDutyForSpecifyDate(String dutyDay, Long shiftId, String postType);
public Object getSchedulingDutyForSpecifyDate(String dutyDay, Long shiftId, String postType, String fieldCode);
}
......@@ -102,6 +102,21 @@
and i.group_code =#{groupCode}
GROUP BY i.field_value
</select>
<select id="newStationViewDataByFieldCode" resultType="java.util.Map">
select
i.field_value as postTypeName,
count(1) as total
from
cb_duty_person_shift s,
cb_dynamic_form_instance i
where
s.instance_id = i.instance_id
and i.field_code = #{fieldCode}
AND s.duty_date = #{dutyDate}
AND s.shift_id is not null
and i.group_code =#{groupCode}
GROUP BY i.field_value
</select>
<select id="genRangeDate" resultType="map">
SELECT
DATE_FORMAT(DATE( DATE_ADD( #{beginDate}, INTERVAL @s DAY )),'%Y-%m-%d') AS date,
......@@ -328,12 +343,24 @@ FROM
cd.FIELD_VALUE
END
) AS 'userName',
MAX(
CASE
WHEN cd.FIELD_CODE = 'postTypeName' THEN
<choose>
<when test="fieldCode != null and fieldCode != ''">
MAX(
CASE
WHEN cd.FIELD_CODE = #{fieldCode} THEN
cd.FIELD_VALUE
END
) AS 'postTypeName',
END
) AS 'postTypeName',
</when>
<otherwise>
MAX(
CASE
WHEN cd.FIELD_CODE = 'postTypeName' THEN
cd.FIELD_VALUE
END
) AS 'postTypeName',
</otherwise>
</choose>
cd.instance_id
FROM
cb_dynamic_form_instance cd
......
......@@ -407,9 +407,9 @@ LEFT JOIN cb_fire_team cft ON cff.fire_team_id = cft.sequence_nbr
AND type = 'RYZT'
) AS stateCode,
fp.employee_hierarchy,
cast(b.birthdayTime as datetime) as birthdayTime,
b.*,
fw.*
fw.*,
DATE_FORMAT(b.birthdayTime,'%Y-%m-%d') AS birthdaryTime
from cb_org_usr a LEFT JOIN
(SELECT
instance_id,
......@@ -427,7 +427,7 @@ LEFT JOIN cb_fire_team cft ON cff.fire_team_id = cft.sequence_nbr
max(case field_code when 'telephone' then field_value end) telephone,
max(case field_code when 'peopleType' then field_value end) peopleType,
max(case field_code when 'nation' then field_value end) nation,
max(case field_code when 'birthdayTime' then field_value end) birthdayTime,
max( CASE field_code WHEN 'birthdayTime' THEN DATE_FORMAT(field_value, '%Y-%m-%d') END ) birthdayTime,
max(case field_code when 'maritalStatus' then field_value end) maritalStatus,
max(case field_code when 'nativePlace' then field_value end) nativePlace,
max(case field_code when 'nativePlaceVal' then field_value end) nativePlaceVal,
......
......@@ -151,6 +151,9 @@
<if test="map.company != null and map.company != '-1'">
AND u.parent_id = #{map.company}
</if>
<if test="map.positionType != null and map.positionType != ''">
AND AND FIND_IN_SET(#{positionType},g.positionType)
</if>
GROUP BY
u.sequence_nbr ,
u.biz_org_name ,
......@@ -198,7 +201,7 @@
LEFT JOIN cb_dynamic_form_column f ON f.sequence_nbr = v.form_column_id
where u.parent_id = #{parentId}
AND u.biz_org_type = #{bizOrgType}
AND U.is_delete = 0
AND u.is_delete = 0
GROUP BY
u.sequence_nbr ,
u.biz_org_name ,
......
......@@ -186,4 +186,10 @@
</select>
<select id="pageByDefect" resultType="com.yeejoin.amos.boot.module.common.api.dto.WaterResourceDto">
select * from cb_water_resource where is_delete = 1
<if test="nameOrCode != null and nameOrCode != ''">and (name like concat('%', #{nameOrCode}, '%') or equip_code like concat('%', #{nameOrCode}, '%'))</if>
<if test="bizOrgCode != null and bizOrgCode != ''">and biz_org_code like concat( #{bizOrgCode}, '%')</if>
order by cb_water_resource.rec_date desc
</select>
</mapper>
......@@ -61,7 +61,11 @@ public class EquipmentCategory extends BaseEntity implements TreeNode<EquipmentC
@TableField(exist=false)
@ApiModelProperty(value = "级别")
private String level;
@TableField(exist = false)
@ApiModelProperty(value = "个数-巡检树用")
private Integer patrolNum;
@TableField(exist=false)
@ApiModelProperty(value = "个数")
private Double count;
......
package com.yeejoin.equipmanage.common.entity;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
......@@ -93,12 +94,12 @@ public class EquipmentDetail extends BaseEntity {
@ApiModelProperty(value = "合同编号")
private String contractCode;
@TableField("production_date")
@TableField(value = "production_date", updateStrategy = FieldStrategy.IGNORED)
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "生产日期")
private Date productionDate;
@TableField("delivery_date")
@TableField(value = "delivery_date", updateStrategy = FieldStrategy.IGNORED)
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "投运日期")
private Date deliveryDate;
......
......@@ -86,26 +86,27 @@ public class EquipmentSpecificAlarm extends BaseEntity {
private Long equipmentIndexId;
@ApiModelProperty(value = "确认类型")
@TableField("confirm_type")
@TableField(exist = false)
private String confirmType;
@ApiModelProperty(value = "报警原因")
@TableField("alam_reason")
@TableField(exist = false)
private String alamReason;
@ApiModelProperty(value = "处理情况")
@TableField("resolve_result")
@TableField(exist = false)
private String resolveResult;
@ApiModelProperty(value = "确警人员")
@TableField("confirm_user")
@TableField(exist = false)
private String confirmUser;
@ApiModelProperty(value = "确警人员姓名")
@TableField(exist = false)
private String confirmUserName;
@ApiModelProperty(value = "确警时间")
@TableField("confirm_date")
@TableField(exist = false)
private Date confirmDate;
@ApiModelProperty(value = "iot数据上报唯一id")
......
......@@ -133,4 +133,12 @@ public class FireFightingSystemEntity {
@ApiModelProperty(value = "分析报告统计用参数(为空不统计) ")
private String analysisIndexKey;
@ApiModelProperty(value = "责任单位")
private String designOrg;
@ApiModelProperty(value = "设计单位联系方式")
private String designOrgTelephone;
@ApiModelProperty(value = "主要设计人员")
private String leadDesigner;
}
......@@ -60,4 +60,10 @@ public class EquipTypeAmountPageDTO extends BaseDTO<EquipmentSpecific> {
@ApiModelProperty(value = "是否物联")
private String isIot;
@ApiModelProperty(value = "装备编码或名称")
private String nameOrCode;
@ApiModelProperty(value = "缺陷管理新增页面用,其余地方可忽略 1-是缺陷管理 0-不是")
private Integer isDefect;
}
......@@ -53,4 +53,6 @@ public class EquipTypeImgAmountVO {
@ApiModelProperty(value = "单位部门org")
private String bizOrgCode;
@ApiModelProperty(value = "所在建筑")
private String belongBuildName;
}
package com.yeejoin.equipmanage.common.entity.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author keyong
* @title: IdxBizDefectVo
* <pre>
* @description: TODO
* </pre>
* @date 2022/9/27 18:44
*/
@Data
public class IdxBizDefectVo {
private String id;
@ApiModelProperty(value = "缺陷等级1-一般 2-严重 3-危急")
private Integer defectLevel;
@ApiModelProperty(value = "缺陷设备ids")
private String defectEquipmentIds;
@ApiModelProperty(value = "缺陷设备名称")
private String defectEquipmentName;
@ApiModelProperty(value = "缺陷设备类型1-装备2-系统3-水源")
private Integer defectEquipmentType;
@ApiModelProperty(value = "缺陷描述")
private String defectDescribe;
@ApiModelProperty(value = "缺陷来源 1-巡查 2-维保 3-消防检测 4-其他")
private Integer defectResource;
@ApiModelProperty(value = "缺陷类型")
private String defectType;
@ApiModelProperty(value = "缺陷图片")
private String defectImg;
@ApiModelProperty(value = "发现日期")
private Date defectDiscoverDate;
@ApiModelProperty(value = "发现人")
private String defectDiscover;
@ApiModelProperty(value = "计划消缺日期")
private Date planClearDate;
@ApiModelProperty(value = "责任人")
private String defectResponsible;
@ApiModelProperty(value = "处理状态(0:未处理,1:已处理,2:处理中)")
private Integer defectStatus;
@ApiModelProperty(value = "是否需要停电处理(0:不需要,1:需要)")
private Integer isPowerCut;
@ApiModelProperty(value = "换流站名称")
private String bizOrgName;
@ApiModelProperty(value = "机构编码")
private String bizOrgCode;
@ApiModelProperty(value = "公司编码")
private String orgCode;
@ApiModelProperty(value = "添加时间")
private Date addTime;
@ApiModelProperty(value = "处理措施/处理情况")
private String handleSituation;
@ApiModelProperty(value = "处理-图片")
private String handleImg;
@ApiModelProperty(value = "工作票号")
private String handleWorkTicketNum;
@ApiModelProperty(value = "工作负责人")
private String handleWorkLeader;
@ApiModelProperty(value = "工作票是否已消号 1-已消号 0 -未消号")
private Integer handleWorkIdTicket;
@ApiModelProperty(value = "负责人检查日期")
private String handleLeaderDate;
@ApiModelProperty(value = "负责人")
private String handleLeader;
@ApiModelProperty(value = "消缺日期")
private Date handleClearDate;
@ApiModelProperty(value = "消缺人")
private String handleClearPerson;
@ApiModelProperty(value = "缺陷编号")
private String defectNum;
@ApiModelProperty(value = "超期提醒")
private String expiredWarning;
@ApiModelProperty(value = "缺陷状态【装备用】")
private String defectStatusName;
@ApiModelProperty(value = "告警id")
private String specificAlarmLogId;
}
......@@ -125,4 +125,6 @@ public class EquipmentManageVo implements Serializable {
private String controBoxBuildName;
private String controBoxBuildId;
private String address;
private String fullName;
}
......@@ -176,4 +176,16 @@ public class FireFightingSystemVo implements Serializable {
*/
private String bizOrgName;
/**
* 责任单位
*/
private String designOrg;
/**
* 主要设计人员
*/
private String leadDesigner;
private String designOrgTelephone;
}
......@@ -45,5 +45,16 @@
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".apt_generated">
<attributes>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path=".apt_generated_tests">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-api</artifactId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>amos-boot-module-kgd-api</artifactId>
<properties>
<tyboot.version>1.1.23-SNAPSHOT</tyboot.version>
</properties>
<dependencies>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-influxdb</artifactId>
<version>1.7.13-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-redis</artifactId>
<version>1.4.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-component-cache</artifactId>
<version>${tyboot.version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- j2cache 二级缓存 -->
<dependency>
<groupId>net.oschina.j2cache</groupId>
<artifactId>j2cache-spring-boot2-starter</artifactId>
<version>2.8.0-release</version>
</dependency>
<dependency>
<groupId>net.oschina.j2cache</groupId>
<artifactId>j2cache-core</artifactId>
<version>2.8.0-release</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-component-emq</artifactId>
<version>${tyboot.version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.yeejoin.amos.kgd.message;
public class Constant {
public static final String REGION = "REALTIME";
}
package com.yeejoin.amos.kgd.message;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.component.emq.EmqxListener;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.component.influxdb.InfluxDbConnection;
import com.yeejoin.amos.component.influxdb.InfluxdbUtil;
import com.yeejoin.amos.kgd.message.model.MessageModel;
import net.oschina.j2cache.CacheChannel;
import net.oschina.j2cache.CacheObject;
@Component
public class IOTPropertyMessageAction extends EmqxListener{
private InfluxDbConnection influxDbConnection;
private InfluxdbUtil influxdbUtil;
private CacheChannel cacheChannel;
public static final int threadNum = 5;
ExecutorService service = Executors.newFixedThreadPool(threadNum);
private static final BlockingQueue<MessageModel> blockingQueue = new LinkedBlockingQueue<MessageModel>();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
public IOTPropertyMessageAction(InfluxDbConnection influxDbConnection, InfluxdbUtil influxdbUtil, CacheChannel cacheChannel) {
this.influxDbConnection = influxDbConnection;
this.cacheChannel = cacheChannel;
this.influxdbUtil = influxdbUtil;
for (int i = 0; i < threadNum; i++) {
service.execute(task_runnable);
}
}
@Override
public void processMessage(String topic,MqttMessage mqttMessage) throws Exception {
MessageModel message = new MessageModel();
message.setPayload(mqttMessage.getPayload());
message.setTableName(topic.replace("/", "").replace("property", ""));
blockingQueue.add(message);
}
Runnable task_runnable = new Runnable() {
public void run() {
while (true) {
try {
MessageModel mqttMessage = blockingQueue.take();
String jsonStr = new String(mqttMessage.getPayload());
String tableName = mqttMessage.getTableName();
if ("iotlogs".contains(tableName)) {
continue;
}
Map<String, String> tagsMap = new HashMap<>();
tagsMap.put("iotCode", tableName);
Map<String, Object> fieldsMap = JSON.parseObject(jsonStr, Map.class);
String sql = "show field keys from " + tableName;
try {
List<Map<String, Object>> list = influxdbUtil.query(sql);
Map<String, Object> fieldsTempMap = new HashMap<>();
for (Map<String, Object> field : list) {
if (fieldsTempMap.containsKey(field.get("fieldKey").toString())) {
continue;
}
fieldsTempMap.put(field.get("fieldKey").toString(), field.get("fieldType").toString());
if (fieldsMap.containsKey(field.get("fieldKey"))) {
if ("integer".equals(field.get("fieldType").toString())) {
fieldsMap.put(field.get("fieldKey").toString(),
Integer.valueOf(fieldsMap.get(field.get("fieldKey")).toString()));
} else if ("float".equals(field.get("fieldType").toString())) {
fieldsMap.put(field.get("fieldKey").toString(),
Float.valueOf(fieldsMap.get(field.get("fieldKey")).toString()));
} else if ("double".equals(field.get("fieldType").toString())) {
fieldsMap.put(field.get("fieldKey").toString(),
Double.valueOf(fieldsMap.get(field.get("fieldKey")).toString()));
}
else {
if ("true".equals(fieldsMap.get(field.get("fieldKey")).toString().toLowerCase()) ||
"false".equals(fieldsMap.get(field.get("fieldKey")).toString().toLowerCase())) {
fieldsMap.put(field.get("fieldKey").toString(), Boolean.valueOf(fieldsMap.get(field.get("fieldKey")).toString()) ? 1 : 0);
} else {
fieldsMap.put(field.get("fieldKey").toString(),
fieldsMap.get(field.get("fieldKey")).toString());
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
fieldsMap.put("createdTime", simpleDateFormat.format(new Date()));
influxDbConnection.insert(tableName, tagsMap, fieldsMap);
CacheObject cacheObject = cacheChannel.get(Constant.REGION, tableName);
if (cacheObject.getValue() == null) {
cacheChannel.set(Constant.REGION, tableName, fieldsMap);
} else {
HashMap<String, Object> cacheData = (HashMap<String, Object>) cacheObject.getValue();
cacheData.putAll(fieldsMap);
cacheChannel.set(Constant.REGION, tableName, cacheData);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
};
}
package com.yeejoin.amos.kgd.message;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.component.emq.EmqxListener;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.component.influxdb.InfluxDbConnection;
import com.yeejoin.amos.component.influxdb.InfluxdbUtil;
import com.yeejoin.amos.kgd.message.model.MessageModel;
import net.oschina.j2cache.CacheChannel;
import net.oschina.j2cache.CacheObject;
@Component
public class MaasMessageAction extends EmqxListener{
private InfluxDbConnection influxDbConnection;
private InfluxdbUtil influxdbUtil;
private CacheChannel cacheChannel;
public static final int threadNum = 5;
ExecutorService service = Executors.newFixedThreadPool(threadNum);
private static final BlockingQueue<MessageModel> blockingQueue = new LinkedBlockingQueue<MessageModel>();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
public MaasMessageAction(InfluxDbConnection influxDbConnection, InfluxdbUtil influxdbUtil, CacheChannel cacheChannel) {
this.influxDbConnection = influxDbConnection;
this.cacheChannel = cacheChannel;
this.influxdbUtil = influxdbUtil;
for (int i = 0; i < threadNum; i++) {
service.execute(task_runnable);
}
}
@Override
public void processMessage(String topic,MqttMessage mqttMessage) throws Exception {
MessageModel message = new MessageModel();
message.setPayload(mqttMessage.getPayload());
message.setTableName(topic.replace("/", ""));
blockingQueue.add(message);
}
Runnable task_runnable = new Runnable() {
public void run() {
while (true) {
try {
MessageModel mqttMessage = blockingQueue.take();
String jsonStr = new String(mqttMessage.getPayload());
JSONObject data = JSONObject.parseObject(jsonStr);
String tableName = mqttMessage.getTableName();
Map<String, String> tagsMap = new HashMap<>();
Map<String, Object> fieldsMap = JSONObject.toJavaObject(data, HashMap.class);
String sql = "show field keys from " + tableName;
try {
List<Map<String, Object>> list = influxdbUtil.query(sql);
Map<String, Object> fieldsTempMap = new HashMap<>();
for (Map<String, Object> field : list) {
if (fieldsTempMap.containsKey(field.get("fieldKey").toString())) {
continue;
}
fieldsTempMap.put(field.get("fieldKey").toString(), field.get("fieldType").toString());
if (fieldsMap.containsKey(field.get("fieldKey"))) {
if ("integer".equals(field.get("fieldType").toString())) {
fieldsMap.put(field.get("fieldKey").toString(),
Integer.valueOf(fieldsMap.get(field.get("fieldKey")).toString()));
} else if ("float".equals(field.get("fieldType").toString())) {
fieldsMap.put(field.get("fieldKey").toString(),
Float.valueOf(fieldsMap.get(field.get("fieldKey")).toString()));
} else if ("double".equals(field.get("fieldType").toString())) {
fieldsMap.put(field.get("fieldKey").toString(),
Double.valueOf(fieldsMap.get(field.get("fieldKey")).toString()));
} else {
fieldsMap.put(field.get("fieldKey").toString(),
fieldsMap.get(field.get("fieldKey")).toString());
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
fieldsMap.put("createdTime", simpleDateFormat.format(new Date()));
influxDbConnection.insert(tableName, tagsMap, fieldsMap);
CacheObject cacheObject = cacheChannel.get(Constant.REGION, tableName);
if (cacheObject.getValue() == null) {
cacheChannel.set(Constant.REGION, tableName, fieldsMap);
} else {
HashMap<String, Object> cacheData = (HashMap<String, Object>) cacheObject.getValue();
cacheData.putAll(fieldsMap);
cacheChannel.set(Constant.REGION, tableName, cacheData);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
};
}
package com.yeejoin.amos.kgd.message;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Configuration;
import org.typroject.tyboot.component.emq.EmqKeeper;
@Configuration
public class MessageConfig implements ApplicationListener<ApplicationReadyEvent>{
@Autowired
private EmqKeeper emqKeeper;
@Autowired
IOTPropertyMessageAction propertyMessageAction;
@Autowired
MaasMessageAction maasMessageAction;
@Value("spring.application.name")
private String serviceName;
public static final Integer DEFAULT_QOS = 2;
@Override
public void onApplicationEvent(ApplicationReadyEvent event) {
try {
emqKeeper.subscript(Topic.IOT_PROPERTY_MESSAGE.getShareTopicStr(serviceName), DEFAULT_QOS, propertyMessageAction);
emqKeeper.subscript(Topic.MAAS_CALCULATION_RESULTS.getShareTopicStr(serviceName), DEFAULT_QOS, maasMessageAction);
} catch (Exception e) {
e.printStackTrace();
}
}
}
package com.yeejoin.amos.kgd.message;
public enum Topic {
MAAS_CALCULATION_RESULTS("maas/calculation/result"),
IOT_PROPERTY_MESSAGE("+/+/property"),
IOT_SHADOW_MESSAGE("+/+/shadow");
private String topicStr;
Topic(String topicStr) {
this.topicStr = topicStr;
}
public String getTopicStr() {
return topicStr;
}
public String getShareTopicStr(String groupName) {
String shareTopicStr = "$share/" + groupName.trim() + "/" + getTopicStr();
return shareTopicStr;
}
}
package com.yeejoin.amos.kgd.message.model;
import lombok.Data;
@Data
public class MessageModel {
private String tableName;
private byte[] payload;
}
package com.yeejoin.amos.kgd.service;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import com.yeejoin.amos.component.feign.model.Page;
import com.yeejoin.amos.component.influxdb.InfluxDbConnection;
import com.yeejoin.amos.component.influxdb.InfluxdbUtil;
import com.yeejoin.amos.kgd.message.Constant;
import net.oschina.j2cache.CacheChannel;
import net.oschina.j2cache.CacheObject;
@Component
public class LiveDataService {
private final Logger logger = LogManager.getLogger(LiveDataService.class);
@Autowired
private InfluxdbUtil influxdbUtil;
@Autowired
InfluxDbConnection influxDbConnection;
@Autowired
private CacheChannel cacheChannel;
public static final String SPACE = " ";
public static final String ASTERISK = "*";
public static final String DATE = "time";
public static final String COMMA = ",";
public static final String FROM = "FROM";
public static final String WHERE = "WHERE";
public static final String EQUALSIGN = "=";
public static final String AND = "AND";
public List queryHistoryDataForList(String tableName, String timeStart, String timeEnd, String fieldKeys, Map<String, Object> requestParams) {
StringBuffer sqlSb = new StringBuffer();
sqlSb.append("SELECT").append(SPACE);
if (ObjectUtils.isEmpty(fieldKeys)) {
sqlSb.append(SPACE).append(ASTERISK).append(SPACE);
} else {
fieldKeys = fieldKeys + ", createdTime ";
sqlSb.append(SPACE).append(fieldKeys).append(SPACE);
}
sqlSb.append(SPACE).append(FROM).append(SPACE);
sqlSb.append(tableName);
if (!ObjectUtils.isEmpty(requestParams)) {
sqlSb.append(SPACE).append(WHERE).append(SPACE);
sqlSb.append(DATE).append(">=").append("'").append(timeStart).append("'");
sqlSb.append(AND).append(DATE).append("<=").append("'").append(timeEnd).append("'");
Set<String> keys = requestParams.keySet();
StringBuffer whereSb = new StringBuffer();
for (String key : keys) {
whereSb.append(AND).append(SPACE).append(key).append(SPACE).append(EQUALSIGN).append(requestParams.get(key)).append(SPACE);
}
sqlSb.append(whereSb.toString());
}
sqlSb.append(SPACE).append("tz('Asia/Shanghai')");
List<Map<String, Object>> list = influxdbUtil.query(sqlSb.toString());
return list;
}
public Page<Map<String, Object>> queryHistoryDataForPage(String tableName, String timeStart, String timeEnd, String fieldKeys, Map<String, Object> requestParams, long current, long size) {
StringBuffer sqlSb = new StringBuffer();
StringBuffer countSb = new StringBuffer();
StringBuffer whereSb = new StringBuffer();
sqlSb.append("SELECT").append(SPACE);
if (ObjectUtils.isEmpty(fieldKeys)) {
sqlSb.append(SPACE).append(ASTERISK).append(SPACE);
} else {
fieldKeys = fieldKeys + ", createdTime ";
sqlSb.append(SPACE).append(fieldKeys).append(SPACE);
}
sqlSb.append(SPACE).append(FROM).append(SPACE);
sqlSb.append(tableName);
if (!ObjectUtils.isEmpty(requestParams)) {
whereSb.append(SPACE).append(WHERE).append(SPACE);
whereSb.append(DATE).append(">=").append("'").append(timeStart).append("'").append(SPACE);
whereSb.append(AND).append(SPACE).append(DATE).append("<=").append("'").append(timeEnd).append("'");
Set<String> keys = requestParams.keySet();
StringBuffer subWhereSb = new StringBuffer();
for (String key : keys) {
subWhereSb.append(AND).append(SPACE).append(key).append(SPACE).append(EQUALSIGN).append(requestParams.get(key)).append(SPACE);
}
whereSb.append(subWhereSb.toString());
}
sqlSb.append(" LIMIT ").append(size).append(" OFFSET ").append((current - 1) * size);
sqlSb.append(whereSb.toString());
sqlSb.append(SPACE).append("tz('Asia/Shanghai')");
countSb.append("SELECT COUNT(createdTime) FROM ").append(tableName);
countSb.append(whereSb.toString());
List<Map<String, Object>> count = influxdbUtil.query(countSb.toString());
List<Map<String, Object>> list = influxdbUtil.query(sqlSb.toString());
Page<Map<String, Object>> page = new Page<Map<String, Object>>();
page.setCurrent(current);
page.setSize(size);
page.setRecords(list);
page.setTotal((Double.valueOf(count.get(0).get("count").toString()).longValue()));
return page;
}
public Map<String, Object> queryrealTimeData(String tableName) {
CacheObject cacheObject = cacheChannel.get(Constant.REGION, tableName);
return (Map<String, Object>) cacheObject.getValue();
}
}
<?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.avic.face.orm.dao.AvicCustomPathMapper">
</mapper>
......@@ -28,5 +28,6 @@
<module>amos-boot-module-ccs-api</module>
<module>amos-boot-module-avic-api</module>
<module>amos-boot-module-precontrol-api</module>
<module>amos-boot-module-kgd-api</module>
</modules>
</project>
\ No newline at end of file
......@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.yeejoin.amos.boot.module.ccs.api.dto.FireStationInfoDto;
import com.yeejoin.amos.boot.module.ccs.api.entity.FireEquipmentSignalLog;
......@@ -17,12 +18,15 @@ import com.yeejoin.amos.boot.module.ccs.api.vo.RawDataVO;
import com.yeejoin.amos.boot.module.ccs.api.vo.ReceiveDataVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -43,6 +47,10 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Autowired
private FireEquipmentSignalLogMapper fireEquipmentSignalLogMapper;
@Autowired
protected EmqKeeper emqKeeper;
public static final String EMERGENCY_ALARM_DATA_REFRESH = "emergency/alarm/data/refresh";
//TODO 逻辑待补充
@Override
......@@ -92,6 +100,15 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
fireEquipmentSignalLog.setLng(oneByCode.getLng());
fireEquipmentSignalLog.setLat(oneByCode.getLat());
fireEquipmentSignalLogMapper.insert(fireEquipmentSignalLog);
// 发送mqtt消息--刷新应急指挥屏数据
HashMap<String, String> refresh = new HashMap<>();
refresh.put("uuId", String.valueOf(System.currentTimeMillis()));
try {
emqKeeper.getMqttClient().publish(EMERGENCY_ALARM_DATA_REFRESH, JSON.toJSONString(refresh).getBytes(), 0, false);
} catch (MqttException e) {
e.printStackTrace();
}
}
} else if (ObjectUtil.isNotEmpty(receiveData) && StrUtil.isNotEmpty(receiveData.getActive()) &&
"update".equals(receiveData.getActive()) && ObjectUtil.isNotEmpty(receiveData.getRawData()) && StrUtil.isNotEmpty(receiveData.getRawData().getEquipmentSpecificCode())) {
......@@ -102,6 +119,15 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
updateWrapper.lambda().eq(FireEquipmentSignalLog::getFireEquipmentMrid, rawData.getEquipmentSpecificCode())
.eq(FireEquipmentSignalLog::getFireEquipmentIndexKey, rawData.getEquipmentIndexKey());
fireEquipmentSignalLogServiceImpl.update(fireEquipmentSignalLog, updateWrapper);
// 发送mqtt消息--刷新应急指挥屏数据
HashMap<String, String> refresh = new HashMap<>();
refresh.put("uuId", String.valueOf(System.currentTimeMillis()));
try {
emqKeeper.getMqttClient().publish(EMERGENCY_ALARM_DATA_REFRESH, JSON.toJSONString(refresh).getBytes(), 0, false);
} catch (MqttException e) {
e.printStackTrace();
}
}
log.info(String.format("收到mqtt(警情)消息并处理完成:%s", message));
}
......
......@@ -103,9 +103,10 @@ public class DutyCarController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "新值班月视图", notes = "新值班月视图")
public ResponseModel<List<Map<String, Object>>> newDutyDetail(
@ApiParam(value = "开始日期", required = true) @RequestParam String beginDate,
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate,
@ApiParam(value = "属性编码") @RequestParam(required = false) String fieldCode
) throws ParseException {
return ResponseHelper.buildResponse(iDutyCarService.newStatisticsDay(beginDate, endDate));
return ResponseHelper.buildResponse(iDutyCarService.newStatisticsDay(beginDate, endDate, fieldCode));
}
/**
* 调班
......@@ -175,8 +176,9 @@ public class DutyCarController extends BaseController {
@GetMapping("/person/{dutyDay}/list")
public ResponseModel listDutyPerson(@ApiParam(value = "值班日期",required = true) @PathVariable String dutyDay,
@ApiParam(value = "班次id") @RequestParam(required = false) Long shiftId,
@ApiParam(value = "岗位") @RequestParam(required = false) String postType){
return ResponseHelper.buildResponse(iDutyCarService.getSchedulingDutyForSpecifyDate(dutyDay,shiftId,postType));
@ApiParam(value = "岗位") @RequestParam(required = false) String postType,
@ApiParam(value = "属性编码") @RequestParam(required = false) String fieldCode){
return ResponseHelper.buildResponse(iDutyCarService.getSchedulingDutyForSpecifyDate(dutyDay,shiftId,postType, fieldCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("查询指定車輛值班人信息列表")
......
package com.yeejoin.amos.boot.module.common.biz.controller;
import java.text.ParseException;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
......@@ -18,18 +17,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.DateUtil;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.common.api.dto.DutyFireFightingDto;
import com.yeejoin.amos.boot.module.common.api.service.IDutyFireFightingService;
......@@ -102,9 +97,10 @@ public class DutyFireFightingController extends BaseController{
@ApiOperation(httpMethod = "GET", value = "新值班月视图", notes = "新值班月视图")
public ResponseModel<List<Map<String, Object>>> newDutyDetail(
@ApiParam(value = "开始日期", required = true) @RequestParam String beginDate,
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate,
@ApiParam(value = "属性编码") @RequestParam(required = false) String fieldCode
) throws ParseException {
return ResponseHelper.buildResponse(iDutyFireFightingService.newStatisticsDay(beginDate, endDate));
return ResponseHelper.buildResponse(iDutyFireFightingService.newStatisticsDay(beginDate, endDate, fieldCode));
}
/**
* 调班
......@@ -173,8 +169,9 @@ public class DutyFireFightingController extends BaseController{
@GetMapping("/person/{dutyDay}/list")
public ResponseModel listDutyPerson(@ApiParam(value = "值班日期",required = true) @PathVariable String dutyDay,
@ApiParam(value = "班次id") @RequestParam(required = false) Long shiftId,
@ApiParam(value = "岗位") @RequestParam(required = false) String postType){
return ResponseHelper.buildResponse(iDutyFireFightingService.getSchedulingDutyForSpecifyDate(dutyDay,shiftId,postType));
@ApiParam(value = "岗位") @RequestParam(required = false) String postType,
@ApiParam(value = "属性编码") @RequestParam(required = false) String fieldCode){
return ResponseHelper.buildResponse(iDutyFireFightingService.getSchedulingDutyForSpecifyDate(dutyDay,shiftId,postType, fieldCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......
......@@ -89,9 +89,10 @@ public class DutyFirstAidController extends BaseController{
@ApiOperation(httpMethod = "GET", value = "新值班月视图", notes = "新值班月视图")
public ResponseModel<List<Map<String, Object>>> newDutyDetail(
@ApiParam(value = "开始日期", required = true) @RequestParam String beginDate,
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate,
@ApiParam(value = "属性编码") @RequestParam(required = false) String fieldCode
) throws ParseException {
return ResponseHelper.buildResponse(iDutyFirstAidService.newStatisticsDay(beginDate, endDate));
return ResponseHelper.buildResponse(iDutyFirstAidService.newStatisticsDay(beginDate, endDate, fieldCode));
}
/**
* 调班
......@@ -160,7 +161,8 @@ public class DutyFirstAidController extends BaseController{
@GetMapping("/person/{dutyDay}/list")
public ResponseModel listDutyPerson(@ApiParam(value = "值班日期",required = true) @PathVariable String dutyDay,
@ApiParam(value = "班次id") @RequestParam(required = false) Long shiftId,
@ApiParam(value = "岗位") @RequestParam(required = false) String postType){
return ResponseHelper.buildResponse(iDutyFirstAidService.getSchedulingDutyForSpecifyDate(dutyDay,shiftId,postType));
@ApiParam(value = "岗位") @RequestParam(required = false) String postType,
@ApiParam(value = "属性编码") @RequestParam(required = false) String fieldCode){
return ResponseHelper.buildResponse(iDutyFirstAidService.getSchedulingDutyForSpecifyDate(dutyDay,shiftId,postType, fieldCode));
}
}
package com.yeejoin.amos.boot.module.common.biz.controller;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonDto;
import com.yeejoin.amos.boot.module.common.api.service.IDutyPersonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
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;
......@@ -23,15 +16,10 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonDto;
import com.yeejoin.amos.boot.module.common.api.service.IDutyPersonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
/**
......@@ -103,9 +91,10 @@ public class DutyPersonController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "新值班月视图", notes = "新值班月视图")
public ResponseModel<List<Map<String, Object>>> newDutyDetail(
@ApiParam(value = "开始日期", required = true) @RequestParam String beginDate,
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate,
@ApiParam(value = "属性编码") @RequestParam(required = false) String fieldCode
) throws ParseException {
return ResponseHelper.buildResponse(iDutyPersonService.newStatisticsDay(beginDate, endDate));
return ResponseHelper.buildResponse(iDutyPersonService.newStatisticsDay(beginDate, endDate, fieldCode));
}
/**
......@@ -186,8 +175,9 @@ public class DutyPersonController extends BaseController {
@GetMapping("/new-person/{dutyDay}/list")
public ResponseModel newListDutyPerson(@ApiParam(value = "值班日期", required = true) @PathVariable String dutyDay,
@ApiParam(value = "班次id") @RequestParam(required = false) Long shiftId,
@ApiParam(value = "岗位") @RequestParam(required = false) String postType) {
return ResponseHelper.buildResponse(iDutyPersonService.getSchedulingDutyForSpecifyDate(dutyDay, shiftId, postType));
@ApiParam(value = "岗位") @RequestParam(required = false) String postType,
@ApiParam(value = "属性编码") @RequestParam(required = false) String fieldCode) {
return ResponseHelper.buildResponse(iDutyPersonService.getSchedulingDutyForSpecifyDate(dutyDay, shiftId, postType, fieldCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("查询当前值班人信息列表")
......
package com.yeejoin.amos.boot.module.common.biz.controller;
import java.io.UnsupportedEncodingException;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSON;
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.conditions.update.UpdateWrapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.constants.CommonConstant;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
......@@ -23,43 +13,33 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.core.framework.PersonIdentify;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.CompanyInfo;
import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import com.yeejoin.amos.boot.module.common.api.mapper.FireTeamMapper;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper;
import com.yeejoin.amos.boot.module.common.biz.service.impl.ESOrgUsrService;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FireCompanyInfoServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.component.emq.EmqKeeper;
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.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.yeejoin.amos.boot.biz.common.constants.CommonConstant;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author fengwang
......
......@@ -6,6 +6,7 @@ import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrAgencyUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
......@@ -36,10 +37,15 @@ public class OrgUsrAgencyUserController extends BaseController {
* @return OrgUsrAgencyUser
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{orgUsrId}/detail", method = RequestMethod.GET)
@RequestMapping(value = "/{orgUsrId}/detail", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "查询关联的amos账号信息", notes = "查询关联的amos账号信息")
public ResponseModel<OrgUsrAgencyUser> getAccountDetail(@PathVariable String orgUsrId) {
OrgUsrAgencyUser orgUsrAgencyUser = new OrgUsrAgencyUser();
OrgUsrAgencyUser agencyUser = orgUsrAgencyUserService.getAccountDetail(orgUsrId);
if (ObjectUtils.isEmpty(agencyUser)) {
orgUsrAgencyUser.setUpAmosUser("0");
return ResponseHelper.buildResponse(orgUsrAgencyUser);
}
return ResponseHelper.buildResponse(agencyUser);
}
}
\ No newline at end of file
......@@ -19,6 +19,7 @@ import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.biz.service.impl.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -511,6 +512,34 @@ public class WaterResourceController extends BaseController {
}
/**
* 列表分页查询缺陷模块用
*
* @param pageNum 当前页
* @param pageSize 每页大小
* @return 返回结果
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/pageByDefect")
@ApiOperation(httpMethod = "GET", value = "列表分页查询缺陷模块用", notes = "列表分页查询缺陷模块用")
public ResponseModel<Page<WaterResourceDto>> pageByDefect(@RequestParam(value = "pageNum") int pageNum,
@RequestParam(value = "pageSize") int pageSize,
@RequestParam(value = "nameOrCode", required = false) String nameOrCode,
@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode) {
ReginParams reginParams = getSelectedOrgInfo();
if (StringUtils.isEmpty(bizOrgCode)) {
if (ObjectUtils.isEmpty(reginParams) || ObjectUtils.isEmpty(reginParams.getPersonIdentity()) || StringUtils.isEmpty(reginParams.getPersonIdentity().getBizOrgCode())) {
return ResponseHelper.buildResponse(null);
}
bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
}
Page<WaterResourceDto> page = new Page<>();
page.setCurrent(pageNum);
page.setSize(pageSize);
Page<WaterResourceDto> waterResourceDtoPage = waterResourceServiceImpl.pageByDefect(page, nameOrCode, bizOrgCode);
return ResponseHelper.buildResponse(waterResourceDtoPage);
}
/**
* 列表全部数据查询
*
* @return 返回结果
......
package com.yeejoin.amos.boot.module.common.biz.enums;
public enum DynamicGroupCode {
JCS_PERSON("机场人员", "246");
private String name;
private String code;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
DynamicGroupCode(String name, String code) {
this.name = name;
this.code = code;
}
}
......@@ -4,11 +4,13 @@ import com.yeejoin.amos.boot.module.common.biz.listener.AmosMqttListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.component.emq.EmqKeeper;
/**
* @author Administrator
*/
@Component
public class ApplicationRunnerImpl implements ApplicationRunner {
@Autowired
......
......@@ -142,7 +142,7 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa
return result;
}
public Object getSchedulingDutyForSpecifyDate(String dutyDay, Long shiftId, String postType) {
public Object getSchedulingDutyForSpecifyDate(String dutyDay, Long shiftId, String postType, String fieldCode) {
List<Map<String, Object>> equipmentList = dutyPersonShiftMapper.getEquipmentForSpecifyDate(dutyDay,
this.getGroupCode(), "carId", "carName", "teamName","result.carId");
if(equipmentList==null || equipmentList.size()<1 || equipmentList.get(0)==null) {
......@@ -181,7 +181,7 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa
// }
// 获取当前装备ID下的排版数据
List<Map<String, Object>> specifyDateList = dutyPersonShiftMapper.getPositionStaffDutyForSpecifyDate(dutyDay,
this.getGroupCode(), instanceIds,null);
this.getGroupCode(), instanceIds,null, fieldCode);
/*if(specifyDateList==null || specifyDateList.size() < 1 || specifyDateList.get(0)==null) {
continue;
}*/
......@@ -246,7 +246,7 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa
if (StringUtils.isNotBlank(instanceId)) {
String[] instanceIds = instanceId.split(",");
specifyDateList = dutyPersonShiftMapper.getPositionStaffDutyForSpecifyDate(dutyDay,
this.getGroupCode(), instanceIds,null);
this.getGroupCode(), instanceIds,null, null);
}
return specifyDateList;
}
......
......@@ -11,6 +11,8 @@ import java.util.stream.Stream;
import javax.servlet.http.HttpServletRequest;
import com.yeejoin.amos.boot.module.common.biz.enums.DynamicGroupCode;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -230,7 +232,8 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
LocalDate startDate = LocalDate.parse(start);
LocalDate endDate = LocalDate.parse(end);
long distance = ChronoUnit.DAYS.between(startDate, endDate);
if (distance < 1) {
if (distance < 1 && StringUtils.isNotBlank(start)) {
list.add(start);
return list;
}
Stream.iterate(startDate, d -> d.plusDays(1)).limit(distance + 1).forEach(f -> list.add(f.toString()));
......@@ -278,7 +281,7 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
/*bug2468 值班排班,日历视图单班次执勤人数满足≤3且班次≤2时,值班显示方式错误 陈召 结束*/
}
public List<Map<String, Object>> newStatisticsDay(String beginDate, String endDate) throws ParseException {
public List<Map<String, Object>> newStatisticsDay(String beginDate, String endDate, String fieldCode) throws ParseException {
Date dateBegin = DateUtils.dateParse(beginDate, DateUtils.DATE_PATTERN);
String timeStart = DateUtils.dateTimeToDateString(dateBegin);
......@@ -306,7 +309,7 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
result.put("key", objectMap.get("date"));
String dateString = objectMap.get("date").toString();
if(this.getGroupCode().equals("dutyPerson")) {
result.put("data", getPersonPostTypeNameAndCount(dateString));
result.put("data", getPersonPostTypeNameAndCount(dateString, fieldCode));
}else if(this.getGroupCode().equals("dutyCar")) {
result.put("data", getCarPostTypeNameAndCount(dateString));
}else if(this.getGroupCode().equals("dutyFireFighting")) {
......@@ -323,11 +326,16 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
/**
* 排班值班人员的统计类型为:
* 岗位: 岗位人员数量
* 岗位: 岗位人员数量
*
* @param dutyDate
* @param dutyType
* @return
*/
public Object getPersonPostTypeNameAndCount(String dutyDate) {
public Object getPersonPostTypeNameAndCount(String dutyDate, String fieldCode) {
if (StringUtils.isNotBlank(fieldCode)) {
return dutyPersonShiftService.getBaseMapper().newStationViewDataByFieldCode(dutyDate, this.getGroupCode(), fieldCode);
}
return dutyPersonShiftService.getBaseMapper().newStationViewData(dutyDate, this.getGroupCode());
}
/**
......@@ -503,6 +511,7 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
Long instanceId = null;
List<DynamicFormColumn> columns = dynamicFormColumnService.list(new LambdaQueryWrapper<DynamicFormColumn>()
.eq(DynamicFormColumn::getGroupCode, this.getGroupCode()));
Map<String, Object> dataMap = buildDataMap(d, userId);
// 1.组装动态表单数据
if (!instances.isEmpty()) {
// 0.定位instanceId,准备进行更新操作
......@@ -515,7 +524,7 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
Map<Object, DynamicFormInstance> instanceMap = Bean.listToMap(instancesInDb, "fieldCode",
DynamicFormInstance.class);
// 3.待更新数据组装,待批量入库
this.updateFormValue(formInstanceList, d, instanceId, columns, instanceMap);
this.updateFormValue(formInstanceList, dataMap, instanceId, columns, instanceMap);
} else {
// 0.新数据,生成id
instanceId = sequence.nextId();
......@@ -523,14 +532,14 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
// 1.组装数据
List<DynamicFormInstance> newInstances = columns.stream().map(column -> {
DynamicFormInstance instance = new DynamicFormInstance();
buildFormInstanceData(finalInstanceId1, d, column, instance);
buildFormInstanceData(finalInstanceId1, dataMap, column, instance);
return instance;
}).collect(Collectors.toList());
// 2.待更新数据组装,待批量入库
formInstanceList.addAll(newInstances);
}
// 2.组装值班数据
List<DutyPersonShiftDto> shiftDtos = (List<DutyPersonShiftDto>) d.get("dutyShift");
List<DutyPersonShiftDto> shiftDtos = (List<DutyPersonShiftDto>) dataMap.get("dutyShift");
Long finalInstanceId = instanceId;
// 按照业务唯一索引查询主键
List<DutyPersonShift> dutyPersonShiftsDb = dutyPersonShiftService
......@@ -574,6 +583,20 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
}
}
private Map<String, Object> buildDataMap(Map<String, Object> d, String userId) {
// 表单存在人员类型,获取用户ID,查询人员类型赋值
if (!ObjectUtils.isEmpty(userId)) {
List<DynamicFormInstance> instances = dynamicFormInstanceService
.list(new LambdaQueryWrapper<DynamicFormInstance>().eq(DynamicFormInstance::getFieldCode, "peopleType")
.eq(DynamicFormInstance::getInstanceId, userId)
.eq(DynamicFormInstance::getGroupCode, DynamicGroupCode.JCS_PERSON.getCode()));
if (!CollectionUtils.isEmpty(instances)) {
d.put("personType", instances.get(0).getFieldValue());
}
}
return d;
}
private void buildFormInstanceData(Long instanceId, Map<String, Object> map, DynamicFormColumn column,
DynamicFormInstance formInstance) {
fillFormInstanceData(instanceId, map, column, formInstance, sequence.nextId());
......@@ -809,7 +832,7 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
}
@Override
public Object getSchedulingDutyForSpecifyDate(String dutyDay, Long shiftId, String postType) {
public Object getSchedulingDutyForSpecifyDate(String dutyDay, Long shiftId, String postType, String fieldCode) {
// TODO Auto-generated method stub
return null;
}
......
......@@ -55,7 +55,7 @@ public class DutyFireFightingServiceImpl extends DutyCommonServiceImpl implement
insertPersonShift(instanceId, dto.getDutyShift());
return dto;
}
public Object getSchedulingDutyForSpecifyDate(String dutyDay, Long shiftId, String postType) {
public Object getSchedulingDutyForSpecifyDate(String dutyDay, Long shiftId, String postType, String fieldCode) {
List<Map<String, Object>> equipmentList = dutyPersonShiftMapper.getEquipmentForSpecifyDate(dutyDay,
this.getGroupCode(), "fireFightingId", "fireFighting", "teamName","result.fireFightingId");
if(equipmentList==null || equipmentList.size()<1 || equipmentList.get(0)==null) {
......@@ -90,7 +90,7 @@ public class DutyFireFightingServiceImpl extends DutyCommonServiceImpl implement
// }
// 获取当前装备ID下的排版数据
List<Map<String, Object>> specifyDateList = dutyPersonShiftMapper.getPositionStaffDutyForSpecifyDate(dutyDay,
this.getGroupCode(), instanceIds,null);
this.getGroupCode(), instanceIds,null, fieldCode);
if(specifyDateList==null || specifyDateList.size() < 1 || specifyDateList.get(0)==null) {
continue;
}
......
......@@ -7,7 +7,6 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.apache.velocity.runtime.directive.Break;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.Bean;
......@@ -58,7 +57,7 @@ public class DutyFirstAidServiceImpl extends DutyCommonServiceImpl implements ID
}
@Override
public Object getSchedulingDutyForSpecifyDate(String dutyDay, Long shiftId, String postType) {
public Object getSchedulingDutyForSpecifyDate(String dutyDay, Long shiftId, String postType, String fieldCode) {
List<Map<String, Object>> equipmentList = dutyPersonShiftMapper.getEquipmentForSpecifyDate(dutyDay,
this.getGroupCode(), "firstAidId", "firstAid", "teamName", "result.firstAidId");
if (equipmentList == null || equipmentList.size() < 1 || equipmentList.get(0) == null) {
......@@ -94,7 +93,7 @@ public class DutyFirstAidServiceImpl extends DutyCommonServiceImpl implements ID
// 获取当前装备ID下的排版数据
List<Map<String, Object>> specifyDateList = dutyPersonShiftMapper
.getPositionStaffDutyForSpecifyDate(dutyDay, this.getGroupCode(), instanceIds,
null);
null, fieldCode);
if (specifyDateList == null || specifyDateList.size() < 1 || specifyDateList.get(0) == null) {
continue;
}
......
......@@ -304,7 +304,7 @@ public Object BuildScheduleDetails(String dutyDay, Long shiftId, String postType
}
public Object getSchedulingDutyForSpecifyDate(String dutyDay, Long shiftId, String postType) {
public Object getSchedulingDutyForSpecifyDate(String dutyDay, Long shiftId, String postType, String fieldCode) {
List<Map<String, Object>> equipmentList = dutyPersonShiftMapper.getNewEquipmentForSpecifyDate(dutyDay,
this.getGroupCode(), "deptId", "deptName", "result.deptId");
if (equipmentList == null || equipmentList.size() < 1 || equipmentList.get(0) == null) {
......@@ -330,7 +330,7 @@ public Object BuildScheduleDetails(String dutyDay, Long shiftId, String postType
// 获取当前装备ID下的排版数据
List<Map<String, Object>> specifyDateList = dutyPersonShiftMapper
.getPositionStaffDutyForSpecifyDate(dutyDay, this.getGroupCode(), instanceIds,
null);
null, fieldCode);
if (specifyDateList == null || specifyDateList.size() < 1 || specifyDateList.get(0) == null) {
continue;
}
......
......@@ -6,9 +6,10 @@ import java.util.stream.Collectors;
import com.yeejoin.amos.boot.biz.common.dao.mapper.DataDictionaryMapper;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.entity.*;
import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrAgencyUserMapper;
import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper;
import com.yeejoin.amos.component.feign.model.Page;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.apache.commons.lang3.ObjectUtils;
......@@ -28,8 +29,6 @@ import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.Menu;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
import com.yeejoin.amos.boot.module.common.api.entity.Firefighters;
import com.yeejoin.amos.boot.module.common.api.entity.FirefightersContacts;
import com.yeejoin.amos.boot.module.common.api.mapper.FirefightersMapper;
import com.yeejoin.amos.boot.module.common.api.service.IFirefightersService;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
......@@ -61,6 +60,9 @@ public class FirefightersServiceImpl extends BaseService<FirefightersDto, Firefi
FirefightersContactsServiceImpl ifirefightersContactsService;
@Autowired
private OrgUsrMapper orgUsrMapper;
@Autowired
OrgUsrAgencyUserMapper orgUsrAgencyUserMapper;
@Override
public List<FirefightersZhDto> getFirefighters(int pageNum, int pageSize, FirefightersDto par) {
......@@ -228,20 +230,65 @@ public class FirefightersServiceImpl extends BaseService<FirefightersDto, Firefi
@Override
@Transactional(rollbackFor = Exception.class)
public PeopleInfoDto updatePeopleById(PeopleInfoDto peopleInfoDto, Long id) {
Map<String, String> map = new HashMap<>();
// 1.动态表单
if(!ValidationUtil.isEmpty(peopleInfoDto.getFirefighters().getAmosUserId())) {
AgencyUserModel amosUser = Privilege.agencyUserClient.queryByUserId(peopleInfoDto.getFirefighters().getAmosUserId()).getResult();
peopleInfoDto.getFirefighters().setAmosName(amosUser.getRealName());
OrgUsr orgUsr = orgUsrService.peopleSaveOrgUsr(peopleInfoDto.getFirefighters());
if(!ValidationUtil.isEmpty(peopleInfoDto.getFirefighters().getAmosUserId()) || "1".equals(peopleInfoDto.getOrgUsrAgencyUser().getUpAmosUser())) {
AgencyUserModel amosUser = null;
if(!ValidationUtil.isEmpty(peopleInfoDto.getFirefighters().getAmosUserId())){
amosUser = Privilege.agencyUserClient.queryByUserId(peopleInfoDto.getFirefighters().getAmosUserId()).getResult();
}
//删除之前所在用户组
OrgUsrAgencyUser orgUsrAgencyUser = orgUsrAgencyUserMapper.selectOne(new QueryWrapper<OrgUsrAgencyUser>().eq("org_usr_id", id));
if (!ValidationUtil.isEmpty(orgUsrAgencyUser) && amosUser != null ) {
String groupIds = orgUsrAgencyUser.getGroupIds();
if (!"".equals(groupIds) && null != groupIds) {
String[] ids = groupIds.split(",");
for (String gId : ids) {
Long groupId = Long.valueOf(gId);
Privilege.groupUserClient.deleteGroupUser(groupId,amosUser.getUserId());
}
}
}
//同步更新或者创建平台用户
if(null == amosUser){
map = orgUsrService.savePlatformUser(orgUsr,peopleInfoDto,"create");
} else {
if("0".equals(peopleInfoDto.getOrgUsrAgencyUser().getUpAmosUser())){
//删除cb_org_usr_agency_user中对应数据
if (!ValidationUtil.isEmpty(orgUsrAgencyUser)) {
orgUsrAgencyUserMapper.delete(new QueryWrapper<OrgUsrAgencyUser>().eq("org_usr_id", id));
}
//删除cb_org_usr相关字段
OrgUsr orgUsr1 = orgUsrMapper.queryBySequenceNbr(id.toString());
orgUsr1.setAmosOrgId("");
orgUsr1.setAmosOrgCode("");
orgUsrMapper.update(orgUsr1,new QueryWrapper<OrgUsr>().eq("sequence_nbr",id));
//删除cb_firefighters相关字段
Firefighters firefighters = firefightersMapper.selectOne(new QueryWrapper<Firefighters>().eq("org_usr_id", id));
firefighters.setAmosUserId("");
firefighters.setAmosName("");
firefightersMapper.update(firefighters,new QueryWrapper<Firefighters>().eq("org_usr_id", id));
Privilege.agencyUserClient.multDeleteUser(orgUsrAgencyUser.getAmosUserId());
} else {
map = orgUsrService.savePlatformUser(orgUsr,peopleInfoDto,"update");
}
}
if(amosUser==null){
peopleInfoDto.getFirefighters().setAmosName(peopleInfoDto.getOrgUsrAgencyUser().getUsrName());
}else {
peopleInfoDto.getFirefighters().setAmosName(amosUser.getRealName());
}
} else {
peopleInfoDto.getFirefighters().setAmosUserId(null);
peopleInfoDto.getFirefighters().setAmosName(null);
}
OrgUsr orgUsr = orgUsrService.peopleSaveOrgUsr(peopleInfoDto.getFirefighters());
OrgPersonDto orgPersonDto = new OrgPersonDto();
BeanUtils.copyProperties(orgUsr, orgPersonDto);
List<DynamicFormInstance> dynamicFormInstances = orgUsrService.dynamicFormColumn(peopleInfoDto.getFirefighters(), true);
orgPersonDto.setAmosOrgId(map.get("orgId"));
orgPersonDto.setAmosOrgCode(map.get("orgCode"));
List<DynamicFormInstance> dynamicFormInstances = orgUsrService.dynamicFormColumn(peopleInfoDto.getFirefighters(), false);
orgPersonDto.setDynamicFormValue(dynamicFormInstances);
try {
orgUsrService.updateByIdOrgPerson(orgPersonDto, id);
......@@ -270,7 +317,7 @@ public class FirefightersServiceImpl extends BaseService<FirefightersDto, Firefi
@Override
public void saveFirefightersByUser(PeopleInfoDto firefighters) {
orgUsrService.saveFirefighters(firefighters);
orgUsrService.saveFirefighters(firefighters,new HashMap<>());
}
public Map<String, String> getPersonByCodes(List<String> list) {
......
......@@ -3,14 +3,22 @@ package com.yeejoin.amos.boot.module.common.biz.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrAgencyUserDto;
import com.yeejoin.amos.boot.module.common.api.entity.Firefighters;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsrAgencyUser;
import com.yeejoin.amos.boot.module.common.api.mapper.FirefightersMapper;
import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrAgencyUserMapper;
import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper;
import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrAgencyUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
......@@ -22,6 +30,12 @@ import java.util.stream.Collectors;
@Service
public class OrgUsrAgencyUserServiceImpl extends BaseService<OrgUsrAgencyUserDto, OrgUsrAgencyUser, OrgUsrAgencyUserMapper> implements IOrgUsrAgencyUserService {
@Autowired
OrgUsrAgencyUserMapper orgUsrAgencyUserMapper;
@Autowired
FirefightersMapper firefightersMapper;
@Autowired
OrgUsrMapper orgUsrMapper;
@Override
public OrgUsrAgencyUser getAccountDetail(String orgUsrId) {
......@@ -35,17 +49,52 @@ public class OrgUsrAgencyUserServiceImpl extends BaseService<OrgUsrAgencyUserDto
String userId = jsonObject.getString("userId");
// 平台添加用户
if ("update".equals(methodName)) {
// 更新cb_org_usr_agency_user、cb_org_usr、cb_firefighters
// 更新cb_org_usr_agency_user
JSONObject object = result.getJSONObject("result");
// person.setId(object.getLong("sequenceNbr"));
// person.setAccountName(object.getString("userName"));
// person.setUserId(object.getLong("userId"));
// person.setName(object.getString("realName"));
// person.setPhone(object.getString("mobile"));
OrgUsrAgencyUser orgUsrAgencyUser = orgUsrAgencyUserMapper.selectOne(new QueryWrapper<OrgUsrAgencyUser>().eq("amos_user_id", object.getString("userId")));
orgUsrAgencyUser.setUsrName(object.getString("userName"));
orgUsrAgencyUser.setMobile(object.getString("mobile"));
orgUsrAgencyUser.setAmosUserId(object.getString("userId"));
orgUsrAgencyUserMapper.update(orgUsrAgencyUser,new QueryWrapper<OrgUsrAgencyUser>().eq("amos_user_id",object.getString("userId")));
// 更新cb_firefighters
Firefighters firefighter = firefightersMapper.selectOne(new QueryWrapper<Firefighters>().eq("org_usr_id", orgUsrAgencyUser.getOrgUsrId()));
if (!ObjectUtils.isEmpty(firefighter) && !firefighter.getIsDelete()) {
firefighter.setAmosUserId(object.get("userId").toString());
firefighter.setAmosName(object.getString("userName"));
firefightersMapper.update(firefighter, new QueryWrapper<Firefighters>().eq("org_usr_id", orgUsrAgencyUser.getOrgUsrId()));
}
// 更新cb_org_usr
OrgUsr orgUsr1 = orgUsrMapper.selectById(orgUsrAgencyUser.getOrgUsrId());
if (!ObjectUtils.isEmpty(orgUsr1) && !orgUsr1.getIsDelete()) {
orgUsr1.setAmosOrgId(object.get("userId").toString());
List<Map<String, Object>> companys = (List<Map<String, Object>>) object.get("companys");
orgUsr1.setAmosOrgCode(companys.get(0).get("orgCode").toString());
orgUsrMapper.update(orgUsr1,new QueryWrapper<OrgUsr>().eq("sequence_nbr",orgUsrAgencyUser.getOrgUsrId()));
}
} else if ("multDeleteUser".equals(methodName)) {
JSONArray array = result.getJSONArray("result");
List<Object> userIds = array.stream().collect(Collectors.toList());
// 删除cb_org_usr_agency_user、cb_org_usr与用户有关字段、cb_firefighters和用户有关字段
for (Object id : userIds) {
//删除cb_org_usr_agency_user中信息
OrgUsrAgencyUser orgUsrAgencyUser = orgUsrAgencyUserMapper.selectOne(new QueryWrapper<OrgUsrAgencyUser>().eq("amos_user_id", id));
if (!ObjectUtils.isEmpty(orgUsrAgencyUser)) {
orgUsrAgencyUserMapper.delete(new QueryWrapper<OrgUsrAgencyUser>().eq("amos_user_id", id));
}
// 删除cb_firefighters和用户有关字段
Firefighters firefighter = firefightersMapper.selectOne(new QueryWrapper<Firefighters>().eq("amos_user_id", id));
if (!ObjectUtils.isEmpty(firefighter)) {
firefighter.setAmosUserId("");
firefighter.setAmosName("");
firefightersMapper.update(firefighter, new QueryWrapper<Firefighters>().eq("amos_user_id", id).eq("is_delete", 0));
}
// 删除cb_org_usr与用户有关字段
OrgUsr orgUsr1 = orgUsrMapper.selectOne(new QueryWrapper<OrgUsr>().eq("amos_org_id", id));
if (!ObjectUtils.isEmpty(orgUsr1)) {
orgUsr1.setAmosOrgId("");
orgUsr1.setAmosOrgCode("");
orgUsrMapper.update(orgUsr1,new QueryWrapper<OrgUsr>().eq("amos_org_id",id).eq("is_delete",0));
}
}
}
}
}
\ No newline at end of file
......@@ -94,6 +94,15 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
}
/**
* 分页查询
*/
public Page<WaterResourceDto> pageByDefect(Page<WaterResourceDto> page,
String nameOrCode,
String bizOrgCode) {
return this.waterResourceMapper.pageByDefect(page, nameOrCode, bizOrgCode);
}
/**
* 列表查询 示例
*/
public List<WaterResourceDto> queryForWaterResourceList(@Condition(Operator.eq) Boolean isDelete) {
......
......@@ -51,6 +51,21 @@
<artifactId>geodesy</artifactId>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-authtoken</artifactId>
<version>1.7.13-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>io.springfox</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
......@@ -4,8 +4,11 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.yeejoin.equipmanage.common.dto.AnalysisReportLogDto;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -87,4 +90,20 @@ public class AnalysisReportLogController extends AbstractBaseController {
return reportResponse;
}
@GetMapping(value = "/iotReportPage")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "分页查询", notes = "分页查询")
public IPage<AnalysisReportLogDto> iotReportPage(Page page, @RequestParam Integer reportType,
@ApiParam(value = "开始日期", required = false) @RequestParam(required = false) @DateTimeFormat(pattern="yyyy-MM-dd")Date startDate,
@ApiParam(value = "结束日期", required = false) @RequestParam(required = false) @DateTimeFormat(pattern="yyyy-MM-dd")Date endDate,
@ApiParam(value = "换流站编码", required = false) @RequestParam(required = false) String stationCode) {
AnalysisReportLogDto dto = new AnalysisReportLogDto();
dto.setStartDate(startDate);
dto.setEndDate(endDate);
dto.setReportType(reportType);
dto.setStationCode(stationCode);
return iAnalysisReportLogService.iotReportPage(page, dto);
}
}
package com.yeejoin.equipmanage.controller;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
......@@ -37,6 +41,7 @@ import com.yeejoin.equipmanage.service.IFormInstanceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
/**
* @author ZeHua Li
......@@ -106,8 +111,23 @@ public class BuildingController extends AbstractBaseController {
@ApiOperation("消防建筑树")
@GetMapping(value = "/tree")
public List<BuildingTreeVo> getBuildingTree() {
return buildService.getBuildingTree();
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
return buildService.getBuildingTree(bizOrgCode);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("消防建筑树带筛选")
@GetMapping(value = "/treeByName")
public List<BuildingTreeVo> treeByName(@RequestParam(required = false) String name) {
ReginParams reginParams = getSelectedOrgInfo();
if (ObjectUtils.isEmpty(reginParams) || ObjectUtils.isEmpty(reginParams.getPersonIdentity()) || StringUtils.isEmpty(reginParams.getPersonIdentity().getBizOrgCode())) {
return new ArrayList<>();
}
String bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
return buildService.treeByName(bizOrgCode, name);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("消防建筑树列表信息")
@GetMapping(value = "/getBuildingList")
......
......@@ -121,7 +121,7 @@ public class CarController extends AbstractBaseController {
private RestTemplate restTemplate;
@Value("${security.productApp}")
private String productApp;
@Value("${security.appKeyApp}")
@Value("${amos.system.user.app-key}")
private String appKeyApp;
@Value("${iot.vehicle.track}")
private String iotServerName;
......
package com.yeejoin.equipmanage.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarmLog;
import com.yeejoin.equipmanage.common.entity.MonitorEvent;
import com.yeejoin.equipmanage.common.entity.vo.IdxBizDefectVo;
import com.yeejoin.equipmanage.fegin.IdxFeign;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificAlarmLogMapper;
import com.yeejoin.equipmanage.service.IConfirmAlarmService;
import com.yeejoin.equipmanage.service.impl.MonitorEventService;
......@@ -14,6 +18,7 @@ import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
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 java.util.LinkedHashMap;
import java.util.List;
......@@ -35,6 +40,8 @@ public class ConfirmAlarmController extends AbstractBaseController {
EquipmentSpecificAlarmLogMapper equipmentSpecificAlarmLogMapper;
@Autowired
private MonitorEventService monitorEventService;
@Autowired
private IdxFeign idxFeign;
@GetMapping(value = "/getDetailsById")
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -108,4 +115,14 @@ public class ConfirmAlarmController extends AbstractBaseController {
public Map<String, Object> getEquipSceneAndRelationVideo(@PathVariable Long equipmentSpecificId) {
return iConfirmAlarmService.getEquipSceneAndRelationVideo(equipmentSpecificId);
}
@GetMapping(value = "/defect/status/{id}")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "缺陷处理状态")
public IdxBizDefectVo getDefectStatus(@PathVariable String id) {
ResponseModel<JSONObject> responseModel = idxFeign.queryDefectByAlarmLogId(id);
JSONObject result = responseModel.getResult();
IdxBizDefectVo vo = JSON.parseObject(JSON.toJSONString(result), IdxBizDefectVo.class);
return vo;
}
}
......@@ -7,12 +7,15 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.equipmanage.common.enums.SourceTypeEnum;
import com.yeejoin.equipmanage.common.utils.SpringUtils;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.config.PersonIdentify;
import com.yeejoin.equipmanage.mapper.EquipmentCategoryMapper;
import com.yeejoin.equipmanage.service.ISourceStatistics;
import com.yeejoin.equipmanage.service.impl.SourcesStatisticsImpl;
import org.apache.commons.lang3.StringUtils;
......@@ -28,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
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;
......@@ -88,11 +92,16 @@ public class EquipmentCategoryController extends AbstractBaseController {
@Value("${redis_equip_type_count}")
private String equipTypeAndCount;
@Autowired
private EquipmentCategoryMapper equipmentCategoryMapper;
private static final String equipmentTreeListAll = "equipmentTreeListAll";
private static final String equipmentTreeListIndustry = "equipmentTreeListIndustry";
// 装备redis缓存key前缀
private static final String prefix = "equipmentTreeList";
private static final String EQUIP_AND_FIRE_TREE = "EQUIP_AND_FIRE_TREE:";
/**
* 新增装备分类
*
......@@ -378,6 +387,147 @@ public class EquipmentCategoryController extends AbstractBaseController {
}
/**
* 消防设施分类定义树
*
* @return
*/
@PersonIdentify
@RequestMapping(value = "/equipAndFireAllTree", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "消防设施分类定义树组合消防装备树", notes = "消防设施分类定义树组合消防装备树")
public ResponseModel equipAndFireAllTree() {
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : "";
if (redisUtils.hasKey(EQUIP_AND_FIRE_TREE + bizOrgCode)) {
return CommonResponseUtil.success(redisUtils.get(EQUIP_AND_FIRE_TREE + bizOrgCode));
}
List<EquipmentCategory> result = new ArrayList<>();
List<EquipmentCategory> listFireCategories = listFirePrivate(bizOrgCode);
List<EquipmentCategory> listEquipCategories = listEquipPrivate(bizOrgCode);
List<EquipmentCategory> treeListByCustom = getTreeListByCustom(bizOrgCode);
listFireCategories.addAll(listEquipCategories);
listFireCategories.addAll(treeListByCustom);
EquipmentCategory equipmentCategory = new EquipmentCategory();
equipmentCategory.setChildren(listFireCategories);
equipmentCategory.setCode("-3");
int countAll = StringUtils.isNotEmpty(bizOrgCode) ? equipmentCategoryMapper.countAll(bizOrgCode) : 0;
equipmentCategory.setName("全部类型" + "(" + countAll + ")");
equipmentCategory.setId(-3L);
equipmentCategory.setHasLowerClassification(true);
result.add(equipmentCategory);
//默认设置两天,新增修改删除数据时清除此缓存
redisUtils.set(EQUIP_AND_FIRE_TREE + bizOrgCode, result, 172800);
return CommonResponseUtil.success(result);
}
/**
* 自定义和重点部位组装
* @return
*/
private List<EquipmentCategory> getTreeListByCustom(String bizOrgCode) {
List<EquipmentCategory> result = new ArrayList<>();
EquipmentCategory equipmentCategory = new EquipmentCategory();
int keyPartsTypeCount = StringUtils.isNotEmpty(bizOrgCode) ? equipmentCategoryMapper.countByKeyPartsType(bizOrgCode) : 0;
equipmentCategory.setCode("-4");
equipmentCategory.setName("重点部位" + "(" + keyPartsTypeCount + ")");
equipmentCategory.setPatrolNum(keyPartsTypeCount);
equipmentCategory.setId(-4L);
equipmentCategory.setParentId(-3L);
equipmentCategory.setHasLowerClassification(false);
result.add(equipmentCategory);
EquipmentCategory equipmentCategory2 = new EquipmentCategory();
int customTypeCount = StringUtils.isNotEmpty(bizOrgCode) ? equipmentCategoryMapper.countByCustomType(bizOrgCode) : 0;
equipmentCategory2.setCode("-5");
equipmentCategory2.setName("自定义巡查点" + "(" + customTypeCount + ")");
equipmentCategory2.setPatrolNum(customTypeCount);
equipmentCategory2.setId(-5L);
equipmentCategory2.setParentId(-3L);
equipmentCategory2.setHasLowerClassification(false);
result.add(equipmentCategory2);
return result;
}
private List<EquipmentCategory> listFirePrivate(String bizOrgCode) {
List<EquipmentCategory> equipmentCategorys = this.iEquipmentCategoryService
.getEquipmentCategoryListByFacilities(Integer.valueOf(equipmentCategoryLeftTypeCode));
List<EquipmentCategory> list = new ArrayList<>();
List<EquipmentCategory> result = new ArrayList<>();
Map<String, List<EquipmentCategory>> tmpMap = new HashMap<String, List<EquipmentCategory>>();
equipmentCategorys.forEach(action -> {
String beginName = action.getName();
String subCode = action.getCode().replaceAll("0+$", "");
int count = StringUtils.isNotEmpty(bizOrgCode)? equipmentCategoryMapper.countByFireTypeAndCode(subCode, bizOrgCode) : 0;
action.setName(action.getName() + "(" + count + ")");
action.setCode(action.getCode() + "@");
if (beginName.equals("消防设施") || beginName.equals("消防系统")) {
action.setPatrolNum(count);
action.setParentId(-1L);
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);
EquipmentCategory equipmentCategory = new EquipmentCategory();
equipmentCategory.setChildren(list);
equipmentCategory.setCode("-1");
equipmentCategory.setName("消防设施(" + ((StringUtils.isNotEmpty(bizOrgCode)? equipmentCategoryMapper.countByFacilitiesType(bizOrgCode) : 0) + ")"));
equipmentCategory.setId(-1L);
equipmentCategory.setHasLowerClassification(true);
equipmentCategory.setParentId(-3L);
result.add(equipmentCategory);
return result;
}
private List<EquipmentCategory> listEquipPrivate(String bizOrgCode) {
List<EquipmentCategory> equipmentCategorys = this.iEquipmentCategoryService
.getEquipmentCategoryListNotFacilities(Integer.valueOf(equipmentCategoryLeftTypeCode));
List<EquipmentCategory> list = new ArrayList<>();
List<EquipmentCategory> result = new ArrayList<>();
Map<String, List<EquipmentCategory>> tmpMap = new HashMap<String, List<EquipmentCategory>>();
equipmentCategorys.forEach(action -> {
String subCode = action.getCode().replaceAll("0+$", "");
int count = StringUtils.isNotEmpty(bizOrgCode)? equipmentCategoryMapper.countByEquipTypeAndCode(subCode, bizOrgCode) : 0;
action.setName(action.getName() + "(" + count + ")");
if (action.getParentId() == null) {
action.setPatrolNum(count);
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);
EquipmentCategory equipmentCategory = new EquipmentCategory();
equipmentCategory.setChildren(list);
equipmentCategory.setCode("-2");
equipmentCategory.setName("消防装备(" + (StringUtils.isNotEmpty(bizOrgCode)? equipmentCategoryMapper.countByEquipType(bizOrgCode) : 0) + ")");
equipmentCategory.setId(-2L);
equipmentCategory.setHasLowerClassification(true);
equipmentCategory.setParentId(-3L);
result.add(equipmentCategory);
return result;
}
/**
*
* 获取子节点
**/
......
......@@ -62,7 +62,8 @@ public class EquipmentManageController extends AbstractBaseController{
@RequestParam(value = "controBoxBuildId",required = false) String controBoxBuildId,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int pageSize,
@RequestParam(value = "companyId") String companyId
@RequestParam(value = "companyId") String companyId,
@RequestParam(required = false) String nameOrCode
) {
......@@ -77,7 +78,7 @@ public class EquipmentManageController extends AbstractBaseController{
companyId = result.get("sequenceNbr").toString();
}
}
return equipmentManageService.queryEquipmenInfoAndCount(equipmentName,equipmentCode,construction,maintenance,bizOrgCode,formGroupId,current,pageSize,controBoxBuildId,companyId);
return equipmentManageService.queryEquipmenInfoAndCount(equipmentName,equipmentCode,construction,maintenance,bizOrgCode,formGroupId,current,pageSize,controBoxBuildId,companyId, nameOrCode);
}
@GetMapping(value = "/getUtils")
......
......@@ -9,11 +9,13 @@ import com.alibaba.fastjson.JSONObject;
import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.utils.SpringUtils;
import com.yeejoin.equipmanage.fegin.JcsFeign;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.http.MediaType;
import org.springframework.scheduling.annotation.Async;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
......@@ -486,6 +488,12 @@ public class FireFightingSystemController extends AbstractBaseController {
return fireFightingSystemService.getColaCategoryAmountEquList(inhierarchy, equipTypeAmountPage.getEquipmentClassificationCode().substring(0, inhierarchy), equipTypeAmountPage);
} else {
if (null != equipTypeAmountPage.getIsDefect() && 1 == equipTypeAmountPage.getIsDefect()) {
ReginParams reginParams = getSelectedOrgInfo();
if (StringUtils.isEmpty(equipTypeAmountPage.getBizOrgCode())) {
equipTypeAmountPage.setBizOrgCode(reginParams.getPersonIdentity().getBizOrgCode());
}
}
return fireFightingSystemService.getColaCategoryAmountEquList(0, null, equipTypeAmountPage);
}
......@@ -534,8 +542,19 @@ public class FireFightingSystemController extends AbstractBaseController {
@RequestParam(value = "formGroupId", required = false) String formGroupId,
@RequestParam(value = "controBoxBuildId", required = false) String controBoxBuildId,
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int pageSize, @RequestParam(value = "companyId",required = false) String companyId
@RequestParam(value = "size") int pageSize,
@RequestParam(value = "nameOrCode", required = false) String nameOrCode, @RequestParam(value = "companyId",required = false) String companyId,
@ApiParam(value = "缺陷管理新增页面用,其余地方可忽略 1-是缺陷管理 0-不是") @RequestParam(required = false) Integer isDefect
) {
if (null != isDefect && 1 == isDefect) {
ReginParams reginParams = getSelectedOrgInfo();
if (org.apache.commons.lang3.ObjectUtils.isEmpty(reginParams) || org.apache.commons.lang3.ObjectUtils.isEmpty(reginParams.getPersonIdentity()) || StringUtils.isEmpty(reginParams.getPersonIdentity().getBizOrgCode())) {
return new HashMap<>();
}
if (StringUtils.isEmpty(bizOrgCode)) {
bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
}
}
if (current > 0){
current = (current - 1) * pageSize;
}
......@@ -550,7 +569,7 @@ public class FireFightingSystemController extends AbstractBaseController {
}
}
return fireFightingSystemService.queryEquipmenInfoAndCount(equipmentName, equipmentCode, construction, maintenance, bizOrgCode, formGroupId, current, pageSize,controBoxBuildId, companyId);
return fireFightingSystemService.queryEquipmenInfoAndCount(equipmentName, equipmentCode, construction, maintenance, bizOrgCode, formGroupId, current, pageSize,controBoxBuildId, companyId, nameOrCode);
}
/**
......
package com.yeejoin.equipmanage.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
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.config.PersonIdentify;
import com.yeejoin.equipmanage.service.DutyDetailsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
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.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.*;
/**
* 获取用户信息
*
*/
@RestController
@RequestMapping(value = "/org/user")
@Api(tags = "用户信息api")
public class OrgUserController {
@Autowired
DutyDetailsService dutyDetailsService;
@Autowired
RedisUtils redisUtils;
/**
* 今日值班运维人员列表清单--分页
*
* @return ResponseModel
*/
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "duty-person/page-list")
@ApiOperation(httpMethod = "GET", value = "今日值班运维人员列表清单", notes = "今日值班运维人员列表清单")
public ResponseModel<IPage<Map<String, Object>>> dutyPersonPageList(
@ApiParam(value = "当前页", required = true) @RequestParam(value = "current") int current,
@ApiParam(value = "页面大小", required = true) @RequestParam(value = "size") int size) {
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
String bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
return ResponseHelper.buildResponse(dutyDetailsService.dutyPersonPageList(current, size, bizOrgCode));
}
}
\ No newline at end of file
package com.yeejoin.equipmanage.fegin;
import com.alibaba.fastjson.JSONObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
/**
* @author DELL
*/
@FeignClient(name = "${idx.feign.name}", path = "idx", configuration = {FeignConfiguration.class})
public interface IdxFeign {
/***
* <pre>
* @Description: 根据告警id查询缺陷治理情况
* </pre>
*
* @MethodName:
* @Param:
* @Return: null
* @Throws
* @Author keyong
* @Date 2022/9/27 17:46
*/
@RequestMapping(value = "/defect/alarm/{alarmLogId}", method = RequestMethod.GET)
ResponseModel<JSONObject> queryDefectByAlarmLogId(@PathVariable String alarmLogId);
}
......@@ -20,8 +20,8 @@ import com.yeejoin.equipmanage.common.entity.AnalysisReportLog;
*/
public interface AnalysisReportLogMapper extends BaseMapper<AnalysisReportLog> {
IPage<AnalysisReportLogDto> allPage(Page<AnalysisReportLogDto> page, @Param("analysisReportLog")AnalysisReportLogDto analysisReportLog,
@Param("rootParentId") Long rootParentId);
IPage<AnalysisReportLogDto> allPage(Page<AnalysisReportLogDto> page, @Param("analysisReportLog")AnalysisReportLogDto analysisReportLog
);
Map<String,Object> getStation(String stationCode);
......@@ -30,4 +30,6 @@ public interface AnalysisReportLogMapper extends BaseMapper<AnalysisReportLog> {
List<Map<String, Object>> getDefect(@Param("analysisReportLog")AnalysisReportLogDto analysisReportLog);
Map<String, Object> getRootOrgUsr();
IPage<AnalysisReportLogDto> iotReportPage(Page page, @Param("analysisReportLog")AnalysisReportLogDto analysisReportLog);
}
......@@ -12,7 +12,7 @@ public interface ConfirmAlarmMapper extends BaseMapper<EquipmentSpecificAlarm> {
int confirmAlam(EquipmentSpecificAlarmLog ent);
EquipmentSpecificAlarm getIdAndConfirmType(String id);
EquipmentSpecificAlarmLog getIdAndConfirmType(String id);
int getFireAlarm();
......
package com.yeejoin.equipmanage.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
public interface DutyDetailsMapper {
IPage<Map<String, Object>> selectDutyPersonList(Page page, @Param(value = "dutyDate") String dutyDate, @Param(value = "bizOrgCode") String bizOrgCode);
}
......@@ -57,6 +57,40 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> {
List<EquipmentCategory> getEquipmentCategoryListByFacilities(Integer head);
int countByFireTypeAndCode(@Param("code") String code, @Param("bizOrgCode") String bizOrgCode);
int countByEquipTypeAndCode(@Param("code") String code, @Param("bizOrgCode") String bizOrgCode);
/**
* 重点部位数量
* @return
*/
int countByKeyPartsType(@Param("bizOrgCode") String bizOrgCode);
/**
* 自定义数量
* @return
*/
int countByCustomType(@Param("bizOrgCode") String bizOrgCode);
/**
* 装备
* @return
*/
int countByEquipType(@Param("bizOrgCode") String bizOrgCode);
/**
* 设施
* @return
*/
int countByFacilitiesType(@Param("bizOrgCode") String bizOrgCode);
/**
* 所有数量
* @return
*/
int countAll(@Param("bizOrgCode") String bizOrgCode);
List<EquipmentCategory> getEquipmentCategoryCarList();
List<EquipmentCategory> getEquipmentCategoryEquipmentList();
......
......@@ -47,7 +47,14 @@ public interface FormInstanceMapper extends BaseMapper<FormInstance> {
* @param parentId
* @return
*/
List<Map<String,Object>> querySpecialChildrenList(String parentId);
List<Map<String,Object>> querySpecialChildrenList(String parentId, String bizOrgCode);
/**
* 查询指定节点的子
* @param parentId
* @return
*/
List<Map<String,Object>> querySpecialChildrenListByName(String parentId, String bizOrgCode, String name);
/**
* 查询指定节点的子
......
......@@ -9,6 +9,7 @@ import java.util.concurrent.TimeUnit;
import javax.servlet.http.HttpServletRequest;
import com.yeejoin.amos.component.authtoken.robot.AmosRequestContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
......@@ -46,18 +47,15 @@ import com.yeejoin.equipmanage.common.vo.Token;
@Service("remoteSecurityService")
public class RemoteSecurityService {
@Value("${security.password}")
@Autowired
AmosRequestContext amosRequestContext;
@Value("${amos.system.user.password}")
private String password;
@Value("${security.loginId}")
private String loginId;
@Value("${security.productWeb}")
private String productWeb;
@Value("${security.productApp}")
private String productApp;
@Value("${security.appKeyApp}")
@Value("${amos.system.user.app-key}")
private String appKeyApp;
@Autowired
......@@ -410,15 +408,15 @@ public class RemoteSecurityService {
public Token getServerToken() {
IdPasswordAuthModel dPasswordAuthModel = new IdPasswordAuthModel();
dPasswordAuthModel.setLoginId(loginId);
dPasswordAuthModel.setLoginId(amosRequestContext.getUserName());
dPasswordAuthModel.setPassword(DesUtil.encode(password, "qaz"));
Token toke = null;
try {
toke = JSON.parseObject(this.redisTemplate.opsForValue().get(buildKey(loginId)), Token.class);
toke = JSON.parseObject(this.redisTemplate.opsForValue().get(buildKey(amosRequestContext.getUserName())), Token.class);
if (ObjectUtils.isEmpty(toke)) {
toke = getLogin(dPasswordAuthModel);
} else {
RequestContext.setProduct(productWeb);
RequestContext.setProduct(amosRequestContext.getProduct());
if (!redisUtils.refresh(toke.getToke())) {
toke = getLogin(dPasswordAuthModel);
}
......@@ -436,15 +434,11 @@ public class RemoteSecurityService {
private Token getLogin(IdPasswordAuthModel dPasswordAuthModel) {
Token toke = new Token();
RequestContext.setProduct(productWeb);
FeignClientResult feignClientResult = Privilege.authClient.idpassword(dPasswordAuthModel);
Map map = (Map) feignClientResult.getResult();
if (map != null) {
toke.setToke(map.get("token").toString());
toke.setProduct(productWeb);
toke.setAppKey(appKeyApp);
redisTemplate.opsForValue().set(buildKey(dPasswordAuthModel.getLoginId()), JSONObject.toJSONString(toke), 28, TimeUnit.DAYS);
}
RequestContext.setProduct(amosRequestContext.getProduct());
toke.setToke(amosRequestContext.getToken());
toke.setProduct(amosRequestContext.getProduct());
toke.setAppKey(amosRequestContext.getAppKey());
redisTemplate.opsForValue().set(buildKey(dPasswordAuthModel.getLoginId()), JSONObject.toJSONString(toke), 28, TimeUnit.DAYS);
return toke;
}
}
package com.yeejoin.equipmanage.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.Map;
/**
* 服务类
*
*/
public interface DutyDetailsService {
IPage<Map<String, Object>> dutyPersonPageList(int current, int size, String bizOrgCode);
}
......@@ -27,7 +27,7 @@ public interface EquipmentManageService extends IService<EquipmentManageEntity>
* @param pageSize
* @return
*/
Map<String, Object> queryEquipmenInfoAndCount(String equimentName, String equimentCode, String construction, String maintenance, String bizOrgCode, String formGroupId , int spage, int pageSize, String controBoxBuildId,String companyId);
Map<String, Object> queryEquipmenInfoAndCount(String equimentName, String equimentCode, String construction, String maintenance, String bizOrgCode, String formGroupId , int spage, int pageSize, String controBoxBuildId,String companyId, String nameOrCode);
/**
* 获取下拉菜单数据
......
......@@ -3,6 +3,7 @@ package com.yeejoin.equipmanage.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.equipmanage.common.dto.AnalysisReportLogDto;
import com.yeejoin.equipmanage.common.entity.AnalysisReportLog;
import com.yeejoin.equipmanage.common.enums.AnalysisReportEnum;
......@@ -35,4 +36,13 @@ public interface IAnalysisReportLogService extends IService<AnalysisReportLog> {
* @param endDate 结束日期
*/
void generateMonthReport(AnalysisReportEnum monthReport, Date beginDate, Date endDate) throws ParseException;
/**
* 消防物联报表列表分页查询
* @param page
* @param dto
* @return
*/
IPage<AnalysisReportLogDto> iotReportPage (Page page, AnalysisReportLogDto dto);
}
......@@ -74,7 +74,7 @@ public interface IBuilldService extends IService<Building> {
*
* @return List<BuildingTreeVo>
*/
List<BuildingTreeVo> getBuildingTree();
List<BuildingTreeVo> getBuildingTree(String bizOrgCode);
/**
* 消防建筑树查询接口(带条件bizOrgCode)
......@@ -346,4 +346,6 @@ public interface IBuilldService extends IService<Building> {
List<BuildingTreeVo> getBuildingTreeInMyOrgCodeList(String bizOrgCode);
List<OrgMenuDto> companyTreeByUserAndType();
List<BuildingTreeVo> treeByName(String bizOrgCode, String name);
}
......@@ -40,7 +40,7 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
* @param pageSize
* @return
*/
Map<String, Object> queryEquipmenInfoAndCount(String equimentName, String equimentCode, String construction, String maintenance, String bizOrgCode, String formGroupId, int current, int pageSize,String controBoxBuildId,String companyId);
Map<String, Object> queryEquipmenInfoAndCount(String equimentName, String equimentCode, String construction, String maintenance, String bizOrgCode, String formGroupId, int current, int pageSize,String controBoxBuildId,String companyId, String nameOrCode);
FireFightingSystemEntity getOneById(Long id);
......
......@@ -70,7 +70,7 @@ public interface IFormInstanceService extends IService<FormInstance> {
* @param parentId 父节点
* @return List<Map < String, Object>>
*/
List<Map<String, Object>> getSpecialChildrenList(String parentId);
List<Map<String, Object>> getSpecialChildrenList(String parentId, String bizOrgCode);
/**
* 查询指定节点的下降
......@@ -164,4 +164,12 @@ public interface IFormInstanceService extends IService<FormInstance> {
List<UnitAreaTreeVo> getValueByColumn(Long instanceId, String bizOrgcode);
List<Map<String, Long>> getBuildVideoCount();
/**
* 查询指定节点的下降
*
* @param parentId 父节点
* @return List<Map < String, Object>>
*/
List<Map<String, Object>> getSpecialChildrenListByName(String parentId, String bizOrgCode, String name);
}
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.equipmanage.common.dto.AnalysisReportLogDto;
import com.yeejoin.equipmanage.common.entity.AnalysisReportLog;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemEntity;
import com.yeejoin.equipmanage.common.entity.publics.BaseEntity;
......@@ -39,6 +40,8 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM
@Autowired
AnalysisReportSummaryMapper analysisReportSummaryMapper;
@Autowired
AnalysisReportLogMapper analysisReportLogMapper;
@Override
public IPage<AnalysisReportLog> listPage(Page page, AnalysisReportLog analysisReportLog) {
......@@ -127,4 +130,9 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM
}
return desc.toString();
}
@Override
public IPage<AnalysisReportLogDto> iotReportPage(Page page, AnalysisReportLogDto dto) {
return analysisReportLogMapper.iotReportPage(page, dto);
}
}
......@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.thoughtworks.xstream.mapper.Mapper;
import com.yeejoin.amos.boot.biz.common.dto.OrgMenuDto;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
......@@ -270,7 +271,7 @@ public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements IA
vo.setType("area");
vo.setBizOrgCode(area.getBizOrgCode());
vo.setBizOrgName(area.getBizOrgName());
vo.setParentId(area.getParentId().equals(0L) ? orgMap.get(area.getBizOrgCode()) : area.getParentId());
vo.setParentId(Objects.isNull(area.getParentId()) || area.getParentId().equals(0L) ? orgMap.get(area.getBizOrgCode()) : area.getParentId());
return vo;
}).collect(Collectors.toList());
orgTreeList.addAll(areaTreeVoList);
......
......@@ -452,8 +452,20 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
}
@Override
public List<BuildingTreeVo> getBuildingTree(String bizOrgCode) {
List<BuildingTreeVo> allListVo = getBuildingTreeVos(true, bizOrgCode);
return allListVo.stream().filter(s -> "-1".equals(s.getParentId())).map(s -> {
BuildingTreeVo t = new BuildingTreeVo();
Bean.copyExistPropertis(s, t);
t.setChildren(this.getChildren(t.getInstanceId(), allListVo));
t.setDetailPaneApi(address);
t.setApiUrl(apiUrl);
return t;
}).collect(Collectors.toList());
}
public List<BuildingTreeVo> getBuildingTree() {
List<BuildingTreeVo> allListVo = getBuildingTreeVos(true);
List<BuildingTreeVo> allListVo = getBuildingTreeVos(true, null);
return allListVo.stream().filter(s -> "-1".equals(s.getParentId())).map(s -> {
BuildingTreeVo t = new BuildingTreeVo();
Bean.copyExistPropertis(s, t);
......@@ -488,12 +500,12 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
@Override
public List<Map<String, Object>> getBuildingDetaiList() {
return iFormInstanceService.getSpecialChildrenList(null);
return iFormInstanceService.getSpecialChildrenList(null, null);
}
private List<BuildingTreeVo> getBuildingTreeVos(Boolean isContainRootNode) {
private List<BuildingTreeVo> getBuildingTreeVos(Boolean isContainRootNode, String bizOrgCode) {
FormGroup formGroup = iFormGroupService.getByUniqueKey(GroupCodeEnum.ALL_BUILDING.getGroupCode());
List<Map<String, Object>> allList = iFormInstanceService.getSpecialChildrenList(null);
List<Map<String, Object>> allList = iFormInstanceService.getSpecialChildrenList(null, bizOrgCode);
List<BuildingTreeVo> allListVo = buildBuildingData(formGroup, allList, isContainRootNode);
Map<Long, String> absolutePositionMap = getBuildingAbsolutePosition(allListVo);
allListVo.forEach(s -> s.setAbsolutePosition(absolutePositionMap.get(s.getId())));
......@@ -505,7 +517,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
@Override
public List<BuildingTreeVo> getBuildingTierTree(Integer tier) {
if (tier != null) {
List<BuildingTreeVo> list = getBuildingTreeVos(true);
List<BuildingTreeVo> list = getBuildingTreeVos(true, null);
if (!CollectionUtils.isEmpty(list)) {
if (tier == 1) {
List<BuildingTreeVo> collect = list.stream().filter(x -> "-1".equals(x.getParentId()) || "building".equalsIgnoreCase(x.getGroupType())).collect(Collectors.toList());
......@@ -1217,7 +1229,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
@Override
public Map<Long, String> getBuildingAbsolutePosition() {
FormGroup formGroup = iFormGroupService.getByUniqueKey(GroupCodeEnum.ALL_BUILDING.getGroupCode());
List<Map<String, Object>> allList = iFormInstanceService.getSpecialChildrenList(null);
List<Map<String, Object>> allList = iFormInstanceService.getSpecialChildrenList(null, null);
List<BuildingTreeVo> allListVo = buildBuildingData(formGroup, allList, true);
return getBuildingAbsolutePosition(allListVo);
}
......@@ -1225,7 +1237,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
@Override
public Map<String, Long> getBuildingCodeKey() {
Map<String, Long> resMap = new HashMap<>();
List<Map<String, Object>> allList = iFormInstanceService.getSpecialChildrenList(null);
List<Map<String, Object>> allList = iFormInstanceService.getSpecialChildrenList(null, null);
if (!allList.isEmpty()) {
allList.forEach(map -> resMap.put(String.valueOf(map.get("code")), Long.valueOf(String.valueOf(map.get("id")))));
}
......@@ -1387,7 +1399,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
if (StringUtils.isEmpty(authKey)) {
authKey = this.authKey;
}
List<BuildingTreeVo> buildingTreeVos = getBuildingTreeVos(false);
List<BuildingTreeVo> buildingTreeVos = getBuildingTreeVos(false, null);
// 1.获取公司list
List<OrgUsrDto> orgUsrLists = jcsRemoteService.getCompanyDeptListWithAuth(authKey, "COMPANY");
if(orgUsrLists.isEmpty()){
......@@ -1537,7 +1549,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
//如果传递的为部门bizOrgCode 取其上级单位下的建筑
// ResponseModel<OrgUsrDto> companyByBizOrgCodeList = jcsFeign.getCompanyByBizOrgCodeList(bizOrgCode);
// String resultCode = companyByBizOrgCodeList.getResult().getBizOrgCode();
List<BuildingTreeVo> buildingTreeVos = this.getBuildingTreeVos(true);
List<BuildingTreeVo> buildingTreeVos = this.getBuildingTreeVos(true, null);
List<BuildingTreeVo> orgBuildingTreeVos = buildingTreeVos.stream().filter(b-> b.getBizOrgCode() != null && b.getBizOrgCode().contains(bizOrgCode)).collect(Collectors.toList());
return buildingTreeVos.stream().filter(b -> "-1".equals(b.getParentId())).peek(b -> {
b.setId(0L);
......@@ -1550,7 +1562,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
//如果传递的为部门bizOrgCode 取其上级单位下的建筑
ResponseModel<OrgUsrDto> companyByBizOrgCodeList = jcsFeign.getCompanyByBizOrgCodeList(bizOrgCode);
String companyCode = companyByBizOrgCodeList.getResult().getBizOrgCode();
List<BuildingTreeVo> buildingTreeVos = this.getBuildingTreeVos(true);
List<BuildingTreeVo> buildingTreeVos = this.getBuildingTreeVos(true, bizOrgCode);
List<BuildingTreeVo> orgBuildingTreeVos = buildingTreeVos.stream().filter(b-> b.getBizOrgCode() != null && b.getBizOrgCode().startsWith(companyCode)).collect(Collectors.toList());
......@@ -1565,7 +1577,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
//如果传递的为部门bizOrgCode 取其上级单位下的建筑
ResponseModel<OrgUsrDto> companyByBizOrgCodeList = jcsFeign.getCompanyByBizOrgCodeList(bizOrgCode);
String companyCode = companyByBizOrgCodeList.getResult().getBizOrgCode();
List<BuildingTreeVo> buildingTreeVos = this.getBuildingTreeVos(true);
List<BuildingTreeVo> buildingTreeVos = this.getBuildingTreeVos(true, bizOrgCode);
List<BuildingTreeVo> orgBuildingTreeVos = buildingTreeVos.stream().filter(b-> b.getBizOrgCode() != null && b.getBizOrgCode().startsWith(companyCode)).collect(Collectors.toList());
return orgBuildingTreeVos;
}
......@@ -1580,4 +1592,26 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
a.setChildren(getCompanyBuildingChildrenTree(a.getId().toString(), all));
}).collect(Collectors.toList());
}
@Override
public List<BuildingTreeVo> treeByName(String bizOrgCode, String name) {
List<BuildingTreeVo> allListVo = getBuildingTreeVosByName(true, bizOrgCode, name);
return allListVo.stream().filter(s -> "-1".equals(s.getParentId())).map(s -> {
BuildingTreeVo t = new BuildingTreeVo();
Bean.copyExistPropertis(s, t);
t.setChildren(this.getChildren(t.getInstanceId(), allListVo));
t.setDetailPaneApi(address);
t.setApiUrl(apiUrl);
return t;
}).collect(Collectors.toList());
}
private List<BuildingTreeVo> getBuildingTreeVosByName(Boolean isContainRootNode, String bizOrgCode, String name) {
FormGroup formGroup = iFormGroupService.getByUniqueKey(GroupCodeEnum.ALL_BUILDING.getGroupCode());
List<Map<String, Object>> allList = iFormInstanceService.getSpecialChildrenListByName(null, bizOrgCode, name);
List<BuildingTreeVo> allListVo = buildBuildingData(formGroup, allList, isContainRootNode);
Map<Long, String> absolutePositionMap = getBuildingAbsolutePosition(allListVo);
allListVo.forEach(s -> s.setAbsolutePosition(absolutePositionMap.get(s.getId())));
return allListVo;
}
}
......@@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.IotSystemAlarmRo;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.equipmanage.common.dto.UserDto;
import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.vo.AlamVideoVO;
import com.yeejoin.equipmanage.common.enums.*;
......@@ -23,6 +22,7 @@ import com.yeejoin.equipmanage.remote.WebMqttHandler;
import com.yeejoin.equipmanage.service.*;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
......@@ -39,16 +39,24 @@ import java.util.*;
@Service
public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, EquipmentSpecificAlarm> implements IConfirmAlarmService {
private static final org.slf4j.Logger log = LoggerFactory.getLogger(ConfirmAlarmServiceImpl.class);
private final static String FIELD_NAME = "longitude,latitude";
@Autowired
private RemoteSecurityService remoteSecurityService;
static ConfirmAlarmMapper confirmAlarmMapper;
@Autowired
ConfirmAlarmMapper confirmAlarmMapper;
public void setConfirmAlarmMapper(ConfirmAlarmMapper confirmAlarmMapper){
ConfirmAlarmServiceImpl.confirmAlarmMapper = confirmAlarmMapper;
}
private static JcsFeign jcsFeign;
@Autowired
private JcsFeign jcsFeign;
public void setJcsFeign(JcsFeign jcsFeign){
ConfirmAlarmServiceImpl.jcsFeign = jcsFeign;
}
@Autowired
VideoMapper videoMapper;
......@@ -66,9 +74,12 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
@Autowired
private IEquipmentSpecificAlarmLogService equipmentSpecificAlarmLogService;
private static IEquipmentSpecificSerivce equipmentSpecificSerivce;
@Autowired
@Lazy
private IEquipmentSpecificSerivce equipmentSpecificSerivce;
public void setIEquipmentSpecificIndexSerivce(IEquipmentSpecificSerivce equipmentSpecificSerivce){
ConfirmAlarmServiceImpl.equipmentSpecificSerivce = equipmentSpecificSerivce;
}
@Autowired
private IEquipmentSpecificIndexSerivce iEquipmentSpecificIndexSerivce;
......@@ -88,8 +99,11 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
@Autowired
private SystemctlFeign systemctlFeign;
private static RuleConfirmAlarmService ruleConfirmAlamService;
@Autowired
private RuleConfirmAlarmService ruleConfirmAlamService;
public void setRuleConfirmAlamService(RuleConfirmAlarmService ruleConfirmAlamService){
ConfirmAlarmServiceImpl.ruleConfirmAlamService = ruleConfirmAlamService;
}
@Autowired
private EquipmentSpecificMapper equipmentSpecificMapper;
......@@ -103,8 +117,11 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
@Autowired
private ISignalClassifyService signalClassifyService;
private static IFormInstanceService instanceService;
@Autowired
private IFormInstanceService instanceService;
public void setInstanceService(IFormInstanceService instanceService){
ConfirmAlarmServiceImpl.instanceService = instanceService;
}
@Autowired
private SourceSceneMapper sourceSceneMapper;
......@@ -191,7 +208,7 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
set(EquipmentSpecific::getRealtimeIotIndexUpdateDate,new Date()).
eq(EquipmentSpecific::getId,alarm.getEquipmentSpecificId());
equipmentSpecificSerivce.update(wrapper);
MqttReceiveServiceImpl.upAlarmLogStatus(alarmLog.getIotCode(), alarmLog.getEquipmentSpecificIndexKey(), null, equipmentSpecificAlarmLogService);
MqttReceiveServiceImpl.upAlarmLogStatus(alarmLog.getIotCode(), alarmLog.getEquipmentSpecificIndexKey(), null, equipmentSpecificAlarmLogService, true);
}
// 如果是批量确警,先查询,再确警,用于批量消息推送
isBatch = ent.getIsBatch();
......@@ -387,7 +404,7 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
//查询当前建筑是否是 最顶级建筑
public List<FormInstance> selectBuildingById(List<FormInstance> formInstances){
public static List<FormInstance> selectBuildingById(List<FormInstance> formInstances){
if (formInstances.get(0).getGroupType().equals("building")){
return formInstances;
}
......@@ -404,7 +421,7 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
}
public void sendIotSystemAlarm(EquipmentSpecificAlarmLog ent, String userId, String appKey, String product, String token){
public static void sendIotSystemAlarm(EquipmentSpecificAlarmLog ent, String userId, String appKey, String product, String token){
// Token serverToken = remoteSecurityService.getServerToken();
IotSystemAlarmRo confirmAlamVo = new IotSystemAlarmRo();
confirmAlamVo.setId(ent.getId());
......
......@@ -72,7 +72,7 @@ public class DownloadFileService implements IDownloadFileService {
//建筑信息
FormGroup formGroup = iFormGroupService.getByUniqueKey(GroupCodeEnum.ALL_BUILDING.getGroupCode());
List<Map<String, Object>> allList = iFormInstanceService.getSpecialChildrenList(null);
List<Map<String, Object>> allList = iFormInstanceService.getSpecialChildrenList(null, null);
List<BuildingTreeVo> allListVo = buildBuildingData(formGroup, allList);
appDownload.setBuildTree(allListVo);
......
package com.yeejoin.equipmanage.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.equipmanage.mapper.DutyDetailsMapper;
import com.yeejoin.equipmanage.service.DutyDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
@Service
public class DutyDetailsImpl implements DutyDetailsService {
@Autowired
private DutyDetailsMapper dutyDetailsMapper;
@Autowired
RedisUtils redisUtils;
@Override
public IPage<Map<String, Object>> dutyPersonPageList(int current, int size,String bizOrgCode) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String dutyDate = sdf.format(new Date());
Page page = new Page();
if (current > 0){
page.setCurrent((long) (current - 1) *size);
page.setSize(size);
}
return dutyDetailsMapper.selectDutyPersonList(page, dutyDate, bizOrgCode);
}
}
......@@ -56,7 +56,7 @@ public class EquipmentManageServiceImpl extends ServiceImpl<EquipmentManageMappe
@Override
public Map<String, Object> queryEquipmenInfoAndCount(String equimentName, String equimentCode, String construction, String maintenance,
String bizOrgCode, String formGroupId, int current, int pageSize,String controBoxBuildId,String companyCode) {
String bizOrgCode, String formGroupId, int current, int pageSize,String controBoxBuildId,String companyCode, String nameOrCode) {
HttpServletRequest request = null;
Map map = new HashMap<String, Object>();
map.put("equimentName", equimentName);
......@@ -69,11 +69,14 @@ public class EquipmentManageServiceImpl extends ServiceImpl<EquipmentManageMappe
map.put("companyCode", companyCode);
map.put("formGroupId", formGroupId);
map.put("controBoxBuildId",controBoxBuildId);
map.put("nameOrCode", nameOrCode);
List<EquipmentManageVo> dataList = equipmentManageMapper.queryEquipmenInfo(map);
Long count = equipmentManageMapper.queryEquipmenCount(map);
map.clear();
map.put("dataList", dataList);
map.put("count", count);
map.put("current", current);
map.put("pageSize", pageSize);
return map;
}
......
......@@ -371,8 +371,8 @@ public class FilePatrolReportServiceImpl implements IFirePatrolReportService {
analysisReportLog.setEndDate(endDate);
analysisReportLog.setReportType(reportType);
analysisReportLog.setStationCode(stationCode);
Long rootParentId = Long.valueOf(String.valueOf(analysisReportLogMapper.getRootOrgUsr().get("sequence_nbr")));
return analysisReportLogMapper.allPage(page, analysisReportLog, rootParentId);
//Long rootParentId = Long.valueOf(String.valueOf(analysisReportLogMapper.getRootOrgUsr().get("sequence_nbr")));
return analysisReportLogMapper.allPage(page, analysisReportLog);
}
@Override
......
......@@ -250,8 +250,8 @@ public class FireAutoSysManageReportServiceImpl implements IFireAutoSysManageRep
analysisReportLog.setEndDate(endDate);
analysisReportLog.setReportType(reportType);
analysisReportLog.setStationCode(stationCode);
Long rootParentId = Long.valueOf(String.valueOf(analysisReportLogMapper.getRootOrgUsr().get("sequence_nbr")));
return analysisReportLogMapper.allPage(page, analysisReportLog, rootParentId);
//Long rootParentId = Long.valueOf(String.valueOf(analysisReportLogMapper.getRootOrgUsr().get("sequence_nbr")));
return analysisReportLogMapper.allPage(page, analysisReportLog);
}
@Override
......
......@@ -163,9 +163,9 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override
public Map<String, Object> queryEquipmenInfoAndCount(String equimentName, String equimentCode, String construction,
String maintenance, String bizOrgCode, String formGroupId, int current, int pageSize,String controBoxBuildId,String companyId) {
String maintenance, String bizOrgCode, String formGroupId, int current, int pageSize, String controBoxBuildId,String companyId, String nameOrCode) {
Map<String, Object> map = equipmentManageService.queryEquipmenInfoAndCount(equimentName, equimentCode,
construction, maintenance, bizOrgCode, formGroupId, current, pageSize,controBoxBuildId, companyId);
construction, maintenance, bizOrgCode, formGroupId, current, pageSize, controBoxBuildId, companyId, nameOrCode);
List<EquipmentManageVo> dataList = (List<EquipmentManageVo>) map.get("dataList");
StringBuilder stb = new StringBuilder();
dataList.forEach(y -> {
......
......@@ -432,8 +432,8 @@ public class FormInstanceServiceImpl extends ServiceImpl<FormInstanceMapper, For
}
@Override
public List<Map<String, Object>> getSpecialChildrenList(String parentId) {
return this.baseMapper.querySpecialChildrenList(parentId);
public List<Map<String, Object>> getSpecialChildrenList(String parentId, String bizOrgCode) {
return this.baseMapper.querySpecialChildrenList(parentId, bizOrgCode);
}
@Override
......@@ -559,4 +559,9 @@ public class FormInstanceServiceImpl extends ServiceImpl<FormInstanceMapper, For
public List<Map<String, Long>> getBuildVideoCount() {
return formInstanceMapper.getBuildVideoCount();
}
@Override
public List<Map<String, Object>> getSpecialChildrenListByName(String parentId, String bizOrgCode, String name) {
return this.baseMapper.querySpecialChildrenListByName(parentId, bizOrgCode, name);
}
}
......@@ -15,6 +15,7 @@ import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import com.yeejoin.equipmanage.common.entity.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
......@@ -34,11 +35,6 @@ import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecific;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarm;
import com.yeejoin.equipmanage.common.entity.EquipmentSystemSourceStatistics;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemEntity;
import com.yeejoin.equipmanage.common.entity.WarehouseStructure;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentStateVo;
import com.yeejoin.equipmanage.common.entity.vo.MainIotMonitorItemContentVo;
import com.yeejoin.equipmanage.common.entity.vo.MainIotMonitorItemVo;
......@@ -264,7 +260,7 @@ public class MainIotMonitorServiceImpl implements IMainIotMonitorSerivce {
type = EquipmentStateEnum.PB.getType();
statusType = "shield";
}
EquipmentSpecificAlarm idvo = confirmAlarmMapper.getIdAndConfirmType(id);
EquipmentSpecificAlarmLog idvo = confirmAlarmMapper.getIdAndConfirmType(id);
Date time = new Date();
if (idvo != null && idvo.getId() != null){
itemVo.setAlamId(idvo.getId().toString());
......@@ -327,7 +323,7 @@ public class MainIotMonitorServiceImpl implements IMainIotMonitorSerivce {
String equSystemId = jsonObj.getString("systemId");
/* 设备id */
String speId = jsonObj.getString("speId");
EquipmentSpecificAlarm idvo = confirmAlarmMapper.getIdAndConfirmType(speId);
EquipmentSpecificAlarmLog idvo = confirmAlarmMapper.getIdAndConfirmType(speId);
if (systemId.equals(equSystemId) && StringUtil.isNotEmpty(speId)) {
/* 设备名称 */
String speName = jsonObj.getString("speName");
......
......@@ -57,8 +57,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
private static Map<String, TemperatureAlarmDto> temperatureMap = new HashMap<>();
static IEquipmentSpecificIndexService equipmentSpecificIndexService;
@Autowired
IEquipmentSpecificIndexService equipmentSpecificIndexService;
public void setEquipmentSpecificIndexService(IEquipmentSpecificIndexService equipmentSpecificIndexService){
MqttReceiveServiceImpl.equipmentSpecificIndexService = equipmentSpecificIndexService;
}
@Autowired
ICarPropertyService carPropertyService;
......@@ -82,17 +85,27 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Autowired
EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
static EquipmentSpecificMapper equipmentSpecificMapper;
@Autowired
EquipmentSpecificMapper equipmentSpecificMapper;
public void setEquipmentSpecificMapper(EquipmentSpecificMapper equipmentSpecificMapper){
MqttReceiveServiceImpl.equipmentSpecificMapper = equipmentSpecificMapper;
}
@Autowired
FireFightingSystemMapper FireFightingSystemMapper;
static IFireFightingSystemService fireFightingSystemService;
@Autowired
IFireFightingSystemService fireFightingSystemService;
public void setFireFightingSystemService(IFireFightingSystemService fireFightingSystemService){
MqttReceiveServiceImpl.fireFightingSystemService = fireFightingSystemService;
}
static MqttSendGateway mqttSendGateway;
@Autowired
MqttSendGateway mqttSendGateway;
public void setMqttSendGateway(MqttSendGateway mqttSendGateway){
MqttReceiveServiceImpl.mqttSendGateway = mqttSendGateway;
}
@Autowired
private RedisUtils redisUtils;
......@@ -118,8 +131,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Autowired
private SystemctlFeign systemctlFeign;
private static RemoteSecurityService remoteSecurityService;
@Autowired
private RemoteSecurityService remoteSecurityService;
public void setRemoteSecurityService(RemoteSecurityService remoteSecurityService){
MqttReceiveServiceImpl.remoteSecurityService = remoteSecurityService;
}
@Autowired
private TopographyService topographyService;
......@@ -133,8 +149,11 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Value("${mqtt.vehicle.topic}")
private String carTopic;
private static String canvasTopic;
@Value("${equip.point.equipmentdata.topic}")
private String canvasTopic;
public void setCanvasTopic(String canvasTopic){
MqttReceiveServiceImpl.canvasTopic = canvasTopic;
}
@Value("${equip.index.topic}")
private String indexTopic;
......@@ -154,6 +173,12 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Value("${isSendIot:false}")
private Boolean isSendIot;
private static Boolean jcsSwitch;
@Value("${systemctl.jcs.switch}")
public void setJcsSwitch(Boolean jcsSwitch){
MqttReceiveServiceImpl.jcsSwitch = jcsSwitch;
}
private static Boolean bool = Boolean.FALSE;
@Override
......@@ -308,7 +333,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
mqttSendGateway.sendToMqtt(TopicEnum.EQDQR.getTopic(), JSONArray.toJSON(action).toString());
} else {
alarmLogs.addAll(upAlarmLogStatus(action.getIotCode(), action.getEquipmentSpecificIndexKey(), action.getTraceId(),
equipmentSpecificAlarmLogService));
equipmentSpecificAlarmLogService, false));
mqttSendGateway.sendToMqtt(TopicEnum.EQYQR.getTopic(), JSONArray.toJSON(action).toString());
bool = Boolean.TRUE;
}
......@@ -386,23 +411,69 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
}
public static List<EquipmentSpecificAlarmLog> upAlarmLogStatus(String iotCode, String equipmentSpecificIndexKey,
String traceId, IEquipmentSpecificAlarmLogService equipmentSpecificAlarmLogService) {
String traceId, IEquipmentSpecificAlarmLogService equipmentSpecificAlarmLogService, boolean flag) {
LambdaQueryWrapper<EquipmentSpecificAlarmLog> queryWrapper = new LambdaQueryWrapper();
queryWrapper.eq(EquipmentSpecificAlarmLog::getIotCode, iotCode);
queryWrapper.eq(EquipmentSpecificAlarmLog::getEquipmentSpecificIndexKey, equipmentSpecificIndexKey);
queryWrapper.ne(EquipmentSpecificAlarmLog::getStatus, AlarmStatusEnum.HF.getCode());
List<EquipmentSpecificAlarmLog> logs = equipmentSpecificAlarmLogService.getBaseMapper()
.selectList(queryWrapper);
logs.forEach(x -> {
x.setCleanTime(new Date());
x.setStatus(AlarmStatusEnum.HF.getCode());
if (!StringUtils.isEmpty(traceId)) {
x.setTraceId(traceId);
if (0 < logs.size()) {
EquipmentSpecificAlarmLog log = logs.get(0);
String cleanType = equipmentSpecificMapper.getEquipmentBySpecificId(log.getEquipmentSpecificId());
EquipmentSpecific specific = equipmentSpecificMapper.selectById(log.getEquipmentSpecificId());
Date date = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(date);
logs.forEach(x -> {
x.setCleanTime(new Date());
x.setStatus(AlarmStatusEnum.HF.getCode());
x.setEquipmentSpecificIndexValue(TrueOrFalseEnum.fake.value);
if (!StringUtils.isEmpty(traceId)) {
x.setTraceId(traceId);
}
// 自动确警处理
if (StringUtil.isNotEmpty(cleanType) && AlarmCleanTypeEnum.ZDXC.getCode().equals(cleanType)){
x.setConfirmType(x.getType());
x.setConfirmTypeName(ConfirmAlamEnum.getTypeByCode(x.getType()));
String equipmentName = StringUtil.isNotEmpty(specific.getCode()) ? specific.getName() + "(" + specific.getCode() + ")" : specific.getName();
if (x.getType().equals(AlarmTypeEnum.PB.getCode())) {
x.setAlarmReason(equipmentName + "频繁故障/误报,将设备报警信息屏蔽。");
} else {
x.setAlarmReason(equipmentName + "引起设备报警");
}
x.setResolveResult(dateString + "系统收到设备复归(已消除)信号,系统自动处理。");
x.setConfirmUser("");
x.setConfirmUserName("系统自动处理");
x.setConfirmDate(date);
}
});
if (jcsSwitch && AlarmTypeEnum.HZGJ.getCode().equals(log.getType())) {
Token token = remoteSecurityService.getServerToken();
String toke = token.getToke();
String appKey = token.getAppKey();
String product = token.getProduct();
String userId = remoteSecurityService.getAgencyUser().getUserId();
// 确警消息发送
if (org.apache.commons.lang3.StringUtils.isNotBlank(userId)) {
new Thread(new Runnable() {
@Override
public void run() {
try {
ConfirmAlarmServiceImpl.sendIotSystemAlarm(log, userId, appKey, product, toke);
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
}
});
if (!logs.isEmpty()) {
equipmentSpecificAlarmLogService.updateBatchById(logs);
}
if (flag) {
List<EquipmentSpecificIndex> indexList = equipmentSpecificIndexService.getEquipmentSpeIndexBySpeIotCode(iotCode);
publishDataToCanvas(indexList);
}
return logs;
}
......@@ -411,7 +482,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
*
* @param indexList
*/
public void publishDataToCanvas(List<EquipmentSpecificIndex> indexList) {
public static void publishDataToCanvas(List<EquipmentSpecificIndex> indexList) {
if (!ObjectUtils.isEmpty(indexList)) {
EquipmentSpecificIndex index = indexList.stream().filter(x -> x.getUpdateDate() != null)
.sorted(Comparator.comparing(EquipmentSpecificIndex::getUpdateDate).reversed())
......
......@@ -534,7 +534,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
date="上传成功:"+(equipmentDetailDownloadVOS.size()-(split!=null?split.length:0))+"条---上传失败:"+(split!=null?split.length:0)+"条(失败编号:"+errBufferName+"详情:"+erryy+")";
}else{
date="上传成功:"+(equipmentDetailDownloadVOS.size())+"条---上传失败:"+"0条(失败编号:"+errBufferName+"详情:"+erryy+")";
date="上传成功:"+(equipmentDetailDownloadVOS.size())+"条";
}
log.error(date);
......
......@@ -45,5 +45,16 @@
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".apt_generated">
<attributes>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path=".apt_generated_tests">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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