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 { ...@@ -40,4 +40,8 @@ public class CommonVideoDto {
*/ */
private Integer quality; private Integer quality;
/**
* 设备所属使用登记证编号
*/
private String useRegistrationCode;
} }
...@@ -90,16 +90,16 @@ public class TzsAppController { ...@@ -90,16 +90,16 @@ public class TzsAppController {
return ResponseHelper.buildResponse(appService.getEquipInfoBySuperviseCode(supervisoryCode)); return ResponseHelper.buildResponse(appService.getEquipInfoBySuperviseCode(supervisoryCode));
} }
/** // /**
* 登录 // * 登录
* @return // * @return
*/ // */
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) // @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@PostMapping(value = "/mobile/login") // @PostMapping(value = "/mobile/login")
@ApiOperation(httpMethod = "POST", value = "小程序登录", notes = "小程序登录") // @ApiOperation(httpMethod = "POST", value = "小程序登录", notes = "小程序登录")
public ResponseModel<Map<String, Object>> login(@RequestBody MobileLoginParam param) { // public ResponseModel<Map<String, Object>> login(@RequestBody MobileLoginParam param) {
return ResponseHelper.buildResponse(appService.login(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; ...@@ -5,8 +5,10 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.common.collect.Lists;
import com.hikvision.artemis.sdk.ArtemisHttpUtil; import com.hikvision.artemis.sdk.ArtemisHttpUtil;
import com.hikvision.artemis.sdk.config.ArtemisConfig; 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.dto.CommonVideoDto;
import com.yeejoin.amos.boot.biz.common.enums.CommonVideoEnum; import com.yeejoin.amos.boot.biz.common.enums.CommonVideoEnum;
import com.yeejoin.amos.boot.module.common.api.dto.BaseEnterpriseVideoDto; import com.yeejoin.amos.boot.module.common.api.dto.BaseEnterpriseVideoDto;
...@@ -19,15 +21,13 @@ import org.apache.commons.lang3.StringUtils; ...@@ -19,15 +21,13 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.http.conn.ConnectTimeoutException; import org.apache.http.conn.ConnectTimeoutException;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.yeejoin.amos.boot.biz.common.constants.VideoConstant.CODE_200; import static com.yeejoin.amos.boot.biz.common.constants.VideoConstant.CODE_200;
...@@ -45,6 +45,8 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi ...@@ -45,6 +45,8 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi
@Value("${cylinder.video.default.image.url:/upload/tzs/cylinder/no-connect.png}") @Value("${cylinder.video.default.image.url:/upload/tzs/cylinder/no-connect.png}")
private String defaultVideoUrl; private String defaultVideoUrl;
private String rootIndexCode = "root00000000";
public List<CommonVideoDto> getUnitVideoUrl(String useUnitCode, String regionCode) { public List<CommonVideoDto> getUnitVideoUrl(String useUnitCode, String regionCode) {
List<CommonVideoDto> result = new ArrayList<>(); List<CommonVideoDto> result = new ArrayList<>();
LambdaQueryWrapper<BaseEnterpriseVideo> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<BaseEnterpriseVideo> wrapper = new LambdaQueryWrapper<>();
...@@ -78,7 +80,7 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi ...@@ -78,7 +80,7 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi
videoList.forEach(video -> { videoList.forEach(video -> {
List<CommonVideoDto> commonVideoDtos = new ArrayList<>(); List<CommonVideoDto> commonVideoDtos = new ArrayList<>();
try { try {
Map<String, Object> artemisInfo = initArtemisConfigAndPath(baseEnterpriseVideo); Map<String, Object> artemisInfo = initArtemisConfigAndPath(baseEnterpriseVideo, baseEnterpriseVideo.getUrl());
ArtemisConfig config = (ArtemisConfig) artemisInfo.get("config"); ArtemisConfig config = (ArtemisConfig) artemisInfo.get("config");
Map<String, String> path = (Map<String, String>) artemisInfo.get("path"); Map<String, String> path = (Map<String, String>) artemisInfo.get("path");
...@@ -136,11 +138,11 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi ...@@ -136,11 +138,11 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi
* 初始化Artemis配置和路径信息 * 初始化Artemis配置和路径信息
* *
* @param baseEnterpriseVideo 视频设备信息 * @param baseEnterpriseVideo 视频设备信息
* @param apiUrl
* @return 包含 ArtemisConfig、请求路径和协议的Map * @return 包含 ArtemisConfig、请求路径和协议的Map
*/ */
private Map<String, Object> initArtemisConfigAndPath(BaseEnterpriseVideo baseEnterpriseVideo) throws URISyntaxException { private Map<String, Object> initArtemisConfigAndPath(BaseEnterpriseVideo baseEnterpriseVideo, String apiUrl) throws URISyntaxException {
String getCamerasUrl = baseEnterpriseVideo.getUrl(); // 或 getTokenUrl(),根据具体方法传入 Map<String, String> uriInfo = parseUri(apiUrl);
Map<String, String> uriInfo = parseUri(getCamerasUrl);
String protocol = uriInfo.get("protocol"); String protocol = uriInfo.get("protocol");
String hostPort = uriInfo.get("hostPort"); String hostPort = uriInfo.get("hostPort");
String urlPath = uriInfo.get("urlPath"); String urlPath = uriInfo.get("urlPath");
...@@ -194,15 +196,9 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi ...@@ -194,15 +196,9 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi
String dataS = videoJsonObject.get("data").toString(); String dataS = videoJsonObject.get("data").toString();
JSONObject dd = JSON.parseObject(dataS); JSONObject dd = JSON.parseObject(dataS);
String url = dd.get("url").toString(); String url = dd.get("url").toString();
CommonVideoDto commonVideoDto = new CommonVideoDto(); channelNo.setUrl(url);
commonVideoDto.setUrl(url); channelNo.setType(CommonVideoEnum.getEnum(video.getProtocol()).getName());
commonVideoDto.setKey(channelNo.getKey()); result.add(channelNo);
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);
} else { } else {
String errorMsg = "code:" + codeVideo + "msg:" + msgVideo + "appKey:" + video.getAppKey() + "appSecret:" + video.getAppSecret() + "accessToken:" + accessToken; String errorMsg = "code:" + codeVideo + "msg:" + msgVideo + "appKey:" + video.getAppKey() + "appSecret:" + video.getAppSecret() + "accessToken:" + accessToken;
log.info("视频地址获取失败errorMsg:{}", errorMsg); log.info("视频地址获取失败errorMsg:{}", errorMsg);
...@@ -269,7 +265,7 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi ...@@ -269,7 +265,7 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi
List<CommonVideoDto> commonVideoDtos = new ArrayList<>(); List<CommonVideoDto> commonVideoDtos = new ArrayList<>();
BaseEnterpriseVideo baseEnterpriseVideo = iSecureCenterVideoList.get(0); BaseEnterpriseVideo baseEnterpriseVideo = iSecureCenterVideoList.get(0);
try { try {
Map<String, Object> artemisInfo = initArtemisConfigAndPath(baseEnterpriseVideo); Map<String, Object> artemisInfo = initArtemisConfigAndPath(baseEnterpriseVideo, baseEnterpriseVideo.getTokenUrl());
ArtemisConfig config = (ArtemisConfig) artemisInfo.get("config"); ArtemisConfig config = (ArtemisConfig) artemisInfo.get("config");
Map<String, String> path = (Map<String, String>) artemisInfo.get("path"); Map<String, String> path = (Map<String, String>) artemisInfo.get("path");
...@@ -299,10 +295,14 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi ...@@ -299,10 +295,14 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi
dataList.forEach(data -> { dataList.forEach(data -> {
CommonVideoDto commonVideoDto = new CommonVideoDto(); CommonVideoDto commonVideoDto = new CommonVideoDto();
JSONObject dataJson = (JSONObject) data; 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.setKey(dataJson.getString("cameraIndexCode"));
commonVideoDto.setLabel(dataJson.getString("cameraName")); commonVideoDto.setLabel(dataJson.getString("cameraName"));
commonVideoDto.setTitle(dataJson.getString("cameraName")); commonVideoDto.setTitle(dataJson.getString("cameraName"));
commonVideoDto.setParent(baseEnterpriseVideo.getUseUnitCode()); commonVideoDto.setParent(baseEnterpriseVideo.getUseUnitCode());
commonVideoDto.setUseRegistrationCode(dataJson.getString("installLocation"));
commonVideoDtos.add(commonVideoDto); commonVideoDtos.add(commonVideoDto);
}); });
return commonVideoDtos; return commonVideoDtos;
...@@ -318,4 +318,77 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi ...@@ -318,4 +318,77 @@ public class BaseEnterpriseVideoServiceImpl extends BaseService<BaseEnterpriseVi
} }
return commonVideoDtos; 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 { ...@@ -90,16 +90,16 @@ public class TzsAppController {
return ResponseHelper.buildResponse(appService.getEquipInfoBySuperviseCode(supervisoryCode)); return ResponseHelper.buildResponse(appService.getEquipInfoBySuperviseCode(supervisoryCode));
} }
/** // /**
* 登录 // * 登录
* @return // * @return
*/ // */
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) // @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@PostMapping(value = "/mobile/login") // @PostMapping(value = "/mobile/login")
@ApiOperation(httpMethod = "POST", value = "小程序登录", notes = "小程序登录") // @ApiOperation(httpMethod = "POST", value = "小程序登录", notes = "小程序登录")
public ResponseModel<Map<String, Object>> login(@RequestBody MobileLoginParam param) { // public ResponseModel<Map<String, Object>> login(@RequestBody MobileLoginParam param) {
return ResponseHelper.buildResponse(appService.login(param)); // return ResponseHelper.buildResponse(appService.login(param));
} // }
/** /**
* 小程序企业详情 * 小程序企业详情
......
...@@ -90,16 +90,16 @@ public class TzsAppController { ...@@ -90,16 +90,16 @@ public class TzsAppController {
return ResponseHelper.buildResponse(appService.getEquipInfoBySuperviseCode(supervisoryCode)); return ResponseHelper.buildResponse(appService.getEquipInfoBySuperviseCode(supervisoryCode));
} }
/** // /**
* 登录 // * 登录
* @return // * @return
*/ // */
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) // @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@PostMapping(value = "/mobile/login") // @PostMapping(value = "/mobile/login")
@ApiOperation(httpMethod = "POST", value = "小程序登录", notes = "小程序登录") // @ApiOperation(httpMethod = "POST", value = "小程序登录", notes = "小程序登录")
public ResponseModel<Map<String, Object>> login(@RequestBody MobileLoginParam param) { // public ResponseModel<Map<String, Object>> login(@RequestBody MobileLoginParam param) {
return ResponseHelper.buildResponse(appService.login(param)); // return ResponseHelper.buildResponse(appService.login(param));
} // }
/** /**
* 小程序企业详情 * 小程序企业详情
......
...@@ -160,128 +160,134 @@ public class EquipInfoCylinderExcelDto extends BaseDto { ...@@ -160,128 +160,134 @@ public class EquipInfoCylinderExcelDto extends BaseDto {
@DateTimeFormat("yyyy-MM-dd") @DateTimeFormat("yyyy-MM-dd")
private String inspectDate; private String inspectDate;
@ApiModelProperty(value = "下次检验日期")
@ExcelProperty(value = "下次检验日期", index = 27)
@NotBlank(message = "下次检验日期不能为空")
@DateTimeFormat("yyyy-MM-dd")
private String nextInspectDate;
@ApiModelProperty(value = "检验报告编号") @ApiModelProperty(value = "检验报告编号")
@ExcelProperty(value = "检验报告编号", index = 27) @ExcelProperty(value = "检验报告编号", index = 28)
private String inspectReportNo; private String inspectReportNo;
//技术参数 //技术参数
@ExcelProperty(value = "额定质量(kg)", index = 28) @ExcelProperty(value = "额定质量(kg)", index = 29)
@ApiModelProperty(value = "额定质量(kg)") @ApiModelProperty(value = "额定质量(kg)")
private String ratedQuality; private String ratedQuality;
@ExcelProperty(value = "使用环境温度(℃)", index = 29) @ExcelProperty(value = "使用环境温度(℃)", index = 30)
@ApiModelProperty(value = "使用环境温度(℃)") @ApiModelProperty(value = "使用环境温度(℃)")
private String ambientTemperature; private String ambientTemperature;
@ExcelProperty(value = "单瓶容积(m3)", index = 30) @ExcelProperty(value = "单瓶容积(m3)", index = 31)
@ApiModelProperty(value = "单瓶容积(m3)") @ApiModelProperty(value = "单瓶容积(m3)")
@NotBlank(message = "单瓶容积(m3)不能为空") @NotBlank(message = "单瓶容积(m3)不能为空")
private String singleBottleVolume; private String singleBottleVolume;
@ExcelProperty(value = "型号", index = 31) @ExcelProperty(value = "型号", index = 32)
@ApiModelProperty(value = "型号") @ApiModelProperty(value = "型号")
private String modelNumber; private String modelNumber;
@ExcelProperty(value = "充装介质", index = 32) @ExcelProperty(value = "充装介质", index = 33)
@ApiModelProperty(value = "充装介质") @ApiModelProperty(value = "充装介质")
@NotBlank(message = "充装介质不能为空") @NotBlank(message = "充装介质不能为空")
private String chargingMedium; private String chargingMedium;
@ExcelProperty(value = "规格", index = 33) @ExcelProperty(value = "规格", index = 34)
@ApiModelProperty(value = "规格") @ApiModelProperty(value = "规格")
private String specification; private String specification;
@ExcelProperty(value = "外径", index = 34) @ExcelProperty(value = "外径", index = 35)
@ApiModelProperty(value = "外径") @ApiModelProperty(value = "外径")
private String outsideDiameter; private String outsideDiameter;
@ExcelProperty(value = "壁厚", index = 35) @ExcelProperty(value = "壁厚", index = 36)
@ApiModelProperty(value = "壁厚") @ApiModelProperty(value = "壁厚")
private String wallThickness; private String wallThickness;
@ExcelProperty(value = "长度", index = 36) @ExcelProperty(value = "长度", index = 37)
@ApiModelProperty(value = "长度") @ApiModelProperty(value = "长度")
private String length; private String length;
@ExcelProperty(value = "公称工作压力(MPa)", index = 37) @ExcelProperty(value = "公称工作压力(MPa)", index = 38)
@ApiModelProperty(value = "公称工作压力(MPa)") @ApiModelProperty(value = "公称工作压力(MPa)")
@NotBlank(message = "公称工作压力(MPa)不能为空") @NotBlank(message = "公称工作压力(MPa)不能为空")
private String nominalWorkingPressure; private String nominalWorkingPressure;
@ExcelProperty(value = "材料(管路)", index = 38) @ExcelProperty(value = "材料(管路)", index = 39)
@ApiModelProperty(value = "材料(管路)") @ApiModelProperty(value = "材料(管路)")
private String piping; private String piping;
@ExcelProperty(value = "无损检测方法(气瓶)", index = 39, converter = NondestructConverter.class) @ExcelProperty(value = "无损检测方法(气瓶)", index = 40, converter = NondestructConverter.class)
@ApiModelProperty(value = "无损检测方法(气瓶)") @ApiModelProperty(value = "无损检测方法(气瓶)")
private String qpLossless;//5988 private String qpLossless;//5988
@ExcelProperty(value = "材料(瓶体)", index = 40) @ExcelProperty(value = "材料(瓶体)", index = 41)
@ApiModelProperty(value = "材料(瓶体)") @ApiModelProperty(value = "材料(瓶体)")
private String bottleBody; private String bottleBody;
@ExcelProperty(value = "材料(端塞)", index = 41) @ExcelProperty(value = "材料(端塞)", index = 42)
@ApiModelProperty(value = "材料(端塞)") @ApiModelProperty(value = "材料(端塞)")
private String endPlug; private String endPlug;
@ExcelProperty(value = "无损检测比例(管路)(%)", index = 42) @ExcelProperty(value = "无损检测比例(管路)(%)", index = 43)
@ApiModelProperty(value = "无损检测比例(管路)(%)") @ApiModelProperty(value = "无损检测比例(管路)(%)")
private String glRatio; private String glRatio;
@ExcelProperty(value = "无损检测比例(气瓶)(%)", index = 43) @ExcelProperty(value = "无损检测比例(气瓶)(%)", index = 44)
@ApiModelProperty(value = "无损检测比例(气瓶)(%)") @ApiModelProperty(value = "无损检测比例(气瓶)(%)")
private String qpRatio; private String qpRatio;
@ExcelProperty(value = "无损检测方法(管路)", index = 44, converter = NondestructConverter.class) @ExcelProperty(value = "无损检测方法(管路)", index = 45, converter = NondestructConverter.class)
@ApiModelProperty(value = "无损检测方法(管路)") @ApiModelProperty(value = "无损检测方法(管路)")
private String glLossless; private String glLossless;
@ExcelProperty(value = "耐压实验压力(气瓶)(Mpa)", index = 45) @ExcelProperty(value = "耐压实验压力(气瓶)(Mpa)", index = 46)
@ApiModelProperty(value = "耐压实验压力(气瓶)(Mpa)") @ApiModelProperty(value = "耐压实验压力(气瓶)(Mpa)")
private String qpPressure; private String qpPressure;
@ExcelProperty(value = "耐压实验压力(管路)(Mpa)", index = 46) @ExcelProperty(value = "耐压实验压力(管路)(Mpa)", index = 47)
@ApiModelProperty(value = "耐压实验压力(管路)(Mpa)") @ApiModelProperty(value = "耐压实验压力(管路)(Mpa)")
private String glPressure; private String glPressure;
@ExcelProperty(value = "气密性试验压力(气瓶)(Mpa)", index = 47) @ExcelProperty(value = "气密性试验压力(气瓶)(Mpa)", index = 48)
@ApiModelProperty(value = "气密性试验压力(气瓶)(Mpa)") @ApiModelProperty(value = "气密性试验压力(气瓶)(Mpa)")
private String qpAirTightness; private String qpAirTightness;
@ExcelProperty(value = "气体置换后压力(MPa)", index = 48) @ExcelProperty(value = "气体置换后压力(MPa)", index = 49)
@ApiModelProperty(value = "气体置换后压力(MPa)") @ApiModelProperty(value = "气体置换后压力(MPa)")
private String displacementPressure; private String displacementPressure;
@ExcelProperty(value = "热处理方式", index = 49) @ExcelProperty(value = "热处理方式", index = 50)
@ApiModelProperty(value = "热处理方式") @ApiModelProperty(value = "热处理方式")
private String heatTreatmentMethod; private String heatTreatmentMethod;
@ExcelProperty(value = "气密性实验压力(管路)(MPa)", index = 50) @ExcelProperty(value = "气密性实验压力(管路)(MPa)", index = 51)
@ApiModelProperty(value = "气密性实验压力(管路)(MPa)") @ApiModelProperty(value = "气密性实验压力(管路)(MPa)")
private String glAirTightness; private String glAirTightness;
@ExcelProperty(value = "气瓶安装位置", index = 51) @ExcelProperty(value = "气瓶安装位置", index = 52)
@ApiModelProperty(value = "气瓶安装位置") @ApiModelProperty(value = "气瓶安装位置")
private String installationPosition; private String installationPosition;
@ExcelProperty(value = "瓶体内含氧量(%)", index = 52) @ExcelProperty(value = "瓶体内含氧量(%)", index = 53)
@ApiModelProperty(value = "瓶体内含氧量(%)") @ApiModelProperty(value = "瓶体内含氧量(%)")
private String oxygen; private String oxygen;
@ExcelProperty(value = "热处理温度(℃)", index = 53) @ExcelProperty(value = "热处理温度(℃)", index = 54)
@ApiModelProperty(value = "热处理温度(℃)") @ApiModelProperty(value = "热处理温度(℃)")
private String qpHeatTreatmentTemperature; private String qpHeatTreatmentTemperature;
/** /**
* 信息化管理字段-信息化管理情况 * 信息化管理字段-信息化管理情况
*/ */
@ExcelProperty(value = "信息化管理情况", index = 54, converter = InformationSituationConverter.class) @ExcelProperty(value = "信息化管理情况", index = 55, converter = InformationSituationConverter.class)
private String informationSituation; private String informationSituation;
/** /**
* 信息化管理字段-二维码或者电子标签编号 * 信息化管理字段-二维码或者电子标签编号
*/ */
@ExcelProperty(value = "二维码或者电子标签编号", index = 55) @ExcelProperty(value = "二维码或者电子标签编号", index = 56)
private String informationManageCode; private String informationManageCode;
@ExcelIgnore @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 ...@@ -53,4 +53,6 @@ public interface JgUseRegistrationManageMapper extends BaseMapper<JgUseRegistrat
JgUseRegistrationManage getLatestJgUseRegistrationManage(@Param("useUnitCreditCode")String useUnitCreditCode, @Param("equDefineCode")String equDefineCode); JgUseRegistrationManage getLatestJgUseRegistrationManage(@Param("useUnitCreditCode")String useUnitCreditCode, @Param("equDefineCode")String equDefineCode);
Integer checkUseRegCertInBusiness(@Param("useRegistrationCode")String useRegistrationCode); 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 @@ ...@@ -2528,16 +2528,17 @@
) )
</select> </select>
<update id="updateTechParamDynamic"> <update id="updateTechParamDynamic">
<if test="columns != null and columns.size > 0"> update ${tableName}
update <set>
${tableName} <foreach collection="columns" item="column" separator=",">
set <if test="column.columnValue != null and column.columnValue != ''">
<foreach collection="columns" item="column" separator=",">
${column.columnName} = #{column.columnValue} ${column.columnName} = #{column.columnValue}
</foreach> </if>
where record = #{record} </foreach>
</if> </set>
where record = #{record}
</update> </update>
<select id="countBizNumAfterUseReg" resultType="java.lang.Long"> <select id="countBizNumAfterUseReg" resultType="java.lang.Long">
select select
sum(inUseNumber) sum(inUseNumber)
......
...@@ -91,8 +91,6 @@ ...@@ -91,8 +91,6 @@
<if test="contractDto.createDate != null"> <if test="contractDto.createDate != null">
AND tjmc.create_date LIKE concat(DATE_FORMAT(#{contractDto.createDate},'%Y-%m-%d'),'%') AND tjmc.create_date LIKE concat(DATE_FORMAT(#{contractDto.createDate},'%Y-%m-%d'),'%')
</if> </if>
-- 数据过滤开始 ----------------------------------------------------
-- 只有使用单位或者维保单位用,或者都没有
<if test="contractDto.useUnitCodeFilter != '' and contractDto.useUnitCodeFilter != null"> <if test="contractDto.useUnitCodeFilter != '' and contractDto.useUnitCodeFilter != null">
and (tjmc.use_unit_code = #{contractDto.useUnitCodeFilter} and (tjmc.use_unit_code = #{contractDto.useUnitCodeFilter}
or tjmc.transfer_to_user_ids LIKE concat ( '%', #{currentUserId}, '%' )) or tjmc.transfer_to_user_ids LIKE concat ( '%', #{currentUserId}, '%' ))
...@@ -102,13 +100,11 @@ ...@@ -102,13 +100,11 @@
or tjmc.transfer_to_user_ids LIKE concat ( '%', #{currentUserId}, '%' )) or tjmc.transfer_to_user_ids LIKE concat ( '%', #{currentUserId}, '%' ))
and (tjmc.instance_id <![CDATA[<>]]> '') and (tjmc.instance_id <![CDATA[<>]]> '')
</if> </if>
-- 接受机构用
<if test="contractDto.receiveOrgCodeFilter != '' and contractDto.receiveOrgCodeFilter != null"> <if test="contractDto.receiveOrgCodeFilter != '' and contractDto.receiveOrgCodeFilter != null">
and (tjmc.receive_org_code = #{contractDto.receiveOrgCodeFilter} and (tjmc.receive_org_code = #{contractDto.receiveOrgCodeFilter}
or tjmc.transfer_to_user_ids LIKE concat ( '%', #{currentUserId}, '%' )) or tjmc.transfer_to_user_ids LIKE concat ( '%', #{currentUserId}, '%' ))
and (tjmc.instance_id <![CDATA[<>]]> '') and (tjmc.instance_id <![CDATA[<>]]> '')
</if> </if>
-- 监管单位用
<if test="contractDto.orgBranchCode != '' and contractDto.orgBranchCode != null"> <if test="contractDto.orgBranchCode != '' and contractDto.orgBranchCode != null">
and tjmc.instance_id <![CDATA[<>]]> '' and tjmc.instance_id <![CDATA[<>]]> ''
HAVING ( HAVING (
...@@ -118,7 +114,6 @@ ...@@ -118,7 +114,6 @@
WHERE ede.equip_transfer_id = tjmc.sequence_nbr WHERE ede.equip_transfer_id = tjmc.sequence_nbr
) LIKE concat('%', #{contractDto.orgBranchCode}, '%') ) LIKE concat('%', #{contractDto.orgBranchCode}, '%')
</if> </if>
-- 数据过滤结束 ----------------------------------------------------
</where> </where>
ORDER BY ORDER BY
<if test="sort != null"> <if test="sort != null">
......
...@@ -79,11 +79,7 @@ ...@@ -79,11 +79,7 @@
</where> </where>
</select> </select>
<select id="queryForPage" resultType="com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationManageDto"> <select id="queryForPage" resultType="com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationManageDto">
<include refid="page_list"/>, <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
FROM tzs_jg_use_registration_manage tjurm FROM tzs_jg_use_registration_manage tjurm
<where> <where>
tjurm.is_delete = 0 tjurm.is_delete = 0
...@@ -593,4 +589,99 @@ ...@@ -593,4 +589,99 @@
ORDER BY tjur.certificate_no DESC ORDER BY tjur.certificate_no DESC
LIMIT 1 LIMIT 1
</select> </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> </mapper>
...@@ -379,370 +379,262 @@ ...@@ -379,370 +379,262 @@
</choose> </choose>
</select> </select>
<select id="getListPage1" resultType="java.util.Map"> <select id="getListPage1" resultType="java.util.Map" fetchSize="500">
<choose> WITH pre_filtered_equipment AS NOT MATERIALIZED (
<!-- 情况1:有设备过滤条件 --> SELECT re.equip_transfer_id
<when test="dto.equList != null or dto.equCategory != null or dto.equDefine != null or FROM tzs_jg_use_registration_eq re
dto.equCode != null or dto.code96333 != null or dto.supervisoryCode != null"> WHERE
WITH pre_filtered_equipment AS ( EXISTS (
SELECT DISTINCT re.equip_transfer_id SELECT 1 FROM tzs_jg_use_registration fu
FROM tzs_jg_use_registration_eq re WHERE fu.sequence_nbr = re.equip_transfer_id
WHERE EXISTS ( AND fu.is_delete = '0'
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.status != null and dto.status != ''">
<!-- 设备表过滤条件 --> AND fu.status = #{dto.status}
<if test="dto.equList != null and dto.equList != ''"> </if>
AND jri."EQU_LIST" = #{dto.equList} <if test="dto.applicationDate != null">
</if> AND DATE(fu.create_date) = DATE(#{dto.applicationDate})
<if test="dto.equCategory != null and dto.equCategory != ''"> </if>
AND jri."EQU_CATEGORY" = #{dto.equCategory} <if test="dto.fullAddress != null and dto.fullAddress != ''">
</if> AND fu.use_address LIKE CONCAT('%', #{dto.fullAddress}, '%')
<if test="dto.equDefine != null and dto.equDefine != ''"> </if>
AND jri."EQU_DEFINE" = #{dto.equDefine} <if test="dto.useUnitName != null and dto.useUnitName != ''">
</if> AND fu.use_unit_name LIKE CONCAT('%', #{dto.useUnitName}, '%')
<if test="dto.equCode != null and dto.equCode != ''"> </if>
AND jri."EQU_CODE" LIKE CONCAT(#{dto.equCode}, '%') <if test="dto.applyNo != null and dto.applyNo != ''">
</if> AND fu.apply_no LIKE CONCAT(#{dto.applyNo}, '%')
<if test="dto.code96333 != null and dto.code96333 != ''"> </if>
AND other."CODE96333" LIKE CONCAT(#{dto.code96333}, '%') <if test="dto.useRegistrationCode != null and dto.useRegistrationCode != ''">
</if> AND fu.use_registration_code LIKE CONCAT(#{dto.useRegistrationCode}, '%')
<if test="dto.supervisoryCode != null and dto.supervisoryCode != ''"> </if>
AND other."SUPERVISORY_CODE" LIKE CONCAT(#{dto.supervisoryCode}, '%') <if test="dto.useUnitCode != null and dto.useUnitCode != ''">
</if> AND fu.use_unit_credit_code = #{dto.useUnitCode}
) </if>
AND EXISTS ( <if test="dto.orgBranchCode != null and dto.orgBranchCode != ''">
SELECT 1 FROM tzs_jg_use_registration fu <choose>
WHERE fu.sequence_nbr = re.equip_transfer_id <when test="client == 'jgLook'">
AND fu.is_delete = '0' AND fu.supervision_org_code LIKE CONCAT(#{dto.orgBranchCode}, '%')
<!-- 公共主表过滤条件 --> </when>
<if test="dto.status != null and dto.status != ''"> <otherwise>
AND fu.status = #{dto.status} AND fu.supervision_org_code = #{dto.orgBranchCode}
</if> </otherwise>
<if test="dto.applicationDate != null"> </choose>
AND DATE(fu.create_date) = DATE(#{dto.applicationDate}) </if>
</if> <if test="dto.auditPassDateStart != null and dto.auditPassDateEnd != null">
<if test="dto.fullAddress != null and dto.fullAddress != ''"> AND fu.audit_pass_date BETWEEN #{dto.auditPassDateStart} AND #{dto.auditPassDateEnd}
AND fu.use_address LIKE CONCAT('%', #{dto.fullAddress}, '%') </if>
</if> <if test="dto.dataType == 'supervision' ">
<if test="dto.useUnitName != null and dto.useUnitName != ''"> <choose>
AND fu.use_unit_name LIKE CONCAT('%', #{dto.useUnitName}, '%') <when test="client == 'jgAudit'">
</if> AND (fu.receive_company_code = #{dto.receiveCompanyCode}
<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}, '%')) OR fu.transfer_to_user_ids LIKE CONCAT('%', #{dto.currentUserId}, '%'))
</if> </when>
) <otherwise>
), AND fu.supervision_org_code LIKE CONCAT(#{dto.supervisionOrgCode}, '%')
main_data AS ( </otherwise>
SELECT </choose>
fu.sequence_nbr AS sequenceNbr, AND fu.status != '使用单位待提交'
fu.audit_status AS auditStatus, </if>
DATE_FORMAT ( fu.reg_date, '%Y-%m-%d' ) AS regDate, <if test="dto.dataType == 'company' ">
fu.use_unit_name AS useUnitName, AND (fu.use_unit_credit_code = #{dto.unitCode}
fu.supervision_org_code AS supervisionOrgCode, OR fu.transfer_to_user_ids LIKE CONCAT('%', #{dto.currentUserId}, '%'))
fu.status, </if>
fu.receive_org_name AS receiveOrgName, )
fu.use_address AS place, <if test="dto.equList != null or dto.equCategory != null or dto.equDefine != null or
fu.instance_id AS instanceId, dto.equCode != null">
fu.apply_no AS applyNo, AND EXISTS (
fu.next_execute_ids AS nextExecuteIds, SELECT 1 FROM idx_biz_jg_register_info jri
fu.promoter, WHERE jri."RECORD" = re.equ_id
fu.use_registration_code AS useRegistrationCode, <!-- 设备表过滤条件 -->
DATE_FORMAT ( fu.audit_pass_date, '%Y-%m-%d' ) AS auditPassDate, <if test="dto.equList != null and dto.equList != ''">
DATE_FORMAT ( fu.create_date, '%Y-%m-%d' ) AS createDate, AND jri."EQU_LIST" = #{dto.equList}
fu.receive_org_name AS receiveOrgName, </if>
fu.next_execute_user_ids AS nextExecuteUserIds, <if test="dto.equCategory != null and dto.equCategory != ''">
fu.next_task_id AS nextTaskId, AND jri."EQU_CATEGORY" = #{dto.equCategory}
fu.create_user_id AS createUserId, </if>
fu.rec_date AS recDate, <if test="dto.equDefine != null and dto.equDefine != ''">
fu.manage_type AS manageType, AND jri."EQU_DEFINE" = #{dto.equDefine}
fu.reg_type AS regType, </if>
fu.is_delete, <if test="dto.equCode != null and dto.equCode != ''">
fu.create_date, AND jri."EQU_CODE" LIKE CONCAT(#{dto.equCode}, '%')
fu.receive_company_code, </if>
fu.use_unit_credit_code, )
fu.transfer_to_user_ids, </if>
fu.supervision_org_code, <if test="dto.code96333 != null or dto.supervisoryCode != null">
fu.use_address AS fullAddress, AND EXISTS (
fu.cancel_reason AS cancelReason, SELECT 1 FROM idx_biz_jg_other_info other
fu.project_contraption_id AS projectContraptionId, WHERE other."RECORD" = re.equ_id
( SELECT company_name FROM privilege_company WHERE org_code = fu.supervision_org_code AND is_deleted = FALSE LIMIT 1 ) AS orgBranchName <!-- 设备表过滤条件 -->
FROM pre_filtered_equipment pfe <if test="dto.code96333 != null and dto.code96333 != ''">
JOIN tzs_jg_use_registration fu ON pfe.equip_transfer_id = fu.sequence_nbr AND other."CODE96333" LIKE CONCAT(#{dto.code96333}, '%')
ORDER BY fu.create_date DESC, fu.apply_no DESC </if>
LIMIT 20 OFFSET 0 <if test="dto.supervisoryCode != null and dto.supervisoryCode != ''">
) AND other."SUPERVISORY_CODE" LIKE CONCAT(#{dto.supervisoryCode}, '%')
SELECT </if>
md.*, )
(SELECT STRING_AGG(DISTINCT other.code96333, ',') </if>
FROM tzs_jg_use_registration_eq re ),
JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD" main_data AS (
JOIN idx_biz_jg_other_info other ON jri."RECORD" = other."RECORD" SELECT
WHERE re.equip_transfer_id = md.sequenceNbr) AS code96333, fu.sequence_nbr AS sequenceNbr,
(SELECT STRING_AGG(DISTINCT other.supervisory_code, ',') fu.audit_status AS auditStatus,
FROM tzs_jg_use_registration_eq re DATE_FORMAT(fu.reg_date, '%Y-%m-%d') AS regDate,
JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD" fu.use_unit_name AS useUnitName,
JOIN idx_biz_jg_other_info other ON jri."RECORD" = other."RECORD" fu.supervision_org_code AS supervisionOrgCode,
WHERE re.equip_transfer_id = md.sequenceNbr) AS supervisoryCode, fu.status,
(SELECT STRING_AGG(DISTINCT jri.PRODUCT_NAME, ',') fu.receive_org_name AS receiveOrgName,
FROM tzs_jg_use_registration_eq re fu.use_address AS place,
JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD" fu.instance_id AS instanceId,
WHERE re.equip_transfer_id = md.sequenceNbr) AS productName , fu.apply_no AS applyNo,
(SELECT STRING_AGG(DISTINCT jri.EQU_CODE, ',') fu.next_execute_ids AS nextExecuteIds,
FROM tzs_jg_use_registration_eq re fu.promoter,
JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD" fu.use_registration_code AS useRegistrationCode,
WHERE re.equip_transfer_id = md.sequenceNbr) AS equCode, DATE_FORMAT(fu.audit_pass_date, '%Y-%m-%d') AS auditPassDate,
(SELECT STRING_AGG(DISTINCT jri.EQU_LIST, ',') DATE_FORMAT(fu.create_date, '%Y-%m-%d') AS createDate,
FROM tzs_jg_use_registration_eq re fu.next_execute_user_ids AS nextExecuteUserIds,
JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD" fu.next_task_id AS nextTaskId,
WHERE re.equip_transfer_id = md.sequenceNbr) AS equListCode , fu.create_user_id AS createUserId,
(SELECT STRING_AGG(DISTINCT jri.EQU_CATEGORY, ',') fu.rec_date AS recDate,
FROM tzs_jg_use_registration_eq re fu.manage_type AS manageType,
JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD" fu.reg_type AS regType,
WHERE re.equip_transfer_id = md.sequenceNbr) AS equCategoryCode , fu.is_delete,
(SELECT STRING_AGG(DISTINCT jri.EQU_DEFINE, ',') fu.create_date,
FROM tzs_jg_use_registration_eq re fu.receive_company_code,
JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD" fu.use_unit_credit_code,
WHERE re.equip_transfer_id = md.sequenceNbr) AS equDefineCode, fu.transfer_to_user_ids,
(SELECT name from tz_equipment_category where code = equListCode ) AS equListName, fu.supervision_org_code,
(SELECT name from tz_equipment_category where code = equCategoryCode ) AS equCategory, fu.use_address AS fullAddress,
(SELECT name from tz_equipment_category where code = equDefineCode ) AS equDefine fu.cancel_reason AS cancelReason,
FROM main_data md fu.project_contraption_id AS projectContraptionId,
GROUP BY md.sequenceNbr (
ORDER BY 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
WHERE pfe.equip_transfer_id = fu.sequence_nbr
)
ORDER BY fu.create_date DESC, fu.apply_no DESC
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.*,
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
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">
<choose> <choose>
<when test="sort != null and sort.field != null and sort.sortType != null"> <when test="sort.field == 'create_date'">md.create_date</when>
<choose> <when test="sort.field == 'apply_no'">md.applyNo</when>
<when test="sort.field == 'create_date'">md.create_date</when> <when test="sort.field == 'reg_date'">md.regType</when>
<when test="sort.field == 'apply_no'">md.applyNo</when> <when test="sort.field == 'audit_pass_date'">fu.auditPassDate</when>
<when test="sort.field == 'reg_date'">md.regType</when> <otherwise>${sort.field}</otherwise>
<when test="sort.field == 'audit_pass_date'">fu.auditPassDate</when>
<otherwise>${sort.field}</otherwise>
</choose>
${sort.sortType}
</when>
<otherwise>
md.create_date DESC, md.applyNo DESC
</otherwise>
</choose> </choose>
LIMIT #{size} OFFSET #{offset} ${sort.sortType}
</when> </when>
<!-- 情况2:无设备过滤条件 -->
<otherwise> <otherwise>
WITH paginated_ids AS ( md.create_date DESC, md.applyNo DESC
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> </otherwise>
</choose> </choose>
</select> </select>
<select id="getListPageCount" resultType="long"> <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 FROM tzs_jg_use_registration ur
LEFT JOIN tzs_jg_use_registration_eq re ON ur.sequence_nbr = re.equip_transfer_id <if test="dto.equList != null or dto.equCategory != null or dto.equDefine != null or
LEFT JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD" dto.equCode != null or dto.code96333 != null or dto.supervisoryCode != null">
LEFT JOIN idx_biz_jg_other_info other ON re.equ_id = other."RECORD" INNER JOIN tzs_jg_use_registration_eq re ON ur.sequence_nbr = re.equip_transfer_id
WHERE ur.is_delete = 0 INNER JOIN idx_biz_jg_register_info jri ON re.equ_id = jri."RECORD"
<!-- 统一设备过滤条件 --> <if test="dto.code96333 != null or dto.supervisoryCode != null">
<if test="dto.equList != null and dto.equList != ''"> INNER JOIN idx_biz_jg_other_info other ON re.equ_id = other."RECORD"
AND jri."EQU_LIST" = #{dto.equList}
</if> </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>
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}
</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>
<!-- 96333码过滤 --> <!-- 96333码过滤 -->
<if test="dto.code96333 != null and dto.code96333 != ''"> <if test="dto.code96333 != null and dto.code96333 != ''">
AND other."CODE96333" LIKE CONCAT('%', #{dto.code96333}, '%') AND other."CODE96333" LIKE CONCAT('%', #{dto.code96333}, '%')
</if> </if>
<!-- 监管码过滤 --> <!-- 监管码过滤 -->
<if test="dto.supervisoryCode != null and dto.supervisoryCode != ''"> <if test="dto.supervisoryCode != null and dto.supervisoryCode != ''">
AND other."SUPERVISORY_CODE" LIKE CONCAT('%', #{dto.supervisoryCode}, '%') AND other."SUPERVISORY_CODE" LIKE CONCAT('%', #{dto.supervisoryCode}, '%')
</if>
</if> </if>
<if test="dto.status != null and dto.status != ''"> <if test="dto.status != null and dto.status != ''">
AND ur.status = #{dto.status} AND ur.status = #{dto.status}
</if> </if>
......
...@@ -4,72 +4,96 @@ ...@@ -4,72 +4,96 @@
<select id="queryForSafetyProblemTracingPage" <select id="queryForSafetyProblemTracingPage"
resultType="com.yeejoin.amos.boot.module.jg.api.dto.SafetyProblemTracingDto"> resultType="com.yeejoin.amos.boot.module.jg.api.dto.SafetyProblemTracingDto">
select
spt.*, SELECT
case when spt."problem_status_code" = '0' then '红' spt.*,
else '绿' end hiddenDangersLevel, CASE
(select extend::json->>'pic' from cb_data_dictionary where type = 'ISSUE_TYPE' and code = spt.problem_type_code) problemTypePic WHEN spt.problem_status_code = '0' THEN '红'
from tzs_safety_problem_tracing spt 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> <where>
spt.is_delete = false spt.is_delete = FALSE
<if test="problemModel.problemNum != null and problemModel.problemNum != ''"> <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>
<if test="problemModel.problemStatus != null and problemModel.problemStatus != ''"> <if test="problemModel.problemStatus != null and problemModel.problemStatus != ''">
and spt.problem_status = #{problemModel.problemStatus} AND spt.problem_status = #{problemModel.problemStatus}
</if> </if>
<if test="problemModel.equipListCode != null and problemModel.equipListCode != ''"> <if test="problemModel.equipListCode != null and problemModel.equipListCode != ''">
and spt.equip_list_code = #{problemModel.equipListCode} AND spt.equip_list_code = #{problemModel.equipListCode}
</if> </if>
<if test="problemModel.equCategoryCode != null and problemModel.equCategoryCode != ''"> <if test="problemModel.equCategoryCode != null and problemModel.equCategoryCode != ''">
and spt.equ_category_code = #{problemModel.equCategoryCode} AND spt.equ_category_code = #{problemModel.equCategoryCode}
</if> </if>
<if test="problemModel.sourceTypeCode != null and problemModel.sourceTypeCode != ''"> <if test="problemModel.sourceTypeCode != null and problemModel.sourceTypeCode != ''">
and spt.source_type_code = #{problemModel.sourceTypeCode} AND spt.source_type_code = #{problemModel.sourceTypeCode}
</if> </if>
<if test="problemModel.problemLevelCode != null and problemModel.problemLevelCode != ''"> <if test="problemModel.problemLevelCode != null and problemModel.problemLevelCode != ''">
and spt.problem_level_code = #{problemModel.problemLevelCode} AND spt.problem_level_code = #{problemModel.problemLevelCode}
</if> </if>
<if test="problemModel.problemTypeCode != null and problemModel.problemTypeCode != ''"> <if test="problemModel.problemTypeCode != null and problemModel.problemTypeCode != ''">
and spt.problem_type_code = #{problemModel.problemTypeCode} AND spt.problem_type_code = #{problemModel.problemTypeCode}
</if> </if>
<if test="problemModel.problemTimeRange != null and problemModel.problemTimeRange.beginDate != null"> <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') to_char(#{problemModel.problemTimeRange.beginDate}::timestamp, 'YYYY-MM-DD')
</if> </if>
<if test="problemModel.problemTimeRange != null and problemModel.problemTimeRange.endDate != null"> <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') to_char(#{problemModel.problemTimeRange.endDate}::timestamp, 'YYYY-MM-DD')
</if> </if>
<if test="problemModel.problemDesc != null and problemModel.problemDesc != ''"> <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>
<if test="problemModel.sourceId != null and problemModel.sourceId != ''"> <if test="problemModel.sourceId != null and problemModel.sourceId != ''">
and spt.source_id = #{problemModel.sourceId} AND spt.source_id = #{problemModel.sourceId}
</if> </if>
<if test="problemModel.governingBodyOrgCode != null and problemModel.governingBodyOrgCode != ''"> <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>
<if test="problemModel.governingBodyCode != null and problemModel.governingBodyCode != ''"> <if test="problemModel.governingBodyCode != null and problemModel.governingBodyCode != ''">
and spt.governing_body_code = #{problemModel.governingBodyCode} AND spt.governing_body_code = #{problemModel.governingBodyCode}
</if> </if>
<if test="problemModel.principalUnit != null and problemModel.principalUnit != ''"> <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>
<if test="problemModel.principalUnitType != null and problemModel.principalUnitType != ''"> <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>
<if test="problemModel.hiddenDangersLevel != null and problemModel.hiddenDangersLevel != ''"> <if test="problemModel.hiddenDangersLevel != null and problemModel.hiddenDangersLevel != ''">
and spt.problem_status_code = #{problemModel.hiddenDangersLevel} AND spt.problem_status_code = #{problemModel.hiddenDangersLevel}
</if> </if>
<if test="problemModel.regionCode != null and problemModel.regionCode != ''"> <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>
<if test="problemModel.problemStatusCode != null and problemModel.problemStatusCode != ''"> <if test="problemModel.problemStatusCode != null and problemModel.problemStatusCode != ''">
and spt.problem_status_code = #{problemModel.problemStatusCode} AND spt.problem_status_code = #{problemModel.problemStatusCode}
</if> </if>
</where> </where>
order by spt.create_date desc ORDER BY spt.create_date DESC
</select> </select>
<select id="queryEquipListByProblemId" resultType="java.util.Map"> <select id="queryEquipListByProblemId" resultType="java.util.Map">
......
...@@ -27,6 +27,7 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -27,6 +27,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.event.TransactionalEventListener; import org.springframework.transaction.event.TransactionalEventListener;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.util.*; import java.util.*;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
...@@ -335,9 +336,23 @@ public class ChangeEquipImpactCertListener { ...@@ -335,9 +336,23 @@ public class ChangeEquipImpactCertListener {
log.info("处理 handleNewProjectEdit 类型逻辑"); log.info("处理 handleNewProjectEdit 类型逻辑");
IdxBizJgProjectContraption projectContraption = jgProjectContraptionService.getById(projectContraptionId); IdxBizJgProjectContraption projectContraption = jgProjectContraptionService.getById(projectContraptionId);
JSONObject certificatePrintTag = Optional.ofNullable(projectContraption.getCertificatePrintTag()) JSONObject certificatePrintTag = Optional.ofNullable(projectContraption.getCertificatePrintTag())
.map(JSONObject::parseObject).orElse(new JSONObject()); .map(JSONObject::parseObject)
.orElseGet(JSONObject::new);
JSONObject tagJson = this.handleFieldChangeProject(fieldChangeMetaList, certificatePrintTag); JSONObject tagJson = this.handleFieldChangeProject(fieldChangeMetaList, certificatePrintTag);
projectContraption.setCertificatePrintTag(JSONObject.toJSONString(tagJson)); projectContraption.setCertificatePrintTag(tagJson.toJSONString());
jgProjectContraptionService.updateById(projectContraption); 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; ...@@ -61,6 +61,7 @@ import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.io.IOException; import java.io.IOException;
...@@ -1142,4 +1143,16 @@ public class CommonEquipDataProcessService { ...@@ -1142,4 +1143,16 @@ public class CommonEquipDataProcessService {
this.updateUseOrgCode2NewPipeline(e, useRegistrationCode); 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; 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.DatePattern;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
...@@ -224,7 +225,9 @@ public class EquipChangeDataUpdateServiceImpl { ...@@ -224,7 +225,9 @@ public class EquipChangeDataUpdateServiceImpl {
return columnDto; return columnDto;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
// sql 动态构建入库 // sql 动态构建入库
commonMapper.updateTechParamDynamic(tableName, record, columns); if (CollUtil.isNotEmpty(columns)) {
commonMapper.updateTechParamDynamic(tableName, record, columns);
}
} }
public void checkFactoryChangeData(String record, EquipFactoryChangeDataDto equipFactoryChangeDataDto, String equList, String equCategory, String equDefine) { 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 ...@@ -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.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.HandleResult;
import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.IEquipChangeDataProcessStrategy; 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 com.yeejoin.amos.boot.module.ymt.api.entity.*;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -28,6 +29,7 @@ import org.elasticsearch.index.query.QueryBuilders; ...@@ -28,6 +29,7 @@ import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.io.IOException; import java.io.IOException;
...@@ -52,6 +54,7 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy ...@@ -52,6 +54,7 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
private final RestHighLevelClient restHighLevelClient; private final RestHighLevelClient restHighLevelClient;
private final EsEquipmentDao esEquipmentDao; private final EsEquipmentDao esEquipmentDao;
private final IdxBizJgRegisterInfoServiceImpl idxBizJgRegisterInfoServiceImpl;
@Override @Override
...@@ -265,7 +268,6 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy ...@@ -265,7 +268,6 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
return orgCode; return orgCode;
} }
private void beforeCheckForUseOrgCode(IdxBizJgUseInfo useInfoOld, IdxBizJgRegisterInfo registerInfoNew) { private void beforeCheckForUseOrgCode(IdxBizJgUseInfo useInfoOld, IdxBizJgRegisterInfo registerInfoNew) {
// 1.使用登记证编辑时重复性校验 // 1.使用登记证编辑时重复性校验
if (!CylinderTypeEnum.CYLINDER.getCode().equals(registerInfoNew.getEquCategory())) { // 非气瓶逻辑,所有设备不能重复 if (!CylinderTypeEnum.CYLINDER.getCode().equals(registerInfoNew.getEquCategory())) { // 非气瓶逻辑,所有设备不能重复
...@@ -286,7 +288,9 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy ...@@ -286,7 +288,9 @@ public class SingleEquipChangeProcess implements IEquipChangeDataProcessStrategy
} }
} }
} }
if (!ValidationUtil.isEmpty(registerInfoNew.getUseOrgCode())){
idxBizJgRegisterInfoServiceImpl.checkUseRegistrationCode(registerInfoNew.getUseOrgCode(), "unit");
}
} }
@Override @Override
......
...@@ -19,15 +19,11 @@ import com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.HandleRes ...@@ -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.process.equip.strategy.IEquipChangeDataProcessStrategy;
import com.yeejoin.amos.boot.module.jg.biz.edit.typeHandler.PieLineLevelTypeHandler; 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.jg.biz.service.impl.IdxBizJgRegisterInfoServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgConstructionInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.*;
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 lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
...@@ -76,7 +72,10 @@ public class SingleProjectEquipChangeProcess implements IEquipChangeDataProcessS ...@@ -76,7 +72,10 @@ public class SingleProjectEquipChangeProcess implements IEquipChangeDataProcessS
// 2.装置基本信息校验、保存(前端返回的装置信息为大写 需注意) // 2.装置基本信息校验、保存(前端返回的装置信息为大写 需注意)
ProjectContraptionChangeDataDto projectContraptionChangeDataDto = CommonEquipDataProcessService.castMap2Bean(changeData, ProjectContraptionChangeDataDto.class); ProjectContraptionChangeDataDto projectContraptionChangeDataDto = CommonEquipDataProcessService.castMap2Bean(changeData, ProjectContraptionChangeDataDto.class);
this.setNameForDictKey(projectContraptionChangeDataDto); this.setNameForDictKey(projectContraptionChangeDataDto);
// 校验使用登记证编号是否重复
if (Objects.toString(projectContraptionChangeDataDto.getDataSource(), "").startsWith("jg_his")) {
commonEquipDataProcessService.beforeCheckForUseOrgCode(projectContraptionChangeDataDto);
}
pieLineDataChangeService.update(projectContraptionChangeDataDto, allChangeColumns); pieLineDataChangeService.update(projectContraptionChangeDataDto, allChangeColumns);
Boolean isRequireTemporarySave = data.getBoolean(DefaultBizDataChangeHandler.IS_REQUIRES_TEMPORARY_SAVE); Boolean isRequireTemporarySave = data.getBoolean(DefaultBizDataChangeHandler.IS_REQUIRES_TEMPORARY_SAVE);
JSONArray oldPieLineJSONArray = data.getJSONArray(DefaultBizDataChangeHandler.TEMPORARY_PIPELINES_DATA); JSONArray oldPieLineJSONArray = data.getJSONArray(DefaultBizDataChangeHandler.TEMPORARY_PIPELINES_DATA);
......
...@@ -28,6 +28,7 @@ import com.yeejoin.amos.boot.module.jg.api.dto.EquipRequestParamsDto; ...@@ -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.entity.JgUseRegistrationManage;
import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum; 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.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.enums.PipelineEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper; import com.yeejoin.amos.boot.module.jg.api.mapper.JgVehicleInformationMapper;
...@@ -400,6 +401,7 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ ...@@ -400,6 +401,7 @@ public class IdxBizJgProjectContraptionServiceImplService extends BaseEntityServ
record.setCompanyType(companyType2); record.setCompanyType(companyType2);
// 来源类型:前端控制编辑按钮显示隐藏 // 来源类型:前端控制编辑按钮显示隐藏
record.setRegType(CommonServiceImpl.genRegTypeByDataSource(record.getDataSource())); record.setRegType(CommonServiceImpl.genRegTypeByDataSource(record.getDataSource()));
record.setIsIntoManagementName(IsIntoManagementEnum.getName(record.getIsIntoManagement()));
// 设置是否发生过后续业务::前端控制编辑按钮显示隐藏 // 设置是否发生过后续业务::前端控制编辑按钮显示隐藏
record.setHappenAfterBiz(projectContraptionUseMap.getOrDefault(record.getSequenceNbr() + "", false)); record.setHappenAfterBiz(projectContraptionUseMap.getOrDefault(record.getSequenceNbr() + "", false));
}); });
......
...@@ -147,6 +147,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -147,6 +147,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
public static final String WHETHER_SKID_MOUNTED_PRESSURE_VESSEL = "WHETHER_SKID_MOUNTED_PRESSURE_VESSEL"; public static final String WHETHER_SKID_MOUNTED_PRESSURE_VESSEL = "WHETHER_SKID_MOUNTED_PRESSURE_VESSEL";
// 设备纳管 纳管:true 未纳管:false // 设备纳管 纳管:true 未纳管:false
public static final String IS_INTO_MANAGEMENT = "IS_INTO_MANAGEMENT"; 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"; public static final String IS_DO_BUSINESS = "IS_DO_BUSINESS";
// 设备来源 jg:新设备录入 jg_his:历史数据录入 // 设备来源 jg:新设备录入 jg_his:历史数据录入
public static final String DATA_SOURCE = "DATA_SOURCE"; public static final String DATA_SOURCE = "DATA_SOURCE";
...@@ -3014,6 +3015,10 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -3014,6 +3015,10 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
dto2.put(DATA_SOURCE, s); dto2.put(DATA_SOURCE, s);
dto2.put(DATA_SOURCE_NAME, EquipSourceEnum.getDataSourceName(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)); dto2.put("record", dto2.get(SEQUENCE_NBR));
list.add(dto2); list.add(dto2);
} }
...@@ -4439,17 +4444,19 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -4439,17 +4444,19 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
inspectionDetectionInfo.setRecDate(new Date()); inspectionDetectionInfo.setRecDate(new Date());
inspectionDetectionInfo.setInspectType("ZZJDJY"); inspectionDetectionInfo.setInspectType("ZZJDJY");
inspectionDetectionInfo.setInspectConclusion("6040");// 默认合格 inspectionDetectionInfo.setInspectConclusion("6040");// 默认合格
// 根据条件确定增加的年数 inspectionDetectionInfo.setInspectDate(DateUtil.parse(data.getInspectDate(), "yyyy-MM-dd"));
Optional.ofNullable(data.getInspectDate()) inspectionDetectionInfo.setNextInspectDate(DateUtil.parse(data.getNextInspectDate(), "yyyy-MM-dd"));
.filter(s -> !s.trim().isEmpty()) // 根据条件确定增加的年数(杨生元说监管让去掉,企业自己输入)
.map(dateStr -> LocalDate.parse(dateStr, DateTimeFormatter.ofPattern("yyyy-MM-dd"))) // Optional.ofNullable(data.getInspectDate())
.ifPresent(inspectDate -> { // .filter(s -> !s.trim().isEmpty())
inspectionDetectionInfo.setInspectDate(Date.from(inspectDate.atStartOfDay(ZoneId.systemDefault()).toInstant())); // .map(dateStr -> LocalDate.parse(dateStr, DateTimeFormatter.ofPattern("yyyy-MM-dd")))
// 计算下次检测日期(加 3 年或 4 年) // .ifPresent(inspectDate -> {
int plusYears = SPECIAL_CYLINDER.getCode().equals(equipInfoDto.getEquDefineCode()) ? 3 : 4; // inspectionDetectionInfo.setInspectDate(Date.from(inspectDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
LocalDate nextInspectDate = inspectDate.plusYears(plusYears); // // 计算下次检测日期(加 3 年或 4 年)
inspectionDetectionInfo.setNextInspectDate(Date.from(nextInspectDate.atStartOfDay(ZoneId.systemDefault()).toInstant())); // 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); inspectionDetectionInfoList.add(inspectionDetectionInfo);
// 其他信息 // 其他信息
......
...@@ -815,7 +815,7 @@ public class JgChangeVehicleRegistrationUnitServiceImpl extends BaseService<JgCh ...@@ -815,7 +815,7 @@ public class JgChangeVehicleRegistrationUnitServiceImpl extends BaseService<JgCh
public Page<JgUseRegistrationManageDto> getUseRegistrationCodeData(Page<JgUseRegistrationManageDto> page, public Page<JgUseRegistrationManageDto> getUseRegistrationCodeData(Page<JgUseRegistrationManageDto> page,
JgUseRegistrationManageDto dto) { JgUseRegistrationManageDto dto) {
return jgUseRegistrationManageService.queryForJgUseRegistrationManagePage(page, dto, null); return jgUseRegistrationManageService.queryUseRegistrationManagePage(page, dto, null);
} }
public Map<String, Object> getEquList(String useRegistrationCode) { public Map<String, Object> getEquList(String useRegistrationCode) {
......
...@@ -330,6 +330,20 @@ public class JgUseRegistrationManageServiceImpl extends BaseService<JgUseRegistr ...@@ -330,6 +330,20 @@ public class JgUseRegistrationManageServiceImpl extends BaseService<JgUseRegistr
return jgUseRegistrationManageMapper.queryForPage(page, dto, sortMap); 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) { public Page<JgUseRegistrationManageDto> queryForJgUseRegistrationManagePageForJG(JgUseRegistrationManageDto dto, String sort, int current, int size) {
Page<JgUseRegistrationManageDto> page = new Page<JgUseRegistrationManageDto>(); Page<JgUseRegistrationManageDto> page = new Page<JgUseRegistrationManageDto>();
page.setCurrent(current); page.setCurrent(current);
......
...@@ -359,13 +359,14 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD ...@@ -359,13 +359,14 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
SortVo sortMap = commonServiceImpl.sortFieldConversionNoToUnderline(sort); SortVo sortMap = commonServiceImpl.sortFieldConversionNoToUnderline(sort);
// 统计查询时间 // 统计查询时间
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
long total = this.baseMapper.getListPageCount(sortMap, dto, roleIds, client);
logger.info("使用登记单据-列表查询"); 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)); logger.info("使用登记单据-列表查询耗时:{}毫秒", (System.currentTimeMillis() - startTime));
page.setRecords(resultRecords); page.setRecords(resultRecords);
logger.info("使用登记单据-列表总数查询"); logger.info("使用登记单据-列表总数查询");
startTime = System.currentTimeMillis(); startTime = System.currentTimeMillis();
page.setTotal(this.baseMapper.getListPageCount(sortMap, dto, roleIds, client)); page.setTotal(total);
logger.info("使用登记单据-列表总数查询耗时:{}毫秒", (System.currentTimeMillis() - startTime)); logger.info("使用登记单据-列表总数查询耗时:{}毫秒", (System.currentTimeMillis() - startTime));
return page; return page;
} }
......
...@@ -287,6 +287,7 @@ public class WordTemplateUtils { ...@@ -287,6 +287,7 @@ public class WordTemplateUtils {
if (value == null) { if (value == null) {
return null; return null;
} }
value = removeControlCharsManual(value);
return value.replace("&", "&amp;") return value.replace("&", "&amp;")
.replace("<", "&lt;") .replace("<", "&lt;")
.replace(">", "&gt;") .replace(">", "&gt;")
...@@ -296,4 +297,18 @@ public class WordTemplateUtils { ...@@ -296,4 +297,18 @@ public class WordTemplateUtils {
.replace(")", "&#41;"); .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 { ...@@ -40,6 +40,8 @@ public enum EquipAdvanceSearchEnum {
AZUSC_UNIT_NAME("安装改造维修单位名称", "USC_UNIT_NAME", TechnicalParameter.ParamType.STRING, "", null, null, FieldType.Text), AZUSC_UNIT_NAME("安装改造维修单位名称", "USC_UNIT_NAME", TechnicalParameter.ParamType.STRING, "", null, null, FieldType.Text),
CODE96333("96333识别码", "CODE96333", TechnicalParameter.ParamType.STRING, "", null, null, FieldType.Keyword), CODE96333("96333识别码", "CODE96333", TechnicalParameter.ParamType.STRING, "", null, null, FieldType.Keyword),
SUPERVISORY_CODE("监管码", "SUPERVISORY_CODE", 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), EQU_TYPE("设备型号", "EQU_TYPE", TechnicalParameter.ParamType.STRING, "", null, null, FieldType.Text),
PRODUCE_DATE("制造日期", "PRODUCE_DATE", TechnicalParameter.ParamType.DATE, "", null, null, FieldType.Date), PRODUCE_DATE("制造日期", "PRODUCE_DATE", TechnicalParameter.ParamType.DATE, "", null, null, FieldType.Date),
designDate("设计日期", "designDate", 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; ...@@ -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.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -193,6 +192,6 @@ public class ZLDPStatisticsController { ...@@ -193,6 +192,6 @@ public class ZLDPStatisticsController {
@GetMapping(value = "/getTree") @GetMapping(value = "/getTree")
@ApiOperation(httpMethod = "GET", value = "查询监管部门树", notes = "查询监管部门树") @ApiOperation(httpMethod = "GET", value = "查询监管部门树", notes = "查询监管部门树")
public ResponseModel<Object> getTree(){ public ResponseModel<Object> getTree(){
return ResponseHelper.buildResponse(Collections.singletonList(statisticsService.getRegulatorUnitTree())); return ResponseHelper.buildResponse(statisticsService.getAllRegulatorUnitTree());
} }
} }
...@@ -910,7 +910,7 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -910,7 +910,7 @@ public class AQZSDPStatisticsServiceImpl {
result.put("total", hasSupervisoryCodeEquipCount); result.put("total", hasSupervisoryCodeEquipCount);
//2.压力管道长度统计 //2.压力管道长度统计
// stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,true, false); // stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,true, false);
jgDPStatisticsService.staticsCenterMapCountPipLine(result, orgCode); jgDPStatisticsService.staticsCenterMapCountPipLine(result, orgCode, true);
//3.单位数量统计 //3.单位数量统计
// 单位统计修改为查询es // 单位统计修改为查询es
// this.staticsCenterMapCountDataForCompany(result, orgCode, dpFilterParamDto.getCityCode()); // this.staticsCenterMapCountDataForCompany(result, orgCode, dpFilterParamDto.getCityCode());
...@@ -1024,7 +1024,7 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -1024,7 +1024,7 @@ public class AQZSDPStatisticsServiceImpl {
stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode,true,true, false); stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode,true,true, false);
// 2. 压力管道长度统计 // 2. 压力管道长度统计
// stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,true, false); // stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,true, false);
jgDPStatisticsService.staticsCenterMapCountPipLine(result, orgCode); jgDPStatisticsService.staticsCenterMapCountPipLine(result, orgCode, true);
//3.单位数量统计 //3.单位数量统计
// 单位统计修改为查询es // 单位统计修改为查询es
// this.staticsCenterMapCountDataForCompany(result, orgCode, dpFilterParamDto.getCityCode()); // this.staticsCenterMapCountDataForCompany(result, orgCode, dpFilterParamDto.getCityCode());
......
...@@ -1211,6 +1211,10 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -1211,6 +1211,10 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
queryBuilder.should(QueryBuilders.wildcardQuery("SAFETY_MANAGER.keyword", "*" + fuzzyValue + "*")); queryBuilder.should(QueryBuilders.wildcardQuery("SAFETY_MANAGER.keyword", "*" + fuzzyValue + "*"));
queryBuilder.should(QueryBuilders.wildcardQuery("ORG_BRANCH_NAME", "*" + fuzzyValue + "*")); queryBuilder.should(QueryBuilders.wildcardQuery("ORG_BRANCH_NAME", "*" + fuzzyValue + "*"));
queryBuilder.should(QueryBuilders.wildcardQuery("MAINTAIN_UNIT_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); queryBuilder.minimumShouldMatch(1);
boolMust.must(queryBuilder); boolMust.must(queryBuilder);
} else if (k.equals("WHETHER_VEHICLE_CYLINDER")) { } else if (k.equals("WHETHER_VEHICLE_CYLINDER")) {
......
...@@ -34,6 +34,7 @@ import com.yeejoin.amos.boot.module.jg.api.enums.*; ...@@ -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.jg.api.mapper.*;
import com.yeejoin.amos.boot.module.statistcs.biz.utils.JsonUtils; 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.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.dto.*;
import com.yeejoin.amos.boot.module.statistics.api.enums.RegulatoryUnitLevelEnum; import com.yeejoin.amos.boot.module.statistics.api.enums.RegulatoryUnitLevelEnum;
import com.yeejoin.amos.boot.module.statistics.api.enums.StatisticalAnalysisEnum; import com.yeejoin.amos.boot.module.statistics.api.enums.StatisticalAnalysisEnum;
...@@ -396,7 +397,7 @@ public class JGDPStatisticsServiceImpl { ...@@ -396,7 +397,7 @@ public class JGDPStatisticsServiceImpl {
//2.压力管道长度统计 //2.压力管道长度统计
// 修改为查询es // 修改为查询es
// stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode, true, false); // stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode, true, false);
this.staticsCenterMapCountPipLine(result, orgCode); this.staticsCenterMapCountPipLine(result, orgCode, true);
//3.单位数量统计 //3.单位数量统计
this.staticsCenterMapCountDataForCompany(result, orgCode, dpFilterParamDto.getCityCode()); this.staticsCenterMapCountDataForCompany(result, orgCode, dpFilterParamDto.getCityCode());
//4.人员数量统计 //4.人员数量统计
...@@ -415,7 +416,8 @@ public class JGDPStatisticsServiceImpl { ...@@ -415,7 +416,8 @@ public class JGDPStatisticsServiceImpl {
//1.8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量 //1.8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode, false, true, false); stCommonService.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode, false, true, false);
//2.压力管道长度统计 //2.压力管道长度统计
stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode, false, false); this.staticsCenterMapCountPipLine(result, orgCode, false);
// stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode, false, false);
return result; return result;
} }
...@@ -432,7 +434,7 @@ public class JGDPStatisticsServiceImpl { ...@@ -432,7 +434,7 @@ public class JGDPStatisticsServiceImpl {
// 2. 压力管道长度统计 // 2. 压力管道长度统计
// 修改为查询es // 修改为查询es
//stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode, true, false); //stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode, true, false);
this.staticsCenterMapCountPipLine(result, orgCode); this.staticsCenterMapCountPipLine(result, orgCode, true);
// 3. 人员数量统计 // 3. 人员数量统计
this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto, orgCode); this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto, orgCode);
return result; return result;
...@@ -490,7 +492,7 @@ public class JGDPStatisticsServiceImpl { ...@@ -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(); SearchRequest request = new SearchRequest();
SearchSourceBuilder builder = new SearchSourceBuilder(); SearchSourceBuilder builder = new SearchSourceBuilder();
request.indices(StatisticalAnalysisEnum.equip.getKey()); request.indices(StatisticalAnalysisEnum.equip.getKey());
...@@ -498,8 +500,16 @@ public class JGDPStatisticsServiceImpl { ...@@ -498,8 +500,16 @@ public class JGDPStatisticsServiceImpl {
BoolQueryBuilder pipeLengthQuery = new BoolQueryBuilder(); BoolQueryBuilder pipeLengthQuery = new BoolQueryBuilder();
pipeLengthQuery.must(QueryBuilders.prefixQuery("ORG_BRANCH_CODE", orgCode)); pipeLengthQuery.must(QueryBuilders.prefixQuery("ORG_BRANCH_CODE", orgCode));
pipeLengthQuery.must(QueryBuilders.existsQuery("pipeLength")); pipeLengthQuery.must(QueryBuilders.existsQuery("pipeLength"));
pipeLengthQuery.must(existsQuery("SUPERVISORY_CODE")); pipeLengthQuery.must(QueryBuilders.prefixQuery("ORG_BRANCH_CODE", orgCode));
pipeLengthQuery.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE", "")); 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("草稿", "已拒领", "待认领"))); pipeLengthQuery.mustNot(QueryBuilders.termsQuery("STATUS", Arrays.asList("草稿", "已拒领", "待认领")));
SumAggregationBuilder pipeLengthAgg = AggregationBuilders.sum("pipeLengthSum").field("pipeLength").missing(0); SumAggregationBuilder pipeLengthAgg = AggregationBuilders.sum("pipeLengthSum").field("pipeLength").missing(0);
builder.query(pipeLengthQuery); builder.query(pipeLengthQuery);
...@@ -1834,7 +1844,7 @@ public class JGDPStatisticsServiceImpl { ...@@ -1834,7 +1844,7 @@ public class JGDPStatisticsServiceImpl {
result.put("total", hasSupervisoryCodeEquipCount); result.put("total", hasSupervisoryCodeEquipCount);
// 2.压力管道长度统计 // 2.压力管道长度统计
// stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode, true, false); // stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode, true, false);
this.staticsCenterMapCountPipLine(result, orgCode); this.staticsCenterMapCountPipLine(result, orgCode, true);
// 3.已纳管设备总数 // 3.已纳管设备总数
this.staticsCenterMapCountDataForEquipIsManage(result); this.staticsCenterMapCountDataForEquipIsManage(result);
// 4.登记证总数 // 4.登记证总数
......
...@@ -548,7 +548,7 @@ public class JYJCDPStatisticsServiceImpl { ...@@ -548,7 +548,7 @@ public class JYJCDPStatisticsServiceImpl {
result.put("total", hasSupervisoryCodeEquipCount); result.put("total", hasSupervisoryCodeEquipCount);
// 3.压力管道统计 // 3.压力管道统计
// stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,true, false); // stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,true, false);
jgDPStatisticsService.staticsCenterMapCountPipLine(result, orgCode); jgDPStatisticsService.staticsCenterMapCountPipLine(result, orgCode, true);
// 4.报检数量统计 // 4.报检数量统计
this.staticsCenterMapCountDataReporting(result, dpFilterParamDto); this.staticsCenterMapCountDataReporting(result, dpFilterParamDto);
// 5.检验检测临期设备数数量统计 // 5.检验检测临期设备数数量统计
......
...@@ -1278,5 +1278,8 @@ public class ZLDPStatisticsServiceImpl { ...@@ -1278,5 +1278,8 @@ public class ZLDPStatisticsServiceImpl {
return null; return null;
} }
public List<LinkedHashMap> getAllRegulatorUnitTree() {
return (List<LinkedHashMap>)redisUtils.get("REGULATOR_UNIT_TREE");
}
} }
...@@ -347,6 +347,9 @@ public class TzBaseEnterpriseInfoDto extends BaseDto { ...@@ -347,6 +347,9 @@ public class TzBaseEnterpriseInfoDto extends BaseDto {
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
protected Date createDateEnd; protected Date createDateEnd;
@ApiModelProperty(value = "创建时间")
protected String createDate;
/** /**
* 单位类型集合 * 单位类型集合
*/ */
......
...@@ -19,24 +19,17 @@ public enum CompanyLevelEnum { ...@@ -19,24 +19,17 @@ public enum CompanyLevelEnum {
HEADQUARTER("headquarter", "省级"), HEADQUARTER("headquarter", "省级"),
PREFECTURE_LEVEL("prefecture-level", "地市级"), PREFECTURE_LEVEL("prefecture-level", "地市级"),
COUNTY("county", "区县级"), COUNTY("county", "区县级"),
ORGANIZATION("organization", "基层机构"); ORGANIZATION("organization", "基层机构"),
COMPANY("company", "企业");
private String code; private String code;
private String name; private String name;
public String getCode() {
return code;
}
public void setCode(String code) { public void setCode(String code) {
this.code = code; this.code = code;
} }
public String getName() {
return name;
}
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
......
...@@ -102,4 +102,8 @@ public interface TzBaseEnterpriseInfoMapper extends BaseMapper<TzBaseEnterpriseI ...@@ -102,4 +102,8 @@ public interface TzBaseEnterpriseInfoMapper extends BaseMapper<TzBaseEnterpriseI
void updateRedundantSupervisionOrgCodeStatistics(String newOrgCode, String oldOrgCode); void updateRedundantSupervisionOrgCodeStatistics(String newOrgCode, String oldOrgCode);
void updateEquipmentSupervisionOrgCode(String newOrgCode, String newSupervisionName, List<String> equipmentList); 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 ...@@ -61,6 +61,6 @@ public interface ITzBaseEnterpriseInfoService extends IService<TzBaseEnterpriseI
void refreshCompanyInfo(JSONObject dataResult, String method); 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 @@ ...@@ -36,8 +36,15 @@
<select id="page" <select id="page"
resultType="com.yeejoin.amos.boot.module.tcm.api.dto.TzBaseEnterpriseInfoDto"> 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(province,'/',city,'/',district) AS region,
CONCAT(street,'/',address) AS full_address CONCAT(street,'/',address) AS full_address
FROM FROM
...@@ -84,7 +91,15 @@ ...@@ -84,7 +91,15 @@
</select> </select>
<select id="pageList" resultType="com.yeejoin.amos.boot.module.tcm.api.dto.TzBaseEnterpriseInfoDto"> <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(province,'/',city,'/',district) AS region,
CONCAT(street,'/',address) AS full_address CONCAT(street,'/',address) AS full_address
FROM tz_base_enterprise_info FROM tz_base_enterprise_info
...@@ -441,4 +456,22 @@ ...@@ -441,4 +456,22 @@
#{record} #{record}
</foreach> </foreach>
</update> </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> </mapper>
...@@ -50,9 +50,15 @@ public class HistoryDataDealController { ...@@ -50,9 +50,15 @@ public class HistoryDataDealController {
@Deprecated @Deprecated
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/handleCompanyHisOrgCode") @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) { public ResponseModel<String> handleCompanyHisOrgCode(@RequestBody List<Map<String, Object>> orgCodeMap) {
return ResponseHelper.buildResponse(historyDataDealService.handleCompanyHisOrgCode(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 { ...@@ -90,16 +90,16 @@ public class TzsAppController {
return ResponseHelper.buildResponse(appService.getEquipInfoBySuperviseCode(supervisoryCode)); return ResponseHelper.buildResponse(appService.getEquipInfoBySuperviseCode(supervisoryCode));
} }
/** // /**
* 登录 // * 登录
* @return // * @return
*/ // */
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) // @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@PostMapping(value = "/mobile/login") // @PostMapping(value = "/mobile/login")
@ApiOperation(httpMethod = "POST", value = "小程序登录", notes = "小程序登录") // @ApiOperation(httpMethod = "POST", value = "小程序登录", notes = "小程序登录")
public ResponseModel<Map<String, Object>> login(@RequestBody MobileLoginParam param) { // public ResponseModel<Map<String, Object>> login(@RequestBody MobileLoginParam param) {
return ResponseHelper.buildResponse(appService.login(param)); // return ResponseHelper.buildResponse(appService.login(param));
} // }
/** /**
* 小程序企业详情 * 小程序企业详情
......
...@@ -87,7 +87,7 @@ public class PlatformUserTopicMessage extends EmqxListener { ...@@ -87,7 +87,7 @@ public class PlatformUserTopicMessage extends EmqxListener {
JSONObject jsonObject = JSON.parseObject(message.toString()); JSONObject jsonObject = JSON.parseObject(message.toString());
String newOrgCode = jsonObject.getString("newOrgCode"); String newOrgCode = jsonObject.getString("newOrgCode");
String oldOrgCode = jsonObject.getString("oldOrgCode"); String oldOrgCode = jsonObject.getString("oldOrgCode");
tzBaseEnterpriseInfoService.refreshCompanyOrgCode(jsonObject, newOrgCode, oldOrgCode); tzBaseEnterpriseInfoService.refreshSupervisionOrgCode(jsonObject, newOrgCode, oldOrgCode);
} catch (Exception e) { } catch (Exception e) {
log.info("处理平台推送组织架构层级变动消息失败:{}", e.getMessage()); log.info("处理平台推送组织架构层级变动消息失败:{}", e.getMessage());
e.printStackTrace(); e.printStackTrace();
......
...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tcm.biz.service.impl; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.tcm.biz.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
...@@ -9,7 +10,11 @@ import com.yeejoin.amos.boot.module.common.api.constant.TZSCommonConstant; ...@@ -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.common.api.entity.TzsUserPermission;
import com.yeejoin.amos.boot.module.tcm.api.entity.TzBaseEnterpriseInfo; 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.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.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel; import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -18,6 +23,7 @@ import org.springframework.util.StopWatch; ...@@ -18,6 +23,7 @@ import org.springframework.util.StopWatch;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* @author Administrator * @author Administrator
...@@ -32,10 +38,13 @@ public class HistoryDataDealServiceImpl { ...@@ -32,10 +38,13 @@ public class HistoryDataDealServiceImpl {
private TzBaseEnterpriseInfoServiceImpl baseEnterpriseInfoService; 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.userInfoService = userInfoService;
this.userPermissionService = userPermissionService; this.userPermissionService = userPermissionService;
this.baseEnterpriseInfoService = baseEnterpriseInfoService; this.baseEnterpriseInfoService = baseEnterpriseInfoService;
this.regUnitInfoService = regUnitInfoService;
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
...@@ -142,15 +151,88 @@ public class HistoryDataDealServiceImpl { ...@@ -142,15 +151,88 @@ public class HistoryDataDealServiceImpl {
orgCodeMap.forEach(map -> { orgCodeMap.forEach(map -> {
String newOrgCode = map.get("newOrgCode").toString(); String newOrgCode = map.get("newOrgCode").toString();
String oldOrgCode = map.get("oldOrgCode").toString(); String oldOrgCode = map.get("oldOrgCode").toString();
//1. 处理平台旧orgCode本身错误数据 //1. 查询新orgCode对应的监管单位信息
@SuppressWarnings("unchecked") @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); CompanyModel parentModel = JSON.parseObject(JSON.toJSONString(platformCompanyInfo.get(TZSCommonConstant.PLATFORM_FEIGN_RESULT_KEY_COMPANY)), CompanyModel.class);
parentModel.setOrgCode(newOrgCode); JSONObject modelMap = new JSONObject();
Privilege.companyClient.update(parentModel, parentModel.getSequenceNbr()); modelMap.put("newModel", JSON.toJSON(parentModel));
//2. 处理业务表旧orgCode错误数据 //2. 处理业务表旧orgCode错误数据
baseEnterpriseInfoService.refreshCompanyOrgCode(null, newOrgCode, oldOrgCode); baseEnterpriseInfoService.refreshSupervisionOrgCode(modelMap, newOrgCode, oldOrgCode);
}); });
return "success"; 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,38 +1466,37 @@ public class TzBaseEnterpriseInfoServiceImpl ...@@ -1466,38 +1466,37 @@ public class TzBaseEnterpriseInfoServiceImpl
@Override @Override
@Transactional @Transactional
@Async @Async
public void refreshCompanyOrgCode(JSONObject dataResult, String newOrgCode, String oldOrgCode) { public void refreshSupervisionOrgCode(JSONObject dataResult, String newOrgCode, String oldOrgCode) {
log.info("开始刷新单位orgCode:{}", dataResult); log.info("开始刷新监管单位orgCode:{}", dataResult);
try { try {
if (!ValidationUtil.isEmpty(newOrgCode) && !ValidationUtil.isEmpty(oldOrgCode) && !newOrgCode.equals(oldOrgCode)) { if (!ValidationUtil.isEmpty(newOrgCode) && !ValidationUtil.isEmpty(oldOrgCode) && !newOrgCode.equals(oldOrgCode)) {
JSONObject newModel = (JSONObject) dataResult.get("newModel"); JSONObject newModel = (JSONObject) dataResult.get("newModel");
// 1. 查询旧属地监管部门orgCode对应所有的公司 String companyLevel = newModel.getString("level");
List<String> companySeqList = tzBaseEnterpriseInfoMapper.selectCompanyBySupervisionOrgCode(oldOrgCode); log.info("监管单位信息:{}", newModel);
// 2. 查询旧属地监管部门orgCode对应的所有设备 if (!CompanyLevelEnum.COMPANY.getCode().equals(companyLevel)) {// 只处理监管单位,企业的orgCode变更在refreshCompanyInfo中处理
List<String> equipmentRecordList = tzBaseEnterpriseInfoMapper.selectEquipmentBySupervisionOrgCode(oldOrgCode); // 1. 查询旧属地监管部门orgCode对应所有的公司
log.info("start-查询旧属地监管部门orgCode对应的所有设备equipmentRecordList:{},companySeqList:{}", equipmentRecordList.size(), companySeqList.size()); List<String> companySeqList = tzBaseEnterpriseInfoMapper.selectCompanyBySupervisionOrgCode(oldOrgCode);
// 3. 3.1 更新单位及业务表的监管单位orgCode // 2. 查询旧属地监管部门orgCode对应的所有设备
tzBaseEnterpriseInfoMapper.updateRedundantSupervisionOrgCodeUnit(newModel.getString("companyName"), newOrgCode, oldOrgCode); List<String> equipmentRecordList = tzBaseEnterpriseInfoMapper.selectEquipmentBySupervisionOrgCode(oldOrgCode);
// 3.2 更新业务表统计表冗余的监管单位orgCode log.info("start-查询旧属地监管部门orgCode对应的所有设备equipmentRecordList:{},companySeqList:{}", equipmentRecordList.size(), companySeqList.size());
tzBaseEnterpriseInfoMapper.updateRedundantSupervisionOrgCodeStatistics(newOrgCode, oldOrgCode); // 3. 3.1 更新单位及业务表的监管单位orgCode
log.info("end-查询旧属地监管部门orgCode对应的所有设备equipmentRecordList:{},companySeqList:{}", equipmentRecordList.size(), companySeqList.size()); tzBaseEnterpriseInfoMapper.updateRedundantSupervisionOrgCodeUnit(newModel.getString("companyName"), newOrgCode, oldOrgCode);
// 4. 更新idx_biz_view_jg_all es设备信息 // 3.2 更新业务表统计表冗余的监管单位orgCode
updateEquipmentJgAllEs(newOrgCode, oldOrgCode, equipmentRecordList, newModel.getString("companyName")); tzBaseEnterpriseInfoMapper.updateRedundantSupervisionOrgCodeStatistics(newOrgCode, oldOrgCode);
// 5. 更新idx_biz_enterprise_info es企业信息 log.info("end-查询旧属地监管部门orgCode对应的所有设备equipmentRecordList:{},companySeqList:{}", equipmentRecordList.size(), companySeqList.size());
updateEnterpriseInfoEs(newOrgCode, oldOrgCode, companySeqList); // 4. 更新idx_biz_view_jg_all es设备信息
// 6. 更新idx_biz_equipment_info es设备信息 updateEquipmentJgAllEs(newOrgCode, oldOrgCode, equipmentRecordList, newModel.getString("companyName"));
updateEquipmentInfoEs(newOrgCode, oldOrgCode, equipmentRecordList); // 5. 更新idx_biz_enterprise_info es企业信息
// // 5. 发送数据刷新事件 - 内存分页处理 updateEnterpriseInfoEs(newOrgCode, oldOrgCode, companySeqList);
// // 处理企业数据 // 6. 更新idx_biz_equipment_info es设备信息
// publishDataRefreshEvents(companySeqList, DataRefreshEvent.DataType.enterprise, 1000); updateEquipmentInfoEs(newOrgCode, oldOrgCode, equipmentRecordList);
// // 处理设备数据 }
// publishDataRefreshEvents(equipmentRecordList, DataRefreshEvent.DataType.equipment, 1000);
} }
} catch (Exception e) { } catch (Exception e) {
willInfo("refreshCompanyOrgCode", dataResult, "orgCodeUpdate", e); willInfo("refreshSupervisionOrgCode", dataResult, "orgCodeUpdate", e);
log.error("刷新单位orgCode发生异常", e); log.error("刷新监管单位orgCode发生异常", e);
} }
log.info("刷新单位orgCode结束"); log.info("刷新监管单位orgCode结束");
} }
private void updateEquipmentInfoEs(String newOrgCode, String oldOrgCode, List<String> equipmentRecordList) { private void updateEquipmentInfoEs(String newOrgCode, String oldOrgCode, List<String> equipmentRecordList) {
......
...@@ -101,6 +101,7 @@ public class TzsBaseIndividualityServiceImpl extends BaseService<TzsBaseIndividu ...@@ -101,6 +101,7 @@ public class TzsBaseIndividualityServiceImpl extends BaseService<TzsBaseIndividu
dto.setAdminUserId(user.getUserId()); dto.setAdminUserId(user.getUserId());
RegUnitInfoDto regUnitInfoDto = new RegUnitInfoDto(); RegUnitInfoDto regUnitInfoDto = new RegUnitInfoDto();
BeanUtils.copyProperties(dto, regUnitInfoDto); BeanUtils.copyProperties(dto, regUnitInfoDto);
regUnitInfoDto.setAppId(regUnitInfoService.createAppId(user));
baseEnterpriseInfo = regUnitInfoService.createBaseEnterpriseInfo(regUnitInfoDto, EnterpriseEnums.GR_ZT.getType()); baseEnterpriseInfo = regUnitInfoService.createBaseEnterpriseInfo(regUnitInfoDto, EnterpriseEnums.GR_ZT.getType());
TzsBaseIndividuality tzsBaseIndividuality = new TzsBaseIndividuality(); TzsBaseIndividuality tzsBaseIndividuality = new TzsBaseIndividuality();
BeanUtils.copyProperties(dto, tzsBaseIndividuality); BeanUtils.copyProperties(dto, tzsBaseIndividuality);
......
...@@ -20,7 +20,6 @@ import com.yeejoin.amos.component.feign.model.FeignClientResult; ...@@ -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.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel; import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.util.DesUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -38,9 +37,6 @@ import java.util.List; ...@@ -38,9 +37,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; 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 ...@@ -118,7 +114,7 @@ public class TzsBaseInstitutionServiceImpl extends BaseService<TzsBaseInstitutio
dto.setAdminUserId(user.getUserId()); dto.setAdminUserId(user.getUserId());
RegUnitInfoDto regUnitInfoDto = new RegUnitInfoDto(); RegUnitInfoDto regUnitInfoDto = new RegUnitInfoDto();
BeanUtils.copyProperties(dto, regUnitInfoDto); BeanUtils.copyProperties(dto, regUnitInfoDto);
this.createAppId(user, regUnitInfoDto); regUnitInfoDto.setAppId(regUnitInfoService.createAppId(user));
baseEnterpriseInfo = regUnitInfoService.createBaseEnterpriseInfo(regUnitInfoDto, EnterpriseEnums.SY_DW.getType()); baseEnterpriseInfo = regUnitInfoService.createBaseEnterpriseInfo(regUnitInfoDto, EnterpriseEnums.SY_DW.getType());
TzsBaseInstitution tzsBaseInstitution = new TzsBaseInstitution(); TzsBaseInstitution tzsBaseInstitution = new TzsBaseInstitution();
BeanUtils.copyProperties(dto.getRegUnitMessage(), tzsBaseInstitution); BeanUtils.copyProperties(dto.getRegUnitMessage(), tzsBaseInstitution);
...@@ -182,17 +178,6 @@ public class TzsBaseInstitutionServiceImpl extends BaseService<TzsBaseInstitutio ...@@ -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)); 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) { private String dealNull2EmptyString(String t) {
return StringUtils.isEmpty(t) ? "" : t; return StringUtils.isEmpty(t) ? "" : t;
} }
......
...@@ -51,6 +51,7 @@ import com.yeejoin.amos.component.feign.model.FeignClientResult; ...@@ -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.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel; 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.model.RoleModel;
import com.yeejoin.amos.feign.privilege.util.DesUtil; import com.yeejoin.amos.feign.privilege.util.DesUtil;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
...@@ -841,36 +842,12 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -841,36 +842,12 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
if (userResult == null || userResult.getResult() == null) { if (userResult == null || userResult.getResult() == null) {
throw new BadRequest("单位注册失败"); 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 // 生成用户id
String adminUserId = userResult.getResult().getUserId(); String adminUserId = userResult.getResult().getUserId();
// 省内充装单位1231:生成对接数据账号 // 所有企业均生成appId
// if (Arrays.asList(units).contains(FILLING_UNIT_TYPE) && (ValidationUtil.isEmpty(regUnitInfo.getIsNationwide()) || "0".equals(regUnitInfo.getIsNationwide()))) { regUnitInfo.setAppId(this.createAppId(userResult.getResult()));
// 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);
// }
regUnitInfo.setAdminUserId(adminUserId); regUnitInfo.setAdminUserId(adminUserId);
regUnitInfo.setAmosCompanySeq(companyInfo.getSequenceNbr().toString()); regUnitInfo.setAmosCompanySeq(companyInfo.getSequenceNbr().toString());
...@@ -1195,4 +1172,25 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI ...@@ -1195,4 +1172,25 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
public void updateBySeq(RegUnitInfo regUnitInfo) { public void updateBySeq(RegUnitInfo regUnitInfo) {
this.updateById(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 { ...@@ -332,6 +332,9 @@ public class IdxBizJgProjectContraption extends BaseEntity {
@TableField(exist = false) @TableField(exist = false)
private String regType; private String regType;
/**
* 是否是否纳管中文返回
*/
@TableField(exist = false)
private String isIntoManagementName;
} }
...@@ -133,5 +133,6 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> { ...@@ -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") @Select("select * from biz_jg_supervisory_code where supervisory_code = #{supervisoryCode} ORDER BY supervisory_code")
SupervisoryCodeInfo searchSupervisoryBySupervisoryCode(@Param("supervisoryCode") String supervisoryCode); SupervisoryCodeInfo searchSupervisoryBySupervisoryCode(@Param("supervisoryCode") String supervisoryCode);
List<Map<String, String>> selectError96333Code();
} }
...@@ -52,4 +52,6 @@ public interface IEquipmentCategoryService { ...@@ -52,4 +52,6 @@ public interface IEquipmentCategoryService {
String handleErrorElevatorCode(String supervisorCode, String elevatorCode); String handleErrorElevatorCode(String supervisorCode, String elevatorCode);
JSONObject batchHandlerCode96333(); JSONObject batchHandlerCode96333();
String handleError96333Code();
} }
...@@ -728,4 +728,15 @@ ...@@ -728,4 +728,15 @@
</where> </where>
ORDER BY parent_id ORDER BY parent_id
</select> </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> </mapper>
...@@ -90,40 +90,28 @@ ...@@ -90,40 +90,28 @@
</resultMap> </resultMap>
<select id="countContraptionInUseTimesForEdit" resultMap="projectContraptionResultMap"> <select id="countContraptionInUseTimesForEdit" resultMap="projectContraptionResultMap">
SELECT SELECT
project_contraption_id, pl.project_contraption_id,
SUM(inUseNumber) inUseNumber COALESCE(SUM(CASE WHEN ur.project_contraption_id IS NOT NULL THEN 1 ELSE 0 END), 0)
FROM ( + COALESCE(SUM(CASE WHEN ins.project_contraption_id IS NOT NULL THEN 1 ELSE 0 END), 0) AS inUseNumber
SELECT FROM
a.project_contraption_id, UNNEST(
COUNT(1) as inUseNumber ARRAY[
FROM <foreach collection="projectContraptionIdList" item="id" separator=",">
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
FROM
tzs_jg_installation_notice a
WHERE a.project_contraption_id in
<foreach collection ='projectContraptionIdList' item='id' index='index' open="(" close= ")" separator=",">
#{id} #{id}
</foreach> </foreach>
AND a.notice_status <![CDATA[ <> ]]> '6610' ]
AND a.notice_status <![CDATA[ <> ]]> '6615' ) AS pl(project_contraption_id)
AND a.notice_status <![CDATA[ <> ]]> '6614' LEFT JOIN tzs_jg_use_registration ur
group by a.project_contraption_id ON ur.project_contraption_id = pl.project_contraption_id
) AND ur.is_delete = 0
GROUP BY project_contraption_id 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>
<select id="countContraptionInUseTimesForDelete" resultMap="projectContraptionResultMap"> <select id="countContraptionInUseTimesForDelete" resultMap="projectContraptionResultMap">
SELECT SELECT
project_contraption_id, project_contraption_id,
...@@ -258,14 +246,21 @@ ...@@ -258,14 +246,21 @@
</select> </select>
<select id="selectEquipCount" resultType="java.util.Map"> <select id="selectEquipCount" resultType="java.util.Map">
SELECT ibjui.project_contraption_id, CAST(count(1) AS INTEGER) AS count SELECT tu.project_contraption_id,
FROM idx_biz_jg_use_info ibjui CAST(COUNT(1) AS INTEGER) AS count
WHERE ibjui.project_contraption_id in FROM (
<foreach collection ='projectContraptionIdList' item='id' index='index' open="(" close= ")" separator=","> 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} #{id}
</foreach> </foreach>
GROUP BY ibjui.project_contraption_id ])) tu
GROUP BY tu.project_contraption_id
</select> </select>
<select id="queryJgProjectContraptionPage" <select id="queryJgProjectContraptionPage"
resultType="com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption"> resultType="com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption">
select select
...@@ -357,26 +352,36 @@ ...@@ -357,26 +352,36 @@
</select> </select>
<select id="selectCheckCountByNotNull" resultType="java.util.Map"> <select id="selectCheckCountByNotNull" resultType="java.util.Map">
SELECT A.project_contraption_id,CAST(count(1) AS INTEGER) AS count /*+ use_cplan tablescan(idx_biz_jg_use_info) tablescan(idx_biz_jg_inspection_detection_info) set(query_dop 16) */
FROM WITH target_use AS MATERIALIZED (
( SELECT "RECORD", project_contraption_id
SELECT FROM idx_biz_jg_use_info
ibjui.project_contraption_id, WHERE project_contraption_id != null and
( SELECT INSPECT_ORG_NAME FROM idx_biz_jg_inspection_detection_info WHERE "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC LIMIT 1 ) inspectOrgName, project_contraption_id IN
( SELECT INSPECT_CONCLUSION FROM idx_biz_jg_inspection_detection_info WHERE "RECORD" = ibjui."RECORD" ORDER BY INSPECT_DATE DESC LIMIT 1 ) inspectConclusion, <foreach collection="projectContraptionIdList" item="id" index="index" open="(" close=")" separator=",">
( 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=",">
#{id} #{id}
</foreach> </foreach>
) A ),
WHERE latest_inspect AS (
A.inspectOrgName IS NOT NULL AND A.inspectOrgName != '' AND A.inspectConclusion IS NOT NULL and A.inspectConclusion!='' SELECT *
and A.nextInspectDate IS NOT NULL FROM (
GROUP BY A.project_contraption_id 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>
<select id="countContraptionInUseTimesForDeleteByIntoManagement" resultType="java.lang.Integer"> <select id="countContraptionInUseTimesForDeleteByIntoManagement" resultType="java.lang.Integer">
...@@ -458,172 +463,130 @@ ...@@ -458,172 +463,130 @@
<select id="countContraptionInUseTimesForDeleteByIntoManagementBatch" resultMap="projectContraptionResultMap"> <select id="countContraptionInUseTimesForDeleteByIntoManagementBatch" resultMap="projectContraptionResultMap">
SELECT SELECT
project_contraption_id, pc.project_contraption_id,
SUM(inUseNumber) inUseNumber COALESCE(et.cnt,0) +
FROM ( COALESCE(ur.cnt,0) +
SELECT COALESCE(cru.cnt,0) +
c.project_contraption_id, COALESCE(ed.cnt,0) +
COUNT(1) AS inUseNumber COALESCE(sc.cnt,0) +
FROM tzs_jg_equip_transfer a COALESCE(crt.cnt,0) +
LEFT JOIN tzs_jg_equip_transfer_eq b ON b.equip_transfer_id=a.sequence_nbr COALESCE(crn.cnt,0) +
LEFT JOIN idx_biz_jg_use_info c ON b.equ_id=c.record COALESCE(ins.cnt,0) +
WHERE c.project_contraption_id in COALESCE(mnt.cnt,0) +
<foreach collection="projectContraptionIdList" item="projectContraptionId" index='index' open="(" close= ")" separator=","> COALESCE(ref.cnt,0) +
#{projectContraptionId} COALESCE(trf.cnt,0) +
</foreach> COALESCE(inspec.cnt,0) AS inUseNumber
AND a.is_delete = 0 FROM
AND ( a.apply_status != '6617') (VALUES
GROUP BY c.project_contraption_id <foreach collection="projectContraptionIdList" item="projectContraptionId" separator=",">
UNION (#{projectContraptionId})
SELECT </foreach>
a.project_contraption_id, ) AS pc(project_contraption_id)
COUNT(1) AS inUseNumber
FROM LEFT JOIN (
tzs_jg_use_registration a SELECT c.project_contraption_id, COUNT(1) AS cnt
WHERE a.project_contraption_id in FROM tzs_jg_equip_transfer a
<foreach collection="projectContraptionIdList" item="projectContraptionId" index='index' open="(" close= ")" separator=","> JOIN tzs_jg_equip_transfer_eq b ON b.equip_transfer_id = a.sequence_nbr
#{projectContraptionId} JOIN idx_biz_jg_use_info c ON b.equ_id = c.record
</foreach> WHERE a.is_delete = 0 AND a.apply_status != '6617'
AND a.is_delete = 0 GROUP BY c.project_contraption_id
AND ( a.status != '已作废') ) et ON et.project_contraption_id = pc.project_contraption_id
GROUP BY a.project_contraption_id
UNION LEFT JOIN (
SELECT SELECT a.project_contraption_id, COUNT(1) AS cnt
c.project_contraption_id, FROM tzs_jg_use_registration a
COUNT(1) AS inUseNumber WHERE a.is_delete = 0 AND a.status != '已作废'
FROM tzs_jg_change_registration_unit a GROUP BY a.project_contraption_id
LEFT JOIN tzs_jg_change_registration_unit_eq b ON b.unit_change_registration_id=a.sequence_nbr ) ur ON ur.project_contraption_id = pc.project_contraption_id
LEFT JOIN idx_biz_jg_use_info c ON b.equ_id=c.record
WHERE c.project_contraption_id in LEFT JOIN (
<foreach collection="projectContraptionIdList" item="projectContraptionId" index='index' open="(" close= ")" separator=","> SELECT c.project_contraption_id, COUNT(1) AS cnt
#{projectContraptionId} FROM tzs_jg_change_registration_unit a
</foreach> JOIN tzs_jg_change_registration_unit_eq b ON b.unit_change_registration_id = a.sequence_nbr
AND a.is_delete = 0 JOIN idx_biz_jg_use_info c ON b.equ_id = c.record
AND ( a.status != '已作废') WHERE a.is_delete = 0 AND a.status != '已作废'
GROUP BY c.project_contraption_id GROUP BY c.project_contraption_id
UNION ) cru ON cru.project_contraption_id = pc.project_contraption_id
SELECT
c.project_contraption_id, LEFT JOIN (
COUNT(1) AS inUseNumber SELECT c.project_contraption_id, COUNT(1) AS cnt
FROM tzs_jg_enable_disable a FROM tzs_jg_enable_disable a
LEFT JOIN tzs_jg_enable_disable_eq b ON b.enable_disable_apply_id=a.sequence_nbr 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 JOIN idx_biz_jg_use_info c ON b.equ_id = c.record
WHERE c.project_contraption_id in WHERE a.is_delete = 0 AND a.audit_status != '已作废'
<foreach collection="projectContraptionIdList" item="projectContraptionId" index='index' open="(" close= ")" separator=","> GROUP BY c.project_contraption_id
#{projectContraptionId} ) ed ON ed.project_contraption_id = pc.project_contraption_id
</foreach>
AND a.is_delete = 0 LEFT JOIN (
AND ( a.audit_status != '已作废') SELECT c.project_contraption_id, COUNT(1) AS cnt
GROUP BY c.project_contraption_id FROM tzs_jg_scrap_cancel a
UNION JOIN tzs_jg_scrap_cancel_eq b ON b.equip_transfer_id = a.sequence_nbr
SELECT JOIN idx_biz_jg_use_info c ON b.equ_id = c.record
c.project_contraption_id, WHERE a.is_delete = 0 AND a.audit_status != '使用单位已撤回'
COUNT(1) AS inUseNumber GROUP BY c.project_contraption_id
FROM tzs_jg_scrap_cancel a ) sc ON sc.project_contraption_id = pc.project_contraption_id
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 LEFT JOIN (
WHERE c.project_contraption_id in SELECT c.project_contraption_id, COUNT(1) AS cnt
<foreach collection="projectContraptionIdList" item="projectContraptionId" index='index' open="(" close= ")" separator=","> FROM tzs_jg_change_registration_transfer a
#{projectContraptionId} JOIN tzs_jg_change_registration_transfer_eq b ON b.equip_transfer_id = a.sequence_nbr
</foreach> JOIN idx_biz_jg_use_info c ON b.equ_id = c.record
AND a.is_delete = 0 WHERE a.is_delete = 0 AND a.audit_status != '使用单位已撤回'
AND ( a.audit_status != '使用单位已撤回') GROUP BY c.project_contraption_id
GROUP BY c.project_contraption_id ) crt ON crt.project_contraption_id = pc.project_contraption_id
UNION
SELECT LEFT JOIN (
c.project_contraption_id, SELECT c.project_contraption_id, COUNT(1) AS cnt
COUNT(1) AS inUseNumber FROM tzs_jg_change_registration_name a
FROM tzs_jg_change_registration_transfer a JOIN tzs_jg_change_registration_name_eq b ON b.name_change_registration_id = a.sequence_nbr
LEFT 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
LEFT JOIN idx_biz_jg_use_info c ON b.equ_id=c.record WHERE a.is_delete = 0 AND a.audit_status != '使用单位已撤回'
WHERE c.project_contraption_id in GROUP BY c.project_contraption_id
<foreach collection="projectContraptionIdList" item="projectContraptionId" index='index' open="(" close= ")" separator=","> ) crn ON crn.project_contraption_id = pc.project_contraption_id
#{projectContraptionId}
</foreach> LEFT JOIN (
AND a.is_delete = 0 SELECT a.project_contraption_id, COUNT(1) AS cnt
AND ( a.audit_status != '使用单位已撤回') FROM tzs_jg_installation_notice a
GROUP BY c.project_contraption_id WHERE a.notice_status != '6617'
UNION GROUP BY a.project_contraption_id
SELECT ) ins ON ins.project_contraption_id = pc.project_contraption_id
c.project_contraption_id,
COUNT(1) AS inUseNumber LEFT JOIN (
FROM tzs_jg_change_registration_name a SELECT c.project_contraption_id, COUNT(1) AS cnt
LEFT JOIN tzs_jg_change_registration_name_eq b ON b.name_change_registration_id=a.sequence_nbr FROM tzs_jg_maintain_notice a
LEFT JOIN idx_biz_jg_use_info c ON b.equ_id=c.record JOIN tzs_jg_maintain_notice_eq b ON b.equip_transfer_id = a.sequence_nbr
WHERE c.project_contraption_id in JOIN idx_biz_jg_use_info c ON b.equ_id = c.record
<foreach collection="projectContraptionIdList" item="projectContraptionId" index='index' open="(" close= ")" separator=","> WHERE a.is_delete = 0 AND a.notice_status != '6617'
#{projectContraptionId} GROUP BY c.project_contraption_id
</foreach> ) mnt ON mnt.project_contraption_id = pc.project_contraption_id
AND a.is_delete = 0
AND ( a.audit_status != '使用单位已撤回') LEFT JOIN (
GROUP BY c.project_contraption_id SELECT c.project_contraption_id, COUNT(1) AS cnt
UNION FROM tzs_jg_reform_notice a
SELECT JOIN tzs_jg_reform_notice_eq b ON b.equip_transfer_id = a.sequence_nbr
a.project_contraption_id, JOIN idx_biz_jg_use_info c ON b.equ_id = c.record
COUNT(1) AS inUseNumber WHERE a.is_delete = 0 AND a.notice_status != '6617'
FROM GROUP BY c.project_contraption_id
tzs_jg_installation_notice a ) ref ON ref.project_contraption_id = pc.project_contraption_id
WHERE a.project_contraption_id in
<foreach collection="projectContraptionIdList" item="projectContraptionId" index='index' open="(" close= ")" separator=","> LEFT JOIN (
#{projectContraptionId} SELECT c.project_contraption_id, COUNT(1) AS cnt
</foreach> FROM tzs_jg_transfer_notice a
AND (a.notice_status != '6617') JOIN tzs_jg_transfer_notice_eq b ON b.equip_transfer_id = a.sequence_nbr
GROUP BY a.project_contraption_id JOIN idx_biz_jg_use_info c ON b.equ_id = c.record
UNION WHERE a.is_delete = 0 AND a.notice_status != '6617'
SELECT GROUP BY c.project_contraption_id
c.project_contraption_id, ) trf ON trf.project_contraption_id = pc.project_contraption_id
COUNT(1) AS inUseNumber
FROM tzs_jg_maintain_notice a LEFT JOIN (
LEFT JOIN tzs_jg_maintain_notice_eq b ON b.equip_transfer_id=a.sequence_nbr SELECT a.project_contraption_id, COUNT(1) AS cnt
LEFT JOIN idx_biz_jg_use_info c ON b.equ_id=c.record FROM tz_jyjc_inspection_application a
WHERE c.project_contraption_id in WHERE a.status != '6617'
<foreach collection="projectContraptionIdList" item="projectContraptionId" index='index' open="(" close= ")" separator=","> GROUP BY a.project_contraption_id
#{projectContraptionId} ) inspec ON inspec.project_contraption_id = pc.project_contraption_id
</foreach>
AND 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
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')
GROUP BY c.project_contraption_id
UNION
SELECT
c.project_contraption_id,
COUNT(1) AS inUseNumber
FROM tzs_jg_transfer_notice a
LEFT JOIN tzs_jg_transfer_notice_eq b ON b.equip_transfer_id=a.sequence_nbr
LEFT JOIN idx_biz_jg_use_info c ON b.equ_id=c.record
WHERE c.project_contraption_id in
<foreach collection="projectContraptionIdList" item="projectContraptionId" index='index' open="(" close= ")" separator=",">
#{projectContraptionId}
</foreach>
AND 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
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')
GROUP BY a.project_contraption_id
) GROUP BY project_contraption_id
</select> </select>
<select id="selectPipelineListByProjectContraptionId" <select id="selectPipelineListByProjectContraptionId"
resultType="com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgTechParamsPipeline"> resultType="com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgTechParamsPipeline">
SELECT SELECT
......
...@@ -702,4 +702,16 @@ public class EquipmentCategoryController extends BaseController { ...@@ -702,4 +702,16 @@ public class EquipmentCategoryController extends BaseController {
public ResponseModel<JSONObject> batchHandlerCode96333() { public ResponseModel<JSONObject> batchHandlerCode96333() {
return ResponseHelper.buildResponse(equipmentCategoryService.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 { ...@@ -90,16 +90,16 @@ public class TzsAppController {
return ResponseHelper.buildResponse(appService.getEquipInfoBySuperviseCode(supervisoryCode)); return ResponseHelper.buildResponse(appService.getEquipInfoBySuperviseCode(supervisoryCode));
} }
/** // /**
* 登录 // * 登录
* @return // * @return
*/ // */
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) // @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@PostMapping(value = "/mobile/login") // @PostMapping(value = "/mobile/login")
@ApiOperation(httpMethod = "POST", value = "小程序登录", notes = "小程序登录") // @ApiOperation(httpMethod = "POST", value = "小程序登录", notes = "小程序登录")
public ResponseModel<Map<String, Object>> login(@RequestBody MobileLoginParam param) { // public ResponseModel<Map<String, Object>> login(@RequestBody MobileLoginParam param) {
return ResponseHelper.buildResponse(appService.login(param)); // return ResponseHelper.buildResponse(appService.login(param));
} // }
/** /**
* 小程序企业详情 * 小程序企业详情
......
...@@ -835,8 +835,13 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -835,8 +835,13 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
param.put("CODE96333", elevatorCode); param.put("CODE96333", elevatorCode);
objMap.put(otherInfo.getRecord(), param); objMap.put(otherInfo.getRecord(), param);
this.commonUpdateEsDataByIds(objMap); this.commonUpdateEsDataByIds(objMap);
}
Optional<ESEquipmentInfo> equipmentDaoById = esEquipmentDao.findById(otherInfo.getRecord());
equipmentDaoById.ifPresent(data -> {
data.setCODE96333(elevatorCode);
esEquipmentDao.save(data);
});
}
return "96333码修复成功!"; return "96333码修复成功!";
} }
...@@ -2746,6 +2751,20 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -2746,6 +2751,20 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
.fluentPut("异常数据,需手动处理:", JSONObject.toJSONString(manualProcessData)); .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) { private void saveCode96333ForEs(String record, String code96333) {
// idx_biz_view_jg_all // idx_biz_view_jg_all
Optional<ESEquipmentCategoryDto> esEquipmentCategoryDto = esEquipmentCategory.findById(record); 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