Commit 4621beaa authored by tianbo's avatar tianbo

Merge remote-tracking branch 'origin/develop_tzs_bugfix' into develop_tzs_register

parents 95cd3508 85a3950d
package com.yeejoin.amos.boot.biz.common.dto;
import io.swagger.annotations.ApiModel;
import lombok.Data;
/**
* @author Administrator
*/
@Data
@ApiModel(value = "CommonRegionDto", description = "通用区域信息")
public class CommonRegionDto {
/**
* 区域代码
*/
private String indexCode;
/**
* 父级区域代码
*/
private String parentIndexCode;
/**
* 区域代码(摄像头所属企业统一信用代码)
*/
private String useUnitCode;
}
......@@ -40,4 +40,8 @@ public class CommonVideoDto {
*/
private Integer quality;
/**
* 设备所属使用登记证编号
*/
private String useRegistrationCode;
}
......@@ -90,16 +90,16 @@ public class TzsAppController {
return ResponseHelper.buildResponse(appService.getEquipInfoBySuperviseCode(supervisoryCode));
}
/**
* 登录
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@PostMapping(value = "/mobile/login")
@ApiOperation(httpMethod = "POST", value = "小程序登录", notes = "小程序登录")
public ResponseModel<Map<String, Object>> login(@RequestBody MobileLoginParam param) {
return ResponseHelper.buildResponse(appService.login(param));
}
// /**
// * 登录
// * @return
// */
// @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
// @PostMapping(value = "/mobile/login")
// @ApiOperation(httpMethod = "POST", value = "小程序登录", notes = "小程序登录")
// public ResponseModel<Map<String, Object>> login(@RequestBody MobileLoginParam param) {
// return ResponseHelper.buildResponse(appService.login(param));
// }
/**
* 小程序企业详情
......
channals:
id:
name: zookeeper
auth: ADF248A492D2E89B943B3626DE32DB7E6619CD10B5BCA9502AC76AFA624104D4A5AAF320B865300FCF49E88D433564312E4B387931E4E14F5EE60A1CCCE3C9BF41C7500CE9E199DA134FD99355A628B1
host: 192.169.82.2
path: /688ca77ef14c054d94cb8e19/metadata/logic_db/rule
port: '2281'
scheme: digest
keys:
configSignature: 14666B5866B08058360FB75FF264B4143EBDFC8FCF9888C9CAAFD6B1EBADF02EA1CD85E696A0697D1760BDAD53CF29B668A47713B6C3EF106F736812A647955E
logMacKey: 4B2701E612E5A376E7B9980722105EF9BEE8F494F81E666A0AEC70BCA18FEF2C
sm2PrvKey: B79F0CB80D6C5D18CC254DA9817B86EEA662A3EFE0A3B3BDA5C1C155564FC6EDFC342D511AD50C9030DD7DB5A9D122AB
sm2PubKey: 046AE3DE41488D7BE1AA5A7C98ADB320B0ECD392DB295A30B5A1A0BB6320FBC9296775BF14319FFB0A6690060DC370EB33C983F43C37E50A196705D371CBA8D68E
userPIN: 3517382078297947681464213757066358386295150902737251965376941307
userPINCtx:
sdkconfig:
invokeMode: local
timeInterval: 6000
tracing:
host:
port:
scheme:
unionServer:
applicationID: 688ca77e4e31c23383e1ab3e
applicationKey: 3BA3D34E2192A53163B08236C17FD77543EE707C2C94559BE08E9B12D8B2B80264967D0AFAEBDE7A26D0E696A1619727
clientId: IcFjcOgrSkWoTxun
clientSecret: uOKWDyGd1KVjG9JTxF59WrOAuFz9EN0i
serverCloudCipherIp: 172.30.42.218
serverCloudCipherKeyPort: '5443'
......@@ -5,8 +5,10 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.common.collect.Lists;
import com.hikvision.artemis.sdk.ArtemisHttpUtil;
import com.hikvision.artemis.sdk.config.ArtemisConfig;
import com.yeejoin.amos.boot.biz.common.dto.CommonRegionDto;
import com.yeejoin.amos.boot.biz.common.dto.CommonVideoDto;
import com.yeejoin.amos.boot.biz.common.enums.CommonVideoEnum;
import com.yeejoin.amos.boot.module.common.api.dto.BaseEnterpriseVideoDto;
......@@ -19,15 +21,13 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.http.conn.ConnectTimeoutException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
import static com.yeejoin.amos.boot.biz.common.constants.VideoConstant.CODE_200;
......@@ -45,6 +45,8 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi
@Value("${cylinder.video.default.image.url:/upload/tzs/cylinder/no-connect.png}")
private String defaultVideoUrl;
private String rootIndexCode = "root00000000";
public List<CommonVideoDto> getUnitVideoUrl(String useUnitCode, String regionCode) {
List<CommonVideoDto> result = new ArrayList<>();
LambdaQueryWrapper<BaseEnterpriseVideo> wrapper = new LambdaQueryWrapper<>();
......@@ -78,7 +80,7 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi
videoList.forEach(video -> {
List<CommonVideoDto> commonVideoDtos = new ArrayList<>();
try {
Map<String, Object> artemisInfo = initArtemisConfigAndPath(baseEnterpriseVideo);
Map<String, Object> artemisInfo = initArtemisConfigAndPath(baseEnterpriseVideo, baseEnterpriseVideo.getUrl());
ArtemisConfig config = (ArtemisConfig) artemisInfo.get("config");
Map<String, String> path = (Map<String, String>) artemisInfo.get("path");
......@@ -136,11 +138,11 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi
* 初始化Artemis配置和路径信息
*
* @param baseEnterpriseVideo 视频设备信息
* @param apiUrl
* @return 包含 ArtemisConfig、请求路径和协议的Map
*/
private Map<String, Object> initArtemisConfigAndPath(BaseEnterpriseVideo baseEnterpriseVideo) throws URISyntaxException {
String getCamerasUrl = baseEnterpriseVideo.getUrl(); // 或 getTokenUrl(),根据具体方法传入
Map<String, String> uriInfo = parseUri(getCamerasUrl);
private Map<String, Object> initArtemisConfigAndPath(BaseEnterpriseVideo baseEnterpriseVideo, String apiUrl) throws URISyntaxException {
Map<String, String> uriInfo = parseUri(apiUrl);
String protocol = uriInfo.get("protocol");
String hostPort = uriInfo.get("hostPort");
String urlPath = uriInfo.get("urlPath");
......@@ -194,15 +196,9 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi
String dataS = videoJsonObject.get("data").toString();
JSONObject dd = JSON.parseObject(dataS);
String url = dd.get("url").toString();
CommonVideoDto commonVideoDto = new CommonVideoDto();
commonVideoDto.setUrl(url);
commonVideoDto.setKey(channelNo.getKey());
commonVideoDto.setType(CommonVideoEnum.getEnum(video.getProtocol()).getName());
commonVideoDto.setTitle(channelNo.getTitle());
commonVideoDto.setThumb(channelNo.getThumb());
commonVideoDto.setQuality(channelNo.getQuality());
commonVideoDto.setSupportH265(channelNo.getSupportH265());
result.add(commonVideoDto);
channelNo.setUrl(url);
channelNo.setType(CommonVideoEnum.getEnum(video.getProtocol()).getName());
result.add(channelNo);
} else {
String errorMsg = "code:" + codeVideo + "msg:" + msgVideo + "appKey:" + video.getAppKey() + "appSecret:" + video.getAppSecret() + "accessToken:" + accessToken;
log.info("视频地址获取失败errorMsg:{}", errorMsg);
......@@ -269,7 +265,7 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi
List<CommonVideoDto> commonVideoDtos = new ArrayList<>();
BaseEnterpriseVideo baseEnterpriseVideo = iSecureCenterVideoList.get(0);
try {
Map<String, Object> artemisInfo = initArtemisConfigAndPath(baseEnterpriseVideo);
Map<String, Object> artemisInfo = initArtemisConfigAndPath(baseEnterpriseVideo, baseEnterpriseVideo.getTokenUrl());
ArtemisConfig config = (ArtemisConfig) artemisInfo.get("config");
Map<String, String> path = (Map<String, String>) artemisInfo.get("path");
......@@ -299,10 +295,14 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi
dataList.forEach(data -> {
CommonVideoDto commonVideoDto = new CommonVideoDto();
JSONObject dataJson = (JSONObject) data;
/* dataJson返回结果样例
{"regionIndexCode":"cac9325d1ac74415b064a621595f6e09","capabilitySetName":"GPS事件能力,视频事件能力,IO能力,视频能力,录像能力,视频设备远程获取能力,设备维护能力,客流统计事件能力,状态能力","channelNo":"3","latitude":"34.4765399909899","channelType":"digital","cameraIndexCode":"9215c9a92f574a7da23523ef6894c5a2","recordLocation":"1","cameraTypeName":"xres.query.camera.type.qj","recordLocationName":"xres.query.device.store","channelTypeName":"xres.query.camera.digital","transTypeName":"TCP","cameraName":"迂回站上车区","longitude":"108.9768070075236","installLocation":"索12陕J00001(21)","updateTime":"2025-08-20T10:44:56.273+08:00","gbIndexCode":"61000000001310257002","cameraType":0,"transType":1,"createTime":"2025-04-07T11:16:01.258+08:00","capabilitySet":"event_gps,event_vss,io,vss,record,remote_vss,maintenance,event_pdc,status","encodeDevIndexCode":"94dddc8ed1124f8c9cd9537beb12ef72"}
*/
commonVideoDto.setKey(dataJson.getString("cameraIndexCode"));
commonVideoDto.setLabel(dataJson.getString("cameraName"));
commonVideoDto.setTitle(dataJson.getString("cameraName"));
commonVideoDto.setParent(baseEnterpriseVideo.getUseUnitCode());
commonVideoDto.setUseRegistrationCode(dataJson.getString("installLocation"));
commonVideoDtos.add(commonVideoDto);
});
return commonVideoDtos;
......@@ -318,4 +318,77 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi
}
return commonVideoDtos;
}
/**
* 根据编号获取区域详细信息
*/
@Transactional(rollbackFor = Exception.class)
public List<CommonRegionDto> getAllRegionInfo(String regionCode) {
List<BaseEnterpriseVideo> allRegionList = Lists.newArrayList();
BaseEnterpriseVideo baseEnterpriseVideo = new BaseEnterpriseVideo();
baseEnterpriseVideo.setAppKey("26245828");
baseEnterpriseVideo.setAppSecret("zzZ3KPeIRFU8PZkHSwVp");
baseEnterpriseVideo.setTokenUrl("https://113.140.67.204:55443/artemis/api/resource/v1/regions/subRegions");
final List<CommonRegionDto> commonRegionList = getCommonRegionList(baseEnterpriseVideo, rootIndexCode);
if (!ValidationUtil.isEmpty(commonRegionList)) {
commonRegionList.forEach(region -> {
BaseEnterpriseVideo enterpriseVideo = new BaseEnterpriseVideo();
enterpriseVideo.setAppKey(baseEnterpriseVideo.getAppKey());
enterpriseVideo.setAppSecret(baseEnterpriseVideo.getAppSecret());
enterpriseVideo.setTokenUrl("https://113.140.67.204:55443/artemis/api/resource/v1/regions/regionIndexCode/cameras?pageNo=1&pageSize=20");
enterpriseVideo.setUrl("https://113.140.67.204:55443/artemis/api/video/v2/cameras/previewURLs");
enterpriseVideo.setDeviceSerial(region.getIndexCode());
enterpriseVideo.setProtocol("2");
enterpriseVideo.setChannelNo("{\"streamType\":0,\"protocol\":\"hls\",\"transmode\":\"1\",\"viewProtocol\":\"hlsHk\"}");
enterpriseVideo.setExpireTime(60480000L);
enterpriseVideo.setUseUnitCode(region.getUseUnitCode());
enterpriseVideo.setIsEnabled(true);
enterpriseVideo.setPlatform("iSecureCenter");
enterpriseVideo.setRecDate(new Date());
allRegionList.add(enterpriseVideo);
});
}
this.saveOrUpdateBatch(allRegionList);
return commonRegionList;
}
private List<CommonRegionDto> getCommonRegionList(BaseEnterpriseVideo baseEnterpriseVideo, String regionCode) {
Map<String, Object> artemisInfo;
List<CommonRegionDto> commonRegionList = new ArrayList<>();
try {
artemisInfo = initArtemisConfigAndPath(baseEnterpriseVideo, baseEnterpriseVideo.getTokenUrl());
ArtemisConfig config = (ArtemisConfig) artemisInfo.get("config");
Map<String, String> path = (Map<String, String>) artemisInfo.get("path");
Map<String, String> paramMap = new HashMap<>();// post请求Form表单参数
paramMap.put("parentIndexCode", "cac9325d1ac74415b064a621595f6e09");
String body = JSON.toJSON(paramMap).toString();
String resultStr = ArtemisHttpUtil.doPostStringArtemis(config, path, body, null, null, "application/json", null);
if (ValidationUtil.isEmpty(resultStr)) {
return null;
}
JSONObject result = JSONObject.parseObject(resultStr);
if (!result.get("code").equals("0")) {
log.error("getRegionInfo列表失败,code:{}", result.get("code"));
}
if (result.get("data") instanceof JSONArray) {
JSONArray dataObj = (JSONArray) result.get("data");
if (!ValidationUtil.isEmpty(dataObj)) {
dataObj.forEach(data -> {
CommonRegionDto commonRegionDto = new CommonRegionDto();
JSONObject dataJson = (JSONObject) data;
commonRegionDto.setIndexCode(dataJson.getString("indexCode"));
commonRegionDto.setParentIndexCode(dataJson.getString("parentIndexCode"));
commonRegionDto.setUseUnitCode(dataJson.getString("name"));
commonRegionList.add(commonRegionDto);
});
}
}
} catch (URISyntaxException e) {
throw new RuntimeException(e);
} catch (Exception e) {
log.error("获取iSecureCenter视频对接平台区域列表失败,未知错误!", e);
throw new RuntimeException(e);
}
return commonRegionList;
}
}
\ No newline at end of file
......@@ -90,16 +90,16 @@ public class TzsAppController {
return ResponseHelper.buildResponse(appService.getEquipInfoBySuperviseCode(supervisoryCode));
}
/**
* 登录
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@PostMapping(value = "/mobile/login")
@ApiOperation(httpMethod = "POST", value = "小程序登录", notes = "小程序登录")
public ResponseModel<Map<String, Object>> login(@RequestBody MobileLoginParam param) {
return ResponseHelper.buildResponse(appService.login(param));
}
// /**
// * 登录
// * @return
// */
// @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
// @PostMapping(value = "/mobile/login")
// @ApiOperation(httpMethod = "POST", value = "小程序登录", notes = "小程序登录")
// public ResponseModel<Map<String, Object>> login(@RequestBody MobileLoginParam param) {
// return ResponseHelper.buildResponse(appService.login(param));
// }
/**
* 小程序企业详情
......
......@@ -90,16 +90,16 @@ public class TzsAppController {
return ResponseHelper.buildResponse(appService.getEquipInfoBySuperviseCode(supervisoryCode));
}
/**
* 登录
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@PostMapping(value = "/mobile/login")
@ApiOperation(httpMethod = "POST", value = "小程序登录", notes = "小程序登录")
public ResponseModel<Map<String, Object>> login(@RequestBody MobileLoginParam param) {
return ResponseHelper.buildResponse(appService.login(param));
}
// /**
// * 登录
// * @return
// */
// @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
// @PostMapping(value = "/mobile/login")
// @ApiOperation(httpMethod = "POST", value = "小程序登录", notes = "小程序登录")
// public ResponseModel<Map<String, Object>> login(@RequestBody MobileLoginParam param) {
// return ResponseHelper.buildResponse(appService.login(param));
// }
/**
* 小程序企业详情
......
......@@ -160,128 +160,134 @@ public class EquipInfoCylinderExcelDto extends BaseDto {
@DateTimeFormat("yyyy-MM-dd")
private String inspectDate;
@ApiModelProperty(value = "下次检验日期")
@ExcelProperty(value = "下次检验日期", index = 27)
@NotBlank(message = "下次检验日期不能为空")
@DateTimeFormat("yyyy-MM-dd")
private String nextInspectDate;
@ApiModelProperty(value = "检验报告编号")
@ExcelProperty(value = "检验报告编号", index = 27)
@ExcelProperty(value = "检验报告编号", index = 28)
private String inspectReportNo;
//技术参数
@ExcelProperty(value = "额定质量(kg)", index = 28)
@ExcelProperty(value = "额定质量(kg)", index = 29)
@ApiModelProperty(value = "额定质量(kg)")
private String ratedQuality;
@ExcelProperty(value = "使用环境温度(℃)", index = 29)
@ExcelProperty(value = "使用环境温度(℃)", index = 30)
@ApiModelProperty(value = "使用环境温度(℃)")
private String ambientTemperature;
@ExcelProperty(value = "单瓶容积(m3)", index = 30)
@ExcelProperty(value = "单瓶容积(m3)", index = 31)
@ApiModelProperty(value = "单瓶容积(m3)")
@NotBlank(message = "单瓶容积(m3)不能为空")
private String singleBottleVolume;
@ExcelProperty(value = "型号", index = 31)
@ExcelProperty(value = "型号", index = 32)
@ApiModelProperty(value = "型号")
private String modelNumber;
@ExcelProperty(value = "充装介质", index = 32)
@ExcelProperty(value = "充装介质", index = 33)
@ApiModelProperty(value = "充装介质")
@NotBlank(message = "充装介质不能为空")
private String chargingMedium;
@ExcelProperty(value = "规格", index = 33)
@ExcelProperty(value = "规格", index = 34)
@ApiModelProperty(value = "规格")
private String specification;
@ExcelProperty(value = "外径", index = 34)
@ExcelProperty(value = "外径", index = 35)
@ApiModelProperty(value = "外径")
private String outsideDiameter;
@ExcelProperty(value = "壁厚", index = 35)
@ExcelProperty(value = "壁厚", index = 36)
@ApiModelProperty(value = "壁厚")
private String wallThickness;
@ExcelProperty(value = "长度", index = 36)
@ExcelProperty(value = "长度", index = 37)
@ApiModelProperty(value = "长度")
private String length;
@ExcelProperty(value = "公称工作压力(MPa)", index = 37)
@ExcelProperty(value = "公称工作压力(MPa)", index = 38)
@ApiModelProperty(value = "公称工作压力(MPa)")
@NotBlank(message = "公称工作压力(MPa)不能为空")
private String nominalWorkingPressure;
@ExcelProperty(value = "材料(管路)", index = 38)
@ExcelProperty(value = "材料(管路)", index = 39)
@ApiModelProperty(value = "材料(管路)")
private String piping;
@ExcelProperty(value = "无损检测方法(气瓶)", index = 39, converter = NondestructConverter.class)
@ExcelProperty(value = "无损检测方法(气瓶)", index = 40, converter = NondestructConverter.class)
@ApiModelProperty(value = "无损检测方法(气瓶)")
private String qpLossless;//5988
@ExcelProperty(value = "材料(瓶体)", index = 40)
@ExcelProperty(value = "材料(瓶体)", index = 41)
@ApiModelProperty(value = "材料(瓶体)")
private String bottleBody;
@ExcelProperty(value = "材料(端塞)", index = 41)
@ExcelProperty(value = "材料(端塞)", index = 42)
@ApiModelProperty(value = "材料(端塞)")
private String endPlug;
@ExcelProperty(value = "无损检测比例(管路)(%)", index = 42)
@ExcelProperty(value = "无损检测比例(管路)(%)", index = 43)
@ApiModelProperty(value = "无损检测比例(管路)(%)")
private String glRatio;
@ExcelProperty(value = "无损检测比例(气瓶)(%)", index = 43)
@ExcelProperty(value = "无损检测比例(气瓶)(%)", index = 44)
@ApiModelProperty(value = "无损检测比例(气瓶)(%)")
private String qpRatio;
@ExcelProperty(value = "无损检测方法(管路)", index = 44, converter = NondestructConverter.class)
@ExcelProperty(value = "无损检测方法(管路)", index = 45, converter = NondestructConverter.class)
@ApiModelProperty(value = "无损检测方法(管路)")
private String glLossless;
@ExcelProperty(value = "耐压实验压力(气瓶)(Mpa)", index = 45)
@ExcelProperty(value = "耐压实验压力(气瓶)(Mpa)", index = 46)
@ApiModelProperty(value = "耐压实验压力(气瓶)(Mpa)")
private String qpPressure;
@ExcelProperty(value = "耐压实验压力(管路)(Mpa)", index = 46)
@ExcelProperty(value = "耐压实验压力(管路)(Mpa)", index = 47)
@ApiModelProperty(value = "耐压实验压力(管路)(Mpa)")
private String glPressure;
@ExcelProperty(value = "气密性试验压力(气瓶)(Mpa)", index = 47)
@ExcelProperty(value = "气密性试验压力(气瓶)(Mpa)", index = 48)
@ApiModelProperty(value = "气密性试验压力(气瓶)(Mpa)")
private String qpAirTightness;
@ExcelProperty(value = "气体置换后压力(MPa)", index = 48)
@ExcelProperty(value = "气体置换后压力(MPa)", index = 49)
@ApiModelProperty(value = "气体置换后压力(MPa)")
private String displacementPressure;
@ExcelProperty(value = "热处理方式", index = 49)
@ExcelProperty(value = "热处理方式", index = 50)
@ApiModelProperty(value = "热处理方式")
private String heatTreatmentMethod;
@ExcelProperty(value = "气密性实验压力(管路)(MPa)", index = 50)
@ExcelProperty(value = "气密性实验压力(管路)(MPa)", index = 51)
@ApiModelProperty(value = "气密性实验压力(管路)(MPa)")
private String glAirTightness;
@ExcelProperty(value = "气瓶安装位置", index = 51)
@ExcelProperty(value = "气瓶安装位置", index = 52)
@ApiModelProperty(value = "气瓶安装位置")
private String installationPosition;
@ExcelProperty(value = "瓶体内含氧量(%)", index = 52)
@ExcelProperty(value = "瓶体内含氧量(%)", index = 53)
@ApiModelProperty(value = "瓶体内含氧量(%)")
private String oxygen;
@ExcelProperty(value = "热处理温度(℃)", index = 53)
@ExcelProperty(value = "热处理温度(℃)", index = 54)
@ApiModelProperty(value = "热处理温度(℃)")
private String qpHeatTreatmentTemperature;
/**
* 信息化管理字段-信息化管理情况
*/
@ExcelProperty(value = "信息化管理情况", index = 54, converter = InformationSituationConverter.class)
@ExcelProperty(value = "信息化管理情况", index = 55, converter = InformationSituationConverter.class)
private String informationSituation;
/**
* 信息化管理字段-二维码或者电子标签编号
*/
@ExcelProperty(value = "二维码或者电子标签编号", index = 55)
@ExcelProperty(value = "二维码或者电子标签编号", index = 56)
private String informationManageCode;
@ExcelIgnore
......
package com.yeejoin.amos.boot.module.jg.api.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;
@Getter
@AllArgsConstructor
public enum IsIntoManagementEnum {
FALSE("未纳管", false),
TRUE("已纳管", true);
private final String name;
private final boolean code;
private static final Map<Boolean, String> CODE_NAME_MAP = Arrays.stream(values())
.collect(Collectors.toMap(IsIntoManagementEnum::isCode, IsIntoManagementEnum::getName));
/**
* 根据 code获取枚举对应的 name
*/
public static String getName(boolean code) {
return CODE_NAME_MAP.get(code);
}
}
......@@ -53,4 +53,6 @@ public interface JgUseRegistrationManageMapper extends BaseMapper<JgUseRegistrat
JgUseRegistrationManage getLatestJgUseRegistrationManage(@Param("useUnitCreditCode")String useUnitCreditCode, @Param("equDefineCode")String equDefineCode);
Integer checkUseRegCertInBusiness(@Param("useRegistrationCode")String useRegistrationCode);
Page<JgUseRegistrationManageDto> queryUseRegistrationManagePage(@Param("page") Page<JgUseRegistrationManageDto> page, @Param("dto") JgUseRegistrationManageDto dto, @Param("sort") SortVo sortMap);
}
......@@ -2528,16 +2528,17 @@
)
</select>
<update id="updateTechParamDynamic">
<if test="columns != null and columns.size > 0">
update
${tableName}
set
update ${tableName}
<set>
<foreach collection="columns" item="column" separator=",">
<if test="column.columnValue != null and column.columnValue != ''">
${column.columnName} = #{column.columnValue}
</if>
</foreach>
</set>
where record = #{record}
</if>
</update>
<select id="countBizNumAfterUseReg" resultType="java.lang.Long">
select
sum(inUseNumber)
......
......@@ -91,8 +91,6 @@
<if test="contractDto.createDate != null">
AND tjmc.create_date LIKE concat(DATE_FORMAT(#{contractDto.createDate},'%Y-%m-%d'),'%')
</if>
-- 数据过滤开始 ----------------------------------------------------
-- 只有使用单位或者维保单位用,或者都没有
<if test="contractDto.useUnitCodeFilter != '' and contractDto.useUnitCodeFilter != null">
and (tjmc.use_unit_code = #{contractDto.useUnitCodeFilter}
or tjmc.transfer_to_user_ids LIKE concat ( '%', #{currentUserId}, '%' ))
......@@ -102,13 +100,11 @@
or tjmc.transfer_to_user_ids LIKE concat ( '%', #{currentUserId}, '%' ))
and (tjmc.instance_id <![CDATA[<>]]> '')
</if>
-- 接受机构用
<if test="contractDto.receiveOrgCodeFilter != '' and contractDto.receiveOrgCodeFilter != null">
and (tjmc.receive_org_code = #{contractDto.receiveOrgCodeFilter}
or tjmc.transfer_to_user_ids LIKE concat ( '%', #{currentUserId}, '%' ))
and (tjmc.instance_id <![CDATA[<>]]> '')
</if>
-- 监管单位用
<if test="contractDto.orgBranchCode != '' and contractDto.orgBranchCode != null">
and tjmc.instance_id <![CDATA[<>]]> ''
HAVING (
......@@ -118,7 +114,6 @@
WHERE ede.equip_transfer_id = tjmc.sequence_nbr
) LIKE concat('%', #{contractDto.orgBranchCode}, '%')
</if>
-- 数据过滤结束 ----------------------------------------------------
</where>
ORDER BY
<if test="sort != null">
......
......@@ -79,11 +79,7 @@
</where>
</select>
<select id="queryForPage" resultType="com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationManageDto">
<include refid="page_list"/>,
(SELECT ei.sequence_nbr from idx_biz_jg_use_info ui
LEFT JOIN idx_biz_jg_register_info ri ON ri.record = ui.record
LEFT JOIN tz_base_enterprise_info ei ON ei.use_unit_code = ui.ESTATE_UNIT_CREDIT_CODE
WHERE ri.USE_ORG_CODE = tjurm.use_registration_code ORDER BY ui.REC_DATE DESC limit 1) AS estateUnitName
<include refid="page_list"/>
FROM tzs_jg_use_registration_manage tjurm
<where>
tjurm.is_delete = 0
......@@ -593,4 +589,99 @@
ORDER BY tjur.certificate_no DESC
LIMIT 1
</select>
<select id="queryUseRegistrationManagePage" resultType="com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationManageDto">
<include refid="page_list"/>
,estate.sequence_nbr AS estateUnitName
FROM tzs_jg_use_registration_manage tjurm
LEFT JOIN (
SELECT DISTINCT ON (ri.use_org_code)
ri.use_org_code, ei.sequence_nbr
FROM idx_biz_jg_register_info ri
JOIN idx_biz_jg_use_info ui ON ui.record = ri.record
JOIN tz_base_enterprise_info ei ON ei.use_unit_code = ui.ESTATE_UNIT_CREDIT_CODE
ORDER BY ri.use_org_code, ui.rec_date DESC
) estate ON estate.use_org_code = tjurm.use_registration_code
<where>
tjurm.is_delete = 0
<if test="dto.equList != null and dto.equList != ''">
and tjurm.equ_list = #{dto.equList}
</if>
<if test="dto.equListCode != null and dto.equListCode != ''">
and tjurm.equ_list_code = #{dto.equListCode}
</if>
<if test="dto.equCategory != null and dto.equCategory != ''">
and tjurm.equ_category = #{dto.equCategory}
</if>
<if test="dto.equCategoryCode != null and dto.equCategoryCode != ''">
and tjurm.equ_category_code = #{dto.equCategoryCode}
</if>
<if test="dto.equDefine != null and dto.equDefine != ''">
and tjurm.equ_define = #{dto.equDefine}
</if>
<if test="dto.equDefineCode != null and dto.equDefineCode != ''">
and tjurm.equ_define_code = #{dto.equDefineCode}
</if>
-- 使用登记证编号
<if test="dto.useRegistrationCode != null and 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 concat('%',#{dto.applyNo},'%')
</if>
-- 登记证书唯一码
<if test="dto.certificateNo != null and dto.certificateNo != ''">
and tjurm.certificate_no = #{dto.certificateNo}
</if>
<if test="dto.auditPassDate != null and dto.auditPassDate != ''">
and tjurm.audit_pass_date like concat('%',DATE_FORMAT(#{dto.auditPassDate},'%Y-%m-%d'),'%')
</if>
<if test="dto.certificateStatus != null and dto.certificateStatus != ''">
and tjurm.certificate_status = #{dto.certificateStatus}
</if>
<if test="dto.useUnitCreditCodeForSearch != null and dto.useUnitCreditCodeForSearch != ''">
and tjurm.use_unit_credit_code = #{dto.useUnitCreditCodeForSearch}
</if>
<if test="dto.useUnitCreditNameForSearch != null and dto.useUnitCreditNameForSearch != ''">
and tjurm.use_unit_name like concat ('%',#{dto.useUnitCreditNameForSearch},'%')
</if>
<if test="dto.receiveCompanyCode != null and dto.receiveCompanyCode != ''">
and (tjurm.receive_company_code = #{dto.receiveCompanyCode}
or tjurm.receive_company_code is null or tjurm.receive_company_code = '')
</if>
-- 企业根据企业统一信用代码匹配
<if test="dto.dataType == 'company' ">
AND tjurm.use_unit_credit_code = #{dto.useUnitCreditCode}
</if>
-- 监管单位根据接受机构匹配
<if test="dto.dataType == 'supervision' ">
AND tjurm.receive_company_code = #{dto.receiveCompanyCode}
</if>
-- 是否车用气瓶(whetherVehicleCylinder)= 1 ,过滤出车用气瓶使用登记证数据
<if test="dto.whetherVehicleCylinder != null and dto.whetherVehicleCylinder == 1 ">
AND tjurm.reg_type = '车用气瓶登记'
</if>
<if test="dto.isScrap != null and dto.isScrap != ''">
and tjurm.is_scrap = #{dto.isScrap}
</if>
<if test="dto.isDoBusiness != null and dto.isDoBusiness != ''">
and tjurm.is_do_business = #{dto.isDoBusiness}
</if>
<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>
<if test="dto.certInBusinessFlag != null and dto.certInBusinessFlag != '' and dto.certInBusinessFlag == 'false'">
and NOT EXISTS ( <include refid="useRegCertInBusiness"/> )
</if>
ORDER BY
<if test="sort != null">
tjurm.${sort.field} ${sort.sortType},
</if>
tjurm.create_date DESC
</where>
</select>
</mapper>
......@@ -379,38 +379,12 @@
</choose>
</select>
<select id="getListPage1" resultType="java.util.Map">
<choose>
<!-- 情况1:有设备过滤条件 -->
<when test="dto.equList != null or dto.equCategory != null or dto.equDefine != null or
dto.equCode != null or dto.code96333 != null or dto.supervisoryCode != null">
WITH pre_filtered_equipment AS (
SELECT DISTINCT re.equip_transfer_id
<select id="getListPage1" resultType="java.util.Map" fetchSize="500">
WITH pre_filtered_equipment AS NOT MATERIALIZED (
SELECT re.equip_transfer_id
FROM tzs_jg_use_registration_eq re
WHERE EXISTS (
SELECT 1 FROM idx_biz_jg_register_info jri,idx_biz_jg_other_info other
WHERE jri."RECORD" = re.equ_id AND other."RECORD" = re.equ_id
<!-- 设备表过滤条件 -->
<if test="dto.equList != null and dto.equList != ''">
AND jri."EQU_LIST" = #{dto.equList}
</if>
<if test="dto.equCategory != null and dto.equCategory != ''">
AND jri."EQU_CATEGORY" = #{dto.equCategory}
</if>
<if test="dto.equDefine != null and dto.equDefine != ''">
AND jri."EQU_DEFINE" = #{dto.equDefine}
</if>
<if test="dto.equCode != null and dto.equCode != ''">
AND jri."EQU_CODE" LIKE CONCAT(#{dto.equCode}, '%')
</if>
<if test="dto.code96333 != null and dto.code96333 != ''">
AND other."CODE96333" LIKE CONCAT(#{dto.code96333}, '%')
</if>
<if test="dto.supervisoryCode != null and dto.supervisoryCode != ''">
AND other."SUPERVISORY_CODE" LIKE CONCAT(#{dto.supervisoryCode}, '%')
</if>
)
AND EXISTS (
WHERE
EXISTS (
SELECT 1 FROM tzs_jg_use_registration fu
WHERE fu.sequence_nbr = re.equip_transfer_id
AND fu.is_delete = '0'
......@@ -466,12 +440,45 @@
OR fu.transfer_to_user_ids LIKE CONCAT('%', #{dto.currentUserId}, '%'))
</if>
)
<if test="dto.equList != null or dto.equCategory != null or dto.equDefine != null or
dto.equCode != null">
AND EXISTS (
SELECT 1 FROM idx_biz_jg_register_info jri
WHERE jri."RECORD" = re.equ_id
<!-- 设备表过滤条件 -->
<if test="dto.equList != null and dto.equList != ''">
AND jri."EQU_LIST" = #{dto.equList}
</if>
<if test="dto.equCategory != null and dto.equCategory != ''">
AND jri."EQU_CATEGORY" = #{dto.equCategory}
</if>
<if test="dto.equDefine != null and dto.equDefine != ''">
AND jri."EQU_DEFINE" = #{dto.equDefine}
</if>
<if test="dto.equCode != null and dto.equCode != ''">
AND jri."EQU_CODE" LIKE CONCAT(#{dto.equCode}, '%')
</if>
)
</if>
<if test="dto.code96333 != null or dto.supervisoryCode != null">
AND EXISTS (
SELECT 1 FROM idx_biz_jg_other_info other
WHERE other."RECORD" = re.equ_id
<!-- 设备表过滤条件 -->
<if test="dto.code96333 != null and dto.code96333 != ''">
AND other."CODE96333" LIKE CONCAT(#{dto.code96333}, '%')
</if>
<if test="dto.supervisoryCode != null and dto.supervisoryCode != ''">
AND other."SUPERVISORY_CODE" LIKE CONCAT(#{dto.supervisoryCode}, '%')
</if>
)
</if>
),
main_data AS (
SELECT
fu.sequence_nbr AS sequenceNbr,
fu.audit_status AS auditStatus,
DATE_FORMAT ( fu.reg_date, '%Y-%m-%d' ) AS regDate,
DATE_FORMAT(fu.reg_date, '%Y-%m-%d') AS regDate,
fu.use_unit_name AS useUnitName,
fu.supervision_org_code AS supervisionOrgCode,
fu.status,
......@@ -482,9 +489,8 @@
fu.next_execute_ids AS nextExecuteIds,
fu.promoter,
fu.use_registration_code AS useRegistrationCode,
DATE_FORMAT ( fu.audit_pass_date, '%Y-%m-%d' ) AS auditPassDate,
DATE_FORMAT ( fu.create_date, '%Y-%m-%d' ) AS createDate,
fu.receive_org_name AS receiveOrgName,
DATE_FORMAT(fu.audit_pass_date, '%Y-%m-%d') AS auditPassDate,
DATE_FORMAT(fu.create_date, '%Y-%m-%d') AS createDate,
fu.next_execute_user_ids AS nextExecuteUserIds,
fu.next_task_id AS nextTaskId,
fu.create_user_id AS createUserId,
......@@ -500,49 +506,77 @@
fu.use_address AS fullAddress,
fu.cancel_reason AS cancelReason,
fu.project_contraption_id AS projectContraptionId,
( SELECT company_name FROM privilege_company WHERE org_code = fu.supervision_org_code AND is_deleted = FALSE LIMIT 1 ) AS orgBranchName
(
SELECT company_name
FROM privilege_company
WHERE org_code = fu.supervision_org_code
AND is_deleted = FALSE
LIMIT 1
) AS orgBranchName
FROM tzs_jg_use_registration fu
WHERE EXISTS (
SELECT 1
FROM pre_filtered_equipment pfe
JOIN tzs_jg_use_registration fu ON pfe.equip_transfer_id = fu.sequence_nbr
WHERE pfe.equip_transfer_id = fu.sequence_nbr
)
ORDER BY fu.create_date DESC, fu.apply_no DESC
LIMIT 20 OFFSET 0
LIMIT #{size} OFFSET #{offset}
),
equipment_aggregates AS MATERIALIZED (
SELECT
re.equip_transfer_id,
STRING_AGG(DISTINCT other."CODE96333", ',') AS code96333,
STRING_AGG(DISTINCT other."SUPERVISORY_CODE", ',') AS supervisoryCode,
STRING_AGG(DISTINCT jri."PRODUCT_NAME", ',') AS productName,
STRING_AGG(DISTINCT jri."EQU_CODE", ',') AS equCode,
STRING_AGG(DISTINCT jri."EQU_LIST", ',') AS equListCode,
STRING_AGG(DISTINCT jri."EQU_CATEGORY", ',') AS equCategoryCode,
STRING_AGG(DISTINCT jri."EQU_DEFINE", ',') AS equDefineCode
FROM main_data md
JOIN tzs_jg_use_registration_eq re ON md.sequenceNbr = re.equip_transfer_id
LEFT JOIN idx_biz_jg_other_info other ON re.equ_id = other."RECORD"
LEFT JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD"
GROUP BY re.equip_transfer_id
),
category_mapping AS MATERIALIZED (
SELECT
code,
name
FROM tz_equipment_category
WHERE code IN (
SELECT DISTINCT unnest(string_to_array(agg.equListCode || ',' || agg.equCategoryCode || ',' || agg.equDefineCode, ','))
FROM equipment_aggregates agg
WHERE agg.equListCode IS NOT NULL
OR agg.equCategoryCode IS NOT NULL
OR agg.equDefineCode IS NOT NULL
)
)
SELECT
md.*,
(SELECT STRING_AGG(DISTINCT other.code96333, ',')
FROM tzs_jg_use_registration_eq re
JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD"
JOIN idx_biz_jg_other_info other ON jri."RECORD" = other."RECORD"
WHERE re.equip_transfer_id = md.sequenceNbr) AS code96333,
(SELECT STRING_AGG(DISTINCT other.supervisory_code, ',')
FROM tzs_jg_use_registration_eq re
JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD"
JOIN idx_biz_jg_other_info other ON jri."RECORD" = other."RECORD"
WHERE re.equip_transfer_id = md.sequenceNbr) AS supervisoryCode,
(SELECT STRING_AGG(DISTINCT jri.PRODUCT_NAME, ',')
FROM tzs_jg_use_registration_eq re
JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD"
WHERE re.equip_transfer_id = md.sequenceNbr) AS productName ,
(SELECT STRING_AGG(DISTINCT jri.EQU_CODE, ',')
FROM tzs_jg_use_registration_eq re
JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD"
WHERE re.equip_transfer_id = md.sequenceNbr) AS equCode,
(SELECT STRING_AGG(DISTINCT jri.EQU_LIST, ',')
FROM tzs_jg_use_registration_eq re
JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD"
WHERE re.equip_transfer_id = md.sequenceNbr) AS equListCode ,
(SELECT STRING_AGG(DISTINCT jri.EQU_CATEGORY, ',')
FROM tzs_jg_use_registration_eq re
JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD"
WHERE re.equip_transfer_id = md.sequenceNbr) AS equCategoryCode ,
(SELECT STRING_AGG(DISTINCT jri.EQU_DEFINE, ',')
FROM tzs_jg_use_registration_eq re
JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD"
WHERE re.equip_transfer_id = md.sequenceNbr) AS equDefineCode,
(SELECT name from tz_equipment_category where code = equListCode ) AS equListName,
(SELECT name from tz_equipment_category where code = equCategoryCode ) AS equCategory,
(SELECT name from tz_equipment_category where code = equDefineCode ) AS equDefine
ea.code96333,
ea.supervisoryCode,
ea.productName,
ea.equCode,
ea.equListCode,
ea.equCategoryCode,
ea.equDefineCode,
(
SELECT STRING_AGG(DISTINCT cm.name, ',')
FROM unnest(string_to_array(ea.equListCode, ',')) AS equ_list(code)
JOIN category_mapping cm ON cm.code = equ_list.code
) AS equListName,
(
SELECT STRING_AGG(DISTINCT cm.name, ',')
FROM unnest(string_to_array(ea.equCategoryCode, ',')) AS equ_category(code)
JOIN category_mapping cm ON cm.code = equ_category.code
) AS equCategory,
(
SELECT STRING_AGG(DISTINCT cm.name, ',')
FROM unnest(string_to_array(ea.equDefineCode, ',')) AS equ_define(code)
JOIN category_mapping cm ON cm.code = equ_define.code
) AS equDefine
FROM main_data md
GROUP BY md.sequenceNbr
JOIN equipment_aggregates ea ON md.sequenceNbr = ea.equip_transfer_id
ORDER BY
<choose>
<when test="sort != null and sort.field != null and sort.sortType != null">
......@@ -559,166 +593,22 @@
md.create_date DESC, md.applyNo DESC
</otherwise>
</choose>
LIMIT #{size} OFFSET #{offset}
</when>
<!-- 情况2:无设备过滤条件 -->
<otherwise>
WITH paginated_ids AS (
SELECT sequence_nbr
FROM tzs_jg_use_registration fu
WHERE fu.is_delete = '0'
<!-- 公共主表过滤条件 -->
<if test="dto.status != null and dto.status != ''">
AND fu.status = #{dto.status}
</if>
<if test="dto.applicationDate != null">
AND DATE(fu.create_date) = DATE(#{dto.applicationDate})
</if>
<if test="dto.fullAddress != null and dto.fullAddress != ''">
AND fu.use_address LIKE CONCAT('%', #{dto.fullAddress}, '%')
</if>
<if test="dto.useUnitName != null and dto.useUnitName != ''">
AND fu.use_unit_name LIKE CONCAT('%', #{dto.useUnitName}, '%')
</if>
<if test="dto.applyNo != null and dto.applyNo != ''">
AND fu.apply_no LIKE CONCAT(#{dto.applyNo}, '%')
</if>
<if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''">
AND fu.use_registration_code LIKE CONCAT(#{dto.useRegistrationCode}, '%')
</if>
<if test="dto.useUnitCode != null and dto.useUnitCode != ''">
AND fu.use_unit_credit_code = #{dto.useUnitCode}
</if>
<if test="dto.orgBranchCode != null and dto.orgBranchCode != ''">
<choose>
<when test="client == 'jgLook'">
AND fu.supervision_org_code LIKE CONCAT(#{dto.orgBranchCode}, '%')
</when>
<otherwise>
AND fu.supervision_org_code = #{dto.orgBranchCode}
</otherwise>
</choose>
</if>
<if test="dto.auditPassDateStart != null and dto.auditPassDateEnd != null">
AND fu.audit_pass_date BETWEEN #{dto.auditPassDateStart} AND #{dto.auditPassDateEnd}
</if>
<if test="dto.dataType == 'supervision' ">
<choose>
<when test="client == 'jgAudit'">
AND (fu.receive_company_code = #{dto.receiveCompanyCode}
OR fu.transfer_to_user_ids LIKE CONCAT('%', #{dto.currentUserId}, '%'))
</when>
<otherwise>
AND fu.supervision_org_code LIKE CONCAT(#{dto.supervisionOrgCode}, '%')
</otherwise>
</choose>
AND fu.status != '使用单位待提交'
</if>
<if test="dto.dataType == 'company' ">
AND (fu.use_unit_credit_code = #{dto.unitCode}
OR fu.transfer_to_user_ids LIKE CONCAT('%', #{dto.currentUserId}, '%'))
</if>
ORDER BY
<choose>
<when test="sort != null and sort.field != null and sort.sortType != null">
<choose>
<when test="sort.field == 'create_date'">fu.create_date</when>
<when test="sort.field == 'apply_no'">fu.apply_no</when>
<when test="sort.field == 'reg_date'">fu.reg_date</when>
<when test="sort.field == 'audit_pass_date'">fu.audit_pass_date</when>
<otherwise>${sort.field}</otherwise>
</choose>
${sort.sortType}
</when>
<otherwise>
fu.create_date DESC, fu.apply_no DESC
</otherwise>
</choose>
LIMIT #{size} OFFSET #{offset}
)
SELECT
fu.sequence_nbr AS sequenceNbr,
fu.audit_status AS auditStatus,
DATE_FORMAT(fu.reg_date,'%Y-%m-%d') AS regDate,
fu.use_unit_name AS useUnitName,
fu.supervision_org_code AS supervisionOrgCode,
fu.status,
fu.receive_org_name AS receiveOrgName,
fu.use_address AS place,
fu.instance_id AS instanceId,
fu.apply_no AS applyNo,
fu.next_execute_ids AS nextExecuteIds,
fu.promoter,
fu.use_registration_code AS useRegistrationCode,
DATE_FORMAT(fu.audit_pass_date,'%Y-%m-%d') AS auditPassDate,
DATE_FORMAT(fu.create_date,'%Y-%m-%d') AS createDate,
fu.receive_org_name AS receiveOrgName,
fu.next_execute_user_ids AS nextExecuteUserIds,
fu.next_task_id AS nextTaskId,
fu.create_user_id AS createUserId,
fu.rec_date AS recDate,
fu.manage_type AS manageType,
fu.reg_type AS regType,
fu.is_delete,
fu.create_date,
fu.receive_company_code,
fu.use_unit_credit_code,
fu.transfer_to_user_ids,
fu.supervision_org_code,
fu.use_address AS fullAddress,
fu.cancel_reason AS cancelReason,
fu.project_contraption_id AS projectContraptionId,
(select company_name from privilege_company where org_code = fu.supervision_org_code and is_deleted = false limit 1) AS orgBranchName,
COALESCE(GROUP_CONCAT(DISTINCT re.equ_id), '') AS equipId,
COALESCE(GROUP_CONCAT(DISTINCT other.supervisory_code), '') AS supervisoryCode,
COALESCE(GROUP_CONCAT(DISTINCT other.CODE96333), '') AS code96333,
COALESCE(GROUP_CONCAT(DISTINCT jri.PRODUCT_NAME), '') AS productName,
COALESCE(GROUP_CONCAT(DISTINCT jri.EQU_CODE), '') AS equCode,
COALESCE(GROUP_CONCAT(DISTINCT jri.EQU_LIST), '') AS equListCode,
COALESCE(GROUP_CONCAT(DISTINCT jri.EQU_CATEGORY), '') AS equCategoryCode,
COALESCE(GROUP_CONCAT(DISTINCT jri.EQU_DEFINE), '') AS equDefineCode,
COALESCE(GROUP_CONCAT(DISTINCT c_list.name), '') AS equListName,
COALESCE(GROUP_CONCAT(DISTINCT c_cate.name), '') AS equCategory,
COALESCE(GROUP_CONCAT(DISTINCT c_def.name), '') AS equDefine
FROM paginated_ids pi
JOIN tzs_jg_use_registration fu ON pi.sequence_nbr = fu.sequence_nbr
LEFT JOIN tzs_jg_use_registration_eq re ON fu.sequence_nbr = re.equip_transfer_id
LEFT JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD"
LEFT JOIN idx_biz_jg_other_info other ON jri."RECORD" = other."RECORD"
LEFT JOIN tz_equipment_category c_list ON jri.EQU_LIST = c_list.code
LEFT JOIN tz_equipment_category c_cate ON jri.EQU_CATEGORY = c_cate.code
LEFT JOIN tz_equipment_category c_def ON jri.EQU_DEFINE = c_def.code
GROUP BY fu.sequence_nbr
ORDER BY
<choose>
<when test="sort != null and sort.field != null and sort.sortType != null">
<choose>
<when test="sort.field == 'create_date'">fu.create_date</when>
<when test="sort.field == 'apply_no'">fu.apply_no</when>
<when test="sort.field == 'reg_date'">fu.reg_date</when>
<when test="sort.field == 'audit_pass_date'">fu.audit_pass_date</when>
<otherwise>${sort.field}</otherwise>
</choose>
${sort.sortType}
</when>
<otherwise>
fu.create_date DESC, fu.apply_no DESC
</otherwise>
</choose>
</otherwise>
</choose>
</select>
<select id="getListPageCount" resultType="long">
SELECT <![CDATA[/*+ set(query_dop 16)*/]]> COUNT(DISTINCT ur.sequence_nbr)
SELECT <![CDATA[/*+ set(query_dop 16)*/]]> COUNT(*)
FROM tzs_jg_use_registration ur
LEFT JOIN tzs_jg_use_registration_eq re ON ur.sequence_nbr = re.equip_transfer_id
LEFT JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD"
LEFT JOIN idx_biz_jg_other_info other ON re.equ_id = other."RECORD"
<if test="dto.equList != null or dto.equCategory != null or dto.equDefine != null or
dto.equCode != null or dto.code96333 != null or dto.supervisoryCode != null">
INNER JOIN tzs_jg_use_registration_eq re ON ur.sequence_nbr = re.equip_transfer_id
INNER JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD"
<if test="dto.code96333 != null or dto.supervisoryCode != null">
INNER JOIN idx_biz_jg_other_info other ON re.equ_id = other."RECORD"
</if>
</if>
WHERE ur.is_delete = 0
<if test="dto.equList != null or dto.equCategory != null or dto.equDefine != null or
dto.equCode != null or dto.code96333 != null or dto.supervisoryCode != null">
<!-- 统一设备过滤条件 -->
<if test="dto.equList != null and dto.equList != ''">
AND jri."EQU_LIST" = #{dto.equList}
......@@ -743,6 +633,8 @@
<if test="dto.supervisoryCode != null and dto.supervisoryCode != ''">
AND other."SUPERVISORY_CODE" LIKE CONCAT('%', #{dto.supervisoryCode}, '%')
</if>
</if>
<if test="dto.status != null and dto.status != ''">
AND ur.status = #{dto.status}
</if>
......
......@@ -4,72 +4,96 @@
<select id="queryForSafetyProblemTracingPage"
resultType="com.yeejoin.amos.boot.module.jg.api.dto.SafetyProblemTracingDto">
select
SELECT
spt.*,
case when spt."problem_status_code" = '0' then '红'
else '绿' end hiddenDangersLevel,
(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
CASE
WHEN spt.problem_status_code = '0' THEN '红'
ELSE '绿'
END AS hiddenDangersLevel,
cdd.extend::json ->> 'pic' AS problemTypePic
FROM tzs_safety_problem_tracing spt
LEFT JOIN cb_data_dictionary cdd
ON cdd.type = 'ISSUE_TYPE'
AND cdd.code = spt.problem_type_code
<where>
spt.is_delete = false
spt.is_delete = FALSE
<if test="problemModel.problemNum != null and problemModel.problemNum != ''">
and spt.problem_num = LIKE CONCAT('%', #{problemModel.problemNum}, '%')
AND spt.problem_num LIKE CONCAT('%', #{problemModel.problemNum}, '%')
</if>
<if test="problemModel.problemStatus != null and problemModel.problemStatus != ''">
and spt.problem_status = #{problemModel.problemStatus}
AND spt.problem_status = #{problemModel.problemStatus}
</if>
<if test="problemModel.equipListCode != null and problemModel.equipListCode != ''">
and spt.equip_list_code = #{problemModel.equipListCode}
AND spt.equip_list_code = #{problemModel.equipListCode}
</if>
<if test="problemModel.equCategoryCode != null and problemModel.equCategoryCode != ''">
and spt.equ_category_code = #{problemModel.equCategoryCode}
AND spt.equ_category_code = #{problemModel.equCategoryCode}
</if>
<if test="problemModel.sourceTypeCode != null and problemModel.sourceTypeCode != ''">
and spt.source_type_code = #{problemModel.sourceTypeCode}
AND spt.source_type_code = #{problemModel.sourceTypeCode}
</if>
<if test="problemModel.problemLevelCode != null and problemModel.problemLevelCode != ''">
and spt.problem_level_code = #{problemModel.problemLevelCode}
AND spt.problem_level_code = #{problemModel.problemLevelCode}
</if>
<if test="problemModel.problemTypeCode != null and problemModel.problemTypeCode != ''">
and spt.problem_type_code = #{problemModel.problemTypeCode}
AND spt.problem_type_code = #{problemModel.problemTypeCode}
</if>
<if test="problemModel.problemTimeRange != null and problemModel.problemTimeRange.beginDate != null">
and to_char(spt.problem_time, 'YYYY-MM-DD') <![CDATA[>=]]>
AND to_char(spt.problem_time, 'YYYY-MM-DD') <![CDATA[>=]]>
to_char(#{problemModel.problemTimeRange.beginDate}::timestamp, 'YYYY-MM-DD')
</if>
<if test="problemModel.problemTimeRange != null and problemModel.problemTimeRange.endDate != null">
and to_char(spt.problem_time, 'YYYY-MM-DD') <![CDATA[<=]]>
AND to_char(spt.problem_time, 'YYYY-MM-DD') <![CDATA[<=]]>
to_char(#{problemModel.problemTimeRange.endDate}::timestamp, 'YYYY-MM-DD')
</if>
<if test="problemModel.problemDesc != null and problemModel.problemDesc != ''">
and spt.problem_desc like CONCAT('%', #{problemModel.problemDesc}, '%')
AND spt.problem_desc LIKE CONCAT('%', #{problemModel.problemDesc}, '%')
</if>
<if test="problemModel.sourceId != null and problemModel.sourceId != ''">
and spt.source_id = #{problemModel.sourceId}
AND spt.source_id = #{problemModel.sourceId}
</if>
<if test="problemModel.governingBodyOrgCode != null and problemModel.governingBodyOrgCode != ''">
and spt.governing_body_org_code like CONCAT(#{problemModel.governingBodyOrgCode}, '%')
AND spt.governing_body_org_code LIKE CONCAT(#{problemModel.governingBodyOrgCode}, '%')
</if>
<if test="problemModel.governingBodyCode != null and problemModel.governingBodyCode != ''">
and spt.governing_body_code = #{problemModel.governingBodyCode}
AND spt.governing_body_code = #{problemModel.governingBodyCode}
</if>
<if test="problemModel.principalUnit != null and problemModel.principalUnit != ''">
and spt.principal_unit like CONCAT('%', #{problemModel.principalUnit}, '%')
AND spt.principal_unit LIKE CONCAT('%', #{problemModel.principalUnit}, '%')
</if>
<if test="problemModel.principalUnitType != null and problemModel.principalUnitType != ''">
and spt.principal_unit_type like CONCAT('%', #{problemModel.principalUnitType}, '%')
AND spt.principal_unit_type LIKE CONCAT('%', #{problemModel.principalUnitType}, '%')
</if>
<if test="problemModel.hiddenDangersLevel != null and problemModel.hiddenDangersLevel != ''">
and spt.problem_status_code = #{problemModel.hiddenDangersLevel}
AND spt.problem_status_code = #{problemModel.hiddenDangersLevel}
</if>
<if test="problemModel.regionCode != null and problemModel.regionCode != ''">
and spt.region_code like CONCAT('%',#{problemModel.regionCode}, '%')
AND spt.region_code LIKE CONCAT('%', #{problemModel.regionCode}, '%')
</if>
<if test="problemModel.problemStatusCode != null and problemModel.problemStatusCode != ''">
and spt.problem_status_code = #{problemModel.problemStatusCode}
AND spt.problem_status_code = #{problemModel.problemStatusCode}
</if>
</where>
order by spt.create_date desc
ORDER BY spt.create_date DESC
</select>
<select id="queryEquipListByProblemId" resultType="java.util.Map">
......
......@@ -27,6 +27,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.transaction.event.TransactionalEventListener;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import javax.annotation.PostConstruct;
import java.util.*;
import java.util.concurrent.BlockingQueue;
......@@ -335,9 +336,23 @@ public class ChangeEquipImpactCertListener {
log.info("处理 handleNewProjectEdit 类型逻辑");
IdxBizJgProjectContraption projectContraption = jgProjectContraptionService.getById(projectContraptionId);
JSONObject certificatePrintTag = Optional.ofNullable(projectContraption.getCertificatePrintTag())
.map(JSONObject::parseObject).orElse(new JSONObject());
.map(JSONObject::parseObject)
.orElseGet(JSONObject::new);
JSONObject tagJson = this.handleFieldChangeProject(fieldChangeMetaList, certificatePrintTag);
projectContraption.setCertificatePrintTag(JSONObject.toJSONString(tagJson));
projectContraption.setCertificatePrintTag(tagJson.toJSONString());
jgProjectContraptionService.updateById(projectContraption);
String useOrgCode = fieldChangeMetaList.stream()
.filter(meta -> "useRegistrationCode".equals(meta.getColumnKey()))
.map(FieldChangeMeta::getColumnOldValue)
.findFirst()
.orElse(null);
if (!ValidationUtil.isEmpty(useOrgCode)) {
JgUseRegistrationManage jgUseRegistrationManage = jgUseRegistrationManageService.lambdaQuery()
.eq(JgUseRegistrationManage::getUseRegistrationCode, useOrgCode)
.eq(JgUseRegistrationManage::getIsDelete, 0)
.one();
this.handleFieldChange(fieldChangeMetaList, jgUseRegistrationManage);
}
}
}
......@@ -61,6 +61,7 @@ import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import javax.annotation.PostConstruct;
import java.io.IOException;
......@@ -1142,4 +1143,16 @@ public class CommonEquipDataProcessService {
this.updateUseOrgCode2NewPipeline(e, useRegistrationCode);
});
}
public void beforeCheckForUseOrgCode(ProjectContraptionChangeDataDto dto) {
LambdaQueryWrapper<IdxBizJgProjectContraption> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(IdxBizJgProjectContraption::getUseRegistrationCode, dto.getUseRegistrationCode())
.ne(BaseEntity::getSequenceNbr, dto.getProjectContraptionId());
if (idxBizJgProjectContraptionServiceImpl.count(queryWrapper) > 0) {
throw new BadRequest("使用登记证编号已存在!");
}
if (!ValidationUtil.isEmpty(dto.getUseRegistrationCode())){
jgRegisterInfoService.checkUseRegistrationCode(dto.getUseRegistrationCode(), "unit");
}
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.jg.biz.edit.process.equip;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
......@@ -224,8 +225,10 @@ public class EquipChangeDataUpdateServiceImpl {
return columnDto;
}).collect(Collectors.toList());
// sql 动态构建入库
if (CollUtil.isNotEmpty(columns)) {
commonMapper.updateTechParamDynamic(tableName, record, columns);
}
}
public void checkFactoryChangeData(String record, EquipFactoryChangeDataDto equipFactoryChangeDataDto, String equList, String equCategory, String equDefine) {
// 气瓶时检验出厂编号-普通气瓶,车用气瓶不再此范围内
......
......@@ -15,6 +15,7 @@ import com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.DefaultBizDataChange
import com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.strategy.IBizDataChangeHandleStrategy;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.HandleResult;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.IEquipChangeDataProcessStrategy;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgRegisterInfoServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
......@@ -28,6 +29,7 @@ import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.io.IOException;
......@@ -52,6 +54,7 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
private final RestHighLevelClient restHighLevelClient;
private final EsEquipmentDao esEquipmentDao;
private final IdxBizJgRegisterInfoServiceImpl idxBizJgRegisterInfoServiceImpl;
@Override
......@@ -265,7 +268,6 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
return orgCode;
}
private void beforeCheckForUseOrgCode(IdxBizJgUseInfo useInfoOld, IdxBizJgRegisterInfo registerInfoNew) {
// 1.使用登记证编辑时重复性校验
if (!CylinderTypeEnum.CYLINDER.getCode().equals(registerInfoNew.getEquCategory())) { // 非气瓶逻辑,所有设备不能重复
......@@ -286,7 +288,9 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
}
}
}
if (!ValidationUtil.isEmpty(registerInfoNew.getUseOrgCode())){
idxBizJgRegisterInfoServiceImpl.checkUseRegistrationCode(registerInfoNew.getUseOrgCode(), "unit");
}
}
@Override
......
......@@ -19,15 +19,11 @@ import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.HandleRes
import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.IEquipChangeDataProcessStrategy;
import com.yeejoin.amos.boot.module.jg.biz.edit.typeHandler.PieLineLevelTypeHandler;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgRegisterInfoServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgConstructionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgInspectionDetectionInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgRegisterInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.*;
import java.util.function.Function;
......@@ -76,7 +72,10 @@ public class SingleProjectEquipChangeProcess implements IEquipChangeDataProcessS
// 2.装置基本信息校验、保存(前端返回的装置信息为大写 需注意)
ProjectContraptionChangeDataDto projectContraptionChangeDataDto = CommonEquipDataProcessService.castMap2Bean(changeData, ProjectContraptionChangeDataDto.class);
this.setNameForDictKey(projectContraptionChangeDataDto);
// 校验使用登记证编号是否重复
if (Objects.toString(projectContraptionChangeDataDto.getDataSource(), "").startsWith("jg_his")) {
commonEquipDataProcessService.beforeCheckForUseOrgCode(projectContraptionChangeDataDto);
}
pieLineDataChangeService.update(projectContraptionChangeDataDto, allChangeColumns);
Boolean isRequireTemporarySave = data.getBoolean(DefaultBizDataChangeHandler.IS_REQUIRES_TEMPORARY_SAVE);
JSONArray oldPieLineJSONArray = data.getJSONArray(DefaultBizDataChangeHandler.TEMPORARY_PIPELINES_DATA);
......
......@@ -28,6 +28,7 @@ import com.yeejoin.amos.boot.module.jg.api.dto.EquipRequestParamsDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationManage;
import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.EquipSourceEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.IsIntoManagementEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.PipelineEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper;
......@@ -400,6 +401,7 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ
record.setCompanyType(companyType2);
// 来源类型:前端控制编辑按钮显示隐藏
record.setRegType(CommonServiceImpl.genRegTypeByDataSource(record.getDataSource()));
record.setIsIntoManagementName(IsIntoManagementEnum.getName(record.getIsIntoManagement()));
// 设置是否发生过后续业务::前端控制编辑按钮显示隐藏
record.setHappenAfterBiz(projectContraptionUseMap.getOrDefault(record.getSequenceNbr() + "", false));
});
......
......@@ -147,6 +147,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
public static final String WHETHER_SKID_MOUNTED_PRESSURE_VESSEL = "WHETHER_SKID_MOUNTED_PRESSURE_VESSEL";
// 设备纳管 纳管:true 未纳管:false
public static final String IS_INTO_MANAGEMENT = "IS_INTO_MANAGEMENT";
public static final String IS_INTO_MANAGEMENT_NAME = "IS_INTO_MANAGEMENT_NAME";
public static final String IS_DO_BUSINESS = "IS_DO_BUSINESS";
// 设备来源 jg:新设备录入 jg_his:历史数据录入
public static final String DATA_SOURCE = "DATA_SOURCE";
......@@ -3014,6 +3015,10 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
dto2.put(DATA_SOURCE, s);
dto2.put(DATA_SOURCE_NAME, EquipSourceEnum.getDataSourceName(s));
}
dto2.computeIfPresent(IS_INTO_MANAGEMENT, (k, v) -> {
dto2.put(IS_INTO_MANAGEMENT_NAME, IsIntoManagementEnum.getName(Boolean.parseBoolean(v.toString())));
return v;
});
dto2.put("record", dto2.get(SEQUENCE_NBR));
list.add(dto2);
}
......@@ -4439,17 +4444,19 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
inspectionDetectionInfo.setRecDate(new Date());
inspectionDetectionInfo.setInspectType("ZZJDJY");
inspectionDetectionInfo.setInspectConclusion("6040");// 默认合格
// 根据条件确定增加的年数
Optional.ofNullable(data.getInspectDate())
.filter(s -> !s.trim().isEmpty())
.map(dateStr -> LocalDate.parse(dateStr, DateTimeFormatter.ofPattern("yyyy-MM-dd")))
.ifPresent(inspectDate -> {
inspectionDetectionInfo.setInspectDate(Date.from(inspectDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
// 计算下次检测日期(加 3 年或 4 年)
int plusYears = SPECIAL_CYLINDER.getCode().equals(equipInfoDto.getEquDefineCode()) ? 3 : 4;
LocalDate nextInspectDate = inspectDate.plusYears(plusYears);
inspectionDetectionInfo.setNextInspectDate(Date.from(nextInspectDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
});
inspectionDetectionInfo.setInspectDate(DateUtil.parse(data.getInspectDate(), "yyyy-MM-dd"));
inspectionDetectionInfo.setNextInspectDate(DateUtil.parse(data.getNextInspectDate(), "yyyy-MM-dd"));
// 根据条件确定增加的年数(杨生元说监管让去掉,企业自己输入)
// Optional.ofNullable(data.getInspectDate())
// .filter(s -> !s.trim().isEmpty())
// .map(dateStr -> LocalDate.parse(dateStr, DateTimeFormatter.ofPattern("yyyy-MM-dd")))
// .ifPresent(inspectDate -> {
// inspectionDetectionInfo.setInspectDate(Date.from(inspectDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
// // 计算下次检测日期(加 3 年或 4 年)
// int plusYears = SPECIAL_CYLINDER.getCode().equals(equipInfoDto.getEquDefineCode()) ? 3 : 4;
// LocalDate nextInspectDate = inspectDate.plusYears(plusYears);
// inspectionDetectionInfo.setNextInspectDate(Date.from(nextInspectDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
// });
inspectionDetectionInfoList.add(inspectionDetectionInfo);
// 其他信息
......
......@@ -815,7 +815,7 @@ public class JgChangeVehicleRegistrationUnitServiceImpl extends BaseService<JgCh
public Page<JgUseRegistrationManageDto> getUseRegistrationCodeData(Page<JgUseRegistrationManageDto> page,
JgUseRegistrationManageDto dto) {
return jgUseRegistrationManageService.queryForJgUseRegistrationManagePage(page, dto, null);
return jgUseRegistrationManageService.queryUseRegistrationManagePage(page, dto, null);
}
public Map<String, Object> getEquList(String useRegistrationCode) {
......
......@@ -330,6 +330,20 @@ public class JgUseRegistrationManageServiceImpl extends BaseService<JgUseRegistr
return jgUseRegistrationManageMapper.queryForPage(page, dto, sortMap);
}
/**
* 分页查询证管理表-选择证使用,添加产权单位id
*/
public Page<JgUseRegistrationManageDto> queryUseRegistrationManagePage(Page<JgUseRegistrationManageDto> page,
JgUseRegistrationManageDto dto,
String sort) {
SortVo sortMap = commonServiceImpl.sortFieldConversion(sort);
if (ApplicationFormTypeEnum.BF.getBusinessCode().equals(dto.getApplyType()) && (!CylinderTypeEnum.CYLINDER.getCode().equals(dto.getEquCategoryCode()) || dto.getRegType().equals(BusinessTypeEnum.JG_VEHICLE_GAS_APPLICATION.getName()))){
dto.setCertificateStatus(null);
dto.setIsScrap("0");
}
return jgUseRegistrationManageMapper.queryUseRegistrationManagePage(page, dto, sortMap);
}
public Page<JgUseRegistrationManageDto> queryForJgUseRegistrationManagePageForJG(JgUseRegistrationManageDto dto, String sort, int current, int size) {
Page<JgUseRegistrationManageDto> page = new Page<JgUseRegistrationManageDto>();
page.setCurrent(current);
......
......@@ -359,13 +359,14 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
SortVo sortMap = commonServiceImpl.sortFieldConversionNoToUnderline(sort);
// 统计查询时间
long startTime = System.currentTimeMillis();
long total = this.baseMapper.getListPageCount(sortMap, dto, roleIds, client);
logger.info("使用登记单据-列表查询");
List<Map<String, Object>> resultRecords = this.baseMapper.getListPage1(page.getSize(), page.getSize() * (page.getCurrent() - 1), sortMap, dto, roleIds, client);
List<Map<String, Object>> resultRecords = this.baseMapper.getListPage1(page.getSize(), Long.min(page.getSize() * (page.getCurrent() - 1), total), sortMap, dto, roleIds, client);
logger.info("使用登记单据-列表查询耗时:{}毫秒", (System.currentTimeMillis() - startTime));
page.setRecords(resultRecords);
logger.info("使用登记单据-列表总数查询");
startTime = System.currentTimeMillis();
page.setTotal(this.baseMapper.getListPageCount(sortMap, dto, roleIds, client));
page.setTotal(total);
logger.info("使用登记单据-列表总数查询耗时:{}毫秒", (System.currentTimeMillis() - startTime));
return page;
}
......
......@@ -287,6 +287,7 @@ public class WordTemplateUtils {
if (value == null) {
return null;
}
value = removeControlCharsManual(value);
return value.replace("&", "&amp;")
.replace("<", "&lt;")
.replace(">", "&gt;")
......@@ -296,4 +297,18 @@ public class WordTemplateUtils {
.replace(")", "&#41;");
}
public static String removeControlCharsManual(String input) {
if (input == null) return "";
StringBuilder sb = new StringBuilder();
for (int i = 0; i < input.length(); i++) {
char c = input.charAt(i);
// 只保留允许的字符
if (c > 31 || c == '\t' || c == '\n' || c == '\r') {
sb.append(c);
}
}
return sb.toString();
}
}
......@@ -40,6 +40,8 @@ public enum EquipAdvanceSearchEnum {
AZUSC_UNIT_NAME("安装改造维修单位名称", "USC_UNIT_NAME", TechnicalParameter.ParamType.STRING, "", null, null, FieldType.Text),
CODE96333("96333识别码", "CODE96333", TechnicalParameter.ParamType.STRING, "", null, null, FieldType.Keyword),
SUPERVISORY_CODE("监管码", "SUPERVISORY_CODE", TechnicalParameter.ParamType.STRING, "", null, null, FieldType.Keyword),
EQU_CODE("设备代码", "EQU_CODE", TechnicalParameter.ParamType.STRING, "", null, null, FieldType.Keyword),
FACTORY_NUM("出厂编号", "FACTORY_NUM", TechnicalParameter.ParamType.STRING, "", null, null, FieldType.Keyword),
EQU_TYPE("设备型号", "EQU_TYPE", TechnicalParameter.ParamType.STRING, "", null, null, FieldType.Text),
PRODUCE_DATE("制造日期", "PRODUCE_DATE", TechnicalParameter.ParamType.DATE, "", null, null, FieldType.Date),
designDate("设计日期", "designDate", TechnicalParameter.ParamType.DATE, "", null, null, FieldType.Date),
......
......@@ -19,7 +19,6 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Collections;
import java.util.List;
import java.util.Map;
......@@ -193,6 +192,6 @@ public class ZLDPStatisticsController {
@GetMapping(value = "/getTree")
@ApiOperation(httpMethod = "GET", value = "查询监管部门树", notes = "查询监管部门树")
public ResponseModel<Object> getTree(){
return ResponseHelper.buildResponse(Collections.singletonList(statisticsService.getRegulatorUnitTree()));
return ResponseHelper.buildResponse(statisticsService.getAllRegulatorUnitTree());
}
}
......@@ -910,7 +910,7 @@ public class AQZSDPStatisticsServiceImpl {
result.put("total", hasSupervisoryCodeEquipCount);
//2.压力管道长度统计
// stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,true, false);
jgDPStatisticsService.staticsCenterMapCountPipLine(result, orgCode);
jgDPStatisticsService.staticsCenterMapCountPipLine(result, orgCode, true);
//3.单位数量统计
// 单位统计修改为查询es
// this.staticsCenterMapCountDataForCompany(result, orgCode, dpFilterParamDto.getCityCode());
......@@ -1024,7 +1024,7 @@ public class AQZSDPStatisticsServiceImpl {
stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode,true,true, false);
// 2. 压力管道长度统计
// stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,true, false);
jgDPStatisticsService.staticsCenterMapCountPipLine(result, orgCode);
jgDPStatisticsService.staticsCenterMapCountPipLine(result, orgCode, true);
//3.单位数量统计
// 单位统计修改为查询es
// this.staticsCenterMapCountDataForCompany(result, orgCode, dpFilterParamDto.getCityCode());
......
......@@ -1211,6 +1211,10 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
queryBuilder.should(QueryBuilders.wildcardQuery("SAFETY_MANAGER.keyword", "*" + fuzzyValue + "*"));
queryBuilder.should(QueryBuilders.wildcardQuery("ORG_BRANCH_NAME", "*" + fuzzyValue + "*"));
queryBuilder.should(QueryBuilders.wildcardQuery("MAINTAIN_UNIT_NAME", "*" + fuzzyValue + "*"));
queryBuilder.should(QueryBuilders.wildcardQuery("FACTORY_NUM", "*" + fuzzyValue + "*"));
queryBuilder.should(QueryBuilders.wildcardQuery("EQU_CODE", "*" + fuzzyValue + "*"));
queryBuilder.should(QueryBuilders.wildcardQuery("CODE96333", "*" + fuzzyValue + "*"));
queryBuilder.should(QueryBuilders.wildcardQuery("SUPERVISORY_CODE", "*" + fuzzyValue + "*"));
queryBuilder.minimumShouldMatch(1);
boolMust.must(queryBuilder);
} else if (k.equals("WHETHER_VEHICLE_CYLINDER")) {
......
......@@ -34,6 +34,7 @@ import com.yeejoin.amos.boot.module.jg.api.enums.*;
import com.yeejoin.amos.boot.module.jg.api.mapper.*;
import com.yeejoin.amos.boot.module.statistcs.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.statistcs.biz.utils.QueryBuilderUtils;
import com.yeejoin.amos.boot.module.statistcs.factory.EnhancedDynamicQueryBuilder;
import com.yeejoin.amos.boot.module.statistics.api.dto.*;
import com.yeejoin.amos.boot.module.statistics.api.enums.RegulatoryUnitLevelEnum;
import com.yeejoin.amos.boot.module.statistics.api.enums.StatisticalAnalysisEnum;
......@@ -396,7 +397,7 @@ public class JGDPStatisticsServiceImpl {
//2.压力管道长度统计
// 修改为查询es
// stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode, true, false);
this.staticsCenterMapCountPipLine(result, orgCode);
this.staticsCenterMapCountPipLine(result, orgCode, true);
//3.单位数量统计
this.staticsCenterMapCountDataForCompany(result, orgCode, dpFilterParamDto.getCityCode());
//4.人员数量统计
......@@ -415,7 +416,8 @@ public class JGDPStatisticsServiceImpl {
//1.8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode, false, true, false);
//2.压力管道长度统计
stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode, false, false);
this.staticsCenterMapCountPipLine(result, orgCode, false);
// stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode, false, false);
return result;
}
......@@ -432,7 +434,7 @@ public class JGDPStatisticsServiceImpl {
// 2. 压力管道长度统计
// 修改为查询es
//stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode, true, false);
this.staticsCenterMapCountPipLine(result, orgCode);
this.staticsCenterMapCountPipLine(result, orgCode, true);
// 3. 人员数量统计
this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto, orgCode);
return result;
......@@ -490,7 +492,7 @@ public class JGDPStatisticsServiceImpl {
}
public void staticsCenterMapCountPipLine(Map<String, Object> result, String orgCode) {
public void staticsCenterMapCountPipLine(Map<String, Object> result, String orgCode, Boolean isMatchSupervisoryCode) {
SearchRequest request = new SearchRequest();
SearchSourceBuilder builder = new SearchSourceBuilder();
request.indices(StatisticalAnalysisEnum.equip.getKey());
......@@ -498,8 +500,16 @@ public class JGDPStatisticsServiceImpl {
BoolQueryBuilder pipeLengthQuery = new BoolQueryBuilder();
pipeLengthQuery.must(QueryBuilders.prefixQuery("ORG_BRANCH_CODE", orgCode));
pipeLengthQuery.must(QueryBuilders.existsQuery("pipeLength"));
pipeLengthQuery.must(QueryBuilders.prefixQuery("ORG_BRANCH_CODE", orgCode));
if (isMatchSupervisoryCode) {
pipeLengthQuery.must(existsQuery("SUPERVISORY_CODE"));
pipeLengthQuery.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE", ""));
} else {
EnhancedDynamicQueryBuilder enhancedDynamicQueryBuilder = new EnhancedDynamicQueryBuilder();
enhancedDynamicQueryBuilder.add(QueryBuilders.boolQuery().mustNot(existsQuery("SUPERVISORY_CODE")), "or");
enhancedDynamicQueryBuilder.add(QueryBuilders.termQuery("SUPERVISORY_CODE", ""), "or");
pipeLengthQuery.must(enhancedDynamicQueryBuilder.build());
}
pipeLengthQuery.mustNot(QueryBuilders.termsQuery("STATUS", Arrays.asList("草稿", "已拒领", "待认领")));
SumAggregationBuilder pipeLengthAgg = AggregationBuilders.sum("pipeLengthSum").field("pipeLength").missing(0);
builder.query(pipeLengthQuery);
......@@ -1834,7 +1844,7 @@ public class JGDPStatisticsServiceImpl {
result.put("total", hasSupervisoryCodeEquipCount);
// 2.压力管道长度统计
// stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode, true, false);
this.staticsCenterMapCountPipLine(result, orgCode);
this.staticsCenterMapCountPipLine(result, orgCode, true);
// 3.已纳管设备总数
this.staticsCenterMapCountDataForEquipIsManage(result);
// 4.登记证总数
......
......@@ -548,7 +548,7 @@ public class JYJCDPStatisticsServiceImpl {
result.put("total", hasSupervisoryCodeEquipCount);
// 3.压力管道统计
// stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,true, false);
jgDPStatisticsService.staticsCenterMapCountPipLine(result, orgCode);
jgDPStatisticsService.staticsCenterMapCountPipLine(result, orgCode, true);
// 4.报检数量统计
this.staticsCenterMapCountDataReporting(result, dpFilterParamDto);
// 5.检验检测临期设备数数量统计
......
......@@ -1278,5 +1278,8 @@ public class ZLDPStatisticsServiceImpl {
return null;
}
public List<LinkedHashMap> getAllRegulatorUnitTree() {
return (List<LinkedHashMap>)redisUtils.get("REGULATOR_UNIT_TREE");
}
}
......@@ -347,6 +347,9 @@ public class TzBaseEnterpriseInfoDto extends BaseDto {
@ApiModelProperty(value = "创建时间")
protected Date createDateEnd;
@ApiModelProperty(value = "创建时间")
protected String createDate;
/**
* 单位类型集合
*/
......
......@@ -19,24 +19,17 @@ public enum CompanyLevelEnum {
HEADQUARTER("headquarter", "省级"),
PREFECTURE_LEVEL("prefecture-level", "地市级"),
COUNTY("county", "区县级"),
ORGANIZATION("organization", "基层机构");
ORGANIZATION("organization", "基层机构"),
COMPANY("company", "企业");
private String code;
private String name;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
......
......@@ -102,4 +102,8 @@ public interface TzBaseEnterpriseInfoMapper extends BaseMapper<TzBaseEnterpriseI
void updateRedundantSupervisionOrgCodeStatistics(String newOrgCode, String oldOrgCode);
void updateEquipmentSupervisionOrgCode(String newOrgCode, String newSupervisionName, List<String> equipmentList);
List<Map<String, String>> getIndividualUserId();
List<Map<String, String>> selectOnlyHasBaseInfoAppId();
}
......@@ -61,6 +61,6 @@ public interface ITzBaseEnterpriseInfoService extends IService<TzBaseEnterpriseI
void refreshCompanyInfo(JSONObject dataResult, String method);
void refreshCompanyOrgCode(JSONObject dataResult, String newOrgCode, String oldOrgCode);
void refreshSupervisionOrgCode(JSONObject dataResult, String newOrgCode, String oldOrgCode);
}
......@@ -36,8 +36,15 @@
<select id="page"
resultType="com.yeejoin.amos.boot.module.tcm.api.dto.TzBaseEnterpriseInfoDto">
SELECT
*,
SELECT "sequence_nbr","use_unit_code","supervise_code","use_unit_certificate","unit_type","use_code","use_unit","supervise_org_code",
"supervise_org_name","key_unit","class_places","province","city","district","street","community",
"address","legal_person","legal_phone","use_contact","contact_phone","safety_one","safety_one_id","safety_one_phone",
"safety_two","safety_two_id","safety_two_phone","longitude","latitude","sync_date","sync_state","app_id","rec_date","rec_user_id",
"governing_body","data_sources","industry","registration_authority","approval_time","operating_status","mainten_person","mainten_telephone",
"sqa","quality_person","quality_telephone","technical_person","is_delete","rec_user_name","equip_category","unit_business_license","unit_exequatur",
"safety_two_photo","safety_one_photo","sqa_phone","qr_code","industry_supervisor","regulatory_labels",
"register_type","other_accessories","status" ,"org_code","office_region","office_address",
DATE_FORMAT(create_date,'%Y-%m-%d') as createDate,
CONCAT(province,'/',city,'/',district) AS region,
CONCAT(street,'/',address) AS full_address
FROM
......@@ -84,7 +91,15 @@
</select>
<select id="pageList" resultType="com.yeejoin.amos.boot.module.tcm.api.dto.TzBaseEnterpriseInfoDto">
SELECT *,
SELECT "sequence_nbr","use_unit_code","supervise_code","use_unit_certificate","unit_type","use_code","use_unit","supervise_org_code",
"supervise_org_name","key_unit","class_places","province","city","district","street","community",
"address","legal_person","legal_phone","use_contact","contact_phone","safety_one","safety_one_id","safety_one_phone",
"safety_two","safety_two_id","safety_two_phone","longitude","latitude","sync_date","sync_state","app_id","rec_date","rec_user_id",
"governing_body","data_sources","industry","registration_authority","approval_time","operating_status","mainten_person","mainten_telephone",
"sqa","quality_person","quality_telephone","technical_person","is_delete","rec_user_name","equip_category","unit_business_license","unit_exequatur",
"safety_two_photo","safety_one_photo","sqa_phone","qr_code","industry_supervisor","regulatory_labels",
"register_type","other_accessories","status" ,"org_code","office_region","office_address",
DATE_FORMAT(create_date,'%Y-%m-%d') as createDate,
CONCAT(province,'/',city,'/',district) AS region,
CONCAT(street,'/',address) AS full_address
FROM tz_base_enterprise_info
......@@ -441,4 +456,22 @@
#{record}
</foreach>
</update>
<select id="getIndividualUserId" resultType="java.util.Map">
SELECT
pc.company_code companyCode, uor.user_id adminUserId
FROM
privilege_company pc
LEFT JOIN privilege_user_org_role uor ON uor.company_seq = pc.sequence_nbr
WHERE
pc.is_deleted = 0
AND pc.company_code IN ( SELECT use_code FROM "tz_base_enterprise_info" WHERE unit_type = '个人主体' AND is_delete = 0 AND app_id is null)
AND uor.role_seq = 1697171841505849345
</select>
<select id="selectOnlyHasBaseInfoAppId" resultType="java.util.Map">
select use_unit_code useUnitCode, app_id appId from tz_base_enterprise_info WHERE app_id is not null
except
select unit_code useUnitCode, app_id appId from tz_flc_reg_unit_info WHERE app_id is not null
</select>
</mapper>
......@@ -50,9 +50,15 @@ public class HistoryDataDealController {
@Deprecated
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/handleCompanyHisOrgCode")
@ApiOperation(httpMethod = "PUT", value = "监管单位层级调整后,业务表(企业、设备、统计等)冗余的所有旧orgCode替换为新orgCode,不更新平台表", notes = "监管单位层级调整后,业务表(企业、设备、统计等)冗余的所有旧orgCode替换为新orgCode,不更新平台表")
@ApiOperation(httpMethod = "POST", value = "监管单位层级调整后,业务表(企业、设备、统计等)冗余的所有旧orgCode替换为新orgCode,不更新平台表", notes = "监管单位层级调整后,业务表(企业、设备、统计等)冗余的所有旧orgCode替换为新orgCode,不更新平台表")
public ResponseModel<String> handleCompanyHisOrgCode(@RequestBody List<Map<String, Object>> orgCodeMap) {
return ResponseHelper.buildResponse(historyDataDealService.handleCompanyHisOrgCode(orgCodeMap));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/handleCompanyAppId")
@ApiOperation(httpMethod = "POST", value = "修复未生成appId的旧企业数据", notes = "修复未生成appId的旧企业数据")
public ResponseModel<String> handleCompanyAppId(@RequestBody(required = false) List<String> useUnitCodes) {
return ResponseHelper.buildResponse(historyDataDealService.handleCompanyAppId(useUnitCodes));
}
}
......@@ -90,16 +90,16 @@ public class TzsAppController {
return ResponseHelper.buildResponse(appService.getEquipInfoBySuperviseCode(supervisoryCode));
}
/**
* 登录
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@PostMapping(value = "/mobile/login")
@ApiOperation(httpMethod = "POST", value = "小程序登录", notes = "小程序登录")
public ResponseModel<Map<String, Object>> login(@RequestBody MobileLoginParam param) {
return ResponseHelper.buildResponse(appService.login(param));
}
// /**
// * 登录
// * @return
// */
// @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
// @PostMapping(value = "/mobile/login")
// @ApiOperation(httpMethod = "POST", value = "小程序登录", notes = "小程序登录")
// public ResponseModel<Map<String, Object>> login(@RequestBody MobileLoginParam param) {
// return ResponseHelper.buildResponse(appService.login(param));
// }
/**
* 小程序企业详情
......
......@@ -87,7 +87,7 @@ public class PlatformUserTopicMessage extends EmqxListener {
JSONObject jsonObject = JSON.parseObject(message.toString());
String newOrgCode = jsonObject.getString("newOrgCode");
String oldOrgCode = jsonObject.getString("oldOrgCode");
tzBaseEnterpriseInfoService.refreshCompanyOrgCode(jsonObject, newOrgCode, oldOrgCode);
tzBaseEnterpriseInfoService.refreshSupervisionOrgCode(jsonObject, newOrgCode, oldOrgCode);
} catch (Exception e) {
log.info("处理平台推送组织架构层级变动消息失败:{}", e.getMessage());
e.printStackTrace();
......
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tcm.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
......@@ -9,7 +10,11 @@ import com.yeejoin.amos.boot.module.common.api.constant.TZSCommonConstant;
import com.yeejoin.amos.boot.module.common.api.entity.TzsUserPermission;
import com.yeejoin.amos.boot.module.tcm.api.entity.TzBaseEnterpriseInfo;
import com.yeejoin.amos.boot.module.tcm.api.entity.TzsUserInfo;
import com.yeejoin.amos.boot.module.tcm.api.enums.UnitTypeEnum;
import com.yeejoin.amos.boot.module.tcm.flc.api.entity.RegUnitInfo;
import com.yeejoin.amos.boot.module.tcm.flc.biz.service.impl.RegUnitInfoServiceImpl;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
......@@ -18,6 +23,7 @@ import org.springframework.util.StopWatch;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author Administrator
......@@ -32,10 +38,13 @@ public class HistoryDataDealServiceImpl {
private TzBaseEnterpriseInfoServiceImpl baseEnterpriseInfoService;
public HistoryDataDealServiceImpl(TzsUserInfoServiceImpl userInfoService, TzsUserPermissionServiceImpl userPermissionService, TzBaseEnterpriseInfoServiceImpl baseEnterpriseInfoService) {
private RegUnitInfoServiceImpl regUnitInfoService;
public HistoryDataDealServiceImpl(TzsUserInfoServiceImpl userInfoService, TzsUserPermissionServiceImpl userPermissionService, TzBaseEnterpriseInfoServiceImpl baseEnterpriseInfoService, RegUnitInfoServiceImpl regUnitInfoService) {
this.userInfoService = userInfoService;
this.userPermissionService = userPermissionService;
this.baseEnterpriseInfoService = baseEnterpriseInfoService;
this.regUnitInfoService = regUnitInfoService;
}
@Transactional(rollbackFor = Exception.class)
......@@ -142,15 +151,88 @@ public class HistoryDataDealServiceImpl {
orgCodeMap.forEach(map -> {
String newOrgCode = map.get("newOrgCode").toString();
String oldOrgCode = map.get("oldOrgCode").toString();
//1. 处理平台旧orgCode本身错误数据
//1. 查询新orgCode对应的监管单位信息
@SuppressWarnings("unchecked")
HashMap<String, Object> platformCompanyInfo = (HashMap<String, Object>) Privilege.companyClient.queryByOrgcode(oldOrgCode).getResult();
HashMap<String, Object> platformCompanyInfo = (HashMap<String, Object>) Privilege.companyClient.queryByOrgcode(newOrgCode).getResult();
CompanyModel parentModel = JSON.parseObject(JSON.toJSONString(platformCompanyInfo.get(TZSCommonConstant.PLATFORM_FEIGN_RESULT_KEY_COMPANY)), CompanyModel.class);
parentModel.setOrgCode(newOrgCode);
Privilege.companyClient.update(parentModel, parentModel.getSequenceNbr());
JSONObject modelMap = new JSONObject();
modelMap.put("newModel", JSON.toJSON(parentModel));
//2. 处理业务表旧orgCode错误数据
baseEnterpriseInfoService.refreshCompanyOrgCode(null, newOrgCode, oldOrgCode);
baseEnterpriseInfoService.refreshSupervisionOrgCode(modelMap, newOrgCode, oldOrgCode);
});
return "success";
}
public String handleCompanyAppId(List<String> useUnitCodes) {
log.info("为没有appId的企业生成appId开始");
List<TzBaseEnterpriseInfo> unitListWithOutAppId;
if (!ValidationUtil.isEmpty(useUnitCodes)) {
unitListWithOutAppId = baseEnterpriseInfoService.getBaseMapper().selectList(new LambdaQueryWrapper<TzBaseEnterpriseInfo>().in(TzBaseEnterpriseInfo::getUseUnitCode, useUnitCodes).isNull(TzBaseEnterpriseInfo::getAppId));
} else {
unitListWithOutAppId = baseEnterpriseInfoService.getBaseMapper().selectList(new LambdaQueryWrapper<TzBaseEnterpriseInfo>().isNull(TzBaseEnterpriseInfo::getAppId));
}
if (!ValidationUtil.isEmpty(unitListWithOutAppId)) {
// 处理企业未生成appId
List<TzBaseEnterpriseInfo> companyListWithOutAppId;
companyListWithOutAppId = unitListWithOutAppId.stream().filter(unit -> !UnitTypeEnum.grzt.getName().equals(unit.getUnitType())).collect(Collectors.toList());
if (!ValidationUtil.isEmpty(companyListWithOutAppId)) {
List<RegUnitInfo> regUnitInfoList = regUnitInfoService.list(new LambdaQueryWrapper<RegUnitInfo>().in(RegUnitInfo::getUnitCode, companyListWithOutAppId.stream().map(TzBaseEnterpriseInfo::getUseUnitCode).collect(Collectors.toList())));
if (!ValidationUtil.isEmpty(regUnitInfoList)) {
regUnitInfoList.forEach(regUnitInfo -> {
if (ValidationUtil.isEmpty(regUnitInfo.getAppId())) {
AgencyUserModel user = new AgencyUserModel();
user.setUserId(regUnitInfo.getAdminUserId());
try {
regUnitInfo.setAppId(regUnitInfoService.createAppId(user));
} catch (Exception e) {
log.error("为没有appId的企业生成appId异常", e);
throw new RuntimeException(e);
}
}
companyListWithOutAppId.stream().filter(company -> company.getUseUnitCode().equals(regUnitInfo.getUnitCode())).forEach(company -> company.setAppId(regUnitInfo.getAppId()));
});
baseEnterpriseInfoService.updateBatchById(companyListWithOutAppId);
regUnitInfoService.updateBatchById(regUnitInfoList);
}
}
List<TzBaseEnterpriseInfo> individualListWithOutAppId = unitListWithOutAppId.stream().filter(unit -> UnitTypeEnum.grzt.getName().equals(unit.getUnitType())).collect(Collectors.toList());;
// 处理个人主体未生成appId
List<Map<String, String>> individualUserId = baseEnterpriseInfoService.getBaseMapper().getIndividualUserId();
if (!ValidationUtil.isEmpty(individualUserId)) {
individualUserId.forEach(map -> {
AgencyUserModel user = new AgencyUserModel();
user.setUserId(map.get("adminUserId"));
try {
map.put("appId", regUnitInfoService.createAppId(user));
} catch (Exception e) {
log.error("为没有appId的企业生成appId异常", e);
throw new RuntimeException(e);
}
});
}
if (!ValidationUtil.isEmpty(individualListWithOutAppId)) {
individualListWithOutAppId.forEach(individual -> {
Optional<Map<String, String>> firstMap = individualUserId.stream().filter(map -> map.get("companyCode").equals(individual.getUseCode())).findFirst();
firstMap.ifPresent(stringMap -> individual.setAppId(stringMap.get("appId")));
});
baseEnterpriseInfoService.updateBatchById(individualListWithOutAppId);
}
}
// 处理baseInfo表有appId,但是regUnitInfo表没有appId的
List<Map<String, String>> onlyHasBaseInfoAppId = baseEnterpriseInfoService.getBaseMapper().selectOnlyHasBaseInfoAppId();
if (!ValidationUtil.isEmpty(onlyHasBaseInfoAppId)) {
List<RegUnitInfo> regUnitInfoList = regUnitInfoService.list(new LambdaQueryWrapper<RegUnitInfo>().isNull(RegUnitInfo::getAppId).in(RegUnitInfo::getUnitCode, onlyHasBaseInfoAppId.stream().map(e -> e.get("useUnitCode")).collect(Collectors.toList())));
if (!ValidationUtil.isEmpty(regUnitInfoList)) {
regUnitInfoList.forEach(regUnitInfo -> {
Optional<Map<String, String>> firstMap = onlyHasBaseInfoAppId.stream().filter(map -> map.get("useUnitCode").equals(regUnitInfo.getUnitCode())).findFirst();
firstMap.ifPresent(stringMap -> regUnitInfo.setAppId(stringMap.get("appId")));
});
regUnitInfoService.updateBatchById(regUnitInfoList);
}
}
log.info("为没有appId的企业生成appId结束");
return "success";
}
}
......@@ -1466,11 +1466,14 @@ public class TzBaseEnterpriseInfoServiceImpl
@Override
@Transactional
@Async
public void refreshCompanyOrgCode(JSONObject dataResult, String newOrgCode, String oldOrgCode) {
log.info("开始刷新单位orgCode:{}", dataResult);
public void refreshSupervisionOrgCode(JSONObject dataResult, String newOrgCode, String oldOrgCode) {
log.info("开始刷新监管单位orgCode:{}", dataResult);
try {
if (!ValidationUtil.isEmpty(newOrgCode) && !ValidationUtil.isEmpty(oldOrgCode) && !newOrgCode.equals(oldOrgCode)) {
JSONObject newModel = (JSONObject) dataResult.get("newModel");
String companyLevel = newModel.getString("level");
log.info("监管单位信息:{}", newModel);
if (!CompanyLevelEnum.COMPANY.getCode().equals(companyLevel)) {// 只处理监管单位,企业的orgCode变更在refreshCompanyInfo中处理
// 1. 查询旧属地监管部门orgCode对应所有的公司
List<String> companySeqList = tzBaseEnterpriseInfoMapper.selectCompanyBySupervisionOrgCode(oldOrgCode);
// 2. 查询旧属地监管部门orgCode对应的所有设备
......@@ -1487,17 +1490,13 @@ public class TzBaseEnterpriseInfoServiceImpl
updateEnterpriseInfoEs(newOrgCode, oldOrgCode, companySeqList);
// 6. 更新idx_biz_equipment_info es设备信息
updateEquipmentInfoEs(newOrgCode, oldOrgCode, equipmentRecordList);
// // 5. 发送数据刷新事件 - 内存分页处理
// // 处理企业数据
// publishDataRefreshEvents(companySeqList, DataRefreshEvent.DataType.enterprise, 1000);
// // 处理设备数据
// publishDataRefreshEvents(equipmentRecordList, DataRefreshEvent.DataType.equipment, 1000);
}
}
} catch (Exception e) {
willInfo("refreshCompanyOrgCode", dataResult, "orgCodeUpdate", e);
log.error("刷新单位orgCode发生异常", e);
willInfo("refreshSupervisionOrgCode", dataResult, "orgCodeUpdate", e);
log.error("刷新监管单位orgCode发生异常", e);
}
log.info("刷新单位orgCode结束");
log.info("刷新监管单位orgCode结束");
}
private void updateEquipmentInfoEs(String newOrgCode, String oldOrgCode, List<String> equipmentRecordList) {
......
......@@ -101,6 +101,7 @@ public class TzsBaseIndividualityServiceImpl extends BaseService<TzsBaseIndividu
dto.setAdminUserId(user.getUserId());
RegUnitInfoDto regUnitInfoDto = new RegUnitInfoDto();
BeanUtils.copyProperties(dto, regUnitInfoDto);
regUnitInfoDto.setAppId(regUnitInfoService.createAppId(user));
baseEnterpriseInfo = regUnitInfoService.createBaseEnterpriseInfo(regUnitInfoDto, EnterpriseEnums.GR_ZT.getType());
TzsBaseIndividuality tzsBaseIndividuality = new TzsBaseIndividuality();
BeanUtils.copyProperties(dto, tzsBaseIndividuality);
......
......@@ -20,7 +20,6 @@ import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.util.DesUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -38,9 +37,6 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static com.yeejoin.amos.boot.module.tcm.flc.biz.service.impl.RegUnitInfoServiceImpl.DEFAULT_PASSWORD;
import static com.yeejoin.amos.boot.module.tcm.flc.biz.service.impl.RegUnitInfoServiceImpl.SECRETKEY;
/**
* 服务实现类
*
......@@ -118,7 +114,7 @@ public class TzsBaseInstitutionServiceImpl extends BaseService<TzsBaseInstitutio
dto.setAdminUserId(user.getUserId());
RegUnitInfoDto regUnitInfoDto = new RegUnitInfoDto();
BeanUtils.copyProperties(dto, regUnitInfoDto);
this.createAppId(user, regUnitInfoDto);
regUnitInfoDto.setAppId(regUnitInfoService.createAppId(user));
baseEnterpriseInfo = regUnitInfoService.createBaseEnterpriseInfo(regUnitInfoDto, EnterpriseEnums.SY_DW.getType());
TzsBaseInstitution tzsBaseInstitution = new TzsBaseInstitution();
BeanUtils.copyProperties(dto.getRegUnitMessage(), tzsBaseInstitution);
......@@ -182,17 +178,6 @@ public class TzsBaseInstitutionServiceImpl extends BaseService<TzsBaseInstitutio
publisher.publish(new DataRefreshEvent(this, Collections.singletonList(baseEnterpriseInfo.getSequenceNbr() + ""), DataRefreshEvent.DataType.enterprise.name(), DataRefreshEvent.Operation.INSERT));
}
private void createAppId(AgencyUserModel user, RegUnitInfoDto regUnitInfoDto) throws Exception {
AgencyUserModel shadowUser = new AgencyUserModel();
shadowUser.setUserId(user.getUserId());
String appId = DesUtil.encode(user.getUserId(), SECRETKEY);
shadowUser.setUserName(appId);
shadowUser.setPassword(DEFAULT_PASSWORD);
Privilege.agencyUserClient.createLoginInfoAppId(shadowUser);
regUnitInfoDto.setAppId(appId);
}
private String dealNull2EmptyString(String t) {
return StringUtils.isEmpty(t) ? "" : t;
}
......
......@@ -51,6 +51,7 @@ import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.LoginInfoModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import com.yeejoin.amos.feign.privilege.util.DesUtil;
import com.yeejoin.amos.feign.systemctl.Systemctl;
......@@ -841,36 +842,12 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
if (userResult == null || userResult.getResult() == null) {
throw new BadRequest("单位注册失败");
}
// //同步创建为当前注册管理员添加两员配备人员信息
// if (userResult.getStatus() == 200) {
// TzsUserInfo tzsUserInfo = new TzsUserInfo();
// tzsUserInfo.setName(regUnitInfo.getAdminName());
// tzsUserInfo.setCertificateType("344");
// tzsUserInfo.setLockStatus("UNLOCK");
// tzsUserInfo.setCertificateNum(regUnitInfo.getAdminIdNumber());
// tzsUserInfo.setUnitName(regUnitInfo.getName());
// tzsUserInfo.setUnitCode(regUnitInfo.getUnitCode());
// tzsUserInfo.setPhone(regUnitInfo.getAdminTel());
// tzsUserInfo.setAmosUserId(userResult.getResult().getUserId());
// tzsUserInfo.setAmosUserName(regUnitInfo.getAdminLoginName());
// tzsUserInfoService.save(tzsUserInfo);
// }
// 生成用户id
String adminUserId = userResult.getResult().getUserId();
// 省内充装单位1231:生成对接数据账号
// if (Arrays.asList(units).contains(FILLING_UNIT_TYPE) && (ValidationUtil.isEmpty(regUnitInfo.getIsNationwide()) || "0".equals(regUnitInfo.getIsNationwide()))) {
// 20250701 改为全部企业类型生成对接数据账号@tianbo
// if (ValidationUtil.isEmpty(regUnitInfo.getIsNationwide()) || "0".equals(regUnitInfo.getIsNationwide())) {
AgencyUserModel shadowUser = new AgencyUserModel();
shadowUser.setUserId(adminUserId);
String appId = DesUtil.encode(adminUserId, SECRETKEY);
shadowUser.setUserName(appId);
shadowUser.setPassword(DEFAULT_PASSWORD);
Privilege.agencyUserClient.createLoginInfoAppId(shadowUser);
regUnitInfo.setAppId(appId);
// }
// 所有企业均生成appId
regUnitInfo.setAppId(this.createAppId(userResult.getResult()));
regUnitInfo.setAdminUserId(adminUserId);
regUnitInfo.setAmosCompanySeq(companyInfo.getSequenceNbr().toString());
......@@ -1195,4 +1172,25 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
public void updateBySeq(RegUnitInfo regUnitInfo) {
this.updateById(regUnitInfo);
}
public String createAppId(AgencyUserModel user) throws Exception {
AgencyUserModel shadowUser = new AgencyUserModel();
shadowUser.setUserId(user.getUserId());
String appId = DesUtil.encode(user.getUserId(), SECRETKEY);
FeignClientResult<LoginInfoModel> result = Privilege.agencyUserClient.getLoginInfo(appId);
// 如果已经存在appId登录方式则用查询到的appId直接返回
if (!ValidationUtil.isEmpty(result) && !ValidationUtil.isEmpty(result.getResult())) {
appId = result.getResult().getLoginId();
return appId;
}
shadowUser.setUserName(appId);
shadowUser.setPassword(DEFAULT_PASSWORD);
// 查询有没有为该userId创建过账号,没有则跳过。历史错误数据会执行
FeignClientResult<AgencyUserModel> userResult = Privilege.agencyUserClient.queryByUserId(user.getUserId());
if (ValidationUtil.isEmpty(userResult) || ValidationUtil.isEmpty(userResult.getResult())) {
return null;
}
Privilege.agencyUserClient.createLoginInfoAppId(shadowUser);
return appId;
}
}
\ No newline at end of file
......@@ -332,6 +332,9 @@ public class IdxBizJgProjectContraption extends BaseEntity {
@TableField(exist = false)
private String regType;
/**
* 是否是否纳管中文返回
*/
@TableField(exist = false)
private String isIntoManagementName;
}
......@@ -133,5 +133,6 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> {
@Select("select * from biz_jg_supervisory_code where supervisory_code = #{supervisoryCode} ORDER BY supervisory_code")
SupervisoryCodeInfo searchSupervisoryBySupervisoryCode(@Param("supervisoryCode") String supervisoryCode);
List<Map<String, String>> selectError96333Code();
}
......@@ -52,4 +52,6 @@ public interface IEquipmentCategoryService {
String handleErrorElevatorCode(String supervisorCode, String elevatorCode);
JSONObject batchHandlerCode96333();
String handleError96333Code();
}
......@@ -728,4 +728,15 @@
</where>
ORDER BY parent_id
</select>
<select id="selectError96333Code" resultType="java.util.Map">
SELECT v1."SUPERVISORY_CODE" as supervisoryCode,
v1."CODE96333" as code,
v2.REC_DATE
FROM "idx_biz_jg_other_info" v1
LEFT JOIN "biz_jg_supervisory_code" v2 on v1.SUPERVISORY_CODE = v2.SUPERVISORY_CODE
WHERE v1."SUPERVISORY_CODE" ~ 'X31' AND v1."CODE96333" ~ '^32'
AND v2.create_status = '1'
ORDER BY v2."REC_DATE" DESC
</select>
</mapper>
......@@ -90,40 +90,28 @@
</resultMap>
<select id="countContraptionInUseTimesForEdit" resultMap="projectContraptionResultMap">
SELECT
project_contraption_id,
SUM(inUseNumber) inUseNumber
FROM (
SELECT
a.project_contraption_id,
COUNT(1) as inUseNumber
FROM
tzs_jg_use_registration a
WHERE a.project_contraption_id in
<foreach collection ='projectContraptionIdList' item='id' index='index' open="(" close= ")" separator=",">
#{id}
</foreach>
AND a.is_delete = 0
AND (a.status <![CDATA[ <> ]]> '使用单位待提交' and a.status <![CDATA[ <> ]]> '一级受理已驳回' and a.status <![CDATA[ <> ]]> '使用单位已撤回' and a.status <![CDATA[ <> ]]> '已作废')
group by a.project_contraption_id
UNION
SELECT
a.project_contraption_id,
COUNT(1) as inUseNumber
pl.project_contraption_id,
COALESCE(SUM(CASE WHEN ur.project_contraption_id IS NOT NULL THEN 1 ELSE 0 END), 0)
+ COALESCE(SUM(CASE WHEN ins.project_contraption_id IS NOT NULL THEN 1 ELSE 0 END), 0) AS inUseNumber
FROM
tzs_jg_installation_notice a
WHERE a.project_contraption_id in
<foreach collection ='projectContraptionIdList' item='id' index='index' open="(" close= ")" separator=",">
UNNEST(
ARRAY[
<foreach collection="projectContraptionIdList" item="id" separator=",">
#{id}
</foreach>
AND a.notice_status <![CDATA[ <> ]]> '6610'
AND a.notice_status <![CDATA[ <> ]]> '6615'
AND a.notice_status <![CDATA[ <> ]]> '6614'
group by a.project_contraption_id
)
GROUP BY project_contraption_id
]
) AS pl(project_contraption_id)
LEFT JOIN tzs_jg_use_registration ur
ON ur.project_contraption_id = pl.project_contraption_id
AND ur.is_delete = 0
AND ur.project_contraption_id != null
AND ur.status NOT IN ('使用单位待提交','一级受理已驳回','使用单位已撤回','已作废')
LEFT JOIN tzs_jg_installation_notice ins
ON ins.project_contraption_id = pl.project_contraption_id
AND ins.notice_status NOT IN ('6610','6614','6615')
GROUP BY pl.project_contraption_id
</select>
<select id="countContraptionInUseTimesForDelete" resultMap="projectContraptionResultMap">
SELECT
project_contraption_id,
......@@ -258,14 +246,21 @@
</select>
<select id="selectEquipCount" resultType="java.util.Map">
SELECT ibjui.project_contraption_id, CAST(count(1) AS INTEGER) AS count
FROM idx_biz_jg_use_info ibjui
WHERE ibjui.project_contraption_id in
<foreach collection ='projectContraptionIdList' item='id' index='index' open="(" close= ")" separator=",">
SELECT tu.project_contraption_id,
CAST(COUNT(1) AS INTEGER) AS count
FROM (
SELECT "RECORD", project_contraption_id
FROM idx_biz_jg_use_info
WHERE project_contraption_id != null
AND project_contraption_id = ANY(
ARRAY[
<foreach collection="projectContraptionIdList" item="id" index="index" separator=",">
#{id}
</foreach>
GROUP BY ibjui.project_contraption_id
])) tu
GROUP BY tu.project_contraption_id
</select>
<select id="queryJgProjectContraptionPage"
resultType="com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption">
select
......@@ -357,26 +352,36 @@
</select>
<select id="selectCheckCountByNotNull" resultType="java.util.Map">
SELECT A.project_contraption_id,CAST(count(1) AS INTEGER) AS count
FROM
(
SELECT
ibjui.project_contraption_id,
( SELECT INSPECT_ORG_NAME FROM idx_biz_jg_inspection_detection_info WHERE "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC LIMIT 1 ) inspectOrgName,
( SELECT INSPECT_CONCLUSION FROM idx_biz_jg_inspection_detection_info WHERE "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC LIMIT 1 ) inspectConclusion,
( SELECT NEXT_INSPECT_DATE FROM idx_biz_jg_inspection_detection_info WHERE "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC LIMIT 1 ) nextInspectDate
FROM
idx_biz_jg_use_info ibjui
WHERE
ibjui.project_contraption_id in
<foreach collection ='projectContraptionIdList' item='id' index='index' open="(" close= ")" separator=",">
/*+ use_cplan tablescan(idx_biz_jg_use_info) tablescan(idx_biz_jg_inspection_detection_info) set(query_dop 16) */
WITH target_use AS MATERIALIZED (
SELECT "RECORD", project_contraption_id
FROM idx_biz_jg_use_info
WHERE project_contraption_id != null and
project_contraption_id IN
<foreach collection="projectContraptionIdList" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
) A
WHERE
A.inspectOrgName IS NOT NULL AND A.inspectOrgName != '' AND A.inspectConclusion IS NOT NULL and A.inspectConclusion!=''
and A.nextInspectDate IS NOT NULL
GROUP BY A.project_contraption_id
),
latest_inspect AS (
SELECT *
FROM (
SELECT li.*,
ROW_NUMBER() OVER (PARTITION BY li."RECORD" ORDER BY li.INSPECT_DATE DESC) AS rn
FROM idx_biz_jg_inspection_detection_info li
JOIN target_use tu ON tu."RECORD" = li."RECORD"
WHERE li.INSPECT_ORG_NAME IS NOT NULL
AND li.INSPECT_ORG_NAME <![CDATA[<>]]> ''
AND li.INSPECT_CONCLUSION IS NOT NULL
AND li.INSPECT_CONCLUSION <![CDATA[<>]]> ''
AND li.NEXT_INSPECT_DATE IS NOT NULL
) t
WHERE rn = 1
)
SELECT tu.project_contraption_id,
CAST(COUNT(1) AS INTEGER) AS count
FROM target_use tu
JOIN latest_inspect li ON li."RECORD" = tu."RECORD"
GROUP BY tu.project_contraption_id
</select>
<select id="countContraptionInUseTimesForDeleteByIntoManagement" resultType="java.lang.Integer">
......@@ -458,172 +463,130 @@
<select id="countContraptionInUseTimesForDeleteByIntoManagementBatch" resultMap="projectContraptionResultMap">
SELECT
project_contraption_id,
SUM(inUseNumber) inUseNumber
FROM (
SELECT
c.project_contraption_id,
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 in
<foreach collection="projectContraptionIdList" item="projectContraptionId" index='index' open="(" close= ")" separator=",">
#{projectContraptionId}
</foreach>
AND a.is_delete = 0
AND ( a.apply_status != '6617')
GROUP BY c.project_contraption_id
UNION
SELECT
a.project_contraption_id,
COUNT(1) AS inUseNumber
pc.project_contraption_id,
COALESCE(et.cnt,0) +
COALESCE(ur.cnt,0) +
COALESCE(cru.cnt,0) +
COALESCE(ed.cnt,0) +
COALESCE(sc.cnt,0) +
COALESCE(crt.cnt,0) +
COALESCE(crn.cnt,0) +
COALESCE(ins.cnt,0) +
COALESCE(mnt.cnt,0) +
COALESCE(ref.cnt,0) +
COALESCE(trf.cnt,0) +
COALESCE(inspec.cnt,0) AS inUseNumber
FROM
tzs_jg_use_registration a
WHERE a.project_contraption_id in
<foreach collection="projectContraptionIdList" item="projectContraptionId" index='index' open="(" close= ")" separator=",">
#{projectContraptionId}
(VALUES
<foreach collection="projectContraptionIdList" item="projectContraptionId" separator=",">
(#{projectContraptionId})
</foreach>
AND a.is_delete = 0
AND ( a.status != '已作废')
) AS pc(project_contraption_id)
LEFT JOIN (
SELECT c.project_contraption_id, COUNT(1) AS cnt
FROM tzs_jg_equip_transfer a
JOIN tzs_jg_equip_transfer_eq b ON b.equip_transfer_id = a.sequence_nbr
JOIN idx_biz_jg_use_info c ON b.equ_id = c.record
WHERE a.is_delete = 0 AND a.apply_status != '6617'
GROUP BY c.project_contraption_id
) et ON et.project_contraption_id = pc.project_contraption_id
LEFT JOIN (
SELECT a.project_contraption_id, COUNT(1) AS cnt
FROM tzs_jg_use_registration a
WHERE a.is_delete = 0 AND a.status != '已作废'
GROUP BY a.project_contraption_id
UNION
SELECT
c.project_contraption_id,
COUNT(1) AS inUseNumber
) ur ON ur.project_contraption_id = pc.project_contraption_id
LEFT JOIN (
SELECT c.project_contraption_id, COUNT(1) AS cnt
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 in
<foreach collection="projectContraptionIdList" item="projectContraptionId" index='index' open="(" close= ")" separator=",">
#{projectContraptionId}
</foreach>
AND a.is_delete = 0
AND ( a.status != '已作废')
JOIN tzs_jg_change_registration_unit_eq b ON b.unit_change_registration_id = a.sequence_nbr
JOIN idx_biz_jg_use_info c ON b.equ_id = c.record
WHERE a.is_delete = 0 AND a.status != '已作废'
GROUP BY c.project_contraption_id
UNION
SELECT
c.project_contraption_id,
COUNT(1) AS inUseNumber
) cru ON cru.project_contraption_id = pc.project_contraption_id
LEFT JOIN (
SELECT c.project_contraption_id, COUNT(1) AS cnt
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 in
<foreach collection="projectContraptionIdList" item="projectContraptionId" index='index' open="(" close= ")" separator=",">
#{projectContraptionId}
</foreach>
AND a.is_delete = 0
AND ( a.audit_status != '已作废')
JOIN tzs_jg_enable_disable_eq b ON b.enable_disable_apply_id = a.sequence_nbr
JOIN idx_biz_jg_use_info c ON b.equ_id = c.record
WHERE a.is_delete = 0 AND a.audit_status != '已作废'
GROUP BY c.project_contraption_id
UNION
SELECT
c.project_contraption_id,
COUNT(1) AS inUseNumber
) ed ON ed.project_contraption_id = pc.project_contraption_id
LEFT JOIN (
SELECT c.project_contraption_id, COUNT(1) AS cnt
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 in
<foreach collection="projectContraptionIdList" item="projectContraptionId" index='index' open="(" close= ")" separator=",">
#{projectContraptionId}
</foreach>
AND a.is_delete = 0
AND ( a.audit_status != '使用单位已撤回')
JOIN tzs_jg_scrap_cancel_eq b ON b.equip_transfer_id = a.sequence_nbr
JOIN idx_biz_jg_use_info c ON b.equ_id = c.record
WHERE a.is_delete = 0 AND a.audit_status != '使用单位已撤回'
GROUP BY c.project_contraption_id
UNION
SELECT
c.project_contraption_id,
COUNT(1) AS inUseNumber
) sc ON sc.project_contraption_id = pc.project_contraption_id
LEFT JOIN (
SELECT c.project_contraption_id, COUNT(1) AS cnt
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 in
<foreach collection="projectContraptionIdList" item="projectContraptionId" index='index' open="(" close= ")" separator=",">
#{projectContraptionId}
</foreach>
AND a.is_delete = 0
AND ( a.audit_status != '使用单位已撤回')
JOIN tzs_jg_change_registration_transfer_eq b ON b.equip_transfer_id = a.sequence_nbr
JOIN idx_biz_jg_use_info c ON b.equ_id = c.record
WHERE a.is_delete = 0 AND a.audit_status != '使用单位已撤回'
GROUP BY c.project_contraption_id
UNION
SELECT
c.project_contraption_id,
COUNT(1) AS inUseNumber
) crt ON crt.project_contraption_id = pc.project_contraption_id
LEFT JOIN (
SELECT c.project_contraption_id, COUNT(1) AS cnt
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 in
<foreach collection="projectContraptionIdList" item="projectContraptionId" index='index' open="(" close= ")" separator=",">
#{projectContraptionId}
</foreach>
AND a.is_delete = 0
AND ( a.audit_status != '使用单位已撤回')
JOIN tzs_jg_change_registration_name_eq b ON b.name_change_registration_id = a.sequence_nbr
JOIN idx_biz_jg_use_info c ON b.equ_id = c.record
WHERE a.is_delete = 0 AND a.audit_status != '使用单位已撤回'
GROUP BY c.project_contraption_id
UNION
SELECT
a.project_contraption_id,
COUNT(1) AS inUseNumber
FROM
tzs_jg_installation_notice a
WHERE a.project_contraption_id in
<foreach collection="projectContraptionIdList" item="projectContraptionId" index='index' open="(" close= ")" separator=",">
#{projectContraptionId}
</foreach>
AND (a.notice_status != '6617')
) crn ON crn.project_contraption_id = pc.project_contraption_id
LEFT JOIN (
SELECT a.project_contraption_id, COUNT(1) AS cnt
FROM tzs_jg_installation_notice a
WHERE a.notice_status != '6617'
GROUP BY a.project_contraption_id
UNION
SELECT
c.project_contraption_id,
COUNT(1) AS inUseNumber
) ins ON ins.project_contraption_id = pc.project_contraption_id
LEFT JOIN (
SELECT c.project_contraption_id, COUNT(1) AS cnt
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 in
<foreach collection="projectContraptionIdList" item="projectContraptionId" index='index' open="(" close= ")" separator=",">
#{projectContraptionId}
</foreach>
AND a.is_delete = 0
AND ( a.notice_status != '6617')
JOIN tzs_jg_maintain_notice_eq b ON b.equip_transfer_id = a.sequence_nbr
JOIN idx_biz_jg_use_info c ON b.equ_id = c.record
WHERE a.is_delete = 0 AND a.notice_status != '6617'
GROUP BY c.project_contraption_id
UNION
SELECT
c.project_contraption_id,
COUNT(1) AS inUseNumber
) mnt ON mnt.project_contraption_id = pc.project_contraption_id
LEFT JOIN (
SELECT c.project_contraption_id, COUNT(1) AS cnt
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 in
<foreach collection="projectContraptionIdList" item="projectContraptionId" index='index' open="(" close= ")" separator=",">
#{projectContraptionId}
</foreach>
AND a.is_delete = 0
AND ( a.notice_status != '6617')
JOIN tzs_jg_reform_notice_eq b ON b.equip_transfer_id = a.sequence_nbr
JOIN idx_biz_jg_use_info c ON b.equ_id = c.record
WHERE a.is_delete = 0 AND a.notice_status != '6617'
GROUP BY c.project_contraption_id
UNION
SELECT
c.project_contraption_id,
COUNT(1) AS inUseNumber
) ref ON ref.project_contraption_id = pc.project_contraption_id
LEFT JOIN (
SELECT c.project_contraption_id, COUNT(1) AS cnt
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 in
<foreach collection="projectContraptionIdList" item="projectContraptionId" index='index' open="(" close= ")" separator=",">
#{projectContraptionId}
</foreach>
AND a.is_delete = 0
AND ( a.notice_status != '6617')
JOIN tzs_jg_transfer_notice_eq b ON b.equip_transfer_id = a.sequence_nbr
JOIN idx_biz_jg_use_info c ON b.equ_id = c.record
WHERE a.is_delete = 0 AND a.notice_status != '6617'
GROUP BY c.project_contraption_id
UNION
SELECT
a.project_contraption_id,
COUNT(1) AS inUseNumber
) trf ON trf.project_contraption_id = pc.project_contraption_id
LEFT JOIN (
SELECT a.project_contraption_id, COUNT(1) AS cnt
FROM tz_jyjc_inspection_application a
WHERE a.project_contraption_id in
<foreach collection="projectContraptionIdList" item="projectContraptionId" index='index' open="(" close= ")" separator=",">
#{projectContraptionId}
</foreach>
AND ( a.status != '6617')
WHERE a.status != '6617'
GROUP BY a.project_contraption_id
) GROUP BY project_contraption_id
) inspec ON inspec.project_contraption_id = pc.project_contraption_id
</select>
<select id="selectPipelineListByProjectContraptionId"
resultType="com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgTechParamsPipeline">
SELECT
......
......@@ -702,4 +702,16 @@ public class EquipmentCategoryController extends BaseController {
public ResponseModel<JSONObject> batchHandlerCode96333() {
return ResponseHelper.buildResponse(equipmentCategoryService.batchHandlerCode96333());
}
/**
* 处理西咸生成96333超31成32 问题
*
* @return s
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/handleError96333Code", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "处理西咸生成96333超31成32 问题", notes = "处理西咸生成96333超31成32 问题")
public ResponseModel<String> handleError96333Code() {
return ResponseHelper.buildResponse(equipmentCategoryService.handleError96333Code());
}
}
......@@ -90,16 +90,16 @@ public class TzsAppController {
return ResponseHelper.buildResponse(appService.getEquipInfoBySuperviseCode(supervisoryCode));
}
/**
* 登录
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@PostMapping(value = "/mobile/login")
@ApiOperation(httpMethod = "POST", value = "小程序登录", notes = "小程序登录")
public ResponseModel<Map<String, Object>> login(@RequestBody MobileLoginParam param) {
return ResponseHelper.buildResponse(appService.login(param));
}
// /**
// * 登录
// * @return
// */
// @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
// @PostMapping(value = "/mobile/login")
// @ApiOperation(httpMethod = "POST", value = "小程序登录", notes = "小程序登录")
// public ResponseModel<Map<String, Object>> login(@RequestBody MobileLoginParam param) {
// return ResponseHelper.buildResponse(appService.login(param));
// }
/**
* 小程序企业详情
......
......@@ -835,8 +835,13 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
param.put("CODE96333", elevatorCode);
objMap.put(otherInfo.getRecord(), param);
this.commonUpdateEsDataByIds(objMap);
}
Optional<ESEquipmentInfo> equipmentDaoById = esEquipmentDao.findById(otherInfo.getRecord());
equipmentDaoById.ifPresent(data -> {
data.setCODE96333(elevatorCode);
esEquipmentDao.save(data);
});
}
return "96333码修复成功!";
}
......@@ -2746,6 +2751,20 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
.fluentPut("异常数据,需手动处理:", JSONObject.toJSONString(manualProcessData));
}
@Override
public String handleError96333Code() {
List<Map<String, String>> exceptionData = equipmentCategoryMapper.selectError96333Code();
exceptionData.stream()
.map(data -> data.get("supervisoryCode"))
.filter(Objects::nonNull)
.forEach(supervisoryCode -> {
String elevatorCode = createElevatorCode("31");
handleErrorElevatorCode(supervisoryCode, elevatorCode);
});
return String.format("修复96333码成功,共处理 %d 条", exceptionData.size());
}
private void saveCode96333ForEs(String record, String code96333) {
// idx_biz_view_jg_all
Optional<ESEquipmentCategoryDto> esEquipmentCategoryDto = esEquipmentCategory.findById(record);
......
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