| | |
| | | package com.fzzy.async.fzzy40.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.fzzy.api.Constant; |
| | | import com.fzzy.api.entity.Api1102; |
| | | import com.fzzy.api.entity.ApiInfoData; |
| | | import com.fzzy.api.entity.ApiLog; |
| | | import com.fzzy.api.service.ApiCommonService; |
| | | import com.fzzy.api.utils.ContextUtil; |
| | | import com.fzzy.api.view.repository.Api1102Rep; |
| | | import com.fzzy.api.view.repository.ApiInfoDataRep; |
| | | import com.fzzy.api.view.repository.ApiLogRep; |
| | | import com.fzzy.async.fzzy40.entity.Fz40SecCamera; |
| | |
| | | import com.fzzy.push.sh2023.SH2023Constant; |
| | | import com.fzzy.push.sh2023.dto.SH2023Api1311; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.aspectj.weaver.ConcreteTypeMunger; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | @Autowired |
| | | private ApiLogRep apiLogRep; |
| | | @Autowired |
| | | private Fzzy40Sync1311Rep fzzy40Sync1311Rep; |
| | | private Api1102Rep api1102Rep; |
| | | @Autowired |
| | | private ApiCommonService commonService; |
| | | private Fzzy40Sync1311Rep fzzy40Sync1311Rep; |
| | | @Autowired |
| | | private ApiInfoDataRep apiInfoDataRep; |
| | | |
| | |
| | | log.debug("-------------没有获取到视频监控信息------------------"); |
| | | return; |
| | | } |
| | | Api1102 api1102 = api1102Rep.findById(kqdm).get(); |
| | | SH2023Api1311 sh2023Api1311; |
| | | SH2023Api1311 sh1311; |
| | | List<ApiInfoData> apiInfoDataList; |
| | | String dataID; |
| | | int num = 1; |
| | | String secType = "01,02,03,04,05"; |
| | | Integer num = 1000001; |
| | | for (Fz40SecCamera sysData : list) { |
| | | dataID = kqdm.substring(3, 8) + "01401327" + String.format("%06d", num++); |
| | | List<ApiInfoData> apiInfoData = apiInfoDataRep.getDataByInteAndData(SH2023Constant.SH_2023_API_CODE_1311, dataID); |
| | | if (null != apiInfoData && apiInfoData.size() > 0) { |
| | | continue; |
| | | } |
| | | sh2023Api1311 = new SH2023Api1311(); |
| | | sh2023Api1311.setSxtbh(dataID); |
| | | sh2023Api1311.setSpjksbid(api1102.getXzqhdm() + "00401327" + String.valueOf(num).substring(1)); |
| | | sh2023Api1311.setTdbh(sysData.getChanNum()); |
| | | sh2023Api1311.setTdmc(sysData.getChanNum() + "号通道"); |
| | | sh2023Api1311.setJksbmc(sysData.getName()); |
| | | sh2023Api1311.setKqdm(kqdm); |
| | | if (sysData.getBrand().equals("01")) { |
| | | sh2023Api1311.setJkcs("2"); |
| | | } else if (sysData.getBrand().equals("02")) { |
| | | sh2023Api1311.setJkcs("1"); |
| | | } else { |
| | | sh2023Api1311.setJkcs("9"); |
| | | } |
| | | sh2023Api1311.setJkxlh(sysData.getSn()); |
| | | if (sysData.getAzwzlx().equals("08")) { |
| | | sh2023Api1311.setSpjklx("1"); |
| | | } else if (secType.indexOf(sysData.getAzwzlx()) >= 0) { |
| | | sh2023Api1311.setSpjklx("2"); |
| | | } else { |
| | | sh2023Api1311.setSpjklx("3"); |
| | | } |
| | | |
| | | //监控厂商 |
| | | sh2023Api1311.setJkcs(getBrandId(sysData.getBrand())); |
| | | |
| | | sh2023Api1311.setJkxh(sysData.getSn()); |
| | | |
| | | sh2023Api1311.setSpjklx(StringUtils.isEmpty(sysData.getSpjklx()) ? "3" : sysData.getSpjklx()); |
| | | sh2023Api1311.setSblxbm("1"); |
| | | sh2023Api1311.setAzwzlx(sysData.getAzwzlx()); |
| | | sh2023Api1311.setZsqy("Y"); |
| | | sh2023Api1311.setJkjlxbm(sysData.getType().substring(1)); |
| | | |
| | | sh2023Api1311.setAzwz(sysData.getName()); |
| | | sh2023Api1311.setAzwzlx(StringUtils.isEmpty(sysData.getSpdwlx()) ? "7" : sysData.getSpdwlx()); |
| | | if(sh2023Api1311.getAzwzlx().length() == 1){ |
| | | sh2023Api1311.setAzwzlx("0" + sh2023Api1311.getAzwzlx()); |
| | | } |
| | | if ("12".equals(sh2023Api1311.getAzwzlx()) || "13".equals(sh2023Api1311.getAzwzlx()) |
| | | || "14".equals(sh2023Api1311.getAzwzlx()) || "15".equals(sh2023Api1311.getAzwzlx())) { |
| | | sh2023Api1311.setAzwzlx("99"); |
| | | } |
| | | if ("16".equals(sh2023Api1311.getAzwzlx())) { |
| | | sh2023Api1311.setAzwzlx("12"); |
| | | } |
| | | sh2023Api1311.setSfazbgd("Y"); |
| | | |
| | | if(StringUtils.isEmpty(sysData.getType())){ |
| | | sysData.setType("01"); |
| | | } |
| | | if(sysData.getType().equals("02")){ |
| | | sh2023Api1311.setJkjlxbm("2"); |
| | | } |
| | | if(sysData.getType().equals("01")){ |
| | | sh2023Api1311.setJkjlxbm("1"); |
| | | } |
| | | sh2023Api1311.setJktyzw(12); |
| | | sh2023Api1311.setSbipdz(sysData.getIpIn()); |
| | | sh2023Api1311.setSbdkh(sysData.getPortInV()); |
| | | sh2023Api1311.setSbdlmc(sysData.getLoginId()); |
| | | sh2023Api1311.setSbdlmm(sysData.getPwd()); |
| | | sh2023Api1311.setBz(sysData.getRemark()); |
| | | sh2023Api1311.setZhgxsj(sysData.getUpdateTime()); |
| | | sh2023Api1311.setZhgxsj(sysData.getUpdateTime()==null?new Date():sysData.getUpdateTime()); |
| | | |
| | | //持久化保存,单独存入非国标接口表 |
| | | ApiInfoData infoData = new ApiInfoData(); |
| | | infoData.setId(ContextUtil.getUUID()); |
| | | infoData.setId(sh2023Api1311.getSpjksbid()); |
| | | infoData.setKqdm(kqdm); |
| | | infoData.setInteType(Constant.API_CATEGORY_13); |
| | | infoData.setInteId(SH2023Constant.SH_2023_API_CODE_1311); |
| | | infoData.setUpdateTime(new Date()); |
| | | infoData.setDataId(dataID); |
| | | infoData.setUpdateTime(sh2023Api1311.getZhgxsj()); |
| | | infoData.setDataId(sh2023Api1311.getSpjksbid()); |
| | | infoData.setRemarks("视频监控信息"); |
| | | //设置操作标志 |
| | | apiInfoDataList = apiInfoDataRep.getDataByInteAndData(SH2023Constant.SH_2023_API_CODE_1311, infoData.getDataId()); |
| | | apiInfoDataList = apiInfoDataRep.getDataByInteAndData(SH2023Constant.SH_2023_API_CODE_1311, infoData.getDataId(), kqdm); |
| | | if (null == apiInfoDataList || apiInfoDataList.isEmpty()) { |
| | | sh2023Api1311.setCzbz(Constant.CZBZ_I); |
| | | infoData.setCzbz(Constant.CZBZ_I); |
| | | } else { |
| | | sh2023Api1311.setCzbz(apiInfoDataList.get(0).getCzbz()); |
| | | infoData.setCzbz(apiInfoDataList.get(0).getCzbz()); |
| | | sh1311 = JSONObject.parseObject(infoData.getData(), SH2023Api1311.class); |
| | | if(null != sh1311 && StringUtils.isNotEmpty(sh1311.getAjdm())){ |
| | | sh2023Api1311.setAjdm(sh1311.getAjdm()); |
| | | } |
| | | if(null != sh1311 && StringUtils.isNotEmpty(sh1311.getHwdm())){ |
| | | sh2023Api1311.setHwdm(sh1311.getHwdm()); |
| | | } |
| | | } |
| | | |
| | | |
| | | infoData.setData(JSON.toJSONString(sh2023Api1311)); |
| | | apiInfoDataRep.save(infoData); |
| | | |
| | | |
| | | log.info("1311---市储检斤单-同步数据:{}", sh2023Api1311); |
| | | num++; |
| | | log.info("1311---视频监控-同步数据:{}", sh2023Api1311); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | |
| | | apiLogRep.save(apiLog); |
| | | } |
| | | } |
| | | |
| | | private String getBrandId(String brandName) { |
| | | if (StringUtils.isEmpty(brandName)) { |
| | | return "9"; |
| | | } |
| | | if (brandName.contains("海康")) { |
| | | return "1"; |
| | | } |
| | | if (brandName.contains("大华")) { |
| | | return "2"; |
| | | } |
| | | if (brandName.contains("宇视")) { |
| | | return "3"; |
| | | } |
| | | return "9"; |
| | | } |
| | | } |