Commit d1aa3d7d authored by tangwei's avatar tangwei

合并解决冲突

parents 19b5cd85 fa8d7e5e
package com.yeejoin.amos.boot.module.common.api.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -22,6 +23,7 @@ public class DutyPersonShiftDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "值班日期")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date dutyDate;
@ApiModelProperty(value = "值班班次id")
......
......@@ -353,7 +353,7 @@
SELECT
COUNT(a.id) num
FROM important_companys a
where a.longitude is not null and a.latitude is not null
where a.longitude is not null and a.latitude is not null and a.keySiteCompany = 1
<if test='par.distance!=null'>
and Round(st_distance(point(a.longitude,a.latitude),point(#{par.longitude},#{par.latitude}))*111195,1) &lt;=
#{par.distance}
......@@ -945,7 +945,7 @@ LEFT JOIN (
*
FROM
cb_org_usr
WHERE is_delete = false AND biz_org_code LIKE CONCAT(#{bizOrgCode} '%') AND( biz_org_type = 'COMPANY' || biz_org_type = 'DEPARTMENT')
WHERE is_delete = false AND biz_org_code LIKE CONCAT(#{bizOrgCode}, '%') AND( biz_org_type = 'COMPANY' || biz_org_type = 'DEPARTMENT')
</select>
<select id="companyDeptListWithPersonCount"
......
......@@ -29,6 +29,12 @@ public class BaseTreeNode {
private String companyId;
private String ownerUnitId;
private Integer type;
public BaseTreeNode() {
}
......@@ -52,7 +58,19 @@ public class BaseTreeNode {
public void setParentId(String parentId) {
this.parentId = parentId;
}
public void setOwnerUnitId(String ownerUnitId) {
this.ownerUnitId = ownerUnitId;
}
public String getOwnerUnitId() {
return ownerUnitId;
}
public void setType(Integer type) {
this.type = type;
}
public Integer getType() {
return type;
}
public List<BaseTreeNode> getChildren() {
if (this.children == null) {
return Lists.newArrayList();
......
package com.yeejoin.equipmanage.common.entity.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -65,4 +66,11 @@ public class BuildingVideoListVO {
@ApiModelProperty("机构编码")
private String bizOrgCode;
private String type;
private String ip;
}
......@@ -313,6 +313,7 @@ public class TreeNodeUtil {
// 循环处理子节点数据
for (T t : newTreeNodes) {
//递归
listNodes.removeAll(collect);
assembleTree2(t, listNodes);
}
return newTreeNodes;
......@@ -328,7 +329,7 @@ public class TreeNodeUtil {
if (!CollectionUtils.isEmpty(node.getChildren())) {
for (Object t : node.getChildren()) {
//递归
//listNodes.remove(t);
listNodes.removeAll(node.getChildren());
assembleTreeSon((T) t, listNodes);
}
}
......@@ -339,17 +340,18 @@ public class TreeNodeUtil {
if (node != null && !CollectionUtils.isEmpty(listNodes)) {
// 循环节点数据,如果是子节点则添加起来
listNodes.stream().filter(t -> t.getParentId().equals(node.getId()) && t.getCompanyId().equals(node.getCompanyId() == null ?node.getParentId():node.getCompanyId() ) ).forEachOrdered(node::addChild);
listNodes.stream().filter(t ->t.getOwnerUnitId()!= null && t.getOwnerUnitId().equals(node.getOwnerUnitId()==null?node.getId():node.getOwnerUnitId())&&t.getParentId().equals(node.getId()) && t.getCompanyId().equals(node.getCompanyId() == null ?node.getParentId():node.getCompanyId() )).forEachOrdered(node::addChild);
// 循环处理子节点数据,递归
if (!CollectionUtils.isEmpty(node.getChildren())) {
for (Object t : node.getChildren()) {
//递归
//listNodes.remove(t);
listNodes.removeAll(node.getChildren());
assembleTreeSon((T) t, listNodes);
}
}
}
}
static <T extends BaseTreeNode> void assembleTree_1(T node, List<T> listNodes) {
if (node != null && !CollectionUtils.isEmpty(listNodes)) {
// 循环节点数据,如果是子节点则添加起来
......
......@@ -69,6 +69,9 @@ public interface PowerTransferMapper extends BaseMapper<PowerTransfer> {
Map<String, Integer> getCarNum(@Param("id") Long id);
List< Map<String, Integer>> getCarUserNum(@Param("dutyDate") String dutyDate,@Param("id") Long id);
Map<String, Integer> getCompanyNum(@Param("id") Long id);
List<PowerData> getPowerDataList(@Param("id") Long id);
......@@ -122,4 +125,10 @@ public interface PowerTransferMapper extends BaseMapper<PowerTransfer> {
IPage<PowerTransferResourceDto> getPowerTransferCarResource(Page<PowerTransferResourceDto> page,
@Param("alertCalledId") Long alertCalledId);
/**
* 查询未结案的航空器报警航班号
* @param alertTypeCode
* @return
*/
List<String> selectFlightNumber(@Param("alertTypeCode") String alertTypeCode);
}
......@@ -145,6 +145,58 @@
</select>
<select id="getCarUserNum" resultType="Map">
select * from (
SELECT
MAX(
CASE
WHEN cd.FIELD_CODE ='carId' THEN
cd.FIELD_VALUE
END
) AS 'carId',
MAX(
CASE
WHEN cd.FIELD_CODE = 'userName' THEN
cd.FIELD_VALUE
END
) AS 'userName'
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 ='dutyCar' and cds.instance_id is not null and
cd.is_delete=0
group by cd.instance_id
) result
where carId is not null and userName is not null and carId in (
SELECT
c.resources_id
FROM
jc_power_transfer a
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.alert_called_id = ${id}
)
</select>
<select id="getCompanyNum" resultType="Map">
select COUNT(*) companyNum from
(SELECT DISTINCT
......@@ -324,5 +376,13 @@
transfer.alert_called_id = #{alertCalledId}
AND is_distribution_agencies = 0
</select>
<select id="selectFlightNumber" resultType="java.lang.String">
SELECT DISTINCT(jaf.field_value) FROM `jc_alert_called` jac
left join jc_alert_form_value jaf on jac.sequence_nbr = jaf.alert_called_id
WHERE jac.alert_status = 0
and jac.alert_type_code = #{alertTypeCode}
and jaf.field_code = "flightNumber"
and jaf.field_value_code is not NULL
</select>
</mapper>
......@@ -36,6 +36,10 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
......
package com.yeejoin.amos.knowledgebase.face.util.excel;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeDynamicsOptionModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagInstanceModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagValueModel;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocContent;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDynamicsValue;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTagInstance;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeTagValue;
import com.yeejoin.amos.knowledgebase.face.util.DocSortUtil;
import lombok.Data;
import lombok.Getter;
import lombok.NonNull;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.DateUtil;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.text.DecimalFormat;
import java.util.*;
import java.util.regex.Pattern;
/**
* excel格式的战例解析--定制化
*
* @author tiantao
*/
public class ExcelParserOld {
private static final Pattern NUMBER_STRING_PATTEN = Pattern.compile("^[-\\+]?[\\d]*$");
private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
private static final String DATE_FORMAT4_HTML = "yyyy-MM-dd HH:mm";
public static final String VALUE_TAG_FIELD_SINGLEVALUE = "singleValue";//单值字段名
public static final String VALUE_TAG_FIELD_RANGE_MAX = "rangeMax";//范围值 上界
public static final String VALUE_TAG_FIELD_RANGE_MIN = "rangeMin";//范围值 下界
public static final String VALUE_TAG_FIELD_TEXT = "text";//文本值
public static final String VALUE_TAG_FIELD_DATE_H = "dateH";//时间,年月日时分秒
public static final String VALUE_TAG_FIELD_ENUM_NAME = "enumName";// 枚举类型字段名
public static final String DOC_STATUS_UNPUBLISHED = "UNPUBLISHED";//文档发布状态--未发布
public static final String DOC_STATUS_PUBLISHED = "PUBLISHED"; //文
public static final String MARKING_TYPE_DOC = "DOC"; // 标记类型--文档标签
public static final String MARKING_TYPE_CONTENT = "CONTENT";// 标记类型--内容标签
/**
* 审核状态--待提交
*/
public static final String DOC_AUDIT_STATUS_SAVED = "SAVED";
/**
* 审核状态--待审核
*/
public static final String DOC_AUDIT_STATUS_SUBMITTED = "SUBMITTED";
/**
* 审核状态--通过
*/
public static final String DOC_AUDIT_STATUS_PASSED = "PASSED";
/**
* 审核状态--驳回
*/
public static final String DOC_AUDIT_STATUS_REJECTED = "REJECTED";
private static final String TAG_INSTANCE_LABEL = "label";
private static String DELETE_SYNC_PLAN_TOPIC = "DELETE_SYNC_PLAN_DOC";
private static String getHolderRegex(Integer index) {
return "#\\{knowledge-" + index + "\\}";
}
private static String getHolderAllRegex() {
return "#\\{knowledge-\\d+\\}";
}
private static String removeAllHolder(String str) {
return str.replaceAll(getHolderAllRegex(), "");
}
private static String replaceHolder(String str, Integer index, String text) {
if (text == null) {
text = "";
}
return str.replaceAll(getHolderRegex(index), text);
}
/**
* 配置信息中涉及的标签列表以id为key
*/
private final Map<Long, KnowledgeTagModel> tagMap;
/**
* 导入配置
*/
private final Map<String, ExcelImportConfig> excelConfigMap;
/**
* 文档动态字段数据类型Map
*/
private final Map<String, KnowledgeDynamicsOptionModel> fieldTypeMap;
/**
* 标签的值类型
*/
private final Map<Long, String> tagValueTypeMap;
/**
* 涉及的枚举信息,以分组为外层key,中文值为内层key,英文值为value
*/
private final Map<String, Map<String, String>> enumCnEnMap;
/**
* 标签的单位
*/
private final Map<Long, String> tagUnitMap;
/**
* 解析的数据及返回结果数据
*/
private List<ImportResult> ImportResults = new ArrayList<>();
private TablesDataList tablesDataList = new TablesDataList();
private Sequence sequence;
public List<ImportResult> getImportResults() {
return ImportResults;
}
private Date now = new Date();
private final String orgCode;
public ExcelParserOld(@NonNull Map<Long, KnowledgeTagModel> tagMap, @NonNull Map<String, ExcelImportConfig> excelConfigMap,
Map<String, KnowledgeDynamicsOptionModel> fieldTypeMap, @NonNull Map<Long, String> tagValueTypeMap,
@NonNull Map<String, Map<String, String>> enumCnEnMap, @NonNull Map<Long, String> tagUnitMap,
@NonNull Sequence sequence, String orgCode) {
this.tagMap = Collections.unmodifiableMap(tagMap);
this.excelConfigMap = excelConfigMap;
this.fieldTypeMap = Collections.unmodifiableMap(fieldTypeMap);
this.tagValueTypeMap = Collections.unmodifiableMap(tagValueTypeMap);
this.enumCnEnMap = Collections.unmodifiableMap(enumCnEnMap);
this.tagUnitMap = Collections.unmodifiableMap(tagUnitMap);
this.sequence = sequence;
this.orgCode = orgCode;
}
/**
* 解析表格行
*
* @param row 表格行对象
*/
public void parseRow(Row row, Map<String, Long> typeValueMap) {
try {
String typeValue = convertCellValueToString(row.getCell(1));
if (ValidationUtil.isEmpty(typeValue) || ValidationUtil.isEmpty(typeValueMap.get(typeValue))) {
throw new BadRequest("缺少基本信息");
}
ExcelImportConfig excelConfig = this.excelConfigMap.get(String.valueOf(typeValueMap.get(typeValue)));
String docTitle = convertCellValueToString(row.getCell(excelConfig.getTitleColumn()));
// String docDirectory = convertCellValueToString(row.getCell(excelConfig.getDirectoryColumn()));
String docDirectory = excelConfig.getDirectoryColumn();
if (ValidationUtil.isEmpty(docTitle) || ValidationUtil.isEmpty(docDirectory)) {
throw new BadRequest("缺少基本信息");
}
Long directoryId = Long.parseLong(docDirectory);
// 创建文档
KnowledgeDocContent docContent = getNewDoc(excelConfig);
// 设置文档分类
docContent.setDocTitle(docTitle);
docContent.setDirectoryId(directoryId);
// 创建动态字段
List<KnowledgeDynamicsValue> dynamicsValues = getDynamicsValueList(excelConfig, row, docContent);
// 创建标签实例
List<KnowledgeTagInstance> tagInstances = new ArrayList<>();
// 以及标签值实例
List<KnowledgeTagValue> tagValues = new ArrayList<>();
Map<Long, List<Integer>> tagColumns = excelConfig.getTagColumns();
Map<Integer, String> formatMap = excelConfig.getFormatMap();
for (Long tagSeq : tagColumns.keySet()) {
if (!tagMap.containsKey(tagSeq) || !tagValueTypeMap.containsKey(tagSeq)) {
continue;
}
String valueType = tagValueTypeMap.get(tagSeq);
KnowledgeTagInstance tagInstance = getTagInstance(tagMap.get(tagSeq), docContent.getSequenceNbr());
switch (valueType) {
case "single": {
Integer valueColIndex = tagColumns.get(tagSeq).get(0);
String cellValue = convertCellValueToString(row.getCell(valueColIndex));
if (ValidationUtil.isEmpty(cellValue) || !NUMBER_STRING_PATTEN.matcher(cellValue).matches()) {
continue;
}
tagValues.add(getTagValue(tagInstance, VALUE_TAG_FIELD_SINGLEVALUE, cellValue));
replaceHtmlHolder(docContent, valueColIndex, cellValue, cellValue);
break;
}
case "date": {
Integer valueColIndex = tagColumns.get(tagSeq).get(0);
String cellValue = convertCellValueToString(row.getCell(valueColIndex));
if (ValidationUtil.isEmpty(cellValue) || !formatMap.containsKey(valueColIndex)) {
continue;
}
try {
Date date = DateUtil.formatStringToDate(cellValue, formatMap.get(valueColIndex));
cellValue = DateUtil.formatDate(date, DATE_FORMAT);
String htmlDateStr = DateUtil.formatDate(date, DATE_FORMAT4_HTML);
tagValues.add(getTagValue(tagInstance, VALUE_TAG_FIELD_DATE_H, cellValue));
replaceHtmlHolder(docContent, valueColIndex, htmlDateStr, cellValue);
} catch (Exception e) {
continue;
}
break;
}
case "text": {
Integer valueColIndex = tagColumns.get(tagSeq).get(0);
String cellValue = convertCellValueToString(row.getCell(valueColIndex));
if (ValidationUtil.isEmpty(cellValue)) {
continue;
}
tagValues.add(getTagValue(tagInstance, VALUE_TAG_FIELD_TEXT, cellValue));
replaceHtmlHolder(docContent, valueColIndex, cellValue, cellValue);
break;
}
case "range":
if (tagColumns.get(tagSeq).size() > 1) {
Integer valueColIndex1 = tagColumns.get(tagSeq).get(0);
String cellValue1 = convertCellValueToString(row.getCell(valueColIndex1));
Integer valueColIndex2 = tagColumns.get(tagSeq).get(1);
String cellValue2 = convertCellValueToString(row.getCell(valueColIndex2));
if (ValidationUtil.isEmpty(cellValue1) && ValidationUtil.isEmpty(cellValue2)
|| !NUMBER_STRING_PATTEN.matcher(cellValue1).matches() || !NUMBER_STRING_PATTEN.matcher(cellValue2).matches()) {
continue;
}
if (!ValidationUtil.isEmpty(cellValue1)) {
tagValues.add(getTagValue(tagInstance, VALUE_TAG_FIELD_RANGE_MIN, cellValue1));
replaceHtmlHolder(docContent, valueColIndex1, cellValue1, cellValue1);
}
if (!ValidationUtil.isEmpty(cellValue2)) {
tagValues.add(getTagValue(tagInstance, VALUE_TAG_FIELD_RANGE_MAX, cellValue2));
replaceHtmlHolder(docContent, valueColIndex2, cellValue2, cellValue2);
}
} else {
continue;
}
break;
default:
break;
}
tagInstances.add(tagInstance);
}
if (ValidationUtil.isEmpty(excelConfig.getTitleColumn())) {
throw new BadRequest("缺少标题所在的索引信息");
}
replaceHtmlHolder(docContent, excelConfig.getTitleColumn(), docTitle, docTitle);
docContent.setHtmlContent(removeAllHolder(docContent.getHtmlContent()));
docContent.setTextContent(removeAllHolder(docContent.getTextContent()));
String textContent = String.valueOf(docContent.getTextContent());
docContent.setSummary(textContent.substring(0, Math.min(300, textContent.length())));
List<KnowledgeTagInstanceModel> docTags = stuffTagValues(tagInstances, tagValues);
docContent.setSortStr(DocSortUtil.getSortStr(docTags));
this.tablesDataList.getDocContentList().add(docContent);
this.tablesDataList.getDynamicsValueList().addAll(dynamicsValues);
this.tablesDataList.getTagInstanceList().addAll(tagInstances);
this.tablesDataList.getTagValueList().addAll(tagValues);
this.ImportResults.add(new ImportResult(row.getRowNum()));
} catch (BaseException e) {
this.ImportResults.add(new ImportResult(row.getRowNum(), e.getMessage()));
} catch (Exception e) {
this.ImportResults.add(new ImportResult(row.getRowNum(), e.getStackTrace()[0].getMethodName()));
}
}
private List<KnowledgeTagInstanceModel> stuffTagValues(List<KnowledgeTagInstance> tagInstances, List<KnowledgeTagValue> tagValues) {
if (ValidationUtil.isEmpty(tagInstances)) {
return Collections.emptyList();
}
ArrayList<KnowledgeTagInstanceModel> resList = Bean.toModels(tagInstances, KnowledgeTagInstanceModel.class);
Map<Object, KnowledgeTagInstanceModel> instanceModelMap = Bean.listToMap(resList, "sequenceNbr", KnowledgeTagInstanceModel.class);
if (!ValidationUtil.isEmpty(tagValues)) {
tagValues.forEach(tagValue -> {
KnowledgeTagInstanceModel instanceModel = instanceModelMap.get(tagValue.getInstanceSeq());
List<KnowledgeTagValueModel> tagValueModels = instanceModel.getTagValues();
if (null == tagValueModels) {
tagValueModels = new ArrayList<>();
instanceModel.setTagValues(tagValueModels);
}
tagValueModels.add(Bean.toModel(tagValue, new KnowledgeTagValueModel()));
});
}
return resList;
}
private void replaceHtmlHolder(KnowledgeDocContent docContent, Integer colIndex, String contentValue, String textValue) {
docContent.setHtmlContent(replaceHolder(docContent.getHtmlContent(), colIndex, contentValue));
docContent.setTextContent(replaceHolder(docContent.getTextContent(), colIndex, textValue));
}
/**
* 获取解析到的数据列表,并刷新以备下一波解析
*
* @return 数据列表合集
*/
public TablesDataList getAndFlushDatas() {
TablesDataList res = this.tablesDataList;
this.tablesDataList = new TablesDataList();
return res;
}
/**
* 创建一个新的文档
*
* @return
*/
private KnowledgeDocContent getNewDoc(ExcelImportConfig excelConfig) {
KnowledgeDocContent docContent = new KnowledgeDocContent();
docContent.setSequenceNbr(sequence.nextId());
docContent.setRecDate(now);
docContent.setRecUserId(RequestContext.getExeUserId());
docContent.setUserId(RequestContext.getExeUserId());
docContent.setCreateTime(now);
docContent.setAgencyCode(RequestContext.getAgencyCode());
docContent.setOrgCode(this.orgCode);
docContent.setHtmlContent(excelConfig.getHtmlModule());
docContent.setTextContent(excelConfig.getSummaryModule());
docContent.setDocStatus(DOC_STATUS_UNPUBLISHED);
docContent.setAuditStatus(DOC_AUDIT_STATUS_SAVED);
docContent.setHaveAttachment(false);
return docContent;
}
private List<KnowledgeDynamicsValue> getDynamicsValueList(ExcelImportConfig excelConfig, Row row, KnowledgeDocContent docContent) {
List<KnowledgeDynamicsValue> dynamicsValues = new ArrayList<>();
Map<String, Integer> basicColumns = excelConfig.getBasicColumns();
Map<Integer, String> enumMap = excelConfig.getEnumMap();
for (String fieldName : basicColumns.keySet()) {
Integer colIndex = basicColumns.get(fieldName);
Cell cell = row.getCell(colIndex);
KnowledgeDynamicsOptionModel optionModel = fieldTypeMap.get(fieldName);
if (null == optionModel) {
throw new BadRequest("无法识别的字段名:" + fieldName);
}
String type = fieldTypeMap.get(fieldName).getDataType();
String cellValue = convertCellValueToString(cell);
if (type.toUpperCase().equals("ENUM")) {
if (!enumMap.containsKey(colIndex)) {
throw new BadRequest("缺少枚举字段的配置信息:" + fieldName);
}
String enumName = enumMap.get(colIndex);
cellValue = enumCnEnMap.get(enumName).get(cellValue);
}
dynamicsValues.add(getNewDynamicsField(optionModel, cellValue, docContent.getSequenceNbr()));
// 替换模板占位字符
replaceHtmlHolder(docContent, colIndex, cellValue, cellValue);
}
return dynamicsValues;
}
private KnowledgeDynamicsValue getNewDynamicsField(KnowledgeDynamicsOptionModel optionModel, String cellValue, Long docSequenceNbr) {
KnowledgeDynamicsValue dynamicsValue = new KnowledgeDynamicsValue();
dynamicsValue.setSequenceNbr(sequence.nextId());
dynamicsValue.setRecDate(now);
dynamicsValue.setRecUserId(RequestContext.getExeUserId());
dynamicsValue.setFieldName(optionModel.getFieldName());
dynamicsValue.setFieldValue(ValidationUtil.isEmpty(cellValue) ? "" : cellValue);
dynamicsValue.setDataType(optionModel.getDataType());
dynamicsValue.setAgencyCode(RequestContext.getAgencyCode());
dynamicsValue.setFieldLabel(optionModel.getFieldLabel());
dynamicsValue.setGroupSeq(optionModel.getGroupSeq());
dynamicsValue.setQueryStrategy(optionModel.getQueryStrategy());
dynamicsValue.setInstanceId(docSequenceNbr);
dynamicsValue.setOptionSeq(optionModel.getSequenceNbr());
return dynamicsValue;
}
KnowledgeTagInstance getTagInstance(KnowledgeTagModel tagModel, Long docSequenceNbr) {
KnowledgeTagInstance tagInstance = new KnowledgeTagInstance();
tagInstance.setSequenceNbr(sequence.nextId());
tagInstance.setRecDate(now);
tagInstance.setRecUserId(RequestContext.getExeUserId());
tagInstance.setAgencyCode(RequestContext.getAgencyCode());
tagInstance.setTagSeq(tagModel.getSequenceNbr());
tagInstance.setTargetSeq(docSequenceNbr);
tagInstance.setTagType(tagModel.getTagType());
tagInstance.setTagName(tagModel.getTagName());
tagInstance.setMarkingType(MARKING_TYPE_DOC);
return tagInstance;
}
/**
* 创建一个新的标签值实例
*
* @param tagInstance 实例对象
* @param value 值
* @return Model
*/
private KnowledgeTagValue getTagValue(KnowledgeTagInstance tagInstance, String fieldName, String value) {
KnowledgeTagValue tagValue = new KnowledgeTagValue();
tagValue.setSequenceNbr(sequence.nextId());
tagValue.setRecDate(now);
tagValue.setRecUserId(RequestContext.getExeUserId());
tagValue.setAgencyCode(RequestContext.getAgencyCode());
tagValue.setInstanceSeq(tagInstance.getSequenceNbr());
tagValue.setFieldName(fieldName);
tagValue.setTagValue(value);
tagValue.setUnit(tagUnitMap.get(tagInstance.getTagSeq()));
return tagValue;
}
/**
* 获取单元格的文本内容
*
* @param cell
* @return
*/
public static String convertCellValueToString(Cell cell) {
if (cell == null) {
return null;
}
String returnValue = null;
switch (cell.getCellType()) {
//数字
case NUMERIC:
Double doubleValue = cell.getNumericCellValue();
// 格式化科学计数法,取一位整数
DecimalFormat df = new DecimalFormat("0");
returnValue = df.format(doubleValue);
break;
//字符串
case STRING:
returnValue = cell.getStringCellValue().trim();
break;
//布尔
case BOOLEAN:
Boolean booleanValue = cell.getBooleanCellValue();
returnValue = booleanValue.toString();
break;
// 空值
case BLANK:
break;
// 公式
case FORMULA:
returnValue = cell.getCellFormula();
break;
// 故障
case ERROR:
break;
default:
}
return returnValue;
}
/**
* 数据涉及对象列表缓存
*/
@Getter
public class TablesDataList {
private List<KnowledgeDocContent> docContentList = new ArrayList<>();
private List<KnowledgeTagInstance> tagInstanceList = new ArrayList<>();
private List<KnowledgeTagValue> tagValueList = new ArrayList<>();
private List<KnowledgeDynamicsValue> dynamicsValueList = new ArrayList<>();
}
@Data
class ImportResult {
// 行号
private Integer rowIndex;
// 是否导入成功
private boolean success;
// 错误信息
private String errorMessege;
ImportResult(Integer rowIndex, String errorMessege) {
this.rowIndex = rowIndex;
this.success = false;
this.errorMessege = errorMessege;
}
ImportResult(Integer rowIndex) {
this.rowIndex = rowIndex;
this.success = true;
}
}
}
......@@ -39,6 +39,7 @@ class SqlStatement extends BaseSqlCondition {
private static final Map<String, String[]> valueTagFieldSqlMap;
private static final Pattern numberPattern = Pattern.compile("^[-\\+]?[\\d]+[.]?[\\d]*$");
private static final Pattern datePattern = Pattern.compile("^[\\d]{4}-[\\d]{2}-[\\d]{2} [\\d]{2}:[\\d]{2}:[\\d]{2}$");
private static final Pattern datePattern16 = Pattern.compile("^[\\d]{4}/[\\d]{2}/[\\d]{2} [\\d]{2}:[\\d]{2}$");
/**
* 字段类型
......@@ -101,36 +102,48 @@ class SqlStatement extends BaseSqlCondition {
return false;
}
boolean emptyVal = ValidationUtil.isEmpty(values);
if (fieldType != FieldType.textTag) {
if (fieldType != FieldType.textTag && values.size() > 0) {
String val1 = values.get(0);
String val2 = "";
switch (valueType) {
case text:
//格式化
if (!emptyVal && !ValidationUtil.isEmpty(values.get(0))) {
values.add(0, stringParamFormat(values.get(0)));
if (!emptyVal && !ValidationUtil.isEmpty(val1)) {
values.add(0, stringParamFormat(val1));
values.remove(1);
}
break;
case date:
// 校验并格式化
if (!emptyVal && !ValidationUtil.isEmpty((values.get(0)))) {
paramValidate(datePattern, values.get(0));
values.add(0, stringParamFormat(values.get(0)));
if (!emptyVal && !ValidationUtil.isEmpty(val1)) {
if (val1.contains("/") && val1.length() == 16) {
paramValidate(datePattern16, val1);
} else {
paramValidate(datePattern, val1);
}
values.add(0, stringParamFormat(val1));
values.remove(1);
}
if (!emptyVal && values.size() > 1 && !ValidationUtil.isEmpty((values.get(1)))) {
paramValidate(datePattern, values.get(1));
values.add(1, stringParamFormat(values.get(1)));
val2 = values.get(1);
if (!emptyVal && !ValidationUtil.isEmpty(val2)) {
if (val2.contains("/") && val1.length() == 16) {
paramValidate(datePattern16, val2);
} else {
paramValidate(datePattern, val2);
}
values.add(1, stringParamFormat(val2));
values.remove(2);
}
break;
case range:
case single:
// 校验
if (!emptyVal && !ValidationUtil.isEmpty((values.get(0)))) {
paramValidate(numberPattern, values.get(0));
if (!emptyVal && !ValidationUtil.isEmpty(val1)) {
paramValidate(numberPattern, val1);
}
if (!emptyVal && values.size() > 1 && !ValidationUtil.isEmpty((values.get(1)))) {
paramValidate(numberPattern, values.get(1));
val2 = values.get(1);
if (!emptyVal && !ValidationUtil.isEmpty(val2)) {
paramValidate(numberPattern, val2);
}
break;
default:
......
......@@ -40,6 +40,10 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/org.docx4j/docx4j-ImportXHTML -->
......
......@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.dto.PermissionModelDto;
import com.yeejoin.amos.boot.biz.common.enums.HomePageEnum;
......@@ -35,11 +36,14 @@ import com.yeejoin.amos.boot.module.jcs.api.mapper.PowerTransferCompanyResources
import com.yeejoin.amos.boot.module.jcs.api.mapper.PowerTransferMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.*;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
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.http.ResponseEntity;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.typroject.tyboot.core.foundation.context.RequestContext;
......@@ -1569,6 +1573,20 @@ public class CommandController extends BaseController {
carTaskDto.getCode(),
carTaskDto.getType(),
carTaskDto.getRemarks());
ReginParams reginParams = getSelectedOrgInfo();
String userId = reginParams.getUserModel().getUserId();
// 执行任务完成反馈,同步修改待办任务状态
if (carTaskDto.getType() == 2 && FireCarStatusEnum.已完成.getCode().equals(carTaskDto.getCode())){
MessageModel model = new MessageModel();
model.setRelationId(String.valueOf(carTaskDto.getAlertCalledId()));
model.setIsRead(true);
model.setMsgType("jcs119");
if (!ObjectUtils.isEmpty(userId)){
model.setUserId(userId);
}
Systemctl.messageClient.update(model);
}
return ResponseHelper.buildResponse(null);
}
......
......@@ -845,6 +845,21 @@ public class OrgUsrController extends BaseController {
@PathVariable String authKey) {
// 获取登陆人角色
ReginParams reginParams = getSelectedOrgInfo();
if(authKey.equals("fire_building_info")){
if (StringUtils.isNotEmpty(orgType) && orgType.equals("COMPANY")){
//查询当前登录人所属单位/部门
OrgUsr orgUsr = orgUsrMapper.selectById(reginParams.getPersonIdentity().getCompanyId());
//判断登陆人是否已经是顶级节点单位
if (orgUsr.getParentId() != null ){
orgUsr =iOrgUsrService.selectParentOrgUsr(orgUsr);
String bizOrgCode = orgUsr.getBizOrgCode() != null? orgUsr.getBizOrgCode() : reginParams.getPersonIdentity().getBizOrgCode();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
personIdentity.setBizOrgCode(bizOrgCode);
reginParams.setPersonIdentity(personIdentity);
}
}
}
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
List<OrgMenuDto> menus = iOrgUsrService.companyTreeByUserAndType(reginParams, orgType);
......@@ -919,4 +934,30 @@ public class OrgUsrController extends BaseController {
return ResponseHelper.buildResponse(iOrgUsrService.getByOrgCode(bizOrgCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "无权限单位树", notes = "无权限单位树")
@GetMapping(value = "/listCompanyTree")
public ResponseModel<List<OrgUsr>> listCompanyTree(@RequestParam(required = false) String orgType) throws Exception {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
String bizOrgCode = personIdentity.getBizOrgCode();
List<OrgUsr> listByBizOrgTypeCode = iOrgUsrService.getListByBizOrgTypeCode(orgType, bizOrgCode);
return ResponseHelper.buildResponse(listByBizOrgTypeCode);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据amosId返回单位code", notes = "根据amosId返回单位code")
@GetMapping(value = "/getBizByAmos")
public ResponseModel<String> getBizByAmos() throws Exception {
ReginParams selectedOrgInfo = getSelectedOrgInfo();
String userId = selectedOrgInfo.getUserModel().getUserId();
String parentId = iOrgUsrService.getParentId(userId);
OrgUsr orgUsr = iOrgUsrService.getById(parentId);
return ResponseHelper.buildResponse(orgUsr.getBizOrgCode());
}
}
\ No newline at end of file
......@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
......@@ -69,9 +70,12 @@ public class ESOrgUsrService {
public void saveAll(List<OrgUsr> orgUsrs) throws Exception {
if (!ValidationUtil.isEmpty(orgUsrs)) {
for (OrgUsr orgUsr : orgUsrs) {
this.saveAlertCalledToES(orgUsr);
}
// for (OrgUsr orgUsr : orgUsrs) {
// this.saveAlertCalledToES(orgUsr);
// }
this.saveAlertCalledToES(orgUsrs);
}
}
......@@ -90,6 +94,32 @@ public class ESOrgUsrService {
return esOrgUsrDto;
}
public List<ESOrgUsrDto> saveAlertCalledToES(List<OrgUsr> orgUsrs) throws Exception {
List<ESOrgUsrDto> listes=new ArrayList<>();
try {
for (OrgUsr orgUsr : orgUsrs) {
ESOrgUsrDto esOrgUsrDto = new ESOrgUsrDto();
String seqStr = String.valueOf(orgUsr.getSequenceNbr());
Long seq = Long.parseLong(seqStr);
esOrgUsrDto.setSequenceNbr(seq);
esOrgUsrDto.setBizOrgName(orgUsr.getBizOrgName());
listes.add(esOrgUsrDto);
}
esOrgUsrDtoRepository.saveAll(listes);
} catch (Exception e) {
e.printStackTrace();
}
return listes;
}
public ESOrgUsrDto saveAlertCalledToESNew(OrgUsr orgUsr) throws Exception {
ESOrgUsrDto esOrgUsrDto = new ESOrgUsrDto();
String seqStr = String.valueOf(orgUsr.getSequenceNbr());
......
......@@ -1742,6 +1742,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
String authKey = PermissionInterceptorContext.getDataAuthRule();
Map<String, Object> param = new HashMap<>();
String bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
PermissionInterceptorContext.clean();
if (StringUtils.isNotEmpty(type) && type.equals("COMPANY")){
//查询当前登录人所属单位/部门
......
......@@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletResponse;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -51,8 +52,8 @@ public class EquipmentAlarmController extends AbstractBaseController {
@Autowired
IEquipmentSpecificAlarmService iEquipmentSpecificAlarmService;
@Value("${equip.enabled}")
private Boolean equioEnabled;
/**
* 列表列名
*
......@@ -157,12 +158,18 @@ public class EquipmentAlarmController extends AbstractBaseController {
request12.setName("isRemoveShield");
request12.setValue(StringUtil.isNotEmpty(isRemoveShield) ? StringUtils.trimToNull(isRemoveShield) : null);
queryRequests.add(request12);
if (!ValidationUtil.isEmpty(reginParams.getPersonIdentity())){
if (equioEnabled) {
if (!ValidationUtil.isEmpty(reginParams.getPersonIdentity())) {
CommonRequest request13 = new CommonRequest();
request13.setName("bizOrgCode");
request13.setValue(StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null );
request13.setValue(StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null);
queryRequests.add(request13);
}
}else {
CommonRequest request13 = new CommonRequest();
request13.setName("bizOrgCode");
request13.setValue("");
}
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
Page<Map<String, Object>> list = iEquipmentSpecificAlarmService.listPage(param);
return CommonResponseUtil.success(list);
......@@ -279,12 +286,19 @@ public class EquipmentAlarmController extends AbstractBaseController {
request13.setName("isRemovedFire");
request13.setValue(StringUtil.isNotEmpty(isRemovedFire) ? StringUtils.trimToNull(isRemovedFire) : null);
queryRequests.add(request13);
if (equioEnabled){
if (!ValidationUtil.isEmpty(reginParams.getPersonIdentity())){
CommonRequest request14 = new CommonRequest();
request14.setName("bizOrgCode");
request14.setValue(StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null );
queryRequests.add(request14);
}
}else {
CommonRequest request14 = new CommonRequest();
request14.setName("bizOrgCode");
request14.setValue("");
}
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
org.springframework.data.domain.Page<AlarmListDataVO> list = iEquipmentSpecificAlarmService.listAlarmsPage(param);
return CommonResponseUtil.success(list);
......
......@@ -333,7 +333,13 @@ public class EquipmentSpecificController extends AbstractBaseController {
public ResponseModel videoOnEquipmentSpecific(@RequestBody VideoOnEquipmentSpecificVo videoOnEquipmentSpecificVo) {
return CommonResponseUtil.success(equipmentSpecificSerivce.videoOnEquipmentSpecific(videoOnEquipmentSpecificVo));
}
@RequestMapping(value = "/delVideoOnEquipmentSpecific/{equipmentSpecificId}/{videoId}", method = RequestMethod.POST)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "摄像头解绑设备", notes = "摄像头绑定设备")
public ResponseModel delVideoOnEquipmentSpecific( @PathVariable Long equipmentSpecificId, @PathVariable Long videoId) {
return CommonResponseUtil.success(equipmentSpecificSerivce.delVideoOnEquipmentSpecific(equipmentSpecificId,videoId));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{buildingId}/list")
......
......@@ -8,6 +8,8 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
......@@ -197,7 +199,17 @@ public class MaintenanceResourceDataController extends AbstractBaseController {
pageBean = new Page<>(0, Long.MAX_VALUE);
}
page = maintenanceResourceDataService.page(pageBean, queryWrapper);
page.getRecords().stream().forEach(e->e.setLocation(e.getBuildingName() == null ? "" : e.getBuildingName()+e.getLocation() == null ? "" : e.getLocation()) );
page.getRecords().stream().forEach(e->{
String add = "";
if (!ValidationUtil.isEmpty(e.getBuildingName())){
add = add+e.getBuildingName();
};
if (!ValidationUtil.isEmpty(e.getLocation())){
add = add+e.getLocation();
}
e.setLocation(add);
}
);
return page;
}
......
......@@ -43,7 +43,7 @@ public interface JcsFeign {
@RequestParam(value = "belongFightingSystemId") Long belongFightingSystemId,
@RequestParam(value = "sequenceNbr") Long sequenceNbr,
@RequestParam(value = "classifyId") String classifyId,
@RequestParam(value = "classifyId") List<String> ids
@RequestParam(value = "ids") List<String> ids
);
@RequestMapping(value = "/equip/fireSystem_waterResource/list", method = RequestMethod.GET, consumes = "application/json")
......@@ -172,4 +172,14 @@ public interface JcsFeign {
ResponseModel<Long> getMaintenanceId(
@RequestParam(value = "userId") String userId);
/**
* 查询有权限的公司部门列表
*
* @param authKey 权限key
* @param orgTypes(多个逗号分隔) 为空默认查询公司和部门,COMPANY: 公司树 DEPARTMENT部门树
* @return ResponseModel<OrgUsrDto>
*/
@GetMapping(value = "/org-usr/listCompanyTree")
FeignClientResult<List<OrgUsrDto>> getlistCompanyTree( @RequestParam(required = false) String orgType);
}
......@@ -172,6 +172,8 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
List<UserDto> getEquipSpecificLocationInfo(Long equipmentSpecificId, String[] fieldName);
Map<String,Double> getEquipLocationInfo(Long equipmentSpecificId);
Map<String, Object> getEquipSpeInfo(@Param("equipmentSpecificId") Long equipmentSpecificId);
/**
......
......@@ -16,6 +16,7 @@ import com.yeejoin.equipmanage.common.entity.vo.ComplementCodeVO;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentSpecificVo;
import com.yeejoin.equipmanage.common.entity.vo.SourceNameByEquipSpeIdVO;
import com.yeejoin.equipmanage.common.vo.*;
import org.springframework.web.bind.annotation.PathVariable;
import java.util.LinkedHashMap;
import java.util.List;
......@@ -169,6 +170,7 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
EquipmentDetailVo getAirEquipSpecificDetail(Long stockDetailId);
List<UserDto> getEquipSpecificLocationInfo(Long equipmentSpecificId, String[] fieldName);
Map<String,Double> getEquipLocationInfo(Long equipmentSpecificId);
/**
* 根据specificId删除相关数据
......@@ -214,5 +216,6 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
* @return
*/
Boolean videoOnEquipmentSpecific(VideoOnEquipmentSpecificVo videoOnEquipmentSpecificVo);
Boolean delVideoOnEquipmentSpecific(Long equipmentSpecificId, Long videoId);
}
......@@ -1300,7 +1300,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
}
Map<String, Long> countMap = iVideoService.getVideoCountMap();
// 1.获取公司list
List<OrgUsrDto> orgUsrLists = jcsRemoteService.getCompanyDeptListWithAuth(authKey, "COMPANY");
List<OrgUsrDto> orgUsrLists = jcsRemoteService.getlistCompanyTree("COMPANY");
if (orgUsrLists.isEmpty()) {
return new ArrayList<>();
}
......
......@@ -451,23 +451,15 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
log.error("查询机场人员为空,检查机场人员是否绑定单位!");
}
confirmAlamVo.setFireLocation(ent.getLocation());
List<UserDto> infoList = equipmentSpecificSerivce.getEquipSpecificLocationInfo(ent.getEquipmentSpecificId(), FIELD_NAME.split(","));
if (CollectionUtils.isNotEmpty(infoList)) {
infoList.stream().forEach(dto -> {
// String name = dto.getPersonName();
// confirmAlamVo.setFireLocation(name);
String code = dto.getFieldCode();
String value = dto.getFieldValue();
switch (code) {
case "longitude":
confirmAlamVo.setFloorLongitude(getVal(value));
break;
case "latitude":
confirmAlamVo.setFloorLatitude(getVal(value));
break;
default:
Map<String, Double> equipLocationInfo = equipmentSpecificSerivce.getEquipLocationInfo(ent.getEquipmentSpecificId());
if (!ObjectUtils.isEmpty(equipLocationInfo)) {
if (equipLocationInfo.containsKey("longitude")){
confirmAlamVo.setFloorLongitude(equipLocationInfo.get("longitude"));
}
if (equipLocationInfo.containsKey("latitude")){
confirmAlamVo.setFloorLatitude(equipLocationInfo.get("latitude"));
}
});
}
try {
ruleConfirmAlamService.confirmAlam(confirmAlamVo, appKey, product, token);
......
......@@ -1197,6 +1197,10 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
return equipmentSpecificMapper.getEquipSpecificLocationInfo(equipmentSpecificId, fieldName);
}
public Map<String,Double> getEquipLocationInfo(Long equipmentSpecificId) {
return equipmentSpecificMapper.getEquipLocationInfo(equipmentSpecificId);
}
@Override
@Async("equipAsyncExecutor")
public void equipSpecificDataSync(Long equipmentId) {
......@@ -1764,6 +1768,15 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
}
}
@Override
public Boolean delVideoOnEquipmentSpecific(Long equipmentSpecificId, Long videoId) {
QueryWrapper<VideoEquipmentSpecific> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("equipment_specific_id", equipmentSpecificId);
queryWrapper.eq("video_id", videoId);
videoEquipmentSpecificService.remove(queryWrapper);
return true;
}
private Boolean bingEquipmentRelationshipToVideo(List<Long> videoIdList, Long equipmentSpecificId) {
List<VideoEquipmentSpecific> videoSpecificList = new ArrayList<>();
videoIdList.parallelStream().forEach(x -> {
......
......@@ -41,4 +41,15 @@ public class JCSRemoteService {
return feignClientResult.getResult();
}
/**
*
* 查询无权限的公司部门列表
*
* @param orgTypes(多个逗号分隔) 为空默认查询公司和部门,COMPANY: 公司树 DEPARTMENT部门树
* @return List<OrgUsrDto>
*/
public List<OrgUsrDto> getlistCompanyTree( String orgType) {
FeignClientResult<List<OrgUsrDto>> feignClientResult = jcsFeignClient.getlistCompanyTree( orgType);
return feignClientResult.getResult();
}
}
......@@ -128,6 +128,7 @@ public class MaintenanceResourceServiceImpl extends ServiceImpl<MaintenanceResou
List<MaintenanceResourceData> maintenanceResourceData = maintenanceResourceDataMapper.selectMaintenanceResourceDataListByclassifyId();
//获取第三层分类节点
List<MaintenanceResourceDto> maintenanceResourceDtos = this.baseMapper.selectAllType();
List<MaintenanceResourceDto> list = new ArrayList<>();
maintenanceResourceData.stream().forEach(e-> {
MaintenanceResourceDto e1 = new MaintenanceResourceDto();
......@@ -136,7 +137,7 @@ public class MaintenanceResourceServiceImpl extends ServiceImpl<MaintenanceResou
e1.setCompanyId(e.getMaintenanceCompanyId().toString());
e1.setType(MaintenanceResourceEnum.CLASSIFY.getValue());
e1.setParentId(e.getFireFightSysId().toString());
e1.setCode(e.getClassifyCode());
e1.setOwnerUnitId(e.getOwnerUnitId().toString());
list.add(e1);
});
// List<MaintenanceResourceDto> list = this.selectAll();
......@@ -144,27 +145,6 @@ public class MaintenanceResourceServiceImpl extends ServiceImpl<MaintenanceResou
//获取维保单位和业主单位
List<MaintenanceResourceDto> companyTree = getCompanyList(appKey, product, token);
if (!CollectionUtils.isEmpty(companyTree)) {
/* List<MaintenanceResourceDto> result = new ArrayList<>();
result.addAll(list);
for (int i = 0; i < list.size(); i++) {
for (int j = 0; j < companyTree.size(); j++) {
if (list.get(i).getParentId().equals(companyTree.get(j).getParentId()) && list.get(i).getId().equals(companyTree.get(j).getId()) ){
result.remove(list.get(i));
}
}
}*/
/* result.addAll(companyTree);
result.forEach(e->{if (e.getContractId() == null){
e.setContractId(QRCodeUtil.generateQRCode());
}
});
List<MaintenanceResourceDto> dataList = new ArrayList<>();
Map<String, Optional<MaintenanceResourceDto>> collect = result.stream().collect(groupingBy(MaintenanceResourceDto::getContractId, minBy(Comparator.comparing(MaintenanceResourceDto::getParentId))));
collect.entrySet().forEach(entry -> {
entry.getValue().ifPresent(v -> {
dataList.add(v);
});
});*/
list.addAll(companyTree);
list.addAll(maintenanceResourceDtos);
//避免造成其他代码bug,替换新的组装树
......
......@@ -9,8 +9,13 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.publics.BaseEntity;
import liquibase.pro.packaged.W;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -34,12 +39,6 @@ import com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentDefectAlarm;
import com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentFaultAlarm;
import com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentFireAlarm;
import com.yeejoin.equipmanage.common.dto.TemperatureAlarmDto;
import com.yeejoin.equipmanage.common.entity.CarProperty;
import com.yeejoin.equipmanage.common.entity.EquipmentAlarmReportDay;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarm;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarmLog;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemEntity;
import com.yeejoin.equipmanage.common.entity.vo.CarPropertyVo;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentIndexVO;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentSpecificVo;
......@@ -491,6 +490,16 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
}
model.setIsSendWeb(true);
model.setCategory(1);
//告警弹窗需要根据人员单位判断是否展示 后端返回单位Code 前端判断
LambdaQueryWrapper<EquipmentSpecific> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BaseEntity::getId,equipmentSpecificAlarmLog.getEquipmentSpecificId());
EquipmentSpecific equipmentSpecific = equipmentSpecificMapper.selectOne(wrapper);
if (!ValidationUtil.isEmpty(equipmentSpecific) && !ValidationUtil.isEmpty(equipmentSpecific.getBizOrgCode())){
Map<String, String> equipMap = new HashMap<>();
equipMap.put("bizOrgCode",equipmentSpecific.getBizOrgCode());
model.setExtras(equipMap);
}
model.setRelationId(String.valueOf(equipmentSpecificAlarmLog.getId()));
Token token = remoteSecurityService.getServerToken();
systemctlFeign.create(token.getAppKey(), token.getProduct(), token.getToke(), model);
......
......@@ -508,6 +508,21 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
relationRedisUtil.delSysRedisKey(fireFightSysIdsBuffer.toString());
}
if (redisUtils.hasKey("equipAndCarIotCodes")) {
redisUtils.del("equipAndCarIotCodes");
}
// TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
// @Override
// public void afterCommit() {
// List<EquipmentSpecificVo> data = equipmentSpecificMapper.getEquipOrCarByIotCode(null);
// if (redisUtils.hasKey("equipAndCarIotCodes")) {
// redisUtils.del("equipAndCarIotCodes");
// }
// redisUtils.set("equipAndCarIotCodes", JSONObject.toJSONString(data));
// }
// });
} catch (Exception e) {
//处理异常 返回 成功失败条数
e.printStackTrace();
......@@ -517,7 +532,14 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
return date;
}
String[] split = errBufferName.toString().split(",");
String date="上传成功:"+(equipmentDetailDownloadVOS.size()-(split!=null?split.length:0))+"条---上传失败:"+(split!=null?split.length:0)+"条(失败编号:"+errBufferName+"详情:"+erryy+")";
String date="";
if(split!=null&&split.length>0&&!"".equals(split[0])){
date="上传成功:"+(equipmentDetailDownloadVOS.size()-(split!=null?split.length:0))+"条---上传失败:"+(split!=null?split.length:0)+"条(失败编号:"+errBufferName+"详情:"+erryy+")";
}else{
date="上传成功:"+(equipmentDetailDownloadVOS.size())+"条---上传失败:"+"0条(失败编号:"+errBufferName+"详情:"+erryy+")";
}
log.error(date);
// 刷新redis中iotCode值
List<EquipmentSpecificVo> data = equipmentSpecificMapper.getEquipOrCarByIotCode(null);
......
......@@ -44,8 +44,10 @@ public class RelationRedisUtil {
List<String> collect = list.stream().map(FireFightingSystemEntity::getSystemTypeCode).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)) {
for (String key : collect) {
if (key!=null&&redisUtil.hasKey(key)){
redisUtil.del(key);
}
}
return Boolean.TRUE;
}
}
......
......@@ -10,6 +10,7 @@ import java.util.stream.Stream;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
......@@ -553,4 +554,11 @@ public class AlertCalledController extends BaseController {
public ResponseModel<Object> toCompletePoliceSituationMatch(@RequestParam Long id)throws Exception {
return ResponseHelper.buildResponse(iAlertCalledService.toCompletePoliceSituationMatch(id));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/selectFlightNumber")
@ApiOperation(httpMethod = "GET", value = "查询未结案的航空器报警存在的航班号", notes = "查询未结案的航空器报警存在的航班号")
public ResponseModel<Object> toCompletePoliceSituationMatch() throws MqttException {
return ResponseHelper.buildResponse(iAlertCalledService.selectFlightNumber());
}
}
\ No newline at end of file
......@@ -119,9 +119,9 @@ public class FirestationJacketController extends BaseController {
QueryWrapper<FirestationJacket> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("firefighters_id", sequenceNbr);
queryWrapper.eq("is_delete", 0);
FirestationJacket firestationJacket = iFirestationJacketService.getOne(queryWrapper);
List<FirestationJacket> firestationJacket = iFirestationJacketService.list(queryWrapper);
if(firestationJacket!=null){
if(firestationJacket!=null&&firestationJacket.size()>0){
return CommonResponseUtil2.failure("微型消防站有配装装备,不能删除!");
}
......
package com.yeejoin.amos.boot.module.jcs.biz.controller;
import java.util.Arrays;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.UserCar;
import com.yeejoin.amos.boot.module.jcs.api.mapper.UserCarMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -12,7 +18,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -49,7 +57,9 @@ public class PowerTransferController extends BaseController {
@Autowired
FireTeamServiceImpl fireTeamService;
@Autowired
EquipFeignClient equipFeignClient;
EquipFeignClient docequipFeignClient;
@Autowired
UserCarMapper userCarMapper;
/**
* 新增力量调派
......@@ -174,6 +184,29 @@ public class PowerTransferController extends BaseController {
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "力量调派-任务派发", notes = "力量调派-任务派发")
public ResponseModel<Boolean> createPowerTransfer(@RequestBody PowerTransferDto powerTransferDto) {
List<PowerTransferCompanyDto> powerTransferCompanyDotList = powerTransferDto.getPowerTransferCompanyDotList();
StringBuilder content = new StringBuilder();
powerTransferCompanyDotList.forEach(e->{
if (e.getPowerTransferCompanyResourcesDtoList()!=null){
e.getPowerTransferCompanyResourcesDtoList().forEach(
c->
{
LambdaQueryWrapper<UserCar> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(UserCar::getCarId,c.getResourcesId());
wrapper.eq(BaseEntity::getIsDelete, false);
Integer count = userCarMapper.selectCount(wrapper);
if (count < 1){
content.append(c.getResourcesName()+":"+c.getResourcesNum()+" ");
}
}
);
}
});
if (!ValidationUtil.isEmpty(content)){
throw new BadRequest("车辆:"+content+"未绑定人员,无法调派");
}
AgencyUserModel userInfo = getUserInfo();
powerTransferDto.setTaskSenderId(Long.parseLong(userInfo.getUserId()));
powerTransferDto.setTaskSenderName(userInfo.getRealName());
......
......@@ -17,6 +17,7 @@ import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -147,6 +148,8 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
@Value("${mqtt.topic.command.knowledgebase.alert.match}")
private String topicMatch;
@Value("${mqtt.topic.command.alert.noticeAviation}")
private String noticeAviation;
@Autowired
private OrgUsrServiceImpl iOrgUsrService;
......@@ -454,6 +457,13 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
emqKeeper.getMqttClient().publish(topicData, json.getBytes(), RuleConfig.DEFAULT_QOS, false);
// 航空报警器报警通知
if (AlertStageEnums.HKJY.getCode().equals(alertCalled.getAlertTypeCode())) {
List<String> flightNumber = powerTransferMapper.selectFlightNumber(AlertStageEnums.HKJY.getCode());
String flightNumIds = JSONObject.toJSONString(flightNumber);
emqKeeper.getMqttClient().publish(noticeAviation, flightNumIds.getBytes(), RuleConfig.DEFAULT_QOS, false);
}
/**
* 同步保存ES
*/
......@@ -479,6 +489,11 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
}
public List<String> selectFlightNumber() throws MqttException {
return powerTransferMapper.selectFlightNumber(AlertStageEnums.HKJY.getCode());
}
......@@ -684,11 +699,31 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
Map<String, Integer> map = powerTransferMapper.getCarNum(id);
// Map<String,Integer> mapc=powerTransferMapper.getCompanyNum(id);
// Map<String,Integer> mapu= alertSubmittedMapper.getUseNum(id);
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(currentTime);
List< Map<String, Integer>> list=powerTransferMapper.getCarUserNum(dateString,id);
AlertCalled al=alertCalledMapper.selectById(id);
// 统计参与人员
List<KeyValueLabel> listdate = new ArrayList<>();
// if(al.getAlertStatus()){
// listdate.add(new KeyValueLabel("调动人力", "useNum", "0", "人"));
// }
if(list!=null&&list.size()>0){
listdate.add(new KeyValueLabel("调动人力", "useNum", list.size(), "人"));
}else{
listdate.add(new KeyValueLabel("调动人力", "useNum", "0", "人"));
}
// listdate.add(new KeyValueLabel("调动人力", "useNum", "0", "人"));
// 统计参与车辆
listdate.add(new KeyValueLabel("调动人力", "carNum", map.get("carNum"), "辆"));
listdate.add(new KeyValueLabel("调派车辆", "carNum", map.get("carNum"), "辆/次"));
// 统计参与队伍
listdate.add(new KeyValueLabel("调动单位", "companyNum", map.get("companyNum"), "个"));
return listdate;
......
......@@ -36,6 +36,7 @@ import com.yeejoin.amos.boot.module.common.api.service.ISourceFileService;
import com.yeejoin.amos.boot.module.jcs.api.entity.*;
import com.yeejoin.amos.boot.module.jcs.api.mapper.JcSituationDetailMapper;
import com.yeejoin.amos.boot.module.jcs.api.mapper.UserCarMapper;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xwpf.usermodel.XWPFTable;
......@@ -186,6 +187,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
@Value("${mqtt.topic.command.power.deployment}")
private String powertopic;
@Value("${mqtt.topic.command.alert.noticeAviation}")
private String noticeAviation;
@Autowired
EquipFeignClient equipFeignClient;
......@@ -348,6 +351,21 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
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);
// 航空报警器警情结案推送
if(AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode()) && AlertStageEnums.HKJY.getCode().equals(alertCalled.getAlertTypeCode())) {
List<String> list = powerTransferMapper.selectFlightNumber(AlertStageEnums.HKJY.getCode());
emqKeeper.getMqttClient().publish(noticeAviation, JSONObject.toJSONString(list).getBytes(), RuleConfig.DEFAULT_QOS, false);
}
// 警情结案时,修改该警情关联待办任务状态
if(AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
MessageModel model = new MessageModel();
model.setRelationId(String.valueOf(alertCalled.getSequenceNbr()));
model.setIsRead(true);
model.setMsgType("jcs119");
Systemctl.messageClient.update(model);
}
} catch (MqttException e) {
throw new RuntimeException();
}
......@@ -1224,11 +1242,16 @@ 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.forString("center"));
reverseList.get(i).getCellDatas().get(0).setCellStyle(tableStyle);
Style style = new Style();
style.setFontFamily("宋体");
style.setFontSize(12);
style.setBold(true);
reverseList.get(i).getCellDatas().get(0).getRenderData().setStyle(style);
reverseList.get(i).getCellDatas().get(0).getRenderData().setText("增\n援\n力\n量");
} else {
reverseList.get(i).getCellDatas().forEach(cellRenderData -> {
Style style = new Style();
......@@ -1247,13 +1270,15 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
for (int i = fSizs; i < listLength ; i++) {
TableStyle tableStyle = new TableStyle();
tableStyle.setAlign(Enum.forInt(2));
tableStyle.setAlign(Enum.forString("center"));
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.setFontSize(12);
style.setBold(true);
reverseList.get(i).getCellDatas().get(0).getRenderData().setStyle(style);
// reverseList.get(i).getCellDatas().forEach(cellRenderData -> {
// Style style = new Style();
......@@ -1696,7 +1721,7 @@ 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) {
if(!ValidationUtil.isEmpty(userList)) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,userList, null);
}
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
......@@ -86,11 +87,14 @@ public class ESAlertCalledService {
List<AlertCalled> alertCalleds = alertCalledService.list(wrapper);
if (!ValidationUtil.isEmpty(alertCalleds))
{
for (AlertCalled alertCalled : alertCalleds)
{
saveAlertCalledToES(alertCalled);
}
// for (AlertCalled alertCalled : alertCalleds)
// {
// saveAlertCalledToES(alertCalled);
// }
saveAlertCalledToES(alertCalleds);
}
return true;
}
......@@ -151,6 +155,44 @@ public class ESAlertCalledService {
return esAlertCalled;
}
public List<ESAlertCalled> saveAlertCalledToES(List<AlertCalled> alertCalleds) throws Exception
{
List<ESAlertCalled> list1=new ArrayList<>();
for (AlertCalled alertCalled : alertCalleds)
{
ESAlertCalled esAlertCalled = new ESAlertCalled();
esAlertCalled.setSequenceNbr(alertCalled.getSequenceNbr());
esAlertCalled.setAlertType(alertCalled.getAlertType());
esAlertCalled.setAlertTypeCode(alertCalled.getAlertTypeCode());
esAlertCalled.setCallTime(alertCalled.getCallTime());
esAlertCalled.setCallTimeLong(alertCalled.getCallTime()!=null?alertCalled.getCallTime().getTime():null);
esAlertCalled.setContactUser(alertCalled.getContactUser());
esAlertCalled.setContactPhone(alertCalled.getContactPhone());
esAlertCalled.setAddress(alertCalled.getAddress());
esAlertCalled.setAlertStage(alertCalled.getAlertStage());
esAlertCalled.setAlertStatus(alertCalled.getAlertStatus());
if (alertCalled.getAlertStatus())
{
esAlertCalled.setAlertStatusStr(AlertStatusEnum.CLOSED.getCode());
}else
{
esAlertCalled.setAlertStatusStr(AlertStatusEnum.UNCLOSED.getCode());
}
esAlertCalled.setResponseLevelCode(alertCalled.getResponseLevelCode());
esAlertCalled.setUnitInvolved(alertCalled.getUnitInvolved());
esAlertCalled.setCoordinateX(alertCalled.getCoordinateX());
esAlertCalled.setCoordinateY(alertCalled.getCoordinateY());
list1.add(esAlertCalled);
}
esAlertCalledRepository.saveAll(list1);
return list1;
}
/**
*
* <pre>
......
......@@ -6,6 +6,7 @@ import java.util.List;
import java.util.Set;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.enums.RuleTypeEnum;
import com.yeejoin.amos.component.rule.config.ClazzUtils;
import com.yeejoin.amos.feign.rule.Rule;
......@@ -90,7 +91,10 @@ public class RuleAlertCalledService {
FactBaseModel factBaseModel = new FactBaseModel();
factBaseModel.setPackageId("西咸机场119接处警规则/alertCalledRule");
HashMap<String, byte[]> map = new HashMap<>();
map.put("com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo", ClazzUtils.serializableObject(alertCalledRo));
// map.put("com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo", ClazzUtils.serializableObject(alertCalledRo));
map.put("com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo", JSONObject.toJSON(alertCalledRo).toString().getBytes());
factBaseModel.setFactMap(map);
Rule.ruleClient.fireRule(factBaseModel);
return true;
......
......@@ -17,6 +17,12 @@
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-knowledgebase-api</artifactId>
<version>${amos-biz-boot.version}</version>
<exclusions>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
......
package com.yeejoin.amos.knowledgebase.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -212,18 +214,31 @@ public class DocLibraryResource {
docLibraryService.export(id, type, response);
}
// @TycloudOperation(ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "导入excel文档")
// @RequestMapping(value = "/import", method = RequestMethod.POST)
// public ResponseModel importExcel(@RequestPart(value = "file") MultipartFile file,
// @RequestPart(value = "module") String moduleStr) {
// ExcelImportConfig excelConfig;
// try {
// excelConfig = JSON.parseObject(moduleStr, ExcelImportConfig.class);
// } catch (Exception e) {
// throw new BadRequest("模板配置信息格式有误");
// }
// return ResponseHelper.buildResponse(docLibraryService.importExcel(file, excelConfig));
// }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导入excel文档")
@RequestMapping(value = "/import", method = RequestMethod.POST)
public ResponseModel importExcel(@RequestPart(value = "file") MultipartFile file,
@RequestPart(value = "module") String moduleStr) {
ExcelImportConfig excelConfig;
public ResponseModel importExcel(@RequestPart(value = "file") MultipartFile file, @RequestPart(value = "module") String moduleStr) {
List<ExcelImportConfig> excelConfigList;
try {
excelConfig = JSON.parseObject(moduleStr, ExcelImportConfig.class);
excelConfigList = JSONArray.parseArray(moduleStr, ExcelImportConfig.class);
} catch (Exception e) {
throw new BadRequest("模板配置信息格式有误");
}
return ResponseHelper.buildResponse(docLibraryService.importExcel(file, excelConfig));
return ResponseHelper.buildResponse(docLibraryService.importExcel(file, excelConfigList));
}
}
......@@ -3,7 +3,12 @@ package com.yeejoin.amos.knowledgebase.controller;
import com.yeejoin.amos.knowledgebase.face.service.StatisticsRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
......@@ -15,76 +20,178 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
@RestController
//@TycloudResource(module = "knowledgebase", value = "docstatistics")
//@RequestMapping(value = "/v1/doccontent/docstatistics")
//@Api(tags = "knowledgebase-文档统计报表")
@TycloudResource(module = "knowledgebase", value = "docstatistics")
@RequestMapping(value = "/v1/doccontent/docstatistics")
@Api(tags = "knowledgebase-文档统计报表")
public class DocStatisticsResource {
@Autowired
private StatisticsRecordService statisticsRecordService;
/*@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "耗时* 刷新统计数据")
@RequestMapping(value = "/record/init", method = RequestMethod.PUT)
public ResponseModel init() {
return ResponseHelper.buildResponse(statisticsRecordService.init());
}
/*
* @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
*
* @ApiOperation(value = "耗时* 刷新统计数据")
*
* @RequestMapping(value = "/record/init", method = RequestMethod.PUT) public
* ResponseModel init() { return
* ResponseHelper.buildResponse(statisticsRecordService.init()); }
*
*
* @TycloudOperation(ApiLevel = UserType.AGENCY)
*
* @ApiOperation(value = "灾情统计")
*
* @RequestMapping(value = "/count/disaster", method = RequestMethod.GET) public
* ResponseModel selectDisasterCount() { return
* ResponseHelper.buildResponse(statisticsRecordService.selectDisasterCount());
* }
*
* @TycloudOperation(ApiLevel = UserType.AGENCY)
*
* @ApiOperation(value = "燃烧物质统计分类")
*
* @RequestMapping(value = "/count/burning", method = RequestMethod.GET) public
* ResponseModel selectBurningCategory() { return
* ResponseHelper.buildResponse(statisticsRecordService.selectCategoryByName(
* StatisticsRecordService.STATISTICS_BURNING_CATEGORY)); }
*
* @TycloudOperation(ApiLevel = UserType.AGENCY)
*
* @ApiOperation(value = "到场时间统计分类")
*
* @RequestMapping(value = "/count/present", method = RequestMethod.GET) public
* ResponseModel selectPresentCategory() { return
* ResponseHelper.buildResponse(statisticsRecordService.selectCategoryByName(
* StatisticsRecordService.STATISTICS_PRESENT_CATEGORY)); }
*
* @TycloudOperation(ApiLevel = UserType.AGENCY)
*
* @ApiOperation(value = "伤亡人数趋势统计")
*
* @RequestMapping(value = "/count/casualties", method = RequestMethod.GET)
* public ResponseModel selectCasualtiesSum(@RequestParam(value = "dateType")
* String dateType,
*
* @RequestParam(value = "dateRangeLeft", required = false) String
* dateRangeLeft,
*
* @RequestParam(value = "dateRangeRight", required = false) String
* dateRangeRight) { return
* ResponseHelper.buildResponse(statisticsRecordService.
* selectCountByTypeAndDateRange(dateType, dateRangeLeft, dateRangeRight,
* StatisticsRecordService.STATISTICS_CASUALTIES_SUM)); }
*
* @TycloudOperation(ApiLevel = UserType.AGENCY)
*
* @ApiOperation(value = "参战车辆数量统计")
*
* @RequestMapping(value = "/count/power", method = RequestMethod.GET) public
* ResponseModel selectPowerSum(@RequestParam(value = "dateType") String
* dateType,
*
* @RequestParam(value = "dateRangeLeft", required = false) String
* dateRangeLeft,
*
* @RequestParam(value = "dateRangeRight", required = false) String
* dateRangeRight) { return
* ResponseHelper.buildResponse(statisticsRecordService.
* selectCountByTypeAndDateRange(dateType, dateRangeLeft, dateRangeRight,
* StatisticsRecordService.STATISTICS_POWER_SUM)); }
*
* @TycloudOperation(ApiLevel = UserType.AGENCY)
*
* @ApiOperation(value = "过火面积统计")
*
* @RequestMapping(value = "/count/area", method = RequestMethod.GET) public
* ResponseModel selectAreaSum(@RequestParam(value = "dateType") String
* dateType,
*
* @RequestParam(value = "dateRangeLeft", required = false) String
* dateRangeLeft,
*
* @RequestParam(value = "dateRangeRight", required = false) String
* dateRangeRight) { return
* ResponseHelper.buildResponse(statisticsRecordService.
* selectCountByTypeAndDateRange(dateType, dateRangeLeft, dateRangeRight,
* StatisticsRecordService.STATISTICS_AREA_COUNT)); }
*
* @TycloudOperation(ApiLevel = UserType.AGENCY)
*
* @ApiOperation(value = "灭火药剂统计")
*
* @RequestMapping(value = "/count/extinguishing", method = RequestMethod.GET)
* public ResponseModel selectExtinguishingSum(@RequestParam(value = "dateType")
* String dateType,
*
* @RequestParam(value = "dateRangeLeft", required = false) String
* dateRangeLeft,
*
* @RequestParam(value = "dateRangeRight", required = false) String
* dateRangeRight) { return
* ResponseHelper.buildResponse(statisticsRecordService.
* selectCountByTypeAndDateRange(dateType, dateRangeLeft, dateRangeRight,
* StatisticsRecordService.STATISTICS_EXTINGUISHING_SUM)); }
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "灾情统计")
@RequestMapping(value = "/count/disaster", method = RequestMethod.GET)
public ResponseModel selectDisasterCount() {
return ResponseHelper.buildResponse(statisticsRecordService.selectDisasterCount());
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "标签总数统计")
@RequestMapping(value = "/tag/statistics", method = RequestMethod.GET)
public ResponseModel tagStatistics(@RequestParam(value = "tag") String tag,
@RequestParam(value = "startDate", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate,
@RequestParam(value = "endDate", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate,
@RequestParam(value = "mode", required = false) String mode) {
return ResponseHelper.buildResponse(statisticsRecordService.tagStatistics(tag, startDate, endDate, mode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "燃烧物质统计分类")
@RequestMapping(value = "/count/burning", method = RequestMethod.GET)
public ResponseModel selectBurningCategory() {
return ResponseHelper.buildResponse(statisticsRecordService.selectCategoryByName(StatisticsRecordService.STATISTICS_BURNING_CATEGORY));
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "文档总数统计")
@RequestMapping(value = "/doc/statistics", method = RequestMethod.GET)
public ResponseModel docStatistics(@RequestParam(value = "categoryName", required = false) String categoryName,
@RequestParam(value = "startDate", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate,
@RequestParam(value = "endDate", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate,
@RequestParam(value = "mode", required = false) String mode) {
return ResponseHelper
.buildResponse(statisticsRecordService.docStatistics(categoryName, startDate, endDate, mode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "到场时间统计分类")
@RequestMapping(value = "/count/present", method = RequestMethod.GET)
public ResponseModel selectPresentCategory() {
return ResponseHelper.buildResponse(statisticsRecordService.selectCategoryByName(StatisticsRecordService.STATISTICS_PRESENT_CATEGORY));
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "标签总数统计")
@RequestMapping(value = "/tag-chart/statistics", method = RequestMethod.GET)
public ResponseModel tagChartStatistics(@RequestParam(value = "tag") String tag,
@RequestParam(value = "startDate", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate,
@RequestParam(value = "endDate", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate,
@RequestParam(value = "split") List<Integer> split, @RequestParam(value = "unit") String unit) {
return ResponseHelper
.buildResponse(statisticsRecordService.tagChartStatistics(tag, startDate, endDate, split, unit));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "伤亡人数趋势统计")
@RequestMapping(value = "/count/casualties", method = RequestMethod.GET)
public ResponseModel selectCasualtiesSum(@RequestParam(value = "dateType") String dateType,
@RequestParam(value = "dateRangeLeft", required = false) String dateRangeLeft,
@RequestParam(value = "dateRangeRight", required = false) String dateRangeRight) {
return ResponseHelper.buildResponse(statisticsRecordService.selectCountByTypeAndDateRange(dateType, dateRangeLeft, dateRangeRight, StatisticsRecordService.STATISTICS_CASUALTIES_SUM));
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "标签总数统计")
@RequestMapping(value = "/tag-time-chart/statistics", method = RequestMethod.GET)
public ResponseModel tagTimeChartStatistics(
@RequestParam(value = "startDate", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate,
@RequestParam(value = "endDate", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate,
@RequestParam(value = "split") List<Integer> split, @RequestParam(value = "unit") String unit) {
return ResponseHelper
.buildResponse(statisticsRecordService.tagTimeChartStatistics(startDate, endDate, split, unit));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "参战车辆数量统计")
@RequestMapping(value = "/count/power", method = RequestMethod.GET)
public ResponseModel selectPowerSum(@RequestParam(value = "dateType") String dateType,
@RequestParam(value = "dateRangeLeft", required = false) String dateRangeLeft,
@RequestParam(value = "dateRangeRight", required = false) String dateRangeRight) {
return ResponseHelper.buildResponse(statisticsRecordService.selectCountByTypeAndDateRange(dateType, dateRangeLeft, dateRangeRight, StatisticsRecordService.STATISTICS_POWER_SUM));
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "文档总数统计")
@RequestMapping(value = "/doc-chart/statistics", method = RequestMethod.GET)
public ResponseModel docChartStatistics(
@RequestParam(value = "startDate", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate,
@RequestParam(value = "endDate", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate) {
return ResponseHelper.buildResponse(statisticsRecordService.docChartStatistics(startDate, endDate));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "过火面积统计")
@RequestMapping(value = "/count/area", method = RequestMethod.GET)
public ResponseModel selectAreaSum(@RequestParam(value = "dateType") String dateType,
@RequestParam(value = "dateRangeLeft", required = false) String dateRangeLeft,
@RequestParam(value = "dateRangeRight", required = false) String dateRangeRight) {
return ResponseHelper.buildResponse(statisticsRecordService.selectCountByTypeAndDateRange(dateType, dateRangeLeft, dateRangeRight, StatisticsRecordService.STATISTICS_AREA_COUNT));
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "文档燃烧物质总数统计")
@RequestMapping(value = "/doc-burn-chart/statistics", method = RequestMethod.GET)
public ResponseModel docBurnChartStatistics(
@RequestParam(value = "startDate", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date startDate,
@RequestParam(value = "endDate", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") Date endDate) {
return ResponseHelper.buildResponse(statisticsRecordService.docBurnChartStatistics(startDate, endDate));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "灭火药剂统计")
@RequestMapping(value = "/count/extinguishing", method = RequestMethod.GET)
public ResponseModel selectExtinguishingSum(@RequestParam(value = "dateType") String dateType,
@RequestParam(value = "dateRangeLeft", required = false) String dateRangeLeft,
@RequestParam(value = "dateRangeRight", required = false) String dateRangeRight) {
return ResponseHelper.buildResponse(statisticsRecordService.selectCountByTypeAndDateRange(dateType, dateRangeLeft, dateRangeRight, StatisticsRecordService.STATISTICS_EXTINGUISHING_SUM));
}*/
}
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.knowledgebase.face.orm.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowlegeStatisticsRecord;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -18,12 +19,14 @@ public interface StatisticsRecordMapper extends BaseMapper<KnowlegeStatisticsRec
/**
* 表清空
*
* @return
*/
void deleteAll();
/**
* 查询灾情总计
*
* @return
*/
Map<String, Object> selectDisasterCount();
......@@ -38,4 +41,19 @@ public interface StatisticsRecordMapper extends BaseMapper<KnowlegeStatisticsRec
*/
List<Map<String, Object>> selectCountByNameAndDateRange(Map<String, Object> queryMap);
List<Map<String, Object>> tagStatisticsMonth(String tag, Date startDate, Date endDate);
List<Map<String, Object>> tagStatisticsYear(String tag, Date startDate, Date endDate);
List<Map<String, Object>> docStatisticsMonth(String categoryName, Date startDate, Date endDate);
List<Map<String, Object>> docStatisticsYear(String categoryName, Date startDate, Date endDate);
List<Map<String, Object>> tagChartStatistics(String tag, Date startDate, Date endDate,String splitSQL);
List<Map<String, Object>> tagTimeChartStatistics(Date startDate, Date endDate,String splitSQL);
List<Map<String, Object>> docChartStatistics(Date startDate, Date endDate);
List<Map<String, Object>> docBurnChartStatistics(Date startDate, Date endDate);
}
\ No newline at end of file
package com.yeejoin.amos.knowledgebase.face.service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -257,4 +250,13 @@ public class DocCategoryService extends BaseService<KnowledgeDocCategoryModel, K
List<KnowledgeDocCategoryModel> categoryModelList = this.queryForList(null, true, categoryName, parentId);
return categoryModelList.isEmpty() ? null : categoryModelList.get(0);
}
public Map<String, Long> getGroupNameValue(List<Long> ids) {
List<KnowledgeDocCategoryModel> list = this.queryBatchSeq(ids);
Map<String, Long> result = new HashMap<>();
for(KnowledgeDocCategoryModel knowledgeDocCategoryModel: list) {
result.put(knowledgeDocCategoryModel.getCategoryName(), knowledgeDocCategoryModel.getSequenceNbr());
}
return result;
}
}
......@@ -21,6 +21,7 @@ import com.yeejoin.amos.knowledgebase.face.util.*;
import com.yeejoin.amos.knowledgebase.face.util.FileExporter.FileType;
import com.yeejoin.amos.knowledgebase.face.util.excel.ExcelImportConfig;
import com.yeejoin.amos.knowledgebase.face.util.excel.ExcelParser;
import com.yeejoin.amos.knowledgebase.face.util.excel.ExcelParserOld;
import com.yeejoin.amos.knowledgebase.face.util.pdf.PdfBuilder;
import com.yeejoin.amos.knowledgebase.face.util.sql.BaseSqlCondition;
import com.yeejoin.amos.knowledgebase.face.util.word.DocxBuilder;
......@@ -310,13 +311,13 @@ public class DocLibraryService {
List<ESDocEntity> esList = new ArrayList<>();
iPage.getRecords().forEach(doc -> {
ESDocEntity esDocEntity = esDocService.queryById(doc.getSequenceNbr());
if (ValidationUtil.isEmpty(esDocEntity)) {
throw new BadRequest("ES库数据丢失,请联系管理员协助解决");
}
if (!ValidationUtil.isEmpty(esDocEntity)) {
// throw new BadRequest("ES库数据丢失,请联系管理员协助解决");
Set<String> involvedTagIds = sqlCondition.getTagSeqs();
deleteRepeatedTags(esDocEntity.getDocTags(), involvedTagIds);
deleteRepeatedTags(esDocEntity.getContentTags(), involvedTagIds);
esList.add(esDocEntity);
}
});
fillDirectoryName(esList);
return page.setRecords(esList).setCurrent(iPage.getCurrent()).setSize(iPage.getSize()).setTotal(iPage.getTotal());
......@@ -582,26 +583,221 @@ public class DocLibraryService {
FileExporter.exportFile(fileType, docTitle, bytes, response);
}
@Transactional(rollbackFor = {Exception.class, BaseException.class})
public List importExcel(MultipartFile file, ExcelImportConfig excelConfig) {
// @Transactional(rollbackFor = { Exception.class, BaseException.class })
// public List importExcel(MultipartFile file, List<ExcelImportConfig> excelConfigList) {
// String inputerOrg = RemoteData.getOrgWithCurUserAndRole(KnowledgeRoleName.INPUTER.getRoleName());
// if (ValidationUtil.isEmpty(inputerOrg)) {
// throw new RequestForbidden("非录入者角色用户无权录入");
// }
// int finishedNum = 0;
//
// Set<Long> involvedTagIds = new HashSet<>();
// Set<String> enumNameList = new HashSet<>();
// Map<String, ExcelImportConfig> excelConfigMap = new HashMap();
// List<Long> directoryList = new ArrayList<>();
// for (ExcelImportConfig excelConfig : excelConfigList) {
// if (!excelConfig.check()) {
// throw new BadRequest("模板配置数据有误");
// }
// excelConfigMap.put(excelConfig.getDirectoryColumn(), excelConfig);
// Set<Long> involvedTags = excelConfig.getTagColumns().keySet();
// involvedTagIds.addAll(involvedTags);
// Set<String> enumNames = new HashSet<>(excelConfig.getEnumMap().values());
// enumNameList.addAll(enumNames);
// directoryList.add(Long.parseLong(excelConfig.getDirectoryColumn()));
// }
// Map<String, Long> directoryMap = docCategoryService.getGroupNameValue(directoryList);
// Workbook workbook = getBookWithFile(file);
// Sheet sheet = workbook.getSheetAt(0);
// if (sheet == null) {
// throw new BadRequest("文档sheet页为空");
// }
// int rowNumber = getRowNumber(sheet, excelConfigList.get(0));
// if (rowNumber <= 0) {
// throw new BadRequest("数据条目为零");
// }
//
// // 组装标签信息Map
// Map<Long, KnowledgeTagModel> tagMap = new HashMap();
// if (!ValidationUtil.isEmpty(involvedTagIds)) {
// List<KnowledgeTagModel> tagModelList = tagService.queryByIds(involvedTagIds);
// for (KnowledgeTagModel tagModel : tagModelList) {
// tagMap.put(tagModel.getSequenceNbr(), tagModel);
// }
// }
// // 组装文档动态字段数据类型Map
// Map<String, KnowledgeDynamicsOptionModel> fieldTypeMap = new HashMap<>();
// List<KnowledgeDynamicsOptionModel> optionModels = dynamicsOptionService
// .queryByFunctional(RequestContext.getAppKey(), DynamicsFunctional.DOC_BASEINFO.name());
// for (KnowledgeDynamicsOptionModel optionModel : optionModels) {
// fieldTypeMap.put(optionModel.getFieldName(), optionModel);
// }
//
// // 组装标签值类型Map
// Map<Long, String> tagValueTypeMap = new HashMap<>();
// if (!ValidationUtil.isEmpty(involvedTagIds)) {
// List<KnowledgeDynamicsValueModel> dynamicsValueList = dynamicsValueService.queryFieldValueByIds(new ArrayList(involvedTagIds), "valueType");
// for (KnowledgeDynamicsValueModel dynamicsValueModel : dynamicsValueList) {
// tagValueTypeMap.put(dynamicsValueModel.getInstanceId(), dynamicsValueModel.getFieldValue());
// }
// }
// // 组装字典中英文Map
// Map<String, Map<String, String>> enumCnEnMap = new HashMap<>();
// for (String enumName : enumNameList) {
// try {
// List<DictionarieValueModel> dictList = RemoteData.queryDict(enumName);
// Map<String, String> cnEnMap = new HashMap<>();
// for (DictionarieValueModel dictionarieValueModel : dictList) {
// cnEnMap.put(dictionarieValueModel.getDictDataValue(), dictionarieValueModel.getDictDataKey());
// }
// enumCnEnMap.put(enumName, cnEnMap);
// } catch (Exception e) {
// throw new RequestForbidden("获取字典数据出错,解析无法进行");
// }
// }
// // 组装标签单位Map
// Map<Long, String> tagUnitMap = new HashMap<>();
// if (!ValidationUtil.isEmpty(involvedTagIds)) {
// List<KnowledgeDynamicsValueModel> dynamicsValueList = dynamicsValueService.queryFieldValueByIds(new ArrayList(involvedTagIds), "unit");
// for (KnowledgeDynamicsValueModel dynamicsValueModel : dynamicsValueList) {
// tagUnitMap.put(dynamicsValueModel.getInstanceId(), dynamicsValueModel.getFieldValue());
// }
// }
//
// ExcelParser excelParser = new ExcelParser(tagMap, excelConfigMap, fieldTypeMap, tagValueTypeMap, enumCnEnMap,
// tagUnitMap, this.sequence, inputerOrg);
// // 逐行解析
// while (finishedNum < rowNumber) {
// for (int i = 0; i < BATCH_IMPORT_ONCE_NUM && finishedNum < rowNumber; i++, finishedNum++) {
// Row row = sheet.getRow(excelConfigList.get(0).getStartRowIndex() + finishedNum);
// excelParser.parseRow(row, directoryMap);
// if (i % 500 == 0) {
// batchInsertDocDataAll(excelParser.getAndFlushDatas());
// }
// }
// QuoteCountFlushTiming.needFlushTag();
// }
// return excelParser.getImportResults();
// }
// @Transactional(rollbackFor = {Exception.class, BaseException.class})
// public List importExcel(MultipartFile file, List<ExcelImportConfig> excelConfigList) {
// String inputerOrg = RemoteData.getOrgWithCurUserAndRole(KnowledgeRoleName.INPUTER.getRoleName());
// if (ValidationUtil.isEmpty(inputerOrg)) {
// throw new RequestForbidden("非录入者角色用户无权录入");
// }
// int finishedNum = 0;
// List<Object> list = new ArrayList<>();
// for (ExcelImportConfig excelConfig : excelConfigList) {
// if (!excelConfig.check()) {
// throw new BadRequest("模板配置数据有误");
// }
// Workbook workbook = getBookWithFile(file);
// Sheet sheet = workbook.getSheetAt(0);
// if (sheet == null) {
// throw new BadRequest("文档sheet页为空");
// }
// int rowNumber = getRowNumber(sheet, excelConfig);
// if (rowNumber <= 0) {
// throw new BadRequest("数据条目为零");
// }
// Set<Long> involvedTagIds = excelConfig.getTagColumns().keySet();
// // 组装标签信息Map
// Map<Long, KnowledgeTagModel> tagMap = new HashMap();
// if (!ValidationUtil.isEmpty(involvedTagIds)) {
// List<KnowledgeTagModel> tagModelList = tagService.queryByIds(involvedTagIds);
// for (KnowledgeTagModel tagModel : tagModelList) {
// tagMap.put(tagModel.getSequenceNbr(), tagModel);
// }
// }
// // 组装文档动态字段数据类型Map
// Map<String, KnowledgeDynamicsOptionModel> fieldTypeMap = new HashMap<>();
// List<KnowledgeDynamicsOptionModel> optionModels = dynamicsOptionService.queryByFunctional(RequestContext.getAppKey(), DynamicsFunctional.DOC_BASEINFO.name());
// for (KnowledgeDynamicsOptionModel optionModel : optionModels) {
// fieldTypeMap.put(optionModel.getFieldName(), optionModel);
// }
//
// // 组装标签值类型Map
// Map<Long, String> tagValueTypeMap = new HashMap<>();
// if (!ValidationUtil.isEmpty(involvedTagIds)) {
// List<KnowledgeDynamicsValueModel> dynamicsValueList = dynamicsValueService.queryFieldValueByIds(new ArrayList(involvedTagIds), "valueType");
// for (KnowledgeDynamicsValueModel dynamicsValueModel : dynamicsValueList) {
// tagValueTypeMap.put(dynamicsValueModel.getInstanceId(), dynamicsValueModel.getFieldValue());
// }
// }
// // 组装字典中英文Map
// Map<String, Map<String, String>> enumCnEnMap = new HashMap<>();
// Set<String> enumNameList = new HashSet<>(excelConfig.getEnumMap().values());
// for (String enumName : enumNameList) {
// try {
// List<DictionarieValueModel> dictList = RemoteData.queryDict(enumName);
// Map<String, String> cnEnMap = new HashMap<>();
// for (DictionarieValueModel dictionarieValueModel : dictList) {
// cnEnMap.put(dictionarieValueModel.getDictDataValue(), dictionarieValueModel.getDictDataKey());
// }
// enumCnEnMap.put(enumName, cnEnMap);
// } catch (Exception e) {
// throw new RequestForbidden("获取字典数据出错,解析无法进行");
// }
// }
// // 组装标签单位Map
// Map<Long, String> tagUnitMap = new HashMap<>();
// if (!ValidationUtil.isEmpty(involvedTagIds)) {
// List<KnowledgeDynamicsValueModel> dynamicsValueList = dynamicsValueService.queryFieldValueByIds(new ArrayList(involvedTagIds), "unit");
// for (KnowledgeDynamicsValueModel dynamicsValueModel : dynamicsValueList) {
// tagUnitMap.put(dynamicsValueModel.getInstanceId(), dynamicsValueModel.getFieldValue());
// }
// }
//
// ExcelParser excelParser = new ExcelParser(tagMap, excelConfig, fieldTypeMap, tagValueTypeMap, enumCnEnMap, tagUnitMap, this.sequence, inputerOrg);
// // 逐行解析
// while (finishedNum <= rowNumber) {
// for (int i = 0; i < BATCH_IMPORT_ONCE_NUM && finishedNum < rowNumber; i++, finishedNum++) {
// Row row = sheet.getRow(excelConfig.getStartRowIndex() + finishedNum);
// excelParser.parseRow(row);
// }
// batchInsertDocDataAll(excelParser.getAndFlushDatas());
// QuoteCountFlushTiming.needFlushTag();
// }
// list.add(excelParser.getImportResults());
// }
// return list;
// }
@Transactional(rollbackFor = { Exception.class, BaseException.class })
public List importExcel(MultipartFile file, List<ExcelImportConfig> excelConfigList) {
String inputerOrg = RemoteData.getOrgWithCurUserAndRole(KnowledgeRoleName.INPUTER.getRoleName());
if (ValidationUtil.isEmpty(inputerOrg)) {
throw new RequestForbidden("非录入者角色用户无权录入");
}
int finishedNum = 0;
Set<Long> involvedTagIds = new HashSet<>();
Set<String> enumNameList = new HashSet<>();
Map<String, ExcelImportConfig> excelConfigMap = new HashMap();
List<Long> directoryList = new ArrayList<>();
for (ExcelImportConfig excelConfig : excelConfigList) {
if (!excelConfig.check()) {
throw new BadRequest("模板配置数据有误");
}
excelConfigMap.put(excelConfig.getDirectoryColumn(), excelConfig);
Set<Long> involvedTags = excelConfig.getTagColumns().keySet();
involvedTagIds.addAll(involvedTags);
Set<String> enumNames = new HashSet<>(excelConfig.getEnumMap().values());
enumNameList.addAll(enumNames);
directoryList.add(Long.parseLong(excelConfig.getDirectoryColumn()));
}
Map<String, Long> directoryMap = docCategoryService.getGroupNameValue(directoryList);
Workbook workbook = getBookWithFile(file);
Sheet sheet = workbook.getSheetAt(0);
if (sheet == null) {
throw new BadRequest("文档sheet页为空");
}
int rowNumber = getRowNumber(sheet, excelConfig);
int rowNumber = getRowNumber(sheet, excelConfigList.get(0));
if (rowNumber <= 0) {
throw new BadRequest("数据条目为零");
}
Set<Long> involvedTagIds = excelConfig.getTagColumns().keySet();
// 组装标签信息Map
Map<Long, KnowledgeTagModel> tagMap = new HashMap();
if (!ValidationUtil.isEmpty(involvedTagIds)) {
......@@ -612,7 +808,8 @@ public class DocLibraryService {
}
// 组装文档动态字段数据类型Map
Map<String, KnowledgeDynamicsOptionModel> fieldTypeMap = new HashMap<>();
List<KnowledgeDynamicsOptionModel> optionModels = dynamicsOptionService.queryByFunctional(RequestContext.getAppKey(), DynamicsFunctional.DOC_BASEINFO.name());
List<KnowledgeDynamicsOptionModel> optionModels = dynamicsOptionService
.queryByFunctional(RequestContext.getAppKey(), DynamicsFunctional.DOC_BASEINFO.name());
for (KnowledgeDynamicsOptionModel optionModel : optionModels) {
fieldTypeMap.put(optionModel.getFieldName(), optionModel);
}
......@@ -620,14 +817,14 @@ public class DocLibraryService {
// 组装标签值类型Map
Map<Long, String> tagValueTypeMap = new HashMap<>();
if (!ValidationUtil.isEmpty(involvedTagIds)) {
List<KnowledgeDynamicsValueModel> dynamicsValueList = dynamicsValueService.queryFieldValueByIds(new ArrayList(involvedTagIds), "valueType");
List<KnowledgeDynamicsValueModel> dynamicsValueList = dynamicsValueService
.queryFieldValueByIds(new ArrayList(involvedTagIds), "valueType");
for (KnowledgeDynamicsValueModel dynamicsValueModel : dynamicsValueList) {
tagValueTypeMap.put(dynamicsValueModel.getInstanceId(), dynamicsValueModel.getFieldValue());
}
}
// 组装字典中英文Map
Map<String, Map<String, String>> enumCnEnMap = new HashMap<>();
Set<String> enumNameList = new HashSet<>(excelConfig.getEnumMap().values());
for (String enumName : enumNameList) {
try {
List<DictionarieValueModel> dictList = RemoteData.queryDict(enumName);
......@@ -643,18 +840,23 @@ public class DocLibraryService {
// 组装标签单位Map
Map<Long, String> tagUnitMap = new HashMap<>();
if (!ValidationUtil.isEmpty(involvedTagIds)) {
List<KnowledgeDynamicsValueModel> dynamicsValueList = dynamicsValueService.queryFieldValueByIds(new ArrayList(involvedTagIds), "unit");
List<KnowledgeDynamicsValueModel> dynamicsValueList = dynamicsValueService
.queryFieldValueByIds(new ArrayList(involvedTagIds), "unit");
for (KnowledgeDynamicsValueModel dynamicsValueModel : dynamicsValueList) {
tagUnitMap.put(dynamicsValueModel.getInstanceId(), dynamicsValueModel.getFieldValue());
}
}
ExcelParser excelParser = new ExcelParser(tagMap, excelConfig, fieldTypeMap, tagValueTypeMap, enumCnEnMap, tagUnitMap, this.sequence, inputerOrg);
ExcelParserOld excelParser = new ExcelParserOld(tagMap, excelConfigMap, fieldTypeMap, tagValueTypeMap, enumCnEnMap,
tagUnitMap, this.sequence, inputerOrg);
// 逐行解析
while (finishedNum < rowNumber) {
for (int i = 0; i < BATCH_IMPORT_ONCE_NUM && finishedNum < rowNumber; i++, finishedNum++) {
Row row = sheet.getRow(excelConfig.getStartRowIndex() + finishedNum);
excelParser.parseRow(row);
for (int i = 1; i <= BATCH_IMPORT_ONCE_NUM && finishedNum < rowNumber; i++, finishedNum++) {
Row row = sheet.getRow(excelConfigList.get(0).getStartRowIndex() + finishedNum);
excelParser.parseRow(row, directoryMap);
if (i % 500 == 0) {
batchInsertDocDataAll(excelParser.getAndFlushDatas());
}
}
batchInsertDocDataAll(excelParser.getAndFlushDatas());
QuoteCountFlushTiming.needFlushTag();
......@@ -662,7 +864,7 @@ public class DocLibraryService {
return excelParser.getImportResults();
}
void batchInsertDocDataAll(ExcelParser.TablesDataList datas) {
void batchInsertDocDataAll(ExcelParserOld.TablesDataList datas) {
docContentService.saveBatch(datas.getDocContentList());
dynamicsValueService.saveBatch(datas.getDynamicsValueList());
tagInstanceService.saveBatch(datas.getTagInstanceList());
......
......@@ -96,8 +96,9 @@ public class ESDocService {
}
catch (Exception e)
{
return new AggregatedPageImpl<>(list, PageRequest.of(current, size), 0);
e.printStackTrace();
}
return new AggregatedPageImpl<>(list, PageRequest.of(current, size), 0);
}
/**
......@@ -129,12 +130,12 @@ public class ESDocService {
for (String key : keys) {
boolMust.must(
QueryBuilders.boolQuery().minimumShouldMatch(1)
.should(QueryBuilders.matchQuery("docTitle", key))
.should(QueryBuilders.matchQuery("docInfo", key))
.should(QueryBuilders.matchQuery("author", key))
.should(QueryBuilders.matchQuery("textContent", key))
.should(QueryBuilders.matchQuery("docTags.tagInfo", key))
.should(QueryBuilders.matchQuery("contentTags.tagInfo", key))
.should(QueryBuilders.matchPhraseQuery("docTitle", key))
.should(QueryBuilders.matchPhraseQuery("docInfo", key))
.should(QueryBuilders.matchPhraseQuery("author", key))
.should(QueryBuilders.matchPhraseQuery("textContent", key))
.should(QueryBuilders.matchPhraseQuery("docTags.tagInfo", key))
.should(QueryBuilders.matchPhraseQuery("contentTags.tagInfo", key))
);
}
// 创建查询构造器
......
package com.yeejoin.amos.knowledgebase.face.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ctc.wstx.util.StringUtil;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeDocContentModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowledgeTagInstanceModel;
import com.yeejoin.amos.knowledgebase.face.model.KnowlegeStatisticsRecordModel;
import com.yeejoin.amos.knowledgebase.face.orm.dao.StatisticsRecordMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowledgeDocContent;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowlegeStatisticsRecord;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -23,9 +25,9 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* <p>
* 标签分组 服务类
......@@ -35,278 +37,359 @@ import java.util.*;
* @since 2020-08-05
*/
@Component
public class StatisticsRecordService extends BaseService<KnowlegeStatisticsRecordModel, KnowlegeStatisticsRecord, StatisticsRecordMapper> {
/*@Autowired
private DocContentService docContentService;
private final Logger logger = LogManager.getLogger(StatisticsRecordService.class);
public class StatisticsRecordService
extends BaseService<KnowlegeStatisticsRecordModel, KnowlegeStatisticsRecord, StatisticsRecordMapper> {
/*
* @Autowired private DocContentService docContentService;
*
* private final Logger logger =
* LogManager.getLogger(StatisticsRecordService.class);
*
*//**
* 灾情标记
*//*
public static final String TAG_NAME_TIME = "时间";
public static final String STATISTICS_DISASTER_COUNT = "DISASTER_RECORD";
*/
/*
* public static final String TAG_NAME_TIME = "时间"; public static final String
* STATISTICS_DISASTER_COUNT = "DISASTER_RECORD";
*
*//**
* 燃烧物质分类
*//*
public static final String TAG_NAME_BURNING = "燃烧物质";
public static final String STATISTICS_BURNING_CATEGORY = "BURNING_RECORD";
*/
/*
* public static final String TAG_NAME_BURNING = "燃烧物质"; public static final
* String STATISTICS_BURNING_CATEGORY = "BURNING_RECORD";
*
*//**
* 参战车辆统计
*//*
public static final String TAG_NAME_POWER = "参战车辆";
public static final String STATISTICS_POWER_SUM = "POWER_RECORD";
*/
/*
* public static final String TAG_NAME_POWER = "参战车辆"; public static final
* String STATISTICS_POWER_SUM = "POWER_RECORD";
*
*//**
* 伤亡人数统计
*//*
public static final String TAG_NAME_CASUALTIES = "人员伤亡情况 含亡人";
public static final String STATISTICS_CASUALTIES_SUM = "CASUALTIES_RECORD";
*/
/*
* public static final String TAG_NAME_CASUALTIES = "人员伤亡情况 含亡人"; public static
* final String STATISTICS_CASUALTIES_SUM = "CASUALTIES_RECORD";
*
*//**
* 灭火药剂统计
*//*
public static final String TAG_NAME_EXTINGUISHING = "使用的灭火药剂数量";
public static final String STATISTICS_EXTINGUISHING_SUM = "EXTINGUISHING_RECORD";
*/
/*
* public static final String TAG_NAME_EXTINGUISHING = "使用的灭火药剂数量"; public
* static final String STATISTICS_EXTINGUISHING_SUM = "EXTINGUISHING_RECORD";
*
*//**
* 过火面积统计
*//*
public static final String TAG_NAME_AREA = "过火面积";
public static final String STATISTICS_AREA_COUNT = "FIRE_AREA_RECORD";
*/
/*
* public static final String TAG_NAME_AREA = "过火面积"; public static final String
* STATISTICS_AREA_COUNT = "FIRE_AREA_RECORD";
*
*//**
* 到场时间分类
*//*
public static final String TAG_NAME_PICKUP = "接警时间";
public static final String TAG_NAME_PRESENT = "到场时间";
public static final String STATISTICS_PRESENT_CATEGORY = "PRESENT_TIME_RECORD";
public static final String DATE_GROUP_BY_DAY = "day";
public static final String DATE_GROUP_BY_MONTH = "month";
@Value("${diy-config.report.record-data}")
private boolean needRecord;
*//** 根据文档标签添加对应的记录 *//*
private void addRecordWithDocValueTag(List<KnowledgeTagInstanceModel> docTags, Long docSeq) {
//找出预定义的所有标签
Map<Object, KnowledgeTagInstanceModel> tagMap = Bean.listToMap(docTags, "tagName", KnowledgeTagInstanceModel.class);
KnowledgeTagInstanceModel tagTime = tagMap.get(TAG_NAME_TIME);
if (ValidationUtil.isEmpty(tagTime)) {
return;
}
Object timeObj = getValueFromTag(tagTime);
if (ValidationUtil.isEmpty(timeObj) || !(timeObj instanceof Date)) {
return;
}
Date disasterTime = (Date) timeObj;
//记录灾情
insertSumTypeRecord(docSeq, disasterTime, STATISTICS_DISASTER_COUNT, 1.0, 1);
//记录燃烧物质
KnowledgeTagInstanceModel tagBurning = tagMap.get(TAG_NAME_BURNING);
if (!ValidationUtil.isEmpty(tagBurning)) {
insertCategoryTypeRecord(docSeq, disasterTime, STATISTICS_BURNING_CATEGORY, getValueFromTag(tagBurning));
}
//记录参战车辆
KnowledgeTagInstanceModel tagPower = tagMap.get(TAG_NAME_POWER);
if (!ValidationUtil.isEmpty(tagPower)) {
insertSumTypeRecord(docSeq, disasterTime, STATISTICS_POWER_SUM, getValueFromTag(tagPower), 1);
}
//记录伤亡人数
KnowledgeTagInstanceModel tagCasualties = tagMap.get(TAG_NAME_CASUALTIES);
if (!ValidationUtil.isEmpty(tagCasualties)) {
insertSumTypeRecord(docSeq, disasterTime, STATISTICS_CASUALTIES_SUM, getValueFromTag(tagCasualties), 1);
}
//记录灭火药剂数量
KnowledgeTagInstanceModel tagExtinguishing = tagMap.get(TAG_NAME_EXTINGUISHING);
if (!ValidationUtil.isEmpty(tagExtinguishing)) {
insertSumTypeRecord(docSeq, disasterTime, STATISTICS_EXTINGUISHING_SUM, getValueFromTag(tagExtinguishing), 1);
}
//记录过火面积
KnowledgeTagInstanceModel tagArea = tagMap.get(TAG_NAME_AREA);
if (!ValidationUtil.isEmpty(tagArea)) {
insertSumTypeRecord(docSeq, disasterTime, STATISTICS_AREA_COUNT, getValueFromTag(tagArea), 1);
}
//记录到场时间
KnowledgeTagInstanceModel tagPickup = tagMap.get(TAG_NAME_PICKUP);
KnowledgeTagInstanceModel tagPresent = tagMap.get(TAG_NAME_PRESENT);
if (!ValidationUtil.isEmpty(tagPickup) && !ValidationUtil.isEmpty(tagPresent)) {
Object pickTimeObj = getValueFromTag(tagPickup);
Object presentTimeObj = getValueFromTag(tagPresent);
if (!ValidationUtil.isEmpty(pickTimeObj) && pickTimeObj instanceof Date
&& !ValidationUtil.isEmpty(presentTimeObj) && presentTimeObj instanceof Date) {
long presentTimeByMinute = (long) Math.ceil((((Date) presentTimeObj).getTime() - ((Date) pickTimeObj).getTime()) / 1000.0 / 60.0);
insertCategoryTypeRecord(docSeq, disasterTime, STATISTICS_PRESENT_CATEGORY, presentTimeByMinute);
}
}
}
*//** 获取标签值 *//*
private Object getValueFromTag(KnowledgeTagInstanceModel tag) {
if (ValidationUtil.isEmpty(tag)
|| !ValidationUtil.equals(tag.getTagType(), TagService.TAG_TYPE_VALUE)
|| ValidationUtil.isEmpty(tag.getTagValues())) {
return null;
}
String fieldName = tag.getTagValues().get(0).getFieldName();
String tagValue = tag.getTagValues().get(0).getTagValue();
if (ValidationUtil.isEmpty(fieldName)
|| ValidationUtil.isEmpty(tagValue)) {
return null;
}
switch (fieldName) {
case TagValueService.VALUE_TAG_FIELD_DATE_H:
try {
return DateUtil.formatStringToDate(tagValue, null);
} catch (Exception e) {
logger.error("报表统计:时间格式标签值解析出错");
return null;
}
case TagValueService.VALUE_TAG_FIELD_SINGLEVALUE:
try {
return Double.parseDouble(tagValue);
} catch (Exception e) {
logger.error("报表统计:数字格式标签值解析出错");
return null;
}
case TagValueService.VALUE_TAG_FIELD_TEXT:
return tagValue;
default:
return null;
}
}
*//** 插入分类统计记录 *//*
private void insertCategoryTypeRecord(Long docSeq, Date disasterTime, String recordName, Object category) {
KnowlegeStatisticsRecordModel recordModel = new KnowlegeStatisticsRecordModel();
recordModel.setDocSeq(docSeq);
recordModel.setDisasterTime(disasterTime);
recordModel.setRecordName(recordName);
recordModel.setCategoryValue(String.valueOf(category));
recordModel.setValueWeight(1);
recordModel.setCountValue(1L);
this.createWithModel(recordModel);
}
*//** 插入数量统计记录 *//*
private void insertSumTypeRecord(Long docSeq, Date disasterTime, String recordName, Object numObj, Integer weight) {
if (!ValidationUtil.isEmpty(numObj) && numObj instanceof Double) {
Long num = ((Double) numObj).longValue();
KnowlegeStatisticsRecordModel recordModel = new KnowlegeStatisticsRecordModel();
recordModel.setDocSeq(docSeq);
recordModel.setDisasterTime(disasterTime);
recordModel.setRecordName(recordName);
recordModel.setCountValue(num);
recordModel.setValueWeight(weight);
this.createWithModel(recordModel);
}
}
*/
/*
* public static final String TAG_NAME_PICKUP = "接警时间"; public static final
* String TAG_NAME_PRESENT = "到场时间"; public static final String
* STATISTICS_PRESENT_CATEGORY = "PRESENT_TIME_RECORD";
*
*
* public static final String DATE_GROUP_BY_DAY = "day"; public static final
* String DATE_GROUP_BY_MONTH = "month";
*
* @Value("${diy-config.report.record-data}") private boolean needRecord;
*
*//** 根据文档标签添加对应的记录 */
/*
* private void addRecordWithDocValueTag(List<KnowledgeTagInstanceModel>
* docTags, Long docSeq) { //找出预定义的所有标签 Map<Object, KnowledgeTagInstanceModel>
* tagMap = Bean.listToMap(docTags, "tagName", KnowledgeTagInstanceModel.class);
* KnowledgeTagInstanceModel tagTime = tagMap.get(TAG_NAME_TIME); if
* (ValidationUtil.isEmpty(tagTime)) { return; } Object timeObj =
* getValueFromTag(tagTime); if (ValidationUtil.isEmpty(timeObj) || !(timeObj
* instanceof Date)) { return; } Date disasterTime = (Date) timeObj; //记录灾情
* insertSumTypeRecord(docSeq, disasterTime, STATISTICS_DISASTER_COUNT, 1.0, 1);
* //记录燃烧物质 KnowledgeTagInstanceModel tagBurning = tagMap.get(TAG_NAME_BURNING);
* if (!ValidationUtil.isEmpty(tagBurning)) { insertCategoryTypeRecord(docSeq,
* disasterTime, STATISTICS_BURNING_CATEGORY, getValueFromTag(tagBurning)); }
* //记录参战车辆 KnowledgeTagInstanceModel tagPower = tagMap.get(TAG_NAME_POWER); if
* (!ValidationUtil.isEmpty(tagPower)) { insertSumTypeRecord(docSeq,
* disasterTime, STATISTICS_POWER_SUM, getValueFromTag(tagPower), 1); } //记录伤亡人数
* KnowledgeTagInstanceModel tagCasualties = tagMap.get(TAG_NAME_CASUALTIES); if
* (!ValidationUtil.isEmpty(tagCasualties)) { insertSumTypeRecord(docSeq,
* disasterTime, STATISTICS_CASUALTIES_SUM, getValueFromTag(tagCasualties), 1);
* } //记录灭火药剂数量 KnowledgeTagInstanceModel tagExtinguishing =
* tagMap.get(TAG_NAME_EXTINGUISHING); if
* (!ValidationUtil.isEmpty(tagExtinguishing)) { insertSumTypeRecord(docSeq,
* disasterTime, STATISTICS_EXTINGUISHING_SUM,
* getValueFromTag(tagExtinguishing), 1); } //记录过火面积 KnowledgeTagInstanceModel
* tagArea = tagMap.get(TAG_NAME_AREA); if (!ValidationUtil.isEmpty(tagArea)) {
* insertSumTypeRecord(docSeq, disasterTime, STATISTICS_AREA_COUNT,
* getValueFromTag(tagArea), 1); } //记录到场时间 KnowledgeTagInstanceModel tagPickup
* = tagMap.get(TAG_NAME_PICKUP); KnowledgeTagInstanceModel tagPresent =
* tagMap.get(TAG_NAME_PRESENT); if (!ValidationUtil.isEmpty(tagPickup) &&
* !ValidationUtil.isEmpty(tagPresent)) { Object pickTimeObj =
* getValueFromTag(tagPickup); Object presentTimeObj =
* getValueFromTag(tagPresent); if (!ValidationUtil.isEmpty(pickTimeObj) &&
* pickTimeObj instanceof Date && !ValidationUtil.isEmpty(presentTimeObj) &&
* presentTimeObj instanceof Date) { long presentTimeByMinute = (long)
* Math.ceil((((Date) presentTimeObj).getTime() - ((Date)
* pickTimeObj).getTime()) / 1000.0 / 60.0); insertCategoryTypeRecord(docSeq,
* disasterTime, STATISTICS_PRESENT_CATEGORY, presentTimeByMinute); } } }
*
*//** 获取标签值 */
/*
* private Object getValueFromTag(KnowledgeTagInstanceModel tag) { if
* (ValidationUtil.isEmpty(tag) || !ValidationUtil.equals(tag.getTagType(),
* TagService.TAG_TYPE_VALUE) || ValidationUtil.isEmpty(tag.getTagValues())) {
* return null; } String fieldName = tag.getTagValues().get(0).getFieldName();
* String tagValue = tag.getTagValues().get(0).getTagValue(); if
* (ValidationUtil.isEmpty(fieldName) || ValidationUtil.isEmpty(tagValue)) {
* return null; } switch (fieldName) { case
* TagValueService.VALUE_TAG_FIELD_DATE_H: try { return
* DateUtil.formatStringToDate(tagValue, null); } catch (Exception e) {
* logger.error("报表统计:时间格式标签值解析出错"); return null; } case
* TagValueService.VALUE_TAG_FIELD_SINGLEVALUE: try { return
* Double.parseDouble(tagValue); } catch (Exception e) {
* logger.error("报表统计:数字格式标签值解析出错"); return null; } case
* TagValueService.VALUE_TAG_FIELD_TEXT: return tagValue; default: return null;
* } }
*
*//** 插入分类统计记录 */
/*
* private void insertCategoryTypeRecord(Long docSeq, Date disasterTime, String
* recordName, Object category) { KnowlegeStatisticsRecordModel recordModel =
* new KnowlegeStatisticsRecordModel(); recordModel.setDocSeq(docSeq);
* recordModel.setDisasterTime(disasterTime);
* recordModel.setRecordName(recordName);
* recordModel.setCategoryValue(String.valueOf(category));
* recordModel.setValueWeight(1); recordModel.setCountValue(1L);
* this.createWithModel(recordModel); }
*
*
*//** 插入数量统计记录 */
/*
* private void insertSumTypeRecord(Long docSeq, Date disasterTime, String
* recordName, Object numObj, Integer weight) { if
* (!ValidationUtil.isEmpty(numObj) && numObj instanceof Double) { Long num =
* ((Double) numObj).longValue(); KnowlegeStatisticsRecordModel recordModel =
* new KnowlegeStatisticsRecordModel(); recordModel.setDocSeq(docSeq);
* recordModel.setDisasterTime(disasterTime);
* recordModel.setRecordName(recordName); recordModel.setCountValue(num);
* recordModel.setValueWeight(weight); this.createWithModel(recordModel); } }
*
*//**
* 根据文档id删除相关记录
*//*
public void deleteRecordsByDocIds(List<KnowledgeDocContentModel> docs) {
if (!ValidationUtil.isEmpty(docs)) {
Set ids = Bean.listToMap(docs, "sequenceNbr", KnowledgeDocContentModel.class).keySet();
QueryWrapper<KnowlegeStatisticsRecord> wrapper = new QueryWrapper<>();
wrapper.in("doc_seq", ids);
this.getBaseMapper().delete(wrapper);
}
}
*/
/*
* public void deleteRecordsByDocIds(List<KnowledgeDocContentModel> docs) { if
* (!ValidationUtil.isEmpty(docs)) { Set ids = Bean.listToMap(docs,
* "sequenceNbr", KnowledgeDocContentModel.class).keySet();
* QueryWrapper<KnowlegeStatisticsRecord> wrapper = new QueryWrapper<>();
* wrapper.in("doc_seq", ids); this.getBaseMapper().delete(wrapper); } }
*
*//**
* 初始化统计数据记录
*
* @return
*//*
@Transactional(rollbackFor = {Exception.class, BaseException.class})
public boolean init() {
this.getBaseMapper().deleteAll();
//扫描所有已发布文档相关的统计型标签
QueryWrapper<KnowledgeDocContent> wrapper = new QueryWrapper<>();
wrapper.eq("doc_status", DocContentService.DOC_STATUS_PUBLISHED);
int count = docContentService.count(wrapper);
int finishNmu = 0;
int current = 0;
while (count > finishNmu) {
Page page = new Page(current++, 30);
IPage resPage = docContentService.page(page, wrapper);
List<KnowledgeDocContent> records = resPage.getRecords();
Set ids = Bean.listToMap(records, "sequenceNbr", KnowledgeDocContent.class).keySet();
saveRecordsByDocIds(ids);
finishNmu += records.size();
}
return true;
}
public boolean addDocRecords(List<KnowledgeDocContentModel> docs) {
if (!ValidationUtil.isEmpty(docs)) {
Set ids = Bean.listToMap(docs, "sequenceNbr", KnowledgeDocContentModel.class).keySet();
saveRecordsByDocIds(ids);
}
return true;
}
private void saveRecordsByDocIds(Collection ids) {
if (!needRecord) {
return;
}
for (Object id : ids) {
KnowledgeDocContentModel docContentModel = docContentService.queryOneDocDetail((Long) id);
if (ValidationUtil.isEmpty(docContentModel)) {
continue;
}
addRecordWithDocValueTag(docContentModel.getDocTags(), docContentModel.getSequenceNbr());
}
}
*/
/*
* @Transactional(rollbackFor = {Exception.class, BaseException.class}) public
* boolean init() { this.getBaseMapper().deleteAll(); //扫描所有已发布文档相关的统计型标签
* QueryWrapper<KnowledgeDocContent> wrapper = new QueryWrapper<>();
* wrapper.eq("doc_status", DocContentService.DOC_STATUS_PUBLISHED); int count =
* docContentService.count(wrapper); int finishNmu = 0; int current = 0; while
* (count > finishNmu) { Page page = new Page(current++, 30); IPage resPage =
* docContentService.page(page, wrapper); List<KnowledgeDocContent> records =
* resPage.getRecords(); Set ids = Bean.listToMap(records, "sequenceNbr",
* KnowledgeDocContent.class).keySet(); saveRecordsByDocIds(ids); finishNmu +=
* records.size(); } return true; }
*
* public boolean addDocRecords(List<KnowledgeDocContentModel> docs) { if
* (!ValidationUtil.isEmpty(docs)) { Set ids = Bean.listToMap(docs,
* "sequenceNbr", KnowledgeDocContentModel.class).keySet();
* saveRecordsByDocIds(ids); } return true; }
*
* private void saveRecordsByDocIds(Collection ids) { if (!needRecord) { return;
* } for (Object id : ids) { KnowledgeDocContentModel docContentModel =
* docContentService.queryOneDocDetail((Long) id); if
* (ValidationUtil.isEmpty(docContentModel)) { continue; }
* addRecordWithDocValueTag(docContentModel.getDocTags(),
* docContentModel.getSequenceNbr()); } }
*
*//**
* 查询灾情统计/同比/环比
*
* @return
*/
/*
* public Map<String, Object> selectDisasterCount() { return
* this.getBaseMapper().selectDisasterCount(); }
*
* public List<Map<String, Object>> selectCategoryByName(String recordName) {
* return this.getBaseMapper().selectCategoryByName(recordName); }
*
*//**
* 分类汇总
*//*
public Map<String, Object> selectDisasterCount() {
return this.getBaseMapper().selectDisasterCount();
* public List<Map<String, Object>> selectCountByTypeAndDateRange(String
* dateType, String dateRangeLeft, String dateRangeRight, String recordName) {
* Map<String, Object> queryMap = new HashMap<>(); switch (dateType) { case
* DATE_GROUP_BY_MONTH: queryMap.put("format", "%Y-%m"); break; default:
* queryMap.put("format", "%Y-%m-%d"); break; }
* if(!ValidationUtil.isEmpty(dateRangeLeft)){ try {
* queryMap.put("dateRangeLeft", DateUtil.formatStringToDate(dateRangeLeft,
* null)); } catch (Exception e) { throw new BadRequest("时间参数格式有误"); } }
* if(!ValidationUtil.isEmpty(dateRangeRight)){ try {
* queryMap.put("dateRangeRight", DateUtil.formatStringToDate(dateRangeRight,
* null)); } catch (Exception e) { throw new BadRequest("时间参数格式有误"); } }
* queryMap.put("recordName", recordName); return
* this.getBaseMapper().selectCountByNameAndDateRange(queryMap); }
*/
public Map<String, Object> tagStatistics(String tag, Date startDate, Date endDate, String mode) {
endDate = getLastDayOfMonth(endDate);
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
Map<String, Object> map = new HashMap<String, Object>();
if ("year".equals(mode)) {
list = this.baseMapper.tagStatisticsYear(tag, startDate, endDate);
} else {
list = this.baseMapper.tagStatisticsMonth(tag, startDate, endDate);
}
Calendar cal = Calendar.getInstance();
cal.setTime(endDate);
int year = cal.get(Calendar.YEAR);
list.forEach(i -> {
if ("year".equals(mode)) {
if (i.get("date") != null && Integer.valueOf((String) (i.get("date"))) <= year) {
map.put((String) i.get("date"), i.get("datas"));
}
} else {
map.put((String) i.get("date"), i.get("datas"));
}
});
return map;
}
public List<Map<String, Object>> selectCategoryByName(String recordName) {
return this.getBaseMapper().selectCategoryByName(recordName);
public Map<String, Object> docStatistics(String categoryName, Date startDate, Date endDate, String mode) {
endDate = getLastDayOfMonth(endDate);
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
Map<String, Object> map = new HashMap<String, Object>();
if ("year".equals(mode)) {
list = this.baseMapper.docStatisticsYear(categoryName, startDate, endDate);
} else {
list = this.baseMapper.docStatisticsMonth(categoryName, startDate, endDate);
}
Calendar cal = Calendar.getInstance();
cal.setTime(endDate);
int year = cal.get(Calendar.YEAR);
list.forEach(i -> {
if ("year".equals(mode)) {
if (i.get("date") != null && Integer.valueOf((String) (i.get("date"))) <= year) {
map.put((String) i.get("date"), i.get("datas"));
}
} else {
map.put((String) i.get("date"), i.get("datas"));
}
});
return map;
}
*//**
* 分类汇总
*//*
public List<Map<String, Object>> selectCountByTypeAndDateRange(String dateType, String dateRangeLeft, String dateRangeRight, String recordName) {
Map<String, Object> queryMap = new HashMap<>();
switch (dateType) {
case DATE_GROUP_BY_MONTH:
queryMap.put("format", "%Y-%m");
break;
default:
queryMap.put("format", "%Y-%m-%d");
break;
public Map<String, Object> tagChartStatistics(String tag, Date startDate, Date endDate, List<Integer> split,
String unit) {
endDate = getLastDayOfMonth(endDate);
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
Map<String, Object> map = new HashMap<String, Object>();
StringBuffer sb = new StringBuffer();
sb.append("elt(interval(ktv.TAG_VALUE");
for (int s : split) {
sb.append(",").append(s);
}
sb.append(")");
String last = "";
for (int s : split) {
if (StringUtils.isNotEmpty(last)) {
sb.append(",'").append(last).append("-").append(s).append(unit).append("'");
}
last = String.valueOf(s);
}
sb.append(",'").append(last).append(unit).append("以上'").append(")");
// String sql="elt(interval(ktv.TAG_VALUE,0, 5, 10, 40), 'less100', '100to500',
// '500to1000', 'more1000K')";
list = this.baseMapper.tagChartStatistics(tag, startDate, endDate, sb.toString());
list.forEach(i -> {
if (i.get("level") != null) {
map.put((String) i.get("level"), i.get("datas"));
}
});
return map;
}
if(!ValidationUtil.isEmpty(dateRangeLeft)){
try {
queryMap.put("dateRangeLeft", DateUtil.formatStringToDate(dateRangeLeft, null));
} catch (Exception e) {
throw new BadRequest("时间参数格式有误");
public Map<String, Object> tagTimeChartStatistics(Date startDate, Date endDate, List<Integer> split, String unit) {
endDate = getLastDayOfMonth(endDate);
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
Map<String, Object> map = new HashMap<String, Object>();
StringBuffer sb = new StringBuffer();
sb.append("elt(interval(kdc.TAG_VALUE");
for (int s : split) {
sb.append(",").append(s);
}
sb.append(")");
String last = "";
for (int s : split) {
if (StringUtils.isNotEmpty(last)) {
sb.append(",'").append(last).append("-").append(s).append(unit).append("'");
}
last = String.valueOf(s);
}
sb.append(",'").append(last).append(unit).append("以上'").append(")");
// String sql="elt(interval(ktv.TAG_VALUE,0, 5, 10, 40), 'less100', '100to500',
// '500to1000', 'more1000K')";
list = this.baseMapper.tagTimeChartStatistics(startDate, endDate, sb.toString());
list.forEach(i -> {
if (i.get("level") != null) {
map.put((String) i.get("level"), i.get("datas"));
}
});
return map;
}
public Map<String, Object> docChartStatistics(Date startDate, Date endDate) {
endDate = getLastDayOfMonth(endDate);
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
Map<String, Object> map = new HashMap<String, Object>();
list = this.baseMapper.docChartStatistics(startDate, endDate);
list.forEach(i -> {
if (i.get("categoryName") != null) {
map.put((String) i.get("categoryName"), i.get("datas"));
}
});
return map;
}
if(!ValidationUtil.isEmpty(dateRangeRight)){
try {
queryMap.put("dateRangeRight", DateUtil.formatStringToDate(dateRangeRight, null));
} catch (Exception e) {
throw new BadRequest("时间参数格式有误");
public Map<String, Object> docBurnChartStatistics(Date startDate, Date endDate) {
endDate = getLastDayOfMonth(endDate);
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
Map<String, Object> map = new HashMap<String, Object>();
list = this.baseMapper.docBurnChartStatistics(startDate, endDate);
list.forEach(i -> {
if (i.get("level") != null) {
map.put((String) i.get("level"), i.get("datas"));
}
});
return map;
}
private static Date getLastDayOfMonth(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
// 获取某月最大天数
int lastDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
// 设置日历中月份的最大天数
cal.set(Calendar.DAY_OF_MONTH, lastDay);
return cal.getTime();
}
queryMap.put("recordName", recordName);
return this.getBaseMapper().selectCountByNameAndDateRange(queryMap);
}*/
}
......@@ -436,4 +436,11 @@ public class LatentDangerController extends BaseController {
}
return ResponseHelper.buildResponse(null);
}
@ApiOperation(value = "隐患跳转巡检任务页面", notes = "隐患跳转巡检任务页面")
@GetMapping(value = "/web/patrol/{id}/{bizId}")
@TycloudOperation(ApiLevel = UserType.AGENCY)
public ResponseModel selectByIdandBizId(@PathVariable String bizId, @PathVariable Long id) {
return ResponseHelper.buildResponse(iLatentDangerService.selectByIdandBizId(id, bizId));
}
}
......@@ -90,4 +90,6 @@ public interface LatentDangerMapper extends BaseMapper<LatentDanger> {
String orgCode);
List<LatentDanger> updateStatusByUserIdAndPlandIdLike(String userId,String planId);
String selectByIdandBizId(Long id,String bizId);
}
......@@ -9,7 +9,9 @@ import java.util.*;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import org.apache.commons.lang3.ObjectUtils;
import org.opengis.metadata.acquisition.Plan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
......@@ -2488,10 +2490,18 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
DangerExecuteSubmitDto executeSubmitDto) throws Exception {
List<String> userIds = workflowExecuteService.getUserIdsByWorkflow(latentDanger.getInstanceId(),
executeSubmitDto.getCheckLeaderId());
// 修改待办任务状态
updateTaskStatus(latentDanger);
ruleDangerService.addDangerSubmitRule(latentDanger, userIds, RuleTypeEnum.隐患审核.getCode(),
ExecuteTypeEnum.getNameByCode(executeType));
}
private void updateTaskStatus(LatentDanger latentDanger){
MessageModel model = new MessageModel();
model.setRelationId(String.valueOf(latentDanger.getId()));
model.setMsgType("danger");
model.setIsRead(true);
Systemctl.messageClient.update(model);
}
@Override
public IPage<LatentDanger> reviewListDanger(PageParam pageParam, String userId) throws Exception {
String type = pageParam.get("type").toString();
......@@ -2707,4 +2717,8 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
this.savePatrol(dangerDtos,userId,userRealName,departmentId,departmentName,companyId,orgCode,role,"1");
}
public String selectByIdandBizId(Long id,String bizId){
return latentDangerMapper.selectByIdandBizId(id,bizId);
}
}
\ No newline at end of file
......@@ -203,4 +203,6 @@ public interface ILatentDangerService {
public Map<String, Integer> currentLandgerCount(String companyId,String loginOrgCode);
void updateStatusByUserIdAndPlandIdLike(String userId, String planId,ReginParams reginParams) throws Exception;
String selectByIdandBizId(Long id,String bizId) ;
}
package com.yeejoin.amos.maintenance.business.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Joiner;
......@@ -11,8 +11,11 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.amos.maintenance.business.constants.XJConstant;
import com.yeejoin.amos.maintenance.business.dao.mapper.CheckMapper;
import com.yeejoin.amos.maintenance.business.dao.mapper.PlanMapper;
import com.yeejoin.amos.maintenance.business.dao.mapper.PlanTaskDetailMapper;
import com.yeejoin.amos.maintenance.business.dao.mapper.PlanTaskMapper;
import com.yeejoin.amos.maintenance.business.dao.mapper.RouteMapper;
......@@ -115,6 +118,9 @@ public class CheckServiceImpl implements ICheckService {
@Autowired
IRouteDao iRouteDao;
@Autowired
PlanServiceImpl planService;
final String CHECK_UPDATE_TOPIC = "maintenance/date/update";
......@@ -273,6 +279,15 @@ public class CheckServiceImpl implements ICheckService {
jsonObject.put("maintenanceTime", check.getCheckTime());
mqttGateway.publish(CHECK_UPDATE_TOPIC, jsonObject.toJSONString());
}
Plan plan = planService.queryPlanById(planTask.getPlanId());
if (!ObjectUtils.isEmpty(plan) && plan.getIsSingleExecution()){
// 单人执行
updateTaskStatus(plan.getId(), reginParams.getUserModel().getUserId());
}else {
// 多人执行
updateTaskStatus(plan.getId(), null);
}
//7.返回不合格记录
return new CheckDto(check.getId(), unqualifiedCheckItemList);
} catch (Exception e) {
......@@ -280,6 +295,17 @@ public class CheckServiceImpl implements ICheckService {
throw new Exception(e.getMessage(), e);
}
}
private void updateTaskStatus(Long planId, String userId){
MessageModel model = new MessageModel();
model.setRelationId(String.valueOf(planId));
model.setIsRead(true);
model.setMsgType("maintenance");
if (!ObjectUtils.isEmpty(userId)){
model.setUserId(userId);
}
log.info("修改待办任务参数-->{}", JSON.toJSON(model));
Systemctl.messageClient.update(model);
}
private void checkCanFinishTask(String mtUserSeq, PlanTask planTask, Long pointId) throws Exception {
int status;
......
......@@ -273,6 +273,7 @@ public class CheckController extends AbstractBaseController {
//数字换流站页面刷新
try {
webMqttComponent.publish(patrolTopic, "");
}catch (Exception e){
log.error("数字换流站页面推送失败-----------"+e.getMessage());
}
......
......@@ -139,6 +139,7 @@ public class LatentDangerController extends AbstractBaseController {
}
return iLatentDangerService.detail(id, user.getUserId(),isFinish);
} catch (Exception e) {
e.printStackTrace();
return CommonResponseUtil.failure("系统繁忙,请稍后再试");
}
}
......
......@@ -48,4 +48,7 @@ public class LatentDangerPatrolBo extends LatentDangerPatrolBoExtend {
* 记录修改时间
*/
private Date updateDate;
//input id
private Long inputId;
}
......@@ -15,6 +15,11 @@ import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.transaction.Transactional;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.amos.patrol.dao.entity.Plan;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.assertj.core.util.Sets;
......@@ -137,6 +142,9 @@ public class CheckServiceImpl implements ICheckService {
@Autowired
private IPointClassifyDao iPointClassifyDao;
@Autowired
private PlanServiceImpl planService;
// @Value("${file.ip}")
// private String fileIp;
//
......@@ -211,6 +219,7 @@ public class CheckServiceImpl implements ICheckService {
PlanTask planTask = null;
Check check = new Check();
HashMap<String, Object> routeParam = new HashMap<String, Object>();
Map detail = null;
Boolean isOffline = requestParam.getIsOffline();
......@@ -343,7 +352,15 @@ public class CheckServiceImpl implements ICheckService {
}else{
check.setScore(Integer.parseInt(XJConstant.POINT_NOT_SCORE));
}
// check = checkDao.save(check);
try {
check = checkDao.save(check);
}catch (Exception e) {
e.printStackTrace();
}
List<CheckShot> imgList = new ArrayList<>();
......@@ -409,6 +426,15 @@ public class CheckServiceImpl implements ICheckService {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
planTaskMapper.reformStatistics(user.getUserId(), sdf.format(new Date()), requestParam.getOrgCode());
}
// 任务完成、同步修改待办任务状态
Plan plan = planService.queryPlanById(check.getPlanId());
if (!ObjectUtils.isEmpty(plan) && plan.getIsSingleExecution()){
// 单人执行
updateTaskStatus(plan.getId(), user.getUserId());
}else {
// 多人执行
updateTaskStatus(plan.getId(), null);
}
return new CheckDto(check.getId(), unqualifiedcheckItemList);
} catch (Exception e) {
......@@ -416,7 +442,21 @@ public class CheckServiceImpl implements ICheckService {
return null;
}
}
private void updateTaskStatus(Long id, String userId){
try {
MessageModel model = new MessageModel();
model.setRelationId(String.valueOf(id));
model.setIsRead(true);
model.setMsgType("patrolSystem");
if (!ObjectUtils.isEmpty(userId)){
model.setUserId(userId);
}
FeignClientResult<MessageModel> update = Systemctl.messageClient.update(model);
}catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void delCheckById(List<Long> list) {
// List<Long> pointIdList = checkDao.getPointIdList(list);
......
......@@ -602,6 +602,9 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
}
Date startDate1 = new Date();;
int dangerListSize = latentDangerMapper.countByBathBusinessKeys(bussinessKeys, latentDangerListParam);
if (latentDangerListParam.getBelongType().equals(1)){
latentDangerListParam.setUserId(user.getUserId());
}
List<LatentDangerBo> dangerList = latentDangerMapper.getByBathBusinessKeys(bussinessKeys, latentDangerListParam);
Date endDate1 = new Date();
logger.info("-------------------------sql时间" +(endDate1.getTime()-startDate1.getTime()));
......@@ -835,6 +838,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
// detailVo.setCurrentUserCanExcute(true);
// }
// }
detailVo.setCurrentFlowRecordId(latentDangerBo.getCurrentFlowRecordId());
detailVo.setCurrentFlowRecordIdWeb(String.valueOf(latentDangerBo.getCurrentFlowRecordId()));
if (!StringUtils.isEmpty(latentDangerBo.getReformJson())) {
......@@ -851,8 +855,8 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
}
private void buildOfDifferentDangerType(LatentDangerBo latentDangerBo, LatentDangerDetailVo detailVo) {
if (latentDangerBo.getDangerType().equals(LatentDangerTypeEnum.计划检查.getCode())
|| latentDangerBo.getDangerType().equals(LatentDangerTypeEnum.无计划检查.getCode())) {
if (latentDangerBo.getDangerType().equals(LatentDangerTypeEnum.计划检查.getCode().toString())
|| latentDangerBo.getDangerType().equals(LatentDangerTypeEnum.无计划检查.getCode().toString())) {
LatentDangerPatrolBo patrolBo = latentDangerPatrolMapper.getByDangerId(latentDangerBo.getId());
if (patrolBo != null) {
LatentDangerDetailRiskVo riskVo = new LatentDangerDetailRiskVo();
......@@ -870,19 +874,23 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
if (StringUtil.isNotEmpty(checkUser)) {
riskVo.setCheckUser(checkUser.getRealName());
}
RiskFactorBo riskFactorBo = StringUtil.isNotEmpty(patrolBo.getClassifyOriginalId()) ? riskFactorMapper.getById(Long.valueOf(patrolBo.getClassifyOriginalId())) : null;
if (riskFactorBo != null && riskFactorBo.getEquipmentDepartmentId() != null) {
DepartmentModel department = remoteSecurityService.getDepartmentByDeptId(RequestContext.getToken(), getProduct(),RequestContext.getAppKey(),riskFactorBo.getEquipmentDepartmentId().toString());
if (department != null) {
riskVo.setBelongDepartmentName(department.getDepartmentName());
}
}
// RiskFactorBo riskFactorBo = StringUtil.isNotEmpty(patrolBo.getClassifyOriginalId()) ? riskFactorMapper.getById(Long.valueOf(patrolBo.getClassifyOriginalId())) : null;
// if (riskFactorBo != null && riskFactorBo.getEquipmentDepartmentId() != null) {
// DepartmentModel department = remoteSecurityService.getDepartmentByDeptId(RequestContext.getToken(), getProduct(),RequestContext.getAppKey(),riskFactorBo.getEquipmentDepartmentId().toString());
// if (department != null) {
// riskVo.setBelongDepartmentName(department.getDepartmentName());
// }
// }
// List<CheckShot> checkShots = iCheckShotDao.findAllByCheckIdAndCheckInputId(patrolBo.getCheckId(),
// latentDangerBo.getBizId());
List<CheckShot> checkShots = iCheckShotDao.findAllByCheckIdAndCheckInputId(patrolBo.getCheckId(),
latentDangerBo.getBizId());
patrolBo.getInputId());
if (!CollectionUtils.isEmpty(checkShots)) {
List<String> photos = Lists.transform(checkShots, e -> {
if (e != null) {
return fileServerAddress + e.getPhotoData().replaceAll("\\\\", "/");
// return fileServerAddress + e.getPhotoData().replaceAll("\\\\", "/");
return e.getPhotoData().replaceAll("\\\\", "/");
} else {
return "";
}
......@@ -1264,9 +1272,12 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
latentDangerBo.setReformType(LatentDangerReformTypeEnum.常规整改.getCode().toString());
JSONObject reformJsonObj = JSONObject.parseObject(latentDangerBo.getReformJson());
if (ValidationUtil.isEmpty(reformJsonObj)) {
reformJsonObj = executeParam.getFlowJson();
// reformJsonObj = executeParam.getFlowJson();
reformJsonObj.put("governPhotoObj",executeParam.getFlowJson().get("photoUrls"));
} else {
reformJsonObj.putAll(executeParam.getFlowJson());
// reformJsonObj.putAll(executeParam.getFlowJson());
reformJsonObj.put("governPhotoObj",executeParam.getFlowJson().get("photoUrls"));
}
latentDangerBo.setReformJson(reformJsonObj.toJSONString());
latentDangerBo.setInferOtherThings(executeParam.getInferOtherThings());
......@@ -1290,6 +1301,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
reformJsonObject = new JSONObject();
}
reformJsonObject.put("governUserId", governUserId);
reformJsonObject.put("reviewPhotoObj",reformJsonObject.get("photoUrls"));
latentDangerBo.setReformJson(reformJsonObject.toJSONString());
// 消防巡查需求:评审通过后指定治理人
......
package com.yeejoin.amos.supervision.business.controller;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.amos.supervision.business.constants.XJConstant;
import com.yeejoin.amos.supervision.business.dao.mapper.PlanTaskDetailMapper;
import com.yeejoin.amos.supervision.business.dto.CheckDto;
import com.yeejoin.amos.supervision.business.dto.CheckInputItemDto;
import com.yeejoin.amos.supervision.business.param.*;
......@@ -19,6 +23,7 @@ import com.yeejoin.amos.supervision.core.common.response.AppPointCheckRespone;
import com.yeejoin.amos.supervision.core.common.response.GraphInitDataResponse;
import com.yeejoin.amos.supervision.core.framework.PersonIdentify;
import com.yeejoin.amos.supervision.core.util.StringUtil;
import com.yeejoin.amos.supervision.dao.entity.PlanTask;
import com.yeejoin.amos.supervision.mqtt.WebMqttComponent;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -82,6 +87,10 @@ public class CheckController extends AbstractBaseController {
@Value("${amosRefresh.patrol.topic}")
private String patrolTopic;
@Autowired
PlanTaskDetailMapper planTaskDetailMapper;
@Autowired
private WebMqttComponent webMqttComponent;
......@@ -557,6 +566,20 @@ public class CheckController extends AbstractBaseController {
String orgCode = getOrgCode(reginParams);
requestParam.setOrgCode(orgCode);
List<CheckInputItemDto> checkInputItemDtoList = checkService.saveCheckRecord(requestParam, reginParams);
// 查询检查计划任务信息
PlanTask planTasks = planTaskDetailMapper.selectById(requestParam.getPlanTaskId());
log.info("检查任务信息-->{}", JSON.toJSON(planTasks));
if (!ObjectUtils.isEmpty(planTasks)){
// 如果计划已超时或者已结束-----更新待办任务状态
if (XJConstant.TASK_STATUS_TIMEOUT == planTasks.getFinishStatus() || XJConstant.TASK_STATUS_FINISH == planTasks.getFinishStatus()){
MessageModel model = new MessageModel();
model.setRelationId(String.valueOf(planTasks.getPlanId()));
model.setMsgType("supervision");
model.setIsRead(true);
log.info("修改待办任务参数-->{}", JSON.toJSON(model));
Systemctl.messageClient.update(model);
}
}
return ResponseHelper.buildResponse(checkInputItemDtoList);
} catch (Exception e) {
log.error(e.getMessage(), e);
......
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.supervision.business.dao.mapper;
import java.util.List;
import java.util.Map;
import com.yeejoin.amos.supervision.dao.entity.PlanTask;
import com.yeejoin.amos.supervision.dao.entity.PlanTaskDetail;
import org.apache.ibatis.annotations.Param;
......@@ -19,4 +20,11 @@ public interface PlanTaskDetailMapper extends BaseMapper {
* @param planTaskDetailId 主键id
*/
void updateDanger(@Param(value="planTaskDetailId") long planTaskDetailId);
/**
* 任务id查询任务信息
* @param id
* @return
*/
PlanTask selectById(@Param("id") Long id);
}
......@@ -22,6 +22,11 @@ public interface IPlanDao extends BaseDao<Plan, Long> {
@Modifying
@Transactional
@Query(value = "select * from p_plan WHERE status NOT IN (0,5,6,7,8)", nativeQuery = true)
List<Plan> queryOutTimePlan();
@Modifying
@Transactional
@Query(value = "select * from p_plan WHERE route_id = ?1 and status = ?2", nativeQuery = true)
List<Plan> queryPlanByRouteId(long routeId, String status);
......
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.supervision.business.service.impl;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.service.IWorkflowExcuteService;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.supervision.business.dao.repository.IPlanAuditDao;
......@@ -26,10 +27,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.*;
@Service("planAuditService")
public class PlanAuditServiceImpl implements IPlanAuditService {
......@@ -77,6 +75,8 @@ public class PlanAuditServiceImpl implements IPlanAuditService {
workflowExcuteService.CompleteTask(instanceId, conditionValue, reginParams);
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
String userId = reginParams.getUserModel().getUserId();
plan.setNextGenDate(DateUtils.dateTimeToDate(new Date()));
planService.updateGenDate(plan);
// 更新计划状态,指定执行人
updatePlanStatus(condition,plan,instanceId, conditionValue);
// 更新流水表
......
......@@ -12,12 +12,16 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.client.MessageClient;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.amos.supervision.business.constants.XJConstant;
import com.yeejoin.amos.supervision.business.dao.mapper.PlanMapper;
import com.yeejoin.amos.supervision.business.dao.mapper.PointMapper;
import com.yeejoin.amos.supervision.business.dao.repository.*;
import com.yeejoin.amos.supervision.business.param.PlanInfoPageParam;
import com.yeejoin.amos.supervision.business.service.intfc.IPlanService;
import com.yeejoin.amos.supervision.business.util.Toke;
import com.yeejoin.amos.supervision.common.enums.*;
import com.yeejoin.amos.boot.biz.common.enums.RuleTypeEnum;
import com.yeejoin.amos.supervision.core.async.AsyncTask;
......@@ -238,6 +242,11 @@ public class PlanServiceImpl implements IPlanService {
}
}
public void updateGenDate(Plan plan){
planMapper.updateById(plan);
}
/**
* 根据工作流获取下一审核人角色下的所有用户ID =》规则推送消息
* @return
......@@ -260,9 +269,13 @@ public class PlanServiceImpl implements IPlanService {
rulePlanService.addPlanRule(plan, userIds, RuleTypeEnum.计划提交, null); // 计划提交
} else {
if (PlanStatusEnum.EXAMINE_THREE.getValue() != status){
// 待办任务状态更新
updateTaskStatus(plan);
// rulePlanService.addPlanAuditRule(plan, userIds, RuleTypeEnum.计划审核, ExecuteStateNameEnum.getNameByCode(excuteState)); // 计划审核
rulePlanService.addPlanAuditRule(plan, userIds, RuleTypeEnum.计划审核任务, ExecuteStateNameEnum.getNameByCode(excuteState)); // 计划审核任务通知
} else {
// 待办任务状态更新
updateTaskStatus(plan);
rulePlanService.addPlanAuditRule(plan, userIds, RuleTypeEnum.计划审核完成, ExecuteStateNameEnum.getNameByCode(excuteState)); // 计划审核完成
}
}
......@@ -273,6 +286,19 @@ public class PlanServiceImpl implements IPlanService {
return userIds;
}
private void updateTaskStatus(Plan plan){
Toke toke= remoteSecurityService.getServerToken();
RequestContext.setToken(toke.getToke());
RequestContext.setProduct(toke.getProduct());
RequestContext.setAppKey(toke.getAppKey());
MessageModel model = new MessageModel();
model.setRelationId(String.valueOf(plan.getId()));
model.setMsgType("supervision");
model.setIsRead(true);
log.info("修改待办任务参数-->{}", JSON.toJSON(model));
Systemctl.messageClient.update(model);
}
private void insertAuditLog(ReginParams reginParams, Plan param, ReginParams.PersonIdentity personIdentity, PlanAudit audit) {
PlanAuditLog planAuditLog = new PlanAuditLog();
planAuditLog.setPlanAuditId(audit.getId());
......
......@@ -377,6 +377,31 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
String strDate = df.format(now);
String tomorrow = DateUtil.getIntervalDateStr(now, 1, "yyyy-MM-dd");// 下一天
//除草稿状态外其他状态过了计划结束时间都需要根据任务状态更新计划状态。
List<Plan> planLists = iplanDao.queryOutTimePlan();
if (CollectionUtils.isNotEmpty(planLists)){
for (Plan plan : planLists) {
// 当前时间在计划结束时间之前,则计划还未超时
Date date = new Date();
Time time = new Time(date.getTime());
String planEndTime = plan.getPlanEnd() + " " + plan.getDayEnd().toString();
try {
Date parse = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(planEndTime);
if (time.before(new Time(parse.getTime()))){
continue;
}
} catch (ParseException e) {
e.printStackTrace();
}
HashMap<String, Object> param= new HashMap<String, Object>();
param.put("id", plan.getId());
param.put("status", PlanStatusEnum.COMPLETED.getValue());
planMapper.updPlanStatusOrGenDate(param);
}
}
// 根据计划状态5,6和next_gen_date查询需要生成任务的计划
List<Plan> planList = iplanDao.queryScheduledPlan(strDate,
String.valueOf(PlanStatusEnum.EXAMINE_DEVELOPED.getValue()),
......@@ -414,6 +439,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
int num = 0;
//根据计划id查询关联的任务
List<PlanTask> planTaskByRouteId = planTaskMapper.getPlanTaskByRouteId(plan.getId());
if (!ValidationUtil.isEmpty(planTaskByRouteId)){
HashMap<String, Object> param = new HashMap<String, Object>();
param.put("pointId",plan.getId());
......@@ -427,6 +453,10 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}else {
paramMap.put("status", PlanStatusEnum.COMPLETED.getValue());
}
}else {
paramMap.put("status", PlanStatusEnum.OUT_TIME.getValue());
planMapper.updPlanStatusOrGenDate(paramMap);
continue;
}
if (plan.getIsFixedDate().equals("2")){
paramMap.put("status", PlanStatusEnum.OUT_TIME.getValue());
......@@ -437,7 +467,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
planTaskMapper.updateTaskDetailStatusByPlanId(plan.getId());
continue;
}
planMapper.updPlanStatusOrGenDate(paramMap);
if (!ObjectUtils.isEmpty(paramMap.get("status")) && paramMap.get("status").equals(PlanStatusEnum.OUT_TIME.getValue())){
// 计划超时,修改计划下任务状态
......@@ -854,13 +884,17 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
}
log.info(String.format("计划对象:%s", JSON.toJSON(plan)));
// 规则推送消息
rulePlanService.addPlanRule(plan, null, RuleTypeEnum.消息型计划生成, extraUserIds);// 根据bug4150 将此处的计划生成的枚举值变成了消息,既TASK ->
// NOTIFY
String userIdString = plan.getUserId();
FeignClientResult amosIdListByUserIds = jcsFeignClient.getAmosIdListByUserIds(userIdString);
List<String> result = (List<String>) amosIdListByUserIds.getResult();
// 规则推送消息
extraUserIds.removeAll(result);//给执行人只发送待办 不发通知
rulePlanService.addPlanRule(plan, null, RuleTypeEnum.消息型计划生成, extraUserIds);// 根据bug4150 将此处的计划生成的枚举值变成了消息,既TASK ->
// NOTIFY
if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(result)) {
// String[] userIdArr = userIdString.split(",");
// List<String> userIdList = Arrays.asList(userIdArr);
......
......@@ -39,6 +39,10 @@
<artifactId>servlet-api</artifactId>
<groupId>javax.servlet</groupId>
</exclusion>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
......
......@@ -14,6 +14,12 @@
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-equip-biz</artifactId>
<version>${amos-biz-boot.version}</version>
<exclusions>
<exclusion>
<artifactId>log4j-to-slf4j</artifactId>
<groupId>org.apache.logging.log4j</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
......
......@@ -85,6 +85,11 @@ dcs.token-key=dcs_token_key
dcs.client.secret=fire_system
dcs.x.hw.id=NR_REST_APP
dcs.x.hw.appKey=s+YkvQhwilx91TRJHhNDmw==
# 故障告警/消防告警/跑马灯权限标识 true 机场 / false 电力
equip.enabled =true
management.endpoints.enabled-by-default=false
# 权限标识-物联区域
auth-key-area=area_info
......
......@@ -1240,7 +1240,7 @@
'其他' AS fireFightSysName,
'equip' AS fireFacilityType,
ws.source_id AS buildingId,
ws.`name` AS buildingName,
ws.full_name AS buildingName,
ed.area AS location
FROM
wl_equipment_specific es
......@@ -1300,6 +1300,20 @@
</where>
</select>
<select id="getEquipLocationInfo" resultType="map">
SELECT
wed.longitude as longitude,
wed.latitude as latitude
FROM
wl_stock_detail sd
LEFT JOIN wl_equipment_detail wed ON sd.equipment_detail_id = wed.id
<where>
<if test="equipmentSpecificId != null">
sd.equipment_specific_id = #{equipmentSpecificId}
</if>
</where>
</select>
<select id="getEquipSpeInfo" resultType="Map">
SELECT
es.id,
......
......@@ -59,7 +59,7 @@
create_date
FROM
mt_maintenance_resource_data
GROUP BY maintenance_company_id,classify_id
GROUP BY maintenance_company_id,classify_id,owner_unit_id,fire_fight_sys_id
</select>
<select id="selectMaintenanceResourceDataList"
......@@ -252,7 +252,17 @@
m.maintenance_company_name,
m.owner_unit_id,
m.owner_unit_name,
<choose>
<when test="fireFightSysId != null and fireFightSysId != '' ">
m.fire_fight_sys_id,
</when>
<otherwise>
'' as fire_fight_sys_id,
</otherwise>
</choose>
m.fire_fight_sys_name,
m.classify_id,
m.classify_name,
......@@ -279,7 +289,8 @@
</if>
</where>
GROUP BY
m.classify_code
-- m.classify_code
m.classify_id
</select>
<select id="getFireFacilityPage" resultType="com.yeejoin.equipmanage.common.dto.MaintenanceResourceDataDto">
SELECT
......@@ -316,7 +327,7 @@
<if test="ownerUnitId != null">
AND m.owner_unit_id = #{ownerUnitId}
</if>
<if test="fireFightSysId != null">
<if test="fireFightSysId != null and fireFightSysId != '' ">
AND m.fire_fight_sys_id = #{fireFightSysId}
</if>
<if test="classifyId != null">
......
......@@ -132,6 +132,7 @@
fire_fight_sys_id AS id,
fire_fight_sys_name name ,
owner_unit_id as parentId,
owner_unit_id as ownerUnitId,
IFNULL(classify_type,3) as type
FROM
`mt_maintenance_resource_data`
......
......@@ -50,6 +50,13 @@
<if test="video!=null and video.bizOrgCode!=null and video.bizOrgCode!=''">
and wlv.biz_org_code LIKE CONCAT(#{video.bizOrgCode}, '%')
</if>
<if test="video!=null and video.ip!=null and video.ip!=''">
and wlv.ip like concat('%',#{video.ip},'%')
</if>
<if test="video!=null and video.type!=null and video.type!=''">
and wlv.type=#{video.type}
</if>
group by wlv.id
order by wlv.create_date desc
</select>
......@@ -108,10 +115,19 @@
<if test="dto.code!=null and dto.code!=''">
and v.code like concat('%',#{dto.code},'%')
</if>
<if test=" dto.ip!=null and dto.ip!=''">
and v.ip like concat('%',#{dto.ip},'%')
</if>
<if test="dto.type!=null and dto.type!=''">
and v.type = #{dto.type}
</if>
GROUP BY id
order by v.create_date
</when>
<when test="dto.buildingId == null || dto.buildingId ==''">
<when test='dto.buildingId == null || dto.buildingId ==""'>
<where>
<if test="dto.bizOrgCode!=null and dto.bizOrgCode!=''">
v.biz_org_code LIKE CONCAT(#{dto.bizOrgCode}, '%')
......@@ -122,6 +138,16 @@
<if test="dto.equipmentName!=null and dto.equipmentName!=''">
and v.name like concat('%',#{dto.equipmentName},'%')
</if>
<if test=" dto.ip!=null and dto.ip!=''">
and v.ip like concat('%',#{dto.ip},'%')
</if>
<if test="dto.type!=null and dto.type!=''">
and v.type =#{dto.type}
</if>
</where>
GROUP BY id
order by v.create_date
......@@ -160,7 +186,7 @@
select
vid.id,
vid.token,
vid.remark,
vid.name as name,
vid.url,
vid.code,
vid.preset_position as presetPosition,
......
......@@ -199,9 +199,29 @@
<if test="equipmentName!=null">
AND d.equipmentName LIKE '%${equipmentName}%'
</if>
<if test="startTime!=null">
<!-- <if test="startTime!=null and endTime!=null ">-->
<!-- AND d.create_date BETWEEN '${startTime}' AND '${endTime}'-->
<!-- </if>-->
<choose>
<when test="startTime!=null and endTime!=null ">
AND d.create_date BETWEEN '${startTime}' AND '${endTime}'
</when>
<otherwise>
<if test="startTime!=null">
AND d.create_date &gt;= '${startTime}'
</if>
<if test="endTime!=null ">
AND d.create_date &lt;= '${endTime}'
</if>
</otherwise>
</choose>
<if test="buildId!=null">
AND d.buildId in (#{buildId})
<!-- AND d.buildId in
......
......@@ -26,10 +26,7 @@
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-security</artifactId>-->
<!-- </dependency>-->
</dependencies>
<build>
......
......@@ -29,11 +29,7 @@ spring.datasource.hikari.max-lifetime=120000
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.connection-test-query=SELECT 1
endpoints.enabled = false
management.security.enabled=true
security.user.name=admin
security.user.password=admin
##liquibase
......@@ -79,6 +75,8 @@ mqtt.topic.alert.iot=iot-system-alarm
mqtt.topic.alert.iot.web=iot-system-alarm-web
#警情预案匹配的消息topic名称
mqtt.topic.command.knowledgebase.alert.match=knowledgeAlertMatch
#航空报警器警情通知
mqtt.topic.command.alert.noticeAviation=aviationAlarm
security.systemctl.name=AMOS-API-SYSTEMCTL
......@@ -122,6 +120,7 @@ mybatis.interceptor.enabled = false
## 消防救援保障部ID
fire-rescue=1432549862557130753
management.endpoints.enabled-by-default=false
#阿里云实时语音识别参数
speech-config.access-key-id=LTAI5t62oH95jgbjRiNXPsho
speech-config.access-key-secret=shy9SpogYgcdDoyTB3bvP21VSRmz8n
......
......@@ -3222,5 +3222,44 @@
REPLACE INTO `cb_data_dictionary`(`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES (1165, '1165', '集结待命', 'XYJBR', NULL, NULL, NULL, NULL, NULL, b'0', 1);
</sql>
</changeSet>
<changeSet author="chenzhao" id="2022-07-1-1">
<preConditions onFail="MARK_RAN">
<tableExists tableName="cb_data_dictionary" />
</preConditions>
<comment>修改数据字典parent</comment>
<sql>
ALTER TABLE cb_data_dictionary MODIFY COLUMN parent VARCHAR(100) </sql>
</changeSet>
<changeSet author="chenzhao" id="2022-07-4-1">
<preConditions onFail="MARK_RAN">
<tableExists tableName="cb_data_dictionary" />
</preConditions>
<comment>修改数据字典</comment>
<sql>
UPDATE `cb_data_dictionary` SET `code` = '1210', `name` = '消防指挥员', `type` = 'GWMC', `type_desc` = '消防人员岗位', `parent` = NULL, `rec_user_name` = NULL, `rec_user_id` = NULL, `rec_date` = NULL, `is_delete` = b'0', `sort_num` = 1 WHERE `sequence_nbr` = 1210;
UPDATE `cb_data_dictionary` SET `code` = '141', `name` = '消防战斗员', `type` = 'GWMC', `type_desc` = NULL, `parent` = '140', `rec_user_name` = NULL, `rec_user_id` = NULL, `rec_date` = NULL, `is_delete` = b'0', `sort_num` = 1 WHERE `sequence_nbr` = 141;
</sql>
</changeSet>
<changeSet author="chenzhao" id="2022-07-4-2">
<preConditions onFail="MARK_RAN">
<tableExists tableName="cb_data_dictionary" />
</preConditions>
<comment>增加数据字典数据</comment>
<sql>
REPLACE INTO `cb_data_dictionary`(`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES (1353, 1, '急救类', 'GWMC', NULL, NULL, NULL, NULL, NULL, b'0', 1);
REPLACE INTO `cb_data_dictionary`(`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES (1354, 2, '医生', 'GWMC', NULL, '1353', NULL, NULL, NULL, b'0', 1);
REPLACE INTO `cb_data_dictionary`(`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES (1355, 3, '公卫医生', 'GWMC', NULL, '1353', NULL, NULL, NULL, b'0', 1);
REPLACE INTO `cb_data_dictionary`(`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES (1356, 4, '护士长', 'GWMC', NULL, '1353', NULL, NULL, NULL, b'0', 1);
REPLACE INTO `cb_data_dictionary`(`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES (1357, 5, '护士', 'GWMC', NULL, '1353', NULL, NULL, NULL, b'0', 1);
REPLACE INTO `cb_data_dictionary`(`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES (1358, 6, '急救驾驶员', 'GWMC', NULL, '1353', NULL, NULL, NULL, b'0', 1);
</sql>
</changeSet>
</databaseChangeLog>
......@@ -14,10 +14,12 @@
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-knowledgebase-biz</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<exclusions>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
......
......@@ -22,8 +22,4 @@ mybatis-plus.mapper-locations=classpath:mapper/*
## redis失效时间
redis.cache.failure.time=10800
endpoints.enabled = false
management.security.enabled=true
security.user.name=admin
security.user.password=admin
management.endpoints.enabled-by-default=false
<?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.knowledgebase.face.orm.dao.StatisticsRecordMapper">
<mapper
namespace="com.yeejoin.amos.knowledgebase.face.orm.dao.StatisticsRecordMapper">
<update id="deleteAll">
truncate table knowlege_statistics_record
......@@ -13,50 +14,62 @@
COUNT(1)
FROM
knowlege_statistics_record
WHERE record_name = "DISASTER_RECORD"
WHERE record_name =
"DISASTER_RECORD"
AND DATE(disaster_time) BETWEEN DATE_ADD(
CURDATE(),
INTERVAL - DAY(CURDATE()) + 1 DAY
)
AND LAST_DAY(CURDATE())) AS currentMonthCount,
AND LAST_DAY(CURDATE())) AS
currentMonthCount,
(SELECT
COUNT(1)
FROM
knowlege_statistics_record
WHERE record_name = "DISASTER_RECORD"
AND DATE(disaster_time) BETWEEN DATE_SUB(
WHERE
record_name = "DISASTER_RECORD"
AND DATE(disaster_time) BETWEEN
DATE_SUB(
CURDATE() - DAY(CURDATE()) + 1,
INTERVAL 1 MONTH
)
AND LAST_DAY(DATE_SUB(NOW(), INTERVAL 1 MONTH))) AS lastMonthCount,
AND
LAST_DAY(DATE_SUB(NOW(), INTERVAL 1 MONTH))) AS lastMonthCount,
(SELECT
COUNT(1)
FROM
knowlege_statistics_record
WHERE record_name = "DISASTER_RECORD"
WHERE record_name =
"DISASTER_RECORD"
AND DATE(disaster_time) BETWEEN DATE_SUB(
CURDATE() - DAY(CURDATE()) + 1,
CURDATE() -
DAY(CURDATE()) + 1,
INTERVAL 2 MONTH
)
AND LAST_DAY(DATE_SUB(NOW(), INTERVAL 2 MONTH))) AS last2MonthCount,
AND LAST_DAY(DATE_SUB(NOW(),
INTERVAL 2 MONTH))) AS last2MonthCount,
(SELECT
COUNT(1)
FROM
knowlege_statistics_record
WHERE record_name = "DISASTER_RECORD"
AND DATE(disaster_time) BETWEEN DATE_SUB(
AND
DATE(disaster_time) BETWEEN DATE_SUB(
CURDATE() - DAY(CURDATE()) + 1,
INTERVAL 1 YEAR
)
AND LAST_DAY(DATE_SUB(CURDATE(), INTERVAL 1 YEAR))) AS lastYearCurrentMonthCount,
AND LAST_DAY(DATE_SUB(CURDATE(), INTERVAL 1 YEAR))) AS
lastYearCurrentMonthCount,
(SELECT
COUNT(1)
FROM
knowlege_statistics_record
WHERE record_name = "DISASTER_RECORD"
AND DATE(disaster_time) BETWEEN DATE_SUB(
AND
DATE(disaster_time) BETWEEN DATE_SUB(
DATE_SUB(
CURDATE() - DAY(CURDATE()) + 1,
CURDATE() -
DAY(CURDATE()) + 1,
INTERVAL 1 MONTH
),
INTERVAL 1 YEAR
......@@ -66,13 +79,15 @@
DATE_SUB(CURDATE(), INTERVAL 1 YEAR),
INTERVAL 1 MONTH
)
)) AS lastYearLastMonthCount,
)) AS
lastYearLastMonthCount,
(SELECT
COUNT(1)
FROM
knowlege_statistics_record
WHERE record_name = "DISASTER_RECORD"
AND DATE(disaster_time) BETWEEN CONCAT(
AND DATE(disaster_time) BETWEEN
CONCAT(
YEAR(NOW()),
'-',
LPAD((QUARTER(CURDATE()) - 1) * 3+1, 2, '0'),
......@@ -82,7 +97,8 @@
CONCAT(
YEAR(NOW()),
'-',
LPAD(QUARTER(NOW()) * 3, 2, 0),
LPAD(QUARTER(NOW()) * 3, 2,
0),
'-01'
)
)) AS currentQuarterCount,
......@@ -91,7 +107,8 @@
FROM
knowlege_statistics_record
WHERE record_name = "DISASTER_RECORD"
AND DATE(disaster_time) BETWEEN DATE_SUB(
AND
DATE(disaster_time) BETWEEN DATE_SUB(
CONCAT(
YEAR(NOW()),
'-',
......@@ -104,7 +121,8 @@
CONCAT(
YEAR(NOW()),
'-',
LPAD((QUARTER(CURDATE()) - 1) * 3+1, 2, '0'),
LPAD((QUARTER(CURDATE()) - 1) *
3+1, 2, '0'),
'-01'
),
INTERVAL 1 DAY
......@@ -113,7 +131,8 @@
COUNT(1)
FROM
knowlege_statistics_record
WHERE record_name = "DISASTER_RECORD"
WHERE record_name =
"DISASTER_RECORD"
AND DATE(disaster_time) BETWEEN DATE_SUB(
CONCAT(
YEAR(NOW()),
......@@ -133,19 +152,23 @@
)
),
INTERVAL 1 YEAR
)) AS lastYearCurrentQuarterCount,
)) AS
lastYearCurrentQuarterCount,
(SELECT
COUNT(1)
FROM
knowlege_statistics_record
WHERE record_name = "DISASTER_RECORD"
AND DATE(disaster_time) BETWEEN CONCAT(YEAR(CURDATE()), '-01-01')
AND CONCAT(YEAR(CURDATE()), '-12-31')) AS currentYearCount,
AND
DATE(disaster_time) BETWEEN CONCAT(YEAR(CURDATE()), '-01-01')
AND
CONCAT(YEAR(CURDATE()), '-12-31')) AS currentYearCount,
(SELECT
COUNT(1)
FROM
knowlege_statistics_record
WHERE record_name = "DISASTER_RECORD"
WHERE record_name =
"DISASTER_RECORD"
AND DATE(disaster_time) BETWEEN CONCAT(
YEAR(DATE_SUB(CURDATE(), INTERVAL 1 YEAR)),
'-01-01'
......@@ -157,29 +180,264 @@
</select>
<!-- 燃烧物质分类查询 -->
<select id="selectCategoryByName" resultType="java.util.Map" parameterType="java.lang.String">
<select id="selectCategoryByName" resultType="java.util.Map"
parameterType="java.lang.String">
SELECT
category_value category, count(1) quantity
FROM
knowlege_statistics_record
WHERE record_name = #{recordName}
group by category_value
group by
category_value
</select>
<select id="selectCountByNameAndDateRange" resultType="java.util.Map" parameterType="java.util.Map">
<select id="selectCountByNameAndDateRange"
resultType="java.util.Map" parameterType="java.util.Map">
SELECT
DATE_FORMAT(disaster_time, #{format}) AS period,
SUM(COUNT_VALUE) quantity
FROM
knowlege_statistics_record
WHERE record_name = #{recordName}
WHERE
record_name = #{recordName}
<if test="dateRangeLeft != null">
AND DATE_FORMAT(disaster_time, #{format}) <![CDATA[ >= ]]> DATE_FORMAT(#{dateRangeLeft}, #{format})
AND DATE_FORMAT(disaster_time, #{format}) <![CDATA[ >= ]]>
DATE_FORMAT(#{dateRangeLeft}, #{format})
</if>
<if test="dateRangeRight != null">
AND DATE_FORMAT(disaster_time, #{format}) <![CDATA[ <= ]]> DATE_FORMAT(#{dateRangeRight}, #{format})
AND DATE_FORMAT(disaster_time, #{format}) <![CDATA[ <= ]]>
DATE_FORMAT(#{dateRangeRight}, #{format})
</if>
GROUP BY period
ORDER BY period ASC
</select>
<select id="tagStatisticsMonth" resultType="java.util.Map"
parameterType="java.util.Map">
SELECT * FROM (
SELECT
SUM( ktv.TAG_VALUE ) AS
datas,DATE_FORMAT(ktv_time.TAG_VALUE,'%Y-%m') AS date
FROM
knowledge_tag_value ktv
LEFT JOIN knowledge_tag_instance kti ON kti.SEQUENCE_NBR = ktv.INSTANCE_SEQ
LEFT JOIN knowledge_doc_content kdc ON kdc.SEQUENCE_NBR = kti.TARGET_SEQ
LEFT JOIN knowledge_tag_instance kti_time ON kti_time.TARGET_SEQ = kdc.SEQUENCE_NBR AND kti_time.TAG_NAME = '发生时间'
LEFT JOIN knowledge_tag_value ktv_time ON kti_time.SEQUENCE_NBR = ktv_time.INSTANCE_SEQ
WHERE
kti.TAG_NAME = #{tag} AND
ktv_time.TAG_VALUE BETWEEN #{startDate} AND #{endDate}
GROUP BY
DATE_FORMAT(ktv_time.TAG_VALUE,'%Y-%m')
UNION all
SELECT
0 AS datas,
DATE_FORMAT( @cdate := DATE_ADD( @cdate, INTERVAL + 1 MONTH ), '%Y-%m'
) date
FROM
( SELECT @cdate := DATE_ADD( DATE_SUB( #{startDate},
INTERVAL + 2 MONTH
), INTERVAL + 1 MONTH ) FROM knowledge_tag_value )
AS t1
WHERE
@cdate &lt; DATE_SUB( #{endDate} , INTERVAL + 0 MONTH )
) as
t2
GROUP BY date ASC
</select>
<select id="tagStatisticsYear" resultType="java.util.Map"
parameterType="java.util.Map">
SELECT * FROM (
SELECT
SUM( ktv.TAG_VALUE ) AS
datas,DATE_FORMAT(ktv_time.TAG_VALUE,'%Y') AS date
FROM
knowledge_tag_value ktv
LEFT JOIN knowledge_tag_instance kti ON kti.SEQUENCE_NBR = ktv.INSTANCE_SEQ
LEFT JOIN knowledge_doc_content kdc ON kdc.SEQUENCE_NBR = kti.TARGET_SEQ
LEFT JOIN knowledge_tag_instance kti_time ON kti_time.TARGET_SEQ = kdc.SEQUENCE_NBR AND kti_time.TAG_NAME = '发生时间'
LEFT JOIN knowledge_tag_value ktv_time ON kti_time.SEQUENCE_NBR = ktv_time.INSTANCE_SEQ
WHERE
kti.TAG_NAME = #{tag} AND
ktv_time.TAG_VALUE BETWEEN #{startDate} AND #{endDate}
GROUP BY
DATE_FORMAT(ktv_time.TAG_VALUE,'%Y')
UNION all
SELECT
0 AS datas,
DATE_FORMAT( @cdate := DATE_ADD( @cdate,
INTERVAL + 1 YEAR ), '%Y' ) date
FROM
( SELECT @cdate := DATE_ADD(
DATE_SUB( #{startDate}, INTERVAL + 2 YEAR
), INTERVAL + 1 YEAR ) FROM
knowledge_tag_value ) AS t1
WHERE
@cdate &lt; DATE_SUB( #{endDate} ,
INTERVAL + 0 YEAR )
) as t2
GROUP BY date ASC
</select>
<select id="docStatisticsMonth" resultType="java.util.Map"
parameterType="java.util.Map">
SELECT * FROM (
SELECT
COUNT(1) AS datas,DATE_FORMAT(ktv_time.TAG_VALUE,'%Y-%m')AS date
FROM
knowledge_doc_content kdc
LEFT JOIN knowledge_doc_category kdca ON kdca.SEQUENCE_NBR=kdc.DIRECTORY_ID
LEFT JOIN knowledge_tag_instance kti_time ON kti_time.TARGET_SEQ = kdc.SEQUENCE_NBR AND kti_time.TAG_NAME = '发生时间'
LEFT JOIN knowledge_tag_value ktv_time ON kti_time.SEQUENCE_NBR = ktv_time.INSTANCE_SEQ
WHERE
ktv_time.TAG_VALUE BETWEEN #{startDate} AND #{endDate}
<if test="categoryName != null and categoryName != ''">
AND kdca.CATEGORY_NAME=#{categoryName}
</if>
GROUP BY
DATE_FORMAT(ktv_time.TAG_VALUE,'%Y-%m')
UNION all
SELECT
0 AS datas,
DATE_FORMAT( @cdate := DATE_ADD( @cdate, INTERVAL + 1 MONTH ), '%Y-%m' ) date
FROM
( SELECT @cdate := DATE_ADD( DATE_SUB(#{startDate}, INTERVAL + 2 MONTH
), INTERVAL + 1 MONTH ) FROM knowledge_tag_value ) AS t1
WHERE
@cdate &lt; DATE_SUB(#{endDate}, INTERVAL + 0 MONTH )
) AS t2
GROUP BY date ASC
</select>
<select id="docStatisticsYear" resultType="java.util.Map"
parameterType="java.util.Map">
SELECT * FROM (
SELECT
COUNT(1) AS datas,DATE_FORMAT(ktv_time.TAG_VALUE,'%Y')AS date
FROM
knowledge_doc_content kdc
LEFT JOIN knowledge_doc_category kdca ON kdca.SEQUENCE_NBR=kdc.DIRECTORY_ID
LEFT JOIN knowledge_tag_instance kti_time ON kti_time.TARGET_SEQ = kdc.SEQUENCE_NBR AND kti_time.TAG_NAME = '发生时间'
LEFT JOIN knowledge_tag_value ktv_time ON kti_time.SEQUENCE_NBR = ktv_time.INSTANCE_SEQ
WHERE
ktv_time.TAG_VALUE BETWEEN #{startDate} AND #{endDate}
<if test="categoryName != null and categoryName != ''">
AND kdca.CATEGORY_NAME=#{categoryName}
</if>
GROUP BY
DATE_FORMAT(ktv_time.TAG_VALUE,'%Y')
UNION all
SELECT
0 AS datas,
DATE_FORMAT( @cdate := DATE_ADD( @cdate, INTERVAL + 1 MONTH ), '%Y') date
FROM
( SELECT @cdate := DATE_ADD( DATE_SUB(#{startDate}, INTERVAL + 2 MONTH
), INTERVAL + 1 MONTH ) FROM knowledge_tag_value ) AS t1
WHERE
@cdate &lt; DATE_SUB(#{endDate}, INTERVAL + 0 MONTH )
) AS t2
GROUP BY date ASC
</select>
<select id="tagChartStatistics" resultType="java.util.Map"
parameterType="java.util.Map">
SELECT
COUNT(1) AS datas,${splitSQL} AS level
FROM
knowledge_doc_content kdc
LEFT JOIN knowledge_tag_instance kti ON kti.TARGET_SEQ = kdc.SEQUENCE_NBR
LEFT JOIN knowledge_tag_value ktv ON kti.SEQUENCE_NBR = ktv.INSTANCE_SEQ
LEFT JOIN knowledge_tag_instance kti_time ON kti_time.TARGET_SEQ = kdc.SEQUENCE_NBR AND kti_time.TAG_NAME = '发生时间'
LEFT JOIN knowledge_tag_value ktv_time ON kti_time.SEQUENCE_NBR = ktv_time.INSTANCE_SEQ
WHERE
kti.TAG_NAME = #{tag} AND ktv_time.TAG_VALUE BETWEEN #{startDate} AND #{endDate}
GROUP BY
${splitSQL}
</select>
<select id="docChartStatistics" resultType="java.util.Map"
parameterType="java.util.Map">
SELECT
*
FROM
(SELECT
COUNT(1) AS datas,kdca.CATEGORY_NAME AS categoryName
FROM
knowledge_doc_category kdca
LEFT JOIN knowledge_doc_content kdc ON kdca.SEQUENCE_NBR=kdc.DIRECTORY_ID
LEFT JOIN knowledge_tag_instance kti_time ON kti_time.TARGET_SEQ = kdc.SEQUENCE_NBR AND kti_time.TAG_NAME = '发生时间'
LEFT JOIN knowledge_tag_value ktv_time ON kti_time.SEQUENCE_NBR = ktv_time.INSTANCE_SEQ
WHERE
ktv_time.TAG_VALUE BETWEEN #{startDate} AND #{endDate}
GROUP BY
kdca.CATEGORY_NAME
UNION ALL
SELECT
0,
kdca.CATEGORY_NAME AS categoryName
FROM knowledge_doc_category kdca
) T1
GROUP BY categoryName
</select>
<select id="tagTimeChartStatistics" resultType="java.util.Map"
parameterType="java.util.Map">
SELECT
COUNT(1) AS datas ,${splitSQL} AS level
FROM
(
SELECT
HOUR(IF(TIMEDIFF( ktv2.TAG_VALUE, ktv.TAG_VALUE ) &lt; 0,0,TIMEDIFF( ktv2.TAG_VALUE, ktv.TAG_VALUE ))) AS TAG_VALUE,
kdc.SEQUENCE_NBR
FROM
knowledge_doc_content kdc
LEFT JOIN knowledge_tag_instance kti ON kti.TARGET_SEQ = kdc.SEQUENCE_NBR
AND kti.TAG_NAME = '到场时间'
LEFT JOIN knowledge_tag_value ktv ON kti.SEQUENCE_NBR = ktv.INSTANCE_SEQ
LEFT JOIN knowledge_tag_instance kti2 ON kti2.TARGET_SEQ = kdc.SEQUENCE_NBR
AND kti2.TAG_NAME = '撤离时间'
LEFT JOIN knowledge_tag_value ktv2 ON kti2.SEQUENCE_NBR = ktv2.INSTANCE_SEQ
WHERE
ktv.TAG_VALUE IS NOT NULL
AND ktv2.TAG_VALUE IS NOT NULL
GROUP BY
kdc.SEQUENCE_NBR
) kdc
LEFT JOIN knowledge_tag_instance kti_time ON kti_time.TARGET_SEQ = kdc.SEQUENCE_NBR AND kti_time.TAG_NAME = '发生时间'
LEFT JOIN knowledge_tag_value ktv_time ON kti_time.SEQUENCE_NBR = ktv_time.INSTANCE_SEQ
WHERE
ktv_time.TAG_VALUE BETWEEN #{startDate} AND #{endDate}
GROUP BY
${splitSQL}
</select>
<select id="docBurnChartStatistics" resultType="java.util.Map"
parameterType="java.util.Map">
SELECT * FROM (
SELECT
COUNT( 1 ) AS datas,
SUBSTR( kti.TAG_NAME, 7) AS level
FROM
knowledge_tag_instance kti
LEFT JOIN knowledge_tag_instance kti_time ON kti_time.TARGET_SEQ = kti.TARGET_SEQ
AND kti_time.TAG_NAME = '发生时间'
LEFT JOIN knowledge_tag_value ktv_time ON kti_time.SEQUENCE_NBR = ktv_time.INSTANCE_SEQ
WHERE
( kti.TAG_NAME = '燃烧物质a类固体' OR kti.TAG_NAME = '燃烧物质b类液体' OR kti.TAG_NAME = '燃烧物质c类气体' OR kti.TAG_NAME = '燃烧物质d类金属' )
AND (ktv_time.TAG_VALUE BETWEEN #{startDate} AND #{endDate})
GROUP BY
kti.TAG_NAME
UNION ALL
SELECT
0,
SUBSTR( kti.TAG_NAME, 7) AS level
FROM knowledge_tag_instance kti
WHERE ( kti.TAG_NAME = '燃烧物质a类固体' OR kti.TAG_NAME = '燃烧物质b类液体' OR kti.TAG_NAME = '燃烧物质c类气体' OR kti.TAG_NAME = '燃烧物质d类金属' )
GROUP BY
kti.TAG_NAME) t1
GROUP BY
t1.level
</select>
</mapper>
......@@ -23,10 +23,7 @@
<artifactId>pagehelper</artifactId>
<version>5.1.10</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-security</artifactId>-->
<!-- </dependency>-->
</dependencies>
<build>
<plugins>
......
......@@ -64,9 +64,4 @@ latentDanger.feign.name=AMOS-LATENT-DANGER
Knowledgebase.fegin.name=AMOS-API-KNOWLEDGEBASE
## 消防救援保障部ID
fire-rescue=1432549862557130753
endpoints.enabled = false
management.security.enabled=true
security.user.name=admin
security.user.password=admin
management.endpoints.enabled-by-default=false
......@@ -1104,4 +1104,16 @@ WHERE
AND deleted = 0
)
</select>
<select id="selectByIdandBizId" resultType="string">
SELECT
pc.plan_task_id as taskId
FROM
p_latent_danger p
LEFT JOIN p_check_input pci ON pci.id = p.biz_id
LEFT JOIN p_check pc ON pci.check_id = pc.id
WHERE
p.id = #{id} and p.biz_id = #{bizId}
</select>
</mapper>
\ No newline at end of file
......@@ -13,10 +13,7 @@
<artifactId>amos-boot-module-maintenance-biz</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
......
......@@ -67,8 +67,4 @@ eureka.instance.metadata-map.management.context-path=${server.servlet.context-pa
eureka.instance.status-page-url-path=/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/swagger-ui.html
endpoints.enabled = false
management.security.enabled=true
security.user.name=admin
security.user.password=admin
management.endpoints.enabled-by-default=false
\ No newline at end of file
......@@ -238,7 +238,7 @@
</if>
<choose>
<when test="identityType==1">
And (a.orgCode LIKE CONCAT( #{orgCode}, '-%' ) or a.orgCode= #{orgCode} )
And (a.orgCode LIKE CONCAT( #{orgCode}, '%' ) or a.orgCode= #{orgCode} )
<if test="companyId != null and companyId != ''"> and a.owner_id = #{companyId}</if>
</when>
<when test="identityType==2">
......
......@@ -16,10 +16,7 @@
<artifactId>amos-boot-module-patrol-biz</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
......
......@@ -58,8 +58,4 @@ rule.definition.default-agency=STATE_GRID
jcs.fegin.name=JCS
emergency.command.section.id=1418223840361709569
endpoints.enabled = false
management.security.enabled=true
security.user.name=admin
security.user.password=admin
management.endpoints.enabled-by-default=false
......@@ -898,6 +898,9 @@
<if test="latentDangerListParam.dangerName != null and latentDangerListParam.dangerName !=''">
AND pld.danger_name LIKE concat('%',#{latentDangerListParam.dangerName},'%')
</if>
<if test="latentDangerListParam.belongType != null and latentDangerListParam.belongType == 1">
AND pld.discoverer_user_id =#{latentDangerListParam.userId}
</if>
<if test="latentDangerListParam.dangerId != null and latentDangerListParam.dangerId !=''">
and pld.id=#{latentDangerListParam.dangerId}
</if>
......
......@@ -127,8 +127,9 @@
</delete>
<select id="getByDangerId" resultType="com.yeejoin.amos.patrol.business.entity.mybatis.extend.LatentDangerPatrolBo">
select
a.*,
select
pci.check_id,
pci.input_id,
b.name as itemName,
b.original_id as itemOriginalId,
b.basis_json as itemBasis,
......@@ -139,32 +140,38 @@
c.charge_dept_id as pointDepartMentId,
c.original_id as pointOriginalId,
d.name as routeName,
e.check_time as checkTime,
e.user_id as checkUserId,
e.dep_id as checkDepartmentId,
pc.check_time as checkTime,
pc.user_id as checkUserId,
pc.dep_id as checkDepartmentId,
f.name as planName,
f.plan_type as planType,
f.execute_rate as executeRate,
g.original_id as classifyOriginalId,
g.name as classifyName
from
p_latent_danger_patrol as a
left join
p_input_item as b on a.item_id = b.id
p_latent_danger as a
LEFT JOIN p_check_input pci ON pci.id = a.biz_id
LEFT JOIN p_check pc ON pci.check_id = pc.id
left join
p_point as c on a.point_id = c.id
p_input_item as b on pci.input_id = b.id
left join
p_route as d on a.route_id = d.id
p_point as c on pc.point_id = c.id
left join
p_check as e on a.check_id = e.id
p_route as d on pc.route_id = d.id
left join
p_plan as f on e.plan_id = f.id
p_plan as f on pc.plan_id = f.id
left join
p_point_classify as g on a.point_classify_id = g.id
p_point_classify as g on pc.point_id= g.point_id
where
a.deleted = 0
and
a.latent_danger_id = #{dangerId}
a.id= #{dangerId}
</select>
<select id="listByMap" resultType="com.yeejoin.amos.patrol.business.entity.mybatis.extend.LatentDangerPatrolBo">
......
......@@ -45,7 +45,7 @@
<if test="isFixed!=null">and b.is_fixed = #{isFixed}</if>
<if test="isOK!=null">and a.is_OK = #{isOK}</if>
<if test="planId!=null">and a.plan_Id = #{planId}</if>
<if test="planTaskId!=null">and a.plan_task_detail_id = #{planTaskId}</if>
<if test="planTaskId!=null">and a.plan_task_id = #{planTaskId}</if>
<if test="userId!=null">and find_in_set(#{userId}, a.user_id) > 0</if>
<if test="routeId!=null">and a.route_Id = #{routeId}</if>
<if test="catalogId!=null">and b.Catalog_Id = #{catalogId}</if>
......@@ -120,7 +120,7 @@
<if test="isFixed!=null">and b.is_fixed = #{isFixed}</if>
<if test="isOK!=null">and a.is_OK = #{isOK}</if>
<if test="planId!=null">and a.plan_Id = #{planId}</if>
<if test="planTaskId!=null">and a.plan_task_detail_id = #{planTaskId}</if>
<if test="planTaskId!=null">and a.plan_task_id = #{planTaskId}</if>
<if test="userId!=null">and find_in_set(#{userId}, a.user_id) > 0</if>
<if test="routeId!=null">and a.route_Id = #{routeId}</if>
<if test="catalogId!=null">and b.Catalog_Id = #{catalogId}</if>
......
......@@ -18,6 +18,12 @@
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-precontrol-biz</artifactId>
<version>${amos-biz-boot.version}</version>
<exclusions>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
......
......@@ -33,10 +33,7 @@
<groupId>cn.jpush.api</groupId>
<artifactId>jpush-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
......
......@@ -73,8 +73,4 @@ eureka.instance.metadata-map.management.context-path=${server.servlet.context-pa
eureka.instance.status-page-url-path=/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/swagger-ui.html
endpoints.enabled = false
management.security.enabled=true
security.user.name=admin
security.user.password=admin
management.endpoints.enabled-by-default=false
\ No newline at end of file
......@@ -405,7 +405,9 @@
<if test="companyId != null and companyId != ''">and ppn.original_id = #{companyId}</if>
<if test="taskType != null and taskType != ''">and ppn.check_type_id = #{taskType}</if>
<if test="planTaskId != null and planTaskId > 0 ">and ptd.task_no = #{planTaskId}</if>
<if test="orderBy != null and orderBy != ''">order by ${orderBy}</if>
<!-- <if test="orderBy != null and orderBy != ''">order by ${orderBy}</if>-->
order by p.id
<if test="offset != null and pageSize != null">
limit #{offset},#{pageSize}
</if>
......
......@@ -34,4 +34,9 @@
WHERE
pptd.id = a.id
</update>
<select id="selectById" resultType="com.yeejoin.amos.supervision.dao.entity.PlanTask">
SELECT * FROM p_plan_task where id = #{id}
</select>
</mapper>
\ No newline at end of file
......@@ -22,5 +22,12 @@
<artifactId>jpush-client</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
......@@ -28,6 +28,7 @@
<amos.version>1.7.8</amos.version>
<rule.version>1.7.9-SNAPSHOT</rule.version>
<itext.version>7.1.1</itext.version>
<elasticsearch.version>7.15.2</elasticsearch.version>
</properties>
<dependencies>
......@@ -215,7 +216,7 @@
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-feign-systemctl</artifactId>
<version>1.6.5</version>
<version>1.7.8</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
......@@ -243,7 +244,7 @@
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-rule</artifactId>
<version>${rule.version}</version>
<version>1.7.9-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
......
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