Commit 788d87fa authored by Lambertliu's avatar Lambertliu

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 bf67a71a d301f051
package com.yeejoin.amos.boot.module.elevator.biz.controller;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......@@ -567,7 +568,7 @@ public class AlertCalledController extends BaseController {
/**
* 冻结工单-维修
*
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -603,7 +604,7 @@ public class AlertCalledController extends BaseController {
/**
* 工单结案-投诉
*
*
* @return
*/
@ResubmitCheck
......@@ -785,6 +786,17 @@ public class AlertCalledController extends BaseController {
/**
* 应急大屏使用
*
* @param id 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/detail/{id}")
@ApiOperation(httpMethod = "GET", value = "根据id获取详细信息", notes = "根据id获取详细信息")
public ResponseModel<Object> getDetail(@PathVariable Long id) {
return ResponseHelper.buildResponse(iAlertCalledService.getDetail(id));
}
}
......@@ -34,6 +34,7 @@ import com.yeejoin.amos.boot.module.elevator.api.service.IAlertCalledService;
import com.yeejoin.amos.boot.module.elevator.api.service.TzsAuthService;
import com.yeejoin.amos.boot.module.elevator.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.text.StrBuilder;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.logging.log4j.LogManager;
......@@ -44,12 +45,16 @@ import org.redisson.api.RedissonClient;
import org.springframework.beans.BeanUtils;
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.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
......@@ -58,6 +63,8 @@ import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.Collectors;
import static com.alibaba.fastjson.JSON.parseArray;
/**
* 警情接警填报记录服务实现类
*
......@@ -127,6 +134,12 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
private RAtomicLong rAtomicLong;
@Autowired
ElevatorServiceImpl elevatorServiceImpl;
@Value("classpath:/json/emergencyInformation.json")
private Resource emergencyInformation;
public AlertCalledServiceImpl(RedissonClient client){
this.redissonClient = client;
rAtomicLong = redissonClient.getAtomicLong("AUTO_INCR_LONG");
......@@ -944,4 +957,98 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
}
return alertCalledMapper.getCountNum(userName, startTime, endTime, groupCode);
}
public Object getDetail(Long id) {
HashMap<String, Object> map = new HashMap<>();
// 基本信息
Map<String, Object> keyInfo = getKeyInfo(id);
// map.put("keyinfo", keyInfo);
return keyInfo;
}
public Map<String, Object> getKeyInfo(Long id) {
HashMap<String, Object> keyinfoData = new HashMap<>();
// 基本信息
List<FormValue> jsonData = getJsonData(emergencyInformation);
AlertCalledFormDto alertCalledFormVo = getAlertCalledFormDto(id);
Map<String, Object> objectMap = Bean.BeantoMap(alertCalledFormVo.getAlertCalledDto());
List<FormValue> dynamicFormAlert = alertCalledFormVo.getDynamicFormAlert();
jsonData.forEach(f -> {
Object o = objectMap.get(f.getKey());
if (!ObjectUtils.isEmpty(o)) {
f.setValue(o.toString());
}
dynamicFormAlert.add(f);
});
// 使用单位信息
// 获取根据警情获取电梯信息
Map<String, Object> map = elevatorServiceImpl.selectByAlertId(id);
// 根据设备id 获取使用单位信息
Map<String, Object> useUnitMap = elevatorServiceImpl.selectUseUnitByAlertId(String.valueOf(map.get("sequenceNbr")));
if (!ObjectUtils.isEmpty(useUnitMap)) {
jsonData.forEach(f -> {
// 单位名称
if ("useUnitName".equals(f.getKey())) {
f.setValue(ObjectUtils.isEmpty(useUnitMap.get("useUnitName")) ? null : String.valueOf(useUnitMap.get("useUnitName")));
}
// 单位电话
// if ("principalPhone".equals(f.getKey())){
//
// }
// 单位地址
if ("unitAddress".equals(f.getKey())) {
f.setValue(ObjectUtils.isEmpty(useUnitMap.get("address")) ? null : String.valueOf(useUnitMap.get("address")));
}
// 安全管理员
if ("securityAdministrator".equals(f.getKey())) {
f.setValue(ObjectUtils.isEmpty(useUnitMap.get("manager")) ? null : String.valueOf(useUnitMap.get("manager")));
}
// 安全管理员电话
if ("securityAdministratorPhone".equals(f.getKey())) {
f.setValue(ObjectUtils.isEmpty(useUnitMap.get("managerPhone")) ? null : String.valueOf(useUnitMap.get("managerPhone")));
}
});
}
// 处置记录
LambdaQueryWrapper<RepairConsult> queryWrapper = new LambdaQueryWrapper<RepairConsult>();
queryWrapper.eq(RepairConsult::getParentId, id).orderByDesc(RepairConsult::getRecDate);
List<RepairConsult> list = repairConsultServiceImpl.list(queryWrapper);
HashMap<String, Object> datas = new HashMap<>();
ArrayList<Map<String, Object>> records = new ArrayList<>();
list.forEach(r -> {
HashMap<String, Object> data = new HashMap<>();
data.put("label", r.getAlertStatus());
data.put("operatingTime", r.getRecDate());
data.put("operater", r.getDescription());
records.add(data);
});
// 监管码
HashMap<String, Object> qrcode = new HashMap<>();
if (!ObjectUtils.isEmpty(alertCalledFormVo.getAlertCalledDto())) {
qrcode.put("value", alertCalledFormVo.getAlertCalledDto().getRegistrationCode());
}
// 96333码
HashMap<String, Object> qrcode2 = new HashMap<>();
if (!ObjectUtils.isEmpty(alertCalledFormVo.getAlertCalledDto())) {
qrcode2.put("value", alertCalledFormVo.getAlertCalledDto().getDeviceId());
}
datas.put("datas", records);
keyinfoData.put("keyParams", dynamicFormAlert);
keyinfoData.put("infoRecords", datas);
keyinfoData.put("qrcode", qrcode);
keyinfoData.put("qrcode2", qrcode2);
return keyinfoData;
}
private List<FormValue> getJsonData(Resource resource) {
String json;
try {
json = IOUtils.toString(resource.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new RuntimeException(e);
}
return parseArray(json, FormValue.class);
}
}
\ No newline at end of file
[
{
"key": "emergencyPerson",
"label": "救援人姓名",
"type": "text"
},
{
"key": "callTime",
"label": "接警时间",
"type": "text"
},
{
"key": "contactPhone",
"label": "联系人电话",
"type": "text"
},
{
"key": "useSiteCategory",
"label": "使用场所分类",
"type": "text"
},
{
"key": "deviceId",
"label": "电梯识别码",
"type": "text"
},
{
"key": "useStatus",
"label": "使用情况",
"type": "text"
},
{
"key": "address",
"label": "地址",
"type": "text"
},
{
"key": "useUnitName",
"label": "单位名称",
"type": "text"
},
{
"key": "principalPhone",
"label": "单位电话",
"type": "text"
},
{
"key": "unitAddress",
"label": "单位地址",
"type": "text"
},
{
"key": "securityAdministrator",
"label": "电梯安全管理员",
"type": "text"
},
{
"key": "securityAdministratorPhone",
"label": "电梯安全管理员电话",
"type": "text"
}
]
\ No newline at end of file
......@@ -38,7 +38,7 @@ public enum IssueTypeEnum {
//充装异常(气瓶)
CHARGE_EXCEPTION_CYLINDER("充装异常","14","4"),
//许可超期(设备,气瓶)
LICENSE_OVERDUE("许可超期","14","3,4"),
LICENSE_OVERDUE("许可超期","15","3,4"),
......
......@@ -15,6 +15,10 @@ public enum DPMapStatisticsItemEnum {
*/
TOTAL("特种设备总量 (台)", "total", ""),
OVER15YEARS_ELEVATORS("超过15年电梯数量", "over15yearsCount", ""),
USE_REGISTRATION_COUNT("使用登记办理量", "useRegistrationCount", ""),
CONSTRUCTION_NOTICE_COUNT("施工告知办理量", "constructionNoticeCount", ""),
CHANGE_COUNT("变更办理量", "changeCount", ""),
GAS("气瓶 (台)", "gas", ""),
ELEVATORS("电梯 (台)", "elevators", "3000"),
PRESSURE_VESSELS("压力容器 (台)", "pressureVessels", "2000"),
......@@ -30,6 +34,9 @@ public enum DPMapStatisticsItemEnum {
GAS_UNITS("充装单位 (家)", "gasUnits", ""),
OPERATORS("作业人员 (人)", "operators", ""),
DEVICE_COUNT("已纳管设备数", "deviceCount", ""),
PERSON_ISSUES_COUNT("个人问题数", "个人", ""),
COMPANY_ISSUES_COUNT("企业问题数", "企业", ""),
EQU_ISSUES_COUNT("设备数", "设备", ""),
CERTIFICATE_COUNT("登记证总量", "certificateCount", "");
private String label;
private String code;
......
......@@ -66,4 +66,14 @@ public interface DPStatisticsMapper {
List<Map<String, Object>> disableCountByOrgCodes(@Param("orgCodes") List<String> orgCodes);
List<Map<String, Object>> cancelCountByOrgCodes(@Param("orgCodes") List<String> orgCodes);
long certificateCountByOrgCode(@Param("orgCode") String orgCode);
long useCountByOrgCode(@Param("orgCode") String orgCode);
Long over15yearsCount(@Param("orgCode") String orgCode, @Param("time") String time);
Long constructionNoticeCount(@Param("orgCode") String orgCode);
Long changeCountByOrgCode(@Param("orgCode") String orgCode);
}
......@@ -527,4 +527,114 @@
GROUP BY
T.org_code
</select>
<select id="certificateCountByOrgCode" resultType="java.lang.Long">
SELECT COUNT
(1)
FROM
tzs_jg_use_registration_manage A
INNER JOIN privilege_company C ON A.receive_company_code = C.company_code
WHERE
A.certificate_status = '已登记'
AND C.org_code LIKE concat ( #{orgCode}, '%' )
</select>
<select id="useCountByOrgCode" resultType="java.lang.Long">
SELECT COUNT
( 1 )
FROM
tzs_jg_use_registration T
WHERE
T.audit_status = '已完成'
AND T.receive_company_org_code LIKE CONCAT ( #{orgCode}, '%' )
</select>
<select id="over15yearsCount" resultType="java.lang.Long">
SELECT COUNT
( 1 )
FROM
idx_biz_jg_factory_info A
INNER JOIN idx_biz_jg_supervision_info B ON A.RECORD = B.RECORD
INNER JOIN idx_biz_jg_register_info C ON A.RECORD = C.RECORD
WHERE
B.ORG_BRANCH_CODE LIKE CONCAT ( #{orgCode}, '%' )
AND A.PRODUCE_DATE &lt; #{time}
AND C.EQU_LIST = '3000'
</select>
<select id="constructionNoticeCount" resultType="java.lang.Long">
SELECT SUM
( T.COUNT )
FROM
(
SELECT COUNT
( 1 )
FROM
tzs_jg_installation_notice T
WHERE
T.notice_status = 6616
AND T.receive_company_org_code LIKE CONCAT ( #{orgCode}, '%' ) UNION
SELECT COUNT
( 1 )
FROM
tzs_jg_maintain_notice T
WHERE
T.notice_status = 6616
AND T.receive_company_org_code LIKE CONCAT ( #{orgCode}, '%' ) UNION
SELECT COUNT
( 1 )
FROM
tzs_jg_reform_notice T
WHERE
T.notice_status = 6616
AND T.receive_company_org_code LIKE CONCAT ( #{orgCode}, '%' ) UNION
SELECT COUNT
( 1 )
FROM
tzs_jg_transfer_notice T
WHERE
T.notice_status = 6616
AND T.receive_company_org_code LIKE CONCAT ( #{orgCode}, '%' )
) T
</select>
<select id="changeCountByOrgCode" resultType="java.lang.Long">
SELECT SUM
( T.COUNT )
FROM
(
SELECT COUNT
( 1 )
FROM
privilege_company pc
INNER JOIN tzs_jg_change_registration_name crn ON crn.receive_org_code = pc.company_code
AND crn.audit_status = '已完成'
WHERE
pc.org_code LIKE CONCAT ( #{orgCode}, '%' ) UNION
SELECT COUNT
( 1 )
FROM
tzs_jg_change_registration_reform T
WHERE
T.audit_status = '已完成'
AND T.receive_company_org_code LIKE CONCAT ( #{orgCode}, '%' ) UNION
SELECT COUNT
( 1 )
FROM
tzs_jg_change_registration_transfer T
WHERE
T.audit_status = '已完成'
AND T.receive_company_org_code LIKE CONCAT ( #{orgCode}, '%' ) UNION
SELECT COUNT
( 1 )
FROM
tzs_jg_change_registration_unit T
WHERE
T.status = '已完成'
AND T.receive_company_org_code LIKE CONCAT ( #{orgCode}, '%' ) UNION
SELECT COUNT
( 1 )
FROM
tzs_jg_change_vehicle_registration_unit T
WHERE
T.status = '已完成'
AND T.receive_company_org_code LIKE CONCAT ( #{orgCode}, '%' )
) T
</select>
</mapper>
......@@ -185,8 +185,11 @@
fi.ins_use_maintain_explain AS insUseMaintainExplain,
useUnit.use_contact AS safetyManager,
useUnit.contact_phone AS safetyManagerPhone,
(select ui.CITY_NAME from idx_biz_jg_use_info ui WHERE ui.record = re.equ_id) AS useUnitCityName,
(select ui.COUNTY_NAME from idx_biz_jg_use_info ui WHERE ui.record = re.equ_id) AS useUnitCountyName,
(select ui.PROVINCE_NAME from idx_biz_jg_use_info ui WHERE ui.record = re.equ_id) AS equipProvinceName,
(select ui.CITY_NAME from idx_biz_jg_use_info ui WHERE ui.record = re.equ_id) AS equipCityName,
(select ui.COUNTY_NAME from idx_biz_jg_use_info ui WHERE ui.record = re.equ_id) AS equipCountyName,
(select ui.STREET_NAME from idx_biz_jg_use_info ui WHERE ui.record = re.equ_id) AS equipStreetName,
(select ui.ADDRESS from idx_biz_jg_use_info ui WHERE ui.record = re.equ_id) AS equipAddress,
useUnit.ADDRESS AS useUnitAddress,
useUnit.ADDRESS AS useUnitLeaderAddress,
installUnit.use_code AS useCode,
......
......@@ -39,15 +39,16 @@
tjmc.next_execute_user_ids,
tjmc.next_task_id,
tjmc.cancel_reason,
ri."EQU_CODE" as equCode,
concat(date_format(IFNULL(inform_start, null),'%Y-%m-%d'),' ~ ',date_format(IFNULL(inform_end, null),'%Y-%m-%d')) as informStartAndEnd,
(SELECT name from tz_equipment_category ec WHERE ec.code = ri.EQU_LIST) AS equList,
(select name from tz_equipment_category ec WHERE ec.code = ri.EQU_CATEGORY) AS equCategory,
(select name from tz_equipment_category ec WHERE ec.code = ri.EQU_DEFINE) AS equDefine
concat(date_format(IFNULL(inform_start, null),'%Y-%m-%d'),' ~ ',date_format(IFNULL(inform_end, null),'%Y-%m-%d')) as informStartAndEnd
<!-- ri."EQU_CODE" as equCode,-->
<!-- (SELECT name from tz_equipment_category ec WHERE ec.code = ri.EQU_LIST) AS equList,-->
<!-- (select name from tz_equipment_category ec WHERE ec.code = ri.EQU_CATEGORY) AS equCategory,-->
<!-- (select name from tz_equipment_category ec WHERE ec.code = ri.EQU_DEFINE) AS equDefine-->
FROM
amos_tzs_biz.tzs_jg_maintenance_contract tjmc
LEFT JOIN tzs_jg_maintenance_contract_eq tjmce ON tjmce.equip_transfer_id = tjmc.sequence_nbr
LEFT JOIN idx_biz_jg_register_info ri ON ri.record = tjmce.equ_id
<!-- LEFT JOIN tzs_jg_maintenance_contract_eq tjmce ON tjmce.equip_transfer_id = tjmc.sequence_nbr-->
<!-- LEFT JOIN idx_biz_jg_register_info ri ON ri.record = tjmce.equ_id-->
<where>
tjmc.is_delete = 0
<if test="contractDto.applyNo != '' and contractDto.applyNo != null">
......@@ -79,18 +80,18 @@
<if test="contractDto.receiveOrgCode != '' and contractDto.receiveOrgCode != null">
and tjmc.receive_org_code = #{contractDto.receiveOrgCode}
</if>
<if test="contractDto.equList != null and contractDto.equList != ''">
AND ri."EQU_LIST" = #{contractDto.equList}
</if>
<if test="contractDto.equCategory != null and contractDto.equCategory != ''">
AND ri."equ_category" = #{contractDto.equCategory}
</if>
<if test="contractDto.equDefine != null and contractDto.equDefine != ''">
AND ri."EQU_DEFINE" = #{contractDto.equDefine}
</if>
<if test="contractDto.equCode != null and contractDto.equCode != ''">
AND ri."EQU_CODE" like concat('%',#{contractDto.equCode},'%')
</if>
<!-- <if test="contractDto.equList != null and contractDto.equList != ''">-->
<!-- AND ri."EQU_LIST" = #{contractDto.equList}-->
<!-- </if>-->
<!-- <if test="contractDto.equCategory != null and contractDto.equCategory != ''">-->
<!-- AND ri."equ_category" = #{contractDto.equCategory}-->
<!-- </if>-->
<!-- <if test="contractDto.equDefine != null and contractDto.equDefine != ''">-->
<!-- AND ri."EQU_DEFINE" = #{contractDto.equDefine}-->
<!-- </if>-->
<!-- <if test="contractDto.equCode != null and contractDto.equCode != ''">-->
<!-- AND ri."EQU_CODE" like concat('%',#{contractDto.equCode},'%')-->
<!-- </if>-->
-- 数据过滤开始 ----------------------------------------------------
<!-- <choose>-->
<!-- <when test="contractDto.useUnitCodeFilter != '' and contractDto.useUnitCodeFilter != null and-->
......
......@@ -146,6 +146,11 @@
fi.factory_standard AS factoryStandard,
fi.product_quality_yield_prove AS productQualityYieldProve,
fi.ins_use_maintain_explain AS insUseMaintainExplain,
(select ui.PROVINCE_NAME from idx_biz_jg_use_info ui WHERE ui.record = re.equ_id) AS equipProvinceName,
(select ui.CITY_NAME from idx_biz_jg_use_info ui WHERE ui.record = re.equ_id) AS equipCityName,
(select ui.COUNTY_NAME from idx_biz_jg_use_info ui WHERE ui.record = re.equ_id) AS equipCountyName,
(select ui.STREET_NAME from idx_biz_jg_use_info ui WHERE ui.record = re.equ_id) AS equipStreetName,
(select ui.ADDRESS from idx_biz_jg_use_info ui WHERE ui.record = re.equ_id) AS equipAddress,
(select useUnit.use_contact from tz_base_enterprise_info useUnit WHERE useUnit.use_code = isn.use_unit_credit_code) AS safetyManager,
(select useUnit.contact_phone from tz_base_enterprise_info useUnit WHERE useUnit.use_code = isn.use_unit_credit_code) AS safetyManagerPhone,
(select useUnit.ADDRESS from tz_base_enterprise_info useUnit WHERE useUnit.use_code = isn.use_unit_credit_code) AS useUnitLeaderAddress,
......
......@@ -90,11 +90,11 @@
</if>
-- 使用登记证编号
<if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''">
and tjurm.use_registration_code like #{dto.useRegistrationCode}
and tjurm.use_registration_code like concat('%',#{dto.useRegistrationCode},'%')
</if>
-- 申请单号
<if test="dto.applyNo != null and dto.applyNo != ''">
and tjurm.apply_no like #{dto.applyNo}
and tjurm.apply_no like concat('%',#{dto.applyNo},'%')
</if>
-- 登记证书唯一码
<if test="dto.certificateNo != null and dto.certificateNo != ''">
......
......@@ -241,6 +241,6 @@ public class IdxBizJqEquipmentRegisterController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "查询当前单位下已注册或未注册工程装置信息", notes = "查询当前单位下已注册或未注册工程装置信息")
public ResponseModel<List<Map<String, Object>>> getProjectContraptionByCondition() {
String unitCreditCode = getSelectedOrgInfo().getCompany().getCompanyCode();
return ResponseHelper.buildResponse(idxBizJgRegisterInfoService.getUnRegisterProjectContraptionList(unitCreditCode));
return ResponseHelper.buildResponse(idxBizJgRegisterInfoService.getProjectContraptionList(unitCreditCode));
}
}
package com.yeejoin.amos.boot.module.jg.biz.controller;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
......@@ -11,7 +10,6 @@ import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgChangeRegistrationReformServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
......@@ -23,7 +21,6 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -149,8 +146,9 @@ public class JgChangeRegistrationReformController extends BaseController {
@RequestParam(value = "EQU_LIST_CODE", required = false) String EQU_LIST_CODE,
@RequestParam(value = "EQU_CATEGORY_CODE", required = false) String EQU_CATEGORY_CODE,
@RequestParam(value = "equList", required = false) String equList,
@RequestParam(value = "receiveCompanyCode") String receiveCompanyCode,
@RequestParam(value = "transferType", required = false) String transferType) {
@RequestParam(value = "receiveCompanyCode", required = false) String receiveCompanyCode,
@RequestParam(value = "transferType", required = false) String transferType,
@RequestParam(value = "useRegistrationCode", required = false) String useRegistrationCode) {
JgUseRegistrationManageDto dto = new JgUseRegistrationManageDto();
Page<JgUseRegistrationManageDto> page = new Page<JgUseRegistrationManageDto>();
page.setCurrent(current);
......@@ -172,6 +170,10 @@ public class JgChangeRegistrationReformController extends BaseController {
if (!ObjectUtils.isEmpty(equList)){
dto.setEquListCode(equList);
}
// 流程页面使用登记证号筛选,适配组件,适配原有表单
if (!ObjectUtils.isEmpty(useRegistrationCode)){
dto.setUseRegistrationCode(useRegistrationCode);
}
// 流程页面使用equList,适配组件,适配原有表单
if (!ObjectUtils.isEmpty(EQU_CATEGORY_CODE)){
dto.setEquCategoryCode(EQU_CATEGORY_CODE);
......@@ -179,7 +181,7 @@ public class JgChangeRegistrationReformController extends BaseController {
if (!ValidationUtil.isEmpty(receiveCompanyCode)){
String[] codes = receiveCompanyCode.split("_");
if (!ValidationUtil.isEmpty(codes)){
dto.setReceiveCompanyCode("1".equals(transferType) ? null : codes[0]);
dto.setReceiveCompanyCode(codes[0]);
}
}
dto.setCertificateStatus("1".equals(transferType) ? "已注销" : "已登记");
......
package com.yeejoin.amos.boot.module.jg.biz.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jg.api.dto.JgChangeVehicleRegistrationUnitDto;
import com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationManageDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgChangeVehicleRegistrationUnit;
import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import java.util.Map;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgChangeVehicleRegistrationUnitServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
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 org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.JgChangeVehicleRegistrationUnitDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import java.util.List;
import java.util.Map;
/**
*
......@@ -128,8 +125,8 @@ public class JgChangeVehicleRegistrationUnitController extends BaseController {
@RequestParam(value = "size") int size,
@RequestParam(value = "useUnitCreditCode") String useUnitCreditCode,
@RequestParam(value = "whetherVehicleCylinder") String whetherVehicleCylinder,
@RequestParam(value = "certificateStatus") String certificateStatus
) {
@RequestParam(value = "certificateStatus") String certificateStatus,
@RequestParam(value = "useRegistrationCode", required = false) String useRegistrationCode) {
JgUseRegistrationManageDto dto = new JgUseRegistrationManageDto();
Page<JgUseRegistrationManageDto> page = new Page<JgUseRegistrationManageDto>();
page.setCurrent(current);
......@@ -144,6 +141,9 @@ public class JgChangeVehicleRegistrationUnitController extends BaseController {
if (!ValidationUtil.isEmpty(certificateStatus)){
dto.setCertificateStatus(certificateStatus);
}
if (!ObjectUtils.isEmpty(useRegistrationCode)){
dto.setUseRegistrationCode(useRegistrationCode);
}
if (!ValidationUtil.isEmpty(whetherVehicleCylinder)){
dto.setWhetherVehicleCylinder(whetherVehicleCylinder);
}
......
......@@ -279,4 +279,23 @@ public class JgUseRegistrationController extends BaseController {
return ResponseHelper.buildResponse(jgUseRegistrationServiceImpl.saveHistoryEquip(secondMap));
}
/**
* 根据使用登记证查询工程装置名称
* @param useRegistrationCode 使用登记证
* @return projectContraption
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/queryByRegistrationCode")
@ApiOperation(httpMethod = "POST", value = "根据使用登记证查询工程装置名称", notes = "根据使用登记证查询工程装置名称")
public ResponseModel<Object> queryByRegistrationCode(@RequestParam("useRegistrationCode") String useRegistrationCode) {
ReginParams selectedOrgInfo = getSelectedOrgInfo();
String companyCode = selectedOrgInfo.getCompany().getCompanyCode();
String companyType = selectedOrgInfo.getCompany().getCompanyType();
String useUnitCreditCode = "个人主体".equals(companyType) && companyCode.contains("_")? companyCode.split("_", 2)[1]
: companyCode;
HashMap<String, Object> map = new HashMap<>();
map.put("useRegistrationCode", useRegistrationCode);
map.put("useUnitCreditCode", useUnitCreditCode);
return ResponseHelper.buildResponse(jgUseRegistrationServiceImpl.queryByRegistrationCode(map));
}
}
......@@ -55,5 +55,5 @@ public interface IIdxBizJgRegisterInfoService {
* @param useUnitCreditCode 单位统一信用代码
* @return 查询单位下工程装置信息
*/
List<Map<String, Object>> getUnRegisterProjectContraptionList(String useUnitCreditCode);
List<Map<String, Object>> getProjectContraptionList(String useUnitCreditCode);
}
......@@ -930,12 +930,12 @@ public class CommonServiceImpl implements ICommonService {
String docTitle = pdfFile.getName();
FileExporter.exportFile(FileExporter.FileType.valueOf("pdf"), docTitle, bytes, response);
} catch (Exception e) {
log.error("pdf文件转换失败:{}", e);
log.error("pdf文件转换失败", e);
} finally {
try {
Files.deleteIfExists(pdfFile.toPath());
} catch (Exception e) {
log.error("文件找不到,删除失败:{}", e);
log.error("文件找不到,删除失败", e);
}
}
}
......@@ -1750,7 +1750,7 @@ public class CommonServiceImpl implements ICommonService {
* @param supervisoryCompanyCode 接收机构单位代码
* @return 使用登记编号
*/
public String generateRegistrationCode(String equipId, String supervisoryCode, String supervisoryCompanyCode) {
public String generateRegistrationCode(String equipId, String supervisoryCode, String supervisoryCompanyCode, boolean isUnit) {
// 根据设备id查询设备类别、品种
LambdaQueryWrapper<RegistrationInfo> equipWrapper = new LambdaQueryWrapper<>();
equipWrapper.eq(RegistrationInfo::getRecord, equipId);
......@@ -1765,16 +1765,14 @@ public class CommonServiceImpl implements ICommonService {
EquipTypeEnum.getMessage(equCategory.substring(0, 1));
// 设备代码中间两位
String equipType2MidDigits;
equipType2MidDigits = equCategory.substring(1, 3);
//if (ValidationUtil.isEmpty(equDefine)) {
// 没有设备品种的设备取设备类别代码中间两位
//}
//else {
// // 设备品种代码中间两位
// equipType2MidDigits = equDefine.substring(1, 3);
//}
String equipType2MidDigits = equCategory.substring(1, 3);
//台套还是取品种的中间两位
if (!isUnit) {
if (!ValidationUtil.isEmpty(equDefine)) {
equipType2MidDigits = equDefine.substring(1, 3);
}
}
// 登记机关代号
String city = supervisoryCode.substring(0, 1);
// 西咸新区监管码对应的设备使用登记证还按咸阳(D)生成
......
......@@ -764,6 +764,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
useInfoMap.put("USE_ADDRESS", useInfo.getAddress());
useInfoMap.put("FULL_ADDRESS", useInfo.getAddress());
}
useInfoMap.put("EQU_STATE", ObjectUtils.isEmpty(useInfo.getEquState()) ? null : EquimentEnum.getName.get(Integer.valueOf(useInfo.getEquState())));
}
if (!useInfoMap.isEmpty()) {
Map<String, Object> filterMap = useInfoMap.entrySet()
......@@ -1431,10 +1432,10 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
throw new BadRequest("请先选择使用单位等信息!");
}
if (!ValidationUtil.isEmpty(map.get("transferType")) && ValidationUtil.equals(map.get("transferType"), "区内移装")) {
if (ValidationUtil.isEmpty(map.get("county"))) {
throw new BadRequest("请先选择施工区域等信息!");
if (ValidationUtil.isEmpty(map.get("city"))) {
throw new BadRequest("请先选择施施工区域-市!");
} else {
map.put(USE_PLACE_CODE, String.valueOf(map.get("county")).split("_")[0]);
map.put(USE_PLACE_CODE, String.valueOf(map.get("city")).split("_")[0]);
}
}
map.put("USE_UNIT_CREDIT_CODE", String.valueOf(map.get("useUnitCreditCode")).split("_")[0]);
......@@ -2293,7 +2294,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
iIdxBizJgOtherInfoService.saveOrUpdateData(otherInfo);
if (CylinderTypeEnum.CYLINDER.getCode().equals(equCategory) || "2100".equals(equCategory)) {
if (CylinderTypeEnum.CYLINDER.getCode().equals(equCategory) || "2100".equals(equCategory) || "8300".equals(equCategory)) {
IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = JSON.parseObject(JSON.toJSONString(equipmentInfoForm), IdxBizJgInspectionDetectionInfo.class);
List<Map<String, Object>> inspectionAndTestingInstitutions = commonMapper.getUnitListByType(INSPECTION_AND_TESTING_INSTITUTIONS);
Optional<Map<String, Object>> optional = inspectionAndTestingInstitutions.stream().filter(x -> x.get("useCode").equals(inspectionDetectionInfo.getInspectOrgCode())).findFirst();
......@@ -2301,8 +2302,8 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
inspectionDetectionInfo.setInspectOrgName((String) mapOrDefault.getOrDefault("useUnit", inspectionDetectionInfo.getInspectOrgName()));
inspectionDetectionInfo.setRecord(record);
inspectionDetectionInfo.setRecDate(date);
inspectionDetectionInfo.setInspectType("ZZJDJY");
inspectionDetectionInfo.setInspectConclusion("6040");
inspectionDetectionInfo.setInspectType("8300".equals(equCategory) ? "AZJDJY" : "ZZJDJY");
// inspectionDetectionInfo.setInspectConclusion("6040");
inspectionDetectionInfo.setSequenceNbr(OPERATESAVE.equals(operateType) ? null : String.valueOf(equipmentInfoForm.get("INSPECTIONDETECTIONINFO_SEQ")));
iIdxBizJgInspectionDetectionInfoService.saveOrUpdateData(inspectionDetectionInfo);
}
......@@ -2514,6 +2515,9 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
Page<JSONObject> page = new Page<>(jsonObject.getLong("number"), jsonObject.getLong("size"));
Set<String> records = EquipUsedCheckStrategyContext.getUsedStrategy("useRegistration").getEquipInFlow(useUnitCreditCode);
if ("8300".equals(jsonObject.get(EQU_CATEGORY_CODE))) {// 管道
if (jsonObject.get("projectContraption") == null) {
throw new BadRequest("请先选择工程装置后,再选择设备信息!");
}
return jgUseRegistrationMapper.queryForUnitPipelineEquipmentPage(page, jsonObject, records);
} else if ("2300".equals(jsonObject.get(EQU_CATEGORY_CODE))) {// 气瓶
List<DictionarieValueModel> fillingMedium = Systemctl.dictionarieClient.dictValues("FILLING_MEDIUM").getResult();
......@@ -3123,7 +3127,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
@Override
public List<Map<String, Object>> getUnRegisterProjectContraptionList(String useUnitCreditCode) {
return this.baseMapper.getUnRegisterProjectContraptionList(useUnitCreditCode);
public List<Map<String, Object>> getProjectContraptionList(String useUnitCreditCode) {
return this.baseMapper.getProjectContraptionList(useUnitCreditCode);
}
}
\ No newline at end of file
......@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.ImmutableMap;
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.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.enums.ReginStepEnum;
......@@ -59,6 +60,7 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -66,8 +68,8 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistrationServiceImpl.getAuditPassedDate;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
/**
* 移装变更登记登记服务实现类
......@@ -207,7 +209,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
throw new BadRequest("区内移装只能选择与设备地址中相同地市进行移装!");
}
});
} else{
} else {
deviceList.forEach(device -> {
String deviceCity = Arrays.stream(((String) device.get("USE_PLACE_CODE")).split("#"))
.skip(1)
......@@ -920,21 +922,20 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
Map<String, String> supervisoryCodeMap = this.createSupervisoryCode(historyData);
supervisoryCode = supervisoryCodeMap.get("superviseCode");
code96333 = supervisoryCodeMap.get("code96333");
useRegistrationCode.set(commonServiceImpl.generateRegistrationCode(device.getEquId(), supervisoryCode, transfer.getReceiveCompanyCode()));
useRegistrationCode.set(commonServiceImpl.generateRegistrationCode(device.getEquId(), supervisoryCode, transfer.getReceiveCompanyCode(), false));
useRegistrationCodeList.add(String.valueOf(useRegistrationCode));
isUpdateRegistrationCode.set(true);
}else{
IdxBizJgUseInfo useInfo = useInfoService.getOneData(device.getEquId());
} else {
JSONObject newPosition = JSON.parseObject(historyData.getChangeData());
String county = newPosition.getString("transferCounty").split("_")[0];
boolean shouldUpdateCode = Arrays.stream(ReginStepEnum.values())
.map(ReginStepEnum::getCode)
.anyMatch(code -> code.equals(county));
if (shouldUpdateCode){
if (shouldUpdateCode) {
Map<String, String> supervisoryCodeMap = this.createSupervisoryCode(historyData);
supervisoryCode = supervisoryCodeMap.get("superviseCode");
code96333 = supervisoryCodeMap.get("code96333");
useRegistrationCode.set(commonServiceImpl.generateRegistrationCode(device.getEquId(), supervisoryCode, transfer.getReceiveCompanyCode()));
useRegistrationCode.set(commonServiceImpl.generateRegistrationCode(device.getEquId(), supervisoryCode, transfer.getReceiveCompanyCode(), false));
useRegistrationCodeList.add(String.valueOf(useRegistrationCode));
isUpdateRegistrationCode.set(true);
}
......@@ -979,6 +980,7 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
registrationManage.setUseRegistrationCode(useRegistrationCode);
}
registrationManage.setCertificateStatus("已登记");
registrationManage.setApplyNo(transfer.getApplyNo());
});
List<JSONObject> updatedRegistrationList = registrationList.stream()
.map(registrationManage -> {
......@@ -1004,7 +1006,8 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
* @param record 设备Id
* @param newData 设备移装的新数据
*/
public void replacementHistoryData(String record, JgChangeRegistrationTransfer transfer, JgRegistrationHistory newData, String supervisoryCode, String code96333) {
public void replacementHistoryData(String record, JgChangeRegistrationTransfer transfer,
JgRegistrationHistory newData, String supervisoryCode, String code96333) {
if (!ValidationUtil.isEmpty(record) && !ValidationUtil.isEmpty(transfer.getApplyNo())) {
//查询设备旧数据
......@@ -1110,7 +1113,9 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
}
useInfo.setEquState("1");
useInfoService.saveOrUpdateData(useInfo);
otherInfo.setSupervisoryCode(supervisoryCode);
if (!StringUtils.isEmpty(supervisoryCode)) {
otherInfo.setSupervisoryCode(supervisoryCode);
}
otherInfo.setCode96333(code96333);
otherInfoService.saveOrUpdateData(otherInfo);
}
......@@ -1143,7 +1148,8 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
* @param useRegistrationCode 使用注册登记证编号
* @param isUpdateRegistrationCode 是否更新使用登记证编号
*/
public void updateRegisterInfoAndEsData(String equId, JgRegistrationHistory newData, String useRegistrationCode, String supervisoryCode, String code96333, AtomicBoolean isUpdateRegistrationCode) {
public void updateRegisterInfoAndEsData(String equId, JgRegistrationHistory newData, String useRegistrationCode,
String supervisoryCode, String code96333, AtomicBoolean isUpdateRegistrationCode) {
//更新使用注册登记证编号
if (isUpdateRegistrationCode.get()) {
idxBizJgRegisterInfoMapper.updateUseOrgCodeByEquip(equId, useRegistrationCode);
......@@ -1215,7 +1221,9 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
if (isUpdateRegistrationCode.get()) {
map1.put("EQU_STATE", "1");
map1.put("USE_ORG_CODE", useRegistrationCode);
map1.put("SUPERVISORY_CODE", supervisoryCode);
if (!StringUtils.isEmpty(supervisoryCode)) {
map1.put("SUPERVISORY_CODE", supervisoryCode);
}
map1.put("CODE96333", code96333);
}
resultMap.put(equId, map1);
......
......@@ -944,7 +944,7 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
useInfo.setUseUnitCreditCode(registration.getNewUseUnitCreditCode());
useInfoMapper.updateById(useInfo);
}
//es中的编号信息
//修改ES中使用单位信息和使用单位代码
Map<String, Map<String, Object>> resultMap = new HashMap<>();
Map<String, Object> map1 = new HashMap<>();
map1.put("USE_UNIT_CREDIT_CODE", registration.getNewUseUnitCreditCode());
......@@ -964,6 +964,7 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
List<String> ids = historyJson.stream().map(v -> JSON.parseObject(v.toString()).getString("sequenceNbr")).collect(Collectors.toList());
List<JgUseRegistrationManage> list = useRegistrationManageService.lambdaQuery().in(BaseEntity::getSequenceNbr, ids).list();
for (JgUseRegistrationManage registrationManage : list) {
//修改使用登记证管理使用单位地址、使用单位代码、接收机构、接收机构公司代码、办理日期、使用单位地址
registrationManage.setUseUnitName(registration.getNewUseUnitName());
registrationManage.setUseUnitCreditCode(registration.getNewUseUnitCreditCode());
registrationManage.setReceiveOrgName(registration.getReceiveOrgName());
......@@ -973,7 +974,6 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
TzBaseEnterpriseInfo useCodeResult = tzBaseEnterpriseInfoMapper.selectOne(new QueryWrapper<TzBaseEnterpriseInfo>().eq("use_unit_code", registration.getNewUseUnitCreditCode()));
if (useCodeResult != null) {
registrationManage.setUseUnitAddress(useCodeResult.getAddress());
registrationManage.setEquUseAddress(useCodeResult.getAddress());
}
}
}
......
......@@ -458,18 +458,6 @@ public class JgChangeVehicleRegistrationUnitServiceImpl extends BaseService<JgCh
jgCertificateChangeRecord.setEquCategory(manage.getEquCategory());
jgCertificateChangeRecord.setReceiveCompanyCode(jgChangeVehicleRegistrationUnit.getReceiveCompanyCode());
jgCertificateChangeRecord.setRoutePath(taskV2Model.getRoutePath());
// 组装设备流水
dataList.forEach(item -> {
JSONObject object = JSONObject.parseObject(JSON.toJSONString(item));
JgCertificateChangeRecordEq jgCertificateChangeRecordEq = new JgCertificateChangeRecordEq();
jgCertificateChangeRecordEq.setEquId(object.get("record").toString());
jgCertificateChangeRecordEq.setChangeRecordId(jgCertificateChangeRecord.getSequenceNbr().toString());
jgCertificateChangeRecordEq.setProductCode(object.get("factoryNum").toString());
jgCertificateChangeRecordEqs.add(jgCertificateChangeRecordEq);
});
// 保存设备流水信息
jgCertificateChangeRecordEqService.saveBatch(jgCertificateChangeRecordEqs);
List<String> collect = jgCertificateChangeRecordEqs.stream().map(JgCertificateChangeRecordEq::getEquId).collect(Collectors.toList());
if ("0".equals(jgChangeVehicleRegistrationUnit.getChangeType()) && !ObjectUtils.isEmpty(collect)) {
// 区外变更
......@@ -509,6 +497,18 @@ public class JgChangeVehicleRegistrationUnitServiceImpl extends BaseService<JgCh
// 保存证流水信息
jgCertificateChangeRecord.setUseRegistrationCode(manage.getUseRegistrationCode());
jgCertificateChangeRecordService.save(jgCertificateChangeRecord);
// 组装设备流水
dataList.forEach(item -> {
JSONObject object = JSONObject.parseObject(JSON.toJSONString(item));
JgCertificateChangeRecordEq jgCertificateChangeRecordEq = new JgCertificateChangeRecordEq();
jgCertificateChangeRecordEq.setEquId(object.get("record").toString());
jgCertificateChangeRecordEq.setChangeRecordId(jgCertificateChangeRecord.getSequenceNbr().toString());
jgCertificateChangeRecordEq.setProductCode(object.get("factoryNum").toString());
jgCertificateChangeRecordEqs.add(jgCertificateChangeRecordEq);
});
// 保存设备流水信息
jgCertificateChangeRecordEqService.saveBatch(jgCertificateChangeRecordEqs);
}
/**
......
......@@ -652,7 +652,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
placeholders.put("installType", businessType); // 施工类别
placeholders.put("installLeaderName", getValue.apply("installLeaderName"));
placeholders.put("installLeaderPhone", getValue.apply("installLeaderPhone"));
placeholders.put("fullAddress", getValue.apply("provinceName") + getValue.apply("cityName") + getValue.apply("countyName") + getValue.apply("streetName") + getValue.apply("address"));
placeholders.put("fullAddress", getValue.apply("equipProvinceName") + getValue.apply("equipCityName") + getValue.apply("equipCountyName") + getValue.apply("equipStreetName") + getValue.apply("equipAddress"));
placeholders.put("useUnitName", getValue.apply("useUnitName"));
placeholders.put("useUnitLeaderName", getValue.apply("safetyManager"));
placeholders.put("useUnitLeaderPhone", getValue.apply("safetyManagerPhone"));
......
......@@ -67,7 +67,7 @@ import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* 移装告知服务实现类
* 移装告知服务实现类
*
* @author system_generator
* @date 2023-12-19
......@@ -114,6 +114,12 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
private RedissonClient redissonClient;
@Autowired
ESEquipmentCategory esEquipmentCategory;
@Autowired
JgRegistrationHistoryServiceImpl jgRegistrationHistoryService;
@Autowired
JgTransferNoticeEqServiceImpl jgTransferNoticeEqService;
@Autowired
ESElavtorRepository esElavtorRepository;
/**
* 根据sequenceNbr查询
......@@ -450,8 +456,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
}
}
@Autowired
ESElavtorRepository esElavtorRepository;
/**
* 分页查询
......@@ -828,7 +833,6 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
// 检查实际状态是否不等于期望状态
commonService.checkExpectedStatus(jgTransferNotice.getNoticeStatus());
// 执行工作流并返回组装好的工作流信息
WorkflowResultDto workflowResultDto = getWorkflowResultDto(op, opinion, jgTransferNotice);
......@@ -848,8 +852,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
jgTransferNotice.setPromoter("");
jgTransferNotice.setHandleDate(new Date());
jgTransferNotice.setNoticeStatus(String.valueOf(FlowStatusEnum.TO_BE_FINISHED.getCode()));
//修改设备ES设备使用场所和设备详细使用地址
Map<String, Map<String, Object>> objMap = new HashMap<>();
for (JgTransferNoticeEq eq : jgTransferNoticeEqs) {
Map<String, Object> map1 = new HashMap<>();
......@@ -966,9 +969,6 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
}
}
@Autowired
JgTransferNoticeEqServiceImpl jgTransferNoticeEqService;
private void updateEq(JgTransferNotice jgTransferNotice) {
// 组装设备注册代码
String ym = null;
......@@ -990,9 +990,6 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
jgTransferNoticeEqService.updateBatchById(eqList);
}
@Autowired
JgRegistrationHistoryServiceImpl jgRegistrationHistoryService;
private void saveHisDataBeforeUpdate(JgTransferNotice jgTransferNotice, List<JgTransferNoticeEq> jgTransferNoticeEqs) {
String seq = jgTransferNotice.getSequenceNbr().toString();
JSONObject json = (JSONObject) JSONObject.toJSON(jgTransferNotice);
......
......@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationManageDto;
import com.yeejoin.amos.boot.module.jg.api.dto.UseFlagParamDto;
import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.CertificateStatusEnum;
......@@ -13,9 +14,11 @@ import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationManageMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper;
import com.yeejoin.amos.boot.module.jg.api.service.IJgChangeRegistrationTransferService;
import com.yeejoin.amos.boot.module.jg.api.service.IJgUseRegistrationManageService;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
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.enums.ApplicationFormTypeEnum;
import org.apache.lucene.queryparser.classic.QueryParser;
import org.elasticsearch.action.search.SearchRequest;
......@@ -41,6 +44,8 @@ import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import static com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistrationServiceImpl.getAuditPassedDate;
/**
* 服务实现类
*
......@@ -81,6 +86,15 @@ public class JgUseRegistrationManageServiceImpl extends BaseService<JgUseRegistr
@Autowired
private JgVehicleInformationServiceImpl jgVehicleInformationService;
@Autowired
private IJgChangeRegistrationTransferService jgChangeRegistrationTransferService;
@Autowired
private CommonServiceImpl commonService;
@Autowired
private IdxBizJgMaintenanceRecordInfoServiceImpl idxBizJgMaintenanceRecordInfoService;
/**
* 将已经通过使用登记审批的证信息录入到 jg-use-registration-manage 表中
*/
......@@ -402,12 +416,7 @@ public class JgUseRegistrationManageServiceImpl extends BaseService<JgUseRegistr
sequenceNbr = String.valueOf(vehicleInformation.getSequenceNbr());
jgVehicleInformationService.exportVehicleUseRegistrationCertificate(sequenceNbr, response, getPrintTypeCode(printType));
} else if (BusinessTypeEnum.JG_USAGE_REGISTRATION.getName().equals(regType)) {
jgUseRegistrationService.list(
new LambdaQueryWrapper<JgUseRegistration>()
.eq(JgUseRegistration::getUseRegistrationCode, useRegistrationCode)
).stream()
.max(Comparator.comparing(JgUseRegistration::getRecDate))
.ifPresent(useRegistration -> jgUseRegistrationService.exportUseRegistrationCertificate(String.valueOf(useRegistration.getSequenceNbr()), response, getPrintTypeCode(printType)));
this.exportUseRegistrationCertificate(manage, response, getPrintTypeCode(printType));
}
break;
case "exportSummaryTable":// 工业管道和气瓶 汇总表下载
......@@ -436,4 +445,107 @@ public class JgUseRegistrationManageServiceImpl extends BaseService<JgUseRegistr
}
}
public void exportUseRegistrationCertificate(JgUseRegistrationManage manage, HttpServletResponse response, String printType) {
Map<String, Object> exportParamsMap = new HashMap<>();
// 查询使用登记详情
exportParamsMap.put("manageType", manage.getManageType());
List<JSONObject> deviceList = this.queryEquByCertificateSeq(manage.getSequenceNbr());
if (ValidationUtil.isEmpty(manage) || ValidationUtil.isEmpty(deviceList)) {
throw new BadRequest("使用登记证导出失败,请稍后重试!");
}
// 登记机关
if (ValidationUtil.isEmpty(manage.getReceiveOrgName())) {
throw new BadRequest("使用登记证导出失败,登记机关为空!");
}
exportParamsMap.put("receiveOrgName", manage.getReceiveOrgName());
// 使用登记证编号
if (ValidationUtil.isEmpty(manage.getUseRegistrationCode())) {
throw new BadRequest("使用登记证导出失败,使用登记证编号为空!");
}
exportParamsMap.put("useRegistrationCode", manage.getUseRegistrationCode());
// 使用单位名称
if (ValidationUtil.isEmpty(manage.getUseUnitName())) {
throw new BadRequest("使用登记证导出失败,使用单位名称为空!");
}
exportParamsMap.put("useUnitName", manage.getUseUnitName());
// 监管码
if (ValidationUtil.isEmpty(deviceList.get(0))) {
throw new BadRequest("使用登记证导出失败,监管码为空!");
}
exportParamsMap.put("supervisoryCode", deviceList.get(0).get("SUPERVISORY_CODE"));
getAuditPassedDate(manage.getAuditPassDate(), exportParamsMap);
exportParamsMap.put("equList", manage.getEquList());
exportParamsMap.put("equCategory", manage.getEquCategory());
exportParamsMap.put("equDefine", manage.getEquDefine());
exportParamsMap.put("equCode", deviceList.get(0).get("EQU_CODE"));
exportParamsMap.put("fullAddress", manage.getEquUseAddress());
exportParamsMap.put("applyNo", manage.getApplyNo());
exportParamsMap.put("factoryNum", deviceList.get(0).get("FACTORY_NUM"));
exportParamsMap.put("useInnerCode", deviceList.get(0).get("USE_INNER_CODE"));
exportParamsMap.put("carNumber", manage.getCarNumber());
if ("0".equals(printType)) {
// 调用生成使用登记证
commonService.generateCertificateReport(exportParamsMap, response);
} else if ("1".equals(printType)) {
// 套打
commonService.generateCertificateReportDoc(exportParamsMap, response);
} else if ("2".equals(printType)) {
// 使用标志普通打印
commonService.useFlagGenerate(this.buildUseFlagParamDto(deviceList, manage, exportParamsMap), response);
} else if ("3".equals(printType)) {
// 使用标志套打
commonService.fightUseFlagGenerate(this.buildUseFlagParamDto(deviceList, manage, exportParamsMap), response);
}
}
private UseFlagParamDto buildUseFlagParamDto(List<JSONObject> deviceList, JgUseRegistrationManage manage, Map<String, Object> exportParamsMap) {
UseFlagParamDto useFlagParamDto = new UseFlagParamDto();
useFlagParamDto.setReceiveCompanyCode(manage.getReceiveCompanyCode());
useFlagParamDto.setEquList(exportParamsMap.get("equList").toString());
useFlagParamDto.setEquListCode(manage.getEquListCode());
useFlagParamDto.setEquipCode(exportParamsMap.get("equCode").toString());
useFlagParamDto.setEquipCategory(manage.getEquCategory());
useFlagParamDto.setEquipDefine(Optional.ofNullable(exportParamsMap.get("equDefine"))
.orElse(exportParamsMap.get("equCategory").toString())
.toString());
useFlagParamDto.setUseUnitName(exportParamsMap.get("useUnitName").toString());
useFlagParamDto.setUseInnerCode(exportParamsMap.get("useInnerCode").toString());
useFlagParamDto.setReceiveOrgName(manage.getReceiveOrgName());
useFlagParamDto.setUseRegistrationCode(exportParamsMap.get("useRegistrationCode").toString());
useFlagParamDto.setFactoryNumber(exportParamsMap.get("factoryNum").toString());
useFlagParamDto.setCarNumber(manage.getCarNumber());
useFlagParamDto.setApplyNo(manage.getApplyNo());
// 检验信息字段设置
setInspectField((String) deviceList.get(0).get("SEQUENCE_NBR"), useFlagParamDto);
// 电梯维保信息字段设置
setMainInfoField((String) deviceList.get(0).get("SEQUENCE_NBR"), useFlagParamDto);
// 车用气瓶专用字段 暂无数据源 需车用气瓶功能开发完成后进行
useFlagParamDto.setCylinderNumOrVolume("");
useFlagParamDto.setFillingMedium("");
return useFlagParamDto;
}
public void setInspectField(String record, UseFlagParamDto useFlagParamDto) {
Map<String, Object> inspectDetail = jgUseRegistrationMapper.getInspectDetail(record, null);
useFlagParamDto.setInspectionUnitName(inspectDetail.get("inspectOrgName") == null ? "" : inspectDetail.get("inspectOrgName").toString());
useFlagParamDto.setNextInspectionDate(inspectDetail.get("nextInspectDate") == null ? null : (Date) inspectDetail.get("nextInspectDate"));
}
public void setMainInfoField(String record, UseFlagParamDto useFlagParamDto) {
IdxBizJgMaintenanceRecordInfo idxBizJgMaintenanceRecordInfo = idxBizJgMaintenanceRecordInfoService.queryNewestDetailByRecord(record);
useFlagParamDto.setEmergencyTel(this.buildEmergencyTel(idxBizJgMaintenanceRecordInfo));
useFlagParamDto.setMaintenanceUnitName(idxBizJgMaintenanceRecordInfo.getMeUnitName() == null ? "" : idxBizJgMaintenanceRecordInfo.getMeUnitName());
}
private String buildEmergencyTel(IdxBizJgMaintenanceRecordInfo idxBizJgMaintenanceRecordInfo) {
if (StringUtil.isNotEmpty(idxBizJgMaintenanceRecordInfo.getMeMasterPhone()) && StringUtil.isNotEmpty(idxBizJgMaintenanceRecordInfo.getMeMaster1Phone())) {
return idxBizJgMaintenanceRecordInfo.getMeMasterPhone() + "/" + idxBizJgMaintenanceRecordInfo.getMeMaster1Phone();
}
return StringUtil.isNotEmpty(idxBizJgMaintenanceRecordInfo.getMeMasterPhone()) ? idxBizJgMaintenanceRecordInfo.getMeMasterPhone() : StringUtil.isNotEmpty(idxBizJgMaintenanceRecordInfo.getMeMaster1Phone()) ? idxBizJgMaintenanceRecordInfo.getMeMaster1Phone() : "";
}
}
\ No newline at end of file
......@@ -661,11 +661,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
CompanyBo company = reginParams.getCompany();
List<Map<String, Object>> equipmentLists = (List<Map<String, Object>>) map.get("equipmentLists");
if (CollectionUtils.isEmpty(equipmentLists) || equipmentLists.stream()
.map(v -> (String) v.get("equDefine"))
.distinct()
.count() != 1) {
throw new BadRequest(CollectionUtils.isEmpty(equipmentLists) ? "请选择设备信息!" : "请选择相同设备品种!");
if (CollectionUtils.isEmpty(equipmentLists)) {
throw new BadRequest( "请选择设备信息!");
}
// 提交时进行校验设备是否在流程中使用(并发及同时打开多个相同的页面时才会出现此种情况)
checkForRepeatUsedEquip(map, equipmentLists, reginParams);
......@@ -1204,7 +1201,8 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
if (!ObjectUtils.isEmpty(jgUseRegistration.getSupervisoryCode())) {
if ("unit".equals(jgUseRegistration.getManageType())) {
if ((Boolean) mapData.get("isFirstEquip")) {
String code = flag ? useRegistrationCode : commonServiceImpl.generateRegistrationCode(String.valueOf(mapData.get("equipId")), jgUseRegistration.getSupervisoryCode(), jgUseRegistration.getReceiveCompanyCode());
String code = flag ? useRegistrationCode : commonServiceImpl.generateRegistrationCode(String.valueOf(mapData.get("equipId")), jgUseRegistration.getSupervisoryCode(),
jgUseRegistration.getReceiveCompanyCode(), true);
jgUseRegistration.setUseRegistrationCode(code);
jgUseRegistration.setAuditPassDate(new Date());
registerInfo.setUseOrgCode(code);
......@@ -1224,7 +1222,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
idxBizJgRegisterInfoService.update(lambda);
}
} else {
String code = commonServiceImpl.generateRegistrationCode(String.valueOf(mapData.get("equipId")), jgUseRegistration.getSupervisoryCode(), jgUseRegistration.getReceiveCompanyCode());
String code = commonServiceImpl.generateRegistrationCode(String.valueOf(mapData.get("equipId")), jgUseRegistration.getSupervisoryCode(), jgUseRegistration.getReceiveCompanyCode(), false);
jgUseRegistration.setUseRegistrationCode(code);
jgUseRegistration.setAuditPassDate(new Date());
registerInfo.setUseOrgCode(code);
......@@ -2950,4 +2948,14 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
jgCertificateChangeRecord.setSequenceNbr(sequenceNbr);
certificateChangeRecordService.save(jgCertificateChangeRecord);
}
public Object queryByRegistrationCode(HashMap<String, Object> map) {
LambdaQueryWrapper<JgUseRegistration> queryWrapper = new LambdaQueryWrapper<JgUseRegistration>()
.eq(JgUseRegistration::getIsDelete, false)
.eq(JgUseRegistration::getUseRegistrationCode, map.get("useRegistrationCode"))
.eq(JgUseRegistration::getUseUnitCreditCode, map.get("useUnitCreditCode"))
.eq(JgUseRegistration::getIsAddEquip, "0")
.ne(JgUseRegistration::getStatus, "已作废");
return this.baseMapper.selectOne(queryWrapper);
}
}
\ No newline at end of file
......@@ -1957,7 +1957,7 @@
</w:rPr>
</w:pPr>
<#list installLicenseNoList as item>
<#list equipList.installLicenseNoList as item>
<w:r>
<w:rPr>
<w:rFonts w:hint="eastAsia" w:ascii="宋体" w:hAnsi="宋体" w:cs="宋体"/>
......@@ -2011,7 +2011,7 @@
<w:gridCol w:w="1640"/>
</w:tblGrid>
<#list installLicenseNoList as item>
<#list equipList.installLicenseNoList as item>
<w:tr>
<w:tblPrEx>
......@@ -2332,7 +2332,7 @@
</w:rPr>
</w:pPr>
<#list installLicenseExpirationDateList as item1>
<#list equipList.installLicenseExpirationDateList as item1>
<w:r>
<w:rPr>
<w:rFonts w:hint="eastAsia" w:ascii="宋体" w:hAnsi="宋体" w:cs="宋体"/>
......
package com.yeejoin.amos.boot.module.jyjc.api.dto;
import lombok.Data;
/**
* 检验机构公示
*
* @author Administrator
*/
@Data
public class InspectionCompanyPublicityDto {
/**
* 单位名称
*/
private String unitName;
/**
* 单位编码
*/
private String unitCode;
/**
* 核准信息:核准证号、核准证有限期
*/
private String approvalInfo;
/**
* 开通区域
*/
private String detectionRegion;
/**
* 业务有效期
*/
private String expiryDate;
/**
* 法人
*/
private String legalPerson;
/**
* 联系人
*/
private String useContact;
/**
* 联系人电话
*/
private String contactPhone;
/**
* 检验及检测人员数量
*/
private Long personNum;
/**
* 开通业务类型
*/
private String openBizType;
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jyjc.api.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.jyjc.api.dto.InspectionCompanyPublicityDto;
import com.yeejoin.amos.boot.module.jyjc.api.dto.PublicityInspectOrgInfoDto;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcOpeningApplicationModel;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcOpeningApplication;
......@@ -36,4 +37,6 @@ public interface JyjcOpeningApplicationMapper extends BaseMapper<JyjcOpeningAppl
* @return List<PublicityInspectOrgInfoDto>
*/
List<PublicityInspectOrgInfoDto> queryInspectionOrgListForPublicity(@Param("orgCode") String orgCode, @Param("dto") DPFilterParamDto dpFilterParamDto);
List<InspectionCompanyPublicityDto> queryInspectionOrgListForBiz();
}
......@@ -83,4 +83,41 @@
and ((b.supervise_org_code != '50' and b.supervise_org_code LIKE CONCAT (#{orgCode}, '%')) or (b.supervise_org_code = '50' and b.office_region LIKE CONCAT ('%', #{dto.cityCode}, '%')))
ORDER BY unitName
</select>
<select id="queryInspectionOrgListForBiz" resultType="com.yeejoin.amos.boot.module.jyjc.api.dto.InspectionCompanyPublicityDto">
select
ei.sequence_nbr,
ei.use_unit as unitName,
oa.unit_code,
oa.detection_region,
oa.expiry_date,
ei.legal_person,
ei.use_contact,
ei.contact_phone,
(select count(1) from tzs_user_info u where u.unit_code = ei.use_unit_code and u.is_delete = false) as personNum,
(
select
group_concat(concat(a.cert_no,'#',a.expiry_date)) cert_no
from
(
SELECT
cert_no,
min(expiry_date) as expiry_date
FROM
"tz_base_unit_licence"
where
unit_code= ei.use_unit_code
and cert_type_code like '1233%'
and expiry_date >= CURRENT_DATE
AND (case when cert_type_code = '1233-1' then 'jy' else 'jc' end) = oa.open_biz_type
GROUP BY cert_no,cert_type_code
) a
) as approvalInfo,
oa.open_biz_type
from
tz_jyjc_opening_application oa,
tz_base_enterprise_info ei
where
oa.unit_code = ei.use_unit_code
and oa.status = 6616
</select>
</mapper>
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jyjc.api.dto.InspectionCompanyPublicityDto;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcOpeningApplication;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcOpeningApplicationModel;
import com.yeejoin.amos.boot.module.jyjc.api.model.JyjcOpeningApplicationRequstDto;
......@@ -284,4 +285,11 @@ public class JyjcOpeningApplicationController extends BaseController {
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "检验检测机构公示", notes = "检验检测机构公示")
@PostMapping(value = "/inspectionOrgList/publicity")
public ResponseModel<List<InspectionCompanyPublicityDto>> inspectionOrgListForPublicity() {
return ResponseHelper.buildResponse(jyjcOpeningApplicationServiceImpl.queryInspectionOrgListForBiz());
}
}
......@@ -17,6 +17,7 @@ import com.yeejoin.amos.boot.biz.common.dao.mapper.DataDictionaryMapper;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.jyjc.api.dto.InspectionCompanyPublicityDto;
import com.yeejoin.amos.boot.module.jyjc.api.entity.JyjcOpeningApplication;
import com.yeejoin.amos.boot.module.jyjc.api.enums.BizTypeEnum;
import com.yeejoin.amos.boot.module.jyjc.api.enums.BusinessTypeEnum;
......@@ -967,4 +968,30 @@ public class JyjcOpeningApplicationServiceImpl extends BaseService<JyjcOpeningAp
commonService.saveExecuteFlowData2Redis(inspectionApplication.getWorkflowProstanceId(), this.buildInstanceRuntimeData(inspectionApplication));
});
}
public List<InspectionCompanyPublicityDto> queryInspectionOrgListForBiz() {
// 查询所有已经业务开通的检验检测机构,已机构为维度进行证的合并处理
List<InspectionCompanyPublicityDto> inspectionCompanyPublicityDtos = this.getBaseMapper().queryInspectionOrgListForBiz();
// 枚举转换
inspectionCompanyPublicityDtos.forEach(c->{
c.setDetectionRegion(this.castRegionCode2Name(c.getDetectionRegion()));
c.setApprovalInfo(this.breakNewLineForApprovalInfo(c.getApprovalInfo()));
c.setOpenBizType(this.castOpenBizTypeCode2Name(c.getOpenBizType()));
});
return inspectionCompanyPublicityDtos;
}
private String castRegionCode2Name(String detectionRegion) {
return "";
}
private String breakNewLineForApprovalInfo(String approvalInfo) {
String[] approvalArray = approvalInfo.split("#");
StringBuilder stringBuilder = new StringBuilder();
return "";
}
private String castOpenBizTypeCode2Name(String openBizType) {
return OpenBizTypeEnum.getOneByCode(openBizType).getName();
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.statistics.api.dto;
import lombok.Data;
/**
* @author Administrator
*/
@Data
public class SecurityIndexCountItemDto {
private String regionCode;
private String regionName;
/**
* 充装检查率
*/
private String czjc;
/**
* 许可有效率
*/
String xuke;
/**
* 使用登记办理率
*/
String shiyongdengji;
/**
* 检验超期率
*/
String jianyanchaoqi;
/**
* 检验合格率
*/
String jianyanhege;
/**
* 充装检查率
*/
String czjchege;
}
package com.yeejoin.amos.boot.module.statistics.api.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Getter
@AllArgsConstructor
public enum DPStatusEnum {
EQUIP_STATUS_USE("equipUse", "在用","在用", "", "success"),
EQUIP_STATUS_STOP("equipStop", "停用","停用", "", "error"),
EQUIP_STATUS_LOGOUT("equipLogout", "注销","注销", "", "error"),
EQUIP_STATUS_SCRAP("equipScrap", "报废","报废", "", "error"),
EQUIP_EMPHASIS_MONITOR("equipEmphasis", "重点监控设备","重点监控设备", "", "success"),
USE_YEAR_GT_15("gt15", ">15年","使用年限大于15年", "", "error"),
// 单位类型
COMPANY_SY("sy", "使用单位","使用单位", "", "success"),
COMPANY_CZ("cz", "充装单位","充装单位", "", "success"),
COMPANY_JYJC("jyjc", "检验检测机构","检验检测机构", "", "success"),
COMPANY_ZZ("zz", "制造单位","制造单位", "", "success"),
COMPANY_SJ("sj", "设计单位","设计单位", "", "success"),
COMPANY_AZGZWX("azgzwx", "安装改造维修单位","安装改造维修单位", "", "success"),
MANAGE_STATUS_USE("manageUse", "在业","在业", "", "success"),
MANAGE_STATUS_OPEN("manageOpen", "在业","开业", "", "success"),
MANAGE_STATUS_STOP("manageStop", "停业","停业", "", "error"),
COMPANY_EMPHASIS_MONITOR("emphasisMonitorCompany", "重点监控企业","重点监控企业", "", "success"),
COMPANY_HIGH_RISK("highRisk", "高风险企业","高风险企业", "", "stop");
private String key;
private String label;
private String status;
private String icon;
private String value;
public static DPStatusEnum getEnumByStatus(String status) {
for (DPStatusEnum c : DPStatusEnum.values()) {
if (c.getStatus().equals(status)){
return c;
}
}
return null;
}
public static Map toMap(DPStatusEnum dpStatusEnum) {
Map map = new HashMap<>();
map.put("key", dpStatusEnum.getKey());
map.put("label", dpStatusEnum.getLabel());
map.put("status", dpStatusEnum.getStatus());
map.put("icon", dpStatusEnum.getIcon());
map.put("value", dpStatusEnum.getValue());
return map;
}
}
......@@ -46,10 +46,10 @@ public interface AQZSDPStatisticsMapper {
/**
* 单位按照资质状态分组下的统计数量
*
* @param regionCode 区域
* @param orgCode 区域
* @return List<KeyValueDto>
*/
List<KeyValueDto> queryLicenseEfficiencyOfRegion(@Param(value = "regionCode") String regionCode);
List<KeyValueDto> queryLicenseEfficiencyOfRegion(@Param(value = "orgCode") String orgCode);
/**
* 查询单个单位的有效期信息
*
......@@ -58,8 +58,9 @@ public interface AQZSDPStatisticsMapper {
*/
KeyValueDto queryLicenseEfficiencyOneCompany(@Param(value = "appId") String appId);
Map<String, Object> getInspectionExpiredRate(@Param(value = "regionCode") String regionCode, @Param(value = "appId") String appId);
Map<String, Object> getInspectionExpiredRate(@Param(value = "orgCode") String orgCode, @Param(value = "appId") String appId);
Map<String, Object> getInspectionResultRate(@Param(value = "regionCode") String regionCode, @Param(value = "appId") String appId);
Map<String, Object> getInspectionResultRate(@Param(value = "orgCode") String orgCode, @Param(value = "appId") String appId);
List<Map<String, Object>> selectByOrg(String orgCode);
}
......@@ -13,4 +13,18 @@ import org.apache.ibatis.annotations.Param;
public interface CylinderStatisticsMapper {
Long countEnterpriseNumForCylinder(@Param("orgCode") String orgCode);
/**
* 按照管辖维度,统计充装单位使用登记证的办理率
* @param orgCode 区域对应的单位orgCode
* @return 办理率*100
*/
String queryUserRegisterCertAppPercent(@Param("orgCode") String orgCode);
/**
* 统计气瓶的办证数量
* @param orgCode 区域对应的公司的orgCode
* @return 办证数量
*/
Long countForCylinderCertNum(String orgCode);
}
package com.yeejoin.amos.boot.module.statistics.api.mapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
* Mapper 接口
*
* @author system_generator
* @date 2023-12-13
*/
@Mapper
public interface DPSubBizMapper {
List<Map<String, String>> equOnJgServiceOperationRecords(String record);
List<Map<String, String>> queryForSafetyProblemTracingList(String sourceId);
}
......@@ -246,8 +246,8 @@
<where>
cu.data_sources = '陕西省内企业'
AND cu.unit_type LIKE '%充装单位%'
<if test="regionCode != null and regionCode != ''">
and cu.org_code like concat(#{regionCode}, '%')
<if test="orgCode != null and orgCode != ''">
and cu.supervise_org_code like concat(#{orgCode}, '%')
</if>
<if test="appId != null and appId != ''">
and cu.app_id = #{appId}
......@@ -264,8 +264,8 @@
<where>
cu.data_sources = '陕西省内企业'
AND cu.unit_type LIKE '%充装单位%'
<if test="regionCode != null and regionCode != ''">
and cu.org_code like concat( #{regionCode}, '%')
<if test="orgCode != null and orgCode != ''">
and cu.supervise_org_code like concat( #{orgCode}, '%')
</if>
<if test="appId != null and appId != ''">
and cu.app_id = #{appId}
......@@ -303,9 +303,21 @@
where
cu.data_sources = '陕西省内企业'
AND cu.unit_type LIKE '%充装单位%'
and cu.org_code like concat('%', #{regionCode}, '%')
and cu.supervise_org_code like concat(#{orgCode}, '%')
GROUP BY strKey
</select>
<select id="selectByOrg" resultType="java.util.Map">
SELECT COUNT
( 1 ),
source_type AS sourceType
FROM
tzs_safety_problem_tracing
WHERE
governing_body_org_code LIKE concat ( #{orgCode}, '%' )
GROUP BY
source_type
</select>
</mapper>
......@@ -10,4 +10,37 @@
unit_type LIKE'%充装单位%'
and supervise_org_code like concat(#{orgCode},'%')
</select>
<select id="queryUserRegisterCertAppPercent" resultType="java.lang.String">
select
case when s2.total= 0 then 0 else round(s1.num/s2.total * 100, 2) end as percent
from
(SELECT
count(DISTINCT(a.use_unit_credit_code)) as num
FROM
"tzs_jg_use_registration_manage" a,
privilege_company c
where
a.receive_company_code = c.company_code
and a.certificate_status='已登记'
and c.org_code like concat(#{orgCode},'%')) s1,
(SELECT
count(1) as total
FROM "tz_base_enterprise_info"
where
unit_type LIKE'%充装单位%'
and supervise_org_code like concat(#{orgCode},'%')
) s2
</select>
<select id="countForCylinderCertNum" resultType="java.lang.Long">
SELECT
count(DISTINCT(a.use_unit_credit_code)) as num
FROM
"tzs_jg_use_registration_manage" a,
privilege_company c
where
a.receive_company_code = c.company_code
and a.certificate_status='已登记'
and a.equ_list_code='2000'
and c.org_code like concat(#{orgCode},'%')
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.statistics.api.mapper.DPSubBizMapper">
<select id="equOnJgServiceOperationRecords" resultType="java.util.Map">
select
sequence_nbr as sequenceNbr,
business_type as businessType,
apply_no as applyNo,
rec_User_Id as recUserId,
rec_user_name as recUserName,
DATE_FORMAT(rec_date,'%Y-%m-%d %H:%i:%s') as recDate,
approval_unit as approvalUnit,
status,
route_path as routePath
from tzs_jg_resume_info
where equ_id = #{record}
order by rec_date ASC
</select>
<select id="queryForSafetyProblemTracingList" resultType="java.util.Map">
select
spt.*,
(select extend::json->>'pic' from cb_data_dictionary where type = 'ISSUE_TYPE' and code = spt.problem_type_code) problemTypePic
from tzs_safety_problem_tracing spt
<where>
spt.is_delete = false
<if test="sourceId != null and sourceId != ''">
and spt.source_id = #{sourceId}
</if>
</where>
order by spt.create_date desc
</select>
</mapper>
......@@ -20,7 +20,7 @@ import java.util.List;
import java.util.Map;
@RestController
@Api(tags = "大屏-安全追溯统计Api")
@Api(tags = "大屏-安全追溯及气瓶统计Api")
@RequestMapping(value = "/dp/aqzs")
public class AQZSDPStatisticsController {
......@@ -30,42 +30,34 @@ public class AQZSDPStatisticsController {
this.statisticsService = statisticsService;
}
/**
* 预警预报统计
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/earlyWarning/child", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "预警预报")
public ResponseModel<Map<String, Object>> getChildEarlyWarning(@RequestBody Map<String, Object> map) throws Exception {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
}
return ResponseHelper.buildResponse(statisticsService.getChildEarlyWarning(regionCode.toString()));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "区域安全指数")
@ApiOperation(value = "大屏-气瓶-区域安全指数")
@PostMapping(value = "/security-index")
public ResponseModel<Map<String, Object>> getsecurityIndex(@RequestBody Map<String, Object> map) throws Exception {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
public ResponseModel<Map<String, Object>> getSecurityIndex(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult bindingResult) throws Exception {
List<FieldError> fieldErrors = bindingResult.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
Map<String, Object> result = statisticsService.getsecurityIndex(regionCode.toString());
Map<String, Object> result = statisticsService.getSecurityIndex(dpFilterParamDto);
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏-气瓶-区域安全指数统计")
@RequestMapping(value = "/earlyWarning/child", method = RequestMethod.POST)
public ResponseModel<Map<String, Object>> getChildEarlyWarning(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult bindingResult) throws Exception {
List<FieldError> fieldErrors = bindingResult.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.getChildEarlyWarning(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-左屏-问题类型主体统计")
@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) {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
......@@ -78,7 +70,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-左屏-设备问题近30天统计")
@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) {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
......@@ -91,7 +83,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-左屏-企业问题近30天统计")
@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) {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
......@@ -104,7 +96,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-左屏-人员问题近30天统计")
@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) {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
......@@ -118,7 +110,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-左屏-气瓶问题近30天统计")
@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) {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
......@@ -131,7 +123,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-右屏-按月统计近12个月的问题数量趋势")
@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) {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
......@@ -144,7 +136,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-右屏-按月统计近30天的问题数量趋势")
@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) {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
......@@ -155,8 +147,8 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-中屏-当前区域数据统计")
@PostMapping(value = "/issueCountByCityCode")
public ResponseModel<Map<String, Object>> issueCountByCityCode(@RequestBody Map<String, Object> map) throws Exception {
@PostMapping(value = "/issueCountByCityCodeOld")
public ResponseModel<Map<String, Object>> issueCountByCityCode(@RequestBody Map<String, Object> map) {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
......@@ -168,7 +160,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-中屏-当前区域子区域数据统计")
@PostMapping(value = "/issueChildrenCityCount")
@PostMapping(value = "/issueChildrenCityCountOld")
public ResponseModel<List<Map<String, Object>>> issueChildrenCityCount(@RequestBody Map<String, Object> map) throws Exception {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
......@@ -182,7 +174,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-左屏-当月问题列表(主体类型、问题类型、问题时间、操作)")
@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) {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
......@@ -194,7 +186,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-右屏-当年问题等级分类统计")
@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) {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
......@@ -206,7 +198,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-右屏-按问题类型排名top 10")
@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) {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
......@@ -241,7 +233,7 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-右屏-按问题类型排名top 10")
@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) {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
......@@ -249,4 +241,26 @@ public class AQZSDPStatisticsController {
List<Map<String, Object>> result = statisticsService.issueCountTopByProblemType(regionCode.toString());
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏-中间地图左右两侧8大类、单位、人员数量、问题数量全局统计", notes = "大屏中间-地图左右两侧8大类、单位、人员数量、问题数量全局统计")
@PostMapping(value = "/issueCountByCityCode")
public ResponseModel<Map<String, Object>> centerMapCountForGlobal(@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.getCenterMapCountDataForGlobal(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "安全追溯大屏-中间地图地市统计", notes = "安全追溯大屏中间-地图地市统计")
@PostMapping(value = "/issueChildrenCityCount")
public ResponseModel<List<Map<String, Object>>> centerMapCountForOverview(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) throws Exception {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.getCenterMapCountDataForOverview(dpFilterParamDto));
}
}
package com.yeejoin.amos.boot.module.statistcs.biz.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.DPSubServiceImpl;
import io.swagger.annotations.Api;
......@@ -38,17 +39,28 @@ public class DPSubController {
public ResponseModel<JSONObject> commonQuery(@PathVariable String template, @RequestBody Map<String, Object> param) {
if (template.equals("company")) {
Assert.notNull(param.get("useUnitCode"), "企业统一信用代码不能为空");
} else if (template.equals("equip")) {
} else if (template.equals("emergency")){
Assert.notNull(param.get("id"), "id不能为空");
}else if(template.equals("equip")) {
param.put("record", param.get("SEQUENCE_NBR"));
param.put("equList", param.get("EQU_LIST_CODE"));
Assert.notNull(param.get("record"), "设备ID不能为空");
Assert.notNull(param.get("equList"), "设备种类不能为空");
template = template + "_" + param.get("equList");
} else {
} else if (template.equals("issue")){
Assert.notNull(param.get("sequenceNbr"), "sequenceNbr不能为空");
}else {
throw new RuntimeException("暂无模板");
}
return ResponseHelper.buildResponse(subService.commonQuery(template, param));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "tab返回单个详情数据", notes = "tab返回单个详情数据")
@PostMapping(value = "/tab/aloneApi")
public ResponseModel<Object> aloneApi(@RequestBody Map map) {
return ResponseHelper.buildResponse(subService.aloneApi(JSONObject.parseObject(JSON.toJSONString(map))));
}
}
......@@ -228,7 +228,7 @@ public class JGDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏监管-中屏-各地市数据统计", notes = "大屏监管-中屏-各地市数据统计")
@PostMapping(value = "/centre/dataStatistic")
@PostMapping(value = "/centre/dataStatisticOld")
public ResponseModel<List<Map<String, Object>>> dataStatisticByReginCode(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
......@@ -239,7 +239,7 @@ public class JGDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏监管-中屏-当前区域数据统计", notes = "大屏监管-中屏-当前区域数据统计")
@PostMapping(value = "/centre/dataStatisticCount")
@PostMapping(value = "/centre/dataStatisticCountOld")
public ResponseModel<Map<String, Object>> dataStatisticCountByReginCode(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
......@@ -247,4 +247,25 @@ public class JGDPStatisticsController {
}
return ResponseHelper.buildResponse(statisticsService.dataStatisticCountByReginCode(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "监管大屏-中间地图左右两侧8大类、单位、人员数量全局统计", notes = "大屏总览中间-地图左右两侧8大类、单位、人员数量全局统计")
@PostMapping(value = "/centre/dataStatistic")
public ResponseModel<Map<String, Object>> JGCenterMapCountForGlobal(@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.JGCenterMapCountForGlobal(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "监管大屏-中间地图地市统计", notes = "大屏总览中间-地图地市统计")
@PostMapping(value = "/centre/dataStatisticCount")
public ResponseModel<List<Map<String, Object>>> JGCenterMapCountForOverview(@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.JGCenterMapCountForOverview(dpFilterParamDto));
}
}
package com.yeejoin.amos.boot.module.statistcs.biz.init;
import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.AQZSDPStatisticsServiceImpl;
import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.JGDPStatisticsServiceImpl;
import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.StCommonServiceImpl;
import com.yeejoin.amos.component.robot.AmosRequestContext;
......@@ -16,14 +17,17 @@ public class DataInitAfterRuning implements ApplicationRunner {
private JGDPStatisticsServiceImpl jgdpStatisticsService;
private AQZSDPStatisticsServiceImpl aqzsdpStatisticsService;
private StCommonServiceImpl stCommonService;
private AmosRequestContext amosRequestContext;
public DataInitAfterRuning(JGDPStatisticsServiceImpl jgdpStatisticsService, StCommonServiceImpl stCommonService, AmosRequestContext amosRequestContext) {
public DataInitAfterRuning(JGDPStatisticsServiceImpl jgdpStatisticsService, StCommonServiceImpl stCommonService, AmosRequestContext amosRequestContext, AQZSDPStatisticsServiceImpl aqzsdpStatisticsService) {
this.jgdpStatisticsService = jgdpStatisticsService;
this.stCommonService = stCommonService;
this.amosRequestContext = amosRequestContext;
this.aqzsdpStatisticsService = aqzsdpStatisticsService;
}
@Override
......@@ -34,5 +38,6 @@ public class DataInitAfterRuning implements ApplicationRunner {
RequestContext.setToken(amosRequestContext.getToken());
jgdpStatisticsService.init();
stCommonService.init();
aqzsdpStatisticsService.init();
}
}
package com.yeejoin.amos.boot.module.statistcs.biz.service.impl;
import cn.hutool.core.date.DateUtil;
import com.yeejoin.amos.boot.biz.common.dto.CountDto;
import com.yeejoin.amos.boot.biz.common.dto.KeyValueDto;
import com.yeejoin.amos.boot.module.common.api.constant.TZSCommonConstant;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.common.api.enums.IssueMainBodyEnum;
import com.yeejoin.amos.boot.module.common.api.enums.IssueTypeEnum;
import com.yeejoin.amos.boot.module.common.api.enums.ReginStepEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.DPMapStatisticsItemEnum;
import com.yeejoin.amos.boot.module.statistics.api.dto.EquipQuestionNumCountDto;
import com.yeejoin.amos.boot.module.statistics.api.dto.SecurityIndexCountItemDto;
import com.yeejoin.amos.boot.module.statistics.api.mapper.AQZSDPStatisticsMapper;
import com.yeejoin.amos.boot.module.statistics.api.mapper.CylinderStatisticsMapper;
import com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.service.ITzBaseEnterpriseInfoService;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipTechParamPipelineMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzsUserInfoMapper;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import joptsimple.internal.Strings;
import org.apache.commons.lang3.StringUtils;
import org.apache.lucene.queryparser.classic.QueryParser;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.client.core.CountRequest;
import org.elasticsearch.client.core.CountResponse;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.springframework.beans.factory.annotation.Autowired;
import org.elasticsearch.search.aggregations.AggregationBuilders;
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import javax.annotation.Resource;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
......@@ -37,8 +45,9 @@ import java.text.NumberFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
......@@ -54,18 +63,102 @@ public class AQZSDPStatisticsServiceImpl {
private final static String NO_DATA_STR = "--";
@Autowired
RestHighLevelClient restHighLevelClient;
/**
* 压力容器设备种类
*/
private final static String EQU_LIST_CYLINDER = "2000";
/**
* 气瓶设备类别
*/
private final static String EQU_CATEGORY_CYLINDER = "2300";
/**
* 单位类型-使用单位
*/
private final static String COMPANY_TYPE_USE = "使用单位";
/**
* 单位类型-安装改造维修单位
*/
private final static String COMPANY_TYPE_MAINTENANCE = "安装改造维修单位";
/**
* 单位类型-制造单位
*/
private final static String COMPANY_TYPE_MANUFACTURE = "制造单位";
/**
* 单位类型-充装单位
*/
private final static String COMPANY_TYPE_FILLING = "充装单位";
private static List<EquipmentCategoryDto> equipmentCategoryDtos;
private static List<RegionModel> regionModels = new ArrayList<>();
private RestHighLevelClient restHighLevelClient;
private static Map<String, String> regionCodeOrgCodeMap = new ConcurrentHashMap<>();
@Resource
private AQZSDPStatisticsMapper statisticsMapper;
private String getLicenseEfficiencyByRegion(String regionCode) {
List<KeyValueDto> keyValueDtos = statisticsMapper.queryLicenseEfficiencyOfRegion(regionCode);
private EquipmentCategoryMapper equipmentCategoryMapper;
private EquipTechParamPipelineMapper techParamsPipelineMapper;
private TzBaseEnterpriseInfoMapper enterpriseInfoMapper;
private TzsUserInfoMapper userInfoMapper;
private CylinderStatisticsMapper cylinderStatisticsMapper;
private StCommonServiceImpl stCommonService;
public void init() {
// 数据不变所以放到内存,提高响应时间
equipmentCategoryDtos = equipmentCategoryMapper.selectClassify();
initReginCode();
}
private void initReginCode() {
Collection<RegionModel> result = Systemctl.regionClient.queryForTree(null).getResult();
result.forEach(r -> {
regionModels.add(r);
this.loopSetChildRegin(regionModels, r.getChildren());
});
}
private void loopSetChildRegin(List<RegionModel> regionModels, Collection<RegionModel> children) {
if (children != null && children.size() > 0) {
children.forEach(c -> {
regionModels.add(c);
this.loopSetChildRegin(regionModels, c.getChildren());
});
}
}
public AQZSDPStatisticsServiceImpl(RestHighLevelClient restHighLevelClient, AQZSDPStatisticsMapper statisticsMapper, EquipmentCategoryMapper equipmentCategoryMapper, EquipTechParamPipelineMapper techParamsPipelineMapper, TzBaseEnterpriseInfoMapper enterpriseInfoMapper, TzsUserInfoMapper userInfoMapper, CylinderStatisticsMapper cylinderStatisticsMapper, StCommonServiceImpl stCommonService) {
this.restHighLevelClient = restHighLevelClient;
this.statisticsMapper = statisticsMapper;
this.equipmentCategoryMapper = equipmentCategoryMapper;
this.techParamsPipelineMapper = techParamsPipelineMapper;
this.enterpriseInfoMapper = enterpriseInfoMapper;
this.userInfoMapper = userInfoMapper;
this.cylinderStatisticsMapper = cylinderStatisticsMapper;
this.stCommonService = stCommonService;
}
private String getLicenseEfficiencyByRegion(String orgCode) {
List<KeyValueDto> keyValueDtos = statisticsMapper.queryLicenseEfficiencyOfRegion(orgCode);
int totalUnitNumber = keyValueDtos.stream().mapToInt(KeyValueDto::getIValue).sum();
int okUnitNumberNumber = keyValueDtos.stream().filter(k -> k.getStrKey().equals(LICENSE_IS_OK)).mapToInt(KeyValueDto::getIValue).sum();
if (totalUnitNumber == 0) {
......@@ -79,7 +172,6 @@ public class AQZSDPStatisticsServiceImpl {
private long searchEsCount(Boolean checkOk, Boolean resultOk, String regionCode, String appId) {
CountRequest countRequest = new CountRequest("cylinder_filling");
// countRequest.indices("cylinder_filling");
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
if (checkOk) {
//匹配充装前检查和充装后检查都有数据
......@@ -118,82 +210,28 @@ public class AQZSDPStatisticsServiceImpl {
}
}
public Map<String, Object> getChildEarlyWarning(String regionCode) throws Exception {
List<RegionModel> regionModels = this.setRegionIfRootParent(regionCode);
List<String> collect = regionModels.stream().map(c -> c.getRegionCode().toString()).collect(Collectors.toList());
List<CompanyModel> companyModelList = Privilege.companyClient.queryListByCompanyCode(Strings.join(collect, ",")).getResult();
Map<String, CompanyModel> companyMap = companyModelList.stream().collect(Collectors.toMap(CompanyModel::getCompanyCode, c -> c));
Set<String> legendData = new HashSet<>();
List<String> xdata = new ArrayList<>();
public Map<String, Object> getChildEarlyWarning(DPFilterParamDto dpFilterParamDto) throws Exception {
List<RegionModel> regionModels = stCommonService.setRegionIfRootParent(dpFilterParamDto.getCityCode());
Map<String, SecurityIndexCountItemDto> regionCodeSecurityIndexMap = getSecurityIndexCountItemDtoMap(regionModels);
Set<String> legendData = getLegendForCyArea();
List<String> xuke = new ArrayList<>();
List<String> shiyongdengji = new ArrayList<>();
List<String> jianyanchaoqi = new ArrayList<>();
List<String> jianyanhege = new ArrayList<>();
List<String> czjc = new ArrayList<>();
List<String> czjchege = new ArrayList<>();
// List<String> renyuan = new ArrayList<>();
legendData.add("许可有效率");
legendData.add("使用登记办理率");
legendData.add("检验超期率");
legendData.add("检验合格率");
legendData.add("充装检查率");
legendData.add("充装检查合格率");
for (RegionModel region : regionModels) {
CompanyModel companyModel = companyMap.get(region.getRegionCode().toString());
if (ObjectUtils.isEmpty(companyModel)) {
continue;
}
// 是否有充装企业在指定区域下
Boolean isHavingUnitInRegion = true;
String orgCode = companyModel.getOrgCode();
xdata.add(region.getRegionName());
// 1.许可有效率
if (!ValidationUtil.isEmpty(companyModel)) {
String value = this.getLicenseEfficiencyByRegion(orgCode);
if (NO_DATA_STR.equals(value)) {
xuke.add("0");
} else {
xuke.add(String.format("%.4f", Double.parseDouble(value) / 100.0000));
}
}
if (!ValidationUtil.isEmpty(orgCode) && !isHavingUnitInRegion) {
shiyongdengji.add("0");
jianyanchaoqi.add("0");
jianyanhege.add("0");
shiyongdengji.add("0");
czjc.add("0");
czjchege.add("0");
continue;
}
// 2.使用登记办理率
shiyongdengji.add("1");
// 3.检验超期率
jianyanchaoqi.add(String.format("%.4f", Double.parseDouble(statisticsMapper.getInspectionExpiredRate(orgCode, null).get("expiredRate").toString()) / 100.0000));
// 4.检验合格率
jianyanhege.add(String.format("%.4f", Double.parseDouble(statisticsMapper.getInspectionResultRate(orgCode, null).get("resultRate").toString()) / 100.0000));
// 5.充装检查率
long totalAll = searchEsCount(false, false, orgCode, null);
long totalCheck = searchEsCount(true, false, orgCode, null);
long totalResult = searchEsCount(false, true, orgCode, null);
if (totalAll != 0) {
czjc.add(new DecimalFormat("#.0000").format(((double) totalCheck / totalAll)));
} else {
czjc.add("0");
}
// 6.充装检查合格率
if (totalAll != 0) {
czjchege.add(new DecimalFormat("#.0000").format(((double) totalResult / totalAll)));
} else {
czjchege.add("0");
}
}
//TODO 多线程处理后,regionCodeSecurityIndexMap顺序与regionModels的顺序不一致,需让数据和x轴的顺序保存一致
List<String> xdata = stCommonService.buildXData(regionModels);
regionModels.forEach(r -> {
SecurityIndexCountItemDto countItemDto = regionCodeSecurityIndexMap.get(r.getRegionCode().toString());
xuke.add(countItemDto.getXuke());
shiyongdengji.add(countItemDto.getShiyongdengji());
jianyanchaoqi.add(countItemDto.getJianyanchaoqi());
jianyanhege.add(countItemDto.getJianyanhege());
czjc.add(countItemDto.getCzjc());
czjchege.add(countItemDto.getCzjchege());
});
Map<String, Object> result = new HashMap<>();
result.put("xdata", xdata);
result.put("legendData", legendData);
result.put("xuke", xuke);
......@@ -202,117 +240,45 @@ public class AQZSDPStatisticsServiceImpl {
result.put("jianyanhege", jianyanhege);
result.put("czjc", czjc);
result.put("czjchege", czjchege);
return result;
}
private List<RegionModel> setRegionIfRootParent(String regionCode) throws Exception {
List<RegionModel> regionList = Systemctl.regionClient.queryByParentRegionCode(Integer.parseInt(regionCode)).getResult();
// 陕西省时需要在地图返回独立的地级市:韩城、杨凌、西咸
if (regionCode.equals(TZSCommonConstant.SHAN_XI_REGION_CODE)) {
List<RegionModel> independentRegions = ReginStepEnum.enum2RegionList("map");
regionList.addAll(independentRegions);
}
return regionList;
private Set<String> getLegendForCyArea() {
Set<String> legendData = new HashSet<>();
legendData.add("许可有效率");
legendData.add("使用登记办理率");
legendData.add("检验超期率");
legendData.add("检验合格率");
legendData.add("充装检查率");
legendData.add("充装检查合格率");
return legendData;
}
public Map<String, Object> getsecurityIndex(String regionCode) throws Exception {
List<RegionModel> regionModels = this.setRegionIfRootParent(regionCode);
List<String> collect = regionModels.stream().map(c -> c.getRegionCode().toString()).collect(Collectors.toList());
List<CompanyModel> companyModelList = Privilege.companyClient.queryListByCompanyCode(Strings.join(collect, ",")).getResult();
Map<String, CompanyModel> companyMap = companyModelList.stream().collect(Collectors.toMap(CompanyModel::getCompanyCode, c -> c));
List<String> xdata = new ArrayList<>();
List<String> xuke = new ArrayList<>();
List<String> shiyongdengji = new ArrayList<>();
List<String> jianyanchaoqi = new ArrayList<>();
List<String> jianyanhege = new ArrayList<>();
List<String> czjc = new ArrayList<>();
List<String> czjchege = new ArrayList<>();
for (RegionModel region : regionModels) {
CompanyModel companyModel = companyMap.get(region.getRegionCode().toString());
if (ObjectUtils.isEmpty(companyModel)) {
continue;
}
// 是否有充装企业在指定区域下
Boolean isHavingUnitInRegion = true;
String orgCode = companyModel.getOrgCode();
xdata.add(region.getRegionName());
// 1.许可有效率
if (!ValidationUtil.isEmpty(companyModel)) {
String value = this.getLicenseEfficiencyByRegion(orgCode);
if (NO_DATA_STR.equals(value)) {
value = "0";
xuke.add(value);
} else {
xuke.add(value);
}
}
if (!ValidationUtil.isEmpty(orgCode) && !isHavingUnitInRegion) {
shiyongdengji.add("0");
jianyanchaoqi.add("0");
jianyanhege.add("0");
shiyongdengji.add("0");
czjc.add("0");
czjchege.add("0");
continue;
}
// 2.使用登记办理率
shiyongdengji.add("100");
// 3.检验超期率
jianyanchaoqi.add(statisticsMapper.getInspectionExpiredRate(orgCode, null).get("expiredRate").toString());
// 4.检验合格率
jianyanhege.add(statisticsMapper.getInspectionResultRate(orgCode, null).get("resultRate").toString());
// 5.充装检查率
long totalAll = searchEsCount(false, false, orgCode, null);
long totalCheck = searchEsCount(true, false, orgCode, null);
long totalResult = searchEsCount(false, true, orgCode, null);
if (totalAll != 0) {
czjc.add(new DecimalFormat("#.00").format(((double) totalCheck / totalAll) * 100));
} else {
czjc.add("0");
}
// 6.充装检查合格率
if (totalAll != 0) {
czjchege.add(new DecimalFormat("#.00").format(((double) totalResult / totalAll) * 100));
} else {
czjchege.add("0");
}
}
Map<String, Object> result = new HashMap<>();
public Map<String, Object> getSecurityIndex(DPFilterParamDto dpFilterParamDto) throws Exception {
List<RegionModel> regionModels = stCommonService.setRegionIfRootParent(dpFilterParamDto.getCityCode());
Map<String, SecurityIndexCountItemDto> regionCodeSecurityIndexMap = getSecurityIndexCountItemDtoMap(regionModels);
List<Map<String, String>> data = new ArrayList<>();
// List<String> ydata = new ArrayList<>();
for (int i = 0; i < xdata.size(); i++) {
List<Map<String, String>> finalData = data;
regionCodeSecurityIndexMap.forEach((k, v) -> {
Map<String, String> item = new HashMap<>();
item.put("name", xdata.get(i));
item.put("name", v.getRegionName());
// 计算xuke的加权值
double xukeWeighted = Double.parseDouble(xuke.get(i)) * 0.10; // 10%
double xukeWeighted = Double.parseDouble(v.getXuke()) * 0.10;
// 剩余权重平均分配给四个因素,每个因素大约22.5%(但为了简化,我们这里用25%的剩余权重)
double remainingWeightPerFactor = 0.90 / 4; // 简化为每个因素25%的剩余权重
double remainingWeightPerFactor = 0.90 / 4;
// 计算其他四个因素的加权值
double jianyanchaoqiWeighted = Double.parseDouble(jianyanchaoqi.get(i)) * remainingWeightPerFactor;
double jianyanhegeWeighted = Double.parseDouble(jianyanhege.get(i)) * remainingWeightPerFactor;
double czjcWeighted = Double.parseDouble(czjc.get(i)) * remainingWeightPerFactor;
double czjchegeWeighted = Double.parseDouble(czjchege.get(i)) * remainingWeightPerFactor;
double jianyanchaoqiWeighted = Double.parseDouble(v.getJianyanchaoqi()) * remainingWeightPerFactor;
double jianyanhegeWeighted = Double.parseDouble(v.getJianyanhege()) * remainingWeightPerFactor;
double czjcWeighted = Double.parseDouble(v.getCzjc()) * remainingWeightPerFactor;
double czjchegeWeighted = Double.parseDouble(v.getCzjchege()) * remainingWeightPerFactor;
// 计算总指数
double totalIndex = xukeWeighted + jianyanchaoqiWeighted + jianyanhegeWeighted + czjcWeighted + czjchegeWeighted;
item.put("value", String.format("%.2f", totalIndex));
data.add(item);
// ydata.add(String.format("%.2f", totalIndex));
}
data = data.stream()
.filter(map -> map.containsKey("value")) // 确保每个Map都包含指定的键
finalData.add(item);
});
data = finalData.stream()
.filter(map -> map.containsKey("value"))
.sorted(Comparator.comparingDouble(map -> {
// 检查并解析值,如果失败则返回Double.MIN_VALUE(或根据需要处理)
try {
......@@ -324,22 +290,89 @@ public class AQZSDPStatisticsServiceImpl {
}
}))
.collect(Collectors.toList());
Map<String, Object> result = new HashMap<>();
List<String> name = data.stream().map(map -> map.get("name")).collect(Collectors.toList());
Collections.reverse(name);
result.put("xdata", name);
List<String> value = data.stream().map(map -> map.get("value")).collect(Collectors.toList());
Collections.reverse(value);
result.put("ydata", value);
return result;
}
private Map<String, SecurityIndexCountItemDto> getSecurityIndexCountItemDtoMap(List<RegionModel> regionModels) {
// 多线程处理后,顺序与regionModels的顺序不一致,故生成list
List<SecurityIndexCountItemDto> countItemDtoList = getSecurityIndexCountDtoList(regionModels);
return countItemDtoList.stream().collect(Collectors.toMap(SecurityIndexCountItemDto::getRegionCode, Function.identity(), (k1, k2) -> k2));
}
private List<SecurityIndexCountItemDto> getSecurityIndexCountDtoList(List<RegionModel> regionModels) {
return regionModels.parallelStream().map(r -> {
String orgCode = stCommonService.getAndSetOrgCode(r.getRegionCode().toString());
SecurityIndexCountItemDto countItemDto = new SecurityIndexCountItemDto();
countItemDto.setRegionCode(r.getRegionCode().toString());
countItemDto.setRegionName(r.getRegionName());
if (ObjectUtils.isEmpty(orgCode)) {
this.setDefaultZeroData(countItemDto);
} else {
// 1.许可有效率
String value = this.getLicenseEfficiencyByRegion(orgCode);
if (NO_DATA_STR.equals(value)) {
value = "0";
countItemDto.setXuke(value);
} else {
countItemDto.setXuke(value);
}
// 2.使用登记办理率
countItemDto.setShiyongdengji(cylinderStatisticsMapper.queryUserRegisterCertAppPercent(orgCode));
// 3.检验超期率
countItemDto.setJianyanchaoqi(statisticsMapper.getInspectionExpiredRate(orgCode, null).get("expiredRate").toString());
// 4.检验合格率
countItemDto.setJianyanhege(statisticsMapper.getInspectionResultRate(orgCode, null).get("resultRate").toString());
// 5.充装检查率
long totalAll = searchEsCount(false, false, orgCode, null);
long totalCheck = searchEsCount(true, false, orgCode, null);
long totalResult = searchEsCount(false, true, orgCode, null);
if (totalAll != 0) {
countItemDto.setCzjc(new DecimalFormat("#.00").format(((double) totalCheck / totalAll) * 100));
} else {
countItemDto.setCzjc("0");
}
// 6.充装检查合格率
if (totalAll != 0) {
countItemDto.setCzjchege(new DecimalFormat("#.00").format(((double) totalResult / totalAll) * 100));
} else {
countItemDto.setCzjchege("0");
}
}
return countItemDto;
}).collect(Collectors.toList());
}
private void setDefaultZeroData(SecurityIndexCountItemDto countItemDto) {
countItemDto.setXuke("0");
countItemDto.setShiyongdengji("0");
countItemDto.setJianyanhege("0");
countItemDto.setCzjc("0");
countItemDto.setCzjchege("0");
countItemDto.setJianyanchaoqi("0");
}
private void setDefaultZeroData(List<String> xuke, List<String> shiyongdengji, List<String> jianyanchaoqi, List<String> jianyanhege, List<String> czjc, List<String> czjchege) {
xuke.add("0");
shiyongdengji.add("0");
jianyanchaoqi.add("0");
jianyanhege.add("0");
czjc.add("0");
czjchege.add("0");
}
public Map<String, Object> mainBodyCount(String cityCode) {
Map<String, Object> resultMap = new HashMap<>();
Map<String, Object> dataMap = new HashMap<>();
String startDate = LocalDate.now().minusDays(100).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
String startDate = LocalDate.now().minusDays(29).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
List<String> mainBodyNameList = IssueMainBodyEnum.getEnumNameList();
String orgCode = getAndSetOrgCode(cityCode);
String orgCode = stCommonService.getAndSetOrgCode(cityCode);
List<Map<String, Object>> list = statisticsMapper.selectByOrgAndMainBody(orgCode, mainBodyNameList, startDate, null);
List<Object> legendDataList = new ArrayList<>();
for (int i = 0; i < 2; i++) {
......@@ -384,23 +417,13 @@ public class AQZSDPStatisticsServiceImpl {
return resultMap;
}
private String getAndSetOrgCode(String cityCode) {
String orgCode = regionCodeOrgCodeMap.get(cityCode);
if (orgCode == null) {
orgCode = statisticsMapper.getOrgCodeByCompanyCode(cityCode);
if (orgCode != null) {
regionCodeOrgCodeMap.put(cityCode, orgCode);
}
}
return orgCode;
}
public Map<String, Object> equipmentCount(String cityCode) {
Map<String, Object> resultMap = new HashMap<>();
Map<String, Object> dataMap = new HashMap<>();
List<Object> xdata = new ArrayList<>();
List<Object> ydata = new ArrayList<>();
String orgCode = getAndSetOrgCode(cityCode);
String orgCode = stCommonService.getAndSetOrgCode(cityCode);
List<String> enumNameList = IssueTypeEnum.getEnumNameListByMainBody("3");
String startDate = LocalDate.now().minusDays(29).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
List<Map<String, Object>> list = statisticsMapper.selectByOrgAndProblemType(orgCode, enumNameList, startDate, IssueMainBodyEnum.EQUIPMENT.getName(), null);
......@@ -419,7 +442,7 @@ public class AQZSDPStatisticsServiceImpl {
public List<Map<String, Object>> companyCount(String cityCode) {
List<Map<String, Object>> resultList = new ArrayList<>();
Map<String, Object> dataMap = new HashMap<>();
String orgCode = getAndSetOrgCode(cityCode);
String orgCode = stCommonService.getAndSetOrgCode(cityCode);
List<String> enumNameList = IssueTypeEnum.getEnumNameListByMainBody("2");
String startDate = LocalDate.now().minusDays(29).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
List<Map<String, Object>> list = statisticsMapper.selectByOrgAndProblemType(orgCode, enumNameList, startDate, IssueMainBodyEnum.COMPANY.getName(), null);
......@@ -451,7 +474,7 @@ public class AQZSDPStatisticsServiceImpl {
Map<String, Object> dataMap = new HashMap<>();
List<Object> xdata = new ArrayList<>();
List<Object> ydata = new ArrayList<>();
String orgCode = getAndSetOrgCode(cityCode);
String orgCode = stCommonService.getAndSetOrgCode(cityCode);
List<String> enumNameList = IssueTypeEnum.getEnumNameListByMainBody("1");
String startDate = LocalDate.now().minusDays(29).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
List<Map<String, Object>> list = statisticsMapper.selectByOrgAndProblemType(orgCode, enumNameList, startDate, IssueMainBodyEnum.PERSON.getName(), null);
......@@ -472,7 +495,7 @@ public class AQZSDPStatisticsServiceImpl {
Map<String, Object> dataMap = new HashMap<>();
List<Object> xdata = new ArrayList<>();
List<Object> ydata = new ArrayList<>();
String orgCode = getAndSetOrgCode(cityCode);
String orgCode = stCommonService.getAndSetOrgCode(cityCode);
List<String> enumNameList = IssueTypeEnum.getEnumNameListByMainBody("4");
String startDate = LocalDate.now().minusDays(29).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
List<Map<String, Object>> list = statisticsMapper.selectByOrgAndProblemType(orgCode, enumNameList, startDate, IssueMainBodyEnum.EQUIPMENT.getName(), "2300");
......@@ -503,7 +526,7 @@ public class AQZSDPStatisticsServiceImpl {
legendData.add(map);
}
resultMap.put("legendData", legendData);
String orgCode = getAndSetOrgCode(cityCode);
String orgCode = stCommonService.getAndSetOrgCode(cityCode);
int year = LocalDate.now().getYear();
List<Map<String, Object>> allIssue = statisticsMapper.getIssueCountByMonth(orgCode, String.valueOf(year), null);
List<Map<String, Object>> endIssue = statisticsMapper.getIssueCountByMonth(orgCode, String.valueOf(year), "1");
......@@ -557,7 +580,7 @@ public class AQZSDPStatisticsServiceImpl {
legendData.add(map);
}
resultMap.put("legendData", legendData);
String orgCode = getAndSetOrgCode(cityCode);
String orgCode = stCommonService.getAndSetOrgCode(cityCode);
String year = LocalDate.now().minusDays(29).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
List<Map<String, Object>> allIssue = statisticsMapper.getIssueCountByDate(orgCode, year, null);
List<Map<String, Object>> endIssue = statisticsMapper.getIssueCountByDate(orgCode, year, "1");
......@@ -597,7 +620,7 @@ public class AQZSDPStatisticsServiceImpl {
}
public Map<String, Object> issueCountByCityCode(String cityCode) {
String orgCode = getAndSetOrgCode(cityCode);
String orgCode = stCommonService.getAndSetOrgCode(cityCode);
String now = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM"));
int count = statisticsMapper.countByOrgCode(orgCode, now);
Map<String, Object> resultMap = new HashMap<>();
......@@ -607,7 +630,7 @@ public class AQZSDPStatisticsServiceImpl {
public List<Map<String, Object>> issueChildrenCityCount(String cityCode) throws Exception {
List<RegionModel> regionModels = setRegionIfRootParent(cityCode);
List<RegionModel> regionModels = stCommonService.setRegionIfRootParent(cityCode);
List<Integer> regionCodeList = regionModels.stream().map(m -> m.getRegionCode()).collect(Collectors.toList());
List<Map<String, String>> orgCodeAndCompanyCodesByCompanyCodes = statisticsMapper.getOrgCodeAndCompanyCodesByCompanyCodes(regionCodeList);
List<String> orgCodes = orgCodeAndCompanyCodesByCompanyCodes.stream().map(m -> m.get("orgCode")).collect(Collectors.toList());
......@@ -645,7 +668,7 @@ public class AQZSDPStatisticsServiceImpl {
}
public List<Map<String, Object>> issueMonthList(String cityCode) {
String orgCode = getAndSetOrgCode(cityCode);
String orgCode = stCommonService.getAndSetOrgCode(cityCode);
String time = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM"));
List<Map<String, Object>> list = statisticsMapper.issueMonthList(orgCode, time);
return list;
......@@ -653,7 +676,7 @@ public class AQZSDPStatisticsServiceImpl {
public Map<String, Object> issueProblemLevelCount(String cityCode) {
Map<String, Object> resultMap = new HashMap<>();
String orgCode = getAndSetOrgCode(cityCode);
String orgCode = stCommonService.getAndSetOrgCode(cityCode);
String time = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy"));
List<Map<String, Object>> list = statisticsMapper.issueProblemLevelCount(orgCode, time);
List<Object> xdata = new ArrayList<>();
......@@ -669,7 +692,7 @@ public class AQZSDPStatisticsServiceImpl {
public List<Map<String, Object>> issueCompanyTop(String cityCode) {
List<Map<String, Object>> resultList = new ArrayList<>();
String orgCode = getAndSetOrgCode(cityCode);
String orgCode = stCommonService.getAndSetOrgCode(cityCode);
String time = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy"));
List<Map<String, Object>> list = statisticsMapper.issueCompanyTop(orgCode, time);
for (int i = 0; i < list.size(); i++) {
......@@ -684,8 +707,8 @@ public class AQZSDPStatisticsServiceImpl {
}
public List<Map<String, Object>> issueChildrenCityCountTop(String cityCode) throws Exception {
List<RegionModel> regionModels = setRegionIfRootParent(cityCode);
List<Integer> regionCodeList = regionModels.stream().map(m -> m.getRegionCode()).collect(Collectors.toList());
List<RegionModel> regionModels = stCommonService.setRegionIfRootParent(cityCode);
List<Integer> regionCodeList = regionModels.stream().map(RegionModel::getRegionCode).collect(Collectors.toList());
List<Map<String, String>> orgCodeAndCompanyCodesByCompanyCodes = statisticsMapper.getOrgCodeAndCompanyCodesByCompanyCodes(regionCodeList);
List<String> orgCodes = orgCodeAndCompanyCodesByCompanyCodes.stream().map(m -> m.get("orgCode")).collect(Collectors.toList());
String now = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy"));
......@@ -745,11 +768,11 @@ public class AQZSDPStatisticsServiceImpl {
}
public List<Map<String, Object>> issueCountTopByProblemType(String cityCode) {
String orgCode = getAndSetOrgCode(cityCode);
String orgCode = stCommonService.getAndSetOrgCode(cityCode);
List<Map<String, Object>> allList = statisticsMapper.issueCountTopByProblemType(orgCode, null);
List<Map<String, Object>> endList = statisticsMapper.issueCountTopByProblemType(orgCode, "1");
Map<String, Object> endIssuedataMap = new HashMap<>();
endList.stream().forEach(t -> {
endList.forEach(t -> {
endIssuedataMap.put(t.get("problemTypeCode").toString(), t.get("count"));
});
List<Map<String, Object>> resultList = new ArrayList<>();
......@@ -768,7 +791,7 @@ public class AQZSDPStatisticsServiceImpl {
public List<Map<String, Object>> getEquipQuestionList(DPFilterParamDto dpFilterParamDto) {
this.setDefaultFilter(dpFilterParamDto);
String orgCode = this.getAndSetOrgCode(dpFilterParamDto.getCityCode());
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode());
if (StringUtils.isEmpty(orgCode)) {
return new ArrayList<>();
}
......@@ -831,4 +854,192 @@ public class AQZSDPStatisticsServiceImpl {
}
}
public Map<String, Object> getCenterMapCountDataForGlobal(DPFilterParamDto dpFilterParamDto) {
Map<String, Object> result = new HashMap<>();
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode());
if (StringUtils.isEmpty(orgCode)) {
return new HashMap<>();
}
// 1.气瓶数量统计
long cylinderNum = this.staticsCenterMapCountDataForCylinder(result, orgCode);
//1.8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
this.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode);
//2.压力管道长度统计
this.staticsCenterMapCountDataForPipeline(result, orgCode);
//3.单位数量统计
this.staticsCenterMapCountDataForCompany(result, orgCode);
//4.人员数量统计
this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto, orgCode);
//5.问题数统计
this.staticsCenterMapCountDataForIssue(result, orgCode);
return result;
}
private void staticsCenterMapCountDataForIssue(Map<String, Object> result, String orgCode) {
List<Map<String, Object>> list = statisticsMapper.selectByOrg(orgCode);
Map<String, Object> dataMap = new HashMap<>();
AtomicReference<Long> issueCount = new AtomicReference<>(0L);
list.stream().forEach(t -> {
dataMap.put(t.get("sourceType").toString(), t.get("count"));
issueCount.updateAndGet(v -> v + Long.parseLong(t.get("count").toString()));
});
result.put("issueCount", issueCount.get());
result.put("deviceIssueCount", dataMap.getOrDefault(DPMapStatisticsItemEnum.EQU_ISSUES_COUNT, 0L));
result.put("companyIssueCount", dataMap.getOrDefault(DPMapStatisticsItemEnum.COMPANY_ISSUES_COUNT, 0L));
result.put("personIssueCount", dataMap.getOrDefault(DPMapStatisticsItemEnum.PERSON_ISSUES_COUNT, 0L));
}
private long staticsCenterMapCountDataForCylinder(Map<String, Object> result, String orgCode) {
long num = 0;
CountRequest request = new CountRequest();
request.indices("idx_biz_view_jg_all");
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
// 按照管辖机构区域信息模糊查询
boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*"));
// 设备类别精确查询气瓶
boolMust.must(QueryBuilders.termsQuery("EQU_CATEGORY_CODE", EQU_CATEGORY_CYLINDER));
// 且在用状态设备
boolMust.must(QueryBuilders.termQuery("EQU_STATE", EquimentEnum.ZAIYONG.getCode()));
request.query(boolMust);
try {
CountResponse response = restHighLevelClient.count(request, RequestOptions.DEFAULT);
num = response.getCount();
} catch (IOException e) {
throw new RuntimeException(e);
}
result.put(DPMapStatisticsItemEnum.GAS.getCode(), num);
return num;
}
private void staticsCenterMapCountDataForEquip(Map<String, Object> result, long cylinderNum, String orgCode) {
SearchRequest request = new SearchRequest();
request.indices("idx_biz_view_jg_all");
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
// 按照管辖机构区域信息模糊查询
boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*"));
// 且在用状态设备
boolMust.must(QueryBuilders.termQuery("EQU_STATE", EquimentEnum.ZAIYONG.getCode()));
SearchSourceBuilder builder = new SearchSourceBuilder();
builder.query(boolMust);
TermsAggregationBuilder aggregationBuilder = AggregationBuilders.terms("count_by_equ_list_code").field("EQU_LIST_CODE");
builder.aggregation(aggregationBuilder);
request.source(builder);
try {
SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
Terms terms = response.getAggregations().get("count_by_equ_list_code");
Map<String, Long> countMap = new HashMap<>();
for (Terms.Bucket bucket : terms.getBuckets()) {
// 压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
if (bucket.getKeyAsString().equals(EQU_LIST_CYLINDER)) {
countMap.put(bucket.getKeyAsString(), bucket.getDocCount() - cylinderNum);
} else {
countMap.put(bucket.getKeyAsString(), bucket.getDocCount());
}
}
// 按照8大类枚举,进行加工。目的:固定八大类防止没统计数据导致缺少分类、将设备种类的code换成前端定义的key
equipmentCategoryDtos.forEach(c -> {
result.put(this.castCategoryCode2WebCode(c.getCode()), countMap.getOrDefault(c.getCode(), 0L));
});
result.put(DPMapStatisticsItemEnum.TOTAL.getCode(), countMap.values().stream().mapToLong(e -> e).sum() + cylinderNum);
} catch (IOException e) {
throw new RuntimeException(e);
}
result.remove(DPMapStatisticsItemEnum.PRESSURE_PIPELINES.getCategory());
}
private String castCategoryCode2WebCode(String category) {
DPMapStatisticsItemEnum itemEnum = DPMapStatisticsItemEnum.getInstanceByCategory(category);
return itemEnum.getCode();
}
private void staticsCenterMapCountDataForPipeline(Map<String, Object> result, String orgCode) {
String length = techParamsPipelineMapper.sumPipeLengthByOrgCode(orgCode);
BigDecimal lengthDecimal = new BigDecimal(length);
if (lengthDecimal.compareTo(BigDecimal.ZERO) > 0) {
length = lengthDecimal.divide(new BigDecimal("1000"), 3, RoundingMode.HALF_UP).toPlainString();
}
result.put(DPMapStatisticsItemEnum.PRESSURE_PIPELINES.getCode(), length);
}
private void staticsCenterMapCountDataForCompany(Map<String, Object> result, String orgCode) {
if (orgCode == null) {
setDefaultCompanyCountData(result);
return;
}
List<CountDto> countDtos = enterpriseInfoMapper.countByUnitTypeAndOrgCode(orgCode);
result.put(DPMapStatisticsItemEnum.USERS_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_USE)).mapToInt(CountDto::getIntValue).sum());
result.put(DPMapStatisticsItemEnum.CONSTRUCTION_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MAINTENANCE)).mapToInt(CountDto::getIntValue).sum());
result.put(DPMapStatisticsItemEnum.MANUFACTURING_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MANUFACTURE)).mapToInt(CountDto::getIntValue).sum());
result.put(DPMapStatisticsItemEnum.GAS_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_FILLING)).mapToInt(CountDto::getIntValue).sum());
}
private void setDefaultCompanyCountData(Map<String, Object> m) {
m.put(DPMapStatisticsItemEnum.USERS_UNITS.getCode(), 0);
m.put(DPMapStatisticsItemEnum.CONSTRUCTION_UNITS.getCode(), 0);
m.put(DPMapStatisticsItemEnum.MANUFACTURING_UNITS.getCode(), 0);
m.put(DPMapStatisticsItemEnum.GAS_UNITS.getCode(), 0);
}
private void staticsCenterMapCountDataForPerson(Map<String, Object> result, DPFilterParamDto dpFilterParamDto, String orgCode) {
if (orgCode == null) {
result.put(DPMapStatisticsItemEnum.OPERATORS.getCode(), 0);
return;
}
Long num = userInfoMapper.countUserByPostAndAreaCode(orgCode, "6552", dpFilterParamDto.getCityCode());
result.put(DPMapStatisticsItemEnum.OPERATORS.getCode(), num);
}
public List<Map<String, Object>> getCenterMapCountDataForOverview(DPFilterParamDto dpFilterParamDto) throws Exception {
List<RegionModel> regionModels = stCommonService.setRegionIfRootParent(dpFilterParamDto.getCityCode());
List<Map<String, Object>> result = regionModels.parallelStream().map(r -> {
DPFilterParamDto filterParamDto = new DPFilterParamDto();
filterParamDto.setCityCode(r.getRegionCode().toString());
Map<String, Object> itemResult = getCenterMapOverviewData(filterParamDto);
itemResult.put("regionCode", r.getRegionCode());
itemResult.put("regionName", r.getRegionName());
return itemResult;
}).collect(Collectors.toList());
this.setCompanyDataBatch(result);
return result;
}
private void setCompanyDataBatch(List<Map<String, Object>> result) {
List<CountDto> countDtos = enterpriseInfoMapper.countByUnitTypeAndOrgCodeNoParam();
result.forEach(m -> {
String cityCode = m.get("regionCode").toString();
String orgCode = stCommonService.getAndSetOrgCode(cityCode);
if (orgCode != null) {
m.put(DPMapStatisticsItemEnum.USERS_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_USE) && c.getLabel().contains(orgCode)).mapToInt(CountDto::getIntValue).sum());
m.put(DPMapStatisticsItemEnum.CONSTRUCTION_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MAINTENANCE) && c.getLabel().contains(orgCode)).mapToInt(CountDto::getIntValue).sum());
m.put(DPMapStatisticsItemEnum.MANUFACTURING_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MANUFACTURE) && c.getLabel().contains(orgCode)).mapToInt(CountDto::getIntValue).sum());
m.put(DPMapStatisticsItemEnum.GAS_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_FILLING) && c.getLabel().contains(orgCode)).mapToInt(CountDto::getIntValue).sum());
} else {
setDefaultCompanyCountData(m);
}
});
}
private Map<String, Object> getCenterMapOverviewData(DPFilterParamDto dpFilterParamDto) {
Map<String, Object> result = new HashMap<>();
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode());
if (StringUtils.isEmpty(orgCode)) {
return new HashMap<>();
}
// 0. 气瓶数量统计
long cylinderNum = this.staticsCenterMapCountDataForCylinder(result, orgCode);
// 1. 8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
this.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode);
// 2. 压力管道长度统计
this.staticsCenterMapCountDataForPipeline(result, orgCode);
// 3.单位数量统计
this.staticsCenterMapCountDataForCompany(result, orgCode);
// 4. 人员数量统计
this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto, orgCode);
// 5.问题统计
this.staticsCenterMapCountDataForIssue(result, orgCode);
return result;
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.statistcs.biz.service.impl;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.dto.CountDto;
import com.yeejoin.amos.boot.module.common.api.dto.CylinderFillingRecordStatisticsDto;
......@@ -30,6 +31,8 @@ import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
......@@ -51,12 +54,16 @@ public class CylinderDPStatisticsServiceImpl {
private TzBaseEnterpriseInfoMapper baseEnterpriseInfoMapper;
private CylinderAreaDataMapper cylinderAreaDataMapper;
;
private CylinderStatisticsMapper cylinderStatisticsMapper;
private CylinderInfoMapper cylinderInfoMapper;
/**
* 气瓶图列换算单位上限
*/
private final static Long CYLINDER_LEGEND_UPPER_LIMIT = 100000L;
public CylinderDPStatisticsServiceImpl(StCommonServiceImpl stCommonService, RestHighLevelClient restHighLevelClient, TzBaseEnterpriseInfoMapper baseEnterpriseInfoMapper, CylinderAreaDataMapper cylinderAreaDataMapper, CylinderStatisticsMapper cylinderStatisticsMapper, CylinderInfoMapper cylinderInfoMapper) {
this.stCommonService = stCommonService;
this.restHighLevelClient = restHighLevelClient;
......@@ -83,7 +90,7 @@ public class CylinderDPStatisticsServiceImpl {
// 按照管辖机构区域信息模糊查询
.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*"))
);
TermsAggregationBuilder aggregation = AggregationBuilders.terms("USE_UNIT_CREDIT_CODE").field("USE_UNIT_CREDIT_CODE.keyword").size(10);
TermsAggregationBuilder aggregation = AggregationBuilders.terms("USE_UNIT_CREDIT_CODE").field("USE_UNIT_CREDIT_CODE.keyword").size(300);
searchSourceBuilder.aggregation(aggregation);
searchRequest.source(searchSourceBuilder);
// 执行搜索并获取响应
......@@ -127,20 +134,44 @@ public class CylinderDPStatisticsServiceImpl {
List<RegionModel> regionList = stCommonService.setRegionIfRootParent(regionCode);
List<Map<String, Object>> legendData = new ArrayList<>();
List<String> xdata = this.buildXData(regionList);
List<Long> qiping = getYDataForQP(regionCode, regionList);
List<Long> qizhan = getYDataForQZ(regionCode, regionList);
Map<String, Object> qiLegend = getQZLegend("气瓶数量", "qiping");
List<Long> qiping = getYDataForQP(regionList);
Long totalCyNum = qiping.stream().mapToLong(e -> e).sum();
List<Long> qizhan = getYDataForQZ(regionList);
Map<String, Object> qiLegend = getQPLegend(totalCyNum);
Map<String, Object> zhanLegend = getQZLegend("气站数量", "qizhan");
legendData.add(qiLegend);
legendData.add(zhanLegend);
Map<String, Object> result = new HashMap<>();
result.put("qizhan", qizhan);
result.put("qiping", qiping);
result.put("qiping", this.changeNum2Million(totalCyNum, qiping));
result.put("xdata", xdata);
result.put("legendData", legendData);
return result;
}
private List changeNum2Million(Long totalCyNum, List<Long> qiping) {
if (totalCyNum > CYLINDER_LEGEND_UPPER_LIMIT) {
return qiping.stream().map(num -> {
BigDecimal numDecimal = new BigDecimal(num.toString());
BigDecimal millionNum = numDecimal.divide(new BigDecimal("10000"), 4, RoundingMode.HALF_UP);
return millionNum.toPlainString();
}).collect(Collectors.toList());
} else {
return qiping;
}
}
private Map<String, Object> getQPLegend(Long totalCyNum) {
Map<String, Object> qiLegend = new HashMap<>();
if (totalCyNum > CYLINDER_LEGEND_UPPER_LIMIT) {
qiLegend.put("value", "气瓶数量(万)");
} else {
qiLegend.put("value", "气瓶数量");
}
qiLegend.put("dataKey", "qiping");
return qiLegend;
}
private Map<String, Object> getQZLegend(String label, String key) {
Map<String, Object> qiLegend = new HashMap<>();
qiLegend.put("value", label);
......@@ -148,11 +179,11 @@ public class CylinderDPStatisticsServiceImpl {
return qiLegend;
}
private List<Long> getYDataForQZ(String regionCode, List<RegionModel> regionList) {
private List<Long> getYDataForQZ(List<RegionModel> regionList) {
List<CountDto> enterpriseCountList = regionList.parallelStream().map(e -> {
CountDto dto = new CountDto();
dto.setKeyStr(e.getRegionCode() + "");
String orgCode = stCommonService.getAndSetOrgCode(regionCode);
String orgCode = stCommonService.getAndSetOrgCode(e.getRegionCode() + "");
if (StringUtils.isNotEmpty(orgCode)) {
Long enterpriseNum = cylinderStatisticsMapper.countEnterpriseNumForCylinder(orgCode);
dto.setLongValue(enterpriseNum);
......@@ -164,10 +195,10 @@ public class CylinderDPStatisticsServiceImpl {
return regionList.stream().map(r -> enterpriseCountList.stream().filter(e -> e.getKeyStr().equals(r.getRegionCode() + "")).mapToLong(CountDto::getLongValue).sum()).collect(Collectors.toList());
}
private List<Long> getYDataForQP(String regionCode, List<RegionModel> regionList) {
private List<Long> getYDataForQP(List<RegionModel> regionList) {
List<Long> qiping = new ArrayList<>();
regionList.forEach(r -> {
String orgCode = stCommonService.getAndSetOrgCode(regionCode);
String orgCode = stCommonService.getAndSetOrgCode(r.getRegionCode() + "");
if (StringUtils.isNotEmpty(orgCode)) {
Long num = this.countForCylinderNum(orgCode);
qiping.add(num);
......@@ -183,8 +214,28 @@ public class CylinderDPStatisticsServiceImpl {
CountRequest request = new CountRequest();
request.indices("idx_biz_view_jg_all");
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
// 按照管辖机构区域信息模糊查询
boolMust.must(QueryBuilders.termQuery("EQU_CATEGORY_CODE", "2300"));
// 按照管辖机构区域信息模糊查询
boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*"));
// 且在用状态设备
boolMust.must(QueryBuilders.termQuery("EQU_STATE", EquimentEnum.ZAIYONG.getCode()));
request.query(boolMust);
try {
CountResponse response = restHighLevelClient.count(request, RequestOptions.DEFAULT);
num = response.getCount();
} catch (IOException e) {
throw new RuntimeException(e);
}
return num;
}
private Long countForCylinderNumForVehicleUsed(String orgCode) {
long num = 0;
CountRequest request = new CountRequest();
request.indices("idx_biz_view_jg_all");
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
// 按照管辖机构区域信息模糊查询
boolMust.must(QueryBuilders.termQuery("WHETHER_VEHICLE_CYLINDER.keyword", "1"));
boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*"));
// 且在用状态设备
boolMust.must(QueryBuilders.termQuery("EQU_STATE", EquimentEnum.ZAIYONG.getCode()));
......@@ -203,33 +254,110 @@ public class CylinderDPStatisticsServiceImpl {
}
public Map<String, Object> getCylinderStatisticsDataByCityForTotal(DPFilterParamDto dpFilterParamDto) {
String regionCode = dpFilterParamDto.getCityCode();
String orgCode = stCommonService.getAndSetOrgCode(regionCode);
Map<String, Object> result = new HashMap<>();
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode());
getCylinderMapCount(orgCode, result);
return result;
}
private Map<String, Object> getCylinderMapCount(String orgCode, Map<String, Object> result) {
if (StringUtils.isNotEmpty(orgCode)) {
result.put("cylindersCount", this.countForCylinderNum(orgCode));
result.put("stationCount", cylinderStatisticsMapper.countEnterpriseNumForCylinder(orgCode));
result.put("operatorCount", cylinderAreaDataMapper.getOpertorStatisticsDataByCity(Collections.singletonList(orgCode)));
// 液化气瓶 (个)
result.put("liquefiedGasCount", 0L);
// 车用气瓶 (个)
result.put("automotiveGasCount", this.countForCylinderNumForVehicleUsed(orgCode));
// 工业气瓶 (个)
result.put("industrialGasCount", 0L);
// 使用登记数量
result.put("useRegistrationQuantityCount", this.countForCylinderCertNum(orgCode));
// 检验临期气瓶数
result.put("jylqsbCount", this.countForCylinderTemporaryInspect(orgCode));
// 检验超期气瓶数
result.put("jycqsbCount", this.countForCylinderOverdueInspect(orgCode));
} else {
this.setDefaultValueIfNoData(result, "stationCount", "cylindersCount", "operatorCount");
this.setDefaultValueIfNoData(result, "cylindersCount", "stationCount", "operatorCount", "liquefiedGasCount", "automotiveGasCount", "industrialGasCount", "useRegistrationQuantityCount", "jylqsbCount", "jycqsbCount");
}
return result;
}
/**
* 临期检验设备数统计
*
* @param orgCode 过滤条件
* @return 临期设备的数量
*/
private Long countForCylinderTemporaryInspect(String orgCode) {
long num = 0;
CountRequest request = new CountRequest();
request.indices("idx_biz_view_jg_all");
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
boolMust.must(QueryBuilders.termQuery("EQU_CATEGORY_CODE", "2300"));
// 按照管辖机构区域信息模糊查询
boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*"));
// 且在用状态设备
boolMust.must(QueryBuilders.termQuery("EQU_STATE", EquimentEnum.ZAIYONG.getCode()));
// 且下次检验日期大于等于当天
long currentDayTime = DateUtil.parse(DateUtil.today(), "yyy-MM-dd").getTime();
boolMust.must(QueryBuilders.rangeQuery("NEXT_INSPECT_DATE").gte(currentDayTime));
// 且查询 下次检验日期 <= 当前天+30天 极为临期
long currentDayAfter30DayTime = DateUtil.offsetDay(DateUtil.parse(DateUtil.today(), "yyy-MM-dd"), 30).getTime();
boolMust.must(QueryBuilders.rangeQuery("NEXT_INSPECT_DATE").lte(currentDayAfter30DayTime));
request.query(boolMust);
try {
CountResponse response = restHighLevelClient.count(request, RequestOptions.DEFAULT);
num = response.getCount();
} catch (IOException e) {
throw new RuntimeException(e);
}
return num;
}
/**
* 超期检验设备数统计
*
* @param orgCode 过滤条件
* @return 超期设备的数量
*/
private Long countForCylinderOverdueInspect(String orgCode) {
long num = 0;
CountRequest request = new CountRequest();
request.indices("idx_biz_view_jg_all");
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
// 设备类别2300气瓶
boolMust.must(QueryBuilders.termQuery("EQU_CATEGORY_CODE", "2300"));
// 按照管辖机构区域信息模糊查询
boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*"));
// 在用状态设备
boolMust.must(QueryBuilders.termQuery("EQU_STATE", EquimentEnum.ZAIYONG.getCode()));
// 查询下次检验日期小于当前天的设备,即为超期检验超期设备
long currentDayTime = DateUtil.parse(DateUtil.now(), "yyy-MM-dd").getTime();
boolMust.must(QueryBuilders.rangeQuery("NEXT_INSPECT_DATE").lt(currentDayTime));
request.query(boolMust);
try {
CountResponse response = restHighLevelClient.count(request, RequestOptions.DEFAULT);
num = response.getCount();
} catch (IOException e) {
throw new RuntimeException(e);
}
return num;
}
private Long countForCylinderCertNum(String orgCode) {
return cylinderStatisticsMapper.countForCylinderCertNum(orgCode);
}
public List<Map<String, Object>> getCylinderStatisticsDataByCityForMap(DPFilterParamDto dpFilterParamDto) throws Exception {
List<RegionModel> regionList = stCommonService.setRegionIfRootParent(dpFilterParamDto.getCityCode());
return regionList.parallelStream().map(r -> {
String orgCode = stCommonService.getAndSetOrgCode(r.getRegionCode() + "");
String orgCode = stCommonService.getAndSetOrgCode(r.getRegionCode().toString());
Map<String, Object> item = new HashMap<>();
item.put("regionCode", r.getRegionCode());
item.put("regionName", r.getRegionName());
if (StringUtils.isNotEmpty(orgCode)) {
item.put("stationCount", cylinderStatisticsMapper.countEnterpriseNumForCylinder(orgCode));
item.put("cylindersCount", this.countForCylinderNum(orgCode));
item.put("operatorCount", cylinderAreaDataMapper.getOpertorStatisticsDataByCity(Collections.singletonList(orgCode)));
} else {
this.setDefaultValueIfNoData(item, "stationCount", "cylindersCount", "operatorCount");
}
getCylinderMapCount(orgCode, item);
return item;
}).collect(Collectors.toList());
}
......
package com.yeejoin.amos.boot.module.statistcs.biz.service.impl;
import com.yeejoin.amos.boot.module.statistics.api.mapper.DPSubBizMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 大屏二级页面实现类
*
* @author Administrator
*/
@Slf4j
@Service
public class DPSubBizServiceImpl {
private DPSubBizMapper dpSubBizMapper;
public DPSubBizServiceImpl(DPSubBizMapper dpSubBizMapper) {
this.dpSubBizMapper = dpSubBizMapper;
}
/**
* 查询设备在jg业务中的记录
*
* @param record
* @return
*/
public List<Map<String, String>> equOnJgServiceOperationRecords(String record) {
return dpSubBizMapper.equOnJgServiceOperationRecords(record).stream()
.map(x -> {
Map<String, String> map = new HashMap<>();
map.put("operatingTime", x.get("recDate"));
String content = String.format("%s 创建人:%s 单号【%s】 审批单位:%s",
x.get("businessType"), x.get("recUserName"), x.get("applyNo"), x.get("approvalUnit"));
map.put("operater", content);
map.put("routePath", x.get("routePath"));
return map;
})
.collect(Collectors.toList());
}
/**
* 问题记录列表
* @param equipId
* @return
*/
public List<Map<String, String>> queryProblemListByEquipId(String equipId) {
return dpSubBizMapper.queryForSafetyProblemTracingList(equipId).stream()
.map(x -> {
Map<String, String> map = new HashMap<>();
map.put("key", x.get("sequence_nbr"));
map.put("type", x.get("problem_type"));
map.put("descr", x.get("problem_desc"));
map.put("createDate", x.get("problem_time"));
return map;
})
.collect(Collectors.toList());
}
}
......@@ -9,6 +9,8 @@ import com.yeejoin.amos.boot.biz.common.utils.JsonValueUtils;
import com.yeejoin.amos.boot.biz.common.utils.RestTemplateUtils;
import com.yeejoin.amos.boot.biz.common.utils.StringUtils;
import com.yeejoin.amos.boot.module.statistcs.biz.utils.DpSubUtils;
import com.yeejoin.amos.boot.module.statistics.api.enums.DPStatusEnum;
import com.yeejoin.amos.boot.module.statistics.api.mapper.*;
import com.yeejoin.amos.feign.morphic.Morphic;
import com.yeejoin.amos.feign.morphic.model.FormSceneModel;
import jdk.nashorn.api.scripting.ScriptObjectMirror;
......@@ -53,6 +55,9 @@ public class DPSubServiceImpl {
@Autowired
DataDictionaryServiceImpl iDataDictionaryService;
@Autowired
DPSubBizServiceImpl dpSubBizService;
public JSONObject commonQuery(String template, @RequestBody Map<String, Object> param) {
JSONObject result = new JSONObject();
String templateJson = DpSubUtils.getFileContent(template + ".json");
......@@ -70,6 +75,7 @@ public class DPSubServiceImpl {
tabs.stream().forEach(x -> {
JSONObject tab = (JSONObject) x;
long s = System.currentTimeMillis();
tab.put("template", template);
this.buildContent(content, tab, param);
long e = System.currentTimeMillis();
log.info("{}tab页处理结束,共耗时:{} 毫秒", tab.get("displayName"), (e - s));
......@@ -77,7 +83,34 @@ public class DPSubServiceImpl {
return result;
}
public Object aloneApi(JSONObject jsonObject){
Object resultConvert = JsonValueUtils.getValueByKey(jsonObject, "dataConfig", "dataConfig.resultConvert");
Object api = JsonValueUtils.getValueByKey(jsonObject, "dataConfig", "dataConfig.api");
String renderType = jsonObject.getString("renderType");
Object apiResult = null;
ResponseModel responseModel = this.getApiResult((JSONObject) api, !ValidationUtil.isEmpty(resultConvert) ? resultConvert.toString() : null);
if (!ValidationUtil.isEmpty(responseModel.getResult())) {
apiResult = responseModel.getResult();
}
if ("timeline".equals(renderType)){
return apiResult;
} else if("table".equals(renderType)){
JSONObject map = new JSONObject();
Object columns = JsonValueUtils.getValueByKey(jsonObject, "visualParams", "visualParams.columns");
map.put("columns", columns);
map.put("dataList", apiResult);
map.put("showPage", true);
map.put("api", api);
map.put("rowKey", JsonValueUtils.getValueByKey(jsonObject, "visualParams", "visualParams.rowKey"));
return map;
}
return apiResult;
}
public void buildContent(JSONObject content, JSONObject tab, Map<String, Object> param) {
if (!ValidationUtil.isEmpty(tab.getBoolean("useAloneApi")) && tab.getBoolean("useAloneApi")){
return;
}
Long formSeq = tab.getLong("formSeq");
String renderType = tab.getString("renderType");
Object resultConvert = JsonValueUtils.getValueByKey(tab, "dataConfig", "dataConfig.resultConvert");
......@@ -100,6 +133,11 @@ public class DPSubServiceImpl {
log.info("{}tab页获取详情接口,共耗时:{} 毫秒", tab.get("displayName"), (e - s));
}
if (tab.getString("template").contains("emergency")){
content.put(tab.getString("key"), JSONObject.parseObject(apiResult.toString()));
return;
}
if (!ValidationUtil.isEmpty(formSeq)) {
long s = System.currentTimeMillis();
FormSceneModel formPage = Morphic.formSceneClient.seleteOne(formSeq).getResult();
......@@ -141,8 +179,11 @@ public class DPSubServiceImpl {
map.getJSONArray("subs").add(matinfo);
}
} else {
if ("timeline".equals(renderType)){
content.put(tab.getString("key"), apiResult);
if ("keyinfo".equals(renderType)) {
this.buildContentKeyinfoData(tab, content, apiResult);
} else if ("timeline".equals(renderType)){
// 监管履历基本信息已经获取过,此次直接用
content.put(tab.getString("key"), !ValidationUtil.isEmpty(param.get("reghistory")) ? param.get("reghistory") : apiResult);
} else if("table".equals(renderType)){
Object columns = JsonValueUtils.getValueByKey(tab, "visualParams", "visualParams.columns");
map.put("columns", columns);
......@@ -155,6 +196,86 @@ public class DPSubServiceImpl {
}
}
public JSONObject buildContentKeyinfoData(JSONObject tab, JSONObject content, Object apiResult){
JSONObject result = JSONObject.parseObject(apiResult.toString());
JSONObject param = tab.getJSONObject("param");
Object keyParams = JsonValueUtils.getValueByKey(content, "keyinfo", "keyinfo.keyParams");
if (ValidationUtil.isEmpty(keyParams)){
JSONObject keyinfo = content.getJSONObject("keyinfo");
// 气瓶区分车用和非车用
if ("2300".equals(param.getString("EQU_CATEGORY_CODE"))){
keyParams = JsonValueUtils.getValueByKey(content, "keyinfo", "keyinfo.keyParams_2300_" +
("1".equals(param.getString("WHETHER_VEHICLE_CYLINDER")) ? "true" : "false"));
keyinfo.remove("keyParams_2300_true");
keyinfo.remove("keyParams_2300_false");
} else {
Object selectKeyParams = JsonValueUtils.getValueByKey(content, "keyinfo", "keyinfo.keyParams_" + param.getString("EQU_CATEGORY_CODE"));
if (!ValidationUtil.isEmpty(selectKeyParams)){
keyParams = selectKeyParams;
keyinfo.remove("keyinfo.keyParams_" + param.getString("EQU_CATEGORY_CODE"));
} else {
keyParams = JsonValueUtils.getValueByKey(content, "keyinfo", "keyinfo.keyParams_default");
}
}
keyinfo.remove("keyParams_default");
keyinfo.put("keyParams", keyParams);
}
((JSONArray) keyParams).stream().forEach(x -> {
JSONObject xobj = (JSONObject) x;
xobj.put("type", "text");
xobj.put("value", "param".equals(xobj.getString("source")) ? param.get(xobj.getString("key")) : result.get(xobj.getString("key")));
});
this.processQRCodeWidget(content.getJSONObject("keyinfo").getJSONObject("qrcode"), result);
if (tab.getString("template").contains("equip")){
// 处理图片
JSONArray jsonArray = result.getJSONArray("PRODUCT_PHOTO");
if (!ValidationUtil.isEmpty(jsonArray)){
content.getJSONObject("keyinfo").put("photo", jsonArray.getJSONObject(0).getString("url"));
}
// 处理标签
JSONArray status = (JSONArray)JsonValueUtils.getValueByKey(content, "keyinfo", "keyinfo.status");
this.processLabel(status, param.getString("EQU_STATE"));
// 处理问题列表
List<Map<String, String>> problem = dpSubBizService.queryProblemListByEquipId(param.getString("record"));
if (!ValidationUtil.isEmpty(problem)){
JSONObject qrcode = (JSONObject)JsonValueUtils.getValueByKey(content, "keyinfo", "keyinfo.qrcode");
qrcode.put("problem", problem);
}
// 处理监管履历
List<Map<String, String>> datas = dpSubBizService.equOnJgServiceOperationRecords(param.getString("record"));
if (!ValidationUtil.isEmpty(datas)){
JSONObject infoRecords = (JSONObject)JsonValueUtils.getValueByKey(content, "keyinfo", "keyinfo.infoRecords");
infoRecords.put("datas", datas);
param.put("reghistory", datas);
}
} else if(tab.getString("template").contains("company")){
// 处理标签
JSONArray status = (JSONArray)JsonValueUtils.getValueByKey(content, "keyinfo", "keyinfo.status");
this.processLabel(status, result.getString("unitType"));
this.processLabel(status, result.getString("operatingStatus"));
// 处理图片
JSONArray jsonArray = result.getJSONArray("unitBusinessLicense");
if (!ValidationUtil.isEmpty(jsonArray)){
content.getJSONObject("keyinfo").put("photo", jsonArray.getJSONObject(0).getString("url"));
}
}
return content;
}
private JSONArray processLabel(JSONArray status, String value){
if (!ValidationUtil.isEmpty(value)){
DPStatusEnum enumByStatus = DPStatusEnum.getEnumByStatus(value);
if (!ValidationUtil.isEmpty(enumByStatus)){
status.add(DPStatusEnum.toMap(enumByStatus));
}
}
return status;
}
private JSONArray processShowHideRules(JSONArray children, Object showHideRules, Object apiResult) {
JSONObject result = JSONObject.parseObject(apiResult.toString());
if (!ValidationUtil.isEmpty(showHideRules)) {
......@@ -305,30 +426,10 @@ public class DPSubServiceImpl {
JSONArray datas = new JSONArray();
// 处理二维码
mergedArray.stream().filter(x -> "QRCode".equals(JsonValueUtils.getValueByKey(x, "componentKey", null))).findFirst().ifPresent(x -> {
JSONObject qrcode = map.getJSONObject("qrcode");
String problemTime = result.getString("problemTime");
String problemStatus = result.getString("problemStatus");
String color = null;
if (!ValidationUtil.isEmpty(problemTime)) {
try {
qrcode.put("text", DateUtil.formatDate(DateUtil.smartFormat(problemTime), "yyyy-MM-dd"));
qrcode.put("subtext", DateUtil.formatDate(DateUtil.smartFormat(problemTime), "HH:mm:ss"));
} catch (Exception e) {
e.printStackTrace();
}
}
if ("正常".equals(problemStatus)) {
color = "green";
} else if ("异常".equals(problemStatus)) {
color = "red";
}
qrcode.put("value", !ValidationUtil.isEmpty(result.get("useCode")) ? result.get("useCode") : result.get("USE_ORG_CODE"));
qrcode.put("status", problemStatus);
qrcode.put("color", color);
this.processQRCodeWidget(map.getJSONObject("qrcode"), result);
});
mergedArray = mergedArray.stream().filter(x -> !"QRCode".equals(JsonValueUtils.getValueByKey(x, "componentKey", null))).collect(Collectors.toList());
mergedArray.stream().forEach(x -> {
Object fieldKey = JsonValueUtils.getValueByKey(x, "visualParams", "visualParams.fieldKey");
if (!ValidationUtil.isEmpty(fieldKey)) {
......@@ -366,6 +467,29 @@ public class DPSubServiceImpl {
return map;
}
public JSONObject processQRCodeWidget(JSONObject qrcode, JSONObject result) {
String problemTime = result.getString("problemTime");
String problemStatus = result.getString("problemStatus");
String color = null;
if (!ValidationUtil.isEmpty(problemTime)) {
try {
qrcode.put("text", DateUtil.formatDate(DateUtil.smartFormat(problemTime), "yyyy-MM-dd"));
qrcode.put("subtext", DateUtil.formatDate(DateUtil.smartFormat(problemTime), "HH:mm:ss"));
} catch (Exception e) {
e.printStackTrace();
}
}
if ("正常".equals(problemStatus)) {
color = "green";
} else if ("异常".equals(problemStatus)) {
color = "red";
}
qrcode.put("value", !ValidationUtil.isEmpty(result.get("useCode")) ? result.get("useCode") : result.get("USE_ORG_CODE"));
qrcode.put("status", problemStatus);
qrcode.put("color", color);
return qrcode;
}
/**
* 处理不同组件的展示
*
......
......@@ -50,6 +50,7 @@ import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -477,7 +478,8 @@ public class JGDPStatisticsServiceImpl {
public Map<String, Object> querySafetyIndex(DPFilterParamDto dpFilterParamDto) {
Map<String, Object> result = new HashMap<>();
result.put("riskScore", 12);
int riskScore = ThreadLocalRandom.current().nextInt(88, 93);
result.put("riskScore", riskScore);
return result;
}
......@@ -797,19 +799,16 @@ public class JGDPStatisticsServiceImpl {
* 1 在用
* 2 停用
* 4 注销
* 0 未登记
*/
for (int i = 0; i < 5; i++) {
for (int i = 0; i < 4; i++) {
Map<String, Object> map = new HashMap();
if (i == 0) {
map.put("name", "未登记");
} else if (i == 1) {
if (i == 0) {
map.put("name", "在用");
} else if (i == 2) {
} else if (i == 1) {
map.put("name", "停用");
} else if (i == 3) {
} else if (i == 2) {
map.put("name", "报废");
} else if (i == 4) {
} else if (i == 3) {
map.put("name", "注销");
}
map.put("value", dataMap.getOrDefault(String.valueOf(i), 0L));
......@@ -1298,7 +1297,7 @@ public class JGDPStatisticsServiceImpl {
legendData.add(map);
}
resultMap.put("legendData", legendData);
List<String> xDataList = Arrays.asList("气瓶", "电梯", "压力容器", "锅炉", "起重机械", "场(厂)内专用", "大型游乐设施", "压力管道", "客运索道");
List<String> xDataList = Arrays.asList( "电梯", "压力容器", "锅炉", "起重机械", "场(厂)内专用", "大型游乐设施", "压力管道", "客运索道");
resultMap.put("xdata", xDataList);
List installNotify = new ArrayList<>();
List transformNotify = new ArrayList<>();
......@@ -1316,47 +1315,42 @@ public class JGDPStatisticsServiceImpl {
* 9000 客运索道
*/
for (int i = 0; i < xDataList.size(); i++) {
if (i == 0) {
installNotify.add(installCountMap.getOrDefault("2300", 0));
transformNotify.add(reformCountMap.getOrDefault("2300", 0));
maintainNotify.add(maintenanceCountMap.getOrDefault("2300", 0));
transloadingNotify.add(transferCountMap.getOrDefault("2300", 0));
} else if (i == 1) {
if (i == 0) {
installNotify.add(installCountMap.getOrDefault("3000", 0));
transformNotify.add(reformCountMap.getOrDefault("3000", 0));
maintainNotify.add(maintenanceCountMap.getOrDefault("3000", 0));
transloadingNotify.add(transferCountMap.getOrDefault("3000", 0));
} else if (i == 2) {
} else if (i == 1) {
installNotify.add(installCountMap.getOrDefault("2000", 0));
transformNotify.add(reformCountMap.getOrDefault("2000", 0));
maintainNotify.add(maintenanceCountMap.getOrDefault("2000", 0));
transloadingNotify.add(transferCountMap.getOrDefault("2000", 0));
} else if (i == 3) {
} else if (i == 2) {
installNotify.add(installCountMap.getOrDefault("1000", 0));
transformNotify.add(reformCountMap.getOrDefault("1000", 0));
maintainNotify.add(maintenanceCountMap.getOrDefault("1000", 0));
transloadingNotify.add(transferCountMap.getOrDefault("1000", 0));
} else if (i == 4) {
} else if (i == 3) {
installNotify.add(installCountMap.getOrDefault("4000", 0));
transformNotify.add(reformCountMap.getOrDefault("4000", 0));
maintainNotify.add(maintenanceCountMap.getOrDefault("4000", 0));
transloadingNotify.add(transferCountMap.getOrDefault("4000", 0));
} else if (i == 5) {
} else if (i == 4) {
installNotify.add(installCountMap.getOrDefault("5000", 0));
transformNotify.add(reformCountMap.getOrDefault("5000", 0));
maintainNotify.add(maintenanceCountMap.getOrDefault("5000", 0));
transloadingNotify.add(transferCountMap.getOrDefault("5000", 0));
} else if (i == 6) {
} else if (i == 5) {
installNotify.add(installCountMap.getOrDefault("6000", 0));
transformNotify.add(reformCountMap.getOrDefault("6000", 0));
maintainNotify.add(maintenanceCountMap.getOrDefault("6000", 0));
transloadingNotify.add(transferCountMap.getOrDefault("6000", 0));
} else if (i == 7) {
} else if (i == 6) {
installNotify.add(installCountMap.getOrDefault("8000", 0));
transformNotify.add(reformCountMap.getOrDefault("8000", 0));
maintainNotify.add(maintenanceCountMap.getOrDefault("8000", 0));
transloadingNotify.add(transferCountMap.getOrDefault("8000", 0));
} else if (i == 8) {
} else if (i == 7) {
installNotify.add(installCountMap.getOrDefault("9000", 0));
transformNotify.add(reformCountMap.getOrDefault("9000", 0));
maintainNotify.add(maintenanceCountMap.getOrDefault("9000", 0));
......@@ -1675,4 +1669,92 @@ public class JGDPStatisticsServiceImpl {
return resultList;
}
public Map<String, Object> JGCenterMapCountForGlobal(DPFilterParamDto dpFilterParamDto) {
Map<String, Object> result = new HashMap<>();
String orgCode = this.getAndSetOrgCode(dpFilterParamDto.getCityCode());
if (StringUtils.isEmpty(orgCode)) {
return new HashMap<>();
}
// 0.气瓶数量统计
long cylinderNum = this.staticsCenterMapCountDataForCylinder(result, orgCode);
// 1.8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
this.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode);
// 2.压力管道长度统计
this.staticsCenterMapCountDataForPipeline(result, orgCode);
// 3.已纳管设备总数
this.staticsCenterMapCountDataForEquipIsManage(result, orgCode);
// 4.登记证总数
this.staticsCenterMapCountCertificate(result, orgCode);
// 5.超过15年电梯数量
this.staticsCenterMapCountDataForOver15Years(result, orgCode);
// 6.使用登记办理量
this.staticsCenterMapCountDataForUseReg(result, orgCode);
// 7.施工告知办理量
this.staticsCenterMapCountDataForConstructionNotice(result, orgCode);
// 8.变更办理量
this.staticsCenterMapCountDataForChange(result, orgCode);
return result;
}
private void staticsCenterMapCountDataForChange(Map<String, Object> result, String orgCode) {
Long num = dpStatisticsMapper.changeCountByOrgCode(orgCode);
result.put(DPMapStatisticsItemEnum.CHANGE_COUNT.getCode(), num);
}
private void staticsCenterMapCountDataForConstructionNotice(Map<String, Object> result, String orgCode) {
Long num = dpStatisticsMapper.constructionNoticeCount(orgCode);
result.put(DPMapStatisticsItemEnum.CONSTRUCTION_NOTICE_COUNT.getCode(), num);
}
private void staticsCenterMapCountDataForOver15Years(Map<String, Object> result, String orgCode) {
String time = LocalDate.now().minusYears(15).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
Long num = dpStatisticsMapper.over15yearsCount(orgCode,time);
result.put(DPMapStatisticsItemEnum.OVER15YEARS_ELEVATORS.getCode(), num);
}
private void staticsCenterMapCountDataForUseReg(Map<String, Object> result, String orgCode) {
//使用告知
long num = dpStatisticsMapper.useCountByOrgCode(orgCode);
result.put(DPMapStatisticsItemEnum.USE_REGISTRATION_COUNT.getCode(), num);
}
private void staticsCenterMapCountCertificate(Map<String, Object> result, String orgCode) {
long num = dpStatisticsMapper.certificateCountByOrgCode(orgCode);
result.put(DPMapStatisticsItemEnum.CERTIFICATE_COUNT.getCode(), num);
}
private void staticsCenterMapCountDataForEquipIsManage(Map<String, Object> result, String orgCode) {
long num = 0;
CountRequest request = new CountRequest();
request.indices("idx_biz_view_jg_all");
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
// 按照管辖机构区域信息模糊查询
boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", QueryParser.escape(orgCode) + "*"));
// 设备类别精确查询气瓶
boolMust.must(QueryBuilders.termQuery("IS_INTO_MANAGEMENT", true));
request.query(boolMust);
try {
CountResponse response = restHighLevelClient.count(request, RequestOptions.DEFAULT);
num = response.getCount();
} catch (IOException e) {
throw new RuntimeException(e);
}
result.put(DPMapStatisticsItemEnum.DEVICE_COUNT.getCode(), num);
}
public List<Map<String, Object>> JGCenterMapCountForOverview(DPFilterParamDto dpFilterParamDto) {
List<RegionModel> regionModels = this.setRegionIfRootParent(dpFilterParamDto);
List<Map<String, Object>> result = regionModels.parallelStream().map(r -> {
DPFilterParamDto filterParamDto = new DPFilterParamDto();
filterParamDto.setCityCode(r.getRegionCode().toString());
Map<String, Object> itemResult = JGCenterMapCountForGlobal(filterParamDto);
itemResult.put("regionCode", r.getRegionCode());
itemResult.put("regionName", r.getRegionName());
return itemResult;
}).collect(Collectors.toList());
return result;
}
}
......@@ -10,6 +10,7 @@ import org.springframework.stereotype.Service;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
/**
* @author Administrator
......@@ -78,4 +79,9 @@ public class StCommonServiceImpl {
}
return regionList;
}
public List<String> buildXData(List<RegionModel> regionList) {
return regionList.stream().map(RegionModel::getRegionName).collect(Collectors.toList());
}
}
......@@ -2,8 +2,22 @@
"name": "企业模板",
"tabs": [
{
"key": "basic",
"key": "keyinfo",
"displayName": "基本信息",
"renderType": "keyinfo",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/tcm/baseEnterprise/getInfoByUseCode/map",
"params": {
"useCode": "{useUnitCode}"
}
}
}
},
{
"key": "basic",
"displayName": "详细信息",
"renderType": "basic",
"formSeq": "1793454184889085953",
"dataConfig": {
......@@ -31,7 +45,7 @@
"key": "devtable",
"displayName": "设备列表",
"renderType": "table",
"formSeq": "",
"useAloneApi": true,
"dataConfig": {
"api": {
"httpMethod":"GET",
......@@ -59,6 +73,24 @@
}
],
"content": {
"keyinfo": {
"status": [],
"qrcode": {
"title": "监管码",
"problem": []
},
"keyParams": [
{ "key": "unitType", "label": "单位类型" },
{ "key": "useUnit", "label": "单位名称" },
{ "key": "useUnitCode", "label": "证件号码" },
{ "key": "governingBody", "label": "管辖机构" },
{ "key": "address", "label": "地址" },
{ "key": "legalPerson", "label": "法人" },
{ "key": "useContact", "label": "单位联系人" },
{ "key": "contactPhone", "label": "联系电话" },
{ "key": "keyUnit", "label": "是否重点监控单位" }
]
},
"basic": {
"columns": 2,
"datas": [],
......
{
"tabs": [
{
"key": "keyinfo",
"displayName": "基本信息",
"renderType": "keyinfo",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/elevator/alert-called/detail/{id}"
}
}
}
],
"content": {
}
}
......@@ -2,8 +2,23 @@
"name": "设备-锅炉",
"tabs": [
{
"key": "keyinfo",
"displayName": "基本信息",
"renderType": "keyinfo",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/ymt/equipment-category/getFormRecordById/map",
"params": {
"alias": "{EQU_LIST_CODE}",
"id": "{SEQUENCE_NBR}"
}
}
}
},
{
"key": "basic",
"displayName": "设备信息",
"displayName": "详细信息",
"renderType": "basic",
"formSeq": "1793458381554479105",
"dataConfig": {
......@@ -70,7 +85,7 @@
"key": "reghistory",
"displayName": "监管履历信息",
"renderType": "timeline",
"formSeq": "",
"useAloneApi": true,
"dataConfig": {
"api": {
"httpMethod":"GET",
......@@ -89,7 +104,7 @@
"key": "devtable",
"displayName": "问题列表",
"renderType": "table",
"formSeq": "",
"useAloneApi": true,
"dataConfig": {
"api": {
"httpMethod":"GET",
......@@ -118,6 +133,33 @@
}
],
"content": {
"keyinfo": {
"status": [],
"qrcode": {
"title": "监管码",
"problem": []
},
"keyParams": [
{ "key": "USE_ORG_CODE", "label": "使用登记证编号" },
{ "key": "ORG_BRANCH_NAME", "label": "登记机关" },
{ "key": "REC_DATE", "label": "登记日期" },
{ "key": "USE_UNIT_NAME", "label": "使用单位名称" },
{ "key": "ADDRESS", "label": "设备使用地点" },
{ "key": "EQU_TYPE", "label": "设备种类", "source": "param" },
{ "key": "EQU_LIST", "label": "设备类别", "source": "param" },
{ "key": "EQU_CATEGORY", "label": "设备品种", "source": "param" },
{ "key": "USE_INNER_CODE", "label": "单位内编号" },
{ "key": "PRODUCE_UNIT_CREDIT_CODE", "label": "设备代码" },
{ "key": "NEXT_INSPECT_DATE", "label": "下一次检验日期" }
],
"infoRecords": {
"title": "监管记录",
"renderType": "timeline",
"showMore": true,
"moreKey": "reghistory",
"datas": []
}
},
"basic": {
"columns": 3,
"datas": [],
......
......@@ -2,8 +2,23 @@
"name": "设备-压力容器",
"tabs": [
{
"key": "keyinfo",
"displayName": "基本信息",
"renderType": "keyinfo",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/ymt/equipment-category/getFormRecordById/map",
"params": {
"alias": "{EQU_LIST_CODE}",
"id": "{SEQUENCE_NBR}"
}
}
}
},
{
"key": "basic",
"displayName": "设备信息",
"displayName": "详细信息",
"renderType": "basic",
"formSeq": "1793458381554479105",
"dataConfig": {
......@@ -74,7 +89,7 @@
"key": "reghistory",
"displayName": "监管履历信息",
"renderType": "timeline",
"formSeq": "",
"useAloneApi": true,
"dataConfig": {
"api": {
"httpMethod":"GET",
......@@ -93,7 +108,7 @@
"key": "devtable",
"displayName": "问题列表",
"renderType": "table",
"formSeq": "",
"useAloneApi": true,
"dataConfig": {
"api": {
"httpMethod":"GET",
......@@ -122,6 +137,56 @@
}
],
"content": {
"keyinfo": {
"status": [],
"qrcode": {
"title": "监管码",
"problem": []
},
"keyParams_default": [
{ "key": "USE_ORG_CODE", "label": "使用登记证编号" },
{ "key": "ORG_BRANCH_NAME", "label": "登记机关" },
{ "key": "REC_DATE", "label": "登记日期" },
{ "key": "USE_UNIT_NAME", "label": "使用单位名称" },
{ "key": "ADDRESS", "label": "设备使用地点" },
{ "key": "EQU_TYPE", "label": "设备种类", "source": "param" },
{ "key": "EQU_LIST", "label": "设备类别", "source": "param" },
{ "key": "EQU_CATEGORY", "label": "设备品种", "source": "param" },
{ "key": "USE_INNER_CODE", "label": "单位内编号" },
{ "key": "PRODUCE_UNIT_CREDIT_CODE", "label": "设备代码" },
{ "key": "NEXT_INSPECT_DATE", "label": "下一次检验日期" }
],
"keyParams_2300_true": [
{ "key": "USE_ORG_CODE", "label": "使用登记证编号" },
{ "key": "ORG_BRANCH_NAME", "label": "登记机关" },
{ "key": "REC_DATE", "label": "登记日期" },
{ "key": "USE_UNIT_NAME", "label": "使用单位名称" },
{ "key": "ADDRESS", "label": "设备使用地点" },
{ "key": "EQU_LIST", "label": "设备类别", "source": "param" },
{ "key": "NEXT_INSPECT_DATE", "label": "下一次检验日期" }
],
"keyParams_2300_false": [
{ "key": "USE_ORG_CODE", "label": "使用登记证编号" },
{ "key": "ORG_BRANCH_NAME", "label": "登记机关" },
{ "key": "REC_DATE", "label": "登记日期" },
{ "key": "USE_UNIT_NAME", "label": "使用单位名称" },
{ "key": "ADDRESS", "label": "设备使用地点" },
{ "key": "CAR_NUMBER", "label": "车牌号" },
{ "key": "IDENTIFICATION_CODE", "label": "车辆VIN码" },
{ "key": "EQU_TYPE", "label": "气瓶品种" },
{ "key": "PRODUCT_NAME", "label": "产品名称" },
{ "key": "GAS_NUM", "label": "气瓶数量" },
{ "key": "FILLING_MEDIUM", "label": "充装介质" },
{ "key": "NEXT_INSPECTION_DATE", "label": "下次检验日期" }
],
"infoRecords": {
"title": "监管记录",
"renderType": "timeline",
"showMore": true,
"moreKey": "reghistory",
"datas": []
}
},
"basic": {
"columns": 3,
"datas": [],
......
......@@ -2,8 +2,23 @@
"name": "设备-电梯",
"tabs": [
{
"key": "keyinfo",
"displayName": "基本信息",
"renderType": "keyinfo",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/ymt/equipment-category/getFormRecordById/map",
"params": {
"alias": "{EQU_LIST_CODE}",
"id": "{SEQUENCE_NBR}"
}
}
}
},
{
"key": "basic",
"displayName": "设备信息",
"displayName": "详细信息",
"renderType": "basic",
"formSeq": "1793458381554479105",
"dataConfig": {
......@@ -70,7 +85,7 @@
"key": "reghistory",
"displayName": "监管履历信息",
"renderType": "timeline",
"formSeq": "",
"useAloneApi": true,
"dataConfig": {
"api": {
"httpMethod":"GET",
......@@ -89,7 +104,7 @@
"key": "devtable",
"displayName": "问题列表",
"renderType": "table",
"formSeq": "",
"useAloneApi": true,
"dataConfig": {
"api": {
"httpMethod":"GET",
......@@ -118,6 +133,35 @@
}
],
"content": {
"keyinfo": {
"status": [],
"qrcode": {
"title": "监管码",
"problem": []
},
"keyParams": [
{ "key": "USE_ORG_CODE", "label": "使用登记证编号" },
{ "key": "ORG_BRANCH_NAME", "label": "登记机关" },
{ "key": "REC_DATE", "label": "登记日期" },
{ "key": "USE_UNIT_NAME", "label": "使用单位名称" },
{ "key": "ADDRESS", "label": "设备使用地点" },
{ "key": "EQU_TYPE", "label": "设备种类", "source": "param" },
{ "key": "EQU_LIST", "label": "设备类别", "source": "param" },
{ "key": "EQU_CATEGORY", "label": "设备品种", "source": "param" },
{ "key": "USE_INNER_CODE", "label": "单位内编号" },
{ "key": "PRODUCE_UNIT_CREDIT_CODE", "label": "设备代码" },
{ "key": "ME_UNIT_NAME", "label": "维保单位名称" },
{ "key": "INFORM_END", "label": "维保备案有效期" },
{ "key": "NEXT_INSPECT_DATE", "label": "下一次检验日期" }
],
"infoRecords": {
"title": "监管记录",
"renderType": "timeline",
"showMore": true,
"moreKey": "reghistory",
"datas": []
}
},
"basic": {
"columns": 3,
"datas": [],
......
......@@ -2,8 +2,23 @@
"name": "设备-起重机械",
"tabs": [
{
"key": "keyinfo",
"displayName": "基本信息",
"renderType": "keyinfo",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/ymt/equipment-category/getFormRecordById/map",
"params": {
"alias": "{EQU_LIST_CODE}",
"id": "{SEQUENCE_NBR}"
}
}
}
},
{
"key": "basic",
"displayName": "设备信息",
"displayName": "详细信息",
"renderType": "basic",
"formSeq": "1793458381554479105",
"dataConfig": {
......@@ -66,7 +81,7 @@
"key": "reghistory",
"displayName": "监管履历信息",
"renderType": "timeline",
"formSeq": "",
"useAloneApi": true,
"dataConfig": {
"api": {
"httpMethod":"GET",
......@@ -85,7 +100,7 @@
"key": "devtable",
"displayName": "问题列表",
"renderType": "table",
"formSeq": "",
"useAloneApi": true,
"dataConfig": {
"api": {
"httpMethod":"GET",
......@@ -114,6 +129,33 @@
}
],
"content": {
"keyinfo": {
"status": [],
"qrcode": {
"title": "监管码",
"problem": []
},
"keyParams": [
{ "key": "USE_ORG_CODE", "label": "使用登记证编号" },
{ "key": "ORG_BRANCH_NAME", "label": "登记机关" },
{ "key": "REC_DATE", "label": "登记日期" },
{ "key": "USE_UNIT_NAME", "label": "使用单位名称" },
{ "key": "ADDRESS", "label": "设备使用地点" },
{ "key": "EQU_TYPE", "label": "设备种类", "source": "param" },
{ "key": "EQU_LIST", "label": "设备类别", "source": "param" },
{ "key": "EQU_CATEGORY", "label": "设备品种", "source": "param" },
{ "key": "USE_INNER_CODE", "label": "单位内编号" },
{ "key": "PRODUCE_UNIT_CREDIT_CODE", "label": "设备代码" },
{ "key": "NEXT_INSPECT_DATE", "label": "下一次检验日期" }
],
"infoRecords": {
"title": "监管记录",
"renderType": "timeline",
"showMore": true,
"moreKey": "reghistory",
"datas": []
}
},
"basic": {
"columns": 3,
"datas": [],
......
......@@ -2,8 +2,23 @@
"name": "设备-场(厂)内机动车",
"tabs": [
{
"key": "keyinfo",
"displayName": "基本信息",
"renderType": "keyinfo",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/ymt/equipment-category/getFormRecordById/map",
"params": {
"alias": "{EQU_LIST_CODE}",
"id": "{SEQUENCE_NBR}"
}
}
}
},
{
"key": "basic",
"displayName": "设备信息",
"displayName": "详细信息",
"renderType": "basic",
"formSeq": "1793458381554479105",
"dataConfig": {
......@@ -62,7 +77,7 @@
"key": "reghistory",
"displayName": "监管履历信息",
"renderType": "timeline",
"formSeq": "",
"useAloneApi": true,
"dataConfig": {
"api": {
"httpMethod":"GET",
......@@ -81,7 +96,7 @@
"key": "devtable",
"displayName": "问题列表",
"renderType": "table",
"formSeq": "",
"useAloneApi": true,
"dataConfig": {
"api": {
"httpMethod":"GET",
......@@ -110,6 +125,33 @@
}
],
"content": {
"keyinfo": {
"status": [],
"qrcode": {
"title": "监管码",
"problem": []
},
"keyParams": [
{ "key": "USE_ORG_CODE", "label": "使用登记证编号" },
{ "key": "ORG_BRANCH_NAME", "label": "登记机关" },
{ "key": "REC_DATE", "label": "登记日期" },
{ "key": "USE_UNIT_NAME", "label": "使用单位名称" },
{ "key": "ADDRESS", "label": "设备使用地点" },
{ "key": "EQU_TYPE", "label": "设备种类", "source": "param" },
{ "key": "EQU_LIST", "label": "设备类别", "source": "param" },
{ "key": "EQU_CATEGORY", "label": "设备品种", "source": "param" },
{ "key": "USE_INNER_CODE", "label": "单位内编号" },
{ "key": "PRODUCE_UNIT_CREDIT_CODE", "label": "设备代码" },
{ "key": "NEXT_INSPECT_DATE", "label": "下一次检验日期" }
],
"infoRecords": {
"title": "监管记录",
"renderType": "timeline",
"showMore": true,
"moreKey": "reghistory",
"datas": []
}
},
"basic": {
"columns": 3,
"datas": [],
......
......@@ -2,8 +2,23 @@
"name": "设备-大型游乐设施",
"tabs": [
{
"key": "keyinfo",
"displayName": "基本信息",
"renderType": "keyinfo",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/ymt/equipment-category/getFormRecordById/map",
"params": {
"alias": "{EQU_LIST_CODE}",
"id": "{SEQUENCE_NBR}"
}
}
}
},
{
"key": "basic",
"displayName": "设备信息",
"displayName": "详细信息",
"renderType": "basic",
"formSeq": "1793458381554479105",
"dataConfig": {
......@@ -56,7 +71,7 @@
"key": "reghistory",
"displayName": "监管履历信息",
"renderType": "timeline",
"formSeq": "",
"useAloneApi": true,
"dataConfig": {
"api": {
"httpMethod":"GET",
......@@ -75,7 +90,7 @@
"key": "devtable",
"displayName": "问题列表",
"renderType": "table",
"formSeq": "",
"useAloneApi": true,
"dataConfig": {
"api": {
"httpMethod":"GET",
......@@ -104,6 +119,33 @@
}
],
"content": {
"keyinfo": {
"status": [],
"qrcode": {
"title": "监管码",
"problem": []
},
"keyParams": [
{ "key": "USE_ORG_CODE", "label": "使用登记证编号" },
{ "key": "ORG_BRANCH_NAME", "label": "登记机关" },
{ "key": "REC_DATE", "label": "登记日期" },
{ "key": "USE_UNIT_NAME", "label": "使用单位名称" },
{ "key": "ADDRESS", "label": "设备使用地点" },
{ "key": "EQU_TYPE", "label": "设备种类", "source": "param" },
{ "key": "EQU_LIST", "label": "设备类别", "source": "param" },
{ "key": "EQU_CATEGORY", "label": "设备品种", "source": "param" },
{ "key": "USE_INNER_CODE", "label": "单位内编号" },
{ "key": "PRODUCE_UNIT_CREDIT_CODE", "label": "设备代码" },
{ "key": "NEXT_INSPECT_DATE", "label": "下一次检验日期" }
],
"infoRecords": {
"title": "监管记录",
"renderType": "timeline",
"showMore": true,
"moreKey": "reghistory",
"datas": []
}
},
"basic": {
"columns": 3,
"datas": [],
......
......@@ -2,8 +2,23 @@
"name": "设备-压力管道",
"tabs": [
{
"key": "keyinfo",
"displayName": "基本信息",
"renderType": "keyinfo",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/ymt/equipment-category/getFormRecordById/map",
"params": {
"alias": "{EQU_LIST_CODE}",
"id": "{SEQUENCE_NBR}"
}
}
}
},
{
"key": "basic",
"displayName": "设备信息",
"displayName": "详细信息",
"renderType": "basic",
"formSeq": "1793458381554479105",
"dataConfig": {
......@@ -62,7 +77,7 @@
"key": "reghistory",
"displayName": "监管履历信息",
"renderType": "timeline",
"formSeq": "",
"useAloneApi": true,
"dataConfig": {
"api": {
"httpMethod":"GET",
......@@ -81,7 +96,7 @@
"key": "devtable",
"displayName": "问题列表",
"renderType": "table",
"formSeq": "",
"useAloneApi": true,
"dataConfig": {
"api": {
"httpMethod":"GET",
......@@ -110,6 +125,42 @@
}
],
"content": {
"keyinfo": {
"status": [],
"qrcode": {
"title": "监管码",
"problem": []
},
"keyParams_default": [
{ "key": "USE_ORG_CODE", "label": "使用登记证编号" },
{ "key": "ORG_BRANCH_NAME", "label": "登记机关" },
{ "key": "REC_DATE", "label": "登记日期" },
{ "key": "USE_UNIT_NAME", "label": "使用单位名称" },
{ "key": "ADDRESS", "label": "设备使用地点" },
{ "key": "EQU_TYPE", "label": "设备种类", "source": "param" },
{ "key": "EQU_LIST", "label": "设备类别", "source": "param" },
{ "key": "EQU_CATEGORY", "label": "设备品种", "source": "param" },
{ "key": "USE_INNER_CODE", "label": "单位内编号" },
{ "key": "PRODUCE_UNIT_CREDIT_CODE", "label": "设备代码" },
{ "key": "NEXT_INSPECT_DATE", "label": "下一次检验日期" }
],
"keyParams_8300": [
{ "key": "USE_ORG_CODE", "label": "使用登记证编号" },
{ "key": "ORG_BRANCH_NAME", "label": "登记机关" },
{ "key": "REC_DATE", "label": "登记日期" },
{ "key": "USE_UNIT_NAME", "label": "使用单位名称" },
{ "key": "ADDRESS", "label": "设备使用地点" },
{ "key": "EQU_LIST", "label": "设备类别", "source": "param" },
{ "key": "NEXT_INSPECT_DATE", "label": "下一次检验日期" }
],
"infoRecords": {
"title": "监管记录",
"renderType": "timeline",
"showMore": true,
"moreKey": "reghistory",
"datas": []
}
},
"basic": {
"columns": 3,
"datas": [],
......
......@@ -2,8 +2,23 @@
"name": "设备-客运索道",
"tabs": [
{
"key": "keyinfo",
"displayName": "基本信息",
"renderType": "keyinfo",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/ymt/equipment-category/getFormRecordById/map",
"params": {
"alias": "{EQU_LIST_CODE}",
"id": "{SEQUENCE_NBR}"
}
}
}
},
{
"key": "basic",
"displayName": "设备信息",
"displayName": "详细信息",
"renderType": "basic",
"formSeq": "1793458381554479105",
"dataConfig": {
......@@ -62,7 +77,7 @@
"key": "reghistory",
"displayName": "监管履历信息",
"renderType": "timeline",
"formSeq": "",
"useAloneApi": true,
"dataConfig": {
"api": {
"httpMethod":"GET",
......@@ -81,7 +96,7 @@
"key": "devtable",
"displayName": "问题列表",
"renderType": "table",
"formSeq": "",
"useAloneApi": true,
"dataConfig": {
"api": {
"httpMethod":"GET",
......@@ -110,6 +125,33 @@
}
],
"content": {
"keyinfo": {
"status": [],
"qrcode": {
"title": "监管码",
"problem": []
},
"keyParams": [
{ "key": "USE_ORG_CODE", "label": "使用登记证编号" },
{ "key": "ORG_BRANCH_NAME", "label": "登记机关" },
{ "key": "REC_DATE", "label": "登记日期" },
{ "key": "USE_UNIT_NAME", "label": "使用单位名称" },
{ "key": "ADDRESS", "label": "设备使用地点" },
{ "key": "EQU_TYPE", "label": "设备种类", "source": "param" },
{ "key": "EQU_LIST", "label": "设备类别", "source": "param" },
{ "key": "EQU_CATEGORY", "label": "设备品种", "source": "param" },
{ "key": "USE_INNER_CODE", "label": "单位内编号" },
{ "key": "PRODUCE_UNIT_CREDIT_CODE", "label": "设备代码" },
{ "key": "NEXT_INSPECT_DATE", "label": "下一次检验日期" }
],
"infoRecords": {
"title": "监管记录",
"renderType": "timeline",
"showMore": true,
"moreKey": "reghistory",
"datas": []
}
},
"basic": {
"columns": 3,
"datas": [],
......
{
"name": "问题模板",
"tabs": [
{
"key": "keyinfo",
"displayName": "基本信息",
"renderType": "keyinfo",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/jg/safety-problem-tracing/{sequenceNbr}",
"params": {
"sequenceNbr": "{sequenceNbr}"
}
}
}
},
{
"key": "devtable",
"displayName": "关联设备",
"renderType": "table",
"formSeq": "",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/jg/safety-problem-tracing/equip/list",
"params": {
"number": 1,
"size": 14,
"sequenceNbr": "{sequenceNbr}"
}
}
},
"visualParams": {
"rowKey": "record",
"columns": [
{"dataRenderingMode": "defaultText","dataIndex": "problemStatusName","width": 150,"align": "left","title": "状态","key": "AA6DE857-C788-494F-8F16-2ECFC7E34528"},
{"dataRenderingMode": "defaultText","dataIndex": "equList","width": 160,"align": "left","title": "设备种类","key": "611DAF3D-5B79-466C-BEF2-CC91580091FA"},
{"dataRenderingMode": "defaultText","dataIndex": "equCategory","width": 150,"align": "left","title": "设备类别","key": "D1CB84A4-E037-446A-9469-65B76E381585"},
{"dataRenderingMode": "defaultText","dataIndex": "supervisoryCode","width": 180,"align": "left","title": "监管码","key": "0BB7318F-5134-42B6-A835-FC86D68066C2"},
{"dataRenderingMode": "defaultText","dataIndex": "code96333","width": 180,"align": "left","title": "96333码","key": "6EB924FB-EFEA-4779-ADF8-78F310818D2D"},
{"dataRenderingMode": "defaultText","dataIndex": "useUnitName","width": 180,"align": "left","title": "主体单位","key": "87C53BEA-829C-4539-9FCA-E2AF6A53DA15"}
]
}
},
{
"key": "devtable1",
"displayName": "关联企业",
"renderType": "table",
"formSeq": "",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/jg/safety-problem-tracing/unit/list",
"params": {
"number": 1,
"size": 14,
"sequenceNbr": "{sequenceNbr}"
}
}
},
"visualParams": {
"rowKey": "record",
"columns": [
{"dataRenderingMode": "defaultText","dataIndex": "problemStatusName","width": 150,"align": "left","title": "状态","key": "AA6DE857-C788-494F-8F16-2ECFC7E34528"},
{"dataRenderingMode": "defaultText","dataIndex": "governingBody","width": 160,"align": "left","title": "企业名称","key": "611DAF3D-5B79-466C-BEF2-CC91580091FA"},
{"dataRenderingMode": "defaultText","dataIndex": "unitType","width": 150,"align": "left","title": "企业类型","key": "D1CB84A4-E037-446A-9469-65B76E381585"},
{"dataRenderingMode": "defaultText","dataIndex": "useUnitCode","width": 180,"align": "left","title": "企业统一信用代码","key": "0BB7318F-5134-42B6-A835-FC86D68066C2"},
{"dataRenderingMode": "defaultText","dataIndex": "useContact","width": 180,"align": "left","title": "企业联系人","key": "6EB924FB-EFEA-4779-ADF8-78F310818D2D"},
{"dataRenderingMode": "defaultText","dataIndex": "contactPhone","width": 180,"align": "left","title": "联系电话","key": "87C53BEA-829C-4539-9FCA-E2AF6A53DA15"}
]
}
}
],
"content": {
"keyinfo": {
"keyParams": [
{ "key": "sourceType", "label": "问题主体类型" },
{ "key": "problemType", "label": "问题类型" },
{ "key": "problemDesc", "label": "问题描述" },
{ "key": "problemTime", "label": "问题时间" },
{ "key": "problemLevel", "label": "问题等级", "value": "重大" },
{ "key": "principalUnit", "label": "主体单位" },
{ "key": "principalUnitType", "label": "单位类型" },
{ "key": "governingBody", "label": "管辖机构" },
{ "key": "governingBodyCode", "label": "所属区域" },
{ "key": "problemStatus", "label": "问题状态" },
{ "key": "equipSuperviseCode", "label": "监管吗" },
{ "key": "equipList", "label": "设备种类" }
]
},
"basic": {
"columns": 2,
"datas": [],
"qrcode": {},
"subs": []
}
}
}
\ No newline at end of file
......@@ -2,8 +2,9 @@ package com.yeejoin.amos.boot.module.ymt.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.ymt.api.entity.EquipTechParamPipeline;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface EquipTechParamPipelineMapper extends BaseMapper<EquipTechParamPipeline> {
/**
* 在用的最新需求整理的技术参数--需求未出
......
......@@ -7,6 +7,7 @@ import com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.UseUnitCreditCodeCategoryDto;
import com.yeejoin.amos.boot.module.ymt.api.vo.EquipExportVo;
import com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
......@@ -19,6 +20,7 @@ import java.util.Map;
* @author system_generator
* @date 2021-10-20
*/
@Mapper
public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> {
@Select("select * from tz_equipment_category where code in('1000','2000','3000','4000','5000','6000','8000','9000')")
......
......@@ -17,7 +17,7 @@ import java.util.Map;
public interface IdxBizJgRegisterInfoMapper extends BaseMapper<IdxBizJgRegisterInfo> {
@Select("select \"USE_ORG_CODE\" from idx_biz_jg_register_info where \"RECORD\" = #{equipCode}")
String getUseOrgCodeByEquip(@Param("equipCode") String equipCode);
String getUseOrgCodeByEquip(@Param("equipCode") String equipCode);
@Select("update idx_biz_jg_register_info set \"USE_ORG_CODE\" = #{useOrgCode} where \"RECORD\" = #{equipCode}")
Boolean updateUseOrgCodeByEquip(@Param("equipCode") String equipCode,@Param("useOrgCode") String useOrgCode);
......@@ -32,15 +32,20 @@ public interface IdxBizJgRegisterInfoMapper extends BaseMapper<IdxBizJgRegisterI
List<Map<String, Object>> esSynchronousProjectContraption();
@Select("SELECT\n" +
"\tjui.PROJECT_CONTRAPTION AS value \n" +
"\tjui.PROJECT_CONTRAPTION AS value,\n" +
"\ttjur.use_registration_code\n" +
"FROM\n" +
"\tidx_biz_jg_use_info jui\n" +
"\tLEFT JOIN idx_biz_jg_register_info jri ON jri.\"RECORD\" = jui.\"RECORD\"\n" +
"\tLEFT JOIN tzs_jg_use_registration_eq tjure ON tjure.\"equ_id\" = jui.\"RECORD\"\n" +
"\tLEFT JOIN tzs_jg_use_registration tjur ON tjure.\"equip_transfer_id\" = tjur.\"sequence_nbr\"\n" +
"WHERE\n" +
"\tjui.USE_UNIT_CREDIT_CODE = #{useUnitCreditCode} \n" +
"\tjui.USE_UNIT_CREDIT_CODE = #{useUnitCreditCode}\n" +
"\tAND jui.PROJECT_CONTRAPTION IS NOT NULL\n" +
"\tAND jri.\"USE_ORG_CODE\" IS NULL\n" +
"\tAND tjur.use_registration_code IS NULL\n" +
"\tAND tjur.status <> '已完成'\n" +
"GROUP BY\n" +
"\tjui.PROJECT_CONTRAPTION")
List<Map<String, Object>> getUnRegisterProjectContraptionList(String useUnitCreditCode);
List<Map<String, Object>> getProjectContraptionList(String useUnitCreditCode);
}
......@@ -7,6 +7,7 @@ import com.yeejoin.amos.boot.biz.common.dto.CountDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.EquEnterDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseEnterpriseInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzBaseEnterpriseInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -17,6 +18,7 @@ import java.util.List;
* @author duanwei
* @date 2022-08-10
*/
@Mapper
public interface TzBaseEnterpriseInfoMapper extends BaseMapper<TzBaseEnterpriseInfo> {
/**
......
......@@ -4,8 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.ymt.api.dto.TzsUserInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzsUserInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface TzsUserInfoMapper extends BaseMapper<TzsUserInfo> {
Page<TzsUserInfoDto> selectPageMessage(@Param("page") Page<TzsUserInfoDto> page, @Param("dto") TzsUserInfoDto dto);
......
......@@ -146,16 +146,17 @@
SELECT
count(1)
FROM
tz_base_enterprise_info u
tz_base_enterprise_info u
RIGHT JOIN tzs_user_info ui ON ui.unit_code = u.use_unit_code
WHERE
u.data_sources = '陕西省内企业'
AND u.unit_type LIKE'%充装单位%'
AND ui.post like '%6552%'
u.data_sources = '陕西省内企业'
AND u.unit_type LIKE'%充装单位%'
AND ui.post like '%6552%'
and ui.is_delete = false
<if test="orgCodes != null and orgCodes.size > 0">
AND
<foreach collection="orgCodes" open="(" item="orgCode" close=")" separator=" or ">
(u.org_code like concat(#{orgCode}, '%') )
(u.supervise_org_code like concat(#{orgCode}, '%') )
</foreach>
</if>
</select>
......
......@@ -517,9 +517,11 @@
jsi.ORG_BRANCH_NAME,
joi.SUPERVISORY_CODE,
jsi.RECORD as id,
jsi.SEQUENCE_NBR as sequenceNbr
jsi.SEQUENCE_NBR as sequenceNbr,
jfi.PRODUCE_DATE as produceDate
from idx_biz_jg_supervision_info jsi
LEFT JOIN idx_biz_jg_other_info joi on jsi."RECORD" = joi."RECORD"
LEFT JOIN idx_biz_jg_factory_info jfi on jsi."RECORD" = jfi."RECORD"
WHERE jsi.RECORD = #{record}
......
......@@ -26,6 +26,7 @@ import com.yeejoin.amos.boot.module.ymt.api.service.IGenerateCodeService;
import com.yeejoin.amos.boot.module.ymt.api.vo.EquipExportVo;
import com.yeejoin.amos.boot.module.ymt.biz.dao.ESElavtorRepository;
import com.yeejoin.amos.boot.module.ymt.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.ymt.biz.utils.StringUtils;
import com.yeejoin.amos.boot.module.ymt.flc.api.feign.IdxFeignService;
import com.yeejoin.amos.boot.module.ymt.flc.api.feign.PrivilegeFeginService;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
......@@ -72,6 +73,8 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.IOException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
......@@ -930,6 +933,15 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
result.put(equipmentMessage.getDesInfo(), desInfo);
// 监督管理信息
Map<String, Object> supInfo = getSupInfo(map);
if(!ValidationUtil.isEmpty(supInfo.get("produceDate"))){
LocalDate produceDate = LocalDate.parse(supInfo.get("produceDate").toString().substring(0, 10), DateTimeFormatter.ofPattern("yyyy-MM-dd"));
LocalDate localDate = LocalDate.now().minusYears(15);
if(produceDate.isBefore(localDate)){
supInfo.put("OVER_FIFTEEN_YEARS","0");
}else{
supInfo.put("OVER_FIFTEEN_YEARS","1");
}
}
if ("1".equals(useInfo.get("IS_NOT_XIXIAN"))) {
supInfo.put("CITY", "咸阳");
} else {
......
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