Commit 7ac2c864 authored by suhuiguang's avatar suhuiguang

Merge branch 'develop_dl_plan6' into develop_dl_plan6_temp

parents b69a9085 e23dfeeb
...@@ -5,7 +5,6 @@ import com.alibaba.excel.annotation.ExcelProperty; ...@@ -5,7 +5,6 @@ import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto; import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.common.api.excel.CommonExplicitConstraint; import com.yeejoin.amos.boot.module.common.api.excel.CommonExplicitConstraint;
import com.yeejoin.amos.boot.module.common.api.excel.ExplicitConstraint; import com.yeejoin.amos.boot.module.common.api.excel.ExplicitConstraint;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
...@@ -13,10 +12,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -13,10 +12,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.util.ObjectUtils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -97,13 +93,13 @@ public class WaterResourceDto extends BaseDto { ...@@ -97,13 +93,13 @@ public class WaterResourceDto extends BaseDto {
@ApiModelProperty(value = "建造日期") @ApiModelProperty(value = "建造日期")
@DateTimeFormat(pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
private String buildDate; private Date buildDate;
@ExcelProperty(value = "启用日期", index = 8) @ExcelProperty(value = "启用日期", index = 8)
@ApiModelProperty(value = "启用日期") @ApiModelProperty(value = "启用日期")
@DateTimeFormat(pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
private String enableDate; private Date enableDate;
@ExcelIgnore @ExcelIgnore
@ApiModelProperty(value = "方位图集合") @ApiModelProperty(value = "方位图集合")
......
...@@ -2,10 +2,7 @@ package com.yeejoin.amos.boot.module.common.api.mapper; ...@@ -2,10 +2,7 @@ package com.yeejoin.amos.boot.module.common.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.RequestData; import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceDto;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceTypeDto;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceZhDto;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResource; import com.yeejoin.amos.boot.module.common.api.entity.WaterResource;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -21,7 +18,7 @@ import java.util.Map; ...@@ -21,7 +18,7 @@ import java.util.Map;
*/ */
public interface WaterResourceMapper extends BaseMapper<WaterResource> { public interface WaterResourceMapper extends BaseMapper<WaterResource> {
List<WaterResourceDto> exportToExcel(@Param("isDelete")Boolean isDelete,@Param("name")String name, @Param("resourceType")String resourceType, @Param("bizOrgCode")String bizOrgCode); List<WaterResourceForExportDto> exportToExcel(@Param("isDelete")Boolean isDelete, @Param("name")String name, @Param("resourceType")String resourceType, @Param("bizOrgCode")String bizOrgCode);
/*** /***
......
...@@ -652,7 +652,7 @@ WHERE ...@@ -652,7 +652,7 @@ WHERE
ou.sequence_nbr as id, ou.sequence_nbr as id,
ou.biz_org_name as userName, ou.biz_org_name as userName,
IFNULL( MAX( CASE WHEN cfi.field_code = 'telephone' THEN field_value END ), '' ) AS telephone, IFNULL( MAX( CASE WHEN cfi.field_code = 'telephone' THEN field_value END ), '' ) AS telephone,
IFNULL( MAX( CASE WHEN cfi.field_code = 'postTypeName' THEN field_value END ), '' ) AS postTypeName, IF(MAX( CASE WHEN cfi.field_code = 'postTypeName' THEN field_value END ) = '', NULL, MAX( CASE WHEN cfi.field_code = 'postTypeName' THEN field_value END )) AS postTypeName,
IFNULL( MAX( CASE WHEN cfi.field_code = 'personImg' THEN field_value END ), '' ) AS personImg, IFNULL( MAX( CASE WHEN cfi.field_code = 'personImg' THEN field_value END ), '' ) AS personImg,
IFNULL( MAX( CASE WHEN cfi.field_code = 'peopleType' THEN field_value END ), '' ) AS peopleType IFNULL( MAX( CASE WHEN cfi.field_code = 'peopleType' THEN field_value END ), '' ) AS peopleType
FROM FROM
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.common.api.mapper.WaterResourceMapper"> <mapper namespace="com.yeejoin.amos.boot.module.common.api.mapper.WaterResourceMapper">
<!--BUG 2919 消防水源导出没有设施定义 分类名称 设施编码 维保周期 by kongfm 2021-09-16 --> <!--BUG 2919 消防水源导出没有设施定义 分类名称 设施编码 维保周期 by kongfm 2021-09-16 -->
<select id="exportToExcel" resultType="com.yeejoin.amos.boot.module.common.api.dto.WaterResourceDto"> <select id="exportToExcel" resultType="com.yeejoin.amos.boot.module.common.api.dto.WaterResourceForExportDto">
select r.name, select r.name,
r.address, r.address,
r.resource_type_name, r.resource_type_name,
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
r.belong_fighting_system, r.belong_fighting_system,
r.management_unit, r.management_unit,
r.maintenance_unit, r.maintenance_unit,
r.build_date, date_format(r.build_date, '%Y-%m-%d') AS buildDate,
r.enable_date, date_format(r.enable_date, '%Y-%m-%d') AS enableDate,
r.orientation_img, r.orientation_img,
r.reality_img, r.reality_img,
r.contact_user, r.contact_user,
......
...@@ -10,14 +10,7 @@ import com.yeejoin.amos.boot.biz.common.constants.BizConstant; ...@@ -10,14 +10,7 @@ import com.yeejoin.amos.boot.biz.common.constants.BizConstant;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl; import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.EnumsUtils; import com.yeejoin.amos.boot.biz.common.utils.EnumsUtils;
import com.yeejoin.amos.boot.biz.common.utils.Menu; import com.yeejoin.amos.boot.biz.common.utils.Menu;
import com.yeejoin.amos.boot.module.common.api.dto.RequestData; import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceCraneDto;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceDto;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceHydrantDto;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceNaturalDto;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourcePoolDto;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceTypeDto;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceZhDto;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResource; import com.yeejoin.amos.boot.module.common.api.entity.WaterResource;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceCrane; import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceCrane;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceHydrant; import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceHydrant;
...@@ -201,8 +194,8 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -201,8 +194,8 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
/** /**
* 导出列表 * 导出列表
*/ */
public List<WaterResourceDto> exportToExcel(Boolean isDelete, String name, public List<WaterResourceForExportDto> exportToExcel(Boolean isDelete, String name,
String resourceType,String bizOrgCode ) { String resourceType, String bizOrgCode ) {
if ("null".equals(name)) { if ("null".equals(name)) {
name = null; name = null;
} }
......
...@@ -183,6 +183,7 @@ public class ConfigureController extends AbstractBaseController { ...@@ -183,6 +183,7 @@ public class ConfigureController extends AbstractBaseController {
if (StringUtils.isEmpty(bizOrgCode)) { if (StringUtils.isEmpty(bizOrgCode)) {
return CommonResponseUtil.success(null); return CommonResponseUtil.success(null);
} }
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize()); Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
Page<Map<String, Object>> fireCarInfoByWL = fireFightingSystemMapper.getFireCarInfoByWL(page, bizOrgCode); Page<Map<String, Object>> fireCarInfoByWL = fireFightingSystemMapper.getFireCarInfoByWL(page, bizOrgCode);
if (!CollectionUtils.isEmpty(fireCarInfoByWL.getRecords())) { if (!CollectionUtils.isEmpty(fireCarInfoByWL.getRecords())) {
...@@ -190,8 +191,10 @@ public class ConfigureController extends AbstractBaseController { ...@@ -190,8 +191,10 @@ public class ConfigureController extends AbstractBaseController {
records.forEach(item -> { records.forEach(item -> {
String prefix = null; String prefix = null;
String suffix = null; String suffix = null;
String iotCode = item.get("iot_code").toString(); String iotCode = null;
if (iotCode.length() > 8) { if (!ObjectUtils.isEmpty(item.get("iot_code"))) {
iotCode = item.get("iot_code").toString();
if (iotCode.length() > 8) {
prefix = iotCode.substring(0, 8); prefix = iotCode.substring(0, 8);
suffix = iotCode.substring(8); suffix = iotCode.substring(8);
} else { } else {
...@@ -215,14 +218,20 @@ public class ConfigureController extends AbstractBaseController { ...@@ -215,14 +218,20 @@ public class ConfigureController extends AbstractBaseController {
} }
if (item.containsKey("carStateDate") && !ObjectUtils.isEmpty(item.get("carStateDate"))) { if (item.containsKey("carStateDate") && !ObjectUtils.isEmpty(item.get("carStateDate"))) {
try { try {
Date carStateDate = DateUtils.dateParse(item.get("carStateDate").toString(), "yyyy-MM-dd'T'HH:mm:ss"); Date carStateDate = DateUtils.dateParse(item.get("carStateDate").toString(), "yyyy-MM-dd HH:mm:ss");
String s = DateUtils.dateFormat(carStateDate, DateUtils.DATE_TIME_PATTERN); String s = DateUtils.dateFormat(carStateDate, DateUtils.DATE_TIME_PATTERN);
item.put("carStateDate", s); item.put("carStateDate", s);
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
}else {
item.put("carState", "无");
item.put("count", 0);
item.put("carStateDate", "--");
}
}); });
} }
return CommonResponseUtil.success(fireCarInfoByWL); return CommonResponseUtil.success(fireCarInfoByWL);
} }
......
...@@ -466,10 +466,11 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -466,10 +466,11 @@ public class FireFightingSystemController extends AbstractBaseController {
QueryWrapper<EquipmentCategory> equipmentCategoryQueryWrapper = new QueryWrapper<>(); QueryWrapper<EquipmentCategory> equipmentCategoryQueryWrapper = new QueryWrapper<>();
equipmentCategoryQueryWrapper.eq("code", equipTypeAmountPage.getEquipmentClassificationCode()); equipmentCategoryQueryWrapper.eq("code", equipTypeAmountPage.getEquipmentClassificationCode());
equipmentCategoryQueryWrapper.eq("industry_code", equipTypeAmountPage.getIndustryCode()); equipmentCategoryQueryWrapper.eq("industry_code", equipTypeAmountPage.getIndustryCode());
EquipmentCategory equipmentCategory = equipmentCategoryService.getOne(equipmentCategoryQueryWrapper); List<EquipmentCategory> equipmentCategoryList = equipmentCategoryService.list(equipmentCategoryQueryWrapper);
if (equipmentCategory == null) { if (CollectionUtils.isEmpty(equipmentCategoryList)) {
throw new RuntimeException("装备定义code有误"); throw new RuntimeException("装备定义code有误");
} }
EquipmentCategory equipmentCategory = equipmentCategoryList.get(0);
int inhierarchy = 1; int inhierarchy = 1;
for (int i = 0; i < result.length + 1; i++) { for (int i = 0; i < result.length + 1; i++) {
//进来先判断是否默认就是空,如果为空第一层 //进来先判断是否默认就是空,如果为空第一层
...@@ -487,7 +488,7 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -487,7 +488,7 @@ public class FireFightingSystemController extends AbstractBaseController {
} }
} }
return fireFightingSystemService.getColaCategoryAmountEquList(inhierarchy, equipTypeAmountPage.getEquipmentClassificationCode().substring(0, inhierarchy), equipTypeAmountPage); return fireFightingSystemService.getColaCategoryAmountEquList(inhierarchy, equipTypeAmountPage.getEquipmentClassificationCode().replaceAll("0+$", ""), equipTypeAmountPage);
} else { } else {
if (null != equipTypeAmountPage.getIsDefect() && 1 == equipTypeAmountPage.getIsDefect()) { if (null != equipTypeAmountPage.getIsDefect() && 1 == equipTypeAmountPage.getIsDefect()) {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
......
...@@ -61,6 +61,13 @@ public class FormInstanceController extends AbstractBaseController { ...@@ -61,6 +61,13 @@ public class FormInstanceController extends AbstractBaseController {
String orgCode = getOrgCode(); String orgCode = getOrgCode();
return formInstanceEquipService.updateForm(instanceId, orgCode, map, groupCode); return formInstanceEquipService.updateForm(instanceId, orgCode, map, groupCode);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "删除")
@DeleteMapping(value = "/{instanceId}")
public Boolean delete(@PathVariable Long instanceId) {
return formInstanceEquipService.deleteInstanceById(instanceId);
}
} }
...@@ -6,6 +6,7 @@ import java.util.List; ...@@ -6,6 +6,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import com.yeejoin.equipmanage.common.datasync.vo.FireEquipmentVO; import com.yeejoin.equipmanage.common.datasync.vo.FireEquipmentVO;
import com.yeejoin.equipmanage.common.entity.*;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -15,10 +16,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -15,10 +16,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.equipmanage.common.datasync.entity.FireEquipment; import com.yeejoin.equipmanage.common.datasync.entity.FireEquipment;
import com.yeejoin.equipmanage.common.dto.EquipmentSpecificDto; import com.yeejoin.equipmanage.common.dto.EquipmentSpecificDto;
import com.yeejoin.equipmanage.common.dto.UserDto; import com.yeejoin.equipmanage.common.dto.UserDto;
import com.yeejoin.equipmanage.common.entity.EquipmentCategory;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecific;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex;
import com.yeejoin.equipmanage.common.entity.MaintenanceResourceData;
import com.yeejoin.equipmanage.common.entity.dto.EquipmentSpecificDTO; import com.yeejoin.equipmanage.common.entity.dto.EquipmentSpecificDTO;
import com.yeejoin.equipmanage.common.entity.vo.ComplementCodeVO; import com.yeejoin.equipmanage.common.entity.vo.ComplementCodeVO;
import com.yeejoin.equipmanage.common.entity.vo.EquiplistSpecificBySystemVO; import com.yeejoin.equipmanage.common.entity.vo.EquiplistSpecificBySystemVO;
...@@ -224,7 +221,7 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> { ...@@ -224,7 +221,7 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
*/ */
List<Map<String, Object>> queryCompanyStaData(); List<Map<String, Object>> queryCompanyStaData();
String getEquipmentBySpecificId(@Param("specificId") Long specificId); Equipment getEquipmentBySpecificId(@Param("specificId") Long specificId);
List<EquiplistSpecificBySystemVO> getListByWarehouseStructureId(Long floorId); List<EquiplistSpecificBySystemVO> getListByWarehouseStructureId(Long floorId);
......
...@@ -3,6 +3,7 @@ package com.yeejoin.equipmanage.service.impl; ...@@ -3,6 +3,7 @@ package com.yeejoin.equipmanage.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.IotSystemAlarmRo; import com.yeejoin.amos.boot.module.jcs.api.dto.IotSystemAlarmRo;
...@@ -110,6 +111,9 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ ...@@ -110,6 +111,9 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
private EquipmentSpecificMapper equipmentSpecificMapper; private EquipmentSpecificMapper equipmentSpecificMapper;
@Autowired @Autowired
private EquipmentMapper equipmentMapper;
@Autowired
private EquipmentSpecificAlarmMapper equipmentSpecificAlarmMapper; private EquipmentSpecificAlarmMapper equipmentSpecificAlarmMapper;
@Autowired @Autowired
...@@ -191,8 +195,14 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ ...@@ -191,8 +195,14 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
ent.setEquipmentSpecificAlarmId(equipmentSpecificAlarmId); ent.setEquipmentSpecificAlarmId(equipmentSpecificAlarmId);
ent.setEquipmentSpecificId(alarmLog.getEquipmentSpecificId()); ent.setEquipmentSpecificId(alarmLog.getEquipmentSpecificId());
ent.setEquipmentSpecificIndexKey(alarmLog.getEquipmentSpecificIndexKey()); ent.setEquipmentSpecificIndexKey(alarmLog.getEquipmentSpecificIndexKey());
String cleanType = equipmentSpecificMapper.getEquipmentBySpecificId(alarmLog.getEquipmentSpecificId()); Equipment equipment = equipmentSpecificMapper.getEquipmentBySpecificId(alarmLog.getEquipmentSpecificId());
if (StringUtil.isNotEmpty(cleanType) && AlarmCleanTypeEnum.QRXC.getCode().equals(cleanType)) { if (!StringUtil.isNotEmpty(equipment.getCleanType())) {
// 若此装备未定义消除策略,默认设置为复位信号自动消除
equipment.setCleanType(AlarmCleanTypeEnum.ZDXC.getCode());
equipmentMapper.updateById(equipment);
}
if (StringUtil.isNotEmpty(equipment.getCleanType()) && AlarmCleanTypeEnum.QRXC.getCode().equals(equipment.getCleanType())) {
EquipmentSpecificAlarm alarm = equipmentSpecificAlarmMapper.selectById(alarmLog.getEquipmentSpecificAlarmId()); EquipmentSpecificAlarm alarm = equipmentSpecificAlarmMapper.selectById(alarmLog.getEquipmentSpecificAlarmId());
alarm.setStatus(AlarmStatusEnum.HF.getCode()); alarm.setStatus(AlarmStatusEnum.HF.getCode());
equipmentSpecificAlarmMapper.updateById(alarm); equipmentSpecificAlarmMapper.updateById(alarm);
...@@ -228,8 +238,8 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ ...@@ -228,8 +238,8 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
Date date = new Date(); Date date = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(date); String dateString = formatter.format(date);
ent.setDefectBatchId(UUID.randomUUID().toString().replace("-", "").toLowerCase());
if (ent.isAddDefect()) { if (ent.isAddDefect()) {
ent.setDefectBatchId(UUID.randomUUID().toString().replace("-", "").toLowerCase());
ent.setResolveResult(dateString + " " + userModel.getRealName() + " 添加为缺陷进行消缺。"); ent.setResolveResult(dateString + " " + userModel.getRealName() + " 添加为缺陷进行消缺。");
} else { } else {
ent.setResolveResult(dateString + " " + userModel.getRealName() + " 进行警情确认处理。"); ent.setResolveResult(dateString + " " + userModel.getRealName() + " 进行警情确认处理。");
......
...@@ -25,6 +25,7 @@ import com.yeejoin.equipmanage.remote.RemoteSecurityService; ...@@ -25,6 +25,7 @@ import com.yeejoin.equipmanage.remote.RemoteSecurityService;
import com.yeejoin.equipmanage.service.*; import com.yeejoin.equipmanage.service.*;
import com.yeejoin.equipmanage.utils.BeanUtil; import com.yeejoin.equipmanage.utils.BeanUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -36,11 +37,14 @@ import org.springframework.transaction.support.TransactionSynchronizationManager ...@@ -36,11 +37,14 @@ import org.springframework.transaction.support.TransactionSynchronizationManager
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -94,6 +98,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -94,6 +98,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Autowired @Autowired
MarqueeDataMapper marqueeDataMapper; MarqueeDataMapper marqueeDataMapper;
/** /**
* 泡沫罐KEY * 泡沫罐KEY
*/ */
...@@ -217,6 +222,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -217,6 +222,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
private static Boolean bool = Boolean.FALSE; private static Boolean bool = Boolean.FALSE;
@Autowired
protected EmqKeeper emqKeeper;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void handlerMqttIncrementMessage(String topic, String message) { public void handlerMqttIncrementMessage(String topic, String message) {
...@@ -264,6 +272,18 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -264,6 +272,18 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
return; return;
} }
log.info(String.format("收到mqtt消息:%s", message)); log.info(String.format("收到mqtt消息:%s", message));
// 发送emq消息转kafka
JSONObject jsonObject = new JSONObject();
jsonObject.put("topic", topic);
jsonObject.put("data",message);
try {
emqKeeper.getMqttClient().publish("emq.iot.created",jsonObject.toString().getBytes(),1,false);
} catch (MqttException e) {
log.info(String.format("发送eqm转kafka消息失败:%s", e.getMessage()));
}
if (!StringUtils.isEmpty(traceId)) { if (!StringUtils.isEmpty(traceId)) {
String finalTraceId = traceId; String finalTraceId = traceId;
List<IotDataVO> collect = iotDatalist.stream().map(x -> { List<IotDataVO> collect = iotDatalist.stream().map(x -> {
......
...@@ -4,6 +4,7 @@ import java.io.InputStream; ...@@ -4,6 +4,7 @@ import java.io.InputStream;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -12,11 +13,14 @@ import javax.servlet.http.HttpServletResponse; ...@@ -12,11 +13,14 @@ import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.spire.ms.System.Collections.Specialized.CollectionsUtil;
import com.yeejoin.amos.boot.module.common.api.dto.*; import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.excel.ExplicitConstraint; import com.yeejoin.amos.boot.module.common.api.excel.ExplicitConstraint;
import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper; import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper;
import com.yeejoin.amos.boot.module.jcs.api.dto.SignDto; import com.yeejoin.amos.boot.module.jcs.api.dto.SignDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.SinStaticDto; import com.yeejoin.amos.boot.module.jcs.api.dto.SinStaticDto;
import io.github.classgraph.json.JSONUtils;
import io.micrometer.core.instrument.util.JsonUtils;
import org.apache.commons.beanutils.ConvertUtils; import org.apache.commons.beanutils.ConvertUtils;
import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Row;
...@@ -256,7 +260,7 @@ public class ExcelServiceImpl { ...@@ -256,7 +260,7 @@ public class ExcelServiceImpl {
WaterResourceDto.class, dataSourcesImpl, false); WaterResourceDto.class, dataSourcesImpl, false);
break; break;
} }
List<WaterResourceDto> waterResourceDtoList = null; List<WaterResourceForExportDto> waterResourceDtoList = null;
if(par.size()>0) { if(par.size()>0) {
waterResourceDtoList = waterResourceServiceImpl.exportToExcel(true,par.containsKey("name")?par.get("name").toString():null, waterResourceDtoList = waterResourceServiceImpl.exportToExcel(true,par.containsKey("name")?par.get("name").toString():null,
par.containsKey("resourceType")?par.get("resourceType").toString():null,par.containsKey("bizOrgCode")?par.get("bizOrgCode").toString():null); par.containsKey("resourceType")?par.get("resourceType").toString():null,par.containsKey("bizOrgCode")?par.get("bizOrgCode").toString():null);
...@@ -264,7 +268,7 @@ public class ExcelServiceImpl { ...@@ -264,7 +268,7 @@ public class ExcelServiceImpl {
waterResourceDtoList = waterResourceServiceImpl.exportToExcel(true,null,null,par.containsKey("bizOrgCode")?par.get("bizOrgCode").toString():null); waterResourceDtoList = waterResourceServiceImpl.exportToExcel(true,null,null,par.containsKey("bizOrgCode")?par.get("bizOrgCode").toString():null);
} }
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), waterResourceDtoList, ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(), waterResourceDtoList,
WaterResourceDto.class, dataSourcesImpl, false); WaterResourceForExportDto.class, dataSourcesImpl, false);
break; break;
case "HKQ": case "HKQ":
List<AircraftDto> aircraftDtoList = null; List<AircraftDto> aircraftDtoList = null;
......
...@@ -10,6 +10,7 @@ import com.yeejoin.amos.boot.module.jcs.api.mapper.SignMapper; ...@@ -10,6 +10,7 @@ import com.yeejoin.amos.boot.module.jcs.api.mapper.SignMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.ISignService; import com.yeejoin.amos.boot.module.jcs.api.service.ISignService;
import com.yeejoin.amos.boot.module.jcs.api.dto.SignDto; import com.yeejoin.amos.boot.module.jcs.api.dto.SignDto;
import com.yeejoin.amos.component.rule.config.RuleConfig; import com.yeejoin.amos.component.rule.config.RuleConfig;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttException;
...@@ -32,6 +33,7 @@ import java.util.List; ...@@ -32,6 +33,7 @@ import java.util.List;
* @author system_generator * @author system_generator
* @date 2022-08-15 * @date 2022-08-15
*/ */
@Slf4j
@Service @Service
public class SignServiceImpl extends BaseService<SignDto,Sign,SignMapper> implements ISignService { public class SignServiceImpl extends BaseService<SignDto,Sign,SignMapper> implements ISignService {
...@@ -41,6 +43,9 @@ public class SignServiceImpl extends BaseService<SignDto,Sign,SignMapper> implem ...@@ -41,6 +43,9 @@ public class SignServiceImpl extends BaseService<SignDto,Sign,SignMapper> implem
@Value("${mqtt.topic.person.sign}") @Value("${mqtt.topic.person.sign}")
private String personSign; private String personSign;
@Value("${mqtt.topic.person.sign.zxj}")
private String personSignZxj;
/** /**
* 分页查询 * 分页查询
*/ */
...@@ -136,8 +141,30 @@ public class SignServiceImpl extends BaseService<SignDto,Sign,SignMapper> implem ...@@ -136,8 +141,30 @@ public class SignServiceImpl extends BaseService<SignDto,Sign,SignMapper> implem
SerializerFeature.WriteMapNullValue); SerializerFeature.WriteMapNullValue);
try { try {
emqKeeper.getMqttClient().publish(personSign, json.getBytes(), RuleConfig.DEFAULT_QOS, false); emqKeeper.getMqttClient().publish(personSign, json.getBytes(), RuleConfig.DEFAULT_QOS, false);
map.put("personOfDay", ObjectUtils.isEmpty(sign.getPersonOfDay())?"":sign.getPersonOfDay());
map.put("type", ObjectUtils.isEmpty(sign.getType())?"":sign.getType());
map.put("photos", ObjectUtils.isEmpty(sign.getPhotos())?"":sign.getPhotos());
map.put("remarks", ObjectUtils.isEmpty(sign.getRemarks())?"":sign.getRemarks());
map.put("date", ObjectUtils.isEmpty(sign.getDate())?"":sign.getDate());
map.put("recDate", ObjectUtils.isEmpty(sign.getRecDate())?"":sign.getRecDate());
map.put("isDelete", ObjectUtils.isEmpty(sign.getIsDelete())?"":sign.getIsDelete());
map.put("source", ObjectUtils.isEmpty(sign.getSource())?"":sign.getSource());
String json1=JSONObject.toJSONString(map, SerializerFeature.PrettyFormat,
SerializerFeature.WriteMapNullValue);
// 发送emq消息转kafka
JSONObject jsonObject = new JSONObject();
jsonObject.put("topic", personSign);
jsonObject.put("data",json);
emqKeeper.getMqttClient().publish("emq.sign.created",jsonObject.toString().getBytes(),1,false);
// 发送emq消息转kafka 同步业务库打卡表
JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("topic", personSignZxj);
jsonObject1.put("data",json1);
emqKeeper.getMqttClient().publish("emq.bussSign.created",jsonObject1.toString().getBytes(),1,false);
} catch (MqttException e) { } catch (MqttException e) {
e.printStackTrace(); log.info(String.format("发送eqm打卡消息失败:%s", e.getMessage()));
} }
} }
return save; return save;
......
...@@ -7713,29 +7713,22 @@ ORDER BY ...@@ -7713,29 +7713,22 @@ ORDER BY
DROP VIEW IF EXISTS `v_fire_check_num_shaoshan`; DROP VIEW IF EXISTS `v_fire_check_num_shaoshan`;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `v_fire_check_num_shaoshan` AS CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `v_fire_check_num_shaoshan` AS
SELECT SELECT
( ( SELECT ifnull( sum( `p_plan_task`.`point_num` ), 0 ) FROM `p_plan_task` WHERE `p_plan_task`.`check_date` LIKE concat( curdate(), '%' ) ) AS `point_num`,
SELECT (
ifnull( sum( `p_plan_task`.`point_num` ), 0 ) SELECT
FROM ifnull( sum( `p_plan_task`.`point_num` ), 0 )
`p_plan_task` FROM
WHERE `p_plan_task`
( to_days( `p_plan_task`.`begin_time` ) - to_days( curdate()) ) <= 0 AND ( to_days( `p_plan_task`.`end_time` ) - to_days( curdate()) ) >= 0 WHERE
) AS `point_num`, `p_plan_task`.`finish_status` = 3
( AND `p_plan_task`.`check_date` LIKE concat( curdate(), '%' )
SELECT ) AS `miss_num`,
ifnull( sum( `p_plan_task`.`point_num` ), 0 ) (
FROM SELECT
`p_plan_task` ifnull( sum( `p_plan_task`.`point_num` ), 0 )
WHERE FROM
`p_plan_task`.`finish_status` = 3 `p_plan_task`
AND ( to_days( `p_plan_task`.`begin_time` ) - to_days( curdate()) ) <= 0 AND ( to_days( `p_plan_task`.`end_time` ) - to_days( curdate()) ) >= 0 WHERE
) AS `miss_num`, `p_plan_task`.`finish_status` = 0
( AND `p_plan_task`.`check_date` LIKE concat( curdate(), '%' )
SELECT ) AS `unfinish_num`;
ifnull( sum( `p_plan_task`.`point_num` ), 0 ) \ No newline at end of file
FROM
`p_plan_task`
WHERE
( `p_plan_task`.`finish_status` = 0 )
AND ( to_days( `p_plan_task`.`begin_time` ) - to_days( curdate()) ) <= 0 AND ( to_days( `p_plan_task`.`end_time` ) - to_days( curdate()) ) >= 0
) AS `unfinish_num`;
\ No newline at end of file
...@@ -3051,4 +3051,15 @@ ...@@ -3051,4 +3051,15 @@
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="tianyiming" id="202211031846">
<preConditions onFail="MARK_RAN">
<tableExists tableName="wl_form_group" />
<primaryKeyExists primaryKeyName="id" tableName="wl_form_group"/>
</preConditions>
<comment>add data wl_form_group</comment>
<sql>
REPLACE INTO `wl_form_group_column` (`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000322, 'latitude', '纬度', 'String', 132828674817, 'eq', b'0', 'r_fireControlRoom', 2581805, '2022-03-01 12:01:04');
REPLACE INTO `wl_form_group_column` (`id`, `field_name`, `field_label`, `data_type`, `group_id`, `query_strategy`, `not_null`, `group_code`, `creator_id`, `create_date`) VALUES (133000000323, 'longitude', '经度', 'String', 132828674817, 'eq', b'0', 'r_fireControlRoom', 2581805, '2022-03-01 12:04:47');
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
\ No newline at end of file
...@@ -114,8 +114,9 @@ ...@@ -114,8 +114,9 @@
from from
wl_equipment_index wl_equipment_index
where equipment_id = #{id} where equipment_id = #{id}
order by group_name,sort_num ) impor) data ) impor) data
where prefQuotaNAME like concat('%',#{groupName},'%') where prefQuotaNAME like concat('%',#{groupName},'%')
order by sort_num, group_name
</select> </select>
<select id="getPerfQutoaList" resultType="com.yeejoin.equipmanage.common.entity.vo.EquipmentIndexVO"> <select id="getPerfQutoaList" resultType="com.yeejoin.equipmanage.common.entity.vo.EquipmentIndexVO">
......
...@@ -816,6 +816,7 @@ ...@@ -816,6 +816,7 @@
<select id="getEquipSpecificDetail" <select id="getEquipSpecificDetail"
resultType="com.yeejoin.equipmanage.common.datasync.entity.FireEquipment"> resultType="com.yeejoin.equipmanage.common.datasync.entity.FireEquipment">
SELECT SELECT
DISTINCT
es.id, es.id,
es.`code` AS mrid, es.`code` AS mrid,
es.`code` AS materialObjectId, es.`code` AS materialObjectId,
...@@ -1595,23 +1596,27 @@ ...@@ -1595,23 +1596,27 @@
</select> </select>
<select id="queryCompanyStaData" resultType="java.util.Map"> <select id="queryCompanyStaData" resultType="java.util.Map">
SELECT SELECT
s.biz_org_code as bizOrgCode, s.biz_org_code AS bizOrgCode,
c.code as categoryCode, c.`code` AS categoryCode,
count(1) as total count( 1 ) AS total
FROM FROM
`wl_equipment_specific` s, `wl_equipment_specific` s
wl_equipment e, LEFT JOIN wl_equipment_detail ed ON ed.id = s.equipment_detail_id
wl_equipment_category c LEFT JOIN wl_equipment e ON e.id = ed.equipment_id
where LEFT JOIN wl_equipment_category c ON c.id = e.category_id
s.equipment_code = e.`code` WHERE
and e.category_id = c.id s.biz_org_code != ''
and s.biz_org_code <![CDATA[<>]]> '' AND s.biz_org_code IS NOT NULL
GROUP BY s.biz_org_code ,c.code AND c.`code` IS NOT NULL
AND c.`code` != ''
GROUP BY
s.biz_org_code,
c.`code`
</select> </select>
<select id="getEquipmentBySpecificId" resultType="String"> <select id="getEquipmentBySpecificId" resultType="com.yeejoin.equipmanage.common.entity.Equipment">
select select
we.clean_type we.*
from from
wl_equipment we wl_equipment we
LEFT JOIN `wl_equipment_detail` wed ON wed.equipment_id = we.id LEFT JOIN `wl_equipment_detail` wed ON wed.equipment_id = we.id
......
...@@ -1954,7 +1954,8 @@ ...@@ -1954,7 +1954,8 @@
LEFT JOIN wl_equipment_category wec ON wle.category_id = wec.id LEFT JOIN wl_equipment_category wec ON wle.category_id = wec.id
WHERE 1=1 WHERE 1=1
<if test="codeHead!=null and codeHead!='' and codeHead!=' '"> <if test="codeHead!=null and codeHead!='' and codeHead!=' '">
and LEFT (wle.CODE, #{hierarchy}) = #{codeHead} <!-- and LEFT (wle.CODE, #{hierarchy}) = #{codeHead}-->
and wec.`code` like concat(#{codeHead}, '%')
</if> </if>
<if test="equipTypeAmountPage.industryCode!=null"> <if test="equipTypeAmountPage.industryCode!=null">
and wec.industry_code = #{equipTypeAmountPage.industryCode} and wec.industry_code = #{equipTypeAmountPage.industryCode}
...@@ -4847,7 +4848,10 @@ ...@@ -4847,7 +4848,10 @@
<select id="getPipeNetworkBySuper" resultType="java.util.Map"> <select id="getPipeNetworkBySuper" resultType="java.util.Map">
SELECT SELECT
a.`name`, a.`name`,
IFNULL(a.area, '') AS area, (CASE WHEN
LENGTH(trim(a.area)) = 0 THEN '--'
ELSE
IFNULL(a.area, '--') END) AS area,
a.id, a.id,
IFNULL(a.nowPressure, '--') AS nowPressure, IFNULL(a.nowPressure, '--') AS nowPressure,
a.nowPressureDate, a.nowPressureDate,
......
...@@ -81,6 +81,9 @@ mqtt.topic.command.alert.noticeAviation=aviationAlarm ...@@ -81,6 +81,9 @@ mqtt.topic.command.alert.noticeAviation=aviationAlarm
#人员打卡同步数据 #人员打卡同步数据
mqtt.topic.person.sign=sign/data/syn mqtt.topic.person.sign=sign/data/syn
#人员打卡同步中心级
mqtt.topic.person.sign.zxj=sign/data/synZxj
security.systemctl.name=AMOS-API-SYSTEMCTL security.systemctl.name=AMOS-API-SYSTEMCTL
jcs.company.topic.add=jcs/company/topic/add jcs.company.topic.add=jcs/company/topic/add
...@@ -118,7 +121,7 @@ auth-key-key-site=key_site_info ...@@ -118,7 +121,7 @@ auth-key-key-site=key_site_info
#消防人员 #消防人员
auth-key-fire-fighters=fire_fighters_info auth-key-fire-fighters=fire_fighters_info
#权限开关: true 启用权限 false 不启用 #权限开关: true 启用权限 false 不启用
mybatis.interceptor.enabled = false mybatis.interceptor.enabled = true
## 消防救援保障部ID ## 消防救援保障部ID
fire-rescue=1432549862557130753 fire-rescue=1432549862557130753
......
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto; import com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckResult; import com.yeejoin.amos.boot.module.tdc.api.entity.CheckResult;
import org.apache.ibatis.annotations.Param;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import java.util.List; import java.util.List;
...@@ -29,4 +30,7 @@ public interface CheckResultMapper extends BaseMapper<CheckResult> { ...@@ -29,4 +30,7 @@ public interface CheckResultMapper extends BaseMapper<CheckResult> {
List<CheckResultDto> getOne(String amosOrgCode); List<CheckResultDto> getOne(String amosOrgCode);
List<CheckResult> getCheckItemNo(@Param("modelName") String modelName);
Map<String, Object> selectCheckItemTotal(@Param("modelName") String modelName);
} }
...@@ -2,11 +2,15 @@ package com.yeejoin.amos.boot.module.tdc.api.mapper; ...@@ -2,11 +2,15 @@ package com.yeejoin.amos.boot.module.tdc.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.tdc.api.entity.ModelItem; import com.yeejoin.amos.boot.module.tdc.api.entity.ModelItem;
import org.apache.ibatis.annotations.Param;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
import java.util.List;
/** /**
* @author DELL * @author DELL
*/ */
@Mapper @Mapper
public interface ModelItemMapper extends BaseMapper<ModelItem> { public interface ModelItemMapper extends BaseMapper<ModelItem> {
List<ModelItem> getListByName(@Param("modelName") String modelName, @Param("orgCode") String orgCode);
} }
package com.yeejoin.amos.boot.module.tdc.api.mapper; package com.yeejoin.amos.boot.module.tdc.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord; import com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
...@@ -9,4 +11,6 @@ import org.mapstruct.Mapper; ...@@ -9,4 +11,6 @@ import org.mapstruct.Mapper;
*/ */
@Mapper @Mapper
public interface SubmitRecordMapper extends BaseMapper<SubmitRecord> { public interface SubmitRecordMapper extends BaseMapper<SubmitRecord> {
IPage<SubmitRecord> selectByOrgCode(Page page);
} }
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.tdc.api.service; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.tdc.api.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckReport; import com.yeejoin.amos.boot.module.tdc.api.entity.CheckReport;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Map; import java.util.Map;
...@@ -16,4 +17,5 @@ public interface CheckReportService extends IService<CheckReport> { ...@@ -16,4 +17,5 @@ public interface CheckReportService extends IService<CheckReport> {
Map getInfo(int pageNumber,int pageSize); Map getInfo(int pageNumber,int pageSize);
void createReport(String batchNo, AgencyUserModel userInfo);
} }
...@@ -6,6 +6,7 @@ import com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto; ...@@ -6,6 +6,7 @@ import com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto;
import com.yeejoin.amos.boot.module.tdc.api.dto.DimensionTableDto; import com.yeejoin.amos.boot.module.tdc.api.dto.DimensionTableDto;
import com.yeejoin.amos.boot.module.tdc.api.dto.ModelTreeDto; import com.yeejoin.amos.boot.module.tdc.api.dto.ModelTreeDto;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckResult; import com.yeejoin.amos.boot.module.tdc.api.entity.CheckResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
...@@ -58,4 +59,9 @@ public interface CheckResultService extends IService<CheckResult> { ...@@ -58,4 +59,9 @@ public interface CheckResultService extends IService<CheckResult> {
List<DimensionTableDto> getDimensionTable(String id); List<DimensionTableDto> getDimensionTable(String id);
List<ModelTreeDto> getModelTreeData(String modelName, AgencyUserModel userInfo);
List<CheckResult> getCheckItem(String modelName, AgencyUserModel userInfo);
Map<String, Object> selectCheckItemTotal(String modelName, AgencyUserModel userInfo);
} }
package com.yeejoin.amos.boot.module.tdc.api.service; package com.yeejoin.amos.boot.module.tdc.api.service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.tdc.api.entity.ModelItem;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
......
package com.yeejoin.amos.boot.module.tdc.api.service; package com.yeejoin.amos.boot.module.tdc.api.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.tdc.api.dto.CheckModelDto;
import com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord;
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 org.springframework.stereotype.Service;
...@@ -8,6 +11,7 @@ import org.springframework.stereotype.Service; ...@@ -8,6 +11,7 @@ import org.springframework.stereotype.Service;
*/ */
@Service @Service
public interface SubmitRecordService { public interface SubmitRecordService {
IPage<SubmitRecord> selectByOrgCode(int current, int size);
int saveSubmitRecord(SubmitRecord submitRecord); int saveSubmitRecord(SubmitRecord submitRecord);
......
...@@ -36,4 +36,47 @@ ...@@ -36,4 +36,47 @@
select amos_org_name,amos_org_code,batch_no,model_id from tdc_check_result where amos_org_code = #{amosOrgCode} group by model_name ORDER BY check_date desc limit 0,1; select amos_org_name,amos_org_code,batch_no,model_id from tdc_check_result where amos_org_code = #{amosOrgCode} group by model_name ORDER BY check_date desc limit 0,1;
</select> </select>
<select id="getCheckItemNo" resultType="com.yeejoin.amos.boot.module.tdc.api.entity.CheckResult">
SELECT
*
FROM
tdc_check_result
WHERE
batch_no = (
SELECT
batch_no
FROM
tdc_submit_record
ORDER BY
submit_time DESC
LIMIT 1
)
AND check_item_result = 1
<if test="modelName != null and modelName != '' and modelName != '-1'">
AND model_name = #{modelName}
</if>
</select>
<select id="selectCheckItemTotal" resultType="java.util.Map">
SELECT
count(1) AS total, COUNT(CASE WHEN (check_item_result=1) THEN check_item_result END) AS unqualified, batch_no AS batchNo
FROM
tdc_check_result
WHERE
batch_no = (
SELECT
batch_no
FROM
tdc_submit_record
-- WHERE
-- amos_org_code = '50*110'
ORDER BY
submit_time DESC
LIMIT 1
)
<if test="modelName != null and modelName != '' and modelName != '-1'">
AND model_name = #{modelName}
</if>
</select>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.tdc.api.mapper.ModelItemMapper"> <mapper namespace="com.yeejoin.amos.boot.module.tdc.api.mapper.ModelItemMapper">
<select id="getListByName" resultType="com.yeejoin.amos.boot.module.tdc.api.entity.ModelItem">
SELECT
sequence_nbr, check_item_label, check_item_value, model_name, submit_record_id
FROM
tdc_model_item
WHERE
submit_record_id = (
SELECT
sequence_nbr
FROM
tdc_submit_record
WHERE
amos_org_code = #{orgCode}
ORDER BY
submit_time DESC
LIMIT 1
)
<if test="modelName != null and modelName != '' and modelName != '-1'">
AND model_name = #{modelName}
</if>
</select>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.tdc.api.mapper.SubmitRecordMapper"> <mapper namespace="com.yeejoin.amos.boot.module.tdc.api.mapper.SubmitRecordMapper">
</mapper>
\ No newline at end of file <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>
</mapper>
...@@ -93,6 +93,7 @@ public class CheckModelAction { ...@@ -93,6 +93,7 @@ public class CheckModelAction {
checkResult.setCheckItemResult(result); checkResult.setCheckItemResult(result);
checkResult.setCheckExplain(checkExplain); checkResult.setCheckExplain(checkExplain);
checkResult.setCheckItem(checkItem); checkResult.setCheckItem(checkItem);
checkResult.setCheckItemLabel(checkItem);
checkResult.setCheckItemValue(checkItemValue); checkResult.setCheckItemValue(checkItemValue);
checkResult.setModelId(String.valueOf(checkModel.getSequenceNbr())); checkResult.setModelId(String.valueOf(checkModel.getSequenceNbr()));
checkResult.setAmosOrgCode(checkModel.getAmosOrgCode()); checkResult.setAmosOrgCode(checkModel.getAmosOrgCode());
......
package com.yeejoin.amos.boot.module.tdc.biz.controller; package com.yeejoin.amos.boot.module.tdc.biz.controller;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckReport; import com.yeejoin.amos.boot.module.tdc.api.entity.CheckReport;
import com.yeejoin.amos.boot.module.tdc.api.service.CheckReportService; import com.yeejoin.amos.boot.module.tdc.api.service.CheckReportService;
import com.yeejoin.amos.boot.module.tdc.biz.service.impl.CheckReportImpl; import com.yeejoin.amos.boot.module.tdc.biz.service.impl.CheckReportImpl;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
...@@ -24,7 +27,7 @@ import java.util.Map; ...@@ -24,7 +27,7 @@ import java.util.Map;
@RestController @RestController
@Api(tags = "校验报告api") @Api(tags = "校验报告api")
@RequestMapping(value = "/report") @RequestMapping(value = "/report")
public class CheckReportController { public class CheckReportController extends BaseController {
@Autowired @Autowired
CheckReportService checkReportService; CheckReportService checkReportService;
...@@ -41,7 +44,6 @@ public class CheckReportController { ...@@ -41,7 +44,6 @@ public class CheckReportController {
return ResponseHelper.buildResponse(checkReportService.selectAll(current,size,amosOrgCode)); return ResponseHelper.buildResponse(checkReportService.selectAll(current,size,amosOrgCode));
} }
/** /**
* *
* return * return
...@@ -53,4 +55,13 @@ public class CheckReportController { ...@@ -53,4 +55,13 @@ public class CheckReportController {
return ResponseHelper.buildResponse(checkReportService.getInfo(pageNumber,pageSize)); return ResponseHelper.buildResponse(checkReportService.getInfo(pageNumber,pageSize));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "createReport")
@ApiOperation(httpMethod = "GET",value = "创建报告", notes = "创建报告")
public ResponseModel createReport(String batchNo) {
AgencyUserModel userInfo = getUserInfo();
checkReportService.createReport(batchNo, userInfo);
return ResponseHelper.buildResponse(true);
}
} }
...@@ -11,10 +11,7 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; ...@@ -11,10 +11,7 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
...@@ -118,5 +115,27 @@ public class CheckResultController extends BaseController { ...@@ -118,5 +115,27 @@ public class CheckResultController extends BaseController {
return ResponseHelper.buildResponse(checkResultService.getDimensionTable(id)); return ResponseHelper.buildResponse(checkResultService.getDimensionTable(id));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/getModelTreeData")
@ApiOperation(httpMethod = "GET",value = "获取单独模型树", notes = "根据模型id获取模型树")
public ResponseModel<List<ModelTreeDto>> getModelTreeData(@RequestParam(required = false) String modelName) {
AgencyUserModel userInfo = getUserInfo();
return ResponseHelper.buildResponse(checkResultService.getModelTreeData(modelName, userInfo));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/getCheckItemNo")
@ApiOperation(httpMethod = "GET",value = "获取不合格校验项", notes = "获取不合格校验项")
public ResponseModel<List<CheckResult>> getCheckItem(@RequestParam(required = false) String modelName) {
AgencyUserModel userInfo = getUserInfo();
return ResponseHelper.buildResponse(checkResultService.getCheckItem(modelName, userInfo));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/selectCheckItemTotal")
@ApiOperation(httpMethod = "GET", value = "获取校验项统计", notes = "获取校验项统计")
public ResponseModel<Map<String, Object>> selectCheckItemTotal(@RequestParam(required = false) String modelName) {
AgencyUserModel userInfo = getUserInfo();
return ResponseHelper.buildResponse(checkResultService.selectCheckItemTotal(modelName, userInfo));
}
} }
package com.yeejoin.amos.boot.module.tdc.biz.controller; package com.yeejoin.amos.boot.module.tdc.biz.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord;
import com.yeejoin.amos.boot.module.tdc.api.service.SubmitRecordService; import com.yeejoin.amos.boot.module.tdc.api.service.SubmitRecordService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
...@@ -22,4 +21,13 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -22,4 +21,13 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
@Api(tags = "校验项提交") @Api(tags = "校验项提交")
@RequestMapping(value = "/check-record") @RequestMapping(value = "/check-record")
public class SubmitRecordController { public class SubmitRecordController {
@Autowired
SubmitRecordService submitRecordService;
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "selectOrgCode")
@ApiOperation(httpMethod = "GET",value = "直接查询列表", notes = "直接查询列表")
public ResponseModel<IPage<SubmitRecord>> selectByOrgCode(int current,int size){
return ResponseHelper.buildResponse(submitRecordService.selectByOrgCode(current, size));
}
} }
\ No newline at end of file
...@@ -7,17 +7,24 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -7,17 +7,24 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.boot.module.tdc.api.dto.ModelTreeDto;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckReport; import com.yeejoin.amos.boot.module.tdc.api.entity.CheckReport;
import com.yeejoin.amos.boot.module.tdc.api.enums.ReportStateEnum; import com.yeejoin.amos.boot.module.tdc.api.enums.ReportStateEnum;
import com.yeejoin.amos.boot.module.tdc.api.feign.IdxFeignService; import com.yeejoin.amos.boot.module.tdc.api.feign.IdxFeignService;
import com.yeejoin.amos.boot.module.tdc.api.mapper.CheckReportMapper; import com.yeejoin.amos.boot.module.tdc.api.mapper.CheckReportMapper;
import com.yeejoin.amos.boot.module.tdc.api.service.CheckReportService; import com.yeejoin.amos.boot.module.tdc.api.service.CheckReportService;
import com.yeejoin.amos.boot.module.tdc.api.service.CheckResultService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import springfox.documentation.spring.web.json.Json; import springfox.documentation.spring.web.json.Json;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -29,6 +36,9 @@ public class CheckReportImpl extends ServiceImpl<CheckReportMapper, CheckReport> ...@@ -29,6 +36,9 @@ public class CheckReportImpl extends ServiceImpl<CheckReportMapper, CheckReport>
@Autowired @Autowired
IdxFeignService idxFeignService; IdxFeignService idxFeignService;
@Autowired
CheckResultService checkResultService;
@Override @Override
public IPage<CheckReport> selectAll(int current,int size,String amosOrgCode) { public IPage<CheckReport> selectAll(int current,int size,String amosOrgCode) {
Page<CheckReport> page = new Page<>(current,size); Page<CheckReport> page = new Page<>(current,size);
...@@ -78,4 +88,14 @@ public class CheckReportImpl extends ServiceImpl<CheckReportMapper, CheckReport> ...@@ -78,4 +88,14 @@ public class CheckReportImpl extends ServiceImpl<CheckReportMapper, CheckReport>
} }
@Override
public void createReport(String batchNo, AgencyUserModel userInfo) {
List<CompanyModel> companyList = userInfo.getCompanys();
if (!CollectionUtils.isEmpty(companyList)) {
String orgCode = companyList.get(0).getOrgCode();
String realName = userInfo.getRealName();
checkResultService.saveSql(orgCode, realName, batchNo);
}
}
} }
...@@ -15,15 +15,13 @@ import com.stoyanr.evictor.queue.NavigableMapEvictionQueue; ...@@ -15,15 +15,13 @@ import com.stoyanr.evictor.queue.NavigableMapEvictionQueue;
import com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto; import com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto;
import com.yeejoin.amos.boot.module.tdc.api.dto.DimensionTableDto; import com.yeejoin.amos.boot.module.tdc.api.dto.DimensionTableDto;
import com.yeejoin.amos.boot.module.tdc.api.dto.ModelTreeDto; import com.yeejoin.amos.boot.module.tdc.api.dto.ModelTreeDto;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckModel; import com.yeejoin.amos.boot.module.tdc.api.entity.*;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckReport;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckResult;
import com.yeejoin.amos.boot.module.tdc.api.entity.PowerReportFile;
import com.yeejoin.amos.boot.module.tdc.api.enums.WordPowerTypeEum; import com.yeejoin.amos.boot.module.tdc.api.enums.WordPowerTypeEum;
import com.yeejoin.amos.boot.module.tdc.api.feign.IdxFeignService; import com.yeejoin.amos.boot.module.tdc.api.feign.IdxFeignService;
import com.yeejoin.amos.boot.module.tdc.api.mapper.CheckModelMapper; import com.yeejoin.amos.boot.module.tdc.api.mapper.CheckModelMapper;
import com.yeejoin.amos.boot.module.tdc.api.mapper.CheckReportMapper; import com.yeejoin.amos.boot.module.tdc.api.mapper.CheckReportMapper;
import com.yeejoin.amos.boot.module.tdc.api.mapper.CheckResultMapper; import com.yeejoin.amos.boot.module.tdc.api.mapper.CheckResultMapper;
import com.yeejoin.amos.boot.module.tdc.api.mapper.ModelItemMapper;
import com.yeejoin.amos.boot.module.tdc.api.service.CheckReportService; import com.yeejoin.amos.boot.module.tdc.api.service.CheckReportService;
import com.yeejoin.amos.boot.module.tdc.api.service.CheckResultService; import com.yeejoin.amos.boot.module.tdc.api.service.CheckResultService;
import com.yeejoin.amos.boot.module.tdc.api.utils.WordPowerUtils; import com.yeejoin.amos.boot.module.tdc.api.utils.WordPowerUtils;
...@@ -31,11 +29,13 @@ import com.yeejoin.amos.boot.module.tdc.api.vo.SubjectTreeVo; ...@@ -31,11 +29,13 @@ import com.yeejoin.amos.boot.module.tdc.api.vo.SubjectTreeVo;
import com.yeejoin.amos.boot.module.tdc.api.vo.TableColumnsVo; import com.yeejoin.amos.boot.module.tdc.api.vo.TableColumnsVo;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
import liquibase.pro.packaged.M; import liquibase.pro.packaged.M;
import org.codehaus.jettison.json.JSONString; import org.codehaus.jettison.json.JSONString;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
...@@ -65,6 +65,8 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult> ...@@ -65,6 +65,8 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult>
@Autowired @Autowired
CheckModelMapper checkModelMapper; CheckModelMapper checkModelMapper;
@Autowired
ModelItemMapper modelItemMapper;
@Override @Override
public IPage<CheckResultDto> selectResult(int current,int size,String code) { public IPage<CheckResultDto> selectResult(int current,int size,String code) {
...@@ -345,6 +347,50 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult> ...@@ -345,6 +347,50 @@ public class CheckResultImpl extends ServiceImpl<CheckResultMapper, CheckResult>
} }
} }
@Override
public List<ModelTreeDto> getModelTreeData(String modelName, AgencyUserModel user) {
List<CompanyModel> companyList = user.getCompanys();
List<ModelTreeDto> list = new ArrayList<>();
if (!CollectionUtils.isEmpty(companyList)) {
String companyName = companyList.get(0).getCompanyName();
String orgCode = companyList.get(0).getOrgCode();
List<ModelItem> listByName = modelItemMapper.getListByName(modelName, orgCode);
if (!CollectionUtils.isEmpty(listByName)) {
Map<String, List<ModelItem>> collect = listByName.stream().collect(Collectors.groupingBy(ModelItem::getModelName));
collect.forEach((key, value) -> {
ModelTreeDto modelTreeDto = new ModelTreeDto();
modelTreeDto.setAmosOrgName(companyName);
modelTreeDto.setName(key);
modelTreeDto.setId(key);
List<Map<String, Object>> valueList = value.stream().map(e -> {
Map<String, Object> map = new HashMap<>(3);
map.put("data", e.getCheckItemValue());
map.put("id", e.getSequenceNbr());
map.put("name", e.getCheckItemLabel());
return map;
}).collect(Collectors.toList());
modelTreeDto.setChildren(valueList);
list.add(modelTreeDto);
});
}
}
return list;
}
@Override
public List<CheckResult> getCheckItem(String modelName, AgencyUserModel userInfo) {
// List<CompanyModel> companyList = userInfo.getCompanys();
// List<CheckResult> resultList = new ArrayList<>();
// if (!CollectionUtils.isEmpty(companyList)) {
// String orgCode = companyList.get(0).getOrgCode();
// resultList = checkResultMapper.getCheckItemNo(modelName, orgCode);
// }
return checkResultMapper.getCheckItemNo(modelName);
}
@Override
public Map<String, Object> selectCheckItemTotal(String modelName, AgencyUserModel userInfo) {
return checkResultMapper.selectCheckItemTotal(modelName);
}
} }
...@@ -43,6 +43,9 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem ...@@ -43,6 +43,9 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
@Autowired @Autowired
SubmitRecordMapper submitRecordMapper; SubmitRecordMapper submitRecordMapper;
@Autowired
ModelItemMapper modelItemMapper;
@Override @Override
public void saveModelItem(JSONObject jsonObject, AgencyUserModel userInfo) { public void saveModelItem(JSONObject jsonObject, AgencyUserModel userInfo) {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
...@@ -160,5 +163,4 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem ...@@ -160,5 +163,4 @@ public class ModelItemServiceImpl extends ServiceImpl<ModelItemMapper, ModelItem
checkResultMapper.delete(resultWrapper); checkResultMapper.delete(resultWrapper);
} }
} }
} }
package com.yeejoin.amos.boot.module.tdc.biz.service.impl; package com.yeejoin.amos.boot.module.tdc.biz.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord; import com.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord;
import com.yeejoin.amos.boot.module.tdc.api.mapper.SubmitRecordMapper; import com.yeejoin.amos.boot.module.tdc.api.mapper.SubmitRecordMapper;
import com.yeejoin.amos.boot.module.tdc.api.service.SubmitRecordService; import com.yeejoin.amos.boot.module.tdc.api.service.SubmitRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -14,6 +17,15 @@ import org.springframework.util.ObjectUtils; ...@@ -14,6 +17,15 @@ import org.springframework.util.ObjectUtils;
@Service @Service
public class SubmitRecordServiceImpl extends ServiceImpl<SubmitRecordMapper, SubmitRecord> implements SubmitRecordService { public class SubmitRecordServiceImpl extends ServiceImpl<SubmitRecordMapper, SubmitRecord> implements SubmitRecordService {
@Autowired
SubmitRecordMapper submitRecordMapper;
@Override
public IPage<SubmitRecord> selectByOrgCode(int current, int size) {
Page page = new Page(current,size);
return submitRecordMapper.selectByOrgCode(page);
}
@Override @Override
public int saveSubmitRecord(SubmitRecord submitRecord) { public int saveSubmitRecord(SubmitRecord submitRecord) {
return this.baseMapper.insert(submitRecord); return this.baseMapper.insert(submitRecord);
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>amos-boot-utils</artifactId>
<groupId>com.amosframework.boot</groupId>
<version>1.0.0</version>
</parent>
<artifactId>amos-boot-utils-message</artifactId>
<properties>
<tyboot.version>1.1.23-SNAPSHOT</tyboot.version>
</properties>
<dependencies>
<dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-core</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
<!--kafka依赖-->
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.typroject</groupId>
<artifactId>tyboot-component-emq</artifactId>
<version>${tyboot.version}</version>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
package com.yeejoin.amos;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.core.env.Environment;
import java.net.InetAddress;
import java.net.UnknownHostException;
/**
* <pre>
* 服务启动类
* </pre>
*
* @author amos
* @version $Id: YeeAMOSPatrolStart.java, v 0.1 2018年11月26日 下午4:56:29 amos Exp $
*/
@SpringBootApplication
@EnableConfigurationProperties
@ServletComponentScan
@EnableDiscoveryClient
@EnableFeignClients
@EnableAsync
@EnableEurekaClient
@ComponentScan({"org.typroject","com.yeejoin.amos"})
public class AmosBootUtilsMessageApplication {
private static final Logger logger = LoggerFactory.getLogger(AmosBootUtilsMessageApplication.class);
public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext context = SpringApplication.run(AmosBootUtilsMessageApplication.class, args);
Environment env = context.getEnvironment();
String ip = InetAddress.getLocalHost().getHostAddress();
String port = env.getProperty("server.port");
String path = env.getProperty("server.servlet.context-path");
logger.info("\n----------------------------------------------------------\n\t" +
"Application Amos-Biz-Boot is running! Access URLs:\n\t" +
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" +
"----------------------------------------------------------");
}
}
package com.yeejoin.amos.message.eqmx;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.message.kafka.KafkaProducerService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.component.emq.EmqxListener;
import javax.annotation.PostConstruct;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import net.sf.json.JSONObject;
@Slf4j
@Component
public class EmqMessageService extends EmqxListener {
@Autowired
protected EmqKeeper emqKeeper;
@Autowired
protected KafkaProducerService kafkaProducerService;
@Value("classpath:/json/topic.json")
private Resource topic;
private List<Map> list;
@Value("${emq.topic}")
private String topics;
private static final BlockingQueue<JSONObject> blockingQueue = new LinkedBlockingQueue<>();
@PostConstruct
void init() {
new Thread(task_runnable).start();
String json = null;
try {
json = IOUtils.toString(topic.getInputStream(), java.lang.String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
e.printStackTrace();
}
list = com.alibaba.fastjson.JSONObject.parseArray(json, Map.class);
String[] split = topics.split(",");
Arrays.stream(split).forEach(e-> {
try {
emqKeeper.subscript(e, 1, this);
} catch (Exception exception) {
log.info("订阅eqm消息失败 ====> message: {}", exception.getMessage());
}
});
}
@Override
public void processMessage(String topic, MqttMessage message) throws Exception {
JSONObject result = JSONObject.fromObject(new String(message.getPayload()));
JSONObject messageResult = new JSONObject();
messageResult.put("result", result);
messageResult.put("topic", topic);
blockingQueue.add(messageResult);
}
Runnable task_runnable = new Runnable() {
public void run() {
while (true) {
try {
JSONObject messageResult = blockingQueue.take();
JSONObject result = messageResult.getJSONObject("result");
// 处理逻辑
list.forEach(e->{
if (e.get("emqTopic").toString().equals(messageResult.getString("topic"))) {
kafkaProducerService.sendMessageAsync(e.get("akkaTopic").toString(),JSON.toJSONString(result));
}
});
} catch (Exception e) {
log.info("发送kafka消息失败 ====> message: {}", e.getMessage());
}
}
}
};
}
package com.yeejoin.amos.message.kafka;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.support.Acknowledgment;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.component.emq.EmqKeeper;
import java.io.UnsupportedEncodingException;
/**
* kafka 消费服务
*
* @author litw
* @create 2022/11/1 10:06
**/
@Slf4j
@Service
public class KafkaConsumerService {
@Autowired
protected EmqKeeper emqKeeper;
/**
* 消费单条消息,topics 可以监听多个topic,如:topics = {"topic1", "topic2"}
* @param message 消息
*/
@KafkaListener(id = "consumerSingle", topics = "#{'${kafka.topics}'.split(',')}")
public void consumerSingle(String message,Acknowledgment ack) {
JSONObject messageObj = JSONObject.fromObject(message);
String topic = messageObj.getString("topic");
JSONObject data = messageObj.getJSONObject("data");
try {
emqKeeper.getMqttClient().publish(topic, data.toString().getBytes("UTF-8"), 0,false);
} catch (MqttException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
log.info("单条消息 ====> message: {}", message);
ack.acknowledge();
}
/* @KafkaListener(id = "consumerBatch", topicPartitions = {
@TopicPartition(topic = "hello-batch1", partitions = "0"),
@TopicPartition(topic = "hello-batch2", partitionOffsets = @PartitionOffset(partition = "2", initialOffset = "4"))
})*/
// /**
// * 批量消费消息
// * @param messages
// */
// @KafkaListener(id = "consumerBatch", topics = "test-batch")
// public void consumerBatch(List<ConsumerRecord<String, String>> messages) {
// log.info("consumerBatch =====> messageSize: {}", messages.size());
// log.info(messages.toString());
// }
// /**
// * 指定消费异常处理器
// * @param message
// */
// @KafkaListener(id = "consumerException", topics = "kafka-test-topic", errorHandler = "consumerAwareListenerErrorHandler")
// public void consumerException(String message) {
// throw new RuntimeException("consumer exception");
// }
//
// /**
// * 验证ConsumerInterceptor
// * @param message
// */
// @KafkaListener(id = "interceptor", topics = "consumer-interceptor")
// public void consumerInterceptor(String message) {
// log.info("consumerInterceptor ====> message: {}", message);
// }
//
//
//
// //kafka的监听器,topic为"zhTest",消费者组为"zhTestGroup"
// @KafkaListener(topics = "test", groupId = "zhTestGroup")
// public void listenZhugeGroup(ConsumerRecord<String, String> record, Acknowledgment ack) {
// String value = record.value();
// System.out.println(value);
// System.out.println(record);
// //手动提交offset
// ack.acknowledge();
// }
}
package com.yeejoin.amos.message.kafka;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaOperations;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.kafka.support.KafkaHeaders;
import org.springframework.kafka.support.SendResult;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Service;
import org.springframework.util.concurrent.ListenableFuture;
import org.springframework.util.concurrent.ListenableFutureCallback;
import org.typroject.tyboot.component.emq.EmqKeeper;
import javax.annotation.Resource;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/**
* kafka 生产服务
*
* @author litw
* @create 2022/11/1 10:06
**/
@Slf4j
@Service
public class KafkaProducerService {
@Resource
private KafkaTemplate<String, String> kafkaTemplate;
@Resource
private KafkaTemplate<String, String> kafkaTemplateWithTransaction;
/**
* 发送消息(同步)
* @param topic 主题
* @param key 键
* @param message 值
*/
public void sendMessageSync(String topic, String key, String message) throws InterruptedException, ExecutionException, TimeoutException {
//可以指定最长等待时间,也可以不指定
kafkaTemplate.send(topic, message).get(10, TimeUnit.SECONDS);
log.info("sendMessageSync => topic: {}, key: {}, message: {}", topic, key, message);
//指定key,kafka根据key进行hash,决定存入哪个partition
// kafkaTemplate.send(topic, key, message).get(10, TimeUnit.SECONDS);
//存入指定partition
// kafkaTemplate.send(topic, 0, key, message).get(10, TimeUnit.SECONDS);
}
/**
* 发送消息并获取结果
* @param topic
* @param message
* @throws ExecutionException
* @throws InterruptedException
*/
public void sendMessageGetResult(String topic, String key, String message) throws ExecutionException, InterruptedException {
SendResult<String, String> result = kafkaTemplate.send(topic, message).get();
log.info("sendMessageSync => topic: {}, key: {}, message: {}", topic, key, message);
log.info("The partition the message was sent to: " + result.getRecordMetadata().partition());
}
/**
* 发送消息(异步)
* @param topic 主题
* @param message 消息内容
*/
public void sendMessageAsync(String topic, String message) {
ListenableFuture<SendResult<String, String>> future = kafkaTemplate.send(topic, message);
//添加回调
future.addCallback(new ListenableFutureCallback<SendResult<String, String>>() {
@Override
public void onFailure(Throwable throwable) {
log.error("发送消息(异步) failure! topic : {}, message: {}", topic, message);
}
@Override
public void onSuccess(SendResult<String, String> stringStringSendResult) {
log.info("发送消息(异步) success! topic: {}, message: {}", topic, message);
}
});
}
/**
* 可以将消息组装成 Message 对象和 ProducerRecord 对象发送
* @param topic
* @param key
* @param message
* @throws InterruptedException
* @throws ExecutionException
* @throws TimeoutException
*/
public void testMessageBuilder(String topic, String key, String message) throws InterruptedException, ExecutionException, TimeoutException {
// 组装消息
Message msg = MessageBuilder.withPayload(message)
.setHeader(KafkaHeaders.MESSAGE_KEY, key)
.setHeader(KafkaHeaders.TOPIC, topic)
.setHeader(KafkaHeaders.PREFIX,"kafka_")
.build();
//同步发送
kafkaTemplate.send(msg).get();
// 组装消息
// ProducerRecord<String, String> producerRecord = new ProducerRecord<>(topic, message);
// kafkaTemplate.send(producerRecord).get(10, TimeUnit.SECONDS);
}
/**
* 以事务方式发送消息
* @param topic
* @param key
* @param message
*/
public void sendMessageInTransaction(String topic, String key, String message) {
kafkaTemplateWithTransaction.executeInTransaction(new KafkaOperations.OperationsCallback<String, String, Object>() {
@Override
public Object doInOperations(KafkaOperations<String, String> kafkaOperations) {
kafkaOperations.send(topic, key, message);
//出现异常将会中断事务,消息不会发送出去
throw new RuntimeException("12");
}
});
}
}
package com.yeejoin.amos.message.kafka.config;
import org.apache.kafka.clients.admin.NewTopic;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
/**
* topic初始化
*
* @author litw
* @create 2022/11/1 10:06
*/
@Configuration class KafkaConfig {
@Value("${kafka.init.topics}")
private String topics;
/**
* 创建一个名为topic.test的Topic并设置分区数为8,分区副本数为2
*/
@Bean public void initialTopic() {
String[] split = topics.split(",");
Arrays.stream(split).forEach(e->{
new NewTopic(e, 8, (short) 2);
});
}
}
\ No newline at end of file
package com.yeejoin.amos.message.kafka.config;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.Consumer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.listener.ConsumerAwareListenerErrorHandler;
import org.springframework.kafka.listener.ListenerExecutionFailedException;
import org.springframework.messaging.Message;
/**
* kafka 消费者配置类
*
* @author Leo
* @create 2020/12/31 15:09
**/
@Slf4j
@Configuration
public class KafkaConsumerConfiguration {
/**
* 消费异常处理器
* @return
*/
@Bean
public ConsumerAwareListenerErrorHandler consumerAwareListenerErrorHandler() {
return new ConsumerAwareListenerErrorHandler() {
@Override
public Object handleError(Message<?> message, ListenerExecutionFailedException exception, Consumer<?, ?> consumer) {
//打印消费异常的消息和异常信息
log.error("消费异常的消息 failed! message: {}, exceptionMsg: {}, groupId: {}", message, exception.getMessage(), exception.getGroupId());
return null;
}
};
}
}
#注册中心地址
eureka.client.service-url.defaultZone =http://172.16.11.201:10001/eureka/
eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*
eureka.instance.health-check-url-path=/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
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
## emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.11.201:1883
emqx.client-user-name=admin
emqx.client-password=public
emqx.max-inflight=1000
spring.redis.database=1
spring.redis.host=172.16.11.201
spring.redis.port=6379
spring.redis.password=1234560
#需要监听得kafka消息主题 根据是否是中心极和站端选择需要监听得主题进行配置
kafka.topics=null.topic
kafka.init.topics=akka.iot.created,akka.patrol.created,akka.sign.created,akka.bussSign.created,akka.user.created
#需要监听得eqm消息主题 根据是否是中心极和站端选择需要监听得主题进行配置
emq.topic=emq.iot.created,emq.patrol.created,emq.sign.created,emq.bussSign.created,emq.user.created
\ No newline at end of file
spring.application.name=AMOS-MESSAGE
server.servlet.context-path=/message
server.port=8119
spring.profiles.active=dev
spring.jackson.time-zone=GMT+8
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.serialization.write-dates-as-timestamps=true
# kafka集群信息
spring.kafka.bootstrap-servers=172.16.3.100:9092
# 生产者配置
# 设置大于0的值,则客户端会将发送失败的记录重新发送 # 重试次数
spring.kafka.producer.retries=3
#16K
spring.kafka.producer.batch-size=16384
spring.kafka.producer.buffer-memory=33554432
# 应答级别
# acks=0 把消息发送到kafka就认为发送成功
# acks=1 把消息发送到kafka leader分区,并且写入磁盘就认为发送成功
# acks=all 把消息发送到kafka leader分区,并且leader分区的副本follower对消息进行了同步就任务发送成功
spring.kafka.producer.acks=1
# 指定消息key和消息体的编解码方式
# # 批量处理的最大大小 单位 byte
# batch-size: 4096
# # 发送延时,当生产端积累的消息达到batch-size或接收到消息linger.ms后,生产者就会将消息提交给kafka
# buffer-memory: 33554432
# # 客户端ID
# client-id: hello-kafka
# # 消息压缩:none、lz4、gzip、snappy,默认为 none。
# compression-type: gzip
spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer
# 消费者组
# 当kafka中没有初始offset或offset超出范围时将自动重置offset
# earliest:重置为分区中最小的offset
# latest:重置为分区中最新的offset(消费分区中新产生的数据)
# none:只要有一个分区不存在已提交的offset,就抛出异常
spring.kafka.consumer.group-id=zhTestGroup
spring.kafka.consumer.enable-auto-commit=false
# 当各分区下有已提交的offset时,从提交的offset开始消费;无提交的offset时,从头开始消费
# # 自动提交的频率 单位 ms
# auto-commit-interval: 1000
# # 批量消费最大数量
# max-poll-records: 100
spring.kafka.consumer.auto-offset-reset=earliest
spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer
spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer
# 当每一条记录被消费者监听器(ListenerConsumer)处理之后提交
# RECORD
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后提交
# BATCH
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后,距离上次提交时间大于TIME时提交
# TIME
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后,被处理record数量大于等于COUNT时提交
# COUNT
# TIME | COUNT 有一个条件满足时提交
# COUNT_TIME
# 当每一批poll()的数据被消费者监听器(ListenerConsumer)处理之后, 手动调用Acknowledgment.acknowledge()后提交
# MANUAL
# 手动调用Acknowledgment.acknowledge()后立即提交,一般使用这种
# MANUAL_IMMEDIATE
spring.kafka.listener.ack-mode=manual_immediate
[
{
"code": "iot",
"emqTopic": "emq.iot.created",
"akkaTopic": "akka.iot.created"
},
{
"code": "patrol",
"emqTopic": "emq.patrol.created",
"akkaTopic": "akka.patrol.created"
},
{
"code": "sign",
"emqTopic": "emq.sign.created",
"akkaTopic": "akka.sign.created"
},
{
"code": "bussSign",
"emqTopic": "emq.bussSign.created",
"akkaTopic": "akka.bussSign.created"
},
{
"code": "user",
"emqTopic": "emq.user.created",
"akkaTopic": "akka.user.created"
}
]
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="log" />
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/jpush.log.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
<!--日志文件大小-->
<MaxFileSize>30mb</MaxFileSize>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
</encoder>
</appender>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
</encoder>
</appender>
<!-- show parameters for hibernate sql 专为 Hibernate 定制
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="DEBUG"/>
<logger name="org.mybatis" level="DEBUG" />
<logger name="java.sql.Connection" level="DEBUG"/>
<logger name="java.sql.Statement" level="DEBUG"/>
<logger name="java.sql.PreparedStatement" level="DEBUG"/>
<logger name="org.springframework" level="DEBUG"/>
<!-- 日志输出级别 -->
<root level="DEBUG">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false">
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="log"/>
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/jpush.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<MaxHistory>30</MaxHistory>
<!--按大小分割同一天的-->
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
</encoder>
</appender>
<!-- show parameters for hibernate sql 专为 Hibernate 定制
<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE" />
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor" level="DEBUG" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
-->
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="INFO"/>
<logger name="org.mybatis" level="INFO"/>
<logger name="java.sql.Connection" level="INFO"/>
<logger name="java.sql.Statement" level="INFO"/>
<logger name="java.sql.PreparedStatement" level="INFO"/>
<logger name="com.baomidou.mybatisplus" level="INFO"/>
<logger name="org.typroject" level="INFO"/>
<logger name="com.yeejoin.amos" level="INFO"/>
<logger name="org.springframework" level="INFO"/>
<!-- 日志输出级别 -->
<root level="INFO">
<appender-ref ref="FILE"/>
</root>
</configuration>
\ No newline at end of file
package com.yeejoin.amos;
import com.yeejoin.amos.message.kafka.KafkaProducerService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class AmosBootUtilsMessageApplicationTests {
@Autowired
private KafkaProducerService kafkaProducerService;
@Test
void contextLoads() {
String msg = "hello";
kafkaProducerService.sendMessageAsync("akka.iot.created",msg);
}
}
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