Commit 3782d297 authored by 王果's avatar 王果

Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into…

Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into develop_tzs_register_to_0715
parents 1d3bef08 20786824
...@@ -13,6 +13,4 @@ public interface IAlertStatisticsService { ...@@ -13,6 +13,4 @@ public interface IAlertStatisticsService {
void statisticalGeneration(String type); void statisticalGeneration(String type);
List<AlertStatistics> getList(String date) throws ParseException; List<AlertStatistics> getList(String date) throws ParseException;
JSONArray statisticInfoByRegionAndDate(DPFilterParamDto queryParams);
} }
...@@ -350,14 +350,4 @@ public class StatisticsController extends BaseController { ...@@ -350,14 +350,4 @@ public class StatisticsController extends BaseController {
ExcelUtil.createTemplate(response, "困人救援超时情况统计", "困人救援超时情况统计", exportVos, AlertDispatchStatisticsExportVo.class, null, false); ExcelUtil.createTemplate(response, "困人救援超时情况统计", "困人救援超时情况统计", exportVos, AlertDispatchStatisticsExportVo.class, null, false);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping (value = "/region/info")
@ApiOperation(httpMethod = "POST", value = "查询区域统计信息", notes = "查询区域统计信息")
public ResponseModel<JSONArray> statisticsRegionInfo(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(alertStatisticsService.statisticInfoByRegionAndDate(dpFilterParamDto));
}
} }
...@@ -73,7 +73,6 @@ public class TzsAuthController extends BaseController { ...@@ -73,7 +73,6 @@ public class TzsAuthController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "获取用户regionCode", notes = "获取用户regionCode") @ApiOperation(httpMethod = "GET", value = "获取用户regionCode", notes = "获取用户regionCode")
public ResponseModel<List<String>> getUserRegincode() { public ResponseModel<List<String>> getUserRegincode() {
List<String> regionList = tzsAuthService.getUserRegionCode(); List<String> regionList = tzsAuthService.getUserRegionCode();
AgencyUserModel me = Privilege.agencyUserClient.getme().getResult();
return ResponseHelper.buildResponse(regionList); return ResponseHelper.buildResponse(regionList);
} }
......
...@@ -168,100 +168,4 @@ public class AlertStatisticsServiceImpl extends BaseService<AlertStatisticsDto, ...@@ -168,100 +168,4 @@ public class AlertStatisticsServiceImpl extends BaseService<AlertStatisticsDto,
return alertStatistics; return alertStatistics;
} }
@Override
public JSONArray statisticInfoByRegionAndDate(DPFilterParamDto params) {
LocalDate today = LocalDate.now();
LocalDate startDate;
LocalDate endDate;
String regionCode = params.getCityCode();
if (ObjectUtils.isEmpty(params.getBeginDate()) || ObjectUtils.isEmpty(params.getBeginDate())) {
startDate = today.minusDays(6);
endDate = today;
} else {
startDate = LocalDate.parse(params.getBeginDate());
endDate = LocalDate.parse(params.getEndDate());
}
params.setBeginDate(startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
params.setEndDate(endDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
AlertStatistics statistics = this.baseMapper.statisticsInfoByRegionAndDate(regionCode, startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")), endDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
JSONArray jsonArray = new JSONArray();
if (!ObjectUtils.isEmpty(statistics)) {
JSONObject jsonObject0 = new JSONObject();
jsonObject0.put("key", "dtkr");
jsonObject0.put("value", ValidationUtil.isEmpty(statistics.getTrappedPeople()) ? 0 : statistics.getTrappedPeople());
jsonObject0.put("name", "电梯困人");
JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("key", "slts");
jsonObject1.put("value", ValidationUtil.isEmpty(statistics.getComplaint()) ? 0 : statistics.getComplaint());
jsonObject1.put("name", "受理投诉");
JSONObject jsonObject2 = new JSONObject();
jsonObject2.put("key", "gzbx");
jsonObject2.put("value", ValidationUtil.isEmpty(statistics.getBreakdownRescue()) ? 0 : statistics.getBreakdownRescue());
jsonObject2.put("name", "故障维修");
JSONObject jsonObject3 = new JSONObject();
jsonObject3.put("key", "jjbkck");
jsonObject3.put("value", ValidationUtil.isEmpty(statistics.getRescuePersonnel()) ? 0 : statistics.getRescuePersonnel());
jsonObject3.put("name", "解救被困乘客");
JSONObject jsonObject4 = new JSONObject();
jsonObject4.put("key", "30fzdd");
jsonObject4.put("value", ValidationUtil.isEmpty(statistics.getWithinThirtyRescue()) ? 0 : statistics.getWithinThirtyRescue());
jsonObject4.put("name", "30分钟内到达");
JSONObject jsonObject5 = new JSONObject();
jsonObject5.put("key", "pjjysj");
jsonObject5.put("value", ValidationUtil.isEmpty(statistics.getAvgTime()) ? 0 : statistics.getAvgTime());
jsonObject5.put("name", "平均救援时间");
String orgCode = this.getAndSetOrgCode(regionCode);
JSONObject jsonObject6 = new JSONObject();
jsonObject6.put("key", "jycq");
jsonObject6.put("value", this.getQuestionNumber("检验超期",params, orgCode));
jsonObject6.put("name", "检验超期");
JSONObject jsonObject7 = new JSONObject();
jsonObject7.put("key", "jybhg");
jsonObject7.put("value", this.getQuestionNumber("检验不合格",params, orgCode));
jsonObject7.put("name", "检验不合格");
JSONObject jsonObject8 = new JSONObject();
jsonObject8.put("key", "wbcq");
jsonObject8.put("value", this.getQuestionNumber("维保超期",params, orgCode));
jsonObject8.put("name", "维保超期");
JSONObject jsonObject9 = new JSONObject();
jsonObject9.put("key", "csjsynx");
jsonObject9.put("value", this.getQuestionNumber("超设计使用年限",params, orgCode));
jsonObject9.put("name", "超设计使用年限");
jsonArray.add(jsonObject0);
jsonArray.add(jsonObject1);
jsonArray.add(jsonObject2);
jsonArray.add(jsonObject3);
jsonArray.add(jsonObject4);
jsonArray.add(jsonObject5);
jsonArray.add(jsonObject6);
jsonArray.add(jsonObject7);
jsonArray.add(jsonObject8);
jsonArray.add(jsonObject9);
}
return jsonArray;
}
private Long getQuestionNumber(String problemType, DPFilterParamDto params, String orgCode) {
return this.getBaseMapper().countProblemByTypeDateAndOrgCode(problemType, params, orgCode);
}
private String getAndSetOrgCode(String region) {
String orgCode = regionCodeOrgCodeMap.get(region);
if (orgCode == null) {
orgCode = this.getBaseMapper().getOrgCodeByCompanyCode(region);
if (orgCode != null) {
regionCodeOrgCodeMap.put(region, orgCode);
}
}
return orgCode;
}
} }
\ No newline at end of file
...@@ -36,4 +36,8 @@ public class DPFilterParamDto { ...@@ -36,4 +36,8 @@ public class DPFilterParamDto {
* month , year * month , year
*/ */
private String searchType; private String searchType;
/**
* 1生产单位 2使用单位 3充装单位 4检验检测机构
*/
private String companyType;
} }
package com.yeejoin.amos.boot.module.common.api.enums;
import lombok.Getter;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
@Getter
public enum UnitTypeEnum {
//type 1生产单位 2使用单位 3充装单位 4检验检测机构
//制造单位
ZZDW("制造单位","1236","1"),
//设计单位
SJDW("设计单位","1235","1"),
//安改维单位
AGWDW("安装改造维修单位","1234","1"),
//使用单位
SYDW("使用单位","1232","2"),
//充装单位
CZDW("充装单位","1231","3"),
//检验检测机构
JYJCJG("检验检测机构","1233","4"),
;
String name;
String code;
String type;
private UnitTypeEnum(String name, String code, String type) {
this.name = name;
this.code = code;
this.type = type;
}
public static List<String> getNameListByType(String type) {
List<String> list = new ArrayList<>();
for (UnitTypeEnum testEnum : EnumSet.allOf(UnitTypeEnum.class)) {
if (testEnum.getType().equals(type)) {
list.add(testEnum.getName());
}
}
return list;
}
}
package com.yeejoin.amos.boot.module.common.api.enums;
import lombok.Getter;
import java.util.*;
@Getter
public enum UserPostEnum {
//type 1生产单位 2使用单位 3充装单位 4检验检测机构
//主要负责人
ZYFZR("主要负责人","6548","1,2,3"),
//质量安全总监
ZLAQZJ("质量安全总监","6550","1"),
//质量安全员
ZLAQY("质量安全员","6551","1"),
//作业人员
ZYRY("作业人员","6552","1,2,3,4"),
//检验人员
ZJRY("检验人员","66151","1,4"),
//检测人员
JCRY("检测人员","66152","1,4"),
//安全总监
AQZJ("安全总监","6547","2,3"),
//安全员
AQY("安全员","6549","2,3"),
//质量保证体系人员(非字典表字段,后期修改code)
ZLBZTXRY("质量保证体系人员","nullnull","1,3,4"),
;
String name;
String code;
String type;
private UserPostEnum(String name, String code, String type) {
this.name = name;
this.code = code;
this.type = type;
}
public static List<Map<String,String>> getEnumListByType(String type) {
List<Map<String,String>> list = new ArrayList<>();
for (UserPostEnum testEnum : EnumSet.allOf(UserPostEnum.class)) {
Map<String,String> map = new HashMap<>();
if (testEnum.getType().contains(type)) {
map.put("name",testEnum.getName());
map.put("code",testEnum.getCode());
list.add(map);
}
}
return list;
}
}
...@@ -64,7 +64,9 @@ public class JgReformNoticeController extends BaseController { ...@@ -64,7 +64,9 @@ public class JgReformNoticeController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/update") @PutMapping(value = "/update")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新改造告知", notes = "根据sequenceNbr更新改造告知") @ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新改造告知", notes = "根据sequenceNbr更新改造告知")
public ResponseModel<JgReformNoticeDto> updateBySequenceNbrJgReformNotice(@RequestParam String submitType, @RequestBody JgReformNoticeDto installationInfo, @RequestParam(value = "op", required = false) String op) { public ResponseModel<JgReformNoticeDto> updateBySequenceNbrJgReformNotice(@RequestParam String submitType,
@RequestBody JgReformNoticeDto installationInfo,
@RequestParam(value = "op", required = false) String op) {
if (Objects.isNull(installationInfo)) { if (Objects.isNull(installationInfo)) {
throw new IllegalArgumentException("参数installationInfo不能为空"); throw new IllegalArgumentException("参数installationInfo不能为空");
} }
......
...@@ -5,6 +5,7 @@ import cn.hutool.core.map.MapBuilder; ...@@ -5,6 +5,7 @@ import cn.hutool.core.map.MapBuilder;
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.toolkit.Sequence; import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.util.StringUtil; import com.github.pagehelper.util.StringUtil;
...@@ -77,7 +78,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -77,7 +78,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
private static final String SUBMIT_TYPE_FLOW = "1"; private static final String SUBMIT_TYPE_FLOW = "1";
private static final String PROCESS_DEFINITION_KEY = "renovationNoticeNew"; private static final String PROCESS_DEFINITION_KEY = "renovationNoticeNew";
private static final String TABLE_PAGE_ID = "reformNoticeAdd"; private static final String TABLE_PAGE_ID = "reformNoticeAdd";
private final List<String> NOT_FLOWING_STATE = Arrays.asList("6610", "6614", "6615", "6617", "6616");
// 西安行政区划code // 西安行政区划code
private static final String XIAN = "610100"; private static final String XIAN = "610100";
...@@ -199,7 +200,9 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -199,7 +200,9 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
// 字段转换 // 字段转换
this.convertField(noticeDto); this.convertField(noticeDto);
JgReformNotice notice = this.getById(noticeDto.getSequenceNbr()); JgReformNotice notice = this.getById(noticeDto.getSequenceNbr());
this.checkRepeatUsed(submitType, notice); List<Map<String, Object>> deviceList = noticeDto.getDeviceList();
List<String> records = deviceList.stream().map(equ -> String.valueOf(equ.get("SEQUENCE_NBR"))).collect(Collectors.toList());
this.checkRepeatUsed(submitType, records, notice);
if (SUBMIT_TYPE_FLOW.equals(submitType)) { if (SUBMIT_TYPE_FLOW.equals(submitType)) {
// 发起流程 // 发起流程
if (!StringUtils.hasText(noticeDto.getInstanceId())) { if (!StringUtils.hasText(noticeDto.getInstanceId())) {
...@@ -245,7 +248,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -245,7 +248,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
} }
dto.setNextExecuteUserCompanyCode(notice.getReceiveCompanyCode()); dto.setNextExecuteUserCompanyCode(notice.getReceiveCompanyCode());
dto.setVariable(commMap); dto.setVariable(commMap);
ProcessTaskDTO processTaskDTO = cmWorkflowService.completeOrReject(notice.getNextTaskId(), dto, op); ProcessTaskDTO processTaskDTO = cmWorkflowService.completeOrReject(notice.getNextTaskId(), dto, "2");
// 提取节点等信息 // 提取节点等信息
WorkflowResultDto workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0); WorkflowResultDto workflowResultDto = commonService.buildWorkFlowInfo(Collections.singletonList(processTaskDTO)).get(0);
BeanUtils.copyProperties(noticeDto, notice); BeanUtils.copyProperties(noticeDto, notice);
...@@ -273,6 +276,19 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -273,6 +276,19 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
BeanUtils.copyProperties(noticeDto, bean); BeanUtils.copyProperties(noticeDto, bean);
jgReformNoticeMapper.updateById(bean); jgReformNoticeMapper.updateById(bean);
} }
jgReformNoticeEqMapper.delete(new QueryWrapper<JgReformNoticeEq>()
.eq("equip_transfer_id", notice.getSequenceNbr()));
// eq关系表
List<JgReformNoticeEq> noticeEqs = new ArrayList<>();
// 更新设备关系表
deviceList.forEach(obj -> {
JgReformNoticeEq jgRelationEquip = new JgReformNoticeEq();
jgRelationEquip.setEquId(String.valueOf(obj.get("SEQUENCE_NBR")));
jgRelationEquip.setEquipTransferId(String.valueOf(notice.getSequenceNbr()));
noticeEqs.add(jgRelationEquip);
});
jgReformNoticeEqMapper.insertBatchSomeColumn(noticeEqs);
return noticeDto; return noticeDto;
} catch (BadRequest | LocalBadRequest e) { } catch (BadRequest | LocalBadRequest e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
...@@ -498,15 +514,13 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -498,15 +514,13 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
equipList.forEach(equipMap -> EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY).equipRepeatUsedCheck(String.valueOf(equipMap.get("SEQUENCE_NBR")), companyCode)); equipList.forEach(equipMap -> EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY).equipRepeatUsedCheck(String.valueOf(equipMap.get("SEQUENCE_NBR")), companyCode));
} }
private void checkRepeatUsed(String submitType, JgReformNotice jgReformNotice) { private void checkRepeatUsed(String submitType, List<String> records, JgReformNotice jgReformNotice) {
if (SUBMIT_TYPE_FLOW.equals(submitType)) { if (SUBMIT_TYPE_FLOW.equals(submitType)) {
// 流程中校验 // 流程中校验
LambdaQueryWrapper<JgReformNoticeEq> queryWrapper = new LambdaQueryWrapper<>(); records.forEach(record -> {
queryWrapper.eq(JgReformNoticeEq::getEquipTransferId, jgReformNotice.getSequenceNbr()); EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY)
List<JgReformNoticeEq> noticeEqs = jgReformNoticeEqMapper.selectList(queryWrapper); .equipRepeatUsedCheck(record, jgReformNotice.getInstallUnitCreditCode());
for (JgReformNoticeEq noticeEq : noticeEqs) { });
EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY).equipRepeatUsedCheck(noticeEq.getEquId(), jgReformNotice.getInstallUnitCreditCode());
}
} }
} }
...@@ -514,10 +528,13 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -514,10 +528,13 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
* 删除 redis校验重复引用设备的数据 * 删除 redis校验重复引用设备的数据
*/ */
private void delRepeatUseEquipData(JgReformNotice notice) { private void delRepeatUseEquipData(JgReformNotice notice) {
if (NOT_FLOWING_STATE.contains(notice.getNoticeStatus())) {
LambdaQueryWrapper<JgReformNoticeEq> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<JgReformNoticeEq> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(JgReformNoticeEq::getEquipTransferId, notice.getSequenceNbr()); queryWrapper.eq(JgReformNoticeEq::getEquipTransferId, notice.getSequenceNbr());
JgReformNoticeEq jgRelationEquip = jgReformNoticeEqMapper.selectOne(queryWrapper); List<JgReformNoticeEq> noticeEqs = jgReformNoticeEqMapper.selectList(queryWrapper);
EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY).delDataForCheckEquipRepeatUsed(Collections.singletonList(jgRelationEquip.getEquId()), notice.getInstallUnitCreditCode()); List<String> ids = noticeEqs.stream().map(JgReformNoticeEq::getEquId).collect(Collectors.toList());
EquipUsedCheckStrategyContext.getUsedStrategy(PROCESS_DEFINITION_KEY).delDataForCheckEquipRepeatUsed(ids, notice.getInstallUnitCreditCode());
}
} }
private void rollBackForDelRedisData() { private void rollBackForDelRedisData() {
...@@ -546,7 +563,11 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -546,7 +563,11 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
} }
private TaskModelDto buildTempTaskModelDto(JgReformNotice item) { private TaskModelDto buildTempTaskModelDto(JgReformNotice item) {
return TaskModelDto.builder().model(item).taskContent(String.format("来自%s的业务办理,【申请单号:%s】", item.getEquListName(), item.getApplyNo())).taskCode(item.getApplyNo()).taskType(BusinessTypeEnum.JG_MODIFICATION_NOTIFICATION.getCode()).relationId(item.getSequenceNbr() + "").build(); return TaskModelDto.builder().model(item)
.taskContent(String.format("来自%s的业务办理,【申请单号:%s】", item.getEquListName(), item.getApplyNo()))
.taskCode(item.getApplyNo())
.taskType(BusinessTypeEnum.JG_MODIFICATION_NOTIFICATION.getCode())
.relationId(item.getSequenceNbr() + "").build();
} }
/** /**
...@@ -570,7 +591,29 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -570,7 +591,29 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
private TaskModelDto buildTaskModelDto(JgReformNotice item, WorkflowResultDto workflowResultDto) { private TaskModelDto buildTaskModelDto(JgReformNotice item, WorkflowResultDto workflowResultDto) {
TaskMessageDto taskMessageDto = new TaskMessageDto(); TaskMessageDto taskMessageDto = new TaskMessageDto();
BeanUtil.copyProperties(item, taskMessageDto); BeanUtil.copyProperties(item, taskMessageDto);
return TaskModelDto.builder().flowCreateDate(item.getCreateDate()).taskName(workflowResultDto.getNextTaskName()).taskCode(item.getApplyNo()).relationId(workflowResultDto.getInstanceId()).taskType(BusinessTypeEnum.JG_MODIFICATION_NOTIFICATION.getCode()).taskTypeLabel(BusinessTypeEnum.JG_MODIFICATION_NOTIFICATION.getName()).relationId(item.getInstanceId()).executeUserIds(workflowResultDto.getNextExecutorUserIds()).taskStatus(FlowStatusEnum.TO_BE_PROCESSED.getCode()).taskStatusLabel(FlowStatusEnum.TO_BE_PROCESSED.getName()).flowStatus(FlowStatusEnum.TO_BE_PROCESSED.getCode()).flowCode(workflowResultDto.getNextTaskId()).flowStatusLabel(FlowStatusEnum.TO_BE_PROCESSED.getName()).taskContent(String.format("来自%s的业务办理,【申请单号:%s】", item.getEquList(), item.getApplyNo())).taskDesc(String.format("来自%s的业务办理,【申请单号:%s】", item.getEquList(), item.getApplyNo())).startUserId(item.getCreateUserId()).startUser(item.getCreateUserName()).startUserCompanyName(item.getCreateUserCompanyName()).startDate(item.getCreateDate()).model(taskMessageDto).nextExecuteUser(item.getNextExecuteIds()).build(); return TaskModelDto.builder()
.flowCreateDate(item.getCreateDate())
.taskName(workflowResultDto.getNextTaskName())
.taskCode(item.getApplyNo())
.relationId(workflowResultDto.getInstanceId())
.taskType(BusinessTypeEnum.JG_MODIFICATION_NOTIFICATION.getCode())
.taskTypeLabel(BusinessTypeEnum.JG_MODIFICATION_NOTIFICATION.getName())
.relationId(item.getInstanceId())
.executeUserIds(workflowResultDto.getNextExecutorUserIds())
.taskStatus(FlowStatusEnum.TO_BE_PROCESSED.getCode())
.taskStatusLabel(FlowStatusEnum.TO_BE_PROCESSED.getName())
.flowStatus(FlowStatusEnum.TO_BE_PROCESSED.getCode())
.flowCode(workflowResultDto.getNextTaskId())
.flowStatusLabel(FlowStatusEnum.TO_BE_PROCESSED.getName())
.taskContent(String.format("来自%s的业务办理,【申请单号:%s】", item.getEquListName(), item.getApplyNo()))
.taskDesc(String.format("来自%s的业务办理,【申请单号:%s】", item.getEquListName(), item.getApplyNo()))
.startUserId(item.getCreateUserId()).startUser(item.getCreateUserName())
.startUserCompanyName(item.getCreateUserCompanyName())
.startDate(item.getCreateDate())
.model(taskMessageDto)
.nextExecuteUser(item.getNextExecuteIds())
.startDate(new Date())
.build();
} }
/** /**
...@@ -841,9 +884,9 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -841,9 +884,9 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
taskV2Model = this.updateLastTodo(jgReformNotice, FlowStatusEnum.REJECTED); taskV2Model = this.updateLastTodo(jgReformNotice, FlowStatusEnum.REJECTED);
this.createNewTodo(jgReformNotice, workflowResultDto, taskV2Model, FlowStatusEnum.REJECTED); this.createNewTodo(jgReformNotice, workflowResultDto, taskV2Model, FlowStatusEnum.REJECTED);
jgReformNoticeMapper.updateById(jgReformNotice); jgReformNoticeMapper.updateById(jgReformNotice);
this.delRepeatUseEquipData(jgReformNotice);
} }
commonService.saveExecuteFlowData2Redis(instanceId, this.buildInstanceRuntimeData(jgReformNotice)); commonService.saveExecuteFlowData2Redis(instanceId, this.buildInstanceRuntimeData(jgReformNotice));
this.delRepeatUseEquipData(jgReformNotice);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
...@@ -882,7 +925,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg ...@@ -882,7 +925,7 @@ public class JgReformNoticeServiceImpl extends BaseService<JgReformNoticeDto, Jg
private void createNewTodo(JgReformNotice transfer, WorkflowResultDto workflowResultDto, TaskV2Model taskV2Model, FlowStatusEnum statusEnum) { private void createNewTodo(JgReformNotice transfer, WorkflowResultDto workflowResultDto, TaskV2Model taskV2Model, FlowStatusEnum statusEnum) {
TaskMessageDto taskMessageDto = new TaskMessageDto(); TaskMessageDto taskMessageDto = new TaskMessageDto();
BeanUtil.copyProperties(transfer, taskMessageDto); BeanUtil.copyProperties(transfer, taskMessageDto);
TaskModelDto taskModelDto = TaskModelDto.builder().flowCreateDate(taskV2Model.getFlowCreateDate()).taskName(workflowResultDto.getNextTaskName()).taskCode(taskV2Model.getTaskCode()).taskType(taskV2Model.getTaskType()).taskTypeLabel(taskV2Model.getTaskTypeLabel()).relationId(taskV2Model.getRelationId()).executeUserIds(workflowResultDto.getNextExecutorUserIds()).taskStatusLabel(statusEnum.getName()).flowStatus(statusEnum.getCode()).flowCode(workflowResultDto.getNextTaskId()).flowStatusLabel(statusEnum.getName()).taskContent(String.format("来自%s的业务办理,【申请单号:%s】", transfer.getEquList(), transfer.getApplyNo())).taskDesc(String.format("来自%s的业务办理,【申请单号:%s】", transfer.getEquList(), transfer.getApplyNo())).startUserCompanyName(transfer.getCreateUserCompanyName()).startUserId(taskV2Model.getStartUserId()).startUser(taskV2Model.getStartUser()).startDate(taskV2Model.getStartDate()).model(taskMessageDto).pageType(statusEnum.getCode() == 6614 ? "edit" : "look").nextExecuteUser(workflowResultDto.getNextExecutorRoleIds()).build(); TaskModelDto taskModelDto = TaskModelDto.builder().flowCreateDate(taskV2Model.getFlowCreateDate()).taskName(workflowResultDto.getNextTaskName()).taskCode(taskV2Model.getTaskCode()).taskType(taskV2Model.getTaskType()).taskTypeLabel(taskV2Model.getTaskTypeLabel()).relationId(taskV2Model.getRelationId()).executeUserIds(workflowResultDto.getNextExecutorUserIds()).taskStatusLabel(statusEnum.getName()).flowStatus(statusEnum.getCode()).flowCode(workflowResultDto.getNextTaskId()).flowStatusLabel(statusEnum.getName()).taskContent(String.format("来自%s的业务办理,【申请单号:%s】", transfer.getEquListName(), transfer.getApplyNo())).taskDesc(String.format("来自%s的业务办理,【申请单号:%s】", transfer.getEquList(), transfer.getApplyNo())).startUserCompanyName(transfer.getCreateUserCompanyName()).startUserId(taskV2Model.getStartUserId()).startUser(taskV2Model.getStartUser()).startDate(taskV2Model.getStartDate()).model(taskMessageDto).pageType(statusEnum.getCode() == 6614 ? "edit" : "look").nextExecuteUser(workflowResultDto.getNextExecutorRoleIds()).build();
commonService.buildTaskModel(Collections.singletonList(taskModelDto)); commonService.buildTaskModel(Collections.singletonList(taskModelDto));
} }
} }
\ No newline at end of file
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.statistics.api.mapper; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.statistics.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto; import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.common.api.entity.AlertStatistics; import com.yeejoin.amos.boot.module.common.api.entity.AlertStatistics;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
/** /**
...@@ -11,6 +12,7 @@ import org.apache.ibatis.annotations.Param; ...@@ -11,6 +12,7 @@ import org.apache.ibatis.annotations.Param;
* @author system_generator * @author system_generator
* @date 2023-11-02 * @date 2023-11-02
*/ */
@Mapper
public interface AlertStatisticsMapper extends BaseMapper<AlertStatistics> { public interface AlertStatisticsMapper extends BaseMapper<AlertStatistics> {
AlertStatistics getStatisticsMessage(@Param("orgCode") String orgCode, @Param("startDate") String startDate, @Param("endDate") String endDate); AlertStatistics getStatisticsMessage(@Param("orgCode") String orgCode, @Param("startDate") String startDate, @Param("endDate") String endDate);
......
...@@ -26,4 +26,6 @@ public interface ZLStatisticsMapper { ...@@ -26,4 +26,6 @@ public interface ZLStatisticsMapper {
List<Map<String, Object>> supervisorCount(@Param("screenDto") DPFilterParamDto screenDto); List<Map<String, Object>> supervisorCount(@Param("screenDto") DPFilterParamDto screenDto);
String getOrgCodeByCompanyCode(@Param("cityCode") String cityCode); String getOrgCodeByCompanyCode(@Param("cityCode") String cityCode);
List<Map<String, String>> userCountNew(@Param("screenDto") DPFilterParamDto screenDto, @Param("unitTypeList") List<String> unitTypeList);
} }
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
WHERE company_code = #{screenDto.cityCode} WHERE company_code = #{screenDto.cityCode}
) AS subquery ) AS subquery
JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT(subquery.org_code, '%') JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT(subquery.org_code, '%')
where bi.equip_category is not null and bi.equip_category != '[]' and bi.unit_type is not null; where bi.unit_type is not null
</select> </select>
<select id="testOrg" resultType="java.util.Map"> <select id="testOrg" resultType="java.util.Map">
SELECT COUNT(1), SELECT COUNT(1),
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
INNER JOIN tzs_user_info tui ON bi.use_unit_code = tui.unit_code INNER JOIN tzs_user_info tui ON bi.use_unit_code = tui.unit_code
WHERE WHERE
tui.post LIKE concat ( '%', '6552', '%' ) tui.post LIKE concat ( '%', '6552', '%' )
AND bi.unit_type IS NOT NULL; AND bi.unit_type IS NOT NULL
</select> </select>
<select id="supervisorCount" resultType="java.util.Map"> <select id="supervisorCount" resultType="java.util.Map">
SELECT SELECT
...@@ -52,6 +52,23 @@ ...@@ -52,6 +52,23 @@
<select id="getOrgCodeByCompanyCode" resultType="java.lang.String"> <select id="getOrgCodeByCompanyCode" resultType="java.lang.String">
select org_code from privilege_company where company_code = #{cityCode} limit 1 select org_code from privilege_company where company_code = #{cityCode} limit 1
</select> </select>
<select id="userCountNew" resultType="java.util.Map">
SELECT
tui.post
FROM
( SELECT org_code FROM privilege_company WHERE company_code = #{screenDto.cityCode} ) AS subquery
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( subquery.org_code, '%' )
INNER JOIN tzs_user_info tui ON bi.use_unit_code = tui.unit_code
WHERE
bi.unit_type IS NOT NULL
AND tui.post IS NOT NULL
<if test="unitTypeList != null and unitTypeList.size() > 0">
AND
<foreach collection="unitTypeList" item="unitType" open="(" separator="OR" close=")">
bi.unit_type LIKE concat ( '%', #{unitType}, '%' )
</foreach>
</if>
</select>
</mapper> </mapper>
......
...@@ -63,7 +63,7 @@ public class AQZSDPStatisticsController { ...@@ -63,7 +63,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "问题类型主体统计") @ApiOperation(value = "大屏-安全追溯-左屏-问题类型主体统计")
@PostMapping(value = "/mainBodyCount") @PostMapping(value = "/mainBodyCount")
public ResponseModel<Map<String, Object>> mainBodyCount(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<Map<String, Object>> mainBodyCount(@RequestBody Map<String, Object> map) throws Exception {
Object regionCode = map.get("cityCode"); Object regionCode = map.get("cityCode");
...@@ -76,7 +76,7 @@ public class AQZSDPStatisticsController { ...@@ -76,7 +76,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "设备问题近30天统计") @ApiOperation(value = "大屏-安全追溯-左屏-设备问题近30天统计")
@PostMapping(value = "/equipmentCount") @PostMapping(value = "/equipmentCount")
public ResponseModel<Map<String, Object>> equipmentCount(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<Map<String, Object>> equipmentCount(@RequestBody Map<String, Object> map) throws Exception {
Object regionCode = map.get("cityCode"); Object regionCode = map.get("cityCode");
...@@ -89,7 +89,7 @@ public class AQZSDPStatisticsController { ...@@ -89,7 +89,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "企业问题近30天统计") @ApiOperation(value = "大屏-安全追溯-左屏-企业问题近30天统计")
@PostMapping(value = "/companyCount") @PostMapping(value = "/companyCount")
public ResponseModel<List<Map<String, Object>>> companyCount(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<List<Map<String, Object>>> companyCount(@RequestBody Map<String, Object> map) throws Exception {
Object regionCode = map.get("cityCode"); Object regionCode = map.get("cityCode");
...@@ -102,7 +102,7 @@ public class AQZSDPStatisticsController { ...@@ -102,7 +102,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "人员问题近30天统计") @ApiOperation(value = "大屏-安全追溯-左屏-人员问题近30天统计")
@PostMapping(value = "/personCount") @PostMapping(value = "/personCount")
public ResponseModel<Map<String, Object>> personCount(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<Map<String, Object>> personCount(@RequestBody Map<String, Object> map) throws Exception {
Object regionCode = map.get("cityCode"); Object regionCode = map.get("cityCode");
...@@ -116,7 +116,7 @@ public class AQZSDPStatisticsController { ...@@ -116,7 +116,7 @@ public class AQZSDPStatisticsController {
; ;
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "气瓶问题近30天统计") @ApiOperation(value = "大屏-安全追溯-左屏-气瓶问题近30天统计")
@PostMapping(value = "/cylinderCount") @PostMapping(value = "/cylinderCount")
public ResponseModel<Map<String, Object>> cylinderCount(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<Map<String, Object>> cylinderCount(@RequestBody Map<String, Object> map) throws Exception {
Object regionCode = map.get("cityCode"); Object regionCode = map.get("cityCode");
...@@ -129,7 +129,7 @@ public class AQZSDPStatisticsController { ...@@ -129,7 +129,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "按月统计近12个月的问题数量趋势") @ApiOperation(value = "大屏-安全追溯-右屏-按月统计近12个月的问题数量趋势")
@PostMapping(value = "/issueCountByMonth") @PostMapping(value = "/issueCountByMonth")
public ResponseModel<Map<String, Object>> issueCountByMonth(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<Map<String, Object>> issueCountByMonth(@RequestBody Map<String, Object> map) throws Exception {
Object regionCode = map.get("cityCode"); Object regionCode = map.get("cityCode");
...@@ -142,7 +142,7 @@ public class AQZSDPStatisticsController { ...@@ -142,7 +142,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "按月统计近30天的问题数量趋势") @ApiOperation(value = "大屏-安全追溯-右屏-按月统计近30天的问题数量趋势")
@PostMapping(value = "/issueCountByDay") @PostMapping(value = "/issueCountByDay")
public ResponseModel<Map<String, Object>> issueCountByDay(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<Map<String, Object>> issueCountByDay(@RequestBody Map<String, Object> map) throws Exception {
Object regionCode = map.get("cityCode"); Object regionCode = map.get("cityCode");
...@@ -154,7 +154,7 @@ public class AQZSDPStatisticsController { ...@@ -154,7 +154,7 @@ public class AQZSDPStatisticsController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "当前区域数据统计") @ApiOperation(value = "大屏-安全追溯-中屏-当前区域数据统计")
@PostMapping(value = "/issueCountByCityCode") @PostMapping(value = "/issueCountByCityCode")
public ResponseModel<Map<String, Object>> issueCountByCityCode(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<Map<String, Object>> issueCountByCityCode(@RequestBody Map<String, Object> map) throws Exception {
Object regionCode = map.get("cityCode"); Object regionCode = map.get("cityCode");
...@@ -167,7 +167,7 @@ public class AQZSDPStatisticsController { ...@@ -167,7 +167,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "当前区域子区域数据统计") @ApiOperation(value = "大屏-安全追溯-中屏-当前区域子区域数据统计")
@PostMapping(value = "/issueChildrenCityCount") @PostMapping(value = "/issueChildrenCityCount")
public ResponseModel<List<Map<String, Object>>> issueChildrenCityCount(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<List<Map<String, Object>>> issueChildrenCityCount(@RequestBody Map<String, Object> map) throws Exception {
Object regionCode = map.get("cityCode"); Object regionCode = map.get("cityCode");
...@@ -180,7 +180,7 @@ public class AQZSDPStatisticsController { ...@@ -180,7 +180,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "当月问题列表(主体类型、问题类型、问题时间、操作)") @ApiOperation(value = "大屏-安全追溯-左屏-当月问题列表(主体类型、问题类型、问题时间、操作)")
@PostMapping(value = "/issueMonthList") @PostMapping(value = "/issueMonthList")
public ResponseModel<List<Map<String, Object>>> issueMonthList(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<List<Map<String, Object>>> issueMonthList(@RequestBody Map<String, Object> map) throws Exception {
Object regionCode = map.get("cityCode"); Object regionCode = map.get("cityCode");
...@@ -192,7 +192,7 @@ public class AQZSDPStatisticsController { ...@@ -192,7 +192,7 @@ public class AQZSDPStatisticsController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "当年问题等级分类统计") @ApiOperation(value = "大屏-安全追溯-右屏-当年问题等级分类统计")
@PostMapping(value = "/issueProblemLevelCount") @PostMapping(value = "/issueProblemLevelCount")
public ResponseModel<Map<String, Object>> issueProblemLevelCount(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<Map<String, Object>> issueProblemLevelCount(@RequestBody Map<String, Object> map) throws Exception {
Object regionCode = map.get("cityCode"); Object regionCode = map.get("cityCode");
...@@ -204,7 +204,7 @@ public class AQZSDPStatisticsController { ...@@ -204,7 +204,7 @@ public class AQZSDPStatisticsController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "按问题类型排名top 10") @ApiOperation(value = "大屏-安全追溯-右屏-按问题类型排名top 10")
@PostMapping(value = "/issueCompanyTop") @PostMapping(value = "/issueCompanyTop")
public ResponseModel<List<Map<String, Object>>> issueCompanyTop(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<List<Map<String, Object>>> issueCompanyTop(@RequestBody Map<String, Object> map) throws Exception {
Object regionCode = map.get("cityCode"); Object regionCode = map.get("cityCode");
...@@ -227,7 +227,7 @@ public class AQZSDPStatisticsController { ...@@ -227,7 +227,7 @@ public class AQZSDPStatisticsController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "当年下级区域问题闭环率排名") @ApiOperation(value = "大屏-安全追溯-右屏-当年下级区域问题闭环率排名")
@PostMapping(value = "/issueChildrenCityCountTop") @PostMapping(value = "/issueChildrenCityCountTop")
public ResponseModel<List<Map<String, Object>>> issueChildrenCityCountTop(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<List<Map<String, Object>>> issueChildrenCityCountTop(@RequestBody Map<String, Object> map) throws Exception {
Object regionCode = map.get("cityCode"); Object regionCode = map.get("cityCode");
...@@ -239,7 +239,7 @@ public class AQZSDPStatisticsController { ...@@ -239,7 +239,7 @@ public class AQZSDPStatisticsController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "按问题类型排名top 10") @ApiOperation(value = "大屏-安全追溯-右屏-按问题类型排名top 10")
@PostMapping(value = "/issueCountTopByProblemType") @PostMapping(value = "/issueCountTopByProblemType")
public ResponseModel<List<Map<String, Object>>> issueCountTopByProblemType(@RequestBody Map<String, Object> map) throws Exception { public ResponseModel<List<Map<String, Object>>> issueCountTopByProblemType(@RequestBody Map<String, Object> map) throws Exception {
Object regionCode = map.get("cityCode"); Object regionCode = map.get("cityCode");
......
...@@ -228,7 +228,7 @@ public class JGDPStatisticsController { ...@@ -228,7 +228,7 @@ public class JGDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏监管-中屏-各地市数据统计", notes = "大屏监管-中屏-各地市数据统计") @ApiOperation(httpMethod = "POST", value = "大屏监管-中屏-各地市数据统计", notes = "大屏监管-中屏-各地市数据统计")
@PostMapping(value = "/jg/centre/dataStatistic") @PostMapping(value = "/centre/dataStatistic")
public ResponseModel<List<Map<String, Object>>> dataStatisticByReginCode(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) { public ResponseModel<List<Map<String, Object>>> dataStatisticByReginCode(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors(); List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) { if (!fieldErrors.isEmpty()) {
...@@ -239,7 +239,7 @@ public class JGDPStatisticsController { ...@@ -239,7 +239,7 @@ public class JGDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏监管-中屏-当前区域数据统计", notes = "大屏监管-中屏-当前区域数据统计") @ApiOperation(httpMethod = "POST", value = "大屏监管-中屏-当前区域数据统计", notes = "大屏监管-中屏-当前区域数据统计")
@PostMapping(value = "/jg/centre/dataStatisticCount") @PostMapping(value = "/centre/dataStatisticCount")
public ResponseModel<Map<String, Object>> dataStatisticCountByReginCode(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) { public ResponseModel<Map<String, Object>> dataStatisticCountByReginCode(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors(); List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) { if (!fieldErrors.isEmpty()) {
......
package com.yeejoin.amos.boot.module.statistcs.biz.controller;
import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.StCommonServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
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.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
@RestController
@Api(tags = "统计公共API")
@RequestMapping(value = "/st-common")
public class StCommonController {
StCommonServiceImpl commonService;
/**
* 获取用户regionCode
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getUserRegincode")
@ApiOperation(httpMethod = "GET", value = "获取用户regionCode", notes = "获取用户regionCode")
public ResponseModel<List<String>> getUserRegincode() {
List<String> regionList = commonService.getUserRegionCode();
return ResponseHelper.buildResponse(regionList);
}
}
package com.yeejoin.amos.boot.module.statistcs.biz.controller; package com.yeejoin.amos.boot.module.statistcs.biz.controller;
import com.alibaba.fastjson.JSONArray;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto; import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.ZLDPStatisticsServiceImpl; import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.ZLDPStatisticsServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
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;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
...@@ -37,36 +42,54 @@ public class ZLDPStatisticsController { ...@@ -37,36 +42,54 @@ public class ZLDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/companyInfo") @PostMapping(value = "/companyInfo")
@ApiOperation(httpMethod = "POST", value = "大屏企业统计", notes = "大屏企业统计") @ApiOperation(httpMethod = "POST", value = "大屏-总览-左屏-企业统计", notes = "大屏-总览-左屏-企业统计")
public ResponseModel<List<Map<String, Object>>> companyInfo(@RequestBody DPFilterParamDto screenDto) { public ResponseModel<List<Map<String, Object>>> companyInfo(@RequestBody DPFilterParamDto screenDto) {
return ResponseHelper.buildResponse(statisticsService.companyInfo(screenDto)); return ResponseHelper.buildResponse(statisticsService.companyInfo(screenDto));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/testOrg") @PostMapping(value = "/testOrg")
@ApiOperation(httpMethod = "POST", value = "大屏检测机构统计", notes = "大屏检测机构统计") @ApiOperation(httpMethod = "POST", value = "大屏-总览-左屏-检测机构统计", notes = "大屏-总览-左屏-检测机构统计")
public ResponseModel<List<Map<String, Object>>> testOrg(@RequestBody DPFilterParamDto screenDto) { public ResponseModel<List<Map<String, Object>>> testOrg(@RequestBody DPFilterParamDto screenDto) {
return ResponseHelper.buildResponse(statisticsService.testOrg(screenDto)); return ResponseHelper.buildResponse(statisticsService.testOrg(screenDto));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/userCount") @PostMapping(value = "/userCount")
@ApiOperation(httpMethod = "POST", value = "大屏人员统计", notes = "大屏人员统计") @ApiOperation(httpMethod = "POST", value = "大屏-总览-左屏-人员统计", notes = "大屏-总览-左屏-人员统计")
public ResponseModel<Map<String, Object>> userCount(@RequestBody DPFilterParamDto screenDto) { public ResponseModel<Map<String, Object>> userCount(@RequestBody DPFilterParamDto screenDto) {
return ResponseHelper.buildResponse(statisticsService.userCount(screenDto)); return ResponseHelper.buildResponse(statisticsService.userCount(screenDto));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/userCountNew")
@ApiOperation(httpMethod = "POST", value = "大屏-总览-左屏-人员统计新", notes = "大屏-总览-左屏-人员统计")
public ResponseModel<Map<String, Object>> userCountNew(@RequestBody DPFilterParamDto screenDto) {
return ResponseHelper.buildResponse(statisticsService.userCountNew(screenDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/supervisorCount") @PostMapping(value = "/supervisorCount")
@ApiOperation(httpMethod = "POST", value = "大屏行业主管部门统计", notes = "大屏行业主管部门统计") @ApiOperation(httpMethod = "POST", value = "大屏-总览-左屏-行业主管部门统计", notes = "大屏-总览-左屏-行业主管部门统计")
public ResponseModel<Map<String, Object>> supervisorCount(@RequestBody DPFilterParamDto screenDto) { public ResponseModel<Map<String, Object>> supervisorCount(@RequestBody DPFilterParamDto screenDto) {
return ResponseHelper.buildResponse(statisticsService.supervisorCount(screenDto)); return ResponseHelper.buildResponse(statisticsService.supervisorCount(screenDto));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/equipmentInformCount") @PostMapping(value = "/equipmentInformCount")
@ApiOperation(httpMethod = "POST", value = "大屏设备使用场所统计", notes = "大屏设备使用场所统计") @ApiOperation(httpMethod = "POST", value = "大屏-总览-左屏-设备使用场所统计", notes = "大屏-总览-左屏-设备使用场所统计")
public ResponseModel<List<Map<String, Object>>> equipmentInformCount(@RequestBody DPFilterParamDto screenDto) { public ResponseModel<List<Map<String, Object>>> equipmentInformCount(@RequestBody DPFilterParamDto screenDto) {
return ResponseHelper.buildResponse(statisticsService.equipmentInformCount(screenDto)); return ResponseHelper.buildResponse(statisticsService.equipmentInformCount(screenDto));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping (value = "/region/info")
@ApiOperation(httpMethod = "POST", value = "查询区域统计信息", notes = "查询区域统计信息")
public ResponseModel<JSONArray> statisticsRegionInfo(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.statisticInfoByRegionAndDate(dpFilterParamDto));
}
} }
package com.yeejoin.amos.boot.module.statistcs.biz.service.impl;
import com.yeejoin.amos.feign.privilege.Privilege;
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.model.RegionModel;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* @author Administrator
*/
@Service
public class StCommonServiceImpl {
public List<String> getUserRegionCode() {
List<String> regionList = new ArrayList<>();
AgencyUserModel me = Privilege.agencyUserClient.getme().getResult();
CompanyModel userCompany = me.getCompanys().get(0);
String regions = userCompany.getRegionSeq();
if(regions != null) {
String[] regionsId = regions.split(",");
for(String regionId:regionsId) {
RegionModel region = Systemctl.regionClient.getRegion(Long.valueOf(regionId)).getResult();
regionList.add(region.getRegionCode() + "");
}
}
return regionList;
}
}
package com.yeejoin.amos.boot.module.statistcs.biz.service.impl; package com.yeejoin.amos.boot.module.statistcs.biz.service.impl;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary; import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
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.module.common.api.dto.DPFilterParamDto; import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.common.api.entity.AlertStatistics;
import com.yeejoin.amos.boot.module.statistics.api.mapper.AlertStatisticsMapper;
import com.yeejoin.amos.boot.module.common.api.enums.UnitTypeEnum;
import com.yeejoin.amos.boot.module.common.api.enums.UserPostEnum;
import com.yeejoin.amos.boot.module.statistics.api.mapper.ZLStatisticsMapper; import com.yeejoin.amos.boot.module.statistics.api.mapper.ZLStatisticsMapper;
import org.apache.lucene.queryparser.classic.QueryParser; import org.apache.lucene.queryparser.classic.QueryParser;
import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchRequest;
...@@ -15,11 +20,14 @@ import org.elasticsearch.search.aggregations.AggregationBuilders; ...@@ -15,11 +20,14 @@ import org.elasticsearch.search.aggregations.AggregationBuilders;
import org.elasticsearch.search.aggregations.Aggregations; import org.elasticsearch.search.aggregations.Aggregations;
import org.elasticsearch.search.aggregations.bucket.terms.Terms; import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder;
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.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -27,25 +35,45 @@ import java.util.stream.Collectors; ...@@ -27,25 +35,45 @@ import java.util.stream.Collectors;
@Service @Service
public class ZLDPStatisticsServiceImpl { public class ZLDPStatisticsServiceImpl {
@Resource
private ZLStatisticsMapper screenMapper; private ZLStatisticsMapper screenMapper;
@Autowired
DataDictionaryServiceImpl iDataDictionaryService;
@Autowired private DataDictionaryServiceImpl iDataDictionaryService;
RestHighLevelClient restHighLevelClient;
private AlertStatisticsMapper alertStatisticsMapper;
private RestHighLevelClient restHighLevelClient;
private static Map<String, String> regionCodeOrgCodeMap = new ConcurrentHashMap<>(); private static Map<String, String> regionCodeOrgCodeMap = new ConcurrentHashMap<>();
public ZLDPStatisticsServiceImpl(ZLStatisticsMapper screenMapper, DataDictionaryServiceImpl iDataDictionaryService, AlertStatisticsMapper alertStatisticsMapper, RestHighLevelClient restHighLevelClient) {
this.screenMapper = screenMapper;
this.iDataDictionaryService = iDataDictionaryService;
this.alertStatisticsMapper = alertStatisticsMapper;
this.restHighLevelClient = restHighLevelClient;
}
public List<Map<String, Object>> companyInfo(DPFilterParamDto screenDto) { public List<Map<String, Object>> companyInfo(DPFilterParamDto screenDto) {
List<Map<String, Object>> list = screenMapper.getCompanyInfo(screenDto); List<Map<String,Object>> list = screenMapper.getCompanyInfo(screenDto);
List<Map<String, Object>> returnList = new ArrayList<>(); List<Map<String,Object>> returnList = new ArrayList<>();
//数据处理后Map,key为企业类型+设备,value为计数 //数据处理后Map,key为企业类型+设备,value为计数
Map<String, Integer> dataMap = new HashMap<>(); Map<String, Integer> dataMap = new HashMap<>();
for (Map<String, Object> map : list) { for(Map<String,Object> map : list){
if(null == map.get("equipCategory") || CollectionUtils.isEmpty((JSONArray) JSONArray.parse((String) map.get("equipCategory")))){
String[] UnitTypeArray = ((String) map.get("unitType")).split("#");
for (int i = 0; i < UnitTypeArray.length; i++) {
String unitTypeName = UnitTypeArray[i];
if (dataMap.containsKey(unitTypeName + "null")) {
dataMap.put(unitTypeName + "null", dataMap.get(unitTypeName + "null") + 1);
} else {
dataMap.put(unitTypeName + "null", 1);
}
}
}else {
JSONArray equipCategoryArray = (JSONArray) JSONArray.parse((String) map.get("equipCategory")); JSONArray equipCategoryArray = (JSONArray) JSONArray.parse((String) map.get("equipCategory"));
String[] UnitTypeArray = ((String) map.get("unitType")).split("#"); String[] UnitTypeArray = ((String) map.get("unitType")).split("#");
for (int i = 0; i < UnitTypeArray.length; i++) { for (int i = 0; i < UnitTypeArray.length; i++) {
...@@ -59,6 +87,7 @@ public class ZLDPStatisticsServiceImpl { ...@@ -59,6 +87,7 @@ public class ZLDPStatisticsServiceImpl {
} }
} }
} }
}
/** /**
* 4000 起重机械 * 4000 起重机械
* 3000 电梯 * 3000 电梯
...@@ -71,190 +100,219 @@ public class ZLDPStatisticsServiceImpl { ...@@ -71,190 +100,219 @@ public class ZLDPStatisticsServiceImpl {
*/ */
//充装Map //充装Map
Map<String, Object> chongzhuangMap = new HashMap<>(); Map<String,Object> chongzhuangMap = new HashMap<>();
List<Map<String, Object>> chongzhuangCompanyList = new ArrayList<>(); List<Map<String,Object>> chongzhuangCompanyList = new ArrayList<>();
chongzhuangMap.put("key", "chongzhuangCompany"); chongzhuangMap.put("key","chongzhuangCompany");
chongzhuangMap.put("value", "充装单位"); chongzhuangMap.put("value","充装单位");
//充装压力容器 //充装压力容器
Map<String, Object> chongzhuangyalirongqiMap = new HashMap<>(); Map<String,Object> chongzhuangyalirongqiMap = new HashMap<>();
chongzhuangyalirongqiMap.put("key", "key04"); chongzhuangyalirongqiMap.put("key","key04");
chongzhuangyalirongqiMap.put("name", "气瓶"); chongzhuangyalirongqiMap.put("name","气瓶");
chongzhuangyalirongqiMap.put("value", dataMap.getOrDefault("充装单位2000", 0)); chongzhuangyalirongqiMap.put("value",dataMap.getOrDefault("充装单位2000",0));
chongzhuangCompanyList.add(chongzhuangyalirongqiMap); chongzhuangCompanyList.add(chongzhuangyalirongqiMap);
chongzhuangMap.put("data", chongzhuangCompanyList); chongzhuangMap.put("data",chongzhuangCompanyList);
//无设备类型
Map<String,Object> chongzhuangNullMap = new HashMap<>();
chongzhuangNullMap.put("key","key09");
chongzhuangNullMap.put("name","无设备类型");
chongzhuangNullMap.put("value",dataMap.getOrDefault("充装单位null",0));
chongzhuangCompanyList.add(chongzhuangNullMap);
chongzhuangMap.put("data",chongzhuangCompanyList);
//安改维Map //安改维Map
Map<String, Object> angaiweiMap = new HashMap<>(); Map<String,Object> angaiweiMap = new HashMap<>();
List<Map<String, Object>> angaiweiCompanyList = new ArrayList<>(); List<Map<String,Object>> angaiweiCompanyList = new ArrayList<>();
angaiweiMap.put("key", "angaiweiCompany"); angaiweiMap.put("key","angaiweiCompany");
angaiweiMap.put("value", "安改维单位"); angaiweiMap.put("value","安改维单位");
//安改维电梯 //安改维电梯
Map<String, Object> angaiweidiantiMap = new HashMap<>(); Map<String,Object> angaiweidiantiMap = new HashMap<>();
angaiweidiantiMap.put("key", "key01"); angaiweidiantiMap.put("key","key01");
angaiweidiantiMap.put("name", "电梯"); angaiweidiantiMap.put("name","电梯");
angaiweidiantiMap.put("value", dataMap.getOrDefault("安装改造维修单位3000", 0)); angaiweidiantiMap.put("value",dataMap.getOrDefault("安装改造维修单位3000",0));
angaiweiCompanyList.add(angaiweidiantiMap); angaiweiCompanyList.add(angaiweidiantiMap);
//安改维锅炉 //安改维锅炉
Map<String, Object> angaiweiguoluMap = new HashMap<>(); Map<String,Object> angaiweiguoluMap = new HashMap<>();
angaiweiguoluMap.put("key", "key02"); angaiweiguoluMap.put("key","key02");
angaiweiguoluMap.put("name", "锅炉"); angaiweiguoluMap.put("name","锅炉");
angaiweiguoluMap.put("value", dataMap.getOrDefault("安装改造维修单位1000", 0)); angaiweiguoluMap.put("value",dataMap.getOrDefault("安装改造维修单位1000",0));
angaiweiCompanyList.add(angaiweiguoluMap); angaiweiCompanyList.add(angaiweiguoluMap);
//安改维场内机动车 //安改维场内机动车
Map<String, Object> angaiweijidongcheMap = new HashMap<>(); Map<String,Object> angaiweijidongcheMap = new HashMap<>();
angaiweijidongcheMap.put("key", "key03"); angaiweijidongcheMap.put("key","key03");
angaiweijidongcheMap.put("name", "场内机动车"); angaiweijidongcheMap.put("name","场内机动车");
angaiweijidongcheMap.put("value", dataMap.getOrDefault("安装改造维修单位5000", 0)); angaiweijidongcheMap.put("value",dataMap.getOrDefault("安装改造维修单位5000",0));
angaiweiCompanyList.add(angaiweijidongcheMap); angaiweiCompanyList.add(angaiweijidongcheMap);
//安改维压力管道 //安改维压力管道
Map<String, Object> angaiweiyaliguandaoMap = new HashMap<>(); Map<String,Object> angaiweiyaliguandaoMap = new HashMap<>();
angaiweiyaliguandaoMap.put("key", "key05"); angaiweiyaliguandaoMap.put("key","key05");
angaiweiyaliguandaoMap.put("name", "压力管道"); angaiweiyaliguandaoMap.put("name","压力管道");
angaiweiyaliguandaoMap.put("value", dataMap.getOrDefault("安装改造维修单位9000", 0)); angaiweiyaliguandaoMap.put("value",dataMap.getOrDefault("安装改造维修单位9000",0));
angaiweiCompanyList.add(angaiweiyaliguandaoMap); angaiweiCompanyList.add(angaiweiyaliguandaoMap);
//安改维起重机械 //安改维起重机械
Map<String, Object> angaiweiqizhongjixieMap = new HashMap<>(); Map<String,Object> angaiweiqizhongjixieMap = new HashMap<>();
angaiweiqizhongjixieMap.put("key", "key06"); angaiweiqizhongjixieMap.put("key","key06");
angaiweiqizhongjixieMap.put("name", "起重机械"); angaiweiqizhongjixieMap.put("name","起重机械");
angaiweiqizhongjixieMap.put("value", dataMap.getOrDefault("安装改造维修单位4000", 0)); angaiweiqizhongjixieMap.put("value",dataMap.getOrDefault("安装改造维修单位4000",0));
angaiweiCompanyList.add(angaiweiqizhongjixieMap); angaiweiCompanyList.add(angaiweiqizhongjixieMap);
//安改维游乐设施 //安改维游乐设施
Map<String, Object> angaiweiyoulesheshiMap = new HashMap<>(); Map<String,Object> angaiweiyoulesheshiMap = new HashMap<>();
angaiweiyoulesheshiMap.put("key", "key07"); angaiweiyoulesheshiMap.put("key","key07");
angaiweiyoulesheshiMap.put("name", "大型游乐设施"); angaiweiyoulesheshiMap.put("name","大型游乐设施");
angaiweiyoulesheshiMap.put("value", dataMap.getOrDefault("安装改造维修单位6000", 0)); angaiweiyoulesheshiMap.put("value",dataMap.getOrDefault("安装改造维修单位6000",0));
angaiweiCompanyList.add(angaiweiyoulesheshiMap); angaiweiCompanyList.add(angaiweiyoulesheshiMap);
//安改维客运索道 //安改维客运索道
Map<String, Object> angaiweikeyunsuodaoMap = new HashMap<>(); Map<String,Object> angaiweikeyunsuodaoMap = new HashMap<>();
angaiweikeyunsuodaoMap.put("key", "key08"); angaiweikeyunsuodaoMap.put("key","key08");
angaiweikeyunsuodaoMap.put("name", "客运索道"); angaiweikeyunsuodaoMap.put("name","客运索道");
angaiweikeyunsuodaoMap.put("value", dataMap.getOrDefault("安装改造维修单位9000", 0)); angaiweikeyunsuodaoMap.put("value",dataMap.getOrDefault("安装改造维修单位9000",0));
angaiweiCompanyList.add(angaiweikeyunsuodaoMap); angaiweiCompanyList.add(angaiweikeyunsuodaoMap);
angaiweiMap.put("data", angaiweiCompanyList); angaiweiMap.put("data",angaiweiCompanyList);
//无设备类型
Map<String,Object> angaiweiNullMap = new HashMap<>();
angaiweiNullMap.put("key","key09");
angaiweiNullMap.put("name","无设备类型");
angaiweiNullMap.put("value",dataMap.getOrDefault("安装改造维修单位null",0));
angaiweiCompanyList.add(angaiweiNullMap);
angaiweiMap.put("data",angaiweiCompanyList);
//设计Map //设计Map
Map<String, Object> shejiMap = new HashMap<>(); Map<String,Object> shejiMap = new HashMap<>();
List<Map<String, Object>> shejiCompanyList = new ArrayList<>(); List<Map<String,Object>> shejiCompanyList = new ArrayList<>();
shejiMap.put("key", "shejiCompany"); shejiMap.put("key","shejiCompany");
shejiMap.put("value", "设计单位"); shejiMap.put("value","设计单位");
//设计压力容器 //设计压力容器
Map<String, Object> shejiyalirongqiMap = new HashMap<>(); Map<String,Object> shejiyalirongqiMap = new HashMap<>();
shejiyalirongqiMap.put("key", "key04"); shejiyalirongqiMap.put("key","key04");
shejiyalirongqiMap.put("name", "压力容器"); shejiyalirongqiMap.put("name","压力容器");
shejiyalirongqiMap.put("value", dataMap.getOrDefault("设计单位2000", 0)); shejiyalirongqiMap.put("value",dataMap.getOrDefault("设计单位2000",0));
shejiCompanyList.add(shejiyalirongqiMap); shejiCompanyList.add(shejiyalirongqiMap);
//设计压力管道 //设计压力管道
Map<String, Object> shejiyaliguandaoMap = new HashMap<>(); Map<String,Object> shejiyaliguandaoMap = new HashMap<>();
shejiyaliguandaoMap.put("key", "key05"); shejiyaliguandaoMap.put("key","key05");
shejiyaliguandaoMap.put("name", "压力管道"); shejiyaliguandaoMap.put("name","压力管道");
shejiyaliguandaoMap.put("value", dataMap.getOrDefault("设计单位8000", 0)); shejiyaliguandaoMap.put("value",dataMap.getOrDefault("设计单位8000",0));
shejiCompanyList.add(shejiyaliguandaoMap); shejiCompanyList.add(shejiyaliguandaoMap);
shejiMap.put("data", shejiCompanyList); shejiMap.put("data",shejiCompanyList);
//制造Map //制造Map
Map<String, Object> zhizaoMap = new HashMap<>(); Map<String,Object> zhizaoMap = new HashMap<>();
List<Map<String, Object>> zhizaoCompanyList = new ArrayList<>(); List<Map<String,Object>> zhizaoCompanyList = new ArrayList<>();
zhizaoMap.put("key", "zhizaoCompany"); zhizaoMap.put("key","zhizaoCompany");
zhizaoMap.put("value", "制造单位"); zhizaoMap.put("value","制造单位");
//制造电梯 //制造电梯
Map<String, Object> zhizaodiantiMap = new HashMap<>(); Map<String,Object> zhizaodiantiMap = new HashMap<>();
zhizaodiantiMap.put("key", "key01"); zhizaodiantiMap.put("key","key01");
zhizaodiantiMap.put("name", "电梯"); zhizaodiantiMap.put("name","电梯");
zhizaodiantiMap.put("value", dataMap.getOrDefault("制造单位3000", 0)); zhizaodiantiMap.put("value",dataMap.getOrDefault("制造单位3000",0));
zhizaoCompanyList.add(zhizaodiantiMap); zhizaoCompanyList.add(zhizaodiantiMap);
//制造锅炉 //制造锅炉
Map<String, Object> zhizaoguoluMap = new HashMap<>(); Map<String,Object> zhizaoguoluMap = new HashMap<>();
zhizaoguoluMap.put("key", "key02"); zhizaoguoluMap.put("key","key02");
zhizaoguoluMap.put("name", "锅炉"); zhizaoguoluMap.put("name","锅炉");
zhizaoguoluMap.put("value", dataMap.getOrDefault("制造单位1000", 0)); zhizaoguoluMap.put("value",dataMap.getOrDefault("制造单位1000",0));
zhizaoCompanyList.add(zhizaoguoluMap); zhizaoCompanyList.add(zhizaoguoluMap);
//制造锅炉 //制造锅炉
Map<String, Object> zhizaojidongcheMap = new HashMap<>(); Map<String,Object> zhizaojidongcheMap = new HashMap<>();
zhizaojidongcheMap.put("key", "key03"); zhizaojidongcheMap.put("key","key03");
zhizaojidongcheMap.put("name", "场内机动车"); zhizaojidongcheMap.put("name","场内机动车");
zhizaojidongcheMap.put("value", dataMap.getOrDefault("制造单位5000", 0)); zhizaojidongcheMap.put("value",dataMap.getOrDefault("制造单位5000",0));
zhizaoCompanyList.add(zhizaojidongcheMap); zhizaoCompanyList.add(zhizaojidongcheMap);
//制造压力容器 //制造压力容器
Map<String, Object> zhizaoyalirongqiMap = new HashMap<>(); Map<String,Object> zhizaoyalirongqiMap = new HashMap<>();
zhizaoyalirongqiMap.put("key", "key04"); zhizaoyalirongqiMap.put("key","key04");
zhizaoyalirongqiMap.put("name", "压力容器"); zhizaoyalirongqiMap.put("name","压力容器");
zhizaoyalirongqiMap.put("value", dataMap.getOrDefault("制造单位2000", 0)); zhizaoyalirongqiMap.put("value",dataMap.getOrDefault("制造单位2000",0));
zhizaoCompanyList.add(zhizaoyalirongqiMap); zhizaoCompanyList.add(zhizaoyalirongqiMap);
//制造起重机械 //制造起重机械
Map<String, Object> zhizaoqizhongjixieMap = new HashMap<>(); Map<String,Object> zhizaoqizhongjixieMap = new HashMap<>();
zhizaoqizhongjixieMap.put("key", "key06"); zhizaoqizhongjixieMap.put("key","key06");
zhizaoqizhongjixieMap.put("name", "起重机械"); zhizaoqizhongjixieMap.put("name","起重机械");
zhizaoqizhongjixieMap.put("value", dataMap.getOrDefault("制造单位4000", 0)); zhizaoqizhongjixieMap.put("value",dataMap.getOrDefault("制造单位4000",0));
zhizaoCompanyList.add(zhizaoqizhongjixieMap); zhizaoCompanyList.add(zhizaoqizhongjixieMap);
//制造游乐设施 //制造游乐设施
Map<String, Object> zhizaoyoulesheshiMap = new HashMap<>(); Map<String,Object> zhizaoyoulesheshiMap = new HashMap<>();
zhizaoyoulesheshiMap.put("key", "key07"); zhizaoyoulesheshiMap.put("key","key07");
zhizaoyoulesheshiMap.put("name", "大型游乐设施"); zhizaoyoulesheshiMap.put("name","大型游乐设施");
zhizaoyoulesheshiMap.put("value", dataMap.getOrDefault("制造单位6000", 0)); zhizaoyoulesheshiMap.put("value",dataMap.getOrDefault("制造单位6000",0));
zhizaoCompanyList.add(zhizaoyoulesheshiMap); zhizaoCompanyList.add(zhizaoyoulesheshiMap);
//制造客运索道 //制造客运索道
Map<String, Object> zhizaokeyunsuodaoMap = new HashMap<>(); Map<String,Object> zhizaokeyunsuodaoMap = new HashMap<>();
zhizaokeyunsuodaoMap.put("key", "key08"); zhizaokeyunsuodaoMap.put("key","key08");
zhizaokeyunsuodaoMap.put("name", "客运索道"); zhizaokeyunsuodaoMap.put("name","客运索道");
zhizaokeyunsuodaoMap.put("value", dataMap.getOrDefault("制造单位9000", 0)); zhizaokeyunsuodaoMap.put("value",dataMap.getOrDefault("制造单位9000",0));
zhizaoCompanyList.add(zhizaokeyunsuodaoMap); zhizaoCompanyList.add(zhizaokeyunsuodaoMap);
zhizaoMap.put("data", zhizaoCompanyList); zhizaoMap.put("data",zhizaoCompanyList);
//无设备类型
Map<String,Object> zhizaoNullMap = new HashMap<>();
zhizaoNullMap.put("key","key09");
zhizaoNullMap.put("name","无设备类型");
zhizaoNullMap.put("value",dataMap.getOrDefault("制造单位null",0));
zhizaoCompanyList.add(zhizaoNullMap);
zhizaoMap.put("data",zhizaoCompanyList);
//使用Map //使用Map
Map<String, Object> shiyongMap = new HashMap<>(); Map<String,Object> shiyongMap = new HashMap<>();
List<Map<String, Object>> shiyongCompanyList = new ArrayList<>(); List<Map<String,Object>> shiyongCompanyList = new ArrayList<>();
shiyongMap.put("key", "shiyongCompany"); shiyongMap.put("key","shiyongCompany");
shiyongMap.put("value", "使用单位"); shiyongMap.put("value","使用单位");
//使用电梯 //使用电梯
Map<String, Object> shiyongdiantiMap = new HashMap<>(); Map<String,Object> shiyongdiantiMap = new HashMap<>();
shiyongdiantiMap.put("key", "key01"); shiyongdiantiMap.put("key","key01");
shiyongdiantiMap.put("name", "电梯"); shiyongdiantiMap.put("name","电梯");
shiyongdiantiMap.put("value", dataMap.getOrDefault("使用单位3000", 0)); shiyongdiantiMap.put("value",dataMap.getOrDefault("使用单位3000",0));
shiyongCompanyList.add(shiyongdiantiMap); shiyongCompanyList.add(shiyongdiantiMap);
//使用锅炉 //使用锅炉
Map<String, Object> shiyongguoluMap = new HashMap<>(); Map<String,Object> shiyongguoluMap = new HashMap<>();
shiyongguoluMap.put("key", "key02"); shiyongguoluMap.put("key","key02");
shiyongguoluMap.put("name", "锅炉"); shiyongguoluMap.put("name","锅炉");
shiyongguoluMap.put("value", dataMap.getOrDefault("使用单位1000", 0)); shiyongguoluMap.put("value",dataMap.getOrDefault("使用单位1000",0));
shiyongCompanyList.add(shiyongguoluMap); shiyongCompanyList.add(shiyongguoluMap);
//使用锅炉 //使用锅炉
Map<String, Object> shiyongjidongcheMap = new HashMap<>(); Map<String,Object> shiyongjidongcheMap = new HashMap<>();
shiyongjidongcheMap.put("key", "key03"); shiyongjidongcheMap.put("key","key03");
shiyongjidongcheMap.put("name", "场内机动车"); shiyongjidongcheMap.put("name","场内机动车");
shiyongjidongcheMap.put("value", dataMap.getOrDefault("使用单位5000", 0)); shiyongjidongcheMap.put("value",dataMap.getOrDefault("使用单位5000",0));
shiyongCompanyList.add(shiyongjidongcheMap); shiyongCompanyList.add(shiyongjidongcheMap);
//使用压力容器 //使用压力容器
Map<String, Object> shiyongyalirongqiMap = new HashMap<>(); Map<String,Object> shiyongyalirongqiMap = new HashMap<>();
shiyongyalirongqiMap.put("key", "key04"); shiyongyalirongqiMap.put("key","key04");
shiyongyalirongqiMap.put("name", "压力容器"); shiyongyalirongqiMap.put("name","压力容器");
shiyongyalirongqiMap.put("value", dataMap.getOrDefault("使用单位2000", 0)); shiyongyalirongqiMap.put("value",dataMap.getOrDefault("使用单位2000",0));
shiyongCompanyList.add(shiyongyalirongqiMap); shiyongCompanyList.add(shiyongyalirongqiMap);
//使用压力管道 //使用压力管道
Map<String, Object> shiyongyaliguandaoMap = new HashMap<>(); Map<String,Object> shiyongyaliguandaoMap = new HashMap<>();
shiyongyaliguandaoMap.put("key", "key05"); shiyongyaliguandaoMap.put("key","key05");
shiyongyaliguandaoMap.put("name", "压力管道"); shiyongyaliguandaoMap.put("name","压力管道");
shiyongyaliguandaoMap.put("value", dataMap.getOrDefault("使用单位9000", 0)); shiyongyaliguandaoMap.put("value",dataMap.getOrDefault("使用单位9000",0));
shiyongCompanyList.add(shiyongyaliguandaoMap); shiyongCompanyList.add(shiyongyaliguandaoMap);
//使用起重机械 //使用起重机械
Map<String, Object> shiyongqizhongjixieMap = new HashMap<>(); Map<String,Object> shiyongqizhongjixieMap = new HashMap<>();
shiyongqizhongjixieMap.put("key", "key06"); shiyongqizhongjixieMap.put("key","key06");
shiyongqizhongjixieMap.put("name", "起重机械"); shiyongqizhongjixieMap.put("name","起重机械");
shiyongqizhongjixieMap.put("value", dataMap.getOrDefault("使用单位4000", 0)); shiyongqizhongjixieMap.put("value",dataMap.getOrDefault("使用单位4000",0));
shiyongCompanyList.add(shiyongqizhongjixieMap); shiyongCompanyList.add(shiyongqizhongjixieMap);
//使用游乐设施 //使用游乐设施
Map<String, Object> shiyongyoulesheshiMap = new HashMap<>(); Map<String,Object> shiyongyoulesheshiMap = new HashMap<>();
shiyongyoulesheshiMap.put("key", "key07"); shiyongyoulesheshiMap.put("key","key07");
shiyongyoulesheshiMap.put("name", "大型游乐设施"); shiyongyoulesheshiMap.put("name","大型游乐设施");
shiyongyoulesheshiMap.put("value", dataMap.getOrDefault("使用单位6000", 0)); shiyongyoulesheshiMap.put("value",dataMap.getOrDefault("使用单位6000",0));
shiyongCompanyList.add(shiyongyoulesheshiMap); shiyongCompanyList.add(shiyongyoulesheshiMap);
//使用客运索道 //使用客运索道
Map<String, Object> shiyongkeyunsuodaoMap = new HashMap<>(); Map<String,Object> shiyongkeyunsuodaoMap = new HashMap<>();
shiyongkeyunsuodaoMap.put("key", "key08"); shiyongkeyunsuodaoMap.put("key","key08");
shiyongkeyunsuodaoMap.put("name", "客运索道"); shiyongkeyunsuodaoMap.put("name","客运索道");
shiyongkeyunsuodaoMap.put("value", dataMap.getOrDefault("使用单位9000", 0)); shiyongkeyunsuodaoMap.put("value",dataMap.getOrDefault("使用单位9000",0));
shiyongCompanyList.add(shiyongkeyunsuodaoMap); shiyongCompanyList.add(shiyongkeyunsuodaoMap);
shiyongMap.put("data", shiyongCompanyList); shiyongMap.put("data",shiyongCompanyList);
//无设备类型
Map<String,Object> shiyongNullMap = new HashMap<>();
shiyongNullMap.put("key","key09");
shiyongNullMap.put("name","无设备类型");
shiyongNullMap.put("value",dataMap.getOrDefault("使用单位null",0));
shiyongCompanyList.add(shiyongNullMap);
shiyongMap.put("data",shiyongCompanyList);
returnList.add(zhizaoMap); returnList.add(zhizaoMap);
returnList.add(angaiweiMap); returnList.add(angaiweiMap);
...@@ -450,4 +508,112 @@ public class ZLDPStatisticsServiceImpl { ...@@ -450,4 +508,112 @@ public class ZLDPStatisticsServiceImpl {
} }
return orgCode; return orgCode;
} }
public Map<String,Object> userCountNew(DPFilterParamDto screenDto) {
List<String> unitTypeList = UnitTypeEnum.getNameListByType(screenDto.getCompanyType());
List<Map<String, String>> userListMap = UserPostEnum.getEnumListByType(screenDto.getCompanyType());
List<Map<String, String>> list = screenMapper.userCountNew(screenDto, unitTypeList);
Map<String, Integer> dataMap = new HashMap<>();
for (Map<String, String> map : list) {
JSONArray jsonArray = JSONArray.parseArray(map.get("post"));
for(int j = 0; j < jsonArray.size(); j++){
dataMap.put(jsonArray.getString(j), dataMap.getOrDefault(jsonArray.getString(j), 1) + 1);
}
}
Map<String, Object> returnMap = new HashMap<>();
List<Object> xdata = new ArrayList<>();
List<Object> ydata = new ArrayList<>();
for (Map<String, String> map : userListMap) {
xdata.add(map.get("name"));
ydata.add(dataMap.getOrDefault(map.get("code"), 0));
}
returnMap.put("xdata", xdata);
returnMap.put("ydata", ydata);
return returnMap;
}
public JSONArray statisticInfoByRegionAndDate(DPFilterParamDto params) {
LocalDate today = LocalDate.now();
LocalDate startDate;
LocalDate endDate;
String regionCode = params.getCityCode();
if (ObjectUtils.isEmpty(params.getBeginDate()) || ObjectUtils.isEmpty(params.getBeginDate())) {
startDate = today.minusDays(6);
endDate = today;
} else {
startDate = LocalDate.parse(params.getBeginDate());
endDate = LocalDate.parse(params.getEndDate());
}
params.setBeginDate(startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
params.setEndDate(endDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
AlertStatistics statistics = alertStatisticsMapper.statisticsInfoByRegionAndDate(regionCode, startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")), endDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
JSONArray jsonArray = new JSONArray();
if (!ObjectUtils.isEmpty(statistics)) {
JSONObject jsonObject0 = new JSONObject();
jsonObject0.put("key", "dtkr");
jsonObject0.put("value", ValidationUtil.isEmpty(statistics.getTrappedPeople()) ? 0 : statistics.getTrappedPeople());
jsonObject0.put("name", "电梯困人");
JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("key", "slts");
jsonObject1.put("value", ValidationUtil.isEmpty(statistics.getComplaint()) ? 0 : statistics.getComplaint());
jsonObject1.put("name", "受理投诉");
JSONObject jsonObject2 = new JSONObject();
jsonObject2.put("key", "gzbx");
jsonObject2.put("value", ValidationUtil.isEmpty(statistics.getBreakdownRescue()) ? 0 : statistics.getBreakdownRescue());
jsonObject2.put("name", "故障维修");
JSONObject jsonObject3 = new JSONObject();
jsonObject3.put("key", "jjbkck");
jsonObject3.put("value", ValidationUtil.isEmpty(statistics.getRescuePersonnel()) ? 0 : statistics.getRescuePersonnel());
jsonObject3.put("name", "解救被困乘客");
JSONObject jsonObject4 = new JSONObject();
jsonObject4.put("key", "30fzdd");
jsonObject4.put("value", ValidationUtil.isEmpty(statistics.getWithinThirtyRescue()) ? 0 : statistics.getWithinThirtyRescue());
jsonObject4.put("name", "30分钟内到达");
JSONObject jsonObject5 = new JSONObject();
jsonObject5.put("key", "pjjysj");
jsonObject5.put("value", ValidationUtil.isEmpty(statistics.getAvgTime()) ? 0 : statistics.getAvgTime());
jsonObject5.put("name", "平均救援时间");
String orgCode = this.getAndSetOrgCode(regionCode);
JSONObject jsonObject6 = new JSONObject();
jsonObject6.put("key", "jycq");
jsonObject6.put("value", this.getQuestionNumber("检验超期",params, orgCode));
jsonObject6.put("name", "检验超期");
JSONObject jsonObject7 = new JSONObject();
jsonObject7.put("key", "jybhg");
jsonObject7.put("value", this.getQuestionNumber("检验不合格",params, orgCode));
jsonObject7.put("name", "检验不合格");
JSONObject jsonObject8 = new JSONObject();
jsonObject8.put("key", "wbcq");
jsonObject8.put("value", this.getQuestionNumber("维保超期",params, orgCode));
jsonObject8.put("name", "维保超期");
JSONObject jsonObject9 = new JSONObject();
jsonObject9.put("key", "csjsynx");
jsonObject9.put("value", this.getQuestionNumber("超设计使用年限",params, orgCode));
jsonObject9.put("name", "超设计使用年限");
jsonArray.add(jsonObject0);
jsonArray.add(jsonObject1);
jsonArray.add(jsonObject2);
jsonArray.add(jsonObject3);
jsonArray.add(jsonObject4);
jsonArray.add(jsonObject5);
jsonArray.add(jsonObject6);
jsonArray.add(jsonObject7);
jsonArray.add(jsonObject8);
jsonArray.add(jsonObject9);
}
return jsonArray;
}
private Long getQuestionNumber(String problemType, DPFilterParamDto params, String orgCode) {
return alertStatisticsMapper.countProblemByTypeDateAndOrgCode(problemType, params, orgCode);
}
} }
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