Commit ec158684 authored by 麻笑宇's avatar 麻笑宇

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

parents 4fe6da30 1d167481
......@@ -11,7 +11,7 @@ import java.util.Map;
public class EquCategoryConverter implements Converter<String> {
private static final Map<String, String> equipmentMap = new HashMap<>();
public static final Map<String, String> equipmentMap = new HashMap<>();
static {
// 填充映射关系
......@@ -80,4 +80,13 @@ public class EquCategoryConverter implements Converter<String> {
public CellData convertToExcelData(String o, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
return new CellData("");
}
public static String getKeyByValue(String value) {
for (Map.Entry<String, String> entry : equipmentMap.entrySet()) {
if (entry.getValue().equals(value)) {
return entry.getKey();
}
}
return null;
}
}
......@@ -108,4 +108,13 @@ public class EquDefineConverter implements Converter<String> {
public CellData convertToExcelData(String o, ExcelContentProperty excelContentProperty, GlobalConfiguration globalConfiguration) throws Exception {
return new CellData("");
}
public static String getKeyByValue(String value) {
for (Map.Entry<String, String> entry : equipmentMap.entrySet()) {
if (entry.getValue().equals(value)) {
return entry.getKey();
}
}
return null;
}
}
......@@ -58,5 +58,13 @@ public class DataDockController {
}
return ResponseHelper.buildResponse(dataDockService.dataCheckAndImportEquipmentData(remark, file));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/delete")
@ApiOperation(httpMethod = "POST", value = "八大类历史设备导入shanchu", notes = "八大类历史设备导入shachu")
public Object importData() {
dataDockService.delete();
return ResponseHelper.buildResponse("ok");
}
}
......@@ -576,6 +576,9 @@ public class DataHandlerServiceImpl {
Map<Long, List<String>> projectContraptionIdRecordsMap = new HashMap<>();
for(JgInstallationNotice installationNotice : noticeList){
List<JgInstallationNoticeEq> noticeEqs = installationNoticeEqService.list(new LambdaQueryWrapper<JgInstallationNoticeEq>().eq(JgInstallationNoticeEq::getEquipTransferId, installationNotice.getSequenceNbr()).select(JgInstallationNoticeEq::getEquId,JgInstallationNoticeEq::getInformNumber));
if(noticeEqs.isEmpty()){
continue;
}
List<String> records = noticeEqs.stream().map(JgInstallationNoticeEq::getEquId).collect(Collectors.toList());
List<IdxBizJgUseInfo> useInfos = useInfoService.lambdaQuery()
.in(IdxBizJgUseInfo::getRecord, records)
......@@ -756,54 +759,59 @@ public class DataHandlerServiceImpl {
private void updateProjectContraptionAfter(JgUseRegistration useRegistration, JgInstallationNotice installationNotice) {
// 特殊处理 将任意一个的 record 放入到remark字段
IdxBizJgUseInfo useInfo = getIdxBizJgUseInfo(installationNotice.getRemark());
LambdaUpdateWrapper<IdxBizJgProjectContraption> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(BaseEntity::getSequenceNbr, installationNotice.getProjectContraptionId());
updateWrapper.set(IdxBizJgProjectContraption::getUscUnitCreditCode ,null);
updateWrapper.set(IdxBizJgProjectContraption::getUscUnitName,null);
updateWrapper.set(IdxBizJgProjectContraption::getUseRegistrationCode, useRegistration.getUseRegistrationCode());
updateWrapper.set(IdxBizJgProjectContraption::getProvince, useInfo.getProvince());
updateWrapper.set(IdxBizJgProjectContraption::getProvinceName, useInfo.getProvinceName());
updateWrapper.set(IdxBizJgProjectContraption::getCity, useInfo.getCity());
updateWrapper.set(IdxBizJgProjectContraption::getCityName, useInfo.getCityName());
updateWrapper.set(IdxBizJgProjectContraption::getCounty, useInfo.getCounty());
updateWrapper.set(IdxBizJgProjectContraption::getCountyName, useInfo.getCountyName());
updateWrapper.set(IdxBizJgProjectContraption::getStreet, useInfo.getFactoryUseSiteStreet());
updateWrapper.set(IdxBizJgProjectContraption::getStreetName, useInfo.getStreetName());
updateWrapper.set(IdxBizJgProjectContraption::getAddress, useInfo.getAddress());
updateWrapper.set(IdxBizJgProjectContraption::getUseDate, useRegistration.getAuditPassDate());
projectContraptionService.update(null, updateWrapper);
if(useInfo != null){
LambdaUpdateWrapper<IdxBizJgProjectContraption> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(BaseEntity::getSequenceNbr, installationNotice.getProjectContraptionId());
updateWrapper.set(IdxBizJgProjectContraption::getUscUnitCreditCode ,null);
updateWrapper.set(IdxBizJgProjectContraption::getUscUnitName,null);
updateWrapper.set(IdxBizJgProjectContraption::getUseRegistrationCode, useRegistration.getUseRegistrationCode());
updateWrapper.set(IdxBizJgProjectContraption::getProvince, useInfo.getProvince());
updateWrapper.set(IdxBizJgProjectContraption::getProvinceName, useInfo.getProvinceName());
updateWrapper.set(IdxBizJgProjectContraption::getCity, useInfo.getCity());
updateWrapper.set(IdxBizJgProjectContraption::getCityName, useInfo.getCityName());
updateWrapper.set(IdxBizJgProjectContraption::getCounty, useInfo.getCounty());
updateWrapper.set(IdxBizJgProjectContraption::getCountyName, useInfo.getCountyName());
updateWrapper.set(IdxBizJgProjectContraption::getStreet, useInfo.getFactoryUseSiteStreet());
updateWrapper.set(IdxBizJgProjectContraption::getStreetName, useInfo.getStreetName());
updateWrapper.set(IdxBizJgProjectContraption::getAddress, useInfo.getAddress());
updateWrapper.set(IdxBizJgProjectContraption::getUseDate, useRegistration.getAuditPassDate());
projectContraptionService.update(null, updateWrapper);
}
}
private void createProjectInspectInfoAfter(JgUseRegistration useRegistration) {
JgRegistrationHistory jgRegistrationHistory = getRegistrationHistory(useRegistration.getSequenceNbr() + "");
JSONObject mapData = JSONObject.parseObject(jgRegistrationHistory.getChangeData());
IdxBizJgProjectInspection inspectionDetectionInfo = new IdxBizJgProjectInspection();
BeanUtil.copyProperties(mapData, inspectionDetectionInfo);
// 兼容最早的老数据,管道的检验信息单独维护
if(inspectionDetectionInfo.getInspectConclusion() == null && mapData.containsKey("equipmentLists")){
List<Map<String, Object>> equipmentLists = null;
try {
equipmentLists = objectMapper.readValue(
objectMapper.writeValueAsString(mapData.get("equipmentLists")),
new TypeReference<ArrayList<Map<String, Object>>>() {
}
);
if(!equipmentLists.isEmpty()){
Object record = equipmentLists.get(0).get("record");
IdxBizJgInspectionDetectionInfo idxBizJgInspectionDetectionInfo = iIdxBizJgInspectionDetectionInfoService.queryNewestDetailByRecord(String.valueOf(record));
BeanUtil.copyProperties(idxBizJgInspectionDetectionInfo, inspectionDetectionInfo);
inspectionDetectionInfo.setRecord(null);
if(jgRegistrationHistory != null){
JSONObject mapData = JSONObject.parseObject(jgRegistrationHistory.getChangeData());
IdxBizJgProjectInspection inspectionDetectionInfo = new IdxBizJgProjectInspection();
BeanUtil.copyProperties(mapData, inspectionDetectionInfo);
// 兼容最早的老数据,管道的检验信息单独维护
if(inspectionDetectionInfo.getInspectConclusion() == null && mapData.containsKey("equipmentLists")){
List<Map<String, Object>> equipmentLists = null;
try {
equipmentLists = objectMapper.readValue(
objectMapper.writeValueAsString(mapData.get("equipmentLists")),
new TypeReference<ArrayList<Map<String, Object>>>() {
}
);
if(!equipmentLists.isEmpty()){
Object record = equipmentLists.get(0).get("record");
IdxBizJgInspectionDetectionInfo idxBizJgInspectionDetectionInfo = iIdxBizJgInspectionDetectionInfoService.queryNewestDetailByRecord(String.valueOf(record));
BeanUtil.copyProperties(idxBizJgInspectionDetectionInfo, inspectionDetectionInfo);
inspectionDetectionInfo.setRecord(null);
}
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
inspectionDetectionInfo.setProjectContraptionId(useRegistration.getProjectContraptionId());
inspectionDetectionInfo.setRecDate(new Date());
// 使用登记创建新增的检验信息id设置为使用登记的主键id,在作废时级联作废
inspectionDetectionInfo.setSequenceNbr(useRegistration.getSequenceNbr() + "");
projectInspectionMapper.insert(inspectionDetectionInfo);
}
inspectionDetectionInfo.setProjectContraptionId(useRegistration.getProjectContraptionId());
inspectionDetectionInfo.setRecDate(new Date());
// 使用登记创建新增的检验信息id设置为使用登记的主键id,在作废时级联作废
inspectionDetectionInfo.setSequenceNbr(useRegistration.getSequenceNbr() + "");
projectInspectionMapper.insert(inspectionDetectionInfo);
}
private IdxBizJgUseInfo getIdxBizJgUseInfo(String record) {
......
package com.yeejoin.amos.boot.module.statistics.api.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.statistics.api.entity.TzBaseEnterpriseInfo;
import com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseEnterpriseInfoDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -22,4 +25,13 @@ public interface EnterpriseBizMapper {
TzBaseEnterpriseInfo queryByUseCode(@Param("useCode") String useCode);
TzBaseEnterpriseInfo queryBySeq(@Param("sequenceNbr") String sequenceNbr);
/**
* 监查值守迁移接口
* @param page 分页参数
* @param tzBaseEnterpriseInfoDto 筛选条件
* @param orgCodeList 机构
* @return 分页
*/
IPage<TzBaseEnterpriseInfoDto> pageList2(Page<TzBaseEnterpriseInfoDto> page, TzBaseEnterpriseInfoDto tzBaseEnterpriseInfoDto, List orgCodeList, List unitTypeList);
}
......@@ -14,5 +14,103 @@
<select id="queryBySeq" resultType="com.yeejoin.amos.boot.module.statistics.api.entity.TzBaseEnterpriseInfo">
select * from tz_base_enterprise_info where sequence_nbr = #{sequenceNbr}
</select>
<select id="pageList2"
resultType="com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseEnterpriseInfoDto">
SELECT
*,
equip_category as equipType,
TRIM(TRAILING '/' FROM CONCAT(
CASE WHEN COALESCE(province, '') <![CDATA[<>]]> '' THEN CONCAT(province, '/') ELSE '' END,
CASE WHEN COALESCE(city, '') <![CDATA[<>]]> '' THEN CONCAT(city, '/') ELSE '' END,
CASE WHEN COALESCE(district, '') <![CDATA[<>]]> '' THEN CONCAT(district, '/') ELSE '' END
)) AS region,
<if test=" tzBaseEnterpriseInfoDto.unitType.indexOf('使用单位')!=-1">
(SELECT cdd.name from amos_tzs_biz.cb_data_dictionary cdd WHERE cdd.code = industry_supervisor and cdd.type = 'HYZGBM') AS industrySupervisorName,
</if>
CONCAT(street,'/',address) AS full_address
FROM
tz_base_enterprise_info
<if test=" tzBaseEnterpriseInfoDto.unitType.indexOf('检验检测机构') !=-1 ">
JOIN (select unit_code,max(accept_date) from tz_jyjc_opening_application
where 1=1
<if test=" tzBaseEnterpriseInfoDto.jyjcStatus!=null and tzBaseEnterpriseInfoDto.jyjcStatus!='' ">
and status = #{tzBaseEnterpriseInfoDto.jyjcStatus}
</if>
<if test=" tzBaseEnterpriseInfoDto.jyjcType!=null and tzBaseEnterpriseInfoDto.jyjcType!='' ">
and open_biz_type = #{tzBaseEnterpriseInfoDto.jyjcType}
</if>
group by unit_code,open_biz_type) t1
ON t1.unit_code = use_code
</if>
<where>
<!-- <if-->
<!-- test="tzBaseEnterpriseInfoDto.unitType!=null and tzBaseEnterpriseInfoDto.unitType!='' and tzBaseEnterpriseInfoDto.unitType!='使用单位' ">-->
<!-- -->
<!-- AND unit_type LIKE CONCAT('%',#{tzBaseEnterpriseInfoDto.unitType},'%')-->
<!-- </if>-->
<if test="unitTypeList != null and !unitTypeList.isEmpty()">
AND (
<foreach collection="unitTypeList" item="item" separator=" OR ">
unit_type LIKE CONCAT('%', #{item}, '%')
</foreach>
)
</if>
<if
test="tzBaseEnterpriseInfoDto.useUnit!=null and tzBaseEnterpriseInfoDto.useUnit!='' ">
AND use_unit LIKE CONCAT('%',#{tzBaseEnterpriseInfoDto.useUnit},'%')
</if>
<if
test="tzBaseEnterpriseInfoDto.useUnitCertificate!=null and tzBaseEnterpriseInfoDto.useUnitCertificate!='' ">
AND use_unit_certificate = #{tzBaseEnterpriseInfoDto.useUnitCertificate}
</if>
<if
test="tzBaseEnterpriseInfoDto.useCode!=null and tzBaseEnterpriseInfoDto.useCode!='' ">
AND use_code LIKE CONCAT('%',#{tzBaseEnterpriseInfoDto.useCode},'%')
</if>
<if
test="tzBaseEnterpriseInfoDto.region!=null and tzBaseEnterpriseInfoDto.region!='' ">
AND CONCAT_WS('/', province,city,district) LIKE CONCAT('%',#{tzBaseEnterpriseInfoDto.region},'%')
</if>
<if
test="tzBaseEnterpriseInfoDto.legalPerson!=null and tzBaseEnterpriseInfoDto.legalPerson!='' ">
AND legal_person LIKE CONCAT('%',#{tzBaseEnterpriseInfoDto.legalPerson},'%')
</if>
<if
test="tzBaseEnterpriseInfoDto.legalPhone!=null and tzBaseEnterpriseInfoDto.legalPhone!='' ">
AND legal_phone LIKE CONCAT('%',#{tzBaseEnterpriseInfoDto.legalPhone},'%')
</if>
<if
test="tzBaseEnterpriseInfoDto.superviseOrgCode!=null and tzBaseEnterpriseInfoDto.superviseOrgCode!='' ">
AND supervise_org_code LIKE CONCAT('%',#{tzBaseEnterpriseInfoDto.superviseOrgCode},'%')
</if>
<if
test="tzBaseEnterpriseInfoDto.address!=null and tzBaseEnterpriseInfoDto.address!='' ">
AND address LIKE CONCAT('%',#{tzBaseEnterpriseInfoDto.address},'%')
</if>
<if test="tzBaseEnterpriseInfoDto.regulatoryLabels!=null and tzBaseEnterpriseInfoDto.regulatoryLabels!='' ">
AND regulatory_labels LIKE CONCAT('%',#{tzBaseEnterpriseInfoDto.regulatoryLabels},'%')
</if>
<if test="tzBaseEnterpriseInfoDto.equipType!=null and tzBaseEnterpriseInfoDto.equipType!='' ">
AND equip_category LIKE CONCAT('%',#{tzBaseEnterpriseInfoDto.equipType},'%')
</if>
<if test="orgCodeList != null and !orgCodeList.isEmpty()">
AND (
<foreach collection="orgCodeList" item="item" separator=" OR ">
supervise_org_code LIKE CONCAT('%', #{item}, '%')
</foreach>
)
</if>
<if test="tzBaseEnterpriseInfoDto.industrySupervisor!=null and tzBaseEnterpriseInfoDto.industrySupervisor!='' ">
AND (industry_supervisor = #{tzBaseEnterpriseInfoDto.industrySupervisor}
<if test=" tzBaseEnterpriseInfoDto.industrySupervisor == '6527' ">
or industry_supervisor is null
</if>)
</if>
AND is_delete = 0
</where>
order by rec_date desc
</select>
</mapper>
......@@ -11,11 +11,12 @@ import com.yeejoin.amos.boot.module.common.api.enums.UnitTypeEnum;
import com.yeejoin.amos.boot.module.statistics.api.mapper.EnterpriseBizMapper;
import com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseEnterpriseInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.PageParam;
import com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.lucene.queryparser.classic.QueryParser;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
......@@ -44,8 +45,6 @@ public class EnterpriseBizServiceImpl {
private StCommonServiceImpl stCommonService;
private TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper;
private EnterpriseBizMapper enterpriseBizMapper;
private RestHighLevelClient restHighLevelClient;
......@@ -54,11 +53,10 @@ public class EnterpriseBizServiceImpl {
private Logger logger = LoggerFactory.getLogger(EnterpriseBizServiceImpl.class);
public EnterpriseBizServiceImpl(RedisUtils redisUtils, StCommonServiceImpl stCommonService,
TzBaseEnterpriseInfoMapper tzBaseEnterpriseInfoMapper, EnterpriseBizMapper enterpriseBizMapper,
EnterpriseBizMapper enterpriseBizMapper,
RestHighLevelClient restHighLevelClient) {
this.redisUtils = redisUtils;
this.stCommonService = stCommonService;
this.tzBaseEnterpriseInfoMapper = tzBaseEnterpriseInfoMapper;
this.enterpriseBizMapper = enterpriseBizMapper;
this.restHighLevelClient = restHighLevelClient;
}
......@@ -107,13 +105,23 @@ public class EnterpriseBizServiceImpl {
}
}
}
IPage<TzBaseEnterpriseInfoDto> tzBaseEnterpriseInfoDtoIPage = tzBaseEnterpriseInfoMapper.pageList2(page, tzBaseEnterpriseInfoDto, orgCodeList, unitTypeList);
IPage<TzBaseEnterpriseInfoDto> tzBaseEnterpriseInfoDtoIPage = enterpriseBizMapper.pageList2(page, tzBaseEnterpriseInfoDto, orgCodeList, unitTypeList);
if (ValidationUtil.isEmpty(tzBaseEnterpriseInfoDtoIPage.getRecords())) {
logger.info("查询到的数据为空");
return tzBaseEnterpriseInfoDtoIPage;
}
for(TzBaseEnterpriseInfoDto dto : tzBaseEnterpriseInfoDtoIPage.getRecords()){
if(StringUtils.isNotEmpty(dto.getEquipType())){
String equipType = dto.getEquipType();
List<String> equipTypeList = JSON.parseArray(equipType, String.class);
Set<String> names = new HashSet<>();
for(String equCode : equipTypeList){
names.add(EquipmentClassifityEnum.getNameByCode(equCode));
}
names.remove("");
dto.setEquipTypeName(StringUtils.join(names, ","));
}
}
if (tzBaseEnterpriseInfoDto.getUnitType().contains(UnitTypeEnum.CZDW.getName())) {
SearchRequest searchRequest = new SearchRequest("idx_biz_view_jg_all");
......
......@@ -319,4 +319,14 @@ public class TzBaseEnterpriseInfoDto extends BaseDto {
//充装单位列表展示需要的气瓶数量
private String gasCount;
/**
* 设备类型-code
*/
private String equipType;
/**
* 设备类型-名称
*/
private String equipTypeName;
}
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