Commit 28f0998f authored by maoying's avatar maoying

Merge branch 'develop_dl_plan6' into develop_dl_plan6_temp

parents 1f0f1d08 c61b6183
......@@ -65,6 +65,12 @@ public interface DutyPersonShiftMapper extends BaseMapper<DutyPersonShift> {
@Param("dutyDate") String dutyDate,
@Param("groupCode") String groupCode
);
List<Map<String, Object>> newStationViewDataByFieldCode(
@Param("dutyDate") String dutyDate,
@Param("groupCode") String groupCode,
@Param("fieldCode") String fieldCode
);
/**
* 利用mysql 生成连续时间区间
*
......
......@@ -32,12 +32,14 @@ public interface IDutyCommonService {
List<Map<String, Object>> statisticsDay(String beginDate, String endDate) throws ParseException;
/**
* 新值班月视图
*
* @param beginDate
* @param endDate
* @param dutyType
* @return
* @throws ParseException
*/
List<Map<String, Object>> newStatisticsDay(String beginDate, String endDate) throws ParseException;
List<Map<String, Object>> newStatisticsDay(String beginDate, String endDate, String fieldCode) throws ParseException;
/**
* 不分页查询
*
......
......@@ -102,6 +102,21 @@
and i.group_code =#{groupCode}
GROUP BY i.field_value
</select>
<select id="newStationViewDataByFieldCode" resultType="java.util.Map">
select
i.field_value as postTypeName,
count(1) as total
from
cb_duty_person_shift s,
cb_dynamic_form_instance i
where
s.instance_id = i.instance_id
and i.field_code = #{fieldCode}
AND s.duty_date = #{dutyDate}
AND s.shift_id is not null
and i.group_code =#{groupCode}
GROUP BY i.field_value
</select>
<select id="genRangeDate" resultType="map">
SELECT
DATE_FORMAT(DATE( DATE_ADD( #{beginDate}, INTERVAL @s DAY )),'%Y-%m-%d') AS date,
......
......@@ -103,9 +103,10 @@ public class DutyCarController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "新值班月视图", notes = "新值班月视图")
public ResponseModel<List<Map<String, Object>>> newDutyDetail(
@ApiParam(value = "开始日期", required = true) @RequestParam String beginDate,
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate,
@ApiParam(value = "属性编码") @RequestParam(required = false) String fieldCode
) throws ParseException {
return ResponseHelper.buildResponse(iDutyCarService.newStatisticsDay(beginDate, endDate));
return ResponseHelper.buildResponse(iDutyCarService.newStatisticsDay(beginDate, endDate, fieldCode));
}
/**
* 调班
......
package com.yeejoin.amos.boot.module.common.biz.controller;
import java.text.ParseException;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
......@@ -18,18 +17,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.DateUtil;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.common.api.dto.DutyFireFightingDto;
import com.yeejoin.amos.boot.module.common.api.service.IDutyFireFightingService;
......@@ -102,9 +97,10 @@ public class DutyFireFightingController extends BaseController{
@ApiOperation(httpMethod = "GET", value = "新值班月视图", notes = "新值班月视图")
public ResponseModel<List<Map<String, Object>>> newDutyDetail(
@ApiParam(value = "开始日期", required = true) @RequestParam String beginDate,
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate,
@ApiParam(value = "属性编码") @RequestParam(required = false) String fieldCode
) throws ParseException {
return ResponseHelper.buildResponse(iDutyFireFightingService.newStatisticsDay(beginDate, endDate));
return ResponseHelper.buildResponse(iDutyFireFightingService.newStatisticsDay(beginDate, endDate, fieldCode));
}
/**
* 调班
......
......@@ -89,9 +89,10 @@ public class DutyFirstAidController extends BaseController{
@ApiOperation(httpMethod = "GET", value = "新值班月视图", notes = "新值班月视图")
public ResponseModel<List<Map<String, Object>>> newDutyDetail(
@ApiParam(value = "开始日期", required = true) @RequestParam String beginDate,
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate,
@ApiParam(value = "属性编码") @RequestParam(required = false) String fieldCode
) throws ParseException {
return ResponseHelper.buildResponse(iDutyFirstAidService.newStatisticsDay(beginDate, endDate));
return ResponseHelper.buildResponse(iDutyFirstAidService.newStatisticsDay(beginDate, endDate, fieldCode));
}
/**
* 调班
......
......@@ -103,9 +103,10 @@ public class DutyPersonController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "新值班月视图", notes = "新值班月视图")
public ResponseModel<List<Map<String, Object>>> newDutyDetail(
@ApiParam(value = "开始日期", required = true) @RequestParam String beginDate,
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate
@ApiParam(value = "结束日期", required = true) @RequestParam String endDate,
@ApiParam(value = "属性编码") @RequestParam(required = false) String fieldCode
) throws ParseException {
return ResponseHelper.buildResponse(iDutyPersonService.newStatisticsDay(beginDate, endDate));
return ResponseHelper.buildResponse(iDutyPersonService.newStatisticsDay(beginDate, endDate, fieldCode));
}
/**
......
......@@ -230,7 +230,8 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
LocalDate startDate = LocalDate.parse(start);
LocalDate endDate = LocalDate.parse(end);
long distance = ChronoUnit.DAYS.between(startDate, endDate);
if (distance < 1) {
if (distance < 1 && StringUtils.isNotBlank(start)) {
list.add(start);
return list;
}
Stream.iterate(startDate, d -> d.plusDays(1)).limit(distance + 1).forEach(f -> list.add(f.toString()));
......@@ -278,7 +279,7 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
/*bug2468 值班排班,日历视图单班次执勤人数满足≤3且班次≤2时,值班显示方式错误 陈召 结束*/
}
public List<Map<String, Object>> newStatisticsDay(String beginDate, String endDate) throws ParseException {
public List<Map<String, Object>> newStatisticsDay(String beginDate, String endDate, String fieldCode) throws ParseException {
Date dateBegin = DateUtils.dateParse(beginDate, DateUtils.DATE_PATTERN);
String timeStart = DateUtils.dateTimeToDateString(dateBegin);
......@@ -306,7 +307,7 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
result.put("key", objectMap.get("date"));
String dateString = objectMap.get("date").toString();
if(this.getGroupCode().equals("dutyPerson")) {
result.put("data", getPersonPostTypeNameAndCount(dateString));
result.put("data", getPersonPostTypeNameAndCount(dateString, fieldCode));
}else if(this.getGroupCode().equals("dutyCar")) {
result.put("data", getCarPostTypeNameAndCount(dateString));
}else if(this.getGroupCode().equals("dutyFireFighting")) {
......@@ -323,11 +324,16 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
/**
* 排班值班人员的统计类型为:
* 岗位: 岗位人员数量
* 岗位: 岗位人员数量
*
* @param dutyDate
* @param dutyType
* @return
*/
public Object getPersonPostTypeNameAndCount(String dutyDate) {
public Object getPersonPostTypeNameAndCount(String dutyDate, String fieldCode) {
if (StringUtils.isNotBlank(fieldCode)) {
return dutyPersonShiftService.getBaseMapper().newStationViewDataByFieldCode(dutyDate, this.getGroupCode(), fieldCode);
}
return dutyPersonShiftService.getBaseMapper().newStationViewData(dutyDate, this.getGroupCode());
}
/**
......
......@@ -418,56 +418,56 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
queryWrapper.ne(EquipmentSpecificAlarmLog::getStatus, AlarmStatusEnum.HF.getCode());
List<EquipmentSpecificAlarmLog> logs = equipmentSpecificAlarmLogService.getBaseMapper()
.selectList(queryWrapper);
EquipmentSpecificAlarmLog log = logs.get(0);
String cleanType = equipmentSpecificMapper.getEquipmentBySpecificId(log.getEquipmentSpecificId());
EquipmentSpecific specific = equipmentSpecificMapper.selectById(log.getEquipmentSpecificId());
Date date = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(date);
logs.forEach(x -> {
x.setCleanTime(new Date());
x.setStatus(AlarmStatusEnum.HF.getCode());
x.setEquipmentSpecificIndexValue(TrueOrFalseEnum.fake.value);
if (!StringUtils.isEmpty(traceId)) {
x.setTraceId(traceId);
}
// 自动确警处理
if (StringUtil.isNotEmpty(cleanType) && AlarmCleanTypeEnum.ZDXC.getCode().equals(cleanType)){
x.setConfirmType(x.getType());
x.setConfirmTypeName(ConfirmAlamEnum.getTypeByCode(x.getType()));
String equipmentName = StringUtil.isNotEmpty(specific.getCode()) ? specific.getName() + "(" + specific.getCode() + ")" : specific.getName();
if (x.getType().equals(AlarmTypeEnum.PB.getCode())) {
x.setAlarmReason(equipmentName + "频繁故障/误报,将设备报警信息屏蔽。");
} else {
x.setAlarmReason(equipmentName + "引起设备报警");
if (0 < logs.size()) {
EquipmentSpecificAlarmLog log = logs.get(0);
String cleanType = equipmentSpecificMapper.getEquipmentBySpecificId(log.getEquipmentSpecificId());
EquipmentSpecific specific = equipmentSpecificMapper.selectById(log.getEquipmentSpecificId());
Date date = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(date);
logs.forEach(x -> {
x.setCleanTime(new Date());
x.setStatus(AlarmStatusEnum.HF.getCode());
x.setEquipmentSpecificIndexValue(TrueOrFalseEnum.fake.value);
if (!StringUtils.isEmpty(traceId)) {
x.setTraceId(traceId);
}
x.setResolveResult(dateString + "系统收到设备复归(已消除)信号,系统自动处理。");
x.setConfirmUser("");
x.setConfirmUserName("系统自动处理");
x.setConfirmDate(date);
}
});
if (jcsSwitch && AlarmTypeEnum.HZGJ.getCode().equals(log.getType())) {
Token token = remoteSecurityService.getServerToken();
String toke = token.getToke();
String appKey = token.getAppKey();
String product = token.getProduct();
String userId = remoteSecurityService.getAgencyUser().getUserId();
// 确警消息发送
if (org.apache.commons.lang3.StringUtils.isNotBlank(userId)) {
new Thread(new Runnable() {
@Override
public void run() {
try {
ConfirmAlarmServiceImpl.sendIotSystemAlarm(log, userId, appKey, product, toke);
} catch (Exception e) {
e.printStackTrace();
}
// 自动确警处理
if (StringUtil.isNotEmpty(cleanType) && AlarmCleanTypeEnum.ZDXC.getCode().equals(cleanType)){
x.setConfirmType(x.getType());
x.setConfirmTypeName(ConfirmAlamEnum.getTypeByCode(x.getType()));
String equipmentName = StringUtil.isNotEmpty(specific.getCode()) ? specific.getName() + "(" + specific.getCode() + ")" : specific.getName();
if (x.getType().equals(AlarmTypeEnum.PB.getCode())) {
x.setAlarmReason(equipmentName + "频繁故障/误报,将设备报警信息屏蔽。");
} else {
x.setAlarmReason(equipmentName + "引起设备报警");
}
}).start();
x.setResolveResult(dateString + "系统收到设备复归(已消除)信号,系统自动处理。");
x.setConfirmUser("");
x.setConfirmUserName("系统自动处理");
x.setConfirmDate(date);
}
});
if (jcsSwitch && AlarmTypeEnum.HZGJ.getCode().equals(log.getType())) {
Token token = remoteSecurityService.getServerToken();
String toke = token.getToke();
String appKey = token.getAppKey();
String product = token.getProduct();
String userId = remoteSecurityService.getAgencyUser().getUserId();
// 确警消息发送
if (org.apache.commons.lang3.StringUtils.isNotBlank(userId)) {
new Thread(new Runnable() {
@Override
public void run() {
try {
ConfirmAlarmServiceImpl.sendIotSystemAlarm(log, userId, appKey, product, toke);
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
}
}
if (!logs.isEmpty()) {
equipmentSpecificAlarmLogService.updateBatchById(logs);
}
if (flag) {
......
package com.yeejoin.amos.boot.module.tdc.api.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
public class CheckModelDto {
private static final long serialVersionUID = 1L;
@TableId(value = "sequence_nbr", type = IdType.ID_WORKER)
protected Long sequenceNbr;
@ApiModelProperty(value = "模型名称")
private String modelName;
@ApiModelProperty(value = "机构code")
private String amosOrgCode;
@ApiModelProperty(value = "机构名称")
private String amosOrgName;
@ApiModelProperty(value = "指标表名")
private String idxTableName;
@ApiModelProperty(value = "校验状态")
private int checkStatus;
@ApiModelProperty(value = "校验时间")
private Date checkDate;
@ApiModelProperty(value = "模型图片地址")
private String modelPictureUrl;
@ApiModelProperty(value = "模型规则知识包")
private String modelRule;
@ApiModelProperty(value = "指标模型所属项目id")
private String projectId;
@ApiModelProperty(value = "指标模型表id")
private String tableId;
@ApiModelProperty(value = "模型校验项数量")
private int checkItemAmount;
private String circle;
}
......@@ -58,5 +58,4 @@ public class CheckModel {
@ApiModelProperty(value = "模型校验项数量")
private int checkItemAmount;
}
package com.yeejoin.amos.boot.module.tdc.api.mapper;
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.dto.CheckModelDto;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckModel;
import org.mapstruct.Mapper;
......@@ -10,4 +13,6 @@ import org.mapstruct.Mapper;
*/
@Mapper
public interface CheckModelMapper extends BaseMapper<CheckModel> {
IPage<CheckModelDto> selectByOrgCode(Page page, String amosOrgCode);
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tdc.api.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.module.tdc.api.dto.CheckModelDto;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckModel;
import org.springframework.stereotype.Service;
......@@ -19,7 +20,7 @@ public interface CheckModelService extends IService<CheckModel> {
* @return 模型list
*/
// List<CheckModel> selectByOrgCode(String amosOrgCode);
IPage<CheckModel> selectByOrgCode(int current, int size, String amosOrgCode);
IPage<CheckModelDto> selectByOrgCode(int current, int size, String amosOrgCode);
List<CheckModel> selectByOrgCode(String amosOrgCode);
......
......@@ -2,4 +2,13 @@
<!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.CheckModelMapper">
<select id="selectByOrgCode" resultType="com.yeejoin.amos.boot.module.tdc.api.dto.CheckModelDto">
select `*`,'●' as circle from tdc_model
<where>
<if test = "amosOrgCode != null and amosOrgCode != ''">
and amosOrgCode=#{amosOrgCode}
</if>
</where>
</select>
</mapper>
......@@ -2,7 +2,7 @@
<!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.CheckResultMapper">
<select id="selectResult" resultType="com.yeejoin.amos.boot.module.tdc.api.dto.CheckResultDto">
select check_date, case when check_type="1" then '全站校验' else `model_name` end as `name`
select check_date, case when check_type="0" then '全站校验' else `model_name` end as `name`
from `tdc_check_result`
<where>
<if test="code != '' and code != null">
......
package com.yeejoin.amos.boot.module.tdc.biz.controller;
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.CheckModel;
import com.yeejoin.amos.boot.module.tdc.api.service.CheckModelService;
import io.swagger.annotations.Api;
......@@ -32,7 +33,7 @@ public class CheckModelController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "selectByOrgCode")
@ApiOperation(httpMethod = "GET",value = "根据amosOrgCode查询模型列表", notes = "根据amosOrgCode查询模型列表")
public ResponseModel<IPage<CheckModel>> selectByOrgCode(int current, int size, String amosOrgCode) {
public ResponseModel<IPage<CheckModelDto>> selectByOrgCode(int current, int size, String amosOrgCode) {
return ResponseHelper.buildResponse(checkModelService.selectByOrgCode(current,size,amosOrgCode));
}
......
......@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.boot.module.tdc.api.dto.CheckModelDto;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckModel;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckReport;
import com.yeejoin.amos.boot.module.tdc.api.entity.CheckResult;
......@@ -39,27 +40,23 @@ public class CheckModelImpl extends ServiceImpl<CheckModelMapper, CheckModel> im
CheckResultMapper checkResultMapper;
@Autowired
CheckModelMapper checkModelMapper;
@Autowired
IdxFeignService idxFeignService;
@Autowired
RuleTrigger ruleTrigger;
@Override
public IPage<CheckModel> selectByOrgCode(int current, int size, String amosOrgCode) {
public IPage<CheckModelDto> selectByOrgCode(int current, int size, String amosOrgCode) {
Page page = new Page(current,size);
if(ValidationUtil.isEmpty(amosOrgCode)){
return this.page(page);
}else{
LambdaQueryWrapper<CheckModel> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CheckModel::getAmosOrgCode, amosOrgCode);
// return baseMapper.selectList(wrapper);
return this.page(page,wrapper);
}
return checkModelMapper.selectByOrgCode(page,amosOrgCode);
}
@Override
public List<CheckModel> selectByOrgCode(String amosOrgCode) {
LambdaQueryWrapper<CheckModel> wrapper = new LambdaQueryWrapper<>();
......@@ -67,6 +64,8 @@ public class CheckModelImpl extends ServiceImpl<CheckModelMapper, CheckModel> im
return baseMapper.selectList(wrapper);
}
@Override
public CheckModel selectOneByDate(String amosOrgCode) {
LambdaQueryWrapper<CheckModel> wrapper = new LambdaQueryWrapper<>();
......
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