Commit e81a15ac authored by litengwei's avatar litengwei

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

parents d01b084c de447b8b
......@@ -362,6 +362,7 @@ public class EquipmentSpecificController extends AbstractBaseController {
}
@GetMapping(value = "/index/normal")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询非告警指标list", notes = "查询非告警指标list")
public ResponseModel normalIndexInfoList(@RequestParam(required = false) String startDate,
@RequestParam(required = false) String endDate){
......@@ -369,6 +370,7 @@ public class EquipmentSpecificController extends AbstractBaseController {
}
@GetMapping(value = "/info/fire")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询火报系统指标", notes = "查询火报系统指标")
public ResponseModel getFireAutoSysInfo(@RequestParam(required = false) String startDate,
@RequestParam(required = false) String endDate){
......@@ -376,6 +378,7 @@ public class EquipmentSpecificController extends AbstractBaseController {
}
@GetMapping(value = "/info/paomo")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询泡沫系统指标", notes = "查询泡沫系统指标")
public ResponseModel getPaomoSysInfo(@RequestParam(required = false) String startDate,
@RequestParam(required = false) String endDate){
......@@ -383,6 +386,7 @@ public class EquipmentSpecificController extends AbstractBaseController {
}
@GetMapping(value = "/info/water")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询给水系统指标", notes = "查询给水系统指标")
public ResponseModel getWaterSysInfo(@RequestParam(required = false) String startDate,
@RequestParam(required = false) String endDate){
......
......@@ -891,4 +891,15 @@ public class FireFightingSystemController extends AbstractBaseController {
public Object getSystemInfoList() throws Exception {
return fireFightingSystemService.getSystemInfoList();
}
/**
* 获取消防系统告警状态信息
* @throws Exception
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取消防系统告警状态信息", notes = "获取消防系统告警状态信息")
@GetMapping(value = "/alarm/num")
public Object getSystemAlarmInfoList(@RequestParam(required = false) String startDate, @RequestParam(required = false) String endDate) throws Exception {
return fireFightingSystemService.getSystemAlarmInfoList(startDate, endDate);
}
}
......@@ -231,7 +231,7 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
Integer getAllEquipNum(@Param("bizOrgCode") String bizOrgCode);
Map<String, Object> normalIndexInfoList(@Param("startDate") String startDate, @Param("endDate") String endDate);
List<Map<String, Object>> normalIndexInfoList(@Param("startDate") String startDate, @Param("endDate") String endDate);
Map<String, Object> getFireAutoSysInfo();
......
......@@ -615,4 +615,6 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
List<Map<String, Integer>> getStockEquipStatistics(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getSystemInfoList();
List<Map<String, Object>> getSystemAlarmInfoList(@Param("startDate") String startDate, @Param("endDate") String endDate);
}
......@@ -237,7 +237,7 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
*/
List<IotIndexInfoVo> getIndexInfoList(String iotCode, ResponseModel entity, Integer isTrend, String fieldKey);
Map<String, Object> normalIndexInfoList(String startDate, String endDate);
List<Map<String, Object>> normalIndexInfoList(String startDate, String endDate);
Map<String, Object> getFireAutoSysInfo(String startDate, String endDate);
......
......@@ -291,4 +291,6 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
List<Map<String, Integer>> getStockEquipStatistics(String bizOrgCode);
List<Map<String, Object>> getSystemInfoList();
List<Map<String, Object>> getSystemAlarmInfoList(String startDate, String endDate);
}
......@@ -1893,8 +1893,26 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
}
@Override
public Map<String, Object> normalIndexInfoList(String startDate, String endDate) {
return equipmentSpecificMapper.normalIndexInfoList(startDate, endDate);
public List<Map<String, Object>> normalIndexInfoList(String startDate, String endDate) {
List<Map<String, Object>> list = equipmentSpecificMapper.normalIndexInfoList(startDate, endDate);
List<Map<String, Object>> results = new ArrayList<>();
if (0 < list.size()) {
int i = 0;
for (Map<String, Object> map : list) {
Map<String, Object> map1 = new HashMap<>();
map1.put("key", i + 1);
map1.put("sb", map.get("equipName"));
map1.put("cs", map.get("equipmentIndexName"));
map1.put("zz", map.get("value"));
map1.put("yz", map.get("standardValue"));
map1.put("sj", map.get("time"));
map1.put("zrr", map.get("chargePersonName"));
map1.put("szqy", map.get("areaName"));
map1.put("ssxt", map.get("fightSysName"));
results.add(map1);
}
}
return results;
}
@Override
......
......@@ -35,6 +35,7 @@ import com.yeejoin.equipmanage.remote.RemoteSecurityService;
import com.yeejoin.equipmanage.service.*;
import org.apache.commons.beanutils.BeanUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
......@@ -2021,6 +2022,22 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override
public List<Map<String, Object>> getSystemInfoList() {
return fireFightingSystemMapper.getSystemInfoList();
List<Map<String, Object>> list = fireFightingSystemMapper.getSystemInfoList();
if (0 < list.size()) {
list.forEach(x -> {
List<Map<String, Object>> list1 = new ArrayList();
Map<String, Object> map = new HashMap<>();
map.put("name", x.get("status"));
map.put("level", "success");
list1.add(map);
x.put("status", list1);
});
}
return list;
}
@Override
public List<Map<String, Object>> getSystemAlarmInfoList(String startDate, String endDate) {
return fireFightingSystemMapper.getSystemAlarmInfoList(startDate, endDate);
}
}
......@@ -5174,10 +5174,10 @@
</select>
<select id="getSystemInfoList" resultType="java.util.Map">
SELECT
fs.id,
fs.id AS `key`,
fs.`code`,
fs.`name`,
fs.system_type_code as 'sysTypeCode',
fs.system_type_code AS systemTypeCode,
CASE WHEN (SELECT
count(1)
FROM
......@@ -5188,5 +5188,32 @@
END as 'status'
FROM
f_fire_fighting_system fs
where system_type_code IS NOT NULL
</select>
<select id="getSystemAlarmInfoList" resultType="java.util.Map">
SELECT
`fs`.`id` AS `id`,
`fs`.`code` AS `code`,
`fs`.`name` AS `name`,
(
SELECT
count( 1 )
FROM
`wl_equipment_specific_alarm_log`
WHERE
`wl_equipment_specific_alarm_log`.`status` = 1
AND
0 <![CDATA[<>]]> find_in_set(`fs`.`id`, `wl_equipment_specific_alarm_log`.`system_ids`)
<if test="startDate!=null">
AND DATE_FORMAT(`wl_equipment_specific_alarm_log`.update_date,'%y-%m-%d') <![CDATA[>=]]> DATE_FORMAT(#{startDate},'%y-%m-%d')
</if>
<if test="endDate!=null">
AND DATE_FORMAT(`wl_equipment_specific_alarm_log`.update_date,'%y-%m-%d') <![CDATA[<=]]> DATE_FORMAT(#{endDate},'%y-%m-%d')
</if>
) AS `value`
FROM
`f_fire_fighting_system` `fs`
-- where
-- fs.system_type_code IS NOT NULL
</select>
</mapper>
......@@ -38,4 +38,10 @@ public class SubmitRecord {
@ApiModelProperty(value = "校验批次号")
private String batchNo;
@ApiModelProperty(value = "是否草稿 0: 草稿 1:提交")
private int draft;
@ApiModelProperty(value = "文件id")
private Long fileId;
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tdc.api.service;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.tdc.api.entity.ModelItem;
import com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.springframework.stereotype.Service;
......@@ -14,9 +15,9 @@ import java.util.Map;
@Service
public interface ModelItemService {
void saveModelItem(JSONObject jsonObject, AgencyUserModel userInfo);
SubmitRecord saveModelItem(JSONObject jsonObject, AgencyUserModel userInfo, int draft);
void editModelItem(JSONObject jsonObject, AgencyUserModel userInfo);
SubmitRecord editModelItem(JSONObject jsonObject, AgencyUserModel userInfo, int draft, Long id);
/**
* 获取详情接口
......
......@@ -6,6 +6,8 @@ import com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord;
import com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author xxz
*/
......@@ -15,6 +17,9 @@ public interface SubmitRecordService {
int saveSubmitRecord(SubmitRecord submitRecord);
SubmitRecord updateById(Long sequenceNbr, String batchNo);
SubmitRecord updateById(Long sequenceNbr, String batchNo, int draft);
List<SubmitRecord> selectRecord();
void saveFileId(Long id, Long fileId);
}
......@@ -47,6 +47,8 @@
batch_no
FROM
tdc_submit_record
WHERE
draft = 1
ORDER BY
submit_time DESC
LIMIT 1
......@@ -68,8 +70,8 @@
batch_no
FROM
tdc_submit_record
-- WHERE
-- amos_org_code = '50*110'
WHERE
draft = 1
ORDER BY
submit_time DESC
LIMIT 1
......
......@@ -14,6 +14,7 @@
tdc_submit_record
WHERE
amos_org_code = #{orgCode}
AND draft = 1
ORDER BY
submit_time DESC
LIMIT 1
......
......@@ -3,6 +3,6 @@
<mapper namespace="com.yeejoin.amos.boot.module.tdc.api.mapper.SubmitRecordMapper">
<select id="selectByOrgCode" resultType="com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord">
SELECT sequence_nbr,submit_people,submit_time,amos_org_name FROM `tdc_submit_record`
SELECT sequence_nbr,submit_people,submit_time,amos_org_name FROM `tdc_submit_record` order by submit_time desc
</select>
</mapper>
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tdc.biz.controller;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord;
import com.yeejoin.amos.boot.module.tdc.api.service.ModelItemService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api;
......@@ -32,18 +33,16 @@ public class ModelItemController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@PostMapping(value = "/saveModelItem")
@ApiOperation(httpMethod = "POST", value = "保存模型项", notes = "保存模型项")
public ResponseModel saveModelItem(@RequestBody JSONObject jsonObject){
public ResponseModel<SubmitRecord> saveModelItem(@RequestParam(value = "id", required = false) Long id, @RequestParam(value = "draft") int draft, @RequestBody JSONObject jsonObject){
AgencyUserModel userInfo = getUserInfo();
if (ObjectUtils.isEmpty(jsonObject)) {
return null;
}
Object sequenceNbr = jsonObject.get("sequenceNbr");
if (ObjectUtils.isEmpty(sequenceNbr)) {
modelItemService.saveModelItem(jsonObject, userInfo);
return ResponseHelper.buildResponse(true);
if (ObjectUtils.isEmpty(sequenceNbr) && ObjectUtils.isEmpty(id)) {
return ResponseHelper.buildResponse(modelItemService.saveModelItem(jsonObject, userInfo, draft));
}
modelItemService.editModelItem(jsonObject, userInfo);
return ResponseHelper.buildResponse(true);
return ResponseHelper.buildResponse(modelItemService.editModelItem(jsonObject, userInfo, draft, id));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
......
......@@ -13,6 +13,8 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
/**
* 校验记录
* @author xxz
......@@ -30,4 +32,19 @@ public class SubmitRecordController {
public ResponseModel<IPage<SubmitRecord>> selectByOrgCode(int current,int size){
return ResponseHelper.buildResponse(submitRecordService.selectByOrgCode(current, size));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "selectRecord")
@ApiOperation(httpMethod = "GET",value = "查询记录top20", notes = "查询记录top20")
public ResponseModel<List<SubmitRecord>> selectRecord(){
return ResponseHelper.buildResponse(submitRecordService.selectRecord());
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "saveFileId")
@ApiOperation(httpMethod = "GET",value = "保存文件id", notes = "保存文件id")
public ResponseModel saveFileId(@RequestParam(value = "id") Long id, @RequestParam(value = "fileId") Long fileId){
submitRecordService.saveFileId(id, fileId);
return ResponseHelper.buildResponse(true);
}
}
\ No newline at end of file
......@@ -47,10 +47,10 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
ModelItemMapper modelItemMapper;
@Override
public void saveModelItem(JSONObject jsonObject, AgencyUserModel userInfo) {
public SubmitRecord saveModelItem(JSONObject jsonObject, AgencyUserModel userInfo, int draft) {
long start = System.currentTimeMillis();
if (ObjectUtils.isEmpty(jsonObject)) {
return;
return null;
}
SubmitRecord submitRecord = new SubmitRecord();
userInfo.getUserName();
......@@ -62,6 +62,7 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
submitRecord.setAmosOrgCode(orgCode);
submitRecord.setAmosOrgName(companyName);
}
submitRecord.setDraft(draft);
submitRecord.setSubmitPeople(userInfo.getRealName());
submitRecord.setSubmitTime(new Date());
String batchNo = UUID.randomUUID().toString();
......@@ -72,7 +73,7 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
long end = System.currentTimeMillis();
log.error("=====记录入库用时:"+(end-start1)+"======");
if (StringUtils.isEmpty(submitRecord.getSequenceNbr())) {
return;
return null;
}
List<ModelItem> collect = jsonObject.entrySet().stream().map(e -> {
......@@ -84,7 +85,11 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
modelItem.setCheckItemLabel(s[1]);
}
String value = String.valueOf(e.getValue());
modelItem.setCheckItemValue(value);
if (!ObjectUtils.isEmpty(value.split("_")) && value.split("_").length > 1) {
modelItem.setCheckItemValue(value.split("_")[2]);
} else {
modelItem.setCheckItemValue(value);
}
modelItem.setSubmitRecordId(submitRecord.getSequenceNbr());
return modelItem;
}).collect(Collectors.toList());
......@@ -98,18 +103,21 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
log.error("=====入库用时:"+(e2-e1)+"======");
// 异步请求规则校验
syncMethodService.checkItem(itemValue, submitRecord);
if (draft == 1) {
syncMethodService.checkItem(itemValue, submitRecord);
}
return submitRecord;
}
@Override
public void editModelItem(JSONObject jsonObject, AgencyUserModel userInfo) {
public SubmitRecord editModelItem(JSONObject jsonObject, AgencyUserModel userInfo, int draft, Long id) {
Long sequenceNbr = Long.valueOf(String.valueOf(jsonObject.get("sequenceNbr")));
Long sequenceNbr = ObjectUtils.isEmpty(jsonObject.get("sequenceNbr")) ? null : Long.valueOf(String.valueOf(jsonObject.get("sequenceNbr")));
String batchNo = UUID.randomUUID().toString();
SubmitRecord submitRecord = submitRecordService.updateById(sequenceNbr, batchNo);
Long sequenceNbrId = ObjectUtils.isEmpty(sequenceNbr) ? id : sequenceNbr;
SubmitRecord submitRecord = submitRecordService.updateById(sequenceNbrId, batchNo, draft);
LambdaQueryWrapper<ModelItem> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ModelItem::getSubmitRecordId, sequenceNbr);
wrapper.eq(ModelItem::getSubmitRecordId, sequenceNbrId);
this.baseMapper.delete(wrapper);
List<ModelItem> collect = jsonObject.entrySet().stream().map(e -> {
......@@ -130,8 +138,11 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
this.saveOrUpdateBatch(collect);
// 异步请求规则校验
Map<String, List<ModelItem>> itemValue = collect.stream().collect(Collectors.groupingBy(ModelItem::getModelName));
syncMethodService.checkItem(itemValue, submitRecord);
if (draft == 1) {
Map<String, List<ModelItem>> itemValue = collect.stream().collect(Collectors.groupingBy(ModelItem::getModelName));
syncMethodService.checkItem(itemValue, submitRecord);
}
return submitRecord;
}
......
package com.yeejoin.amos.boot.module.tdc.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -10,6 +12,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.Date;
import java.util.List;
/**
* @author DELL
......@@ -32,10 +37,29 @@ public class SubmitRecordServiceImpl extends ServiceImpl<SubmitRecordMapper, Sub
}
@Override
public SubmitRecord updateById(Long sequenceNbr, String batchNo) {
public SubmitRecord updateById(Long sequenceNbr, String batchNo, int draft) {
SubmitRecord submitRecord = this.getById(sequenceNbr);
submitRecord.setBatchNo(batchNo);
submitRecord.setDraft(draft);
submitRecord.setSubmitTime(new Date());
this.updateById(submitRecord);
return submitRecord;
}
@Override
public List<SubmitRecord> selectRecord() {
LambdaQueryWrapper<SubmitRecord> wrapper = new LambdaQueryWrapper<>();
// wrapper.eq(SubmitRecord::getDraft,1);
wrapper.orderByDesc(SubmitRecord::getSubmitTime);
wrapper.last(" limit 20");
return this.baseMapper.selectList(wrapper);
}
@Override
public void saveFileId(Long id, Long fileId) {
LambdaUpdateWrapper<SubmitRecord> wrapper = new LambdaUpdateWrapper<>();
wrapper.set(SubmitRecord::getFileId, fileId);
wrapper.set(SubmitRecord::getSequenceNbr, id);
this.update(wrapper);
}
}
......@@ -40,7 +40,7 @@ public class SyncMethodServiceImpl implements SyncMethodService {
// 调用规则校验模型
try {
// 没有配决策流,processIds传null即可
String packageId = "三维校验/" + key;
String packageId = "数据填报/" + key;
ruleTrigger.publish(idxProjectModel, packageId, null);
} catch (Exception e) {
e.printStackTrace();
......
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