Commit caa9f8f8 authored by suhuiguang's avatar suhuiguang

Merge branch 'develop_tzs_register' of…

Merge branch 'develop_tzs_register' of http://39.100.92.250:5000/moa/amos-boot-biz into develop_tzs_register
parents be0df028 6994eaad
...@@ -114,7 +114,7 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi ...@@ -114,7 +114,7 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi
JSONObject dataObj = (JSONObject) result.get("data"); JSONObject dataObj = (JSONObject) result.get("data");
String cameraUrl = dataObj.getString("url"); String cameraUrl = dataObj.getString("url");
video.setUrl(cameraUrl); video.setUrl(cameraUrl);
video.setType(param.getString("protocol")); video.setType(param.getString("viewProtocol"));
} }
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
throw new RuntimeException("URL格式解析异常", e); throw new RuntimeException("URL格式解析异常", e);
......
...@@ -42,6 +42,7 @@ import com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext; ...@@ -42,6 +42,7 @@ import com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient; import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.*; import com.yeejoin.amos.boot.module.jg.biz.service.*;
import com.yeejoin.amos.boot.module.jg.biz.utils.CodeUtil; import com.yeejoin.amos.boot.module.jg.biz.utils.CodeUtil;
import com.yeejoin.amos.boot.module.jg.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.ymt.api.entity.*; import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum;
...@@ -58,6 +59,8 @@ import org.apache.commons.collections.CollectionUtils; ...@@ -58,6 +59,8 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -66,8 +69,8 @@ import org.typroject.tyboot.core.foundation.context.RequestContext; ...@@ -66,8 +69,8 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.InputStream; import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -133,6 +136,8 @@ public class DataDockServiceImpl { ...@@ -133,6 +136,8 @@ public class DataDockServiceImpl {
List<String> useOrgCodeList = new ArrayList<>();// 使用登记证集合 List<String> useOrgCodeList = new ArrayList<>();// 使用登记证集合
Map<String, List<String>> projectContraptionMap = new HashMap<>();// 工程装置名称集合 Map<String, List<String>> projectContraptionMap = new HashMap<>();// 工程装置名称集合
private static final String DEFINITION_KEY = "useRegistration"; private static final String DEFINITION_KEY = "useRegistration";
@Value("classpath:/json/urlInfo.json")
private Resource urlInfo;
private final JgVehicleInformationMapper jgVehicleInformationMapper; private final JgVehicleInformationMapper jgVehicleInformationMapper;
private final IdxBizJgRegisterInfoMapper idxBizJgRegisterInfoMapper; private final IdxBizJgRegisterInfoMapper idxBizJgRegisterInfoMapper;
private final ExcelImportErrorLogDao excelImportErrorLogDao; private final ExcelImportErrorLogDao excelImportErrorLogDao;
...@@ -2006,8 +2011,8 @@ public class DataDockServiceImpl { ...@@ -2006,8 +2011,8 @@ public class DataDockServiceImpl {
.setUseRegistrationCode(paramsDto.getUseOrgCode()) .setUseRegistrationCode(paramsDto.getUseOrgCode())
.setReceiveOrgCode(paramsDto.getReceiveOrgCode()) .setReceiveOrgCode(paramsDto.getReceiveOrgCode())
.setReceiveCompanyCode(paramsDto.getReceiveOrgCode()) .setReceiveCompanyCode(paramsDto.getReceiveOrgCode())
// .setReceiveCompanyOrgCode() //.setReceiveCompanyOrgCode()
.setReceiveOrgName(paramsDto.getReceiveOrgName()) //.setReceiveOrgName(paramsDto.getReceiveOrgName())
.setUseAddress("") .setUseAddress("")
.setManageType("unit") .setManageType("unit")
.setCreateDate(new Date()) .setCreateDate(new Date())
...@@ -2029,9 +2034,7 @@ public class DataDockServiceImpl { ...@@ -2029,9 +2034,7 @@ public class DataDockServiceImpl {
useRegEq.setRecUserName(paramsDto.getExecUserName()); useRegEq.setRecUserName(paramsDto.getExecUserName());
jgUseRegistrationEqServiceImpl.save(useRegEq); jgUseRegistrationEqServiceImpl.save(useRegEq);
}); });
JSONObject changeData = getJgUseRegistrationChangeData(paramsDto, records, applyNo); JSONObject changeData = getJgUseRegistrationChangeData(paramsDto, records, applyNo);
JgRegistrationHistory registrationHistory = JgRegistrationHistory.builder() JgRegistrationHistory registrationHistory = JgRegistrationHistory.builder()
.registrationClass("使用登记") .registrationClass("使用登记")
.changeData(JSON.toJSONString(changeData)) .changeData(JSON.toJSONString(changeData))
...@@ -2044,9 +2047,68 @@ public class DataDockServiceImpl { ...@@ -2044,9 +2047,68 @@ public class DataDockServiceImpl {
registrationHistory.setCreateUserId(paramsDto.getExecUserId()); registrationHistory.setCreateUserId(paramsDto.getExecUserId());
registrationHistory.setRecUserName(paramsDto.getExecUserName()); registrationHistory.setRecUserName(paramsDto.getExecUserName());
jgRegistrationHistoryService.save(registrationHistory); jgRegistrationHistoryService.save(registrationHistory);
String routePath = this.buildTaskModel(useReg, paramsDto);
jgResumeInfoService.createWithModel(JgResumeInfoDto.builder()
.applyNo(useReg.getApplyNo())
.businessType(BusinessTypeEnum.JG_HISTORY_USAGE_REGISTRATION.getName())
.businessId(useReg.getSequenceNbr() + "")
.equId(useReg.getProjectContraptionId())
.approvalUnit(useReg.getReceiveOrgName())
.approvalUnitCode(useReg.getReceiveOrgCode())
.status("正常")
.routePath(routePath)
.changeContent(BusinessTypeEnum.JG_HISTORY_USAGE_REGISTRATION.getName() + "业务办理")
.build());
return useReg; return useReg;
} }
public String buildTaskModel(JgUseRegistration jgUseRegistration, EquipRequestParamsDto paramsDto) {
TaskModelDto modelDto = new TaskModelDto();
modelDto.setNextExecuteUser(jgUseRegistration.getNextExecuteUserIds());
modelDto.setPageType("look");
modelDto.setStartUserId(RequestContext.getExeUserId());
modelDto.setStartDate(new Date());
TaskMessageDto taskMessageDto = new TaskMessageDto();
BeanUtil.copyProperties(jgUseRegistration, taskMessageDto);
taskMessageDto.setRegType("历史登记");
taskMessageDto.setEQU_LIST_CODE(paramsDto.getEquCategoryCode());
taskMessageDto.setAuditStatus(null);
taskMessageDto.setEquipId((jgUseRegistration.getProjectContraptionId()));
modelDto.setModel(taskMessageDto);
// 获取URL配置并匹配对应业务类型和pageType
List<Map> urlList = JsonUtils.getResourceList(urlInfo);
if (CollectionUtils.isEmpty(urlList)) {
throw new IllegalStateException("URL配置未初始化");
}
final String targetType = BusinessTypeEnum.JG_USAGE_REGISTRATION.getCode();
final String targetPageType = modelDto.getPageType();
for (Map urlMap : urlList) {
Object type = urlMap.get("type");
Object pageType = urlMap.get("pageType");
if (Objects.equals(type, targetType) && Objects.equals(pageType, targetPageType)) {
String baseUrl = String.valueOf(urlMap.get("url"));
try {
String queryParams = commonService.toQueryParams(modelDto.getModel());
String roleIds = Optional.ofNullable(modelDto.getNextExecuteUser()).orElse("");
return baseUrl.replace("{roleIds}", roleIds)
.replace("{userId}", taskMessageDto.getCreateUserId())
+ "&" + queryParams
+ "&nextExecuteUserIds=" + Optional.ofNullable(modelDto.getExecuteUserIds()).orElse("");
} catch (UnsupportedEncodingException e) {
// 建议记录日志,便于排查问题
log.error("URL参数编码失败", e);
throw new IllegalStateException("构建任务模型URL失败", e);
}
}
}
throw new IllegalStateException("未找到匹配的URL配置项,type=" + targetType + ", pageType=" + targetPageType);
}
private JSONObject getJgUseRegistrationChangeData(EquipRequestParamsDto paramsDto, List<String> records, String spplyNo) { private JSONObject getJgUseRegistrationChangeData(EquipRequestParamsDto paramsDto, List<String> records, String spplyNo) {
String record = Optional.ofNullable(records.get(0)).orElse(""); String record = Optional.ofNullable(records.get(0)).orElse("");
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
......
...@@ -27,9 +27,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; ...@@ -27,9 +27,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil; import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory; import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto; import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.jg.api.dto.CodeGenerateDto; import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.dto.EquipInfoCylinderExcelDto;
import com.yeejoin.amos.boot.module.jg.api.dto.EquipmentInfoDto;
import com.yeejoin.amos.boot.module.jg.api.entity.*; import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.*; import com.yeejoin.amos.boot.module.jg.api.enums.*;
import com.yeejoin.amos.boot.module.jg.api.mapper.*; import com.yeejoin.amos.boot.module.jg.api.mapper.*;
...@@ -38,6 +36,7 @@ import com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext ...@@ -38,6 +36,7 @@ import com.yeejoin.amos.boot.module.jg.biz.context.EquipUsedCheckStrategyContext
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient; import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.*; import com.yeejoin.amos.boot.module.jg.biz.service.*;
import com.yeejoin.amos.boot.module.jg.biz.utils.CodeUtil; import com.yeejoin.amos.boot.module.jg.biz.utils.CodeUtil;
import com.yeejoin.amos.boot.module.jg.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgRegisterInfoDto; import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgRegisterInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseEnterpriseInfoDto; import com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseEnterpriseInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.TzsUserInfoDto; import com.yeejoin.amos.boot.module.ymt.api.dto.TzsUserInfoDto;
...@@ -67,6 +66,7 @@ import org.elasticsearch.search.sort.SortOrder; ...@@ -67,6 +66,7 @@ import org.elasticsearch.search.sort.SortOrder;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations; import org.springframework.data.redis.core.ValueOperations;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
...@@ -84,6 +84,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper; ...@@ -84,6 +84,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
...@@ -287,6 +288,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -287,6 +288,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
@Autowired @Autowired
private JgUseRegistrationEqMapper jgRelationEquipMapper; private JgUseRegistrationEqMapper jgRelationEquipMapper;
@Autowired @Autowired
private JgResumeInfoServiceImpl jgResumeInfoService;
@Autowired
private JgRegistrationHistoryServiceImpl jgRegistrationHistoryService; private JgRegistrationHistoryServiceImpl jgRegistrationHistoryService;
@Autowired @Autowired
private SafetyProblemTracingMapper safetyProblemTracingMapper; private SafetyProblemTracingMapper safetyProblemTracingMapper;
...@@ -302,10 +305,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -302,10 +305,11 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
private ShCarServiceImpl shCarService; private ShCarServiceImpl shCarService;
@Autowired @Autowired
private IIdxBizJgProjectContraptionService idxBizJgProjectContraptionService; private IIdxBizJgProjectContraptionService idxBizJgProjectContraptionService;
@Value("classpath:/json/urlInfo.json")
private Resource urlInfo;
@Autowired @Autowired
private CommonServiceImpl commonServiceImpl; private CommonServiceImpl commonServiceImpl;
public IdxBizJgRegisterInfo getOneData(String record) { public IdxBizJgRegisterInfo getOneData(String record) {
return this.getOne(new QueryWrapper<IdxBizJgRegisterInfo>().eq("RECORD", record)); return this.getOne(new QueryWrapper<IdxBizJgRegisterInfo>().eq("RECORD", record));
} }
...@@ -4127,6 +4131,23 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4127,6 +4131,23 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
objectHashMap.put("EQU_CATEGORY_CODE", equipInfoDto.getEquCategoryCode()); objectHashMap.put("EQU_CATEGORY_CODE", equipInfoDto.getEquCategoryCode());
objectHashMap.put("orgBranchCode", equipInfoDto.getOrgBranchCode()); objectHashMap.put("orgBranchCode", equipInfoDto.getOrgBranchCode());
updateHistory(objectHashMap, String.valueOf(jgUseRegistration.getSequenceNbr())); updateHistory(objectHashMap, String.valueOf(jgUseRegistration.getSequenceNbr()));
String routePath = this.buildTaskModel(jgUseRegistration, equipInfoDto.getEquListCode());
jgResumeInfoService.saveBatchResume(
equipmentLists.stream()
.map(equipId -> JgResumeInfoDto.builder()
.applyNo(jgUseRegistration.getApplyNo())
.businessType(BusinessTypeEnum.JG_HISTORY_USAGE_REGISTRATION.getName())
.businessId(String.valueOf(jgUseRegistration.getSequenceNbr()))
.equId(String.valueOf(equipId.get("record")))
.approvalUnit(jgUseRegistration.getReceiveOrgName())
.approvalUnitCode(jgUseRegistration.getReceiveCompanyCode())
.status("正常")
.changeContent(BusinessTypeEnum.JG_HISTORY_USAGE_REGISTRATION.getName() + "业务办理")
.routePath(routePath)
.build())
.collect(Collectors.toList())
);
} }
Optional.of(supervisionInfoList).filter(list -> !list.isEmpty()).ifPresent(iIdxBizJgSupervisionInfoService::saveBatch); Optional.of(supervisionInfoList).filter(list -> !list.isEmpty()).ifPresent(iIdxBizJgSupervisionInfoService::saveBatch);
...@@ -4141,6 +4162,53 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4141,6 +4162,53 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
return String.format("导入完成,成功导入: %d 条数据!", useInfoList.size()); return String.format("导入完成,成功导入: %d 条数据!", useInfoList.size());
} }
public String buildTaskModel(JgUseRegistration jgUseRegistration, String equListCode) {
TaskModelDto modelDto = new TaskModelDto();
modelDto.setNextExecuteUser(jgUseRegistration.getNextExecuteUserIds());
modelDto.setPageType("look");
modelDto.setStartUserId(RequestContext.getExeUserId());
modelDto.setStartDate(new Date());
TaskMessageDto taskMessageDto = new TaskMessageDto();
BeanUtil.copyProperties(jgUseRegistration, taskMessageDto);
taskMessageDto.setRegType("历史登记");
taskMessageDto.setEQU_LIST_CODE(equListCode);
taskMessageDto.setAuditStatus(null);
taskMessageDto.setEquipId((jgUseRegistration.getProjectContraptionId()));
modelDto.setModel(taskMessageDto);
// 获取URL配置并匹配对应业务类型和pageType
List<Map> urlList = JsonUtils.getResourceList(urlInfo);
if (CollectionUtils.isEmpty(urlList)) {
throw new IllegalStateException("URL配置未初始化");
}
final String targetType = BusinessTypeEnum.JG_USAGE_REGISTRATION.getCode();
final String targetPageType = modelDto.getPageType();
for (Map urlMap : urlList) {
Object type = urlMap.get("type");
Object pageType = urlMap.get("pageType");
if (Objects.equals(type, targetType) && Objects.equals(pageType, targetPageType)) {
String baseUrl = String.valueOf(urlMap.get("url"));
try {
String queryParams = commonServiceImpl.toQueryParams(modelDto.getModel());
String roleIds = Optional.ofNullable(modelDto.getNextExecuteUser()).orElse("");
return baseUrl.replace("{roleIds}", roleIds)
.replace("{userId}", taskMessageDto.getCreateUserId())
+ "&" + queryParams
+ "&nextExecuteUserIds=" + Optional.ofNullable(modelDto.getExecuteUserIds()).orElse("");
} catch (UnsupportedEncodingException e) {
// 建议记录日志,便于排查问题
log.error("URL参数编码失败", e);
throw new IllegalStateException("构建任务模型URL失败", e);
}
}
}
throw new IllegalStateException("未找到匹配的URL配置项,type=" + targetType + ", pageType=" + targetPageType);
}
private static void setSupervisionInfo(String orgBranchCode, String orgBranchName, String record, List<IdxBizJgSupervisionInfo> supervisionInfoList) { private static void setSupervisionInfo(String orgBranchCode, String orgBranchName, String record, List<IdxBizJgSupervisionInfo> supervisionInfoList) {
IdxBizJgSupervisionInfo supervisionInfo = new IdxBizJgSupervisionInfo(); IdxBizJgSupervisionInfo supervisionInfo = new IdxBizJgSupervisionInfo();
supervisionInfo.setOrgBranchCode(orgBranchCode); supervisionInfo.setOrgBranchCode(orgBranchCode);
......
...@@ -5,17 +5,17 @@ import com.alibaba.fastjson.JSON; ...@@ -5,17 +5,17 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.annotation.FieldMapping;
import com.yeejoin.amos.boot.biz.common.annotation.ResultFieldMapping;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.yeejoin.amos.boot.biz.common.annotation.FieldMapping;
import com.yeejoin.amos.boot.biz.common.annotation.ResultFieldMapping;
import com.yeejoin.amos.boot.biz.common.bo.CompanyBo; import com.yeejoin.amos.boot.biz.common.bo.CompanyBo;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
import com.yeejoin.amos.boot.module.common.api.enums.ReginStepEnum; import com.yeejoin.amos.boot.module.common.api.enums.ReginStepEnum;
import com.yeejoin.amos.boot.module.jg.api.common.StringUtil; import com.yeejoin.amos.boot.module.jg.api.common.StringUtil;
import com.yeejoin.amos.boot.module.jg.api.dto.*; import com.yeejoin.amos.boot.module.jg.api.dto.*;
...@@ -33,6 +33,7 @@ import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient; ...@@ -33,6 +33,7 @@ import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.service.*; import com.yeejoin.amos.boot.module.jg.biz.service.*;
import com.yeejoin.amos.boot.module.ymt.api.entity.*; import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgOtherInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgOtherInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper;
...@@ -151,7 +152,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang ...@@ -151,7 +152,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
*/ */
@GlobalTransactional(rollbackFor = Exception.class) @GlobalTransactional(rollbackFor = Exception.class)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@FieldMapping({@FieldMapping.FieldMap(paramIndex = 1, sourceField = "notice.estateUnitSeq", targetField = "transferUseInfo", serviceClass = CommonServiceImpl.class, queryMethod = "queryUnitCreditInfoBySeq")}) @FieldMapping({@FieldMapping.FieldMap(paramIndex = 1, sourceField = "changeRegistrationTransfer.estateUnitSeq", targetField = "changeRegistrationTransfer.transferUseInfo", serviceClass = CommonServiceImpl.class, queryMethod = "queryUnitCreditInfoBySeq")})
public List<JgChangeRegistrationTransferDto> createTransfer(String submitType, JSONObject map, ReginParams reginParams) { public List<JgChangeRegistrationTransferDto> createTransfer(String submitType, JSONObject map, ReginParams reginParams) {
try { try {
Map<String, Object> tableData = (Map<String, Object>) map.get(TABLE_PAGE_ID); Map<String, Object> tableData = (Map<String, Object>) map.get(TABLE_PAGE_ID);
...@@ -829,6 +830,19 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang ...@@ -829,6 +830,19 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
private Map<String, String> create96333Code(JgRegistrationHistory historyData, String record) { private Map<String, String> create96333Code(JgRegistrationHistory historyData, String record) {
Map<String, Object> changeData = JSON.parseObject(historyData.getChangeData(), Map.class); Map<String, Object> changeData = JSON.parseObject(historyData.getChangeData(), Map.class);
List<JSONObject> registrationList = (List<JSONObject>) changeData.get("registrationList"); List<JSONObject> registrationList = (List<JSONObject>) changeData.get("registrationList");
IdxBizJgOtherInfo otherInfo = otherInfoService.getOneData(record);
String superviseCode = otherInfo.getSupervisoryCode();
String equListCode = Optional.ofNullable(registrationList)
.flatMap(list -> list.stream()
.findFirst()
.map(json -> json.getString("equListCode")))
.orElse("");
// 非电梯不生成96333码
if (!EquipmentClassifityEnum.DT.getCode().equals(equListCode)) {
return ImmutableMap.<String, String>builder()
.put("superviseCode", superviseCode)
.build();
}
String equCategoryCode = Optional.ofNullable(registrationList) String equCategoryCode = Optional.ofNullable(registrationList)
.flatMap(list -> list.stream() .flatMap(list -> list.stream()
.findFirst() .findFirst()
...@@ -843,8 +857,6 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang ...@@ -843,8 +857,6 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
.orElse(""); .orElse("");
String isXiXian = "0".equals(changeData.get("transferIsXixian")) ? "null" : "1"; String isXiXian = "0".equals(changeData.get("transferIsXixian")) ? "null" : "1";
// 移转不需要重新生成监管码,只需要新生成96333码,接口上送superviseCode则不再生成监管码 // 移转不需要重新生成监管码,只需要新生成96333码,接口上送superviseCode则不再生成监管码
IdxBizJgOtherInfo otherInfo = otherInfoService.getOneData(record);
String superviseCode = otherInfo.getSupervisoryCode();
ImmutableMap<String, Object> map = ImmutableMap.<String, Object>builder() ImmutableMap<String, Object> map = ImmutableMap.<String, Object>builder()
.put("cityCode", cityCode) .put("cityCode", cityCode)
.put("countyCode", countyCode) .put("countyCode", countyCode)
...@@ -855,12 +867,14 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang ...@@ -855,12 +867,14 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
Map<String, Object> result = tzsServiceFeignClient.createCode(map).getResult(); Map<String, Object> result = tzsServiceFeignClient.createCode(map).getResult();
return ImmutableMap.<String, String>builder() ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
.put("superviseCode", superviseCode) builder.put("superviseCode", superviseCode);
.put("code96333", Optional.ofNullable(result)
.map(r -> (String) r.get("code96333")) Optional.ofNullable(result)
.orElse(null)) .map(r -> (String) r.get("code96333"))
.build(); .ifPresent(code -> builder.put("code96333", code));
return builder.build();
} }
public void saveChangeRecord(JgChangeRegistrationTransfer transfer, TaskV2Model taskV2Model) { public void saveChangeRecord(JgChangeRegistrationTransfer transfer, TaskV2Model taskV2Model) {
...@@ -995,12 +1009,15 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang ...@@ -995,12 +1009,15 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
private void updateUseRegistrationManage(JgChangeRegistrationTransferEq device, JgChangeRegistrationTransfer transfer, JgRegistrationHistory historyData, String useRegistrationCode, boolean isUpdateRegistrationCode) { private void updateUseRegistrationManage(JgChangeRegistrationTransferEq device, JgChangeRegistrationTransfer transfer, JgRegistrationHistory historyData, String useRegistrationCode, boolean isUpdateRegistrationCode) {
JSONObject historyJson = JSON.parseObject(historyData.getChangeData()); JSONObject historyJson = JSON.parseObject(historyData.getChangeData());
JSONObject deviceInfo = JSON.parseObject(device.getDeviceInfo());
List<JgUseRegistrationManage> registrationList = useRegistrationManageService.lambdaQuery() List<JgUseRegistrationManage> registrationList = useRegistrationManageService.lambdaQuery()
.in(BaseEntity::getSequenceNbr, .in(BaseEntity::getSequenceNbr,
((List<?>) historyJson.get("registrationList")).stream() ((List<?>) historyJson.get("registrationList")).stream()
.map(obj -> ((JSONObject) obj).getString("sequenceNbr")) .map(obj -> ((JSONObject) obj).getString("sequenceNbr"))
.collect(Collectors.toList()) .collect(Collectors.toList())
).list(); )
.eq(JgUseRegistrationManage::getUseRegistrationCode,deviceInfo.getString("USE_ORG_CODE"))
.list();
// 区外移装更新是否报废字段为1,区内移装不变 // 区外移装更新是否报废字段为1,区内移装不变
if (isUpdateRegistrationCode) { if (isUpdateRegistrationCode) {
...@@ -1083,10 +1100,6 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang ...@@ -1083,10 +1100,6 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
// 批量保存新的注册管理对象 // 批量保存新的注册管理对象
useRegistrationManageService.saveOrUpdateBatch(newRegistrationList); useRegistrationManageService.saveOrUpdateBatch(newRegistrationList);
// 保存历史数据
historyJson.put("registrationList", updatedRegistrationList);
historyData.setChangeData(JSONObject.toJSONString(historyJson));
} }
/** /**
......
...@@ -50,6 +50,7 @@ import com.yeejoin.amos.boot.module.jg.biz.service.ICommonService; ...@@ -50,6 +50,7 @@ import com.yeejoin.amos.boot.module.jg.biz.service.ICommonService;
import com.yeejoin.amos.boot.module.jg.biz.service.ICompensateFlowDataOfRedis; import com.yeejoin.amos.boot.module.jg.biz.service.ICompensateFlowDataOfRedis;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgInspectionDetectionInfoService; import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgInspectionDetectionInfoService;
import com.yeejoin.amos.boot.module.jg.biz.utils.CodeUtil; import com.yeejoin.amos.boot.module.jg.biz.utils.CodeUtil;
import com.yeejoin.amos.boot.module.jg.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.ymt.api.common.StringUtil; import com.yeejoin.amos.boot.module.ymt.api.common.StringUtil;
import com.yeejoin.amos.boot.module.ymt.api.entity.*; import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.*; import com.yeejoin.amos.boot.module.ymt.api.enums.*;
...@@ -76,8 +77,10 @@ import org.redisson.api.RedissonClient; ...@@ -76,8 +77,10 @@ import org.redisson.api.RedissonClient;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware; import org.springframework.context.ApplicationContextAware;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -95,6 +98,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -95,6 +98,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.net.URLEncoder; import java.net.URLEncoder;
...@@ -138,6 +142,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -138,6 +142,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
private static final String REGION = "REGION"; private static final String REGION = "REGION";
private static final String STREET = "STREET"; private static final String STREET = "STREET";
public static final String carNumber = "carNumber"; public static final String carNumber = "carNumber";
@Value("classpath:/json/urlInfo.json")
private Resource urlInfo;
private ApplicationContext applicationContext; private ApplicationContext applicationContext;
@Autowired @Autowired
RedisUtils redisUtils; RedisUtils redisUtils;
...@@ -811,7 +817,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -811,7 +817,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
* @return list * @return list
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class) @GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 6000000)
public List<Map<String, Object>> handleUnitUseRegistration(JSONObject map) { public List<Map<String, Object>> handleUnitUseRegistration(JSONObject map) {
try { try {
if (!ObjectUtils.isEmpty(map.get("submit"))) { if (!ObjectUtils.isEmpty(map.get("submit"))) {
...@@ -2031,7 +2037,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -2031,7 +2037,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class) @GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 6000000)
public void withdraw(String instanceId, String nextTaskId, String manageType) { public void withdraw(String instanceId, String nextTaskId, String manageType) {
String lockKey = CommonServiceImpl.buildJgExecuteLockKey(instanceId); String lockKey = CommonServiceImpl.buildJgExecuteLockKey(instanceId);
RLock lock = redissonClient.getLock(lockKey); RLock lock = redissonClient.getLock(lockKey);
...@@ -3102,7 +3108,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -3102,7 +3108,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
* @return JgUseRegistration * @return JgUseRegistration
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@GlobalTransactional(rollbackFor = Exception.class) @GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 6000000)
public JgUseRegistration cancelApplication(Long sequenceNbr, String cancelReason) { public JgUseRegistration cancelApplication(Long sequenceNbr, String cancelReason) {
// 1.单据更新为已作废 // 1.单据更新为已作废
JgUseRegistration jgUseRegistration = this.getById(sequenceNbr); JgUseRegistration jgUseRegistration = this.getById(sequenceNbr);
...@@ -4097,7 +4103,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -4097,7 +4103,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 历史设备 生成证书管理表记录 & 生成安装 维保等操作记录 // 历史设备 生成证书管理表记录 & 生成安装 维保等操作记录
this.historyEquGenManageRelated(map, jgUseRegistration, registerInfo, idxBizJgFactoryInfo); this.historyEquGenManageRelated(map, jgUseRegistration, registerInfo, idxBizJgFactoryInfo);
String routePath = this.buildTaskModel(jgUseRegistration, map, reginParams);
jgResumeInfoService.createWithModel(JgResumeInfoDto.builder() jgResumeInfoService.createWithModel(JgResumeInfoDto.builder()
.applyNo(jgUseRegistration.getApplyNo()) .applyNo(jgUseRegistration.getApplyNo())
.businessType(BusinessTypeEnum.JG_HISTORY_USAGE_REGISTRATION.getName()) .businessType(BusinessTypeEnum.JG_HISTORY_USAGE_REGISTRATION.getName())
...@@ -4106,6 +4112,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -4106,6 +4112,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
.approvalUnit(jgUseRegistration.getReceiveOrgName()) .approvalUnit(jgUseRegistration.getReceiveOrgName())
.approvalUnitCode(jgUseRegistration.getReceiveOrgCode()) .approvalUnitCode(jgUseRegistration.getReceiveOrgCode())
.status("正常") .status("正常")
.routePath(routePath)
.changeContent(BusinessTypeEnum.JG_HISTORY_USAGE_REGISTRATION.getName() + "业务办理") .changeContent(BusinessTypeEnum.JG_HISTORY_USAGE_REGISTRATION.getName() + "业务办理")
.build()); .build());
} }
...@@ -4123,6 +4130,54 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -4123,6 +4130,54 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
} }
} }
public String buildTaskModel(JgUseRegistration jgUseRegistration, JSONObject map, ReginParams reginParams) {
TaskModelDto modelDto = new TaskModelDto();
modelDto.setNextExecuteUser(jgUseRegistration.getNextExecuteUserIds());
modelDto.setPageType("look");
modelDto.setStartUserId(RequestContext.getExeUserId());
modelDto.setStartUser(reginParams.getUserModel().getRealName());
modelDto.setStartUserCompanyName(reginParams.getCompany().getCompanyName());
modelDto.setStartDate(new Date());
TaskMessageDto taskMessageDto = new TaskMessageDto();
BeanUtil.copyProperties(jgUseRegistration, taskMessageDto);
taskMessageDto.setRegType("历史登记");
taskMessageDto.setEQU_LIST_CODE(String.valueOf(map.get("equListCode")));
taskMessageDto.setAuditStatus(null);
taskMessageDto.setEquipId((String.valueOf(map.get("equipId"))));
modelDto.setModel(taskMessageDto);
// 获取URL配置并匹配对应业务类型和pageType
List<Map> urlList = JsonUtils.getResourceList(urlInfo);
if (CollectionUtils.isEmpty(urlList)) {
throw new IllegalStateException("URL配置未初始化");
}
final String targetType = BusinessTypeEnum.JG_USAGE_REGISTRATION.getCode();
final String targetPageType = modelDto.getPageType();
for (Map urlMap : urlList) {
Object type = urlMap.get("type");
Object pageType = urlMap.get("pageType");
if (Objects.equals(type, targetType) && Objects.equals(pageType, targetPageType)) {
String baseUrl = String.valueOf(urlMap.get("url"));
try {
String queryParams = commonServiceImpl.toQueryParams(modelDto.getModel());
String roleIds = Optional.ofNullable(modelDto.getNextExecuteUser()).orElse("");
return baseUrl.replace("{roleIds}", roleIds)
.replace("{userId}", taskMessageDto.getCreateUserId())
+ "&" + queryParams
+ "&nextExecuteUserIds=" + Optional.ofNullable(modelDto.getExecuteUserIds()).orElse("");
} catch (UnsupportedEncodingException e) {
// 建议记录日志,便于排查问题
log.error("URL参数编码失败", e);
throw new IllegalStateException("构建任务模型URL失败", e);
}
}
}
throw new IllegalStateException("未找到匹配的URL配置项,type=" + targetType + ", pageType=" + targetPageType);
}
/** /**
* 历史设备登记-》更新维保信息 * 历史设备登记-》更新维保信息
*/ */
......
...@@ -5,11 +5,9 @@ import com.yeejoin.amos.boot.module.ys.biz.service.CommonService; ...@@ -5,11 +5,9 @@ import com.yeejoin.amos.boot.module.ys.biz.service.CommonService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.apache.velocity.runtime.directive.Evaluate;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
...@@ -45,4 +43,12 @@ public class CommonController extends BaseController { ...@@ -45,4 +43,12 @@ public class CommonController extends BaseController {
@PathVariable(value = "statisticalType") String statisticalType) { @PathVariable(value = "statisticalType") String statisticalType) {
return ResponseHelper.buildResponse(commonService.safetyTraceabilitySynthesis(statisticalType)); return ResponseHelper.buildResponse(commonService.safetyTraceabilitySynthesis(statisticalType));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "运营监管分析中间地图", notes = "运营监管分析中间地图")
@RequestMapping(value = "/analysis/cityMapData", method = RequestMethod.GET)
public ResponseModel<Object> analysisCityMapData(@RequestParam(value = "firstMenuKey") String firstMenuKey,
@RequestParam(value = "secondMenuKey") String secondMenuKey) {
return ResponseHelper.buildResponse(commonService.analysisCityMapData(firstMenuKey, secondMenuKey));
}
} }
...@@ -6,4 +6,6 @@ public interface CommonService { ...@@ -6,4 +6,6 @@ public interface CommonService {
Object safetyTraceabilitySynthesis(String statisticalType); Object safetyTraceabilitySynthesis(String statisticalType);
Object analysisCityMapData(String firstMenuKey, String secondMenuKey);
} }
...@@ -4,6 +4,8 @@ import cn.hutool.core.util.NumberUtil; ...@@ -4,6 +4,8 @@ import cn.hutool.core.util.NumberUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
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.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yeejoin.amos.boot.module.common.biz.service.impl.DynamicFormInstanceServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.DynamicFormInstanceServiceImpl;
import com.yeejoin.amos.boot.module.jg.api.entity.SafetyProblemTracing; import com.yeejoin.amos.boot.module.jg.api.entity.SafetyProblemTracing;
import com.yeejoin.amos.boot.module.jg.api.mapper.SafetyProblemTracingMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.SafetyProblemTracingMapper;
...@@ -30,10 +32,14 @@ import org.elasticsearch.search.builder.SearchSourceBuilder; ...@@ -30,10 +32,14 @@ import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Collections;
import java.util.Optional; import java.util.Optional;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
...@@ -110,6 +116,20 @@ public class CommonServiceImpl implements CommonService { ...@@ -110,6 +116,20 @@ public class CommonServiceImpl implements CommonService {
.fluentPut("rehearsal", "应急演练数").fluentPut("prePlan", "应急预案数"); .fluentPut("rehearsal", "应急演练数").fluentPut("prePlan", "应急预案数");
} }
@Value("classpath:/json/analysisCityMapData.json")
private Resource analysisCityMapData;
private JsonNode jsonData;
@PostConstruct
public void init() {
try {
jsonData = new ObjectMapper().readTree(analysisCityMapData.getInputStream());
} catch (IOException e) {
throw new RuntimeException("Failed to read or parse JSON data", e);
}
}
/** /**
* 排序 :页面列表排序功能支持,将 "字段,ascend" 或 "字段,descend" 转化为对应JSONObject * 排序 :页面列表排序功能支持,将 "字段,ascend" 或 "字段,descend" 转化为对应JSONObject
* *
...@@ -286,6 +306,7 @@ public class CommonServiceImpl implements CommonService { ...@@ -286,6 +306,7 @@ public class CommonServiceImpl implements CommonService {
/** /**
* 安全追溯-综合分析统计 * 安全追溯-综合分析统计
*
* @param statisticalType 统计类型 creditSupervision(信用监管) 、 exceptionDirectory(异常名录)、seriousViolationOfLaw(严重违法) * @param statisticalType 统计类型 creditSupervision(信用监管) 、 exceptionDirectory(异常名录)、seriousViolationOfLaw(严重违法)
* @return result * @return result
*/ */
...@@ -295,39 +316,39 @@ public class CommonServiceImpl implements CommonService { ...@@ -295,39 +316,39 @@ public class CommonServiceImpl implements CommonService {
if ("seriousViolationOfLaw".equals(statisticalType)) { if ("seriousViolationOfLaw".equals(statisticalType)) {
// 红码警示企业数 // 红码警示企业数
long comp = safetyProblemTracingMapper.selectCount(new LambdaQueryWrapper<SafetyProblemTracing>() long comp = safetyProblemTracingMapper.selectCount(new LambdaQueryWrapper<SafetyProblemTracing>()
.eq(SafetyProblemTracing::getProblemStatusCode,0) .eq(SafetyProblemTracing::getProblemStatusCode, 0)
.eq(SafetyProblemTracing::getSourceTypeCode,2)); .eq(SafetyProblemTracing::getSourceTypeCode, 2));
// 红码警示设备数 // 红码警示设备数
long equ = safetyProblemTracingMapper.selectCount(new LambdaQueryWrapper<SafetyProblemTracing>() long equ = safetyProblemTracingMapper.selectCount(new LambdaQueryWrapper<SafetyProblemTracing>()
.eq(SafetyProblemTracing::getProblemStatusCode,0) .eq(SafetyProblemTracing::getProblemStatusCode, 0)
.eq(SafetyProblemTracing::getSourceTypeCode,3)); .eq(SafetyProblemTracing::getSourceTypeCode, 3));
// 红码警示人员数 // 红码警示人员数
long peo = safetyProblemTracingMapper.selectCount(new LambdaQueryWrapper<SafetyProblemTracing>() long peo = safetyProblemTracingMapper.selectCount(new LambdaQueryWrapper<SafetyProblemTracing>()
.eq(SafetyProblemTracing::getProblemStatusCode,0) .eq(SafetyProblemTracing::getProblemStatusCode, 0)
.eq(SafetyProblemTracing::getSourceTypeCode,1)); .eq(SafetyProblemTracing::getSourceTypeCode, 1));
return JSONObject.parseObject(String.format(SERIOUS_VIOLATION_OF_LAW, comp, equ, peo)); return JSONObject.parseObject(String.format(SERIOUS_VIOLATION_OF_LAW, comp, equ, peo));
} }
// 异常名录 统计企业主体问题数量 // 异常名录 统计企业主体问题数量
if ("exceptionDirectory".equals(statisticalType)) { if ("exceptionDirectory".equals(statisticalType)) {
// 问题企业数量 // 问题企业数量
long comp = safetyProblemTracingMapper.selectList(new LambdaQueryWrapper<SafetyProblemTracing>() long comp = safetyProblemTracingMapper.selectList(new LambdaQueryWrapper<SafetyProblemTracing>()
.eq(SafetyProblemTracing::getProblemStatusCode,0) .eq(SafetyProblemTracing::getProblemStatusCode, 0)
.eq(SafetyProblemTracing::getSourceTypeCode,2) .eq(SafetyProblemTracing::getSourceTypeCode, 2)
.groupBy(SafetyProblemTracing::getPrincipalUnitCode)) .groupBy(SafetyProblemTracing::getPrincipalUnitCode))
.size(); .size();
// 非问题企业数量 (企业总数-问题企业数量) // 非问题企业数量 (企业总数-问题企业数量)
long total = Privilege.companyClient.queryForCompanyList(null, null).getResult().size(); long total = Privilege.companyClient.queryForCompanyList(null, null).getResult().size();
long other = (long) NumberUtil.sub(total,comp); long other = (long) NumberUtil.sub(total, comp);
return JSONArray.parseArray(String.format(EXCEPTION_DIRECTORY, comp, other)); return JSONArray.parseArray(String.format(EXCEPTION_DIRECTORY, comp, other));
} }
// 信用监管 统计绿、红、橙、灰码数量及占比 // 信用监管 统计绿、红、橙、灰码数量及占比
if ("creditSupervision".equals(statisticalType)) { if ("creditSupervision".equals(statisticalType)) {
// 绿码 // 绿码
long greenCode = safetyProblemTracingMapper.selectCount(new LambdaQueryWrapper<SafetyProblemTracing>() long greenCode = safetyProblemTracingMapper.selectCount(new LambdaQueryWrapper<SafetyProblemTracing>()
.eq(SafetyProblemTracing::getProblemStatusCode,1)); .eq(SafetyProblemTracing::getProblemStatusCode, 1));
// 红码 // 红码
long redCode = safetyProblemTracingMapper.selectCount(new LambdaQueryWrapper<SafetyProblemTracing>() long redCode = safetyProblemTracingMapper.selectCount(new LambdaQueryWrapper<SafetyProblemTracing>()
.eq(SafetyProblemTracing::getProblemStatusCode,0)); .eq(SafetyProblemTracing::getProblemStatusCode, 0));
// 橙码 // 橙码
long orangeCode = 0L; long orangeCode = 0L;
// 灰码 // 灰码
...@@ -336,4 +357,9 @@ public class CommonServiceImpl implements CommonService { ...@@ -336,4 +357,9 @@ public class CommonServiceImpl implements CommonService {
} }
return null; return null;
} }
@Override
public Object analysisCityMapData(String firstMenuKey, String secondMenuKey) {
return new JSONObject().fluentPut("records", Collections.singletonList(jsonData.get(firstMenuKey).get(secondMenuKey)));
}
} }
\ No newline at end of file
{
"底数清": {
"设备": {
"YULINNUM": "116256",
"YANANNUM": "61979",
"HANCHENGNUM": "21668",
"TONGCHUANNUM": "10538",
"WEINANNUM": "50877",
"XIANYANGNUM": "96436",
"BAOJINUM": "30731",
"YANGLINGNUM": "5870",
"XIANNUM": "185387",
"SHANGLUONUM": "7009",
"HANZHONGNUM": "36683",
"ANKANGNUM": "57340"
},
"高风险企业数": {
"YULINNUM": "1009",
"YANANNUM": "3482",
"HANCHENGNUM": "1003",
"TONGCHUANNUM": "3087",
"WEINANNUM": "980",
"XIANYANGNUM": "7265",
"BAOJINUM": "3854",
"YANGLINGNUM": "2398",
"XIANNUM": "8882",
"SHANGLUONUM": "981",
"HANZHONGNUM": "293",
"ANKANGNUM": "9211"
},
"人员": {
"YULINNUM": "451",
"YANANNUM": "221",
"HANCHENGNUM": "211",
"TONGCHUANNUM": "210",
"WEINANNUM": "129",
"XIANYANGNUM": "102",
"BAOJINUM": "200",
"YANGLINGNUM": "176",
"XIANNUM": "801",
"SHANGLUONUM": "129",
"HANZHONGNUM": "251",
"ANKANGNUM": "220"
}
},
"业务办理": {
"使用登记": {
"YULINNUM": "10091",
"YANANNUM": "39309",
"HANCHENGNUM": "93821",
"TONGCHUANNUM": "26209",
"WEINANNUM": "129029",
"XIANYANGNUM": "93837",
"BAOJINUM": "716321",
"YANGLINGNUM": "30193",
"XIANNUM": "38413",
"SHANGLUONUM": "74043",
"HANZHONGNUM": "40033",
"ANKANGNUM": "92239"
},
"安装改造修理单位": {
"YULINNUM": "30392",
"YANANNUM": "27211",
"HANCHENGNUM": "1202",
"TONGCHUANNUM": "29302",
"WEINANNUM": "20233",
"XIANYANGNUM": "3021",
"BAOJINUM": "29303",
"YANGLINGNUM": "20122",
"XIANNUM": "93011",
"SHANGLUONUM": "4122",
"HANZHONGNUM": "8332",
"ANKANGNUM": "18122"
},
"施工告知": {
"YULINNUM": "8291",
"YANANNUM": "2033",
"HANCHENGNUM": "4021",
"TONGCHUANNUM": "30399",
"WEINANNUM": "8282",
"XIANYANGNUM": "7233",
"BAOJINUM": "40022",
"YANGLINGNUM": "7333",
"XIANNUM": "7662",
"SHANGLUONUM": "8333",
"HANZHONGNUM": "7112",
"ANKANGNUM": "8221"
},
"检验": {
"YULINNUM": "123",
"YANANNUM": "362",
"HANCHENGNUM": "92",
"TONGCHUANNUM": "62",
"WEINANNUM": "72",
"XIANYANGNUM": "23",
"BAOJINUM": "45",
"YANGLINGNUM": "56",
"XIANNUM": "67",
"SHANGLUONUM": "67",
"HANZHONGNUM": "201",
"ANKANGNUM": "101"
}
},
"安全监管": {
"双重预防建设": {
"YULINNUM": "12",
"YANANNUM": "23",
"HANCHENGNUM": "363",
"TONGCHUANNUM": "932",
"WEINANNUM": "245",
"XIANYANGNUM": "498",
"BAOJINUM": "274",
"YANGLINGNUM": "228",
"XIANNUM": "531",
"SHANGLUONUM": "347",
"HANZHONGNUM": "890",
"ANKANGNUM": "125"
},
"两个清单": {
"YULINNUM": "346",
"YANANNUM": "789",
"HANCHENGNUM": "123",
"TONGCHUANNUM": "573",
"WEINANNUM": "982",
"XIANYANGNUM": "452",
"BAOJINUM": "127",
"YANGLINGNUM": "452",
"XIANNUM": "323",
"SHANGLUONUM": "356",
"HANZHONGNUM": "346",
"ANKANGNUM": "111"
},
"专项整治": {
"YULINNUM": "122",
"YANANNUM": "12",
"HANCHENGNUM": "78",
"TONGCHUANNUM": "56",
"WEINANNUM": "124",
"XIANYANGNUM": "17",
"BAOJINUM": "97",
"YANGLINGNUM": "43",
"XIANNUM": "87",
"SHANGLUONUM": "12",
"HANZHONGNUM": "87",
"ANKANGNUM": "98"
},
"监察": {
"YULINNUM": "123",
"YANANNUM": "76",
"HANCHENGNUM": "34",
"TONGCHUANNUM": "89",
"WEINANNUM": "998",
"XIANYANGNUM": "43",
"BAOJINUM": "33",
"YANGLINGNUM": "76",
"XIANNUM": "135",
"SHANGLUONUM": "974",
"HANZHONGNUM": "234",
"ANKANGNUM": "765"
},
"应急监管": {
"YULINNUM": "12",
"YANANNUM": "344",
"HANCHENGNUM": "654",
"TONGCHUANNUM": "345",
"WEINANNUM": "345",
"XIANYANGNUM": "754",
"BAOJINUM": "123",
"YANGLINGNUM": "76",
"XIANNUM": "98",
"SHANGLUONUM": "54",
"HANZHONGNUM": "12",
"ANKANGNUM": "87"
}
}
}
\ No newline at end of file
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