|  |  |  | 
|---|
|  |  |  | package com.fzzy.async.whhpjl.impl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSON; | 
|---|
|  |  |  | import com.fzzy.api.Constant; | 
|---|
|  |  |  | import com.fzzy.api.entity.ApiInfoData; | 
|---|
|  |  |  | import com.fzzy.api.entity.ApiLog; | 
|---|
|  |  |  | import com.fzzy.api.utils.ContextUtil; | 
|---|
|  |  |  | import com.fzzy.api.view.repository.ApiInfoDataRep; | 
|---|
|  |  |  | import com.fzzy.api.view.repository.ApiLogRep; | 
|---|
|  |  |  | import com.fzzy.async.whhpjl.entity.Fz40WhjlDefaultDept; | 
|---|
|  |  |  | import com.fzzy.async.whhpjl.repository.Fz40ToWhjlSync1101Rep; | 
|---|
|  |  |  | import com.fzzy.whjl.dto.WhjlApi1101; | 
|---|
|  |  |  | import com.fzzy.otherview.whhpjl.WhjlConstant; | 
|---|
|  |  |  | import com.fzzy.otherview.whhpjl.dto.WhjlApi1101; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.apache.commons.lang.StringUtils; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Component; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @author: czt | 
|---|
|  |  |  | * @update-time: 2023/08/04 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Slf4j | 
|---|
|  |  |  | @Component | 
|---|
|  |  |  | 
|---|
|  |  |  | private Fz40ToWhjlSync1101Rep fz40ToWhjlSync1101Rep; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ApiLogRep apiLogRep; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ApiInfoDataRep apiInfoDataRep; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 军工单位信息 | 
|---|
|  |  |  | 
|---|
|  |  |  | apiLog.setType(ApiLog.TYPE_SYNC); | 
|---|
|  |  |  | apiLog.setKqdm(deptId); | 
|---|
|  |  |  | apiLog.setUploadTime(new Date()); | 
|---|
|  |  |  | apiLog.setInteId(Constant.API_CODE_1111); | 
|---|
|  |  |  | apiLog.setInteId(Constant.API_CODE_1101); | 
|---|
|  |  |  | apiLog.setStatus(99); | 
|---|
|  |  |  | apiLog.setId(ContextUtil.getUUID()); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | 
|---|
|  |  |  | log.info("-------------没有获取到单位信息------------------"); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<ApiInfoData> apiInfoDataList; | 
|---|
|  |  |  | WhjlApi1101 apiData; | 
|---|
|  |  |  | //封装军工单位信息 | 
|---|
|  |  |  | for (Fz40WhjlDefaultDept sysData : list) { | 
|---|
|  |  |  | 
|---|
|  |  |  | apiData.setQywd(sysData.getLat());  //企业纬度 | 
|---|
|  |  |  | apiData.setQyxzqhmc(sysData.getCountry());  //企业行政区划名称 | 
|---|
|  |  |  | apiData.setQyxzqhdm(sysData.getCountry());  //企业行政区划代码 | 
|---|
|  |  |  | apiData.setSfyx("是");  //企业行政区划代码 | 
|---|
|  |  |  | if(StringUtils.isNotEmpty(sysData.getVal()) && "0".equals(sysData.getVal())){ | 
|---|
|  |  |  | apiData.setSfyx("是");  //是否启用 | 
|---|
|  |  |  | if (StringUtils.isNotEmpty(sysData.getVal()) && "0".equals(sysData.getVal())) { | 
|---|
|  |  |  | apiData.setSfyx("否"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | apiData.setBizId(sysData.getId()); | 
|---|
|  |  |  | apiData.setUpdateTime(new Date()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //TODO 持久化保存待实现 | 
|---|
|  |  |  | //持久化保存,单独存入非国标接口表 | 
|---|
|  |  |  | ApiInfoData infoData = new ApiInfoData(); | 
|---|
|  |  |  | infoData.setId(sysData.getId()); | 
|---|
|  |  |  | infoData.setKqdm(kqdm); | 
|---|
|  |  |  | infoData.setInteType(WhjlConstant.API_CATEGORY_11); | 
|---|
|  |  |  | infoData.setInteId(WhjlConstant.API_CODE_1101); | 
|---|
|  |  |  | infoData.setUpdateTime(new Date()); | 
|---|
|  |  |  | infoData.setDataId(sysData.getId()); | 
|---|
|  |  |  | infoData.setRemarks("备注信息"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //设置操作标志 | 
|---|
|  |  |  | apiInfoDataList = apiInfoDataRep.getDataByDataId(infoData.getDataId()); | 
|---|
|  |  |  | if(null == apiInfoDataList || apiInfoDataList.isEmpty()){ | 
|---|
|  |  |  | apiData.setCzbz(Constant.CZBZ_I); | 
|---|
|  |  |  | infoData.setCzbz(Constant.CZBZ_I); | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | apiData.setCzbz(apiInfoDataList.get(0).getCzbz()); | 
|---|
|  |  |  | infoData.setCzbz(apiInfoDataList.get(0).getCzbz()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | infoData.setData(JSON.toJSONString(apiData)); | 
|---|
|  |  |  | apiInfoDataRep.save(infoData); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | log.info("1101---军工单位-同步数据:{}", apiData.toString()); | 
|---|
|  |  |  | } | 
|---|