Commit 680ae113 authored by KeYong's avatar KeYong

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

parents 5c9d1dc1 67c12c5a
......@@ -79,11 +79,11 @@ public class KeySiteExcleDto implements Serializable {
private String keyPreventionReason;
@ExcelProperty(value = "消防设施情况", index = 8)
@ExplicitConstraint(indexNum=11,source = {"有","无"})
@ApiModelProperty(value = "消防设施情况")
private String fireFacilitiesInfo;
@ExcelProperty(value = "防火标志设立情况", index = 9)
@ExplicitConstraint(indexNum=9,source = {"有","无"})
@ApiModelProperty(value = "防火标志设立情况")
private String firePreventionFlagName;
......
package com.yeejoin.equipmanage.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.equipmanage.common.utils.*;
import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author Jianqiang Gao
* @title: DCenterController
* <pre>
* @description: 设备告警
* </pre>
* @date 2022/11/15 09:54
*/
@RestController
@Api(tags = "总部直流中心监管页面Api")
@RequestMapping(value = "/dc-center", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class DCenterController extends AbstractBaseController {
@Autowired
IEquipmentSpecificAlarmService iEquipmentSpecificAlarmService;
/**
* 直流中心告警列表分页,用于直流中心大数据查询分页,不建议再扩展联表查询
*
*/
@RequestMapping(value = "/list", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", produces = "application/json;charset=UTF-8", notes = "列表分页查询")
public ResponseModel listPage(@RequestParam(value = "alarmType", required = false) String alarmType,
CommonPageable commonPageable) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
List<CommonRequest> queryRequests = new ArrayList<>();
CommonRequest request = new CommonRequest();
request.setName("alarmType");
request.setValue(StringUtil.isNotEmpty(alarmType) ? StringUtils.trimToNull(alarmType) : null);
queryRequests.add(request);
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
Page<Map<String, Object>> list = iEquipmentSpecificAlarmService.zlzxListPage(param);
return CommonResponseUtil.success(list);
}
}
......@@ -140,6 +140,8 @@ public interface EquipmentSpecificAlarmMapper extends BaseMapper<EquipmentSpecif
Page<Map<String, Object>> page(Page page, @Param("param") CommonPageInfoParam param);
Page<Map<String, Object>> zlzxPage(Page page, @Param("param") CommonPageInfoParam param);
Page<Map<String, Object>> pageQuery(Page page, @Param("param") CommonPageInfoParam param);
......
......@@ -31,6 +31,8 @@ public interface IEquipmentSpecificAlarmService extends IService<EquipmentSpecif
Page<Map<String, Object>> listPage(CommonPageInfoParam param);
Page<Map<String, Object>> zlzxListPage(CommonPageInfoParam param);
Page<Map<String, Object>> pageQuery(CommonPageInfoParam param);
void handleExport(HttpServletResponse response, List<Long> ids, String alarmType);
......
......@@ -206,6 +206,27 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
}
@Override
public Page<Map<String, Object>> zlzxListPage(CommonPageInfoParam param) {
Page result = new Page<>(param.getPageNumber(), param.getPageSize());
if (AlarmTypeEnum.GZGJ.getCode().equals(param.getAlarmType())) {
param.setAlarmType("");
param.setIsFireAlarm("false");
}
Page<Map<String, Object>> resultPage = this.baseMapper.zlzxPage(result, param);
if (resultPage.getTotal() > 0) {
for (Map<String, Object> x : resultPage.getRecords()) {
if (ObjectUtils.isEmpty(x.get("handleType"))) {
x.put("handleType", null);
} else {
String handleType = ConfirmAlamEnum.getTypeByCode(String.valueOf(x.get("handleType")));
x.put("handleType", StringUtil.isNotEmpty(handleType) ? handleType : signalClassifyService.getTypeNameByCode(String.valueOf(x.get("handleType"))).getTypeName());
}
}
}
return resultPage;
}
@Override
public Page<Map<String, Object>> pageQuery(CommonPageInfoParam param) {
Page result = new Page<>(param.getPageNumber(), param.getPageSize());
return this.baseMapper.pageQuery(result, param);
......
......@@ -263,6 +263,37 @@
ORDER BY wlesal.create_date DESC
</select>
<select id="zlzxPage" resultType="java.util.HashMap">
SELECT
wlesal.id,
wlesal.equipment_specific_id AS equipmentSpecificId,
concat(wlesal.equipment_specific_name,wlesal.equipment_specific_index_name) as alamContent,
if(wlesal.confirm_type is null,'未处理','已处理') handleStatus,
IF (
wlesal.clean_time IS NOT NULL,
'已消除',
'未消除'
) cleanStatus,
confirm_type as handleType,
wlesal.type AS typeCode,
(select type_name from wl_signal_classify sc where sc.type_code = wlesal.type limit 1) as type,
date_format(
wlesal.create_date,
'%Y-%m-%d %H:%i:%s'
) createDate,
wlesal.equipment_specific_name as equipmentSpecificName,
wles.position,
wles.biz_org_code AS bizOrgCode,
wles.biz_org_name AS bizOrgName
FROM wl_equipment_specific_alarm_log wlesal
LEFT JOIN wl_equipment_specific wles ON wlesal.equipment_specific_id = wles.id
<where>
<if test="param.alarmType == 'BREAKDOWN'">AND wlesal.type = #{param.alarmType}</if>
<if test="param.alarmType == 'FIREALARM'">AND wlesal.type = #{param.alarmType}</if>
<if test="param.isFireAlarm == 'false'">AND wlesal.type != 'FIREALARM'</if>
</where>
ORDER BY wlesal.create_date DESC
</select>
<select id="pageQuery" resultType="java.util.HashMap">
SELECT
`wlesal`.`equipment_specific_alarm_id` AS `id`,
......
......@@ -76,6 +76,7 @@
WHERE
pi.point_id = #{pointId}
AND IF(prp.id, NOT FIND_IN_SET(pi.id,IFNULL(prp.exclude_items,'')),' 1=1 ')
GROUP BY pi.id
ORDER BY
pi.order_no
</select>
......@@ -384,7 +385,9 @@
ppc.id,
ppc.point_id pointId,
ppc.`name`,
ppc.order_no orderNo
ppc.order_no orderNo,
ppc.equipment_id equipmentId,
ppc.data_source_code dataSourceCode
FROM
`p_route_point_item` prpi
LEFT JOIN p_route_point prp ON prp.id = prpi.route_point_id
......
......@@ -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