Commit ab861d05 authored by Lambertliu's avatar Lambertliu

Merge branch 'refs/heads/develop_tzs_register_0207' into develop_tzs_bugfix

# Conflicts: # amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/DataHandlerServiceImpl.java
parents 3445b022 3a8bd898
......@@ -30,7 +30,7 @@ public class StringUtils {
* @param map
* @return
*/
public static String transMap2UrlParam(Map<String, Object> map) {
public static String transMap2UrlParam(String url,Map<String, Object> map) {
StringBuilder stringBuilder = new StringBuilder();
for (Map.Entry entry : map.entrySet()) {
......@@ -39,11 +39,12 @@ public class StringUtils {
continue;
try {
stringBuilder.append("&").append(entry.getKey()).append("=").append(URLEncoder.encode(entry.getValue().toString(), "UTF-8"));
url = url.replaceAll("\\{"+entry.getKey()+"}",entry.getValue()+"");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
return stringBuilder.toString();
return url + stringBuilder.toString();
}
/**
......@@ -52,16 +53,17 @@ public class StringUtils {
* @param list
* @return
*/
public static String transList2UrlParam(List<Map<String, Object>> list) {
public static String transList2UrlParam(String url,List<Map<String, Object>> list) {
StringBuilder stringBuilder = new StringBuilder();
list.forEach(x -> {
Map<String, Object> map = JSONObject.parseObject(JSON.toJSONString(x));
try {
stringBuilder.append("&").append(map.get("key")).append("=").append(URLEncoder.encode(map.get("value").toString(), "UTF-8"));
url.replaceAll("{"+map.get("key")+"}",map.get("value")+"");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
});
return stringBuilder.toString();
return url + stringBuilder.toString();
}
}
......@@ -4,7 +4,7 @@ import lombok.Data;
@Data
public class CylinderFillingRecordStatisticsDto {
private String time;
private String fillingTime;
private String fillingQuantity;
private String offloadingVolume;
}
package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import org.apache.ibatis.annotations.Select;
import org.checkerframework.checker.index.qual.SameLen;
import java.util.List;
/**
* 用于业务变更过程中的历史数据处理的mapper层
*/
public interface DataHandlerMapper {
@Select("SELECT ui.\"RECORD\" \n" +
"FROM \"amos_tzs_biz\".\"idx_biz_jg_use_info\" ui \n" +
"INNER JOIN \"amos_tzs_biz\".\"idx_biz_jg_register_info\" ri \n" +
" ON ui.\"RECORD\" = ri.\"RECORD\"\n" +
"WHERE ui.\"DATA_SOURCE\" = 'jg_his' \n" +
"AND ui.\"EQU_STATE\" IS NULL \n" +
"AND ri.\"EQU_CATEGORY\" = '2300' \n" +
"AND NOT EXISTS (\n" +
" SELECT 1 \n" +
" FROM amos_tzs_biz.tzs_jg_scrap_cancel_eq sceq\n" +
" INNER JOIN amos_tzs_biz.tzs_jg_scrap_cancel sc \n" +
" ON sceq.\"equip_transfer_id\" = sc.\"sequence_nbr\"\n" +
" WHERE sc.\"audit_status\" = '已完成' \n" +
" AND sceq.\"equ_id\" = ui.\"RECORD\"\n" +
")\n" +
"AND NOT EXISTS (\n" +
" SELECT 1 \n" +
" FROM amos_tzs_biz.tzs_jg_enable_disable_eq edeq\n" +
" INNER JOIN amos_tzs_biz.tzs_jg_enable_disable ed \n" +
" ON edeq.\"enable_disable_apply_id\" = ed.\"sequence_nbr\"\n" +
" WHERE ed.\"audit_status\" = '已完成' \n" +
" AND edeq.\"equ_id\" = ui.\"RECORD\"\n" +
")")
List<String> selectOrdinaryHisGasCylinder();
@Select("SELECT ui.\"RECORD\" \n" +
"FROM \"amos_tzs_biz\".\"idx_biz_jg_use_info\" ui \n" +
"INNER JOIN \"amos_tzs_biz\".\"idx_biz_jg_register_info\" ri \n" +
" ON ui.\"RECORD\" = ri.\"RECORD\"\n" +
"WHERE ui.\"DATA_SOURCE\" = 'jg' \n" +
"AND ui.\"EQU_STATE\" IS NULL \n" +
"AND ri.\"EQU_CATEGORY\" = '2300' \n" +
"AND NOT EXISTS (\n" +
" SELECT 1 \n" +
" FROM amos_tzs_biz.tzs_jg_use_registration_eq ureq\n" +
" INNER JOIN amos_tzs_biz.tzs_jg_use_registration ur \n" +
" ON ureq.\"equip_transfer_id\" = ur.\"sequence_nbr\"\n" +
" WHERE ur.\"status\" = '已完成' \n" +
" AND ureq.\"equ_id\" = ui.\"RECORD\"\n" +
")")
List<String> selectOrdinaryGasCylinder();
}
......@@ -133,6 +133,9 @@
<if test="dto.cityName != null and dto.cityName != ''">
and tjurm.equ_use_address LIKE CONCAT('%', #{dto.cityName}, '%')
</if>
<if test="dto.carNumber != null and dto.carNumber != ''">
and tjurm.car_number LIKE CONCAT('%', #{dto.carNumber}, '%')
</if>
ORDER BY
<if test="sort != null">
tjurm.${sort.field} ${sort.sortType},
......
......@@ -136,4 +136,15 @@ public class DataHandlerController extends BaseController {
public ResponseModel<Boolean> writeProjectContraptionIdInJgUseRegistration() {
return ResponseHelper.buildResponse(dataHandlerService.writeProjectContraptionIdInJgUseRegistration());
}
/**
* BUG 26910 【现场需求】登记证管理中,历史设备登记的普通气瓶,状态为空,新增气瓶的状态为在用
* 将历史导入的普通气瓶和正常导入的普通气瓶刷入设备状态
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "将历史导入的普通气瓶和正常导入的普通气瓶刷入设备状态", notes = "将历史导入的普通气瓶和正常导入的普通气瓶刷入设备状态")
@GetMapping(value = "/ordinaryGasCylinder/equState")
public ResponseModel<String> ordinaryGasCylinderWriteEquState() {
return ResponseHelper.buildResponse(dataHandlerService.ordinaryGasCylinderWriteEquState());
}
}
......@@ -130,11 +130,13 @@ public class IdxBizJgProjectContraptionServiceImpl extends BaseService<IdxBizJgP
List<IdxBizJgUseInfo> useInfos = useInfoService.lambdaQuery().select(IdxBizJgUseInfo::getRecord).eq(IdxBizJgUseInfo::getProjectContraptionId, sequenceNbr).list();
// 删除idx设备表信息 + 删除对应es数据
List<String> records = useInfos.stream().map(IdxBizJgUseInfo::getRecord).collect(Collectors.toList());
if (records.isEmpty()) return Boolean.TRUE;
Map<String, Object> map = new HashMap<>();
map.put("recordList", records);
map.put("equList", PipelineEnum.PRESSURE_PIPELINE.getCode());
registerInfoService.batchDeleteByRecord(map);
if (!records.isEmpty()){
Map<String, Object> map = new HashMap<>();
map.put("recordList", records);
map.put("equList", PipelineEnum.PRESSURE_PIPELINE.getCode());
registerInfoService.batchDeleteByRecord(map);
}
// 删除装置表信息
this.removeById(sequenceNbr);
return Boolean.TRUE;
......
......@@ -84,6 +84,8 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.IOException;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
......@@ -502,11 +504,13 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
projectContraption.setEquCategoryName(equCategoryName);
projectContraption.setEquDefineName(equDefineName);
projectContraption.setPipelineLength(
pipelineList.stream()
.map(pipeline -> pipeline.get("pipeLength"))
.filter(Objects::nonNull)
.mapToDouble(pipeLength -> Double.parseDouble(String.valueOf(pipeLength)))
.sum()
BigDecimal.valueOf(pipelineList.stream()
.map(pipeline -> pipeline.get("pipeLength"))
.filter(Objects::nonNull)
.mapToDouble(pipeLength -> Double.parseDouble(String.valueOf(pipeLength)))
.sum())
.setScale(2, RoundingMode.HALF_UP)
.doubleValue()
);
projectContraption.setUscUnitName(companyInfoMap.get("companyName").toString());
......
......@@ -89,6 +89,8 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URLEncoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
......@@ -1923,7 +1925,9 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
result.fluentPut("deviceList", deviceList)
.fluentPut("projectContraption", projectContraption.getProjectContraption())
.fluentPut("projectContraptionNo", projectContraption.getProjectContraptionNo())
.fluentPut("pipelineLength", projectContraption.getPipelineLength())
.fluentPut("pipelineLength", BigDecimal.valueOf(projectContraption.getPipelineLength())
.setScale(2, RoundingMode.HALF_UP)
.doubleValue())
.fluentPut("projectContraptionId", projectContraptionSeq);
if (!ValidationUtil.isEmpty(projectContraption.getCity())) {
result.fluentPut("city", projectContraption.getCity() + "_" + projectContraption.getCityName());
......
......@@ -65,13 +65,14 @@
E.supervise_org_code LIKE concat ( #{orgCode}, '%' )
</select>
<select id="countEnterpriseUsed" resultType="java.lang.Long">
SELECT COUNT
( DISTINCT ( E.app_id ) )
FROM
tz_cylinder_filling_record
T INNER JOIN tz_base_enterprise_info E ON T.app_id = E.app_id and E.unit_type like '%充装单位%'
WHERE
E.supervise_org_code LIKE concat ( #{orgCode}, '%' )
SELECT COUNT(1)
FROM tz_base_enterprise_info E
WHERE E.unit_type LIKE '%充装单位%' AND E.supervise_org_code LIKE concat ( #{orgCode}, '%' )
AND EXISTS (
SELECT 1
FROM tz_cylinder_filling_record T
WHERE T.app_id = E.app_id
)
</select>
<select id="getStationRateSubPage"
resultType="com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseEnterpriseInfoDto">
......
......@@ -77,6 +77,22 @@ public class DPSubController {
} else if(template.equals("inspection")) { // 报检
template = template + "_" + param.get("equListCode");
Assert.notNull(param.get("sequenceNbr"), "sequenceNbr不能为空");
} else if(template.equals("sydj")){
Assert.notNull(param.get("sequenceNbr"), "sequenceNbr不能为空");
if("vehicle".equals(param.get("bType"))){
template = template + "_" + param.get("bType");
}
} else if(template.equals("azgz")){
Assert.notNull(param.get("sequenceNbr"), "sequenceNbr不能为空");
} else if(template.equals("jdjy")){
Assert.notNull(param.get("sequenceNbr"), "sequenceNbr不能为空");
} else if(template.equals("dqjy")){
Assert.notNull(param.get("sequenceNbr"), "sequenceNbr不能为空");
} else if(template.equals("bgdj")){
Assert.notNull(param.get("sequenceNbr"), "sequenceNbr不能为空");
template = template + "_" + param.get("bType");
} else if(template.equals("zxbf")){
Assert.notNull(param.get("sequenceNbr"), "sequenceNbr不能为空");
} else {
throw new RuntimeException("暂无模板");
}
......
......@@ -445,14 +445,16 @@ public class CylinderDPStatisticsServiceImpl {
fillingRecord = cylinderInfoMapper.queryFillingRecordByOrgCode(orgCode, LocalDate.now().minusDays(29).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")),null);
offloading = cylinderInfoMapper.queryoffloadingByOrgCode(orgCode, LocalDate.now().minusDays(29).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")),null);
}
Map<String, String> fillingRecordMap = fillingRecord.stream().collect(Collectors.toMap(CylinderFillingRecordStatisticsDto::getTime, CylinderFillingRecordStatisticsDto::getFillingQuantity));
Map<String, String> offloadingMap = offloading.stream().collect(Collectors.toMap(CylinderFillingRecordStatisticsDto::getTime, CylinderFillingRecordStatisticsDto::getOffloadingVolume));
Map<String, String> fillingRecordMap = fillingRecord.stream().collect(Collectors.toMap(CylinderFillingRecordStatisticsDto::getFillingTime, CylinderFillingRecordStatisticsDto::getFillingQuantity));
Map<String, String> offloadingMap = offloading.stream().collect(Collectors.toMap(CylinderFillingRecordStatisticsDto::getFillingTime, CylinderFillingRecordStatisticsDto::getOffloadingVolume));
List<CylinderFillingRecordStatisticsDto> data = new ArrayList<>();
for (String key : times) {
CylinderFillingRecordStatisticsDto dayData = new CylinderFillingRecordStatisticsDto();
dayData.setTime(key);
dayData.setFillingQuantity(fillingRecordMap.getOrDefault(key, "0"));
dayData.setOffloadingVolume(offloadingMap.getOrDefault(key, "0"));
dayData.setFillingTime(key);
String filling = fillingRecordMap.getOrDefault(key, "0");
dayData.setFillingQuantity(filling.equals("0") ? filling : Double.valueOf(filling).toString());
String offloadingRecord = offloadingMap.getOrDefault(key, "0");
dayData.setOffloadingVolume(offloadingRecord.equals("0") ? offloadingRecord : Double.valueOf(offloadingRecord).toString());
data.add(dayData);
}
return data;
......
{
"name": "安装告知",
"tabs": [
{
"key": "basic",
"displayName": "安装告知详情",
"renderType": "basic",
"formSeq": "1734107811517853698",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/jg/jg-installation-notice/details",
"params": {
"sequenceNbr": "{sequenceNbr}"
},
"ruleData": {
"responseSuccess": "data.result.installationInfo"
}
}
},
"subResultParams": ["province","city","county","orgBranchCode","factoryUseSiteStreet","installLeaderId",
"useUnitCreditCode","propertyUnitName"]
}
],
"content": {
"basic": {
"columns": 4,
"datas": [],
"subs": []
}
}
}
\ No newline at end of file
{
"name": "车用气瓶变更",
"tabs": [
{
"key": "basic",
"displayName": "车用气瓶变更详情",
"renderType": "basic",
"formSeq": "1811232965410189314",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/jg/jg-change-vehicle-registration-unit/details",
"params": {
"sequenceNbr": "{sequenceNbr}"
},
"ruleData": {
"responseSuccess": "data.result"
}
}
},
"subResultParams": ["useUnitCreditCode","receiveOrgCode","orgBranchCode"]
}
],
"content": {
"basic": {
"columns": 4,
"datas": [],
"subs": []
}
}
}
\ No newline at end of file
{
"name": "单位变更",
"tabs": [
{
"key": "basic",
"displayName": "单位变更详情",
"renderType": "basic",
"formSeq": "1738022519656443905",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/jg/jg-change-registration-unit/details",
"params": {
"sequenceNbr": "{sequenceNbr}"
},
"ruleData": {
"responseSuccess": "data.result.changeRegisInfo"
}
}
},
"subResultParams": ["useUnitCreditCode","receiveOrgCode","newUseUnitName"]
}
],
"content": {
"basic": {
"columns": 4,
"datas": [],
"subs": []
}
}
}
\ No newline at end of file
{
"name": "更名变更",
"tabs": [
{
"key": "basic",
"displayName": "更名变更详情",
"renderType": "basic",
"formSeq": "1739185443716493313",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/jg/jg-change-registration-name/details",
"params": {
"sequenceNbr": "{sequenceNbr}"
},
"ruleData": {
"responseSuccess": "data.result.jgRegistrationInfo"
}
}
}
}
],
"content": {
"basic": {
"columns": 4,
"datas": [],
"subs": []
}
}
}
\ No newline at end of file
{
"name": "改造变更",
"tabs": [
{
"key": "basic",
"displayName": "改造变更详情",
"renderType": "basic",
"formSeq": "1737034262198120450",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/jg/jg-change-registration-reform/getDetail",
"params": {
"currentDocumentId": "{sequenceNbr}"
},
"ruleData": {
"responseSuccess": "data.result"
}
}
},
"subResultParams": ["receiveCompanyCode"]
}
],
"content": {
"basic": {
"columns": 4,
"datas": [],
"subs": []
}
}
}
\ No newline at end of file
{
"name": "移装变更",
"tabs": [
{
"key": "basic",
"displayName": "移装变更详情",
"renderType": "basic",
"formSeq": "1737063574276173826",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/jg/jg-change-registration-transfer/detail",
"params": {
"sequenceNbr": "{sequenceNbr}"
},
"ruleData": {
"responseSuccess": "data.result.changeRegistrationTransfer"
}
}
},
"subResultParams": ["receiveCompanyCode","transferProvince","transferCity","transferCounty","transferStreet",
"orgBranchCode","transferUseInfo","transferSafetyManager"]
}
],
"content": {
"basic": {
"columns": 4,
"datas": [],
"subs": []
}
}
}
\ No newline at end of file
{
"name": "定期检验",
"tabs": [
{
"key": "basic",
"displayName": "定期检验详情",
"renderType": "basic",
"formSeq": "1735144325639073793",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/jyjc/jyjc-inspection-application/{sequenceNbr}",
"params": {
"sequenceNbr": "{sequenceNbr}"
},
"ruleData": {
"responseSuccess": "data.result"
}
}
}
}
],
"content": {
"basic": {
"columns": 4,
"datas": [],
"subs": []
}
}
}
\ No newline at end of file
{
"name": "监督检验",
"tabs": [
{
"key": "basic",
"displayName": "监督检验详情",
"renderType": "basic",
"formSeq": "1734854656288387074",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/jyjc/jyjc-inspection-application/{sequenceNbr}",
"params": {
"sequenceNbr": "{sequenceNbr}"
},
"ruleData": {
"responseSuccess": "data.result"
}
}
}
}
],
"content": {
"basic": {
"columns": 4,
"datas": [],
"subs": []
}
}
}
\ No newline at end of file
{
"name": "使用登记",
"tabs": [
{
"key": "basic",
"displayName": "使用登记详情",
"renderType": "basic",
"formSeq": "1744311337623777282",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/jg/jg-use-registration/getDetail",
"params": {
"sequenceNbr": "{sequenceNbr}"
},
"ruleData": {
"responseSuccess": "data.result"
}
}
},
"subResultParams": ["orgBranchCode","receiveOrgCode","estateUnitName"]
}
],
"content": {
"basic": {
"columns": 4,
"datas": [],
"subs": []
}
}
}
\ No newline at end of file
{
"name": "使用登记",
"tabs": [
{
"key": "basic",
"displayName": "车用气瓶登记详情",
"renderType": "basic",
"formSeq": "1770000499483897858",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/jg/jg-vehicle-information/details",
"params": {
"sequenceNbr": "{sequenceNbr}"
},
"ruleData": {
"responseSuccess": "data.result"
}
}
}
}
],
"content": {
"basic": {
"columns": 4,
"datas": [],
"subs": []
}
}
}
\ No newline at end of file
{
"name": "注销报废",
"tabs": [
{
"key": "basic",
"displayName": "注销报废详情",
"renderType": "basic",
"formSeq": "1737366819582275586",
"dataConfig": {
"api": {
"httpMethod":"GET",
"apiPath":"/jg/jg-scrap-cancel/details",
"params": {
"sequenceNbr": "{sequenceNbr}"
},
"ruleData": {
"responseSuccess": "data.result.jgScrapCancelAdd"
}
}
}
}
],
"content": {
"basic": {
"columns": 4,
"datas": [],
"subs": []
}
}
}
\ No newline at end of file
......@@ -15,11 +15,15 @@ public class DateUtils {
public static Date calculateEndOfMonth(Date currentDate) {
LocalDateTime localDateTime = toLocalDateTime(currentDate);
LocalDateTime endOfMonth = localDateTime.with(localDateTime.withDayOfMonth(localDateTime.getMonth().maxLength())
// 获取当前月份的实际天数(考虑闰年)
int lastDay = localDateTime.getMonth().length(localDateTime.toLocalDate().isLeapYear());
// 直接设置为本月最后一天 23:59:59.999
LocalDateTime endOfMonth = localDateTime
.withDayOfMonth(lastDay)
.withHour(23)
.withMinute(59)
.withSecond(59)
.withNano(999999999));
.withNano(999_999_999);
return toDate(endOfMonth);
}
......
......@@ -276,110 +276,47 @@
</select>
<select id="countContraptionInUseTimesForDeleteByIntoManagement" resultType="java.lang.Integer">
SELECT
SUM(inUseNumber)
FROM (
SELECT
COUNT(1) AS inUseNumber
FROM tzs_jg_equip_transfer a
LEFT JOIN tzs_jg_equip_transfer_eq b ON b.equip_transfer_id=a.sequence_nbr
LEFT JOIN idx_biz_jg_use_info c ON b.equ_id=c.record
WHERE c.project_contraption_id = #{projectContraptionId}
AND a.is_delete = 0
AND ( a.apply_status != '6617')
UNION
SELECT
COUNT(1) AS inUseNumber
FROM
tzs_jg_use_registration a
WHERE a.project_contraption_id = #{projectContraptionId}
AND a.is_delete = 0
AND ( a.status != '已作废')
UNION
SELECT
COUNT(1) AS inUseNumber
FROM tzs_jg_change_registration_unit a
LEFT JOIN tzs_jg_change_registration_unit_eq b ON b.unit_change_registration_id=a.sequence_nbr
LEFT JOIN idx_biz_jg_use_info c ON b.equ_id=c.record
WHERE c.project_contraption_id = #{projectContraptionId}
AND a.is_delete = 0
AND ( a.status != '已作废')
UNION
SELECT
COUNT(1) AS inUseNumber
FROM tzs_jg_enable_disable a
LEFT JOIN tzs_jg_enable_disable_eq b ON b.enable_disable_apply_id=a.sequence_nbr
LEFT JOIN idx_biz_jg_use_info c ON b.equ_id=c.record
WHERE c.project_contraption_id = #{projectContraptionId}
AND a.is_delete = 0
AND ( a.audit_status != '已作废')
UNION
SELECT
COUNT(1) AS inUseNumber
FROM tzs_jg_scrap_cancel a
LEFT JOIN tzs_jg_scrap_cancel_eq b ON b.equip_transfer_id=a.sequence_nbr
LEFT JOIN idx_biz_jg_use_info c ON b.equ_id=c.record
WHERE c.project_contraption_id = #{projectContraptionId}
AND a.is_delete = 0
AND ( a.audit_status != '使用单位已撤回')
UNION
SELECT
COUNT(1) AS inUseNumber
FROM tzs_jg_change_registration_transfer a
LEFT JOIN tzs_jg_change_registration_transfer_eq b ON b.equip_transfer_id=a.sequence_nbr
LEFT JOIN idx_biz_jg_use_info c ON b.equ_id=c.record
WHERE c.project_contraption_id = #{projectContraptionId}
AND a.is_delete = 0
AND ( a.audit_status != '使用单位已撤回')
UNION
SELECT
COUNT(1) AS inUseNumber
FROM tzs_jg_change_registration_name a
LEFT JOIN tzs_jg_change_registration_name_eq b ON b.name_change_registration_id=a.sequence_nbr
LEFT JOIN idx_biz_jg_use_info c ON b.equ_id=c.record
WHERE c.project_contraption_id = #{projectContraptionId}
AND a.is_delete = 0
AND ( a.audit_status != '使用单位已撤回')
UNION
SELECT
COUNT(1) AS inUseNumber
FROM
tzs_jg_installation_notice a
WHERE a.project_contraption_id = #{projectContraptionId}
AND (a.notice_status != '6617')
UNION
SELECT
COUNT(1) AS inUseNumber
FROM tzs_jg_maintain_notice a
LEFT JOIN tzs_jg_maintain_notice_eq b ON b.equip_transfer_id=a.sequence_nbr
LEFT JOIN idx_biz_jg_use_info c ON b.equ_id=c.record
WHERE c.project_contraption_id = #{projectContraptionId}
AND a.is_delete = 0
AND ( a.notice_status != '6617')
UNION
SELECT
COUNT(1) AS inUseNumber
FROM tzs_jg_reform_notice a
LEFT JOIN tzs_jg_reform_notice_eq b ON b.equip_transfer_id=a.sequence_nbr
LEFT JOIN idx_biz_jg_use_info c ON b.equ_id=c.record
WHERE c.project_contraption_id = #{projectContraptionId}
AND a.is_delete = 0
AND ( a.notice_status != '6617')
UNION
SELECT
COUNT(1) AS inUseNumber
FROM tzs_jg_transfer_notice a
LEFT JOIN tzs_jg_transfer_notice_eq b ON b.equip_transfer_id=a.sequence_nbr
LEFT JOIN idx_biz_jg_use_info c ON b.equ_id=c.record
WHERE c.project_contraption_id = #{projectContraptionId}
AND a.is_delete = 0
AND ( a.notice_status != '6617')
UNION
SELECT
COUNT(1) AS inUseNumber
FROM tz_jyjc_inspection_application a
WHERE a.project_contraption_id = #{projectContraptionId}
AND ( a.status != '6617')
)
SELECT SUM(inUseNumber) FROM (
SELECT COUNT(DISTINCT A.sequence_nbr) AS inUseNumber FROM tzs_jg_equip_transfer A
LEFT JOIN tzs_jg_equip_transfer_eq b ON b.equip_transfer_id = A.sequence_nbr
LEFT JOIN idx_biz_jg_use_info C ON b.equ_id = C.record
WHERE C.project_contraption_id = #{projectContraptionId}
AND A.is_delete = 0
AND A.apply_status != '6617'
UNION
SELECT COUNT(1) AS inUseNumber FROM tzs_jg_use_registration A
WHERE A.project_contraption_id = #{projectContraptionId}
AND A.is_delete = 0
AND A.status != '已作废'
UNION
SELECT COUNT(DISTINCT A.sequence_nbr) AS inUseNumber FROM tzs_jg_change_registration_unit A
LEFT JOIN tzs_jg_change_registration_unit_eq b ON b.unit_change_registration_id = A.sequence_nbr
LEFT JOIN idx_biz_jg_use_info C ON b.equ_id = C.record
WHERE C.project_contraption_id = #{projectContraptionId}
AND A.is_delete = 0
AND A.status != '已作废'
UNION
SELECT COUNT(DISTINCT A.sequence_nbr) AS inUseNumber FROM tzs_jg_enable_disable A
LEFT JOIN tzs_jg_enable_disable_eq b ON b.enable_disable_apply_id = A.sequence_nbr
LEFT JOIN idx_biz_jg_use_info C ON b.equ_id = C.record
WHERE C.project_contraption_id = #{projectContraptionId}
AND A.is_delete = 0
AND A.audit_status != '已作废'
UNION
SELECT COUNT(DISTINCT A.sequence_nbr) AS inUseNumber FROM tzs_jg_scrap_cancel A
LEFT JOIN tzs_jg_scrap_cancel_eq b ON b.equip_transfer_id = A.sequence_nbr
LEFT JOIN idx_biz_jg_use_info C ON b.equ_id = C.record
WHERE C.project_contraption_id = #{projectContraptionId}
AND A.is_delete = 0
AND A.audit_status != '使用单位已撤回'
UNION
SELECT COUNT(1) AS inUseNumber FROM tzs_jg_installation_notice A
WHERE A.project_contraption_id = #{projectContraptionId}
AND A.notice_status != '6617'
UNION
SELECT COUNT(1) AS inUseNumber FROM tz_jyjc_inspection_application A
WHERE A.project_contraption_id = #{projectContraptionId}
AND A.status != '6617'
) AS result
</select>
</mapper>
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