Commit f68386a1 authored by tangwei's avatar tangwei

Merge branch 'developer' into develop_ccs

# Conflicts: # amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/controller/OrgUsrController.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/OrgUsrServiceImpl.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/controller/EquipmentSpecificController.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/mapper/EquipmentSpecificMapper.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/IEquipmentSpecificSerivce.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/BuildingServiceImpl.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/EquipmentSpecificSerivceImpl.java # amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/service/impl/AlertSubmittedServiceImpl.java # amos-boot-system-equip/src/main/resources/application-docker.properties # amos-boot-system-equip/src/main/resources/application-jcs.properties # amos-boot-system-equip/src/main/resources/application-qa.properties # amos-boot-system-equip/src/main/resources/application-test.properties # amos-boot-system-equip/src/main/resources/changelog/wl-3.0.1.xml # amos-boot-system-equip/src/main/resources/mapper/EquipmentSpecificMapper.xml ---------合并dev 到css
parents d7b0565f 3eba64b3
......@@ -104,7 +104,12 @@ public class PermissionInterceptor implements Interceptor {
BoundSql boundSql = (BoundSql) metaObject.getValue("delegate.boundSql");
String sql = boundSql.getSql();
// 将权限规则拼接到原始sql
try {
sql = processSelectSql(sql, dataAuthorization, reginParam, boundSql);
} catch (Exception e) {
PermissionInterceptorContext.clean();
logger.debug(e.getMessage());
}
metaObject.setValue("delegate.boundSql.sql", sql);
PermissionInterceptorContext.clean();
return invocation.proceed();
......
......@@ -61,7 +61,10 @@ public interface DutyPersonShiftMapper extends BaseMapper<DutyPersonShift> {
@Param("groupCode") String groupCode
);
List<Map<String, Object>> newStationViewData(
@Param("dutyDate") String dutyDate,
@Param("groupCode") String groupCode
);
/**
* 利用mysql 生成连续时间区间
*
......@@ -137,4 +140,8 @@ public interface DutyPersonShiftMapper extends BaseMapper<DutyPersonShift> {
List<Map<String, Object>> queryByCompanyId(@Param(value="bizNames") List<String> bizNames);
List<Map<String, Object>> queryByCompanyNew(String bizOrgName);
List<Map<String, Object>> getNewEquipmentForSpecifyDate(String dutyDate,String groupCode,String equipmentId,String equipmentName,String groupByName);
String getFirstAidCompanyId ();
}
package com.yeejoin.amos.boot.module.common.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.oracle.webservices.internal.api.databinding.DatabindingMode;
import com.yeejoin.amos.boot.biz.common.annotations.DataAuth;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
......
......@@ -30,7 +30,14 @@ public interface IDutyCommonService {
* @return ResponseModel
*/
List<Map<String, Object>> statisticsDay(String beginDate, String endDate) throws ParseException;
/**
* 新值班月视图
* @param beginDate
* @param endDate
* @return
* @throws ParseException
*/
List<Map<String, Object>> newStatisticsDay(String beginDate, String endDate) throws ParseException;
/**
* 不分页查询
*
......
......@@ -87,6 +87,21 @@
and i.group_code =#{groupCode}
GROUP BY i.field_value
</select>
<select id="newStationViewData" 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 = 'postTypeName'
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,
......@@ -187,6 +202,50 @@ select * from (
group by ${groupByName}
</if>
</select>
<select id='getNewEquipmentForSpecifyDate' resultType='map'>
select * from (
SELECT
MAX(
CASE
WHEN cd.FIELD_CODE = #{equipmentId} THEN
cd.FIELD_VALUE
END
) AS #{equipmentId},
MAX(
CASE
WHEN cd.FIELD_CODE = 'userName' THEN
cd.FIELD_VALUE
END
) AS 'userName',
MAX(
CASE
WHEN cd.FIELD_CODE = #{equipmentName} THEN
cd.FIELD_VALUE
END
) AS #{equipmentName}
FROM
cb_dynamic_form_instance cd
LEFT JOIN (
SELECT
dp.instance_id,
ds.`name`
FROM
cb_duty_person_shift dp
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
WHERE
dp.duty_date = #{dutyDate} and dp.is_delete=0
) cds ON cd.instance_id = cds.instance_id
where cd.group_code =#{groupCode} and cds.instance_id is not null and
cd.is_delete=0
group by cd.instance_id
) result
<if test="groupByName != null and groupByName!='' ">
group by ${groupByName}
</if>
</select>
<select id='getInstanceIdForSpecifyDateAndEquipment'
resultType='map'>
SELECT
......@@ -288,7 +347,7 @@ FROM
GROUP BY
cd.instance_id
) ss
LEFT JOIN (
<!-- LEFT JOIN (
SELECT
dp.instance_id,
ds.`name`
......@@ -301,7 +360,7 @@ LEFT JOIN (
AND NAME IS NOT NULL
) cds ON ss.instance_id = cds.instance_id
WHERE
cds.NAME =#{duty}
cds.NAME =#{duty} -->
GROUP BY
ss.postTypeName
</select>
......@@ -331,6 +390,16 @@ WHERE
</select>
<select id='getFirstAidCompanyId' resultType="string">
SELECT
sequence_nbr
FROM
cb_org_usr a
WHERE
a.is_delete = 0
AND
a.biz_org_name = '消防救援保障部'
</select>
<select id='getFirstAidForTypeCodeAndCompanyId' resultType="map">
SELECT
......
......@@ -519,6 +519,7 @@ AND instance_id = (
jc_user_car
WHERE
car_id = #{carId}
and is_delete = 0
)
) and field_code='telephone'
) ss
......
......@@ -101,4 +101,10 @@ public class Equipment extends BaseEntity {
*/
@TableField(value = "is_iot")
private String isIot = "0";
/**
* 警情消除策略 【0:收到复位信号自动消除;1:警情处理确认后消除】
*/
@TableField(value = "clean_type")
private String cleanType = "0";
}
......@@ -180,4 +180,12 @@ public class EquipmentSpecificAlarmLog extends BaseEntity {
@TableField("build_id")
@ApiModelProperty(value = "建筑id")
private String buildId;
@TableField("clean_time")
@ApiModelProperty(value = "消除时间")
private Date cleanTime;
@ApiModelProperty(value = "消除状态")
@TableField(exist = false)
private String cleanStatus;
}
......@@ -23,4 +23,6 @@ public class AlamVideoVO {
private String presetPosition;
private String vedioFormat;
}
......@@ -43,5 +43,6 @@ public class BuildingVideoVO {
@ApiModelProperty("详细地址")
private String presetPosition;
@ApiModelProperty("视频转码")
private String vedioFormat;
}
......@@ -28,4 +28,6 @@ public class EquipmentAlarmBySystemIdOrSourceIdVO {
* 告警类型
*/
private String type;
private Integer cleanStatus;
}
package com.yeejoin.equipmanage.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author keyong
* @title: AlarmCleanTypeEnum
* <pre>
* @description: TODO
* </pre>
* @date 2022/01/05 12:04
*/
@AllArgsConstructor
@Getter
public enum AlarmCleanTypeEnum {
ZDXC("0", "收到复位信号自动消除"), QRXC("1", "警情处理确认后消除");
private String code;
private String name;
}
......@@ -111,6 +111,16 @@ public class CommonPageInfoParam extends CommonPageable {
private String status;
public void setCleanStatus(String cleanStatus) {
this.cleanStatus = cleanStatus;
}
public String getCleanStatus() {
return cleanStatus;
}
private String cleanStatus;
public void setStatus(String status) {
this.status = status;
}
......
......@@ -57,6 +57,8 @@ public class CommonPageParamUtil {
param.setBuildIds((List<String>)queryRequests.get(i).getValue());
} else if("status".equals(name)){
param.setStatus(toString(queryRequests.get(i).getValue()));
} else if("cleanStatus".equals(name)){
param.setCleanStatus(toString(queryRequests.get(i).getValue()));
}
}
if(commonPageable !=null){
......
......@@ -23,6 +23,8 @@ public class AlarmListDataVO {
private String alarmEquip;
private String type;
private String alarmType;
private String alarmInfo;
......@@ -32,4 +34,8 @@ public class AlarmListDataVO {
private Long alarmId;
private String alarmTypeCode;
private String cleanStatus;
private String cleanStatusVal;
}
\ No newline at end of file
package com.yeejoin.equipmanage.common.vo;
import lombok.Data;
import java.util.List;
/**
* @ProjectName: amos-biz-boot
* @Package: com.yeejoin.equipmanage.common.vo
* @ClassName: VideoOnEquipmentSpecificVo
* @Author: Jianqiang Gao
* @Description: 摄像头绑定设备
* @Date: 2022/1/7 17:35
* @Version: 1.0
*/
@Data
public class VideoOnEquipmentSpecificVo {
/**
* 设备ID
*/
private Long equipmentSpecificId;
/**
* 摄像头Id集合
*/
private List<Long> videoIdList;
}
\ No newline at end of file
......@@ -161,9 +161,9 @@
LEFT JOIN jc_power_transfer_company b ON a.sequence_nbr = b.power_transfer_id
LEFT JOIN jc_power_transfer_company_resources c ON c.power_transfer_company_id = b.sequence_nbr
where a.sequence_nbr = (select sequence_nbr from jc_power_transfer where alert_called_id
where a.sequence_nbr in (select sequence_nbr from (select sequence_nbr from jc_power_transfer where alert_called_id
= #{alertId}
order by rec_date asc limit 1,100)
order by rec_date asc limit 1,100) as t )
</select>
......
package com.yeejoin.amos.latentdanger.common.enums;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public enum AuditEnum {
AUDIT("待审核","audit"),
REVIEW("待复核","review");
/**
* 名称,描述
*/
private String name;
/**
* 编码
*/
private String code;
AuditEnum(String name, String code){
this.name = name;
this.code = code;
}
public static AuditEnum getEnum(String code) {
AuditEnum auditEnum = null;
for(AuditEnum type: AuditEnum.values()) {
if (type.getCode().equals(code)) {
auditEnum = type;
break;
}
}
return auditEnum;
}
public static List<Map<String,String>> getEnumList() {
List<Map<String,String>> nameList = new ArrayList<>();
for (AuditEnum c: AuditEnum.values()) {
Map<String, String> map = new HashMap<String, String>();
map.put("name", c.getName());
map.put("code", c.getCode());
nameList.add(map);
}
return nameList;
}
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;
}
}
......@@ -90,7 +90,7 @@ public class LatentDanger extends BasicEntity {
/**
* 限制时间
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date reformLimitDate;
private Integer overtimeState;
......
......@@ -5,6 +5,7 @@ public enum ExecuteStateEnum {
未执行("未执行", 1, ""),
通过("通过", 2, "{\"action\": \"complete\",\"variables\": [{\"name\": \"rejected\",\"value\": false}]}"),
完毕("完毕", 2, "{\"action\": \"complete\",\"variables\": [{\"name\": \"rejected\",\"value\": false}]}"),
驳回("驳回", 3, "{\"action\": \"complete\",\"variables\": [{\"name\": \"rejected\",\"value\": true}]}"),
已确认("已确认", 4, ""),
停止执行("停止执行", 5, ""),
......
......@@ -7,7 +7,7 @@ public enum LatentDangerExcuteTypeEnum {
"{\"reviewResult\": \"通过\"}"),
隐患评审拒绝("隐患评审拒绝", 3, ExecuteStateEnum.驳回, LatentDangerStateEnum.已撤销,
"{\"reviewResult\": \"不通过\"}"),
隐患常规治理("隐患常规治理", 4, ExecuteStateEnum.通过, LatentDangerStateEnum.待验证,
隐患常规治理("隐患常规治理", 4, ExecuteStateEnum.完毕, LatentDangerStateEnum.待验证,
"{\"rectifyResult\": \"常规整改\"}"),
隐患安措计划("隐患安措计划", 5, ExecuteStateEnum.通过, LatentDangerStateEnum.安措计划中,
"{\"action\": \"complete\",\"variables\": [{\"name\": \"rectification\",\"value\": \"plan\"}]}"),
......
package com.yeejoin.amos.boot.module.tzs.flc.api.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 设备使用信息表
*
* @author system_generator
* @date 2022-01-05
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="EquipmentUseInfoDto", description="设备使用信息表")
public class EquipmentUseInfoDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "使用单位名称")
private String useUnitName;
@ApiModelProperty(value = "使用单位id")
private Long useUnitId;
@ApiModelProperty(value = "使用单位统一信用代码")
private String useOrganizationCode;
@ApiModelProperty(value = "产权单位名称")
private String propertyUnitName;
@ApiModelProperty(value = "产权单位id")
private Long propertyUnitId;
@ApiModelProperty(value = "产权统一信用代码")
private String propertyOrganizationCode;
@ApiModelProperty(value = "使用地址")
private String useAddress;
@ApiModelProperty(value = "经度")
private String longitude;
@ApiModelProperty(value = "纬度")
private String latitude;
@ApiModelProperty(value = "使用场所")
private String useSite;
@ApiModelProperty(value = "使用场所编码")
private String useSiteCode;
@ApiModelProperty(value = "特设编码")
private String specialCode;
@ApiModelProperty(value = "设备注册代码")
private String registerCode;
@ApiModelProperty(value = "96333识别码")
private String rescueCode;
@ApiModelProperty(value = "使用登记证编码")
private String registerLicenceCode;
@ApiModelProperty(value = "登记机关")
private String registerOrg;
@ApiModelProperty(value = "登记机关id")
private Long registerOrgId;
@ApiModelProperty(value = "登记日期")
private Date registerTime;
@ApiModelProperty(value = "发证日期")
private Date issueLicenceTime;
@ApiModelProperty(value = "投入使用日期")
private Date startUseTime;
@ApiModelProperty(value = "设备id")
private Long equipmentId;
}
package com.yeejoin.amos.boot.module.tzs.flc.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 设备使用信息表
*
* @author system_generator
* @date 2022-01-05
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("tcb_equipment_use_info")
public class EquipmentUseInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 使用单位名称
*/
@TableField("use_unit_name")
private String useUnitName;
/**
* 使用单位id
*/
@TableField("use_unit_id")
private Long useUnitId;
/**
* 使用单位统一信用代码
*/
@TableField("use_organization_code")
private String useOrganizationCode;
/**
* 产权单位名称
*/
@TableField("property_unit_name")
private String propertyUnitName;
/**
* 产权单位id
*/
@TableField("property_unit_id")
private Long propertyUnitId;
/**
* 产权统一信用代码
*/
@TableField("property_organization_code")
private String propertyOrganizationCode;
/**
* 使用地址
*/
@TableField("use_address")
private String useAddress;
/**
* 经度
*/
@TableField("longitude")
private String longitude;
/**
* 纬度
*/
@TableField("latitude")
private String latitude;
/**
* 使用场所
*/
@TableField("use_site")
private String useSite;
/**
* 使用场所编码
*/
@TableField("use_site_code")
private String useSiteCode;
/**
* 特设编码
*/
@TableField("special_code")
private String specialCode;
/**
* 设备注册代码
*/
@TableField("register_code")
private String registerCode;
/**
* 96333识别码
*/
@TableField("rescue_code")
private String rescueCode;
/**
* 使用登记证编码
*/
@TableField("register_licence_code")
private String registerLicenceCode;
/**
* 登记机关
*/
@TableField("register_org")
private String registerOrg;
/**
* 登记机关id
*/
@TableField("register_org_id")
private Long registerOrgId;
/**
* 登记日期
*/
@TableField("register_time")
private Date registerTime;
/**
* 发证日期
*/
@TableField("issue_licence_time")
private Date issueLicenceTime;
/**
* 投入使用日期
*/
@TableField("start_use_time")
private Date startUseTime;
/**
* 设备id
*/
@TableField("equipment_id")
private Long equipmentId;
}
package com.yeejoin.amos.boot.module.tzs.flc.api.mapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentUseInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 设备使用信息表 Mapper 接口
*
* @author system_generator
* @date 2022-01-05
*/
public interface EquipmentUseInfoMapper extends BaseMapper<EquipmentUseInfo> {
}
package com.yeejoin.amos.boot.module.tzs.flc.api.service;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentAssociatedDto;
/**
* 配套设备/设施/部件接口类
*
......@@ -9,4 +11,5 @@ package com.yeejoin.amos.boot.module.tzs.flc.api.service;
*/
public interface IEquipmentAssociatedService {
EquipmentAssociatedDto updateAssociated(EquipmentAssociatedDto model);
}
package com.yeejoin.amos.boot.module.tzs.flc.api.service;
/**
* 设备使用信息表接口类
*
* @author system_generator
* @date 2022-01-05
*/
public interface IEquipmentUseInfoService {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.tzs.flc.api.mapper.EquipmentUseInfoMapper">
</mapper>
......@@ -94,6 +94,20 @@ public class DutyCarController extends BaseController {
}
/**
* 值班月视图
*
* @return ResponseModel
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping("/new-statistics-day")
@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
) throws ParseException {
return ResponseHelper.buildResponse(iDutyCarService.newStatisticsDay(beginDate, endDate));
}
/**
* 调班
*
* @return ResponseModel
......
......@@ -92,7 +92,20 @@ public class DutyFireFightingController extends BaseController{
) throws ParseException {
return ResponseHelper.buildResponse(iDutyFireFightingService.statisticsDay(beginDate, endDate));
}
/**
* 新值班月视图
*
* @return ResponseModel
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping("/new-statistics-day")
@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
) throws ParseException {
return ResponseHelper.buildResponse(iDutyFireFightingService.newStatisticsDay(beginDate, endDate));
}
/**
* 调班
*
......
......@@ -84,7 +84,15 @@ public class DutyFirstAidController extends BaseController{
) throws ParseException {
return ResponseHelper.buildResponse(iDutyFirstAidService.statisticsDay(beginDate, endDate));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping("/new-statistics-day")
@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
) throws ParseException {
return ResponseHelper.buildResponse(iDutyFirstAidService.newStatisticsDay(beginDate, endDate));
}
/**
* 调班
*
......
......@@ -93,7 +93,20 @@ public class DutyPersonController extends BaseController {
) throws ParseException {
return ResponseHelper.buildResponse(iDutyPersonService.statisticsDay(beginDate, endDate));
}
/**
* 值班月视图
*
* @return ResponseModel
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping("/new-duty-detail")
@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
) throws ParseException {
return ResponseHelper.buildResponse(iDutyPersonService.newStatisticsDay(beginDate, endDate));
}
/**
* 调班
......@@ -168,7 +181,14 @@ public class DutyPersonController extends BaseController {
@ApiParam(value = "岗位") @RequestParam(required = false) String postType) {
return ResponseHelper.buildResponse(iDutyPersonService.dayDutyPersonList(dutyDay, shiftId, postType));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("新查询指定日期值班人信息列表")
@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));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("查询当前值班人信息列表")
@GetMapping("/person/on_duty/list")
......
......@@ -91,7 +91,7 @@ public class OrgPersonController {
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "更新单位数据", notes = "更新单位数据")
@ApiOperation(httpMethod = "PUT", value = "更新人员数据", notes = "更新人员数据")
public ResponseModel<?> updateByIdOrgUsr(HttpServletRequest request, @RequestBody OrgPersonDto OrgPersonVo,
@PathVariable Long id) throws Exception {
OrgPersonVo.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_PERSON);
......
......@@ -257,6 +257,55 @@ public class OrgUsrController extends BaseController {
page = iOrgUsrService.page(pageBean, orgUsrQueryWrapper);
return page;
}
/**
* 列表分页查询
*
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/new-list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "新列表分页查询---只查询当前登录人本单位下的对应数据信息", notes = "新列表分页查询---只查询当前登录人本单位下的对应数据信息")
public IPage<OrgUsr> newlistPage(String pageNum, String pageSize, OrgUsr orgUsr) {
ReginParams reginParams = getSelectedOrgInfo();
String companyIdString= reginParams.getPersonIdentity().getCompanyId();
orgUsr.setParentId(companyIdString);
Page<OrgUsr> pageBean;
QueryWrapper<OrgUsr> orgUsrQueryWrapper = new QueryWrapper<>();
Class<? extends OrgUsr> aClass = orgUsr.getClass();
Arrays.stream(aClass.getDeclaredFields()).forEach(field -> {
try {
field.setAccessible(true);
Object o = field.get(orgUsr);
if (o != null) {
Class<?> type = field.getType();
String name = NameUtils.camel2Underline(field.getName());
if (type.equals(Integer.class)) {
Integer fileValue = (Integer) field.get(orgUsr);
orgUsrQueryWrapper.eq(name, fileValue);
} else if (type.equals(Long.class)) {
Long fileValue = (Long) field.get(orgUsr);
orgUsrQueryWrapper.eq(name, fileValue);
} else if (type.equals(String.class)) {
String fileValue = (String) field.get(orgUsr);
orgUsrQueryWrapper.eq(name, fileValue);
} else {
String fileValue = (String) field.get(orgUsr);
orgUsrQueryWrapper.eq(name, fileValue);
}
}
} catch (Exception e) {
}
});
orgUsrQueryWrapper.eq("is_delete", 0);
IPage<OrgUsr> page;
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE);
} else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
page = iOrgUsrService.page(pageBean, orgUsrQueryWrapper);
return page;
}
/**
* 导入部门信息
......@@ -597,6 +646,7 @@ public class OrgUsrController extends BaseController {
return ResponseHelper.buildResponse(iOrgUsrService.getOrgUserByAmosUserId(amosUserId));
}
/**
* 根据机构类型和登陆人bizOrgCode获取列表不分页
*
......@@ -645,4 +695,5 @@ public class OrgUsrController extends BaseController {
return ResponseHelper.buildResponse(menus);
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.common.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.ContractDto;
import com.yeejoin.amos.boot.module.common.api.entity.Contract;
import com.yeejoin.amos.boot.module.common.api.entity.MaintenanceCompany;
import com.yeejoin.amos.boot.module.common.api.entity.SourceFile;
import com.yeejoin.amos.boot.module.common.api.mapper.ContractMapper;
import com.yeejoin.amos.boot.module.common.api.service.IContractService;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.FileInfoModel;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -23,10 +16,17 @@ import org.typroject.tyboot.core.rdbms.annotation.Operator;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.DataNotFound;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.ContractDto;
import com.yeejoin.amos.boot.module.common.api.entity.Contract;
import com.yeejoin.amos.boot.module.common.api.entity.MaintenanceCompany;
import com.yeejoin.amos.boot.module.common.api.entity.SourceFile;
import com.yeejoin.amos.boot.module.common.api.mapper.ContractMapper;
import com.yeejoin.amos.boot.module.common.api.service.IContractService;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.FileInfoModel;
/**
* 维保合同服务实现类
......@@ -53,8 +53,6 @@ public class ContractServiceImpl extends BaseService<ContractDto, Contract, Cont
MaintenanceCompany company = maintenanceCompanyService.getMaintenanceCompany(amosUserId);
companyId = company.getSequenceNbr();
}
//
Page<ContractDto> resultPage= queryForContractPageByParam(page, isDelete, companyId, signedCompanyId, name, typeCode,
signedDate);
List<ContractDto> resultContractDtos= resultPage.getRecords();
......
......@@ -170,21 +170,23 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa
if (StringUtils.isNotBlank(instanceId)) {
String[] instanceIds = instanceId.split(",");
List<Map<String, Object>> dutyList = dutyPersonShiftMapper.getDutyForSpecifyDate(dutyDay);
if(dutyList!=null && dutyList.size()>0) {
for (Map<String, Object> dutyDetail : dutyList) {
if(!dutyDetail.containsKey("name")) {
continue;
}
// List<Map<String, Object>> dutyList = dutyPersonShiftMapper.getDutyForSpecifyDate(dutyDay);
// if(dutyList!=null && dutyList.size()>0) {
// for (Map<String, Object> dutyDetail : dutyList) {
// if(!dutyDetail.containsKey("name")) {
// continue;
// }
// 获取当前装备ID下的排版数据
List<Map<String, Object>> specifyDateList = dutyPersonShiftMapper.getPositionStaffDutyForSpecifyDate(dutyDay,
this.getGroupCode(), instanceIds,dutyDetail.get("name").toString());
this.getGroupCode(), instanceIds,null);
if(specifyDateList==null || specifyDateList.size() < 1 || specifyDateList.get(0)==null) {
continue;
}
LinkedHashMap<String, Object> infoMap_1 =new LinkedHashMap<String, Object>();
infoMap_1.put(dutyDetail.get("name").toString(), "");
resultList.add(infoMap_1);
//取消掉班次的显示---2022-01-16 by chenhao ---start
//infoMap_1.put(dutyDetail.get("name").toString(), "");
//resultList.add(infoMap_1);
//取消掉班次的显示---2022-01-16 by chenhao ---end
for (Map<String, Object> specify : specifyDateList) {
LinkedHashMap<String, Object> infoMap_2 =new LinkedHashMap<String, Object>();
// infoMap_2.put(specify.get("postTypeName").toString(),specify.get("userName").toString());
......@@ -194,32 +196,8 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa
resultList.add(infoMap_2);
}
}
}
}
// 获取当前装备ID下的排版数据
// List<Map<String, Object>> specifyDateList = dutyPersonShiftMapper.getSpecifyDateList(dutyDay,
// this.getGroupCode(), instanceIds,null);
// for (Map<String, Object> specify : specifyDateList) {
//
// if(!specify.containsKey("name") || specify.get("name").toString()==null) {
// continue;
// }
// LinkedHashMap<String, Object> infoMap_1 =new LinkedHashMap<String, Object>();
// infoMap_1.put(specify.get("name").toString(), "");
// resultList.add(infoMap_1);
// Map<String, Object> equipmentOperatorMap = dutyPersonShiftMapper.getEquipmentOperator(dutyDay,
// this.getGroupCode(), instanceIds, "消防车驾驶员", specify.get("name").toString());
// String operator =null;
// if (equipmentOperatorMap!=null && equipmentOperatorMap.containsKey("userName")) {
// operator = equipmentOperatorMap.get("equipmentOperatorMap").toString();
// }
// LinkedHashMap<String, Object> infoMap_2 =new LinkedHashMap<String, Object>();
// infoMap_2.put("驾驶员", operator!=null?operator:"");
// resultList.add(infoMap_2);
// LinkedHashMap<String, Object> infoMap_3 =new LinkedHashMap<String, Object>();
// infoMap_3.put("战斗员",specify.get("value").toString());
// resultList.add(infoMap_3);
// }
// }
//}
}
detailList.add(resultList);
}
......
......@@ -46,6 +46,7 @@ import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormColumn;
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.enums.DutyViewTypeEnum;
import com.yeejoin.amos.boot.module.common.api.mapper.DutyPersonShiftMapper;
import com.yeejoin.amos.boot.module.common.api.service.IDutyCommonService;
/**
......@@ -76,6 +77,9 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
@Autowired
OrgUsrServiceImpl orgUsrService;
@Autowired
DutyPersonShiftMapper dutyPersonShiftMapper;
/**
* 每天单个班次执勤人数全部小于等于3人
*/
......@@ -214,6 +218,125 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
/*bug2468 值班排班,日历视图单班次执勤人数满足≤3且班次≤2时,值班显示方式错误 陈召 结束*/
}
public List<Map<String, Object>> newStatisticsDay(String beginDate, String endDate) throws ParseException {
Date dateBegin = DateUtils.dateParse(beginDate, DateUtils.DATE_PATTERN);
String timeStart = DateUtils.dateTimeToDateString(dateBegin);
Date dateEnd = DateUtils.dateParse(endDate, DateUtils.DATE_PATTERN);
String timeEnd = DateUtils.dateTimeToDateString(dateEnd);
List<String> betweenDate = getBetweenDate(timeStart, timeEnd);
//拿到每一天的视图展示
String beginTime = null;
String endTime = null;
List<Map<String, Object>> viewTypeResult = new ArrayList<>();
for (String time : betweenDate) {
beginTime = time + " 00:00:00";
endTime = time + " 23:59:59";
Map<String, Object> viewTypeMap = new HashMap<>();
viewTypeMap.put("date",time);
viewTypeResult.add(viewTypeMap);
}
List<Map<String, Object>> rangeDate = dutyPersonShiftService.getBaseMapper().genRangeDate(beginDate, endDate);
List<Map<String, Object>> resultMap = new ArrayList<>();
for (Map<String, Object> stringObjectMap : viewTypeResult) {
for (Map<String, Object> objectMap : rangeDate) {
if (stringObjectMap.get("date").equals(objectMap.get("date"))){
Map<String, Object> result = new LinkedHashMap<>();
result.put("key", objectMap.get("date"));
String dateString = objectMap.get("date").toString();
if(this.getGroupCode().equals("dutyPerson")) {
result.put("data", getPersonPostTypeNameAndCount(dateString));
}else if(this.getGroupCode().equals("dutyCar")) {
result.put("data", getCarPostTypeNameAndCount(dateString));
}else if(this.getGroupCode().equals("dutyFireFighting")) {
result.put("data", getFireFightingPostTypeNameAndCount(dateString));
}else if(this.getGroupCode().equals("dutyFirstAid")) {
result.put("data", getFirstAidPostTypeNameAndCount(dateString));
}
resultMap.add(result);
}
}
}
return resultMap;
}
/**
* 排班值班人员的统计类型为:
* 岗位: 岗位人员数量
* @param dutyDate
* @return
*/
public Object getPersonPostTypeNameAndCount(String dutyDate) {
return dutyPersonShiftService.getBaseMapper().newStationViewData(dutyDate, this.getGroupCode());
}
/**
* 车辆值班人员左侧的统计: 只有几辆车
* @param dutyDate
* @return
*/
public Object getCarPostTypeNameAndCount(String dutyDate) {
Map<String, Object> map = new HashMap<String, Object>();
int station =0;
int person=0;
List<Map<String, Object>> equipmentList = dutyPersonShiftMapper.getEquipmentForSpecifyDate(dutyDate,
this.getGroupCode(), "carId", "carName", "teamName","result.carId");
if(equipmentList==null || equipmentList.size()<1 || equipmentList.get(0)==null) {
station =0;
}else {
station=equipmentList.size();
}
map.put("station", station);
List<Map<String, Object>> list = dutyPersonShiftService.getBaseMapper().newStationViewData(dutyDate, this.getGroupCode());
for (Map<String, Object> map2 : list) {
person = person +Integer.parseInt(map2.get("total").toString());
}
map.put("person", person);
return map;
}
public Object getFireFightingPostTypeNameAndCount(String dutyDate) {
Map<String, Object> map = new HashMap<String, Object>();
int station =0;
int person=0;
List<Map<String, Object>> equipmentList = dutyPersonShiftMapper.getEquipmentForSpecifyDate(dutyDate,
this.getGroupCode(), "fireFightingId", "fireFighting", "teamName","result.fireFightingId");
if(equipmentList==null || equipmentList.size()<1 || equipmentList.get(0)==null) {
station =0;
}else {
station=equipmentList.size();
}
map.put("station", station);
List<Map<String, Object>> list = dutyPersonShiftService.getBaseMapper().newStationViewData(dutyDate, this.getGroupCode());
for (Map<String, Object> map2 : list) {
person = person +Integer.parseInt(map2.get("total").toString());
}
map.put("person", person);
return map;
}
public Object getFirstAidPostTypeNameAndCount(String dutyDate) {
Map<String, Object> map = new HashMap<String, Object>();
int station =0;
int person=0;
List<Map<String, Object>> equipmentList = dutyPersonShiftMapper.getEquipmentForSpecifyDate(dutyDate,
this.getGroupCode(), "firstAidId", "firstAid", "teamName", "result.firstAidId");
if(equipmentList==null || equipmentList.size()<1 || equipmentList.get(0)==null) {
station =0;
}else {
station=equipmentList.size();
}
map.put("station", station);
List<Map<String, Object>> list = dutyPersonShiftService.getBaseMapper().newStationViewData(dutyDate, this.getGroupCode());
for (Map<String, Object> map2 : list) {
person = person +Integer.parseInt(map2.get("total").toString());
}
map.put("person", person);
return map;
}
private Object buildViewData(DutyViewTypeEnum viewTypeEnum, String dutyDate, String appKey) {
List<Map<String, Object>> result = new ArrayList<>();
switch (viewTypeEnum) {
......
package com.yeejoin.amos.boot.module.common.biz.service.impl;
import static org.hamcrest.CoreMatchers.nullValue;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
......@@ -15,7 +13,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.Bean;
import com.itextpdf.text.pdf.PdfStructTreeController.returnType;
import com.yeejoin.amos.boot.module.common.api.dto.DutyFireFightingDto;
import com.yeejoin.amos.boot.module.common.api.dto.DynamicFormInstanceDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireStationDto;
......@@ -85,29 +82,29 @@ public class DutyFireFightingServiceImpl extends DutyCommonServiceImpl implement
if (StringUtils.isNotBlank(instanceId)) {
String[] instanceIds = instanceId.split(",");
List<Map<String, Object>> dutyList = dutyPersonShiftMapper.getDutyForSpecifyDate(dutyDay);
if(dutyList!=null && dutyList.size()>0) {
for (Map<String, Object> dutyDetail : dutyList) {
if(!dutyDetail.containsKey("name")) {
continue;
}
// List<Map<String, Object>> dutyList = dutyPersonShiftMapper.getDutyForSpecifyDate(dutyDay);
// if(dutyList!=null && dutyList.size()>0) {
// for (Map<String, Object> dutyDetail : dutyList) {
// if(!dutyDetail.containsKey("name")) {
// continue;
// }
// 获取当前装备ID下的排版数据
List<Map<String, Object>> specifyDateList = dutyPersonShiftMapper.getPositionStaffDutyForSpecifyDate(dutyDay,
this.getGroupCode(), instanceIds,dutyDetail.get("name").toString());
this.getGroupCode(), instanceIds,null);
if(specifyDateList==null || specifyDateList.size() < 1 || specifyDateList.get(0)==null) {
continue;
}
LinkedHashMap<String, Object> infoMap_1 =new LinkedHashMap<String, Object>();
infoMap_1.put(dutyDetail.get("name").toString(), "");
resultList.add(infoMap_1);
// LinkedHashMap<String, Object> infoMap_1 =new LinkedHashMap<String, Object>();
// infoMap_1.put(dutyDetail.get("name").toString(), "");
// resultList.add(infoMap_1);
for (Map<String, Object> specify : specifyDateList) {
LinkedHashMap<String, Object> infoMap_2 =new LinkedHashMap<String, Object>();
if( specify.containsKey("postTypeName")&& specify.get("postTypeName")!=null && specify.containsKey("userName")&& specify.get("userName")!=null ) {
infoMap_2.put(specify.get("postTypeName").toString(),specify.get("userName").toString());
resultList.add(infoMap_2);
}
}
}
// }
// }
}
}
detailList.add(resultList);
......
......@@ -7,6 +7,7 @@ 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;
......@@ -18,8 +19,6 @@ import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.mapper.DutyPersonShiftMapper;
import com.yeejoin.amos.boot.module.common.api.service.IDutyFirstAidService;
import ch.qos.logback.core.joran.conditional.IfAction;
@Service
public class DutyFirstAidServiceImpl extends DutyCommonServiceImpl implements IDutyFirstAidService {
......@@ -67,15 +66,15 @@ public class DutyFirstAidServiceImpl extends DutyCommonServiceImpl implements ID
}
List<Object> detailList = new ArrayList<Object>();
for (Map<String, Object> map : equipmentList) {
List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
LinkedHashMap<String, Object> titleMap_1 = new LinkedHashMap<String, Object>();
titleMap_1.put("120急救站", map.get("firstAid").toString());
resultList.add(titleMap_1);
LinkedHashMap<String, Object> titleMap_2 = new LinkedHashMap<String, Object>();
if(map.containsKey("teamName") && map.get("teamName") != null){
titleMap_2.put("单位/部门", map.get("teamName").toString());
}
resultList.add(titleMap_2);
List<Object> resultList = new ArrayList<Object>();
//LinkedHashMap<String, Object> titleMap_1 = new LinkedHashMap<String, Object>();
//titleMap_1.put("120急救站", map.get("firstAid").toString());
resultList.add( map.get("firstAid").toString());
// LinkedHashMap<String, Object> titleMap_2 = new LinkedHashMap<String, Object>();
// if(map.containsKey("teamName") && map.get("teamName") != null){
// titleMap_2.put("单位/部门", map.get("teamName").toString());
// }
// resultList.add(titleMap_2);
String carId = map.get("firstAidId").toString();
Map<String, Object> instanceMap = dutyPersonShiftMapper.getInstanceIdForSpecifyDateAndEquipment(dutyDay,
this.getGroupCode(), carId);
......@@ -86,22 +85,22 @@ public class DutyFirstAidServiceImpl extends DutyCommonServiceImpl implements ID
if (StringUtils.isNotBlank(instanceId)) {
String[] instanceIds = instanceId.split(",");
List<Map<String, Object>> dutyList = dutyPersonShiftMapper.getDutyForSpecifyDate(dutyDay);
if (dutyList != null && dutyList.size() > 0) {
for (Map<String, Object> dutyDetail : dutyList) {
if (!dutyDetail.containsKey("name")) {
continue;
}
// List<Map<String, Object>> dutyList = dutyPersonShiftMapper.getDutyForSpecifyDate(dutyDay);
// if (dutyList != null && dutyList.size() > 0) {
// for (Map<String, Object> dutyDetail : dutyList) {
// if (!dutyDetail.containsKey("name")) {
// continue;
// }
// 获取当前装备ID下的排版数据
List<Map<String, Object>> specifyDateList = dutyPersonShiftMapper
.getPositionStaffDutyForSpecifyDate(dutyDay, this.getGroupCode(), instanceIds,
dutyDetail.get("name").toString());
null);
if (specifyDateList == null || specifyDateList.size() < 1 || specifyDateList.get(0) == null) {
continue;
}
LinkedHashMap<String, Object> infoMap_1 = new LinkedHashMap<String, Object>();
infoMap_1.put(dutyDetail.get("name").toString(), "");
resultList.add(infoMap_1);
// LinkedHashMap<String, Object> infoMap_1 = new LinkedHashMap<String, Object>();
// infoMap_1.put(dutyDetail.get("name").toString(), "");
// resultList.add(infoMap_1);
for (Map<String, Object> specify : specifyDateList) {
LinkedHashMap<String, Object> infoMap_2 = new LinkedHashMap<String, Object>();
// infoMap_2.put(specify.get("postTypeName").toString(), specify.get("userName").toString());
......@@ -110,9 +109,9 @@ public class DutyFirstAidServiceImpl extends DutyCommonServiceImpl implements ID
infoMap_2.put(specify.get("postTypeName").toString(),specify.get("userName").toString());
resultList.add(infoMap_2);
}
}
}
// }
//
// }
}
}
detailList.add(resultList);
......@@ -125,6 +124,11 @@ public class DutyFirstAidServiceImpl extends DutyCommonServiceImpl implements ID
List< Map<String, Object>> result = new ArrayList<Map<String, Object>>();
List<String> userNameList= new ArrayList<String>();
String firstAidCompanyId = dutyPersonShiftMapper.getFirstAidCompanyId();
if (firstAidCompanyId != "" && firstAidCompanyId != null){
ids.add(firstAidCompanyId);
}
List<String> firstAidSimpleList = new ArrayList<String>();
List<String> companyNameList = new ArrayList<String>();
String typeString = "JJZ";
......@@ -157,10 +161,19 @@ public class DutyFirstAidServiceImpl extends DutyCommonServiceImpl implements ID
});
if( firstAidSimpleList != null && firstAidSimpleList.size() >= 1 ) {
detailMap.put("firstAidName", firstAidSimpleList);
resultList.add(detailMap);
}
resultList.add(detailMap);
});
result.add(resultList.get(0));
for (int i = 0; i < resultList.size(); i++) {
if (resultList.get(i).size() == 4){
result.add(resultList.get(i));
}
if (result.size()>0){
break;
}
}
return result;
}
......
......@@ -304,7 +304,48 @@ public Object BuildScheduleDetails(String dutyDay, Long shiftId, String postType
}
public Object getSchedulingDutyForSpecifyDate(String dutyDay, Long shiftId, String postType) {
List<Map<String, Object>> equipmentList = dutyPersonShiftMapper.getNewEquipmentForSpecifyDate(dutyDay,
this.getGroupCode(), "deptId", "deptName", "result.deptId");
if (equipmentList == null || equipmentList.size() < 1 || equipmentList.get(0) == null) {
return null;
}
List<Object> detailList = new ArrayList<Object>();
for (Map<String, Object> map : equipmentList) {
List<Object> resultList = new ArrayList<Object>();
LinkedHashMap<String, Object> titleMap_2 = new LinkedHashMap<String, Object>();
if(map.containsKey("deptName") && map.get("deptName") != null){
resultList.add( map.get("deptName").toString());
}
String carId = map.get("deptId").toString();
Map<String, Object> instanceMap = dutyPersonShiftMapper.getInstanceIdForSpecifyDateAndEquipment(dutyDay,
this.getGroupCode(), carId);
if (instanceMap == null) {
continue;
}
String instanceId = instanceMap.get("instanceIds").toString();
if (StringUtils.isNotBlank(instanceId)) {
String[] instanceIds = instanceId.split(",");
// 获取当前装备ID下的排版数据
List<Map<String, Object>> specifyDateList = dutyPersonShiftMapper
.getPositionStaffDutyForSpecifyDate(dutyDay, this.getGroupCode(), instanceIds,
null);
if (specifyDateList == null || specifyDateList.size() < 1 || specifyDateList.get(0) == null) {
continue;
}
for (Map<String, Object> specify : specifyDateList) {
LinkedHashMap<String, Object> infoMap_2 = new LinkedHashMap<String, Object>();
if( specify.containsKey("postTypeName")&& specify.get("postTypeName")!=null && specify.containsKey("userName")&& specify.get("userName")!=null ) {
infoMap_2.put(specify.get("postTypeName").toString(),specify.get("userName").toString());
resultList.add(infoMap_2);
}
}
}
detailList.add(resultList);
}
return detailList;
}
......
......@@ -323,6 +323,7 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
// 发起主表流程 并添加至报修日志
failureDetailsDto.setSubmissionTime(new Date());
failureDetailsDto.setCurrentStatus(FailureStatuEnum.WAITING_AUDIT.getCode());
FailureDetailsDto model = this.updateWithModel(failureDetailsDto);
if (ObjectUtils.isNotEmpty(failureDetailsDto.getAttachment())) {
......
......@@ -85,10 +85,15 @@ public class FailureVerifyServiceImpl extends BaseService<FailureVerifyDto, Fail
FailureDetailsDto failureDetailsDto = failureDetailsService.queryBySeq(model.getFaultId());
List<FailureVerify> byfaultId = findByfaultId(failureDetailsDto.getSequenceNbr());
if (byfaultId.size() != 0) {
if (byfaultId.size() != 0 && status.getCode().equals(FailureStatuEnum.FINISH.getCode())) {
failureDetailsDto.setCurrentStatus(status.getCode());
}
if (condition == AuditResultEnum.REFUSE.getCode()){
failureDetailsDto.setCurrentStatus(status.getCode());
}
failureDetailsDto.setSequenceNbr(model.getFaultId());
failureDetailsService.updateWithModel(failureDetailsDto);
......
......@@ -642,7 +642,7 @@ public class MaintenanceCompanyServiceImpl
MaintenanceCompany maintenanceCompany = new MaintenanceCompany();
if (ValidationUtil.isEmpty(seq)) {
maintenanceCompany = getMaintenanceCompany(amosUserId);
seq = maintenanceCompany.getParentId();
seq = maintenanceCompany.getSequenceNbr();
}
// 机场单位列表基本信息
if (pageNum == -1 || pageSize == -1) {
......@@ -674,11 +674,11 @@ public class MaintenanceCompanyServiceImpl
LambdaQueryWrapper<MaintenanceCompany> wrapper = new LambdaQueryWrapper<MaintenanceCompany>();
wrapper.eq(MaintenanceCompany::getIsDelete, false);
wrapper.eq(MaintenanceCompany::getAmosId, amosUserId);
MaintenanceCompany maintenanceCompany = this.baseMapper.selectOne(wrapper);
MaintenanceCompany maintenancePerson = this.baseMapper.selectOne(wrapper);
// DynamicFormInstance dyFormInstance = dynamicFormInstanceService.getOne(
// new LambdaQueryWrapper<DynamicFormInstance>().eq(DynamicFormInstance::getFieldCode, "amosAccount")
// .eq(DynamicFormInstance::getFieldValue, amosUserId));
if (ValidationUtil.isEmpty(maintenanceCompany)) {
if (ValidationUtil.isEmpty(maintenancePerson)) {
throw new BadRequest("维保账号不存在或未关联系统账号.");
}
// MaintenanceCompany person = this.getOne(new LambdaQueryWrapper<MaintenanceCompany>()
......@@ -686,11 +686,11 @@ public class MaintenanceCompanyServiceImpl
// if (ValidationUtil.isEmpty(person)) {
// throw new BadRequest("维保账号不存在或未关联系统账号.");
// }
// maintenanceCompany = this.getOne(new LambdaQueryWrapper<MaintenanceCompany>()
// .eq(MaintenanceCompany::getSequenceNbr, person.getParentId()));
// if (ValidationUtil.isEmpty(maintenanceCompany)) {
// throw new BadRequest("维保账号不存在或未关联系统账号.");
// }
MaintenanceCompany maintenanceCompany = this.getOne(new LambdaQueryWrapper<MaintenanceCompany>()
.eq(MaintenanceCompany::getSequenceNbr, maintenancePerson.getParentId()));
if (ValidationUtil.isEmpty(maintenanceCompany)) {
throw new BadRequest("维保公司不存在或未关联系统账号.");
}
return maintenanceCompany;
}
......@@ -817,7 +817,7 @@ public class MaintenanceCompanyServiceImpl
// 查询公司下人列表
List<MaintenanceCompany> personList = list(new LambdaQueryWrapper<MaintenanceCompany>()
.eq(MaintenanceCompany::getIsDelete, false).eq(MaintenanceCompany::getType, PERSON)
.likeRight(MaintenanceCompany::getCode, company.getCode()));
.eq(MaintenanceCompany::getParentId,company.getParentId()));
List<Long> instanceIdList = Lists.transform(personList, MaintenanceCompany::getInstanceId);
// 查询手机号
List<DynamicFormInstance> dynamicFormInstanceList = dynamicFormInstanceService
......@@ -830,7 +830,7 @@ public class MaintenanceCompanyServiceImpl
Map<String, Object> map = Maps.newHashMap();
map.put("sequenceNbr", person.getSequenceNbr());
map.put("name", person.getName());
map.put("tel", dyMap.get(person.getInstanceId()).get(0).getFieldValue());
map.put("tel", dyMap.get(person.getInstanceId()) != null ? dyMap.get(person.getInstanceId()).get(0).getFieldValue() : null);
resultList.add(map);
});
return resultList;
......
......@@ -41,6 +41,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
......@@ -51,7 +53,14 @@ import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 机构/部门/人员表 服务实现类
......@@ -495,8 +504,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
}
@Override
public OrgUsrDto saveOrgUsrDynamicFormInstance(OrgUsr orgUsr, List<DynamicFormInstance> alertFromValuelist)
throws Exception {
public OrgUsrDto saveOrgUsrDynamicFormInstance(OrgUsr orgUsr, List<DynamicFormInstance> alertFromValuelist) {
orgUsr.setRecDate(new Date());
AgencyUserModel user = Privilege.agencyUserClient.getme().getResult();
orgUsr.setRecUserName(user.getRealName());
......@@ -517,19 +525,14 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
});
// 保存动态表单数据
alertFormValueServiceImpl.saveBatch(alertFromValuelist);
OrgUsrFormDto formDto = this.selectCompanyById(orgUsrDto.getSequenceNbr());
if (OrgPersonEnum.公司.getKey().equals(orgUsrDto.getBizOrgType())) {
try {
emqKeeper.getMqttClient().publish(airportAddTopic, JSON.toJSONString(formDto).getBytes(), 2, false);
} catch (Exception e) {
e.getMessage();
}
}
return model;
}
@Override
public void updateDynamicFormInstance(Long instanceId, List<DynamicFormInstance> fromValueList) {
if (ValidationUtil.isEmpty(fromValueList)) {
return;
}
// 填充主键
fromValueList.forEach(alertFromValue -> {
alertFromValue.setInstanceId(instanceId);
......@@ -679,6 +682,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
* 同步保存ES
*/
eSOrgUsrService.saveAlertCalledToES(orgUsr);
syncCompany2Supervision(Lists.newArrayList(orgUsrDto.getSequenceNbr()));
return orgUsrDto;
}
......@@ -720,17 +725,18 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
saveOrgUsrDynamicFormInstance(orgUsr, OrgPersonVo.getDynamicFormValue());
}
@Transactional(rollbackFor = Exception.class)
@Override
public OrgUsrDto updateByIdOrgUsr(OrgUsrDto OrgUsrVo, Long id) throws Exception {
public OrgUsrDto updateByIdOrgUsr(OrgUsrDto orgUsrVo, Long id) throws Exception {
// 修改单位信息
OrgUsr orgUsr = new OrgUsr();
OrgUsr oriOrgUsr = getById(id);
BeanUtils.copyProperties(OrgUsrVo, orgUsr);
BeanUtils.copyProperties(orgUsrVo, orgUsr);
// 判断是否修改所属单位
if (!(oriOrgUsr.getParentId() != null ? oriOrgUsr.getParentId() : "").equals(OrgUsrVo.getParentId())) {
if (!(oriOrgUsr.getParentId() != null ? oriOrgUsr.getParentId() : "").equals(orgUsrVo.getParentId())) {
/* 单位编辑后 code值也应做出修改 2021-09-09 陈召 开始 */
OrgUsr parent = getById(OrgUsrVo.getParentId());
OrgUsr parent = getById(orgUsrVo.getParentId());
if (parent != null) {
orgUsr.setBizOrgCode(parent.getBizOrgCode() + getOrgCodeStr());
}
......@@ -752,13 +758,15 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
// saveOrgUsr(orgUsr, oriOrgUsr);
// 保存动态表单数据
updateDynamicFormInstance(orgUsr.getSequenceNbr(), OrgUsrVo.getDynamicFormValue());
updateDynamicFormInstance(orgUsr.getSequenceNbr(), orgUsrVo.getDynamicFormValue());
/**
* 同步保存ES
*/
eSOrgUsrService.saveAlertCalledToES(orgUsr);
OrgUsrVo.setBizOrgCode(orgUsr.getBizOrgCode());
return OrgUsrVo;
orgUsrVo.setBizOrgCode(orgUsr.getBizOrgCode());
syncCompany2Supervision(Lists.newArrayList(orgUsr.getSequenceNbr()));
return orgUsrVo;
}
@Override
......@@ -870,13 +878,16 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
}
@Override
public void saveCompany(List<OrgUsrDto> OrgUsrVo) throws Exception {
public void saveCompany(List<OrgUsrDto> OrgUsrVo) {
List<Long> companyIdList = Lists.newArrayList();
for (int i = 0; i < OrgUsrVo.size(); i++) {
OrgUsr orgUsr = new OrgUsr();
BeanUtils.copyProperties(OrgUsrVo.get(i), orgUsr);
orgUsr.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_COMPANY);
saveOrgUsrDynamicFormInstance(orgUsr, OrgUsrVo.get(i).getDynamicFormValue());
OrgUsrDto orgUsrDto = saveOrgUsrDynamicFormInstance(orgUsr, OrgUsrVo.get(i).getDynamicFormValue());
companyIdList.add(orgUsrDto.getSequenceNbr());
}
syncCompany2Supervision(companyIdList);
}
@Override
......@@ -2080,6 +2091,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
}
@Override
public List<OrgUsr> getListByBizOrgTypeCode(String orgTypes, String orgCode) {
List<String> orgTypeList = new ArrayList<>();
......@@ -2098,4 +2110,31 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
List<OrgUsr> list = orgUsrMapper.companyDeptListWithPersonCount(param);
return buildTreeParallel(list);
}
/**
* 同步单位信息到防火监督point表
*
* @param companyIdList
*/
protected void syncCompany2Supervision(List<Long> companyIdList) {
if (ValidationUtil.isEmpty(companyIdList)) {
return;
}
String token = RequestContext.getToken();
String appKey = RequestContext.getAppKey();
String product = RequestContext.getProduct();
new Thread(() -> companyIdList.forEach(id -> {
try {
RequestContext.setAppKey(appKey);
RequestContext.setToken(token);
RequestContext.setProduct(product);
OrgUsrFormDto formDto = this.selectCompanyById(id);
if (!ValidationUtil.isEmpty(formDto) && OrgPersonEnum.公司.getKey().equals(formDto.getBizOrgType())) {
emqKeeper.getMqttClient().publish(airportAddTopic, JSON.toJSONString(formDto).getBytes(), 2, false);
}
} catch (Exception e) {
logger.debug("syncCompany2Supervision error:", e.getMessage());
e.printStackTrace();
}
})).start();
}
}
......@@ -94,6 +94,8 @@ public class EquipmentAlarmController extends AbstractBaseController {
@RequestParam(value = "alarmType", required = false) String alarmType,
@RequestParam(value = "type", required = false) String type,
@RequestParam(value = "buildIds", required = false) List<String> buildIds,
@RequestParam(value = "id", required = false) String id,
@RequestParam(value = "cleanStatus", required = false) String cleanStatus,
CommonPageable commonPageable) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
......@@ -139,6 +141,14 @@ public class EquipmentAlarmController extends AbstractBaseController {
request9.setName("buildIds");
request9.setValue(ObjectUtils.isEmpty(buildIds) ? null : buildIds);
queryRequests.add(request9);
CommonRequest request10 = new CommonRequest();
request10.setName("id");
request10.setValue(StringUtil.isNotEmpty(id) ? StringUtils.trimToNull(id) : null);
queryRequests.add(request10);
CommonRequest request11 = new CommonRequest();
request11.setName("cleanStatus");
request11.setValue(StringUtil.isNotEmpty(cleanStatus) ? StringUtils.trimToNull(cleanStatus) : null);
queryRequests.add(request11);
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
Page<Map<String, Object>> list = iEquipmentSpecificAlarmService.listPage(param);
return CommonResponseUtil.success(list);
......@@ -200,6 +210,8 @@ public class EquipmentAlarmController extends AbstractBaseController {
@RequestParam(value = "systemCode", required = false) String systemCode,
@RequestParam(value = "buildId", required = false) String buildId,
// @RequestParam(value = "equipmentCode", required = false) String equipmentCode,
@RequestParam(value = "id", required = false) String id,
@RequestParam(value = "cleanStatus", required = false) String cleanStatus,
CommonPageable commonPageable) {
List<CommonRequest> queryRequests = new ArrayList<>();
CommonRequest request = new CommonRequest();
......@@ -235,6 +247,14 @@ public class EquipmentAlarmController extends AbstractBaseController {
request9.setName("buildId");
request9.setValue(StringUtil.isNotEmpty(buildId) ? StringUtils.trimToNull(buildId) : null);
queryRequests.add(request9);
CommonRequest request10 = new CommonRequest();
request10.setName("id");
request10.setValue(StringUtil.isNotEmpty(id) ? StringUtils.trimToNull(id) : null);
queryRequests.add(request10);
CommonRequest request11 = new CommonRequest();
request11.setName("cleanStatus");
request11.setValue(StringUtil.isNotEmpty(cleanStatus) ? StringUtils.trimToNull(cleanStatus) : null);
queryRequests.add(request11);
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
org.springframework.data.domain.Page<AlarmListDataVO> list = iEquipmentSpecificAlarmService.listAlarmsPage(param);
return CommonResponseUtil.success(list);
......
......@@ -35,6 +35,7 @@ import com.yeejoin.equipmanage.common.entity.vo.ComplementCodeVO;
import com.yeejoin.equipmanage.common.entity.vo.SourceNameByEquipSpeIdVO;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.common.vo.EquipmentOnCarVo;
import com.yeejoin.equipmanage.common.vo.VideoOnEquipmentSpecificVo;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificMapper;
import com.yeejoin.equipmanage.service.IEquipmentDetailService;
import com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce;
......@@ -42,6 +43,19 @@ import com.yeejoin.equipmanage.service.impl.FireFightingSystemServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.ObjectUtils;
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.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author ZeHua Li
......@@ -159,8 +173,8 @@ public class EquipmentSpecificController extends AbstractBaseController {
@RequestMapping(value = "/getOneCard", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "组装组态使用装备卡片数据")
public Object getOneCard(Long id , String type) {
return equipmentSpecificSerivce.getOneCard(id , type);
public Object getOneCard(Long id, String type) {
return equipmentSpecificSerivce.getOneCard(id, type);
}
/**
......@@ -246,12 +260,13 @@ public class EquipmentSpecificController extends AbstractBaseController {
/**
* 根据specificId删除装备相关数据
*
* @param specificId id
* @return ResponseModel
*/
@DeleteMapping(value = "/delEquipmentBySpecificId")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation( value = "删除装备相关所有数据", notes = "删除装备相关所有数据")
@ApiOperation(value = "删除装备相关所有数据", notes = "删除装备相关所有数据")
public ResponseModel delEquipmentBySpecificId(@RequestParam Long specificId) {
EquipmentSpecific equipmentSpecific = equipmentSpecificSerivce.getById(specificId);
Boolean result = equipmentSpecificSerivce.delEquipmentSpecific(specificId);
......@@ -271,17 +286,18 @@ public class EquipmentSpecificController extends AbstractBaseController {
/**
* 根据specificIds删除装备相关数据
*
* @param specificIds id
* @return ResponseModel
*/
@DeleteMapping(value = "/delAllEquipmentBySpecificIds")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation( value = "批量删除装备相关所有数据", notes = "批量删除装备相关所有数据")
@ApiOperation(value = "批量删除装备相关所有数据", notes = "批量删除装备相关所有数据")
public ResponseModel delEquipmentBySpecificId(@RequestBody List<Long> specificIds) {
if(ObjectUtils.isEmpty(specificIds)){
if (ObjectUtils.isEmpty(specificIds)) {
return CommonResponseUtil.failure("参数为空");
}
specificIds.forEach(specificId->{
specificIds.forEach(specificId -> {
equipmentSpecificSerivce.delEquipmentBySpecificId(specificId);
});
return CommonResponseUtil.success();
......@@ -293,4 +309,11 @@ public class EquipmentSpecificController extends AbstractBaseController {
public ResponseModel getFessIndexDetails() {
return CommonResponseUtil.success(equipmentSpecificSerivce.getFessIndexDetails());
}
@RequestMapping(value = "/videoOnEquipmentSpecific", method = RequestMethod.POST)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "摄像头绑定设备", notes = "摄像头绑定设备")
public ResponseModel videoOnEquipmentSpecific(@RequestBody VideoOnEquipmentSpecificVo videoOnEquipmentSpecificVo) {
return CommonResponseUtil.success(equipmentSpecificSerivce.videoOnEquipmentSpecific(videoOnEquipmentSpecificVo));
}
}
......@@ -629,7 +629,7 @@ public class FireFightingSystemController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "按照组态格式获取系统报警,或者建筑报警列表", notes = "按照组态格式获取系统报警,或者建筑报警列表")
@GetMapping(value = "/getEquipmentAlarmBySystemIdOrSourceIdVO/{Systemtype}/{id}")
public IPage<EquipmentAlarmBySystemIdOrSourceIdVO> getEquipmentAlarmBySystemIdOrSourceIdVO(int pageSize, int current, Integer confirmType, String createDate, String type, @PathVariable String Systemtype, @PathVariable Long id) {
public IPage<EquipmentAlarmBySystemIdOrSourceIdVO> getEquipmentAlarmBySystemIdOrSourceIdVO(Integer pageSize, Integer current, Integer confirmType, String createDate, String type, @PathVariable String Systemtype, @PathVariable Long id) {
Page<EquipmentAlarmBySystemIdOrSourceIdVO> page = new Page();
page.setCurrent(current);
page.setSize(pageSize);
......
......@@ -6,10 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.equipmanage.common.datasync.entity.FireEquipment;
import com.yeejoin.equipmanage.common.dto.EquipmentSpecificDto;
import com.yeejoin.equipmanage.common.dto.UserDto;
import com.yeejoin.equipmanage.common.entity.EquipmentCategory;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecific;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex;
import com.yeejoin.equipmanage.common.entity.MaintenanceResourceData;
import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.dto.EquipmentSpecificDTO;
import com.yeejoin.equipmanage.common.entity.vo.ComplementCodeVO;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentSpecificVo;
......@@ -201,9 +198,13 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
*/
List<Map<String, String>> getBoxTropicsIndexDetails();
/**
* 统计数据
* @return
*/
List<Map<String, Object>> queryCompanyStaData();
String getEquipmentBySpecificId(@Param("specificId") Long specificId);
}
......@@ -3,6 +3,9 @@ package com.yeejoin.equipmanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.equipmanage.common.entity.VideoEquipmentSpecific;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author ZeHua Li
......@@ -11,4 +14,5 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface VideoEquipmentSpecificMapper extends BaseMapper<VideoEquipmentSpecific> {
List<VideoEquipmentSpecific> findBySpecificIdAndVideoIdIn(@Param("equipmentSpecificId") Long equipmentSpecificId, @Param("list") List<Long> videoIdList);
}
package com.yeejoin.equipmanage.service;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
......@@ -16,14 +12,13 @@ import com.yeejoin.equipmanage.common.entity.EquipmentSpecific;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex;
import com.yeejoin.equipmanage.common.entity.dto.EquipmentSpecificDTO;
import com.yeejoin.equipmanage.common.entity.vo.ComplementCodeVO;
import com.yeejoin.equipmanage.common.entity.vo.DetailPaneVO;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentSpecificVo;
import com.yeejoin.equipmanage.common.entity.vo.SourceNameByEquipSpeIdVO;
import com.yeejoin.equipmanage.common.vo.EquipFor3DVO;
import com.yeejoin.equipmanage.common.vo.EquipmentDate;
import com.yeejoin.equipmanage.common.vo.EquipmentDetailVo;
import com.yeejoin.equipmanage.common.vo.EquipmentOnCarVo;
import com.yeejoin.equipmanage.common.vo.EquipmentSpecific3dVo;
import com.yeejoin.equipmanage.common.vo.*;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author ZeHua Li
......@@ -168,6 +163,7 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
/**
* 根据specificId删除相关数据
*
* @param specificId specificId
* @return Boolean
*/
......@@ -175,28 +171,39 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
/**
* 集成页面刷新,发送数据时调用
*
* @param systemTypeCode
*/
void integrationPageSysDataRefresh(String systemTypeCode);
/**
* 更新设备表实时指标状态
*
* @param indexs
*/
void updateEquipmentSpecIndexRealtimeData(List<EquipmentSpecificIndex> indexs);
List<EquipmentSpecificVo> getEquipAndCarIotcodeByIotcode(String iotCode);
/**
* 获取中州环境监测指标详情
*
* @return
*/
Map<String, List<Map<String, String>>> getFessIndexDetails();
/**
* 更新redis 统计数据
*/
void refreshStaData();
/* 设备绑定摄像头
*
* @param videoOnEquipmentSpecificVo
* @return
*/
Boolean videoOnEquipmentSpecific(VideoOnEquipmentSpecificVo videoOnEquipmentSpecificVo);
}
......@@ -3,10 +3,19 @@ package com.yeejoin.equipmanage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.equipmanage.common.entity.VideoEquipmentSpecific;
import java.util.List;
/**
* @author ZeHua Li
* @date 2020/11/23 15:42
* @since v2.0
*/
public interface IVideoEquipmentSpecificService extends IService<VideoEquipmentSpecific> {
/**
* 获取设备或摄像头ID绑定集合
* @param equipmentSpecificId
* @param videoIdList
* @return
*/
List<VideoEquipmentSpecific> findBySpecificIdAndVideoIdIn(Long equipmentSpecificId, List<Long> videoIdList);
}
......@@ -126,6 +126,8 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
@Autowired
private JCSRemoteService jcsRemoteService;
@Value("${window.vedioFormat}")
private String vedioFormat;
@Autowired
private SourceSceneMapper sourceSceneMapper;
......@@ -780,6 +782,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
x.setLocation(x.getAddress());
}
}
x.setVedioFormat(vedioFormat);
x.setUrl(videoService.getVideoUrl(x.getName(), x.getPresetPosition(), x.getUrl(), x.getCode()));
});
}
......
......@@ -2,6 +2,7 @@ package com.yeejoin.equipmanage.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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;
......@@ -11,16 +12,22 @@ import com.yeejoin.equipmanage.common.entity.EquipmentSpecific;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarm;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarmLog;
import com.yeejoin.equipmanage.common.entity.vo.AlamVideoVO;
import com.yeejoin.equipmanage.common.enums.AlarmCleanTypeEnum;
import com.yeejoin.equipmanage.common.enums.AlarmStatusEnum;
import com.yeejoin.equipmanage.common.enums.AlarmTypeEnum;
import com.yeejoin.equipmanage.common.enums.TopicEnum;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.fegin.JcsFeign;
import com.yeejoin.equipmanage.mapper.ConfirmAlarmMapper;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificAlarmMapper;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificMapper;
import com.yeejoin.equipmanage.mapper.VideoMapper;
import com.yeejoin.equipmanage.remote.RemoteSecurityService;
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.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
......@@ -28,6 +35,7 @@ import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -74,9 +82,20 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
@Value("${systemctl.jcs.switch}")
private Boolean jcsSwitch;
@Value("${window.vedioFormat}")
String vedioFormat;
@Autowired
private RuleConfirmAlarmService ruleConfirmAlamService;
@Autowired
private EquipmentSpecificMapper equipmentSpecificMapper;
@Autowired
private EquipmentSpecificAlarmMapper equipmentSpecificAlarmMapper;
@Override
public Map<String, Object> getDetailsById(Long alarmId, Long equipId, String type, String area) {
final String videoType = "video";
......@@ -85,6 +104,7 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
if (videoType.equals(type)) {
List<AlamVideoVO> video = videoMapper.getVideoBySpeId(equipId);
video.forEach(action -> {
action.setVedioFormat(vedioFormat);
action.setUrl(videoService.getVideoUrl(action.getName(), action.getPresetPosition(), action.getUrl(), action.getCode()));
});
res.put("video", video);
......@@ -103,6 +123,7 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
}
videoBySpeId.forEach(action -> {
action.setVedioFormat(vedioFormat);
action.setUrl(videoService.getVideoUrl(action.getName(), action.getPresetPosition(), action.getUrl(), action.getCode()));
});
res.put("data", specificAlarm);
......@@ -122,6 +143,27 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
if (!ObjectUtils.isEmpty(alarmLog)) {
Long equipmentSpecificAlarmId = alarmLog.getEquipmentSpecificAlarmId();
ent.setEquipmentSpecificAlarmId(equipmentSpecificAlarmId);
String cleanType = equipmentSpecificMapper.getEquipmentBySpecificId(alarmLog.getEquipmentSpecificId());
if (StringUtil.isNotEmpty(cleanType) && AlarmCleanTypeEnum.QRXC.getCode().equals(cleanType)) {
EquipmentSpecificAlarm alarm = equipmentSpecificAlarmMapper.selectById(alarmLog.getEquipmentSpecificAlarmId());
alarm.setStatus(AlarmStatusEnum.HF.getCode());
equipmentSpecificAlarmMapper.updateById(alarm);
if (isBatch == 1) {
List<EquipmentSpecificAlarmLog> logs = equipmentSpecificAlarmLogService.getIsConfirmByAlarmId(equipmentSpecificAlarmId, "0");
logs = logs.stream().map(x -> {
BeanUtils.copyProperties(ent, x);
x.setCleanTime(new Date());
x.setStatus(AlarmStatusEnum.HF.getCode());
return x;
}).collect(Collectors.toList());
equipmentSpecificAlarmLogService.updateBatchById(logs);
} else {
ent.setCleanTime(new Date());
ent.setStatus(AlarmStatusEnum.HF.getCode());
equipmentSpecificAlarmLogService.updateById(ent);
}
return;
}
// 如果是批量确警,先查询,再确警,用于批量消息推送
isBatch = ent.getIsBatch();
if (isBatch == 1) {
......
......@@ -126,7 +126,7 @@ public class EquipmentDetailServiceImpl extends ServiceImpl<EquipmentDetailMappe
equipmentDetail.setEquPropertyList(equPropertyList);
ManufacturerInfo manufacturerInfo = manufacturerInfoMapper.selectById(equipmentDetail.getManufacturerId());
if (manufacturerInfo != null) {
manufacturerInfo.setImg(fileServer + manufacturerInfo.getImg());
manufacturerInfo.setImg(manufacturerInfo.getImg());
}
equipmentDetail.setManufacturerInfo(manufacturerInfo);
equipmentDetail.setImg(getEquipFileList(id, FileTypeEnum.image.toString()));
......
......@@ -126,8 +126,6 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
@Override
public boolean addEquipmentDef(Equipment equipment) throws IllegalArgumentException {
try {
// 查询装备定义名陈是否重复
nameDuplicate(equipment);
// 设置code属性
......@@ -138,18 +136,19 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
equipment.setCode(code);
}
int num = equipmentMapper.insert(equipment);
// saveEquipmentQRCodes(equipment);
JSONObject equipRuleParams = new JSONObject();
equipRuleParams.put("name", equipment.getName());
equipRuleParams.put("inspectionSpecId", equipment.getInspectionSpec());
try {
patrolFeign.getEquipDetail(equipRuleParams.toJSONString());
} catch (Exception e) {
log.error("新增装备定义操作中,检测到巡检服务未启动或启动出错!");
}
if (num > 0) {
return true;
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("录入的装备名称重复!");
}
return false;
}
......@@ -232,7 +231,11 @@ public class EquipmentServiceImpl extends ServiceImpl<EquipmentMapper, Equipment
JSONObject equipRuleParams = new JSONObject();
equipRuleParams.put("name", equipment1.getName());
equipRuleParams.put("inspectionSpecId", equipment1.getInspectionSpec());
try {
patrolFeign.getEquipDetail(equipRuleParams.toJSONString());
} catch (Exception e) {
log.error("编辑装备定义操作中,检测到巡检服务未启动或启动出错!");
}
if (savedEquipment > 0) {
return true;
}
......
......@@ -208,10 +208,13 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
|| AlarmTypeEnum.PB.getCode().equals(type)) {
dataVO.setAlarmType(AlarmTypeEnum.getTypeByCode(String.valueOf(type)));
}
dataVO.setType(String.valueOf(x.get("type")));
dataVO.setAlarmInfo(x.get("fireEquipmentName") + dataVO.getAlarmType());
dataVO.setEquipSpeId(Long.valueOf(String.valueOf(x.get("fireEquipmentId"))));
dataVO.setAlarmId(Long.valueOf(String.valueOf(x.get("alarmId"))));
dataVO.setAlarmTypeCode(String.valueOf(x.get("fireEquipmentSpecificIndexKey")));
dataVO.setCleanStatus(String.valueOf(x.get("cleanStatus")));
dataVO.setCleanStatusVal(String.valueOf(x.get("cleanStatusVal")));
res.add(dataVO);
});
}
......
......@@ -115,6 +115,8 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
@Autowired
private ICarService carService;
@Autowired
private IVideoEquipmentSpecificService videoEquipmentSpecificService;
@Value("${systemctl.dict.iot-core-param}")
private String iotCoreParam;
......@@ -1604,4 +1606,33 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
return SourcesStatisticsImpl.PREFIX_CATEGORY_COUNT + row.get("bizOrgCode").toString() + "_" + SourceTypeEnum.EQUIPMENT.getCode() + "_" + row.get("categoryCode").toString();
}
public Boolean videoOnEquipmentSpecific(VideoOnEquipmentSpecificVo videoOnEquipmentSpecificVo) {
Long equipmentSpecificId = videoOnEquipmentSpecificVo.getEquipmentSpecificId();
List<Long> videoIdList = videoOnEquipmentSpecificVo.getVideoIdList();
if (equipmentSpecificId != null) {
EquipmentSpecific equipmentSpecific = this.baseMapper.selectById(equipmentSpecificId);
if (!ObjectUtils.isEmpty(equipmentSpecific)) {
QueryWrapper<VideoEquipmentSpecific> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("equipment_specific_id", equipmentSpecificId);
boolean remove = videoEquipmentSpecificService.remove(queryWrapper);
if (remove) {
List<VideoEquipmentSpecific> videoSpecificList = new ArrayList<>();
videoIdList.parallelStream().forEach(x -> {
VideoEquipmentSpecific videoEquipmentSpecific = new VideoEquipmentSpecific();
videoEquipmentSpecific.setVideoId(x);
videoEquipmentSpecific.setEquipmentSpecificId(equipmentSpecificId);
videoSpecificList.add(videoEquipmentSpecific);
});
videoEquipmentSpecificService.saveBatch(videoSpecificList);
return Boolean.TRUE;
} else {
throw new RuntimeException("移除设备摄像头绑定关系失败!");
}
} else {
throw new RuntimeException("未获取到此设备!");
}
} else {
throw new RuntimeException("设备ID为空!");
}
}
}
......@@ -179,8 +179,8 @@ public class MaintenanceResourceServiceImpl extends ServiceImpl<MaintenanceResou
public List<MaintenanceResourceDto> findTreeById(Long id) {
List<MaintenanceResourceDto> list = maintenanceResourceMapper.findTreeById(id);
if (!CollectionUtils.isEmpty(list)) {
List<MaintenanceResourceDto> dtoList = TreeNodeUtil.assembleTreeNotFilter(list);
List<MaintenanceResourceDto> collect = dtoList.stream().filter(x -> !MaintenanceResourceEnum.CLASSIFY.getValue().equals(x.getType())).collect(Collectors.toList());
List<MaintenanceResourceDto> dtoList = TreeNodeUtil.assembleTreeNotFilter(list);//&& x.getId().equals(Long.toString(id)) 这一段用于生成树之后并没有把树子节点数据从list列表删除造成的脏数据的问题 by chenhao 2022-01-12
List<MaintenanceResourceDto> collect = dtoList.stream().filter(x -> !MaintenanceResourceEnum.CLASSIFY.getValue().equals(x.getType()) && x.getId().equals(Long.toString(id))).collect(Collectors.toList());
return collect;
}
return Lists.newArrayList();
......
......@@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.equipmanage.common.entity.VideoEquipmentSpecific;
import com.yeejoin.equipmanage.mapper.VideoEquipmentSpecificMapper;
import com.yeejoin.equipmanage.service.IVideoEquipmentSpecificService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author ZeHua Li
* @date 2020/11/23 15:43
......@@ -13,4 +16,11 @@ import org.springframework.stereotype.Service;
*/
@Service
public class VideoEquipmentSpecificImpl extends ServiceImpl<VideoEquipmentSpecificMapper,VideoEquipmentSpecific> implements IVideoEquipmentSpecificService {
@Autowired
private VideoEquipmentSpecificMapper videoEquipmentSpecificMapper;
@Override
public List<VideoEquipmentSpecific> findBySpecificIdAndVideoIdIn(Long equipmentSpecificId, List<Long> videoIdList) {
return videoEquipmentSpecificMapper.findBySpecificIdAndVideoIdIn(equipmentSpecificId, videoIdList);
}
}
......@@ -67,8 +67,8 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
@Value("${equip.security.code}")
String securityMonitorCode;
@Value("${param.isUseVideoTranscoding}")
String isUseVideoTranscoding;
@Value("${window.vedioFormat}")
String vedioFormat;
@Autowired
VideoMapper videoMapper;
......@@ -501,7 +501,7 @@ public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements
@Override
public String getVideoUrl(String videoId, String presetIndex, String defaultUrl, String code) {
if ("off".equals(isUseVideoTranscoding)) {
if ("hls".equals(vedioFormat)) {
String url = getVideoUrl(code);
return ObjectUtils.isEmpty(url) ? defaultUrl : url;
}
......
......@@ -121,8 +121,12 @@ public class AircraftServiceImpl extends BaseService<AircraftDto, Aircraft, Airc
String aircraft = "";
List<AlertFormValue> list1 = list.stream().filter(formValue -> formValue.getFieldCode().equals("aircraft") || formValue.getFieldCode().equals("aircraftModel")).collect(Collectors.toList());
if(list1.size() > 0) {
if(!ValidationUtil.isEmpty(list1.get(0).getFieldValue())) {
aircraft = list1.get(0).getFieldValue();
} else {
aircraft = list1.get(0).getFieldValueCode();
}
}
LambdaQueryWrapper<Aircraft> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Aircraft::getAircraftModel,aircraft);
......
......@@ -640,11 +640,19 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
/*
* if(null == valueCode) { valueCode = alertFormValue.getFieldValue(); }
*/
// if("flightNumber".equals(alertFormValue.getFieldCode()) || "aircraftModel".equals(alertFormValue.getFieldCode())) {
// listdate.add(new KeyValueLabel(alertFormValue.getFieldName(), alertFormValue.getFieldCode(), alertFormValue.getFieldValueCode()));
// } else {
if("flightNumber".equals(alertFormValue.getFieldCode())) {
listdate.add(new KeyValueLabel(alertFormValue.getFieldName(), alertFormValue.getFieldCode(), alertFormValue.getFieldValueCode()));
} else {
if( "aircraftModel".equals(alertFormValue.getFieldCode())) {
if(ValidationUtil.isEmpty(valueCode)) {
listdate.add(new KeyValueLabel(alertFormValue.getFieldName(), alertFormValue.getFieldCode(), alertFormValue.getFieldValueCode()));
} else {
listdate.add(new KeyValueLabel(alertFormValue.getFieldName(), alertFormValue.getFieldCode(), valueCode));
// }
}
} else {
listdate.add(new KeyValueLabel(alertFormValue.getFieldName(), alertFormValue.getFieldCode(), valueCode));
}
}
});
map.put("data", listdate);
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xwpf.usermodel.XWPFTable;
import org.apache.poi.xwpf.usermodel.XWPFTableRow;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttPersistenceException;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTc;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTcPr;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STJc.Enum;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STVerticalJc;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONException;
......@@ -38,12 +86,39 @@ import com.yeejoin.amos.boot.module.common.api.service.IFireTeamService;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FireTeamServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.*;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCallCommandDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCallePowerTransferRo;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledMobDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledObjsDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledPowerInfoDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledZhDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedExtDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedSMSDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertSubmittedZHDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.CarStatusInfoDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.InstructionsZHDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerData;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyResourcesDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyZHDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PushMessageWebAndAppRo;
import com.yeejoin.amos.boot.module.jcs.api.dto.SchedulingReportingDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.TemplateExtendDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.VoiceRecordFileDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmitted;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertSubmittedObject;
import com.yeejoin.amos.boot.module.jcs.api.entity.Template;
import com.yeejoin.amos.boot.module.jcs.api.enums.*;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertBusinessTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertSchedulingTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertStageEnums;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertSubmitTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.FireCarStatusEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.SubmissionMethodEnum;
import com.yeejoin.amos.boot.module.jcs.api.mapper.AlertSubmittedMapper;
import com.yeejoin.amos.boot.module.jcs.api.mapper.PowerTransferCompanyMapper;
import com.yeejoin.amos.boot.module.jcs.api.mapper.PowerTransferMapper;
......@@ -54,33 +129,6 @@ import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.component.rule.RuleTrigger;
import com.yeejoin.amos.component.rule.config.RuleConfig;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xwpf.usermodel.XWPFTable;
import org.apache.poi.xwpf.usermodel.XWPFTableRow;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttPersistenceException;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STJc.Enum;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.io.*;
import java.lang.reflect.Field;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.*;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
/**
......@@ -197,12 +245,12 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
TemplateExtendDto template = null;
Template templateN = null;
if (AlertBusinessTypeEnum.警情初报.getName().equals(alertSubmittedExtDto.getBusinessType())) {
if(AlertBusinessTypeEnum.警情初报.getName().equals(alertSubmittedExtDto.getBusinessType())) {
// 获取任务派发模板
templateN = templateService
.getOne(new QueryWrapper<Template>().eq("type_code", "JQCB").eq("format", false));
template = new TemplateExtendDto();
BeanUtils.copyProperties(templateN, template);
BeanUtils.copyProperties(templateN,template);
template.setRichContent(template.getContent());
} else {
......@@ -216,39 +264,39 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
*/
AlertCalledRo alertCalledRo = new AlertCalledRo();
String replaceContent = "";
if (null != alertCalled) {
String replaceContent ="";
if(null != alertCalled) {
replaceContent = RuleAlertCalledService.init(alertCalledRo, alertCalledVo);
}
Map<String, String> definitions = new HashMap<>();
definitions.put("$type", alertCalled.getAlertType());
definitions.put("$callTime", DateUtils.convertDateToString(alertCalled.getCallTime(), DateUtils.DATE_TIME_PATTERN));
definitions.put("$replaceContent", replaceContent);
definitions.put("$address", ValidationUtil.isEmpty(alertCalled.getAddress()) ? "" : alertCalled.getAddress());
definitions.put("$type",alertCalled.getAlertType());
definitions.put("$callTime", DateUtils.convertDateToString(alertCalled.getCallTime(),DateUtils.DATE_TIME_PATTERN));
definitions.put("$replaceContent",replaceContent);
definitions.put("$address",ValidationUtil.isEmpty(alertCalled.getAddress()) ? "" : alertCalled.getAddress());
// definitions.put("$recDate",DateUtils.dateTimeToDateString(alertCalled.getUpdateTime()));
definitions.put("$contactUser", ValidationUtil.isEmpty(alertCalled.getContactUser()) ? "" : alertCalled.getContactUser());
definitions.put("$trappedNum", ValidationUtil.isEmpty(alertCalledRo.getTrappedNum()) ? "" : String.valueOf(alertCalled.getTrappedNum()));
definitions.put("$casualtiesNum", ValidationUtil.isEmpty(alertCalled.getCasualtiesNum()) ? "" : String.valueOf(alertCalled.getCasualtiesNum()));
definitions.put("$contactPhone", ValidationUtil.isEmpty(alertCalled.getContactPhone()) ? "" : alertCalled.getContactPhone());
definitions.put("$contactUser",ValidationUtil.isEmpty(alertCalled.getContactUser()) ? "" : alertCalled.getContactUser());
definitions.put("$trappedNum",ValidationUtil.isEmpty(alertCalledRo.getTrappedNum()) ? "" : String.valueOf(alertCalled.getTrappedNum()));
definitions.put("$casualtiesNum",ValidationUtil.isEmpty(alertCalled.getCasualtiesNum()) ? "" : String.valueOf(alertCalled.getCasualtiesNum()));
definitions.put("$contactPhone",ValidationUtil.isEmpty(alertCalled.getContactPhone()) ? "" : alertCalled.getContactPhone());
String companyName = JSONObject.parseObject(alertSubmittedExtDto.getSubmissionContent()).getString("$companyName");
String companyName = JSONObject.parseObject(alertSubmittedExtDto.getSubmissionContent()).getString("$companyName") ;
JSONObject jsonObject = null;
if (!ValidationUtil.isEmpty(alertCalled.getUpdateTime())) {
if(!ValidationUtil.isEmpty(alertCalled.getUpdateTime())) {
jsonObject = JSONObject.parseObject(alertSubmittedExtDto.getSubmissionContent());
jsonObject.put("recDate", DateUtils.convertDateToString(alertCalled.getUpdateTime(), DateUtils.DATE_TIME_PATTERN));
jsonObject.put("recDate",DateUtils.convertDateToString(alertCalled.getUpdateTime(), DateUtils.DATE_TIME_PATTERN));
}
if (jsonObject != null) {
if(jsonObject != null) {
alertSubmittedExtDto.setSubmissionContent(jsonObject.toJSONString());
}
definitions.put("$companyName", null == companyName ? "" : companyName);
String content = getTaskInformation(template.getRichContent(), definitions);
String content = getTaskInformation( template.getRichContent(),definitions);
alertSubmittedExtDto.setSubmissionContentValue(JSONObject.parseObject(alertSubmittedExtDto.getSubmissionContent()));
alertSubmittedExtDto.setSubmissionContent(content);
......@@ -268,8 +316,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
@Override
public Boolean save(AlertSubmittedDto alertSubmittedDto, String userName) throws Exception {
try {
String company = ValidationUtil.isEmpty(alertSubmittedDto.getSubmitContent().get("companyName")) ? "" : alertSubmittedDto.getSubmitContent().get("companyName").toString();
Map<String, String> map = saveAlertSubmitted(alertSubmittedDto, userName);
String company = ValidationUtil.isEmpty(alertSubmittedDto.getSubmitContent().get("companyName")) ? "" : alertSubmittedDto.getSubmitContent().get("companyName").toString() ;
Map<String,String> map = saveAlertSubmitted(alertSubmittedDto, userName);
// 组装规则入参
AlertCalled alertCalled = alertCalledService.getById(alertSubmittedDto.getAlertCalledId());
alertCalled.setCompanyName(company);
......@@ -282,7 +330,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertCalledVo.setAlertCalled(alertCalled);
// 调用规则
ruleAlertCalledService.fireAlertCalledRule(alertCalledVo, map.get("alertWay"), map.get("mobiles"), map.get("usIds"), map.get("feedBack"));
ruleAlertCalledService.fireAlertCalledRule(alertCalledVo, map.get("alertWay"),map.get("mobiles"), map.get("usIds"), map.get("feedBack"));
//通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
emqKeeper.getMqttClient().publish(powertopic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true);
} catch (MqttException e) {
......@@ -294,7 +342,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
/**
* 规则回调
*/
public void ruleCallbackAction(String smsCode, List<Map<String, Object>> sendIds, Object object) throws Exception {
public void ruleCallbackAction(String smsCode, List<Map<String,Object>> sendIds, Object object) throws Exception {
// 获取报送对象列表
List<AlertSubmittedObject> alertSubmittedObjectList = Lists.newArrayList();
......@@ -312,7 +360,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
String alertSubmittedId = calledRo.getAlertSubmittedId();
alertCalledId = calledRo.getSequenceNbr();
AlertCalledObjsDto alertCalledObjsDto = (AlertCalledObjsDto) alertCalledService.selectAlertCalledByIdNoRedisNew(Long.valueOf(calledRo.getSequenceNbr()));
AlertCalledObjsDto alertCalledObjsDto = (AlertCalledObjsDto)alertCalledService.selectAlertCalledByIdNoRedisNew(Long.valueOf(calledRo.getSequenceNbr()));
alertCalled = alertCalledObjsDto.getAlertCalled();
// AlertCalledRo tempCalledRo = new AlertCalledRo();
......@@ -325,80 +373,80 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 警情续报 警情结案,非警情确认选择人员电话号码
String ids = calledRo.getIds();
if (!ValidationUtil.isEmpty(ids)) {
if(!ValidationUtil.isEmpty(ids)) {
List<String> ls = Arrays.asList(ids.split(","));
for (String s : ls
for (String s: ls
) {
mobiles.add(s);
}
}
// 获取报送规则
sendIds.stream().forEach(e -> {
sendIds.stream().forEach(e->{
// 一般火灾 // 航空器救援
if (alertTypeCode.equals(AlertStageEnums.YBHZ.getCode()) || alertTypeCode.equals(AlertStageEnums.HKJY.getCode())) {
if (e.containsKey("onDuty")) {
if(alertTypeCode.equals(AlertStageEnums.YBHZ.getCode()) || alertTypeCode.equals(AlertStageEnums.HKJY.getCode())) {
if(e.containsKey("onDuty")) {
// 当日值班人员:获值班表中包括消救部、综合办公室、消防支队、应急指挥科的值班人员。
String[] arr = e.get("onDuty").toString().split(",");
String [] arr = e.get("onDuty").toString().split(",");
List<String> list = Arrays.asList(arr);
List<Map<String, Object>> mapList = iDutyPersonService.queryByCompanyId(list);
orgUsers.addAll(mapList);
}
if (e.containsKey("fireBrigade")) {
if(e.containsKey("fireBrigade")) {
// 根据人员岗位:班组长、队长、通讯员; 消防队伍--消防人员 中,对应岗位的人员
List<FirefightersDto> fireBrigade = firefightersService.queryById(e.get("fireBrigade").toString().split(","), e.get("name").toString());
fireBrigade.stream().forEach(f -> {
HashMap<String, Object> map = new HashMap<>();
map.put("telephone", f.getMobilePhone());
map.put("sequenceNbr", f.getSequenceNbr());
map.put("bizOrgName", f.getName());
map.put("amosUserId", f.getAmosUserId());
fireBrigade.stream().forEach(f->{
HashMap<String,Object> map = new HashMap<>();
map.put("telephone",f.getMobilePhone());
map.put("sequenceNbr",f.getSequenceNbr());
map.put("bizOrgName",f.getName());
map.put("amosUserId",f.getAmosUserId());
map.put("companyName", e.get("name").toString());
orgUsers.add(map);
});
}
if (e.containsKey("name")) {
if(e.containsKey("name")) {
// 消防救援保障部
List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyIdNew(e.get("name").toString());
orgUsers.addAll(mapList);
}
// 安运部
if (e.get("type").toString().equals("AY")) {
if (e.containsKey("name")) {
String[] arr = e.get("airportPost").toString().split(",");
if(e.get("type").toString().equals("AY")) {
if(e.containsKey("name")) {
String [] arr = e.get("airportPost").toString().split(",");
List<String> list = Arrays.asList(arr);
List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyId(e.get("name").toString(), list);
List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyId(e.get("name").toString(),list);
orgUsers.addAll(mapList);
}
}
// 事发单位
if (e.get("type").toString().equals("SF")) {
if (e.containsKey("airportPost")) {
String[] arr = e.get("airportPost").toString().split(",");
if(e.get("type").toString().equals("SF")) {
if(e.containsKey("airportPost")) {
String [] arr = e.get("airportPost").toString().split(",");
List<String> list = Arrays.asList(arr);
List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyId(unitInvolved, list);
List<Map<String, Object>> mapList = iOrgUsrService.queryCompanyId(unitInvolved,list);
orgUsers.addAll(mapList);
}
}
}
// 突发事件救援 // 漏油现场安全保障 // 专机保障 // 其他
if (alertTypeCode.equals(AlertStageEnums.HKJY.getCode()) || alertTypeCode.equals(AlertStageEnums.LYXC.getCode())
if(alertTypeCode.equals(AlertStageEnums.HKJY.getCode()) || alertTypeCode.equals(AlertStageEnums.LYXC.getCode())
|| alertTypeCode.equals(AlertStageEnums.ZJBZ.getCode()) || alertTypeCode.equals(AlertStageEnums.QTJQ.getCode())) {
if (e.containsKey("onDuty")) {
if(e.containsKey("onDuty")) {
List<Map<String, Object>> mapList = iDutyPersonService.queryByCompanyNew(e.get("name").toString());
orgUsers.addAll(mapList);
}
}
// 120急救
if (alertTypeCode.equals(AlertStageEnums.JJJQ.getCode())) {
if(alertTypeCode.equals(AlertStageEnums.JJJQ.getCode())) {
if (e.containsKey("name")) {
List<Map<String, Object>> mapList = iDutyPersonService.queryByCompanyNew(e.get("name").toString());
orgUsers.addAll(mapList);
......@@ -416,7 +464,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 保存初报细分类型(一般火灾、航空器救援等)
alertSubmitted.setBusinessTypeCode(calledRo.getAlertTypeCode());
// 警情初报 --- 续报 结案
if (alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
if(alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
alertSubmitted.setBusinessType(AlertBusinessTypeEnum.警情初报.getName());
Optional<SubmissionMethodEnum> submissionMethodEnum = Optional.of(SubmissionMethodEnum.SMS);
......@@ -433,10 +481,10 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
this.baseMapper.insert(alertSubmitted);
alertSubmittedId = alertSubmitted.getSequenceNbr().toString();
} else if (alertWay.equals(AlertBusinessTypeEnum.警情续报.getCode())) {
} else if(alertWay.equals(AlertBusinessTypeEnum.警情续报.getCode())) {
alertSubmitted.setBusinessType(AlertBusinessTypeEnum.警情续报.getName());
sCode = "SMS_JCS_XB";
} else if (alertWay.equals(AlertBusinessTypeEnum.警情结案.getCode())) {
} else if(alertWay.equals(AlertBusinessTypeEnum.警情结案.getCode())) {
alertSubmitted.setBusinessType(AlertBusinessTypeEnum.警情结案.getName());
sCode = "SMS_JCS_JA";
} else {
......@@ -451,14 +499,14 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// smsCode = alertBusinessTypeEnum.get().getSms_code();
if (!alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
if(!alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
LambdaQueryWrapper<AlertSubmitted> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AlertSubmitted::getAlertCalledId, alertCalledId);
queryWrapper.eq(AlertSubmitted::getAlertCalledId,alertCalledId);
queryWrapper.orderByDesc(AlertSubmitted::getSequenceNbr);
List<AlertSubmitted> alertSubmitteds = alertSubmittedMapper.selectList(queryWrapper);
alertSubmittedNew = alertSubmitteds.get(0);
if (!ValidationUtil.isEmpty(calledRo.getUsIds())) {
if(!ValidationUtil.isEmpty(calledRo.getUsIds())) {
usIds.addAll(Arrays.asList(calledRo.getUsIds().split(",")));
}
}
......@@ -466,7 +514,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 组装人员信息
for (Map<String, Object> orgUser : orgUsers) {
AlertSubmittedObject alertSubmittedObject = new AlertSubmittedObject();
if (!alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
if(!alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
alertSubmittedObject.setAlertSubmittedId(alertSubmittedNew.getSequenceNbr());
} else {
alertSubmittedObject.setAlertSubmittedId(Long.parseLong(alertSubmittedId));
......@@ -493,7 +541,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
smsParams.put("callTimeStr", calledRo.getCallTimeStr());
smsParams.put("address", calledRo.getAddress());
smsParams.put("fireLocation", calledRo.getFireLocation());
smsParams.put("endTimeStr", DateUtils.convertDateToString(alertCalled.getUpdateTime(), DateUtils.DATE_TIME_PATTERN));
smsParams.put("endTimeStr", DateUtils.convertDateToString(alertCalled.getUpdateTime(),DateUtils.DATE_TIME_PATTERN));
smsParams.put("burningMaterial", calledRo.getBurningMaterial());
smsParams.put("fireSituation", calledRo.getFireSituation());
smsParams.put("trappedNum", calledRo.getTrappedNum());
......@@ -512,33 +560,36 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 组织短信内容
// 调用短信发送接口
Map<String, String> besidesMap = new HashMap<>();
besidesMap.put("alterId", String.valueOf(alertCalled.getSequenceNbr()));
Map<String,String> besidesMap = new HashMap<>();
besidesMap.put("alterId",String.valueOf(alertCalled.getSequenceNbr()));
if (alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
if(alertWay.equals(AlertBusinessTypeEnum.警情初报.getCode())) {
alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams);
besidesMap.put("sendTime", DateUtils.dateFormat(alertCalled.getCallTime(), DateUtils.DATE_TIME_PATTERN));
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情初报.getCode(), besidesMap, smsParams, usIds);
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情初报.getCode(),besidesMap,smsParams,usIds);
} else {
if (alertWay.equals(AlertBusinessTypeEnum.警情续报.getCode())) {
if(alertWay.equals(AlertBusinessTypeEnum.警情续报.getCode())) {
besidesMap.put("sendTime", DateUtils.dateFormat(alertCalled.getCallTime(), DateUtils.DATE_TIME_PATTERN));
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情续报.getCode(), besidesMap, smsParams, usIds);
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情续报.getCode(),besidesMap,smsParams,usIds);
}
if (alertWay.equals(AlertBusinessTypeEnum.警情结案.getCode())) {
if(alertWay.equals(AlertBusinessTypeEnum.警情结案.getCode())) {
besidesMap.put("startTime", DateUtils.dateFormat(alertCalled.getCallTime(), DateUtils.DATE_TIME_PATTERN));
besidesMap.put("endTime", DateUtils.dateFormat(alertCalled.getRecDate(), DateUtils.DATE_TIME_PATTERN));
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情结案.getCode(), besidesMap, smsParams, usIds);
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.警情结案.getCode(),besidesMap,smsParams,usIds);
}
if (alertWay.equals(AlertBusinessTypeEnum.非警情确认.getCode())) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.非警情确认.getCode(), besidesMap, smsParams, usIds);
if(alertWay.equals(AlertBusinessTypeEnum.非警情确认.getCode())) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.非警情确认.getCode(),besidesMap,smsParams,usIds);
}
alertCalledAction.sendAlertCalleCmd(sCode, mobiles, smsParams);
}
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false);
}
......@@ -549,12 +600,11 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
* @param userName 用户名
*/
@Transactional(rollbackFor = Exception.class)
public Map<String, String> saveAlertSubmitted(AlertSubmittedDto alertSubmittedDto, String userName) {
try {
Long alertSubmittedId = alertSubmittedDto.getSequenceNbr();
public Map<String,String> saveAlertSubmitted(AlertSubmittedDto alertSubmittedDto, String userName) {
try { Long alertSubmittedId = alertSubmittedDto.getSequenceNbr();
String alertWay = "";
Date endDate = null;
Map<String, String> map = new HashMap<>();
Map<String,String> map = new HashMap<>();
Set<String> mobiles = new HashSet<>();
List<Long> userIds = new ArrayList<>();
if (alertSubmittedId == null) {
......@@ -584,7 +634,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 任务 4174 日常值班---融合调度----短信模版中的内容用户可以全部删除掉,按照自定义内容重新录入发送内容 by litw 2021年10月27日
alertSubmitted.setBusinessTypeCode(alertSubmittedDto.getBusinessTypeCode());
alertSubmittedDto.getSubmitContent().get("recDate").toString();
endDate = DateUtils.dateParse(alertSubmittedDto.getSubmitContent().get("recDate").toString(), DateUtils.HOUR_PATTERN);
endDate = DateUtils.dateParse(alertSubmittedDto.getSubmitContent().get("recDate").toString(),DateUtils.HOUR_PATTERN);
alertSubmitted.setSubmissionContent(alertSubmittedDto.getSubmitContent().toJSONString());
......@@ -640,20 +690,20 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
queryWrapper.in(true, OrgUsr::getSequenceNbr, userIds);
List<String> usIds = new ArrayList<>();
List<OrgUsr> list = orgUsrService.getBaseMapper().selectList(queryWrapper);
if (null != list && list.size() > 0) {
list.stream().forEach(e -> {
if (!ValidationUtil.isEmpty(e.getAmosOrgId())) {
if(null != list && list.size() > 0) {
list.stream().forEach(e->{
if(!ValidationUtil.isEmpty(e.getAmosOrgId())) {
usIds.add(e.getAmosOrgId());
}
});
map.put("usIds", StringUtils.join(usIds.toArray(new String[userIds.size()]), ","));
map.put("usIds", StringUtils.join(usIds.toArray(new String[userIds.size()]),","));
} else {
map.put("usIds", "");
}
// alertSubmittedObjectServiceImpl.saveBatch(alertSubmittedObjectList);
for (AlertSubmittedObject object : alertSubmittedObjectList) {
for(AlertSubmittedObject object :alertSubmittedObjectList ) {
alertSubmittedObjectServiceImpl.save(object);
}
......@@ -662,16 +712,16 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmittedDto.getBusinessTypeCode());
// 警情续报
if (AlertBusinessTypeEnum.警情续报.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
if(AlertBusinessTypeEnum.警情续报.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
alertWay = AlertBusinessTypeEnum.警情续报.getCode();
}
if (AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
if(AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
alertWay = AlertBusinessTypeEnum.警情结案.getCode();
// 警情结案生成模板
try {
AlertCalledFormDto alertCalledFormDto = (AlertCalledFormDto) alertCalledService.selectAlertCalledById(alertSubmittedDto.getAlertCalledId());
AlertCalledFormDto alertCalledFormDto = (AlertCalledFormDto)alertCalledService.selectAlertCalledById(alertSubmittedDto.getAlertCalledId());
AlertCalled alertCalled = alertCalledFormDto.getAlertCalled();
generateMob(alertCalled);
} catch (FileNotFoundException e) {
......@@ -681,11 +731,17 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}
}
if (AlertBusinessTypeEnum.非警情确认.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
if(AlertBusinessTypeEnum.非警情确认.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
alertWay = AlertBusinessTypeEnum.非警情确认.getCode();
}
if (AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())
|| AlertBusinessTypeEnum.非警情确认.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
// 查询本次警情调派的车辆
......@@ -712,25 +768,25 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
//警情結案推送
if (AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
if(AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
//tuisongxinjingqing
RequestData par = new RequestData();
RequestData par=new RequestData();
par.setAlertId(alertSubmittedDto.getAlertCalledId());
List<AlertCalledZhDto> list4 = alertCalledService.alertCalledListByAlertStatus(null, null, par);
String json = "";
if (list != null && list.size() > 0) {
AlertCalledZhDto ll = list4.get(0);
Map<String, String> map1 = org.apache.commons.beanutils.BeanUtils.describe((Object) list4.get(0));
String json="";
if(list!=null&&list.size()>0){
AlertCalledZhDto ll=list4.get(0);
Map<String, String> map1 = org.apache.commons.beanutils.BeanUtils.describe((Object)list4.get(0));
String strDateFormat = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);
map1.put("callTime", ll.getCallTime() != null ? sdf.format(ll.getCallTime()) : "");
map.put("sequenceNbr", ll.getSequenceNbr() + "");
map1.put("updateTime", ll.getUpdateTime() != null ? sdf.format(ll.getUpdateTime()) : "");
json = list != null && list.size() > 0 ? JSONObject.toJSONString(map1, SerializerFeature.PrettyFormat,
SerializerFeature.WriteMapNullValue) : "";
map1.put("callTime",ll.getCallTime()!=null?sdf.format(ll.getCallTime()):"");
map.put("sequenceNbr",ll.getSequenceNbr()+"");
map1.put("updateTime",ll.getUpdateTime()!=null?sdf.format(ll.getUpdateTime()):"");
json=list!=null&&list.size()>0?JSONObject.toJSONString(map1, SerializerFeature.PrettyFormat,
SerializerFeature.WriteMapNullValue):"";
}
// String json=list4!=null&&list4.size()>0?JSONObject.toJSONString(list4.get(0), SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue):"";
......@@ -739,20 +795,21 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}
// 4.发送任务消息
// 4.1组织短信内容 废弃
JSONObject submitContent = alertSubmittedDto.getSubmitContent();
String feedBack = submitContent.get("editContent") != null ? submitContent.get("editContent").toString() : "";
String feedBack = submitContent.get("editContent") != null ? submitContent.get("editContent").toString(): "";
// 4.2调用短信发送接口 废弃
// alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams);\
map.put("feedBack", feedBack);
map.put("alertWay", alertWay);
map.put("mobiles", StringUtils.join(mobiles, ","));
map.put("feedBack",feedBack);
map.put("alertWay",alertWay);
map.put("mobiles", StringUtils.join(mobiles,","));
return map;
} catch (Exception e) {
e.printStackTrace();
......@@ -773,49 +830,49 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
report.setCallTime(ValidationUtil.isEmpty(alertCalled.getCallTime()) ? "" : DateUtils.convertDateToString(alertCalled.getCallTime(), DateUtils.DATE_TIME_PATTERN));
String urlString = "";
String urlString="";
report.setEndTime(DateUtils.convertDateToString(new Date(), DateUtils.DATE_TIME_PATTERN));
// 查询第一次调派
List<Map<String, Object>> first = alertSubmittedMapper.getFirst(alertCalled.getSequenceNbr());
// 查询后续调派
List<Map<String, Object>> other = alertSubmittedMapper.getFirst(alertCalled.getSequenceNbr());
List<Map<String, Object>> other = alertSubmittedMapper.getOther(alertCalled.getSequenceNbr());
LinkedList<AlertCalledPowerInfoDto> list = new LinkedList<>();
for (int i = 0; i < first.size(); i++) {
for(int i = 0; i <first.size(); i++) {
AlertCalledPowerInfoDto dto = new AlertCalledPowerInfoDto();
if (i == 0) {
if(i == 0) {
dto.setDisatchNum(String.valueOf(first.size()));
}
handleFunc(dto, first.get(i));
LocalDateTime dateTime = (LocalDateTime) first.get(i).get("recDate");
handleFunc(dto,first.get(i));
LocalDateTime dateTime = (LocalDateTime)first.get(i).get("recDate");
Date date = Date.from(dateTime.toInstant(ZoneOffset.of("+8")));
report.setToTime((DateUtils.dateFormat(date, DateUtils.HOUR_PATTERN)));
report.setToTime((DateUtils.dateFormat(date,DateUtils.HOUR_PATTERN)));
report.setArriveTime((DateUtils.dateFormat(date, DateUtils.HOUR_PATTERN)));
report.setArriveTime((DateUtils.dateFormat(date,DateUtils.HOUR_PATTERN)));
dto.setArriveTime((DateUtils.dateFormat(date, DateUtils.HOUR_PATTERN)));
dto.setArriveTime((DateUtils.dateFormat(date,DateUtils.HOUR_PATTERN)));
list.add(dto);
}
for (int i = 0; i < other.size(); i++) {
for(int i = 0; i <other.size(); i++) {
AlertCalledPowerInfoDto dto = new AlertCalledPowerInfoDto();
handleFunc(dto, first.get(i));
LocalDateTime dateTime = (LocalDateTime) first.get(i).get("recDate");
handleFunc(dto,other.get(i));
LocalDateTime dateTime = (LocalDateTime)other.get(i).get("recDate");
Date date = Date.from(dateTime.toInstant(ZoneOffset.of("+8")));
dto.setArriveTime((DateUtils.dateFormat(date, DateUtils.HOUR_PATTERN)));
dto.setArriveTime((DateUtils.dateFormat(date,DateUtils.HOUR_PATTERN)));
list.add(dto);
}
// 查询应急指挥辅屏值班人员
List<Map<String, Object>> mapList = iDutyPersonService.listOnDutyPerson();
List<AlertCallCommandDto> list1 = new ArrayList<>();
mapList.forEach(e -> {
mapList.forEach(e->{
AlertCallCommandDto dto = new AlertCallCommandDto();
dto.setName(e.get("userName").toString());
dto.setDuty(e.get("postTypeName").toString());
......@@ -844,17 +901,17 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// String filePath = this.getClass().getClassLoader().getResource("templates").getPath();
String filePath = "";
String fileName = "";
if (os.toLowerCase().startsWith("win")) {
if(os.toLowerCase().startsWith("win")) {
filePath = this.getClass().getClassLoader().getResource("templates").getPath();
fileName = filePath + "/" + System.currentTimeMillis() + ".docx";
} else {
// String [] arr = path.split("amos-boot-system-jcs-1.0.0.jar!");
// System.out.println(arr[0].substring(0,arr[0].lastIndexOf("/")));
// fileName = arr[0].substring(0,arr[0].lastIndexOf("/")) + "/" + System.currentTimeMillis() + ".docx";
fileName = "/opt/file/" + System.currentTimeMillis() + ".docx";
fileName = "/opt/file/"+System.currentTimeMillis() + ".docx";
}
String newFileName = "";
String newFileName= "";
AlertCalledPowerInfoTablePolicy calledPowerInfoTablePolicy = new AlertCalledPowerInfoTablePolicy();
AlertCallCommandTablePolicy alertCallCommandTablePolicy = new AlertCallCommandTablePolicy();
......@@ -865,12 +922,12 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
XWPFTemplate template = XWPFTemplate.compile(resourceAsStream, configureBuilder.build()).render(report);
File file = new File(fileName);
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
if (!file .getParentFile().exists()) {
file .getParentFile().mkdirs();
}
if (!file.exists()) {
if(!file .exists()) {
try {
file.createNewFile();
file .createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
......@@ -892,17 +949,17 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
//拼接完整连接
String pa1 = "";
if (os.toLowerCase().startsWith("win")) {
if(os.toLowerCase().startsWith("win")){
String pa = fileName.substring(1);
document.loadFromFile(pa);
newFileName = System.currentTimeMillis() + ".doc";
newFileName = System.currentTimeMillis()+".doc";
//保存结果文件
pa1 = newFileName.substring(1);
document.saveToFile(pa1, FileFormat.Doc);
} else {
document.loadFromFile(fileName);
System.out.println(fileName);
newFileName = "/opt/file/" + System.currentTimeMillis() + ".doc";
newFileName = "/opt/file/" + System.currentTimeMillis()+".doc";
System.out.println(newFileName);
document.saveToFile(newFileName, FileFormat.Doc);
pa1 = newFileName;
......@@ -915,7 +972,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
Map<String, String> map = date.getResult();
Iterator<String> it = map.keySet().iterator();
while (it.hasNext()) {
urlString = it.next();
urlString=it.next();
}
}
System.out.println(urlString);
......@@ -933,12 +990,12 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
template.close();
File file2 = new File(fileName);
if (file2.exists()) {
if(file2.exists()) {
file2.delete();
}
File file1 = new File(newFileName);
if (file1.exists()) {
if(file1.exists()) {
file1.delete();
}
} catch (IOException e) {
......@@ -947,8 +1004,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}
}
}
void handleFunc(AlertCalledPowerInfoDto dto, Map<String, Object> map) {
void handleFunc(AlertCalledPowerInfoDto dto,Map<String, Object> map) {
if (map.containsKey("carName")) {
dto.setCarName(map.get("carName").toString());
}
......@@ -993,7 +1049,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
List<RowRenderData> checkDangerList = Lists.newArrayList();
reportDto.forEach(foreachWithIndex((report, index) -> {
RowRenderData rowRenderData = RowRenderData.build(String.valueOf(reportDto.size() - index),
report.getStation(), report.getArriveTime(), report.getCarName(), report.getPersonNum(), report.getDisatchNum(), report.getDryPowder(), report.getFoam(), report.getOther());
report.getStation(), report.getArriveTime(), report.getCarName(),report.getPersonNum(),report.getDisatchNum(),report.getDryPowder(),report.getFoam(),report.getOther());
checkDangerList.add(rowRenderData);
}));
generateTableData(table, checkDangerList);
......@@ -1034,7 +1090,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
cellRenderData.getRenderData().setStyle(style);
});
XWPFTableRow insertNewTableRow = table.insertNewTableRow(dangerListDataStartRowNew);
IntStream.range(2, 6).forEach(j -> insertNewTableRow.createCell());
IntStream.range(2,6).forEach(j -> insertNewTableRow.createCell());
MiniTableRenderPolicy.Helper.renderRow(table, dangerListDataStartRowNew, reverseList.get(i));
}
......@@ -1044,10 +1100,11 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}
public static void generateTableData(XWPFTable table, List<RowRenderData> dangerList) {
String firstSize = "";
String firstSize ="";
if (!ValidationUtil.isEmpty(dangerList)) {
firstSize = dangerList.get(0).getCellDatas().get(5).getRenderData().getText();
int fSizs = Integer.parseInt(firstSize);
dangerList.get(0).getCellDatas().get(5).getRenderData().setText("");
// 表格渲染和列表数据下标相反,需要翻转一下列表
List<RowRenderData> reverseList = Lists.reverse(dangerList);
......@@ -1055,11 +1112,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 循环插入行
int listLength = dangerList.size();
for (int i = 0; i < fSizs; i++) {
if (i == 0) {
TableStyle tableStyle = new TableStyle();
tableStyle.setAlign(Enum.forInt(2));
reverseList.get(i).getCellDatas().get(0).setCellStyle(tableStyle);
reverseList.get(i).getCellDatas().get(0).getRenderData().setText("增\n援\n力\n量");
if(i == 0) {
Style style = new Style();
style.setFontFamily("宋体");
style.setFontSize(12);
......@@ -1075,27 +1128,47 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}
XWPFTableRow insertNewTableRow = table.insertNewTableRow(dangerListDataStartRow);
IntStream.range(5, 14).forEach(j -> insertNewTableRow.createCell());
IntStream.range(5,14).forEach(j -> insertNewTableRow.createCell());
MiniTableRenderPolicy.Helper.renderRow(table, dangerListDataStartRow, reverseList.get(i));
}
for (int i = fSizs; i < listLength; i++) {
reverseList.get(i).getCellDatas().forEach(cellRenderData -> {
for (int i = fSizs; i < listLength ; i++) {
TableStyle tableStyle = new TableStyle();
tableStyle.setAlign(Enum.forInt(2));
reverseList.get(i).getCellDatas().get(0).setCellStyle(tableStyle);
reverseList.get(i).getCellDatas().get(0).getRenderData().setText("增\n援\n力\n量");
Style style = new Style();
style.setFontFamily("仿宋");
style.setFontFamily("宋体");
style.setFontSize(12);
cellRenderData.getRenderData().setStyle(style);
});
style.setBold(true);
reverseList.get(i).getCellDatas().get(0).getRenderData().setStyle(style);
// reverseList.get(i).getCellDatas().forEach(cellRenderData -> {
// Style style = new Style();
// style.setFontFamily("仿宋");
// style.setFontSize(12);
// cellRenderData.getRenderData().setStyle(style);
// });
XWPFTableRow insertNewTableRow = table.insertNewTableRow(dangerListDataStartRow);
IntStream.range(5, 14).forEach(j -> insertNewTableRow.createCell());
IntStream.range(5,14).forEach(j -> insertNewTableRow.createCell());
MiniTableRenderPolicy.Helper.renderRow(table, dangerListDataStartRow, reverseList.get(i));
}
TableTools.mergeCellsVertically(table, 0, 0, fSizs + 1);
TableTools.mergeCellsVertically(table, 0, 0, fSizs+1);
if (listLength - fSizs > 1) {
TableTools.mergeCellsVertically(table, 0, fSizs + 2, listLength + 1);
if(fSizs == 1 && (listLength - fSizs > 1)) {
TableTools.mergeCellsVertically(table, 0, fSizs +2 , fSizs + 2 + (listLength - fSizs -1));
}
if(fSizs > 1 && (listLength - fSizs > 1)) {
TableTools.mergeCellsVertically(table, 0, fSizs +2, fSizs + 2 + (listLength - fSizs -1));
}
XWPFTableRow xwpfTableRow = table.getRows().get(fSizs +2);
CTTc ctTc = xwpfTableRow.getTableCells().get(0).getCTTc();
CTTcPr ctTcPr = ctTc.addNewTcPr();
ctTcPr.addNewVAlign().setVal(STVerticalJc.CENTER);
}
}
......@@ -1131,7 +1204,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
*/
AlertCalledRo alertCalledRo = new AlertCalledRo();
String replaceContent = RuleAlertCalledService.init(alertCalledRo, alertCalledVo);
String replaceContent = RuleAlertCalledService.init(alertCalledRo,alertCalledVo);
// 获取模板内容
List<DataDictionary> dataDictionaries =
......@@ -1141,20 +1214,20 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
Template template = templateService.getOne(new QueryWrapper<Template>().eq("type_code",
dataDictionary.getCode()).eq("format", true));
Map<String, String> definitions = new HashMap<>();
definitions.put("$type", alertCalled.getAlertType());
definitions.put("$callTime", DateUtils.convertDateToString(alertCalled.getCallTime(), DateUtils.DATE_TIME_PATTERN));
definitions.put("$replaceContent", replaceContent);
definitions.put("$address", ValidationUtil.isEmpty(alertCalled.getAddress()) ? "" : alertCalled.getAddress());
definitions.put("$contactUser", ValidationUtil.isEmpty(alertCalled.getContactUser()) ? "" : alertCalled.getContactUser());
definitions.put("$contactPhone", ValidationUtil.isEmpty(alertCalled.getContactPhone()) ? "" : alertCalled.getContactPhone());
definitions.put("$type",alertCalled.getAlertType());
definitions.put("$callTime", DateUtils.convertDateToString(alertCalled.getCallTime(),DateUtils.DATE_TIME_PATTERN));
definitions.put("$replaceContent",replaceContent);
definitions.put("$address",ValidationUtil.isEmpty(alertCalled.getAddress()) ? "" : alertCalled.getAddress() );
definitions.put("$contactUser",ValidationUtil.isEmpty(alertCalled.getContactUser()) ? "" : alertCalled.getContactUser() );
definitions.put("$contactPhone",ValidationUtil.isEmpty(alertCalled.getContactPhone()) ? "" : alertCalled.getContactPhone() );
// definitions.put("$recDate", DateUtils.convertDateToString(new Date(), DateUtils.DATE_TIME_PATTERN));
if (alertCalled.getAlertStatus()) {
map.put("recDate", DateUtils.convertDateToString(alertCalled.getUpdateTime(), DateUtils.DATE_TIME_PATTERN));
if(alertCalled.getAlertStatus()) {
map.put("recDate",DateUtils.convertDateToString(alertCalled.getUpdateTime(), DateUtils.DATE_TIME_PATTERN));
} else {
map.put("recDate", DateUtils.convertDateToString(new Date(), DateUtils.DATE_TIME_PATTERN));
map.put("recDate",DateUtils.convertDateToString(new Date(), DateUtils.DATE_TIME_PATTERN));
}
String content = getTaskInformation(template.getContent(), definitions);
String content = getTaskInformation( template.getContent(),definitions);
template.setContent(content);
TemplateDto templateDto = new TemplateDto();
BeanUtils.copyProperties(template, templateDto);
......@@ -1183,7 +1256,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
//获取接警录音
List<VoiceRecordFileDto> voiceRecordFileDtos = voiceRecordFileService.listByAlertId(id);
voiceRecordFileDtos.stream().forEach(voiceRecordFileDto -> {
InstructionsZHDto instruct = new InstructionsZHDto(voiceRecordFileDto.getSequenceNbr(), "接警录音", voiceRecordFileDto.getRecDate(), voiceRecordFileDto.getFilePath(), null);
InstructionsZHDto instruct = new InstructionsZHDto(voiceRecordFileDto.getSequenceNbr(), "接警录音", voiceRecordFileDto.getRecDate(), voiceRecordFileDto.getFilePath(),null);
listInstructionsZHDto.add(instruct);
});
......@@ -1234,16 +1307,16 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
break;
}
InstructionsZHDto instruct = new InstructionsZHDto(AlertSubmittedZHDto.getSequenceNbr(), AlertSubmittedZHDto.getBusinessType(), AlertSubmittedZHDto.getSubmissionTime(), content, null);
InstructionsZHDto instruct = new InstructionsZHDto(AlertSubmittedZHDto.getSequenceNbr(), AlertSubmittedZHDto.getBusinessType(), AlertSubmittedZHDto.getSubmissionTime(), content,null);
listInstructionsZHDto.add(instruct);
});
// 获取归并得警情信息
LambdaQueryWrapper<AlertCalled> queryWrapper = new LambdaQueryWrapper();
queryWrapper.eq(AlertCalled::getFatherAlert, id);
queryWrapper.eq(AlertCalled::getFatherAlert,id);
List<AlertCalled> alertCalleds = alertCalledService.getBaseMapper().selectList(queryWrapper);
alertCalleds.stream().forEach(e -> {
alertCalleds.stream().forEach(e->{
AlertSubmittedZHDto alertSubmittedZHDto = new AlertSubmittedZHDto();
AlertCalledFormDto alertCalledFormDto = (AlertCalledFormDto) alertCalledService.selectAlertCalledByIdNoRedis(e.getSequenceNbr());
alertSubmittedZHDto.setAlertCalledFormDto(alertCalledFormDto);
......@@ -1303,6 +1376,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}
@SuppressWarnings("unchecked")
public void ruleCallbackActionForPowerTransferForCar(String smsCode, List sendIds, Object object, List<String> pList)
throws IllegalAccessException, MqttPersistenceException, MqttException {
......@@ -1330,8 +1404,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertCalledId = calledRo.getSequenceNbr();
AlertCalled alertCalled = alertCalledService.getAlertCalledById(Long.parseLong(alertSubmittedId));
//响应级别
String responseLevelString = "";
if (alertCalled != null && alertCalled.getResponseLevel() != null) {
String responseLevelString ="";
if(alertCalled!=null && alertCalled.getResponseLevel()!=null) {
responseLevelString = alertCalled.getResponseLevel();
}
//先获取消救部领导、消救部值班人员信息
......@@ -1339,21 +1413,20 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(e));
// 消救部
if (jsonObject.containsKey("airportUnit")) {
String departmentName = jsonObject.getString("name");
if (jsonObject.containsKey("airportUnit")) {
{
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(departmentName, null);
String departmentName= jsonObject.getString("name");
if (jsonObject.containsKey("airportUnit")) { {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(departmentName,null);
userIdList.addAll(mapList);
}
if (jsonObject.containsKey("onDuty")) {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(DateUtils.getDateNowShortStr(), departmentName);
if(jsonObject.containsKey("onDuty")) {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(DateUtils.getDateNowShortStr(),departmentName);
userIdList.addAll(mapList);
}
}
}
});
List<Object> companyDetail = JSONArray.parseArray(JSON.toJSON(calledRo.getCompany()).toString(), Object.class);
List<Object> companyDetail = JSONArray.parseArray(JSON.toJSON(calledRo.getCompany()).toString(),Object.class);
for (Object powerTransferCompanyDto : companyDetail) {
PowerTransferCompanyDto powerDto = JSONObject.parseObject(JSON.toJSON(powerTransferCompanyDto).toString(), PowerTransferCompanyDto.class);
Long companyId = powerDto.getCompanyId();
......@@ -1362,34 +1435,32 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
Set<Map<String, Object>> sendUserIds = new HashSet<Map<String, Object>>();
//FireTeam fireTeam= fireTeamServiceImpl.getById(companyId);
String alertTypeCode = calledRo.getAlertTypeCode();
FireTeam fireTeam = fireTeamServiceImpl.getById(companyId);
FireTeam fireTeam= fireTeamServiceImpl.getById(companyId);
sendIds.stream().forEach(e -> {
JSONObject jsonObject1 = JSONObject.parseObject(JSONObject.toJSONString(e));
if (jsonObject1.containsKey("type") && (jsonObject1.getString("type").equals(AlertStageEnums.DD.getCode()))) {
String[] groupCode = jsonObject1.getString("fireBrigade").split(",");
List<String> positionType = Arrays.asList(groupCode);
if (jsonObject1.containsKey("fireBrigade")) {
{
String [] groupCode = jsonObject1.getString("fireBrigade").split(",");
List<String> positionType= Arrays.asList(groupCode);
if (jsonObject1.containsKey("fireBrigade")) { {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(fireTeam.getCompanyName(), positionType);
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(fireTeam.getCompanyName(),positionType);
sendUserIds.addAll(mapList);
}
if (jsonObject1.containsKey("onDuty")) {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(DateUtils.getDateNowShortStr(), fireTeam.getCompanyName());
if(jsonObject1.containsKey("onDuty")) {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(DateUtils.getDateNowShortStr(),fireTeam.getCompanyName());
sendUserIds.addAll(mapList);
}
}
} else if (jsonObject1.containsKey("type") && (jsonObject1.getString("type").equals(AlertStageEnums.ZD.getCode()))) {
String[] groupCode = jsonObject1.get("fireBrigade").toString().split(",");
List<String> positionType = Arrays.asList(groupCode);
String departmentName = jsonObject1.getString("name");
if (jsonObject1.containsKey("fireBrigade")) {
{
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(departmentName, positionType);
}else if (jsonObject1.containsKey("type") && (jsonObject1.getString("type").equals(AlertStageEnums.ZD.getCode()))) {
String [] groupCode = jsonObject1.get("fireBrigade").toString().split(",");
List<String> positionType= Arrays.asList(groupCode);
String departmentName= jsonObject1.getString("name");
if (jsonObject1.containsKey("fireBrigade")) { {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(departmentName,positionType);
sendUserIds.addAll(mapList);
}
if (jsonObject1.containsKey("onDuty")) {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(DateUtils.getDateNowShortStr(), departmentName);
if(jsonObject1.containsKey("onDuty")) {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(DateUtils.getDateNowShortStr(),departmentName);
sendUserIds.addAll(mapList);
}
}
......@@ -1440,7 +1511,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
if (designatedDriver) {
// 发送单个车辆的信息数据到客户
smsParams.put("resourcesNum",
resourcesNum.toString().substring(resourcesNum.toString().length() - 2));
resourcesNum.toString());
List<AlertSubmittedObject> alertSubmittedObjectListSub = Lists.newArrayList();
Map<String, Object> map = dynamicFormInstanceMapper
.getCurentCarIsUserPhone(Long.parseLong(i.getResourcesId()));
......@@ -1450,23 +1521,23 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
alertSubmittedObjectSub.setCompanyId(companyId);
alertSubmittedObjectSub.setCompanyName(companyName);
alertSubmittedObjectSub.setType(false);
if (map == null || !map.containsKey("userId")) {
if(map==null || !map.containsKey("userId")) {
continue;
}
alertSubmittedObjectSub.setUserId(Long.parseLong(map.get("userId").toString()));
alertSubmittedObjectSub.setTheUser(map.get("userName").toString());
//
pList.add(map.get("userName").toString());
Set<String> mobile = null;
List<String> userList = null;
Set<String> mobile =null;
List<String> userList=null;
if (!ValidationUtil.isEmpty(map.get("mobilePhone"))) {
mobile = new HashSet<String>() {
{
add(map.get("mobilePhone").toString());
}
};
userList = new ArrayList<String>();
if (!ValidationUtil.isEmpty(map.get("amosId"))) {
userList=new ArrayList<String>();
if(!ValidationUtil.isEmpty(map.get("amosId"))) {
userList.add(map.get("amosId").toString());
}
alertSubmittedObjectSub.setUserPhone(map.get("mobilePhone").toString());
......@@ -1478,8 +1549,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
Map<String, String> besidesMap = new HashMap<String, String>();
besidesMap.put("responseLevelString", responseLevelString);
besidesMap.put("alterId", alertCalledId);
if (userList.size() > 0) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(), besidesMap, smsParams, userList);
if(userList.size()>0) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,userList);
}
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS,
......@@ -1488,12 +1559,12 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}
}
String resourcesNumStr = resourcesNum.toString();
List<String> userList = new ArrayList<String>();
List<String> userList= new ArrayList<String>();
sendUserIds.stream().forEach(i -> {
if (i.containsKey("mobilePhone")) {
mobiles.add(i.get("mobilePhone").toString());
}
if (i.containsKey("amosId") && !ValidationUtil.isEmpty(i.get("amosId"))) {
if (i.containsKey("amosId")&& !ValidationUtil.isEmpty(i.get("amosId"))) {
userList.add(i.get("amosId").toString());
}
});
......@@ -1510,8 +1581,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
Map<String, String> besidesMap = new HashMap<String, String>();
besidesMap.put("responseLevelString", responseLevelString);//响应级别
besidesMap.put("alterId", alertCalledId);
if (userList.size() > 0) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(), besidesMap, smsParams, userList);
if(userList.size()>0) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,userList);
}
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false);
}
......@@ -1532,18 +1603,17 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
String alertSubmittedId = calledRo.getAlertSubmittedId();
alertCalledId = calledRo.getSequenceNbr();
Set<Map<String, Object>> userIds = new HashSet<Map<String, Object>>();
List<Object> companyDetail = JSONArray.parseArray(JSON.toJSON(calledRo.getCompany()).toString(), Object.class);
for (Object e : sendIds) {
List<Object> companyDetail =JSONArray.parseArray(JSON.toJSON(calledRo.getCompany()).toString(),Object.class);
for(Object e:sendIds) {
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(e));
if (jsonObject.containsKey("type") && ((jsonObject.getString("type").equals(AlertStageEnums.ZH.getCode())) || jsonObject.getString("type").equals(AlertStageEnums.XJ.getCode()))) {
String departmentName = jsonObject.getString("name");
if (jsonObject.containsKey("airportUnit")) {
{
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(departmentName, null);
if(jsonObject.containsKey("type") &&( (jsonObject.getString("type").equals(AlertStageEnums.ZH.getCode())) || jsonObject.getString("type").equals(AlertStageEnums.XJ.getCode()))) {
String departmentName= jsonObject.getString("name");
if (jsonObject.containsKey("airportUnit")) { {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(departmentName,null);
userIds.addAll(mapList);
}
if (jsonObject.containsKey("onDuty")) {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(DateUtils.getDateNowShortStr(), departmentName);
if(jsonObject.containsKey("onDuty")) {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(DateUtils.getDateNowShortStr(),departmentName);
userIds.addAll(mapList);
}
}
......@@ -1554,19 +1624,18 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
PowerTransferCompanyDto powerDto = JSONObject.parseObject(JSON.toJSON(powerTransferCompanyDto).toString(), PowerTransferCompanyDto.class);
Long companyId = powerDto.getCompanyId();
String companyName = powerDto.getCompanyName();
FireTeam fireTeam = fireTeamServiceImpl.getById(companyId);
FireTeam fireTeam= fireTeamServiceImpl.getById(companyId);
for (Object sendObject : sendIds) {
for(Object sendObject:sendIds) {
JSONObject jsonObject1 = JSONObject.parseObject(JSONObject.toJSONString(sendObject));
if (jsonObject1.containsKey("type") && (jsonObject1.getString("type").equals(AlertStageEnums.监控大队.getCode()))) {
if (jsonObject1.containsKey("onDuty")) {
if(jsonObject1.containsKey("onDuty")) {
List<Map<String, Object>> dutyList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(
DateUtils.getDateNowShortStr(), fireTeam.getCompanyName());
sendUserIds.addAll(dutyList);
}
if (jsonObject1.containsKey("airportUnit")) {
{
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(fireTeam.getCompanyName(), null);
if (jsonObject1.containsKey("airportUnit")) { {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff( fireTeam.getCompanyName(),null);
sendUserIds.addAll(mapList);
}
}
......@@ -1603,12 +1672,12 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
smsParams.put("contactPhone", calledRo.getContactPhone());
smsParams.put("alertType", calledRo.getAlertType());
List<String> userList = new ArrayList<String>();
List<String> userList= new ArrayList<String>();
sendUserIds.stream().forEach(i -> {
if (i.containsKey("mobilePhone")) {
mobiles.add(i.get("mobilePhone").toString());
}
if (i.containsKey("amosId") && !ValidationUtil.isEmpty(i.get("amosId"))) {
if (i.containsKey("amosId")&& !ValidationUtil.isEmpty(i.get("amosId"))) {
userList.add(i.get("amosId").toString());
}
});
......@@ -1620,13 +1689,13 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 调用短信发送接口
try {
alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams);
} catch (Exception e) {
}catch(Exception e){
}
Map<String, String> besidesMap = new HashMap<String, String>();
besidesMap.put("alterId", alertCalledId);
if (userList.size() > 0) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(), besidesMap, smsParams, userList);
if(userList.size()>0) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,userList);
}
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false);
}
......@@ -1634,6 +1703,9 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
}
public void ruleCallbackActionForPowerTransferForAid(String smsCode, List sendIds, Object object, List<String> pList) throws MqttPersistenceException, MqttException {
List<AlertSubmittedObject> alertSubmittedObjectList = Lists.newArrayList();
......@@ -1649,20 +1721,19 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
String alertSubmittedId = calledRo.getAlertSubmittedId();
alertCalledId = calledRo.getSequenceNbr();
//List<FireTeam> fireTeamList= new ArrayList<FireTeam>();
List<Object> companyDetail = JSONArray.parseArray(JSON.toJSON(calledRo.getCompany()).toString(), Object.class);
List<Object> companyDetail =JSONArray.parseArray(JSON.toJSON(calledRo.getCompany()).toString(),Object.class);
//获取急救科、消救部人员信息
for (Object e : sendIds) {
for(Object e:sendIds) {
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(e));
if (jsonObject.containsKey("type") && ((jsonObject.getString("type").equals(AlertStageEnums.ZH.getCode())) || jsonObject.getString("type").equals(AlertStageEnums.XJ.getCode()))) {
String departmentName = jsonObject.getString("name");
if (jsonObject.containsKey("airportUnit")) {
{
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(departmentName, null);
if(jsonObject.containsKey("type") &&( (jsonObject.getString("type").equals(AlertStageEnums.ZH.getCode())) || jsonObject.getString("type").equals(AlertStageEnums.XJ.getCode()))) {
String departmentName= jsonObject.getString("name");
if (jsonObject.containsKey("airportUnit")) { {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getFireRescueDepartmentStaff(departmentName,null);
userIds.addAll(mapList);
}
if (jsonObject.containsKey("onDuty")) {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(DateUtils.getDateNowShortStr(), departmentName);
if(jsonObject.containsKey("onDuty")) {
List<Map<String, Object>> mapList = dynamicFormInstanceMapper.getDutyPersonByTeamIdAndCarId(DateUtils.getDateNowShortStr(),departmentName);
userIds.addAll(mapList);
}
}
......@@ -1674,13 +1745,13 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
PowerTransferCompanyDto powerDto = JSONObject.parseObject(JSON.toJSON(powerTransferCompanyDto).toString(), PowerTransferCompanyDto.class);
Long companyId = powerDto.getCompanyId();
String companyName = powerDto.getCompanyName();
FireTeam fireTeam = fireTeamServiceImpl.getById(companyId);//这个公司ID实际上是120急救站的id值
FireTeam fireTeam= fireTeamServiceImpl.getById(companyId);//这个公司ID实际上是120急救站的id值
//fireTeamList.add(fireTeam);
for (Object e : sendIds) {
for(Object e:sendIds) {
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(e));
//获取120急救站的规则
if (jsonObject.containsKey("type") && (jsonObject.getString("type").equals(AlertStageEnums.JJZ.getCode()))) {
if (!jsonObject.containsKey("onDuty")) {
if(!jsonObject.containsKey("onDuty")) {
continue;
}
//fireTeamList.stream().forEach(i->{
......@@ -1721,12 +1792,12 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
smsParams.put("contactUser", calledRo.getContactUser());
smsParams.put("contactPhone", calledRo.getContactPhone());
smsParams.put("alertType", calledRo.getAlertType());
List<String> userList = new ArrayList<String>();
List<String> userList= new ArrayList<String>();
sendUserIds.stream().forEach(i -> {
if (i.containsKey("mobilePhone")) {
mobiles.add(i.get("mobilePhone").toString());
}
if (i.containsKey("amosId") && !ValidationUtil.isEmpty(i.get("amosId"))) {
if (i.containsKey("amosId")&& !ValidationUtil.isEmpty(i.get("amosId"))) {
userList.add(i.get("amosId").toString());
}
});
......@@ -1738,13 +1809,13 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
// 调用短信发送接口
try {
alertCalledAction.sendAlertCalleCmd(smsCode, mobiles, smsParams);
} catch (Exception e) {// TODO: handle exception
}catch (Exception e) {// TODO: handle exception
}
Map<String, String> besidesMap = new HashMap<String, String>();
besidesMap.put("alterId", alertCalledId);
if (userList.size() > 0) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(), besidesMap, smsParams, userList);
if(userList.size()>0) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,userList);
}
emqKeeper.getMqttClient().publish(topic, alertCalledId.getBytes(), RuleConfig.DEFAULT_QOS, false);
......@@ -1754,12 +1825,11 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
/**
* app消息web 消息推送
*
* @param
* @throws MqttPersistenceException
* @throws MqttException
*/
public void pushPowerTransferToAppAndWeb(String type, Map<String, String> besidesMap, HashMap<String, String> smsParams, List<String> userList) {
public void pushPowerTransferToAppAndWeb(String type,Map<String, String> besidesMap, HashMap<String, String> smsParams, List<String> userList){
PushMessageWebAndAppRo pushMessageWebAndAppRo = new PushMessageWebAndAppRo();
pushMessageWebAndAppRo.setRelationId(besidesMap.get("alterId"));
......@@ -1770,24 +1840,24 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
pushMessageWebAndAppRo.setRuleType(type);
pushMessageWebAndAppRo.setMsgType(this.msgType);
pushMessageWebAndAppRo.setTerminal(RuleConstant.APP_WEB);
Map<String, String> map = new HashMap<String, String>();
Map<String,String> map= new HashMap<String,String>();
//map.put("url", "disasterPage");
map.put("sequenceNbr", besidesMap.get("alterId"));
if (AlertBusinessTypeEnum.警情结案.getCode().equals(type)) {
if(AlertBusinessTypeEnum.警情结案.getCode().equals(type)) {
pushMessageWebAndAppRo.setName("消息");
pushMessageWebAndAppRo.setStartTime(besidesMap.get("startTime"));
pushMessageWebAndAppRo.setEndTime(besidesMap.get("endTime"));
pushMessageWebAndAppRo.setAddress(smsParams.get("address"));
pushMessageWebAndAppRo.setRuleType("endAlert");
}
if (AlertBusinessTypeEnum.非警情确认.getCode().equals(type)) {
if(AlertBusinessTypeEnum.非警情确认.getCode().equals(type)) {
pushMessageWebAndAppRo.setName("消息");
pushMessageWebAndAppRo.setSendTime(smsParams.get("callTimeStr"));
pushMessageWebAndAppRo.setAddress(smsParams.get("address"));
pushMessageWebAndAppRo.setRuleType("notAlert");
}
if (AlertBusinessTypeEnum.警情续报.getCode().equals(type)) {
if(AlertBusinessTypeEnum.警情续报.getCode().equals(type)) {
pushMessageWebAndAppRo.setName("消息");
pushMessageWebAndAppRo.setCompanyName(smsParams.get("alertType"));
pushMessageWebAndAppRo.setAddress(smsParams.get("address"));
......@@ -1797,20 +1867,20 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
pushMessageWebAndAppRo.setCasualtiesNum(smsParams.get("casualtiesNum"));//伤亡人数
pushMessageWebAndAppRo.setRuleType("followReportAlert");
}
if (AlertBusinessTypeEnum.力量调派.getCode().equals(type)) {
if(AlertBusinessTypeEnum.力量调派.getCode().equals(type)) {
//map.put("url", "powerInformationPage");
pushMessageWebAndAppRo.setName(AlertBusinessTypeEnum.力量调派.getName());
pushMessageWebAndAppRo.setCompanyName(smsParams.get("resourcesNum"));
pushMessageWebAndAppRo.setAddress(smsParams.get("address"));
pushMessageWebAndAppRo.setSendTime(smsParams.get("callTimeStr"));
if (StringUtils.isNotBlank(besidesMap.get("transferLocation"))) {
if(StringUtils.isNotBlank(besidesMap.get("transferLocation"))) {
pushMessageWebAndAppRo.setTransferLocation(besidesMap.get("responseLevelString"));//响应级别
pushMessageWebAndAppRo.setRuleType("fullTime");
} else {
}else {
pushMessageWebAndAppRo.setRuleType("monitor");
}
}
if (AlertBusinessTypeEnum.警情初报.getCode().equals(type)) {
if(AlertBusinessTypeEnum.警情初报.getCode().equals(type)) {
pushMessageWebAndAppRo.setRuleType("reportAlert");
pushMessageWebAndAppRo.setName(AlertBusinessTypeEnum.警情初报.getName());
pushMessageWebAndAppRo.setSendTime(besidesMap.get("sendTime"));
......@@ -1820,8 +1890,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
pushMessageWebAndAppRo.setTrappedNum(smsParams.get("trappedNum"));//被困人数
pushMessageWebAndAppRo.setCasualtiesNum(smsParams.get("casualtiesNum"));//伤亡人数
}
pushMessageWebAndAppRo.setExtras(map);
;
pushMessageWebAndAppRo.setExtras(map);;
try {
ruleTrigger.publish(pushMessageWebAndAppRo, "消息/addAlterMessageCheck", new String[0]);
......
......@@ -517,10 +517,10 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
responseLevel = list1.get(0).getFieldValue();
}
definitions.put("rescueGrid", alertCalled.getAddress());
definitions.put("rescueGrid", ValidationUtil.isEmpty(alertCalled.getAddress() ) ? "" : alertCalled.getAddress());
definitions.put("type", alertCalled.getAlertType());
definitions.put("contactUser", alertCalled.getContactUser());
definitions.put("contactPhone", alertCalled.getContactPhone());
definitions.put("contactUser", ValidationUtil.isEmpty(alertCalled.getContactUser() ) ? "" : alertCalled.getContactUser());
definitions.put("contactPhone", ValidationUtil.isEmpty(alertCalled.getContactPhone() ) ? "" : alertCalled.getContactPhone());
definitions.put("replaceContent", replaceContent);
definitions.put("responseLevel", responseLevel);
definitions.put("callTime",
......
......@@ -53,6 +53,7 @@ import com.yeejoin.amos.latentdanger.business.vo.DangerTimeAxisVo;
import com.yeejoin.amos.latentdanger.business.vo.LatentDangerDetailRiskVo;
import com.yeejoin.amos.latentdanger.business.vo.LatentDangerDetailVo;
import com.yeejoin.amos.latentdanger.business.vo.LatentDangerListVo;
import com.yeejoin.amos.latentdanger.common.enums.AuditEnum;
import com.yeejoin.amos.latentdanger.common.enums.DangerHandleStateEnum;
import com.yeejoin.amos.latentdanger.common.enums.DictTypeEnum;
import com.yeejoin.amos.latentdanger.common.enums.ExecuteStateEnum;
......@@ -97,17 +98,7 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
import static com.yeejoin.amos.latentdanger.business.util.RandomUtil.buildOrderNo;
......@@ -251,7 +242,8 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
if (ValidationUtil.isEmpty(dangerTypeEnum)) {
throw new Exception("检查类型参数有误");
}
Date endTime = this.GetTargetEndTime(param.getReformLimitDate());
param.setReformLimitDate(endTime);
// 保存隐患
LatentDanger latentDanger = saveLatentDanger(param, userId, departmentId, businessKey, orgCode,
dangerTypeEnum);
......@@ -326,6 +318,16 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
// riskFactorMapper.updateControlStatus(riskFactorBo);
// }
public static Date GetTargetEndTime(Date target) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(target);
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
Date end = calendar.getTime();
return end;
}
// TODO 使用远程调用替换
private void updateCheckInputDangerState(Long id, int code) {
latentDangerMapper.updateCheckInputDangerState(id, code);
......@@ -369,18 +371,18 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
Bean.copyExistPropertis(dangerDto, latentDanger);
if (ValidationUtil.isEmpty(dangerDto.getId())) {
// 新增
latentDanger.setBusinessKey(businessKey == null?"":businessKey);
latentDanger.setDiscovererDepartmentId(departmentId == null?"":departmentId);
latentDanger.setDiscovererUserId(userId == null?"": userId);
latentDanger.setOrgCode(orgCode == null?"":orgCode);
latentDanger.setDangerType(dangerTypeEnum.getCode() == null?"":dangerTypeEnum.getCode());
latentDanger.setDangerTypeName(dangerTypeEnum.getName() == null?"":dangerTypeEnum.getName());
latentDanger.setBusinessKey(businessKey == null ? "" : businessKey);
latentDanger.setDiscovererDepartmentId(departmentId == null ? "" : departmentId);
latentDanger.setDiscovererUserId(userId == null ? "" : userId);
latentDanger.setOrgCode(orgCode == null ? "" : orgCode);
latentDanger.setDangerType(dangerTypeEnum.getCode() == null ? "" : dangerTypeEnum.getCode());
latentDanger.setDangerTypeName(dangerTypeEnum.getName() == null ? "" : dangerTypeEnum.getName());
if (LatentDangerBizTypeEnum.防火监督.getCode().equals(bizType)) {
latentDanger.setDangerState(LatentDangerState.SupervisionDangerStateEnum.提交隐患.getCode() == null?"":LatentDangerState.SupervisionDangerStateEnum.提交隐患.getCode() );
latentDanger.setDangerStateName(LatentDangerState.SupervisionDangerStateEnum.提交隐患.getName() == null?"":LatentDangerState.SupervisionDangerStateEnum.提交隐患.getName());
latentDanger.setDangerState(LatentDangerState.SupervisionDangerStateEnum.提交隐患.getCode() == null ? "" : LatentDangerState.SupervisionDangerStateEnum.提交隐患.getCode());
latentDanger.setDangerStateName(LatentDangerState.SupervisionDangerStateEnum.提交隐患.getName() == null ? "" : LatentDangerState.SupervisionDangerStateEnum.提交隐患.getName());
} else if (LatentDangerBizTypeEnum.巡检.getCode().equals(bizType)) {
latentDanger.setDangerState(LatentDangerState.PatrolDangerStateEnum.待评审.getCode() == null?"":LatentDangerState.PatrolDangerStateEnum.待评审.getCode());
latentDanger.setDangerStateName(LatentDangerState.PatrolDangerStateEnum.待评审.getName() == null?"":LatentDangerState.PatrolDangerStateEnum.待评审.getName() );
latentDanger.setDangerState(LatentDangerState.PatrolDangerStateEnum.待评审.getCode() == null ? "" : LatentDangerState.PatrolDangerStateEnum.待评审.getCode());
latentDanger.setDangerStateName(LatentDangerState.PatrolDangerStateEnum.待评审.getName() == null ? "" : LatentDangerState.PatrolDangerStateEnum.待评审.getName());
}
if (ValidationUtil.isEmpty(dangerDto.getDangerName())) {
latentDanger.setDangerName(dangerDto.getInputItemName());
......@@ -403,13 +405,16 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
record.setExecuteUserName(userName);
record.setExecuteDepartmentId(departmentId);
record.setExecuteDepartmentName(departmentName);
record.setFlowJson(flowJson != null ? flowJson.toJSONString() : null);
record.setFlowTaskName(taskName);
record.setDangerId(dangerId);
record.setExecuteState(executeState);
record.setExecuteResult(executeResult);
record.setActionFlag(dangerState);
record.setRemark(remark);
if (!ValidationUtil.isEmpty(flowJson)) {
record.setFlowJson(flowJson.toJSONString());
record.setRemark(ValidationUtil.isEmpty(remark) ? flowJson.getString("remark") : remark);
}
record.setUpdateDate(new Date());
latentDangerFlowRecordService.saveOrUpdate(record);
return record;
......@@ -1148,13 +1153,14 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
ReginParams reginParams) throws Exception {
// 隐患的巡查信息
JSONObject bizInfo = latentDanger.getBizInfo();
if (ValidationUtil.isEmpty(bizInfo) || ValidationUtil.isEmpty(bizInfo.get("planType")) || ValidationUtil.isEmpty(bizInfo.get("accompanyingUserId"))) {
if (ValidationUtil.isEmpty(bizInfo) || ValidationUtil.isEmpty(bizInfo.get("planType")) || ValidationUtil.isEmpty(bizInfo.get("leadPeopleId"))) {
executeSubmitDto.setIsOk(false);
executeSubmitDto.setMsg("业务信息错误");
return executeSubmitDto;
}
String planType = bizInfo.get("planType").toString();
AgencyUserModel userModel = jcsFeignClient.getAmosIdByUserId((String) bizInfo.get("accompanyingUserId")).getResult();
// 获取检查组长
AgencyUserModel userModel = jcsFeignClient.getAmosIdByUserId((String) bizInfo.get("leadPeopleId")).getResult();
if (ValidationUtil.isEmpty(userModel)) {
executeSubmitDto.setIsOk(false);
executeSubmitDto.setMsg("业务信息错误");
......@@ -1264,6 +1270,20 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
return executeSubmitDto;
}
// 当隐患当前节点状态是现场确认,在执行完节点后需要将检查组长设置为下个节点执行人
if (LatentDangerState.SupervisionDangerStateEnum.现场确认.getCode().equals(latentDanger.getDangerState()) &&
!ValidationUtil.isEmpty(latentDanger.getInstanceId()) && ExecuteTypeEnum.驳回.getCode().equals(preRecord.getExecuteState())) {
// 在检查组长驳回后再现场确认需要将检查组长id设置为下个节点执行人
Object resultObj = workflowExecuteService.setTaskAssign(latentDanger.getInstanceId(), checkLeaderId);
executeSubmitDto.setCheckLeaderId(userModel.getUserId());
if (!(Boolean) resultObj) {
executeSubmitDto.setIsOk(false);
executeSubmitDto.setMsg("设置节点执行人失败");
return executeSubmitDto;
}
}
String nextState = "";
String nextStateName = "";
if (ExecuteTypeEnum.通过.getCode().equals(param.getExecuteType())) {
......@@ -1292,18 +1312,32 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
nextStateName = LatentDangerState.SupervisionDangerStateEnum.整改完毕.getName();
}
executeResultMsg = currentStateEnum.getName() + ExecuteTypeEnum.通过.getName();
} else {
} else {// 审核驳回
LatentDangerState.SupervisionDangerStateEnum nextStateEnum =
LatentDangerState.SupervisionDangerStateEnum.getEnumByCode(currentStateEnum.getRejectNext());
nextState = nextStateEnum.getCode();
nextStateName = nextStateEnum.getName();
executeResultMsg = currentStateEnum.getName() + ExecuteTypeEnum.驳回.getName();
// 驳回到提交整改资料节点需重新设置工作流节点执行人为整改责任人
if (nextStateEnum == LatentDangerState.SupervisionDangerStateEnum.提交整改资料) {
JSONObject reformJson = latentDanger.getReformJson();
AgencyUserModel checkLeader =
jcsFeignClient.getAmosIdByUserId((String) reformJson.get("reformLeaderId")).getResult();
Object result = workflowExecuteService.setTaskAssign(processInstanceId, checkLeader.getUserName());
if (!(Boolean) result) {
executeSubmitDto.setIsOk(false);
executeResultMsg = "设置节点执行人失败";
executeSubmitDto.setMsg(executeResultMsg);
return executeSubmitDto;
}
}
}
latentDanger.setDangerState(nextState);
latentDanger.setDangerStateName(nextStateName);
// 当隐患状态当前节点是整改任务分配时,在执行完节点后需要将整改分配责任人设置为下个节点执行人
// TODO 整改责任人需要保存(如果下一步审核驳回,需要能获取到这个指定的整改责任人)
// 整改责任人需要保存(如果下一步审核驳回,需要能获取到这个指定的整改责任人)
if (LatentDangerState.SupervisionDangerStateEnum.整改任务分配.getCode().equals(currentStateEnum.getCode())) {
if (ValidationUtil.isEmpty(param.getReformLeaderId())) {
executeSubmitDto.setIsOk(false);
......@@ -1854,13 +1888,15 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
dangerIdList = Lists.newArrayList(idsStr.split(","));
}
if (OwerEnum.MY.getCode().equals(pageParam.get("my"))) {
// 不指定隐患id-我的任务
// 查询工作流待登录人执行的任务
JSONObject allTaskResult = workflowFeignService.getCurrentUserAllTaskList(workflowProcessDefinitionKey);
allTaskList = (List) allTaskResult.get("data");
// 待执行任务对应instanceId列表
List<String> instanceIdList = Lists.newArrayList();
List<LatentDanger> dangers;
if (!ValidationUtil.isEmpty(allTaskList)) {
allTaskList.forEach(m -> instanceIdList.add(((Map) m).get("processInstanceId").toString()));
// 查询对应instanceId的隐患数据
dangers =
this.baseMapper.selectList(new LambdaQueryWrapper<LatentDanger>().in(LatentDanger::getInstanceId, instanceIdList));
List<String> finalDangerIdList = dangerIdList;
......@@ -1875,6 +1911,10 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
pageParam.put("dangerState", LatentDangerState.PatrolDangerStateEnum.待评审.getCode());
}
}
// app待审核隐患须加上“提交隐患”状态的数据
if (AuditEnum.AUDIT.getCode().equals(pageParam.get("type"))) {
pageParam.put("submitDangerState", LatentDangerState.SupervisionDangerStateEnum.提交隐患.getCode());
}
}
// 获取隐患地点的子节点
Object structureId = pageParam.get("structureId");
......@@ -2166,7 +2206,11 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
throw new Exception("隐患不存");
}
latentDangerDto.setDangerPosition(null);
Bean.copyExistPropertis(latentDangerDto, latentDanger);
//以下方法存在bug会将数值类型的默认值0拷贝到对象上造成数据覆盖
//Bean.copyExistPropertis(latentDangerDto, latentDanger);
latentDanger.setId(latentDangerDto.getId());
latentDanger.setFlowJson(latentDangerDto.getFlowJson());
if (!ValidationUtil.isEmpty(latentDangerDto.getPhotoUrl())) {
latentDanger.setPhotoUrls(Joiner.on(",").join(latentDangerDto.getPhotoUrl()));
}
......@@ -2199,7 +2243,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
@Override
public IPage<LatentDanger> reviewListDanger(PageParam pageParam) throws Exception {
String type = pageParam.get("type").toString();
if ("audit".equals(type)) {
if (AuditEnum.AUDIT.getCode().equals(type)) {
List<LatentDangerState.SupervisionDangerStateEnum> stateEnums =
LatentDangerState.SupervisionDangerStateEnum.getEnumListByProcessState(LatentDangerProcessStateEnum.待审核.getCode());
List<String> dangerState = stateEnums.stream().map(stateEnum -> stateEnum != null ?
......@@ -2207,7 +2251,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
dangerState.add(LatentDangerState.SupervisionDangerStateEnum.提交隐患.getCode());
// 审核状态
pageParam.put("dangerState", Joiner.on(",").join(dangerState));
} else if ("review".equals(type)) {
} else if (AuditEnum.REVIEW.getCode().equals(type)) {
List<LatentDangerState.SupervisionDangerStateEnum> stateEnums =
LatentDangerState.SupervisionDangerStateEnum.getEnumListByProcessState(LatentDangerProcessStateEnum.待复核.getCode());
List<String> dangerState = stateEnums.stream().map(stateEnum -> stateEnum != null ? stateEnum.getCode() : null).collect(Collectors.toList());
......
......@@ -586,4 +586,14 @@ public class CheckController extends AbstractBaseController {
return CommonResponseUtil.success(page);
}
/**
* 根据检查记录查询照片
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据检查记录查询照片", notes = "根据检查记录查询照片")
@RequestMapping(value = "/getPictureByCheckId", method = RequestMethod.GET)
public CommonResponse getPictureByCheckId(@ApiParam(value = "检查记录ID") @RequestParam String checkId) {
List<String> pictures = checkService.getPictureByCheckId(checkId);
return CommonResponseUtil.success(pictures);
}
}
......@@ -8,6 +8,7 @@ import com.yeejoin.amos.supervision.business.vo.CheckInfoVo;
import com.yeejoin.amos.supervision.business.vo.CheckVo;
import com.yeejoin.amos.supervision.core.common.response.PointCheckInfoBusinessRespone;
import com.yeejoin.amos.supervision.core.common.response.PointCheckInfoRespone;
import com.yeejoin.amos.supervision.dao.entity.Check;
import org.apache.ibatis.annotations.Param;
import java.util.HashMap;
......@@ -295,4 +296,14 @@ public interface CheckMapper extends BaseMapper {
long queryPageCount(CheckPageParam param);
List<CheckVo> queryPage(CheckPageParam param);
/**
* 根据任务id获取相关检查记录
*
* @param id
* @return
*/
List<Check> getCheckListByTaskId(@Param(value = "planTaskId") long id);
List<String> getPictureByCheckId(String checkId);
}
package com.yeejoin.amos.supervision.business.feign;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.supervision.business.dto.OrgUsrFormDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
......@@ -54,4 +55,13 @@ public interface JCSFeignClient {
*/
@RequestMapping(value = "jcs/org-usr/getUnit/{id}", method = RequestMethod.GET)
FeignClientResult<Map<String, Object>> getCompanyById(@PathVariable("id") String companyId);
/**
* 根据机场单位id获取单位人员列表
*
* @param companyId 机场单位id
* @return
*/
@RequestMapping(value = "jcs/org-usr/{companyId}/person/list", method = RequestMethod.GET)
FeignClientResult<List<OrgUsrFormDto>> getPersonListByCompanyId(@PathVariable("companyId") String companyId);
}
......@@ -41,17 +41,18 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.ParseException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
......@@ -160,17 +161,26 @@ public class CheckReportServiceImpl extends BaseService<CheckReportDto, CheckRep
// 获取隐患信息
Map<String, String> dangerParamMap = Maps.newHashMap();
// 本次隐患id
List<String> dangerIdList = Arrays.asList(checkReportDto.getDangerIds().split(","));
List<String> dangerIdList = Lists.newArrayList();
if (!ValidationUtil.isEmpty(checkReportDto.getDangerIds())) {
dangerIdList = Arrays.asList(checkReportDto.getDangerIds().split(","));
}
// 复核隐患id
List<String> reviewDangerIdList = Arrays.asList(checkReportDto.getReviewDangerIds().split(","));
List<String> reviewDangerIdList = Lists.newArrayList();
if (!ValidationUtil.isEmpty(checkReportDto.getReviewDangerIds())) {
reviewDangerIdList = Arrays.asList(checkReportDto.getReviewDangerIds().split(","));
}
Set<String> allDangerIdSet = Sets.newHashSet();
allDangerIdSet.addAll(dangerIdList);
allDangerIdSet.addAll(reviewDangerIdList);
if (!ValidationUtil.isEmpty(allDangerIdSet)) {
dangerParamMap.put("dangerIds", Joiner.on(",").join(allDangerIdSet));
List<DangerDto> dangerDtoList = dangerFeignClient.listAll(dangerParamMap).getResult();
List<CheckReportDangerDto> dangerList = Lists.newArrayList();
List<CheckReportDangerDto> reviewDangerList = Lists.newArrayList();
if (!ValidationUtil.isEmpty(dangerDtoList)) {
List<String> finalDangerIdList = dangerIdList;
List<String> finalReviewDangerIdList = reviewDangerIdList;
dangerDtoList.forEach(dangerDto -> {
CheckReportDangerDto checkReportDangerDto = new CheckReportDangerDto();
BeanUtils.copyProperties(dangerDto, checkReportDangerDto);
......@@ -178,19 +188,19 @@ public class CheckReportServiceImpl extends BaseService<CheckReportDto, CheckRep
checkReportDangerDto.setCompanyId(bizInfo.get("pointId"));
checkReportDangerDto.setCompanyName(bizInfo.get("pointName"));
if (dangerIdList.contains(dangerDto.getId().toString())) {
if (finalDangerIdList.contains(dangerDto.getId().toString())) {
dangerList.add(checkReportDangerDto);
}
if (reviewDangerIdList.contains(dangerDto.getId().toString())) {
if (finalReviewDangerIdList.contains(dangerDto.getId().toString())) {
checkReportDangerDto.setReviewUser(dangerDto.getExecuteUserName());
reviewDangerList.add(checkReportDangerDto);
}
});
}
checkReportDto.setCheckDangerList(dangerList);
checkReportDto.setReviewDangerList(reviewDangerList);
}
}
return checkReportDto;
}
......
......@@ -1578,7 +1578,7 @@ public class CheckServiceImpl implements ICheckService {
Plan plan = planService.queryPlanById(planTask.getPlanId());
// 计划完成,规则推送消息
if (PlanStatusEnum.COMPLETED.getValue() == plan.getStatus()){
rulePlanService.addPlanRule(plan, null, RuleTypeEnum.计划完成);
rulePlanService.addPlanRule(plan, null, RuleTypeEnum.计划完成, null);
}
// p_plan_task_detail更新隐患个数
......@@ -1685,5 +1685,8 @@ public class CheckServiceImpl implements ICheckService {
return result;
}
@Override
public List<String> getPictureByCheckId(String checkId) {
return checkMapper.getPictureByCheckId(checkId);
}
}
......@@ -38,6 +38,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.DataNotFound;
......@@ -207,14 +208,15 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService {
//组织业务基本数据 对应bizInfo
HiddenDangerDto hiddenDangerDto = new HiddenDangerDto();
hiddenDangerDto.setPlanId(planId);
hiddenDangerDto.setPointId(pointArray.length > 1 ? Long.parseLong(pointArray[1]) : null);
hiddenDangerDto.setPointId(pointArray.length > 1 ? Long.parseLong(StringUtils.trimAllWhitespace(pointArray[1])) : null);
hiddenDangerDto.setPointName(pointArray.length > 1 ? pointArray[0] : null);
hiddenDangerDto.setCheckInputId(seq);
hiddenDangerDto.setDangerType(DangerHandleTypeEnum.SELF.getCode());
try {
dangerDto.setBizInfo(this.buildBizInfo(hiddenDangerDto));
} catch (Exception e) {
log.error(e.getMessage(),e);
throw new RuntimeException("组织数据失败");
log.error(e.getMessage(), e);
throw new RuntimeException("组织数据失败!" + e.getMessage());
}
return dangerDto;
}).collect(Collectors.toList());
......@@ -273,6 +275,8 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService {
Point point = new Point();
if (!ObjectUtils.isEmpty(hiddenDangerDto.getPointId())) {
point = iPointDao.findById(hiddenDangerDto.getPointId()).orElseThrow(() -> new RuntimeException("单位不存在"));
} else {
throw new RuntimeException("单位不存在");
}
//检查级别
DangerCheckTypeLevelEnum dangerCheckTypeLevelEnum = DangerCheckTypeLevelEnum.getEumByCode(plan.getCheckLevel());
......@@ -288,10 +292,8 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService {
result.put("bizId", hiddenDangerDto.getCheckInputId());
result.put("bizName", hiddenDangerDto.getInputItemName());
result.put("routeId", plan.getRouteId());
result.put("accompanyingUserId", plan.getLeadPeopleIds()); // 检查陪同人id
result.put("accompanyingUserName", plan.getLeadPeopleNames()); // 检查陪同人名称
result.put("checkUnitId",plan.getCheckUnitId());
result.put("checkUnitName",plan.getCheckUnitName());
result.put("checkUnitId", plan.getCheckUnitId()); // 检查人所在单位id逗号隔开
result.put("checkUnitName", plan.getCheckUnitName());// 检查人所在单位名称逗号隔开
result.put("leadPeopleId", plan.getLeadPeopleIds()); // 牵头人id
result.put("leadPeopleName", plan.getLeadPeopleNames()); // 牵头人名称
result.put("makerUserId", plan.getMakerUserId()); // 计划制定人id
......@@ -313,13 +315,11 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService {
return;
}
List<CheckShot> shotList = iCheckShotDao.findAllByCheckIdAndCheckInputId(checkInput.getCheckId(), checkInput.getId());
result.put("checkUserId", checkInput.getUserId());
result.put("checkUserName", checkInput.getUserName());
result.put("accompanyUserId", checkInput.getAccompanyUserId());
result.put("accompanyUserName", checkInput.getAccompanyUserName());
result.put("accompanyingUserId", checkInput.getAccompanyUserId());
result.put("accompanyingUserName",checkInput.getAccompanyUserName());
result.put("planExecuteTime", checkInput.getCreateDate());
result.put("checkUserId", checkInput.getUserId()); // 任务执行人id
result.put("checkUserName", checkInput.getUserName()); // 任务执行人名称
result.put("accompanyingUserId", checkInput.getAccompanyUserId()); // 检查陪同人id
result.put("accompanyingUserName", checkInput.getAccompanyUserName()); // 检查陪同人名称
result.put("planExecuteTime", checkInput.getCreateDate()); // 计划任务执行时间
result.put("checkPhotoUrl", shotList.stream().map(CheckShot::getPhotoData).collect(Collectors.joining(",")));
}
}
......@@ -237,7 +237,7 @@ public class PlanServiceImpl implements IPlanService {
}
try {
if (ValidationUtil.isEmpty(status)){
rulePlanService.addPlanRule(plan, userIds, RuleTypeEnum.计划提交); // 计划提交
rulePlanService.addPlanRule(plan, userIds, RuleTypeEnum.计划提交, null); // 计划提交
} else {
if (PlanStatusEnum.EXAMINE_THREE.getValue() != status){
rulePlanService.addPlanAuditRule(plan, userIds, RuleTypeEnum.计划审核, ExecuteStateNameEnum.getNameByCode(excuteState)); // 计划审核
......
......@@ -536,8 +536,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
// 2.保存执行数据明细表
planTaskDetail.saveAndFlush(planTaskDetailInstance);
// 规则推送消息
rulePlanService.addPlanRule(plan, null, RuleTypeEnum.计划生成);
rulePlanService.addPlanRule(plan, null, RuleTypeEnum.计划生成, pointId.longValue());
}
// 定时任务监控
jobService.planTaskAddJob(planTask);
......
package com.yeejoin.amos.supervision.business.service.impl;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.google.gson.JsonObject;
import com.yeejoin.amos.boot.biz.common.constants.RuleConstant;
import com.yeejoin.amos.boot.biz.common.enums.RuleTypeEnum;
import com.yeejoin.amos.component.rule.RuleTrigger;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import com.yeejoin.amos.supervision.business.dao.mapper.PointMapper;
import com.yeejoin.amos.supervision.business.dto.OrgUsrFormDto;
import com.yeejoin.amos.supervision.business.dto.PlanRo;
import com.yeejoin.amos.supervision.business.feign.JCSFeignClient;
import com.yeejoin.amos.supervision.business.util.DateUtil;
import com.yeejoin.amos.supervision.business.util.Toke;
import com.yeejoin.amos.supervision.dao.entity.Plan;
import com.yeejoin.amos.supervision.dao.entity.Point;
import com.yeejoin.amos.supervision.feign.RemoteSecurityService;
import org.bouncycastle.cert.ocsp.Req;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.Date;
......@@ -28,28 +43,47 @@ public class RulePlanService {
private final String packageId = "消息/addPlanRule";
private final String msgType = "supervision";
@Value("${supervision.person.charger.role:Person_charge_unit_fire_protection_supervision_inspection}")
private String supervisionPersonChargerRole;
@Autowired
private RuleTrigger ruleTrigger;
@Autowired
private JCSFeignClient jcsFeignClient;
public Boolean addPlanRule(Plan plan, List<String> userIds, RuleTypeEnum ruleType) throws Exception {
PlanRo planRo = buildPlanRo(plan, userIds, ruleType);
@Autowired
private RemoteSecurityService remoteSecurityService;
@Autowired
private PointServiceImpl pointService;
@Async
public Boolean addPlanRule(Plan plan, List<String> userIds, RuleTypeEnum ruleType, Long pointId) throws Exception {
PlanRo planRo = buildPlanRo(plan, userIds, ruleType, pointId);
//触发规则
ruleTrigger.publish(planRo, packageId, new String[0]);
return true;
}
@Async
public Boolean addPlanAuditRule(Plan plan, List<String> userIds, RuleTypeEnum ruleType, String excuteStateName) throws Exception {
PlanRo planRo = buildPlanRo(plan, userIds, ruleType);
PlanRo planRo = buildPlanRo(plan, userIds, ruleType, null);
planRo.setExcuteStateName(excuteStateName);
//触发规则
ruleTrigger.publish(planRo, packageId, new String[0]);
return true;
}
private PlanRo buildPlanRo(Plan plan, List<String> userIds, RuleTypeEnum ruleType) {
private PlanRo buildPlanRo(Plan plan, List<String> userIds, RuleTypeEnum ruleType, Long pointId) {
// 设置token
if (ValidationUtil.isEmpty(RequestContext.getToken())) {
Toke tokenObj = remoteSecurityService.getServerToken();
RequestContext.setProduct(tokenObj.getProduct());
RequestContext.setAppKey(tokenObj.getAppKey());
RequestContext.setToken(tokenObj.getToke());
}
PlanRo planRo = new PlanRo();
BeanUtils.copyProperties(plan, planRo);
planRo.setMsgType(msgType);
......@@ -74,11 +108,35 @@ public class RulePlanService {
}
if (ValidationUtil.isEmpty(userIds)) {
// 计划牵头责任人
String leadPeopleIds = plan.getLeadPeopleIds();
if (!ValidationUtil.isEmpty(plan.getUserId()) && !leadPeopleIds.contains(plan.getUserId())) {
leadPeopleIds += "," + plan.getUserId();
}
userIds = (List<String>) jcsFeignClient.getAmosIdListByUserIds(leadPeopleIds).getResult();
// pointId是被检查单位id
if (!ValidationUtil.isEmpty(pointId)) {
List<String> userIdList = Lists.newArrayList();
Point point = pointService.queryPointById(pointId);
List<OrgUsrFormDto> personList =
jcsFeignClient.getPersonListByCompanyId(point.getOriginalId()).getResult();
List<String> personIdList = Lists.transform(personList, OrgUsrFormDto::getAmosOrgId);
List<RoleModel> roleList =
Privilege.roleClient.queryRoleList(supervisionPersonChargerRole, null).getResult();
if (!ValidationUtil.isEmpty(roleList)) {
List<AgencyUserModel> agencyUserModelList = Privilege.agencyUserClient.queryByRoleId(
String.valueOf(roleList.get(0).getSequenceNbr()), null).getResult();
if (!ValidationUtil.isEmpty(agencyUserModelList)) {
List<String> finalUserIds = userIds;
agencyUserModelList.forEach(userModel -> {
if (personIdList.contains(userModel.getUserId()) && !finalUserIds.contains(userModel.getUserId())) {
finalUserIds.add(userModel.getUserId());
}
});
userIds = finalUserIds;
}
}
}
}
planRo.setSendTime(DateUtil.date2LongStr(new Date()));
planRo.setRecivers(userIds);
......
......@@ -282,4 +282,6 @@ public interface ICheckService {
int checkHasRecord(Long planTaskId, Long pointId);
Page<CheckVo> queryPage(CheckPageParam criterias);
List<String> getPictureByCheckId(String checkId);
}
......@@ -9,7 +9,10 @@ import java.util.Date;
*/
@Data
public class CheckVo {
/**
* checkId
*/
private Long checkId;
/**
* 主键id
*/
......
......@@ -43,10 +43,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@Service("jobService")
public class JobService implements IJobService {
......@@ -215,7 +217,13 @@ public class JobService implements IJobService {
private void createOmissionCheckRecord(PlanTask planTask) {
List<PlanTaskPointInputItemBo> planTaskPointInputItems = planTaskMapper
.getPlanTaskPointInputItemByPlanTaskId(planTask.getId(), PlanTaskDetailStatusEnum.OMISSION.getValue());
List<Check> checkList = checkMapper.getCheckListByTaskId(planTask.getId());
Map<Long, Check> checkMap = new HashMap<>();
if (!ValidationUtil.isEmpty(checkList)) {
checkList.stream().collect(Collectors.groupingBy(Check::getPointId)).forEach((e,v) -> {
checkMap.put(e, v.get(0));
});
}
Set<Long> checkIds = new HashSet<Long>();
//查询用户名字
for (PlanTaskPointInputItemBo arg : planTaskPointInputItems) {
......
......@@ -2,19 +2,25 @@ package com.yeejoin.amos.boot.module.tzs.flc.biz.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.Equipment;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentAssociated;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.ArrayList;
import java.util.List;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.EquipmentAssociatedServiceImpl;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
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 org.springframework.beans.factory.annotation.Autowired;
......@@ -48,10 +54,64 @@ public class EquipmentAssociatedController extends BaseController {
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增配套设备设施部件", notes = "新增配套设备设施部件")
public ResponseModel<EquipmentAssociatedDto> save(@RequestBody EquipmentAssociatedDto model) {
model.setIsDelete(false);
model = equipmentAssociatedServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
}
/**
* 根据sequenceNbr删除
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "删除配套设施", notes = "删除配套设施")
public ResponseModel<Boolean> deleteBySequenceNbr(@PathVariable(value = "sequenceNbr") Long sequenceNbr){
Boolean flag = equipmentAssociatedServiceImpl.update(new LambdaUpdateWrapper<EquipmentAssociated>().eq(EquipmentAssociated::getSequenceNbr,sequenceNbr).set(EquipmentAssociated::getIsDelete,true));
return ResponseHelper.buildResponse(flag);
}
/**
* 根据sequenceNbr更新
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/updateAssociated")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新配套设备设施部件", notes = "根据sequenceNbr配套设备设施部件")
public ResponseModel<EquipmentAssociatedDto> updateAssociated(@RequestBody EquipmentAssociatedDto model) {
if (ValidationUtil.isEmpty(model)
|| ValidationUtil.isEmpty(model.getSequenceNbr())) {
throw new BadRequest("参数校验失败.");
}
model = equipmentAssociatedServiceImpl.updateAssociated(model);
return ResponseHelper.buildResponse(model);
}
/**
* 新增配套设备/设施/部件
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据设备id返回配套设施信息", notes = "根据设备id返回配套设施信息")
public ResponseModel<List<EquipmentAssociatedDto>> getAssociatedByEquipmentId(@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
List<EquipmentAssociated> entity = equipmentAssociatedServiceImpl.list(new LambdaQueryWrapper<EquipmentAssociated>().eq(EquipmentAssociated::getIsDelete,false).eq(EquipmentAssociated::getEquipmentId,sequenceNbr));
List<EquipmentAssociatedDto> result = new ArrayList<>();
entity.stream().forEach(t -> {
EquipmentAssociatedDto temp = new EquipmentAssociatedDto();
BeanUtils.copyProperties(t,temp);
result.add(temp);
});
return ResponseHelper.buildResponse(result);
}
/**
*
......
......@@ -96,7 +96,7 @@ public class EquipmentController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/updateEquipment")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新装备信息表", notes = "根据sequenceNbr更新装备信息表")
public ResponseModel<EquipmentDto> updateBySequenceNbrEquipment(@RequestBody EquipmentDto model) {
public ResponseModel<EquipmentDto> updateEquip20ment(@RequestBody EquipmentDto model) {
if (ValidationUtil.isEmpty(model)
|| ValidationUtil.isEmpty(model.getSequenceNbr())) {
throw new BadRequest("参数校验失败.");
......
package com.yeejoin.amos.boot.module.tzs.flc.biz.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.EquipmentUseInfoServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentUseInfoDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
/**
* 设备使用信息表
*
* @author system_generator
* @date 2022-01-05
*/
@RestController
@Api(tags = "设备使用信息表Api")
@RequestMapping(value = "/equipment-use-info")
public class EquipmentUseInfoController extends BaseController {
@Autowired
EquipmentUseInfoServiceImpl equipmentUseInfoServiceImpl;
/**
* 新增设备使用信息表
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增设备使用信息表", notes = "新增设备使用信息表")
public ResponseModel<EquipmentUseInfoDto> save(@RequestBody EquipmentUseInfoDto model) {
model = equipmentUseInfoServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新设备使用信息表", notes = "根据sequenceNbr更新设备使用信息表")
public ResponseModel<EquipmentUseInfoDto> updateBySequenceNbrEquipmentUseInfo(@RequestBody EquipmentUseInfoDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(equipmentUseInfoServiceImpl.updateWithModel(model));
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除设备使用信息表", notes = "根据sequenceNbr删除设备使用信息表")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
return ResponseHelper.buildResponse(equipmentUseInfoServiceImpl.removeById(sequenceNbr));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个设备使用信息表", notes = "根据sequenceNbr查询单个设备使用信息表")
public ResponseModel<EquipmentUseInfoDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(equipmentUseInfoServiceImpl.queryBySeq(sequenceNbr));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "设备使用信息表分页查询", notes = "设备使用信息表分页查询")
public ResponseModel<Page<EquipmentUseInfoDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size) {
Page<EquipmentUseInfoDto> page = new Page<EquipmentUseInfoDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(equipmentUseInfoServiceImpl.queryForEquipmentUseInfoPage(page));
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "设备使用信息表列表全部数据查询", notes = "设备使用信息表列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<EquipmentUseInfoDto>> selectForList() {
return ResponseHelper.buildResponse(equipmentUseInfoServiceImpl.queryForEquipmentUseInfoList());
}
}
......@@ -30,4 +30,10 @@ public class EquipmentAssociatedServiceImpl extends BaseService<EquipmentAssocia
public List<EquipmentAssociatedDto> queryForEquipmentAssociatedList() {
return this.queryForList("" , false);
}
@Override
public EquipmentAssociatedDto updateAssociated(EquipmentAssociatedDto model) {
this.updateWithModel(model);
return model;
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.dto.FailureDetailsDto;
......@@ -16,11 +17,14 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.tzs.api.enums.InformWorkFlowEnum;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentIndexDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentUseInfoDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.InformEquipmentDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.Equipment;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentIndex;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentIndexInform;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentInform;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentUseInfo;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.UnitInfo;
import com.yeejoin.amos.boot.module.tzs.flc.api.enums.EquipmentInformStatusEnum;
import com.yeejoin.amos.boot.module.tzs.flc.api.enums.EquipmentStatusEnum;
import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.EquipmentInformMapper;
......@@ -51,6 +55,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;
/**
* 设备告知单服务实现类
......@@ -89,7 +94,11 @@ public class EquipmentInformServiceImpl extends BaseService<EquipmentInformDto,E
@Autowired
EquipmentIndexInformServiceImpl iEquipmentIndexInformService;
@Autowired
EquipmentUseInfoServiceImpl equipmentUseInfoServiceImpl;
@Autowired
UnitInfoServiceImpl unitInfoServiceImpl;
/**
* 分页查询
......@@ -199,7 +208,8 @@ public class EquipmentInformServiceImpl extends BaseService<EquipmentInformDto,E
public Boolean acceptInform(Long sequenceNbr) {
// 接收告知书 更新告知书状态
Boolean flag = false;
flag = this.update(new LambdaUpdateWrapper<EquipmentInform>().eq(EquipmentInform::getSequenceNbr,sequenceNbr).set(EquipmentInform::getInformStatus,"9"));
EquipmentInform inform = this.getById(sequenceNbr);
flag = this.updateById(inform);
if(flag) {
// 更新设备相关参数
List<InformEquipmentDto> equipmentList = informEquipmentServiceImpl.getEquipListByInformId(sequenceNbr);
......@@ -209,6 +219,44 @@ public class EquipmentInformServiceImpl extends BaseService<EquipmentInformDto,E
BeanUtils.copyProperties(t,sourceEquip);
sourceEquip.setSequenceNbr(t.getSourceEquipmentId());
equipmentServiceImpl.updateById(sourceEquip);
// 保存设备相关使用信息
EquipmentUseInfo useInfo = equipmentUseInfoServiceImpl.getOne(new LambdaQueryWrapper<EquipmentUseInfo>().eq(EquipmentUseInfo::getEquipmentId,t.getSourceEquipmentId()));
if(useInfo == null) {
useInfo = new EquipmentUseInfo();
}
useInfo.setLatitude(t.getLatitude());
useInfo.setLongitude(t.getLongitude());
useInfo.setUseAddress(t.getAddress());
useInfo.setUseSite(inform.getUseSite());
useInfo.setUseSiteCode(inform.getUseSiteCode());
//useInfo.setSpecialCode(UUID.randomUUID().toString().replaceAll("-",""));
//if(StringUtils.isEmpty(useInfo.getRegisterCode())) {
// useInfo.setRegisterCode(sourceEquip.getTypeId()+inform.getRegionCode()+ DateUtils.getYear(new Date())+"01");
//}
//useInfo.setRescueCode(UUID.randomUUID().toString().replaceAll("-",""));
//useInfo.setRegisterLicenceCode(UUID.randomUUID().toString().replaceAll("-",""));
if(useInfo.getRegisterTime() != null) {
useInfo.setRegisterTime(new Date());
}
useInfo.setStartUseTime(new Date());
useInfo.setIssueLicenceTime(new Date());
useInfo.setEquipmentId(t.getSourceEquipmentId());
useInfo.setUseUnitName(inform.getUseUnit());
useInfo.setUseUnitId(inform.getUseUnitId());
UnitInfo useUnit = unitInfoServiceImpl.getOne(new LambdaQueryWrapper<UnitInfo>().eq(UnitInfo::getIsDelete,false).eq(UnitInfo::getOrgUserId,inform.getUseUnitId()));
useInfo.setUseOrganizationCode(useUnit.getOrganizationCode());
useInfo.setPropertyUnitName(inform.getPropertyUnit());
useInfo.setPropertyUnitId(inform.getPropertyUnitId());
UnitInfo propertyUnit = unitInfoServiceImpl.getOne(new LambdaQueryWrapper<UnitInfo>().eq(UnitInfo::getIsDelete,false).eq(UnitInfo::getOrgUserId,inform.getPropertyUnitId()));
useInfo.setPropertyOrganizationCode(propertyUnit.getOrganizationCode());
equipmentUseInfoServiceImpl.saveOrUpdate(useInfo);
// 获取设备附件信息 保存附件信息
// 原附件信息
Map<String, List<AttachmentDto>> sourceAttach = sourceFileService.getAttachments(t.getSequenceNbr());
......@@ -283,6 +331,7 @@ public class EquipmentInformServiceImpl extends BaseService<EquipmentInformDto,E
}
}
}
model.setProcessStatus("0");
return model;
}
......@@ -333,7 +382,6 @@ public class EquipmentInformServiceImpl extends BaseService<EquipmentInformDto,E
@Transactional
public Boolean acceptInform(Long sequenceNbr, ReginParams userInfo) throws Exception {
EquipmentInformDto model = this.queryBySeq(sequenceNbr);
model.setInformStatus("9");
InformWorkFlowEnum submit = InformWorkFlowEnum.接收方接收告知书;
model.setProcessStatus(submit.getProcessStatus());
// 流程流转
......
package com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentUseInfo;
import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.EquipmentUseInfoMapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.IEquipmentUseInfoService;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentUseInfoDto;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
/**
* 设备使用信息表服务实现类
*
* @author system_generator
* @date 2022-01-05
*/
@Service
public class EquipmentUseInfoServiceImpl extends BaseService<EquipmentUseInfoDto,EquipmentUseInfo,EquipmentUseInfoMapper> implements IEquipmentUseInfoService {
/**
* 分页查询
*/
public Page<EquipmentUseInfoDto> queryForEquipmentUseInfoPage(Page<EquipmentUseInfoDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<EquipmentUseInfoDto> queryForEquipmentUseInfoList() {
return this.queryForList("" , false);
}
}
\ No newline at end of file
......@@ -66,8 +66,8 @@ dcs.url.sendalarm=http://198.87.103.158:8001/alarm-service/appalarm/sendalarm
#系统上线时间
param.system.online.date = 2019-02-12
# 视频转码服务开关 off/on,默认关闭,数字换流站使用时开启
param.isUseVideoTranscoding = off
# 视频转码服务开关 hls(关)/flv(开),默认关闭,数字换流站使用时开启
window.vedioFormat = hls
# 航天视频服务地址
param.htvideo.url="http://192.168.4.174:9001";
# 南瑞视频转码服务地址
......
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url = jdbc:mysql://172.16.11.20:3306/autosys_business_v3.0.0.2?useUnicode=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.username= root
spring.datasource.password= root_123
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.pool-name=DatebookHikariCP
spring.datasource.hikari.minimum-idle= 3
spring.datasource.hikari.maximum-pool-size= 30
spring.datasource.hikari.auto-commit= true
spring.datasource.hikari.idle-timeout= 10000
spring.datasource.hikari.max-lifetime= 1800000
spring.datasource.hikari.connection-timeout= 30000
spring.datasource.hikari.connection-test-query= SELECT 1
# 文件服务器地址
fileserver_domain=http://39.98.246.31:8888/
eureka.instance.hostname= 172.16.11.20
eureka.instance.prefer-ip-address = true
eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:10001/eureka/
#security config
security.password=a1234560
security.loginId=fas_system
security.productApp=STUDIO_APP_MOBILE
security.productWeb=STUDIO_APP_WEB
security.appKeyApp=studio_normalapp_3056965
#redis
spring.redis.database=1
spring.redis.host=172.16.11.20
spring.redis.port=6379
spring.redis.password=1234560
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
## emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.11.33:1883
emqx.user-name=admin
emqx.password=public
mqtt.scene.host=mqtt://172.16.11.33:8083/mqtt
mqtt.client.product.id=mqtt
mqtt.topic=topic_mqtt
spring.mqtt.completionTimeout=3000
#数据同步开关
systemctl.sync.switch=false
#数据JCS开关
systemctl.jcs.switch=false
#平台数据开关
systemctl.amos.switch=false
#报表数据地址
equip.report.url=/fire-fighting-system/ureport/preview?_u=file:
#数字化南瑞平台接口
dcs.url.token=http://198.87.103.158:8001/auth-service/oauth/token
dcs.url.sendalarm=http://198.87.103.158:8001/alarm-service/appalarm/sendalarm
#系统上线时间
param.system.online.date = 2019-02-12
# 视频转码服务开关 hls(关)/flv(开),默认关闭,数字换流站使用时开启
window.vedioFormat = hls
# 航天视频服务地址
param.htvideo.url="";
# 南瑞视频转码服务地址
param.nrvideo.url="";
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url = jdbc:mysql://172.16.10.66:3306/safety-business-3.0.1?useUnicode=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.username= root
spring.datasource.password= root_123
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.pool-name=DatebookHikariCP
spring.datasource.hikari.minimum-idle= 3
spring.datasource.hikari.maximum-pool-size= 30
spring.datasource.hikari.auto-commit= true
spring.datasource.hikari.idle-timeout= 10000
spring.datasource.hikari.max-lifetime= 1800000
spring.datasource.hikari.connection-timeout= 30000
spring.datasource.hikari.connection-test-query= SELECT 1
fdfs.so-timeout=1501
fdfs.connect-timeout=601
fdfs.thumb-image.height=200
fdfs.thumb-image.width=200
fdfs.tracker-list[0]=39.98.246.31:22122
# 文件服务器地址
fileserver_domain=http://39.98.246.31:8888/
eureka.instance.hostname= 172.16.10.72
eureka.instance.prefer-ip-address = true
eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:10001/eureka/
#security config
security.password=a1234560
security.loginId=fas_system
security.productApp=STUDIO_APP_MOBILE
security.productWeb=STUDIO_APP_WEB
security.appKeyApp=studio_normalapp_3157169
#redis
spring.redis.database=0
spring.redis.host=172.16.10.85
spring.redis.port=6379
spring.redis.password=amos2019Redis
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
mqtt.scene.host=mqtt://172.16.10.85:8083/mqtt
mqtt.client.product.id=mqtt
mqtt.topic=topic_mqtt
spring.mqtt.completionTimeout=3000
## emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.85:1883
emqx.user-name=super
emqx.password=a123456
#数据同步开关
systemctl.sync.switch=false
#数据JCS开关
systemctl.jcs.switch=true
#平台数据开关
systemctl.amos.switch=true
#报表数据地址
equip.report.url=/fire-fighting-system/ureport/preview?_u=file:
#数字化南瑞平台接口
dcs.url.token=http://198.87.103.158:8001/auth-service/oauth/token
dcs.url.sendalarm=http://198.87.103.158:8001/alarm-service/appalarm/sendalarm
#系统上线时间
param.system.online.date = 2019-02-12
# 视频转码服务开关 hls(关)/flv(开),默认关闭,数字换流站使用时开启
window.vedioFormat = hls
# 航天视频服务地址
param.htvideo.url="";
# 南瑞视频转码服务地址
param.nrvideo.url="";
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url = jdbc:mysql://172.16.11.20:3306/autosys_business_v3.0.0.2?useUnicode=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.username= root
spring.datasource.password= root_123
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.pool-name=DatebookHikariCP
spring.datasource.hikari.minimum-idle= 3
spring.datasource.hikari.maximum-pool-size= 30
spring.datasource.hikari.auto-commit= true
spring.datasource.hikari.idle-timeout= 10000
spring.datasource.hikari.max-lifetime= 1800000
spring.datasource.hikari.connection-timeout= 30000
spring.datasource.hikari.connection-test-query= SELECT 1
# 文件服务器地址
fileserver_domain=http://39.98.246.31:8888/
eureka.instance.hostname= 172.16.11.20
eureka.instance.prefer-ip-address = true
eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:10001/eureka/
#security config
security.password=a1234560
security.loginId=fas_system
security.productApp=STUDIO_APP_MOBILE
security.productWeb=STUDIO_APP_WEB
security.appKeyApp=studio_normalapp_3056965
#redis
spring.redis.database=1
spring.redis.host=172.16.11.20
spring.redis.port=6379
spring.redis.password=1234560
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
## emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.11.33:1883
emqx.user-name=admin
emqx.password=public
mqtt.scene.host=mqtt://172.16.11.33:8083/mqtt
mqtt.client.product.id=mqtt
mqtt.topic=topic_mqtt
spring.mqtt.completionTimeout=3000
#数据同步开关
systemctl.sync.switch=false
#数据JCS开关
systemctl.jcs.switch=false
#平台数据开关
systemctl.amos.switch=false
#报表数据地址
equip.report.url=/fire-fighting-system/ureport/preview?_u=file:
#数字化南瑞平台接口
dcs.url.token=http://198.87.103.158:8001/auth-service/oauth/token
dcs.url.sendalarm=http://198.87.103.158:8001/alarm-service/appalarm/sendalarm
#系统上线时间
param.system.online.date = 2019-02-12
# 视频转码服务开关 hls(关)/flv(开),默认关闭,数字换流站使用时开启
window.vedioFormat = hls
# 航天视频服务地址
param.htvideo.url="";
# 南瑞视频转码服务地址
param.nrvideo.url="";
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url = jdbc:mysql://172.16.11.20:3306/autosys_business_v3.0.0.2?useUnicode=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.username= root
spring.datasource.password= root_123
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.pool-name=DatebookHikariCP
spring.datasource.hikari.minimum-idle= 3
spring.datasource.hikari.maximum-pool-size= 30
spring.datasource.hikari.auto-commit= true
spring.datasource.hikari.idle-timeout= 10000
spring.datasource.hikari.max-lifetime= 1800000
spring.datasource.hikari.connection-timeout= 30000
spring.datasource.hikari.connection-test-query= SELECT 1
# 文件服务器地址
fileserver_domain=http://39.98.246.31:8888/
eureka.instance.hostname= 172.16.11.20
eureka.instance.prefer-ip-address = true
eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:10001/eureka/
#security config
security.password=a1234560
security.loginId=fas_system
security.productApp=STUDIO_APP_MOBILE
security.productWeb=STUDIO_APP_WEB
security.appKeyApp=studio_normalapp_3056965
#redis
spring.redis.database=1
spring.redis.host=172.16.11.20
spring.redis.port=6379
spring.redis.password=1234560
spring.redis.lettuce.pool.max-active=200
spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle=10
spring.redis.lettuce.pool.min-idle=0
spring.redis.expire.time=300
## emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.11.33:1883
emqx.user-name=admin
emqx.password=public
mqtt.scene.host=mqtt://172.16.11.33:8083/mqtt
mqtt.client.product.id=mqtt
mqtt.topic=topic_mqtt
spring.mqtt.completionTimeout=3000
#报表数据地址
equip.report.url=/fire-fighting-system/ureport/preview?_u=file:
#数字化南瑞平台接口
dcs.url.token=http://198.87.103.158:8001/auth-service/oauth/token
dcs.url.sendalarm=http://198.87.103.158:8001/alarm-service/appalarm/sendalarm
#系统上线时间
param.system.online.date = 2019-02-12
# 视频转码服务开关 hls(关)/flv(开),默认关闭,数字换流站使用时开启
window.vedioFormat = hls
# 航天视频服务地址
param.htvideo.url="";
# 南瑞视频转码服务地址
param.nrvideo.url="";
......@@ -632,23 +632,18 @@ ORDER BY
-- ----------------------------
DROP VIEW IF EXISTS `v_equip_alarm_today_statistics`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `v_equip_alarm_today_statistics` AS SELECT
count(
`confirm_type`
) AS `confirmed`,
(
count(1) - count(
`clean_time`
)
) AS `unCleaned`,
(
count(1) - count(
`confirm_type`
)
) AS `pending`
FROM
`wl_equipment_specific_alarm_log`
WHERE
(
cast(now() AS date) = cast(
`create_date` AS date
)
);
`wl_equipment_specific_alarm_log`;
-- ----------------------------
-- View structure for v_equip_fire_control_water
......@@ -674,10 +669,8 @@ SELECT
`sal`.`equipment_specific_index_key` AS `indexKey`,
`sal`.`equipment_specific_index_name` AS `indexName`,
`sal`.`equipment_specific_id` AS `specificId`,
concat(
sal.equipment_specific_name,
sal.equipment_specific_index_name
) AS alamReason,
IF
( `sal`.`clean_time` IS NOT NULL, '已消除', '未消除' ) `cleanStatus`,
`sal`.`iot_code` AS `iotCode`,
date_format(
`sal`.`create_date`,
......@@ -5794,27 +5787,153 @@ CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `v_equip
-- 火灾报警系统4小告警列表前60
DROP VIEW IF EXISTS `v_fire_equip_alarm_60list_alarm`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `v_fire_equip_alarm_60list_alarm` AS select `sa`.`id` AS `id`,`ec`.`code` AS `mRid`,`sa`.`equipment_specific_name` AS `specificName`,`sa`.`equipment_specific_index_key` AS `indexKey`,`sa`.`equipment_specific_index_name` AS `indexName`,`sa`.`equipment_specific_id` AS `specificId`,concat(`sa`.`equipment_specific_name`,`sa`.`equipment_specific_index_name`) AS `alamReason`,`sa`.`iot_code` AS `iotCode`,`sa`.`create_date` AS `createDate` from (`wl_equipment_specific_alarm_log` `sa` left join `wl_equipment_specific` `ec` on((`sa`.`equipment_specific_id` = `ec`.`id`))) where find_in_set('029026401813010000000016',`sa`.`system_codes`) order by `sa`.`create_date` desc limit 60;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `v_fire_equip_alarm_60list_alarm` AS SELECT
`sa`.`id` AS `id`,
`ec`.`code` AS `mRid`,
`sa`.`equipment_specific_name` AS `specificName`,
`sa`.`equipment_specific_index_key` AS `indexKey`,
`sa`.`equipment_specific_index_name` AS `indexName`,
`sa`.`equipment_specific_id` AS `specificId`,
IF
( `sa`.`clean_time` IS NOT NULL, '已消除', '未消除' ) `cleanStatus`,
`sa`.`iot_code` AS `iotCode`,
`sa`.`create_date` AS `createDate`
FROM
(
`wl_equipment_specific_alarm_log` `sa`
LEFT JOIN `wl_equipment_specific` `ec` ON ((
`sa`.`equipment_specific_id` = `ec`.`id`
)))
WHERE
find_in_set( '029026401813010000000016', `sa`.`system_codes` )
ORDER BY
`sa`.`create_date` DESC
LIMIT 60;
-- CAFS系统4小告警列表前60
DROP VIEW IF EXISTS `v_fire_equip_alarm_60list_cafs`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `v_fire_equip_alarm_60list_cafs` AS select `sa`.`id` AS `id`,`ec`.`code` AS `mRid`,`sa`.`equipment_specific_name` AS `specificName`,`sa`.`equipment_specific_index_key` AS `indexKey`,`sa`.`equipment_specific_index_name` AS `indexName`,`sa`.`equipment_specific_id` AS `specificId`,concat(`sa`.`equipment_specific_name`,`sa`.`equipment_specific_index_name`) AS `alamReason`,`sa`.`iot_code` AS `iotCode`,`sa`.`create_date` AS `createDate` from (`wl_equipment_specific_alarm_log` `sa` left join `wl_equipment_specific` `ec` on((`sa`.`equipment_specific_id` = `ec`.`id`))) where find_in_set('029026401813010000000023',`sa`.`system_codes`) order by `sa`.`create_date` desc limit 60;
CREATE ALGORITHM = UNDEFINED DEFINER = `root` @`%` SQL SECURITY DEFINER VIEW `v_fire_equip_alarm_60list_cafs` AS SELECT
`sa`.`id` AS `id`,
`ec`.`code` AS `mRid`,
`sa`.`equipment_specific_name` AS `specificName`,
`sa`.`equipment_specific_index_key` AS `indexKey`,
`sa`.`equipment_specific_index_name` AS `indexName`,
`sa`.`equipment_specific_id` AS `specificId`,
IF
( `sa`.`clean_time` IS NOT NULL, '已消除', '未消除' ) `cleanStatus`,
`sa`.`iot_code` AS `iotCode`,
`sa`.`create_date` AS `createDate`
FROM
(
`wl_equipment_specific_alarm_log` `sa`
LEFT JOIN `wl_equipment_specific` `ec` ON ((
`sa`.`equipment_specific_id` = `ec`.`id`
)))
WHERE
find_in_set( '029026401813010000000023', `sa`.`system_codes` )
ORDER BY
`sa`.`create_date` DESC
LIMIT 60;
-- 预混泡沫灭火系统4小告警列表前60
DROP VIEW IF EXISTS `v_fire_equip_alarm_60list_foam`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `v_fire_equip_alarm_60list_foam` AS select `sa`.`id` AS `id`,`ec`.`code` AS `mRid`,`sa`.`equipment_specific_name` AS `specificName`,`sa`.`equipment_specific_index_key` AS `indexKey`,`sa`.`equipment_specific_index_name` AS `indexName`,`sa`.`equipment_specific_id` AS `specificId`,concat(`sa`.`equipment_specific_name`,`sa`.`equipment_specific_index_name`) AS `alamReason`,`sa`.`iot_code` AS `iotCode`,`sa`.`create_date` AS `createDate` from (`wl_equipment_specific_alarm_log` `sa` left join `wl_equipment_specific` `ec` on((`sa`.`equipment_specific_id` = `ec`.`id`))) where find_in_set('029026401813010000000054',`sa`.`system_codes`) order by `sa`.`create_date` desc limit 60;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `v_fire_equip_alarm_60list_foam` AS SELECT
`sa`.`id` AS `id`,
`ec`.`code` AS `mRid`,
`sa`.`equipment_specific_name` AS `specificName`,
`sa`.`equipment_specific_index_key` AS `indexKey`,
`sa`.`equipment_specific_index_name` AS `indexName`,
`sa`.`equipment_specific_id` AS `specificId`,
IF
( `sa`.`clean_time` IS NOT NULL, '已消除', '未消除' ) `cleanStatus`,
`sa`.`iot_code` AS `iotCode`,
`sa`.`create_date` AS `createDate`
FROM
(
`wl_equipment_specific_alarm_log` `sa`
LEFT JOIN `wl_equipment_specific` `ec` ON ((
`sa`.`equipment_specific_id` = `ec`.`id`
)))
WHERE
find_in_set( '029026401813010000000054', `sa`.`system_codes` )
ORDER BY
`sa`.`create_date` DESC
LIMIT 60;
-- 细水雾涡扇炮系统4小告警列表前60
DROP VIEW IF EXISTS `v_fire_equip_alarm_60list_foam_mist`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `v_fire_equip_alarm_60list_foam_mist` AS select `sa`.`id` AS `id`,`ec`.`code` AS `mRid`,`sa`.`equipment_specific_name` AS `specificName`,`sa`.`equipment_specific_index_key` AS `indexKey`,`sa`.`equipment_specific_index_name` AS `indexName`,`sa`.`equipment_specific_id` AS `specificId`,concat(`sa`.`equipment_specific_name`,`sa`.`equipment_specific_index_name`) AS `alamReason`,`sa`.`iot_code` AS `iotCode`,`sa`.`create_date` AS `createDate` from (`wl_equipment_specific_alarm_log` `sa` left join `wl_equipment_specific` `ec` on((`sa`.`equipment_specific_id` = `ec`.`id`))) where find_in_set('011023306003010000000082',`sa`.`system_codes`) order by `sa`.`create_date` desc limit 60;
CREATE ALGORITHM = UNDEFINED DEFINER = `root` @`%` SQL SECURITY DEFINER VIEW `v_fire_equip_alarm_60list_foam_mist` AS SELECT
`sa`.`id` AS `id`,
`ec`.`code` AS `mRid`,
`sa`.`equipment_specific_name` AS `specificName`,
`sa`.`equipment_specific_index_key` AS `indexKey`,
`sa`.`equipment_specific_index_name` AS `indexName`,
`sa`.`equipment_specific_id` AS `specificId`,
IF
( `sa`.`clean_time` IS NOT NULL, '已消除', '未消除' ) `cleanStatus`,
`sa`.`iot_code` AS `iotCode`,
`sa`.`create_date` AS `createDate`
FROM
(
`wl_equipment_specific_alarm_log` `sa`
LEFT JOIN `wl_equipment_specific` `ec` ON ((
`sa`.`equipment_specific_id` = `ec`.`id`
)))
WHERE
find_in_set( '011023306003010000000082', `sa`.`system_codes` )
ORDER BY
`sa`.`create_date` DESC
LIMIT 60;
-- 排油系统4小告警列表前60
DROP VIEW IF EXISTS `v_fire_equip_alarm_60list_ONL`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `v_fire_equip_alarm_60list_onl` AS select `sa`.`id` AS `id`,`ec`.`code` AS `mRid`,`sa`.`equipment_specific_name` AS `specificName`,`sa`.`equipment_specific_index_key` AS `indexKey`,`sa`.`equipment_specific_index_name` AS `indexName`,`sa`.`equipment_specific_id` AS `specificId`,concat(`sa`.`equipment_specific_name`,`sa`.`equipment_specific_index_name`) AS `alamReason`,`sa`.`iot_code` AS `iotCode`,`sa`.`create_date` AS `createDate` from (`wl_equipment_specific_alarm_log` `sa` left join `wl_equipment_specific` `ec` on((`sa`.`equipment_specific_id` = `ec`.`id`))) where find_in_set('029026401813010000000030',`sa`.`system_codes`) order by `sa`.`create_date` desc limit 60;
DROP VIEW IF EXISTS `v_fire_equip_alarm_60list_onl`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `v_fire_equip_alarm_60list_onl` AS SELECT
`sa`.`id` AS `id`,
`ec`.`code` AS `mRid`,
`sa`.`equipment_specific_name` AS `specificName`,
`sa`.`equipment_specific_index_key` AS `indexKey`,
`sa`.`equipment_specific_index_name` AS `indexName`,
`sa`.`equipment_specific_id` AS `specificId`,
IF
( `sa`.`clean_time` IS NOT NULL, '已消除', '未消除' ) `cleanStatus`,
`sa`.`iot_code` AS `iotCode`,
`sa`.`create_date` AS `createDate`
FROM
(
`wl_equipment_specific_alarm_log` `sa`
LEFT JOIN `wl_equipment_specific` `ec` ON ((
`sa`.`equipment_specific_id` = `ec`.`id`
)))
WHERE
find_in_set( '029026401813010000000030', `sa`.`system_codes` )
ORDER BY
`sa`.`create_date` DESC
LIMIT 60;
-- 消防给水系统4小告警列表前60
DROP VIEW IF EXISTS `v_fire_equip_alarm_60list_water`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `v_fire_equip_alarm_60list_water` AS select `sa`.`id` AS `id`,`ec`.`code` AS `mRid`,`sa`.`equipment_specific_name` AS `specificName`,`sa`.`equipment_specific_index_key` AS `indexKey`,`sa`.`equipment_specific_index_name` AS `indexName`,`sa`.`equipment_specific_id` AS `specificId`,concat(`sa`.`equipment_specific_name`,`sa`.`equipment_specific_index_name`) AS `alamReason`,`sa`.`iot_code` AS `iotCode`,`sa`.`create_date` AS `createDate` from (`wl_equipment_specific_alarm_log` `sa` left join `wl_equipment_specific` `ec` on((`sa`.`equipment_specific_id` = `ec`.`id`))) where find_in_set('029026401813010000000047',`sa`.`system_codes`) order by `sa`.`create_date` desc limit 60;
CREATE ALGORITHM = UNDEFINED DEFINER = `root` @`%` SQL SECURITY DEFINER VIEW `v_fire_equip_alarm_60list_water` AS SELECT
`sa`.`id` AS `id`,
`ec`.`code` AS `mRid`,
`sa`.`equipment_specific_name` AS `specificName`,
`sa`.`equipment_specific_index_key` AS `indexKey`,
`sa`.`equipment_specific_index_name` AS `indexName`,
`sa`.`equipment_specific_id` AS `specificId`,
IF
( `sa`.`clean_time` IS NOT NULL, '已消除', '未消除' ) `cleanStatus`,
`sa`.`iot_code` AS `iotCode`,
`sa`.`create_date` AS `createDate`
FROM
(
`wl_equipment_specific_alarm_log` `sa`
LEFT JOIN `wl_equipment_specific` `ec` ON ((
`sa`.`equipment_specific_id` = `ec`.`id`
)))
WHERE
find_in_set( '029026401813010000000047', `sa`.`system_codes` )
ORDER BY
`sa`.`create_date` DESC
LIMIT 60;
-- 消防人员视图
DROP VIEW IF EXISTS `v_fire_fighter`;
......
......@@ -2238,6 +2238,7 @@
</sql>
</changeSet>
<changeSet author="tw" id="20220104-5">
<preConditions onFail="MARK_RAN">
<not>
......@@ -2275,4 +2276,26 @@
<changeSet author="keyong" id="1641367742-1">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_equipment_specific_alarm_log" columnName="clean_time"/>
</not>
</preConditions>
<comment>wl_equipment_specific_alarm_log add column clean_time</comment>
<sql>
alter table `wl_equipment_specific_alarm_log` add column `clean_time` datetime DEFAULT NULL COMMENT '消除时间';
</sql>
</changeSet>
<changeSet author="keyong" id="1641367742-2">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_equipment" columnName="clean_type"/>
</not>
</preConditions>
<comment>wl_equipment add column clean_type</comment>
<sql>
ALTER TABLE wl_equipment ADD COLUMN clean_type varchar(50) DEFAULT NULL COMMENT '警情消除方式(0:收到复位信号自动消除;1:警情处理确认后消除)';
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -44,7 +44,9 @@
confirm_user,
confirm_user_name,
confirm_date,
(SELECT GROUP_CONCAT(fem.name) FROM `f_fire_fighting_system` fem WHERE find_in_set(fem.id,spe.system_id)) as systemName
(SELECT GROUP_CONCAT(fem.name) FROM `f_fire_fighting_system` fem WHERE find_in_set(fem.id,spe.system_id)) as systemName,
if(ala.clean_time is null, '未清除', '已清除') AS cleanStatus,
ala.clean_time
from
wl_equipment_specific_alarm_log as ala
left join wl_equipment_specific as spe on spe.id = ala.equipment_specific_id
......
......@@ -180,6 +180,11 @@
fireEquipmentName,
concat(wlesal.equipment_specific_name,wlesal.equipment_specific_index_name) as alamContent,
if(confirm_type is null,'未处理','已处理') handleStatus,
IF (
wlesal.clean_time IS NOT NULL,
'已消除',
'未消除'
) cleanStatus,
confirm_type as handleType,
wlesal.equipment_index_id AS fireEquipmentIndexId,
wlesal.equipment_specific_index_key AS fireEquipmentSpecificIndexKey,
......@@ -237,6 +242,13 @@
open="(" close=")" index="">#{item}
</foreach>
</if>
<if test="param.id!=null and param.id!=''">AND d.fireEquipmentId = #{param.id}</if>
<if test="param.cleanStatus != null and param.cleanStatus != '' and param.cleanStatus == 1">AND
d.cleanStatus = '已消除'
</if>
<if test="param.cleanStatus != null and param.cleanStatus != '' and param.cleanStatus == 2">AND
d.cleanStatus = '未消除'
</if>
</where>
ORDER BY d.createDate DESC
</select>
......@@ -294,6 +306,16 @@
'已处理',
'去确认'
) handleStatus,
IF (
wlesal.clean_time IS NOT NULL,
'已消除',
'未消除'
) cleanStatus,
IF (
wlesal.clean_time IS NOT NULL,
'1',
'2'
) cleanStatusVal,
wlesal.confirm_type AS handleType,
wlesal.system_codes AS systemCodes,
wlesal.equipment_index_id AS fireEquipmentIndexId,
......@@ -344,10 +366,16 @@
<when test="param.confirmType != null and param.confirmType != '' and param.confirmType == 0">
AND d.handleType IS NULL
</when>
<when test="param.confirmType != null and param.confirmType != '' and param.confirmType == 2">
AND d.cleanStatus = '未消除'
</when>
<when test="param.confirmType != null and param.confirmType != '' and param.confirmType == 3">
AND d.cleanStatus = '已消除'
</when>
</choose>
<if test="param.beginDate!=null">AND d.createDate <![CDATA[>=]]> #{param.beginDate}</if>
<if test="param.endDate!=null">AND d.createDate <![CDATA[<=]]> #{param.endDate}</if>
<if test="param.alarmType == 'BREAKDOWN' or param.alarmType == 'FIREALARM'">AND d.type = #{param.alarmType}</if>
<if test="param.alarmType != null and param.alarmType != ''">AND d.type = #{param.alarmType}</if>
<if test="param.systemCode != null and param.systemCode != ''">
AND find_in_set(#{param.systemCode},d.systemCodes)
</if>
......@@ -358,6 +386,12 @@
</if>
<if test="param.id!=null and param.id!=''">AND d.fireEquipmentId = #{param.id}</if>
<if test="param.status!=null and param.status!=3">AND d.status = #{param.status}</if>
<if test="param.cleanStatus != null and param.cleanStatus != '' and param.cleanStatus == 1">AND
d.cleanStatus = '已消除'
</if>
<if test="param.cleanStatus != null and param.cleanStatus != '' and param.cleanStatus == 2">AND
d.cleanStatus = '未消除'
</if>
ORDER BY d.createDate DESC
</select>
<select id="getAlarmList" resultType="java.util.HashMap">
......
......@@ -1453,5 +1453,15 @@
and e.category_id = c.id
and s.biz_org_code <![CDATA[<>]]> ''
GROUP BY s.biz_org_code ,c.code
<select id="getEquipmentBySpecificId" resultType="String">
select
we.clean_type
from
wl_Equipment we
LEFT JOIN `wl_equipment_detail` wed ON wed.equipment_id = we.id
LEFT JOIN `wl_equipment_specific` wes ON wes.equipment_detail_id = wed.id
where
wes.id = #{specificId}
</select>
</mapper>
\ No newline at end of file
......@@ -489,8 +489,10 @@
d.fireEquipmentName,
d.warehouseStructureName,
d.fireEquipmentSpecificIndexName,
d.createDate,d.confirmType,
d.type
d.createDate,
d.confirmType,
d.type,
d.cleanStatus
FROM
(
SELECT
......@@ -501,7 +503,8 @@
wlesal.equipment_index_id AS fireEquipmentIndexId,
wlesal.equipment_specific_index_key AS fireEquipmentSpecificIndexKey,
wlesal.equipment_specific_index_name AS fireEquipmentSpecificIndexName,
if(wlesal.confirm_type IS NULL,0,1) AS confirmType,
if(wlesal.confirm_type IS NULL, 0, 1) AS confirmType,
if(wlesal.clean_time IS NULL, 0, 1) AS cleanStatus,
CASE
wlesal.equipment_specific_index_value
WHEN 'true' THEN
......@@ -549,6 +552,12 @@
<if test='confirmType != null and confirmType == 1'>
and wlesal.confirm_type IS NOT NULL
</if>
<if test='confirmType != null and confirmType == 2'>
and wlesal.clean_time IS NULL
</if>
<if test='confirmType != null and confirmType == 3'>
and wlesal.clean_time IS NOT NULL
</if>
</where>
) d
<where>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.equipmanage.mapper.VideoEquipmentSpecificMapper">
<select id="findBySpecificIdAndVideoIdIn" resultType="com.yeejoin.equipmanage.common.entity.VideoEquipmentSpecific">
SELECT
v.id,
v.equipment_specific_id AS equipmentSpecificId,
v.video_id AS videoId
FROM
`wl_video_equipment_specific` v
<where>
<if test="equipmentSpecificId != null">
v.equipment_specific_id = #{equipmentSpecificId}
</if>
<if test="list != null and list.size() >0">
AND v.video_id IN
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
</mapper>
......@@ -967,10 +967,13 @@
and a.biz_type = #{value}
</if>
<if test="key == 'dangerIds' and value != null">
and a.id IN
and (a.id IN
<foreach collection="value" item="id" open="(" separator="," close=")">
#{id}
</foreach>
<if test="paramMap['my'] == 0">
or a.danger_state = #{paramMap[submitDangerState]}
</if>)
</if>
<if test="key == 'dangerState' and value != null and !value.isEmpty()">
and a.danger_state IN
......
......@@ -289,4 +289,15 @@
ALTER TABLE p_check add COLUMN `owner_name` varchar(255) DEFAULT NULL COMMENT '业主单位名称' after `owner_id`;
</sql>
</changeSet>
<changeSet author="suhuiguang" id="1641519644827-01">
<preConditions onFail="MARK_RAN">
<columnExists tableName="p_check" columnName="point_no"/>
</preConditions>
<comment>p_check MODIFY `point_no`</comment>
<sql>
alter table p_check MODIFY `point_no` varchar(100) DEFAULT NULL COMMENT '编号';
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -9,10 +9,10 @@
ci.input_name as inputItemName,
ci.user_name as checkUserName,
ci.create_date as checkTime,
c.point_name
pp.name as pointName
FROM `p_hidden_danger` phd
left join p_check_input ci on phd.check_input_id = ci.id
left join p_check c on c.id = phd.check_id
left join p_point pp on pp.id = phd.point_id
<where>
<if test="planId !=null and planId != ''">and phd.plan_id=#{planId}</if>
<if test="pointId !=null and pointId != ''">and phd.point_id=#{pointId}</if>
......
......@@ -51,7 +51,7 @@
<if test="catalogId!=null">and b.Catalog_Id = #{catalogId}</if>
<if test="orgCode!=null">and (a.org_Code like concat (#{orgCode},"-%")or a.org_Code= #{orgCode})</if>
<if test="pointId!=null">and a.point_id = #{pointId}</if>
<if test="departmentId!=null and departmentId!='-1'"> and find_in_set(#{departmentId}, a.dep_id) > 0</if>
<if test="departmentId!=null and departmentId!='-1'">and find_in_set(#{departmentId}, a.dep_id) > 0</if>
<choose>
<when test="finishStatus == 0">and (`a`.`plan_task_detail_id` = 0 OR `a`.`plan_task_detail_id` is
null)
......@@ -109,7 +109,8 @@
LEFT JOIN `p_route` `d` ON `a`.`route_id` = `d`.`id`
LEFT JOIN `p_plan` `e` ON `a`.`plan_id` = `e`.`id`
<if test="dangerId != null and dangerId != ''">
LEFT JOIN ( SELECT check_id, GROUP_CONCAT( latent_danger_id ) dangerIds FROM p_latent_danger_patrol GROUP BY check_id ) t ON t.check_id = a.id
LEFT JOIN ( SELECT check_id, GROUP_CONCAT( latent_danger_id ) dangerIds FROM p_latent_danger_patrol GROUP BY
check_id ) t ON t.check_id = a.id
</if>
<trim prefix="WHERE" prefixOverrides="AND ">
<if test="beginDate!=null and endDate!=null">and a.check_time BETWEEN #{beginDate} and #{endDate}</if>
......@@ -127,7 +128,7 @@
<if test="orgCode!=null">and (a.org_Code like concat (#{orgCode},"-%")or a.org_Code= #{orgCode})</if>
<if test="pointId!=null">and a.point_id = #{pointId}</if>
<if test="checkTime!=null">and TO_DAYS(a.check_time) = TO_DAYS('${checkTime}')</if>
<if test="departmentId!=null and departmentId!='-1'"> and find_in_set(#{departmentId}, a.dep_id) > 0</if>
<if test="departmentId!=null and departmentId!='-1'">and find_in_set(#{departmentId}, a.dep_id) > 0</if>
<if test="checkType == '计划检查'">and a.plan_task_id &gt; 0</if>
<if test="checkType == '无计划检查'">and a.plan_task_id &lt;= 0</if>
<choose>
......@@ -211,7 +212,8 @@
order by ci.order_no
</select>
<select id="findCheckPointInputItem" resultType="com.yeejoin.amos.supervision.business.entity.mybatis.PointCheckDetailBo"
<select id="findCheckPointInputItem"
resultType="com.yeejoin.amos.supervision.business.entity.mybatis.PointCheckDetailBo"
parameterType="long">
SELECT
pp.id pointId,
......@@ -250,16 +252,16 @@
order by pci.order_no
</select>
<!-- <select id="checkHasRecord" resultType="int">-->
<!-- SELECT-->
<!-- count(1) num-->
<!-- FROM-->
<!-- p_check c-->
<!-- WHERE-->
<!-- is_ok in (1,2)-->
<!-- and c.point_id = #{pointId}-->
<!-- and c.plan_task_id = #{planTaskId}-->
<!-- </select>-->
<!-- <select id="checkHasRecord" resultType="int">-->
<!-- SELECT-->
<!-- count(1) num-->
<!-- FROM-->
<!-- p_check c-->
<!-- WHERE-->
<!-- is_ok in (1,2)-->
<!-- and c.point_id = #{pointId}-->
<!-- and c.plan_task_id = #{planTaskId}-->
<!-- </select>-->
<select id="pieChartData" resultType="Map">
SELECT
......@@ -475,7 +477,7 @@
<when test="finishStatus == 1">and (`a`.`plan_task_detail_id` != 0 AND `a`.`is_ok` != 3)</when>
<when test="finishStatus == 2">and `a`.`is_ok` = 3</when>
</choose>
<if test="departmentId!=null"> and find_in_set(#{departmentId},a.dep_id)>0 </if>
<if test="departmentId!=null">and find_in_set(#{departmentId},a.dep_id)>0</if>
</trim>
</select>
......@@ -795,12 +797,13 @@
FROM
p_point_classify classify
<where>
classify.id IN ( SELECT pci.point_classify_id FROM p_check_input pci WHERE <if test="checkID != null">pci.check_id = #{checkID}</if> )
classify.id IN ( SELECT pci.point_classify_id FROM p_check_input pci WHERE <if test="checkID != null">
pci.check_id = #{checkID}
</if> )
</where>
</select>
<!-- 根据巡检记录ID和巡检点ID获取巡检项信息 -->
<select id="getCheckInputByCheckId" resultMap="checkInputResultMap">
SELECT
......@@ -856,7 +859,8 @@
FROM p_check_input pci WHERE
<if test="pointID != null">
pci.check_id = #{checkID}
</if> )
</if>
)
</select>
<!-- 根据巡检记录ID和巡检点ID获取巡检项信息 -->
<select id="getEquipInputByCheckId" resultType="java.util.HashMap">
......@@ -1092,7 +1096,8 @@
<!-- 风险点最新巡检信息查询,3d屏使用 -->
<resultMap id="planRoutePointResultMap" type="com.yeejoin.amos.supervision.business.entity.mybatis.PlanRoutePointBo">
<resultMap id="planRoutePointResultMap"
type="com.yeejoin.amos.supervision.business.entity.mybatis.PlanRoutePointBo">
<result property="routeName" column="route_name"/>
<result property="planName" column="plan_name"/>
<result property="deptName" column="department_name"/>
......@@ -1189,7 +1194,7 @@
) sa
<where>
c.plan_id = sa.id
<if test="userId != null">AND find_in_set(#{userId}, sa.user_id) >0 </if>
<if test="userId != null">AND find_in_set(#{userId}, sa.user_id) >0</if>
<if test="checkDate != null">AND DATE_FORMAT(c.check_time, '%Y%m%d') = DATE_FORMAT(#{checkDate}, '%Y%m%d')
</if>
</where>
......@@ -1235,7 +1240,7 @@
) sa
WHERE
d.plan_id = sa.planID
<if test="userId != null">AND find_in_set(#{userId}, sa.userID)>0 </if>
<if test="userId != null">AND find_in_set(#{userId}, sa.userID)>0</if>
<if test="checkDate != null">AND DATE_FORMAT(d.check_time, '%y%m%d') = #{checkDate}</if>
ORDER BY d.id DESC
) temp_row
......@@ -1685,7 +1690,7 @@
ADDDATE(#{startTime} , INTERVAL @d DAY)<![CDATA[ < ]]> DATE_FORMAT(#{endTime}, '%Y-%m-%d')
) d LEFT JOIN p_check c ON DATE_FORMAT(c.check_time, '%Y-%m-%d') = d.date
<if test=" orgCode != null and orgCode != '' ">and position( #{orgCode} in c.org_code )</if>
<if test=" userId != null and userId != '' ">and find_in_set(#{userId}, c.user_id)>0 </if>
<if test=" userId != null and userId != '' ">and find_in_set(#{userId}, c.user_id)>0</if>
<if test="type == 1">and c.is_ok != #{param}</if>
<if test="type == 2">and c.plan_id != #{param}</if>
<if test="type == 3">and c.is_ok = #{param}</if>
......@@ -1698,50 +1703,50 @@
</select>
<!-- 巡检记录查询 -->
<!-- <select id="getCheckInfoList1" resultMap="CheckInfoResultMap">-->
<!-- select * from (-->
<!-- SELECT-->
<!-- DATE_FORMAT(c.check_time, '%Y-%m-%d %T') as checkTime,-->
<!-- c.user_id as UserID,-->
<!-- c.point_id as PointID,-->
<!-- c.id as CheckID,-->
<!-- c.is_ok as IsOK,-->
<!-- c.error as ErrorMsg,-->
<!-- c.plan_task_id as ErrorID,-->
<!-- p.name as pointName,-->
<!-- c.dep_name as NAME,-->
<!-- c.dep_id as GroupID,-->
<!-- c.user_name as RealName,-->
<!-- (SELECT-->
<!-- GROUP_CONCAT(-->
<!-- IFNULL(case when u.mobile = '' or u.mobile is null then null else u.mobile END,u.telephone)-->
<!-- )-->
<!-- FROM-->
<!-- s_user u-->
<!-- WHERE-->
<!-- find_in_set(u.id,c.user_id)>0) as LoginName,-->
<!-- c.org_code as orgCode-->
<!-- FROM-->
<!-- p_check c,-->
<!-- p_point p-->
<!-- where-->
<!-- p.id =c.point_id ) as a-->
<!-- <trim prefix="WHERE" prefixOverrides="AND ">-->
<!-- <if test="pointID!=null">AND a.PointID = #{pointID}</if>-->
<!-- <if test="checkTime!=null">AND DATE_FORMAT(a.CheckTime, '%Y%m%d') = #{checkTime}</if>-->
<!-- <if test="userID!=null and userID!=-1 ">AND find_in_set(#{userID}, a.userID)>0 </if>-->
<!-- <if test="status!=null">AND a.IsOK = #{status}</if>-->
<!-- <if test="userName!=null">AND a.RealName LIKE concat(concat("%",#{userName}),"%")</if>-->
<!-- <if test="groupId!=null">AND find_in_set(#{groupId}, a.GroupID)>0</if>-->
<!-- <if test="pointName!=null">AND a.pointName LIKE concat(concat("%",#{pointName}),"%")</if>-->
<!-- <if test="orgCode!=null">AND a.orgCode LIKE #{orgCode}</if>-->
<!-- </trim>-->
<!-- <choose>-->
<!-- <when test="pageSize==-1"></when>-->
<!-- <when test="pageSize!=-1">limit #{offset},#{pageSize}</when>-->
<!-- </choose>-->
<!-- </select>!&ndash;&gt;-->
<!-- <select id="getCheckInfoList1" resultMap="CheckInfoResultMap">-->
<!-- select * from (-->
<!-- SELECT-->
<!-- DATE_FORMAT(c.check_time, '%Y-%m-%d %T') as checkTime,-->
<!-- c.user_id as UserID,-->
<!-- c.point_id as PointID,-->
<!-- c.id as CheckID,-->
<!-- c.is_ok as IsOK,-->
<!-- c.error as ErrorMsg,-->
<!-- c.plan_task_id as ErrorID,-->
<!-- p.name as pointName,-->
<!-- c.dep_name as NAME,-->
<!-- c.dep_id as GroupID,-->
<!-- c.user_name as RealName,-->
<!-- (SELECT-->
<!-- GROUP_CONCAT(-->
<!-- IFNULL(case when u.mobile = '' or u.mobile is null then null else u.mobile END,u.telephone)-->
<!-- )-->
<!-- FROM-->
<!-- s_user u-->
<!-- WHERE-->
<!-- find_in_set(u.id,c.user_id)>0) as LoginName,-->
<!-- c.org_code as orgCode-->
<!-- FROM-->
<!-- p_check c,-->
<!-- p_point p-->
<!-- where-->
<!-- p.id =c.point_id ) as a-->
<!-- <trim prefix="WHERE" prefixOverrides="AND ">-->
<!-- <if test="pointID!=null">AND a.PointID = #{pointID}</if>-->
<!-- <if test="checkTime!=null">AND DATE_FORMAT(a.CheckTime, '%Y%m%d') = #{checkTime}</if>-->
<!-- <if test="userID!=null and userID!=-1 ">AND find_in_set(#{userID}, a.userID)>0 </if>-->
<!-- <if test="status!=null">AND a.IsOK = #{status}</if>-->
<!-- <if test="userName!=null">AND a.RealName LIKE concat(concat("%",#{userName}),"%")</if>-->
<!-- <if test="groupId!=null">AND find_in_set(#{groupId}, a.GroupID)>0</if>-->
<!-- <if test="pointName!=null">AND a.pointName LIKE concat(concat("%",#{pointName}),"%")</if>-->
<!-- <if test="orgCode!=null">AND a.orgCode LIKE #{orgCode}</if>-->
<!-- </trim>-->
<!-- <choose>-->
<!-- <when test="pageSize==-1"></when>-->
<!-- <when test="pageSize!=-1">limit #{offset},#{pageSize}</when>-->
<!-- </choose>-->
<!-- </select>!&ndash;&gt;-->
<select id="getCheckInfoList1" resultType="Map">
select
......@@ -1763,7 +1768,7 @@
where c.point_id = p.id
<if test="pointID!=null">AND c.point_id = #{pointID}</if>
<if test="checkTime!=null">AND DATE_FORMAT(c.check_time, '%Y%m%d') = #{checkTime}</if>
<if test="userID!=null and userID!=-1 ">AND find_in_set(#{userID}, c.user_id)>0 </if>
<if test="userID!=null and userID!=-1 ">AND find_in_set(#{userID}, c.user_id)>0</if>
<if test="status!=null">AND c.is_ok = #{status}</if>
<if test="userName!=null">AND c.error LIKE concat(concat("%",#{userName}),"%")</if>
<if test="groupId!=null">AND find_in_set(#{groupId}, c.dep_id)>0</if>
......@@ -1788,7 +1793,7 @@
where c.point_id = p.id
<if test="pointID!=null">AND c.point_id = #{pointID}</if>
<if test="checkTime!=null">AND DATE_FORMAT(c.check_time, '%Y%m%d') = #{checkTime}</if>
<if test="userID!=null and userID!=-1 ">AND find_in_set(#{userID}, c.user_id)>0 </if>
<if test="userID!=null and userID!=-1 ">AND find_in_set(#{userID}, c.user_id)>0</if>
<if test="status!=null">AND c.is_ok = #{status}</if>
<if test="userName!=null">AND c.user_name LIKE concat(concat("%",#{userName}),"%")</if>
<if test="groupId!=null">AND find_in_set(#{groupId}, c.dep_id)>0</if>
......@@ -1886,8 +1891,8 @@
AND (c.org_code=#{orgCode} or c.org_code like CONCAT(#{orgCode},'-%'))
</if>
WHERE 1=1
<if test="startTime !=null and startTime!= '' "> AND d.date <![CDATA[ >= ]]> #{startTime}</if>
<if test="endTime !=null and endTime!='' "> AND d.date <![CDATA[ < ]]> #{endTime} </if>
<if test="startTime !=null and startTime!= '' ">AND d.date <![CDATA[ >= ]]> #{startTime}</if>
<if test="endTime !=null and endTime!='' ">AND d.date <![CDATA[ < ]]> #{endTime}</if>
GROUP BY
d.date
ORDER BY
......@@ -1955,12 +1960,12 @@
<if test="teamId != null and teamId != ''">
AND pp.original_id = #{teamId}
</if>
<!-- <if test="status != null and status != ''">-->
<!-- AND pc.point_id = #{status}-->
<!-- </if>-->
<!-- <if test="companyName != null and companyName != ''">-->
<!-- AND pc.company_name = #{company_name}-->
<!-- </if>-->
<!-- <if test="status != null and status != ''">-->
<!-- AND pc.point_id = #{status}-->
<!-- </if>-->
<!-- <if test="companyName != null and companyName != ''">-->
<!-- AND pc.company_name = #{company_name}-->
<!-- </if>-->
limit #{offset},#{pageSize}
</select>
......@@ -1999,13 +2004,14 @@
<if test="pointId != null and pointId != -1">
AND pp.id = #{pointId}
</if>
<!-- <if test="orgCode != null">-->
<!-- AND c.org_code = #{orgCode}-->
<!-- </if>-->
<!-- <if test="orgCode != null">-->
<!-- AND c.org_code = #{orgCode}-->
<!-- </if>-->
</where>
</select>
<select id="queryPage" resultType="com.yeejoin.amos.supervision.business.vo.CheckVo">
SELECT
c.id checkId,
i.id,
i.`name` inputItemName,
ci.safety_danger_num,
......@@ -2015,7 +2021,6 @@
ci.accompany_user_name,
pp.original_id,
pp.name companyName,
IF
( c.check_time IS NULL, 0, 1 ) AS ext
FROM
......@@ -2033,9 +2038,9 @@
<if test="pointId != null and pointId != -1">
AND pp.id = #{pointId}
</if>
<!-- <if test="orgCode != null">-->
<!-- AND c.org_code = #{orgCode}-->
<!-- </if>-->
<!-- <if test="orgCode != null">-->
<!-- AND c.org_code = #{orgCode}-->
<!-- </if>-->
ORDER BY c.check_time DESC
<choose>
<when test="pageSize==-1"></when>
......@@ -2043,4 +2048,17 @@
</choose>
</where>
</select>
<select id="getCheckListByTaskId" resultType="com.yeejoin.amos.supervision.dao.entity.Check">
select * from p_check where plan_task_id = #{planTaskId}
</select>
<select id="getPictureByCheckId" resultType="java.lang.String">
SELECT
photo_data
FROM
p_check_shot
WHERE
check_id = #{checkId}
</select>
</mapper>
\ No newline at end of file
......@@ -361,6 +361,7 @@
p.id pointId,
p.point_no pointNO,
p.offline,
p.original_id originalId,
ptd.status,
ptd.is_finish finish,
p.is_fixed isFixed,
......
......@@ -805,5 +805,55 @@
</sql>
</changeSet>
<changeSet author="kongfm" id="2022-01-05-01">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="tcb_equipment_use_info"/>
</not>
</preConditions>
<comment>add tcb_equipment_use_info table </comment>
<sql>
CREATE TABLE `tcb_equipment_use_info` (
`sequence_nbr` bigint(30) NOT NULL,
`use_unit_name` varchar(200) DEFAULT NULL COMMENT '使用单位名称',
`use_unit_id` bigint(30) DEFAULT NULL COMMENT '使用单位id',
`use_organization_code` varchar(30) DEFAULT NULL COMMENT '使用单位统一信用代码',
`property_unit_name` varchar(50) DEFAULT NULL COMMENT '产权单位名称',
`property_unit_id` bigint(30) DEFAULT NULL COMMENT '产权单位id',
`property_organization_code` varchar(30) DEFAULT NULL COMMENT '产权统一信用代码',
`use_address` varchar(300) DEFAULT NULL COMMENT '使用地址',
`longitude` varchar(50) DEFAULT NULL COMMENT '经度',
`latitude` varchar(255) DEFAULT NULL COMMENT '纬度',
`use_site` varchar(30) DEFAULT NULL COMMENT '使用场所',
`use_site_code` varchar(30) DEFAULT NULL COMMENT '使用场所编码',
`special_code` varchar(50) DEFAULT NULL COMMENT '特设编码',
`register_code` varchar(50) DEFAULT NULL COMMENT '设备注册代码',
`rescue_code` varchar(50) DEFAULT NULL COMMENT '96333识别码',
`register_licence_code` varchar(50) DEFAULT NULL COMMENT '使用登记证编码',
`register_org` varchar(30) DEFAULT NULL COMMENT '登记机关',
`register_org_id` bigint(30) DEFAULT NULL COMMENT '登记机关id',
`register_time` datetime DEFAULT NULL COMMENT '登记日期',
`issue_licence_time` datetime DEFAULT NULL COMMENT '发证日期',
`start_use_time` datetime DEFAULT NULL COMMENT '投入使用日期',
`rec_user_id` bigint(30) DEFAULT NULL COMMENT '更新人id',
`rec_user_name` varchar(100) DEFAULT NULL COMMENT '更新人名称',
`rec_date` datetime DEFAULT NULL COMMENT '更新时间',
`is_delete` bit(1) DEFAULT b'0' COMMENT '是否删除(0:未删除,1:已删除)',
PRIMARY KEY (`sequence_nbr`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='设备使用信息表';
</sql>
</changeSet>
<changeSet author="kongfm" id="2022-01-05-02">
<preConditions onFail="MARK_RAN">
<tableExists tableName="tcb_equipment_use_info"/>
</preConditions>
<comment>modify table tcb_equipment_use_info add equipment_id columns</comment>
<sql>
ALTER TABLE `tcb_equipment_use_info` add equipment_id bigint(50) COMMENT '设备ID';
</sql>
</changeSet>
</databaseChangeLog>
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