| | |
| | | import com.fzzy.api.Constant; |
| | | import com.fzzy.api.data.ApiParam; |
| | | import com.fzzy.api.dto.ResponseDto; |
| | | import com.fzzy.api.entity.Api1204; |
| | | import com.fzzy.api.entity.ApiConfs; |
| | | import com.fzzy.api.entity.ApiInfoData; |
| | | import com.fzzy.api.service.ApiCommonService; |
| | |
| | | import com.fzzy.api.service.ApiRemoteService; |
| | | import com.fzzy.api.utils.ContextUtil; |
| | | import com.fzzy.api.view.repository.ApiInfoDataRep; |
| | | import com.fzzy.otherview.whhpjl.WhjlConstant; |
| | | import com.fzzy.otherview.whhpjl.dto.WhjlApi1101; |
| | | import com.fzzy.push.sh2023.SH2023Constant; |
| | | import com.fzzy.push.sh2023.dto.SH2023Api2101; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.apache.commons.lang.time.DateFormatUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.PageRequest; |
| | | import org.springframework.data.domain.Pageable; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 上海市接口-2101 检斤单 |
| | |
| | | if (null == data.getPch() || data.getPch() == "") { |
| | | data.setPch(data.getHwdm() + DateFormatUtils.format(data.getJjrq(), "yyyy")); |
| | | } |
| | | ApiInfoData infoData = new ApiInfoData(); |
| | | infoData.setId(data.getJjdh()); |
| | | infoData.setKqdm(data.getKqdm()); |
| | | infoData.setInteId(SH2023Constant.SH_2023_API_CODE_2101); |
| | | infoData.setUpdateTime(new Date()); |
| | | infoData.setDataId(data.getJjdh()); |
| | | infoData.setData(JSON.toJSONString(data)); |
| | | infoData.setCzbz(data.getCzbz()); |
| | | infoData.setRemarks("备注信息"); |
| | | ApiInfoData infoData; |
| | | List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(SH2023Constant.SH_2023_API_CODE_2101, data.getJjdh(),data.getKqdm()); |
| | | if (apiInfoList.size() != 0) { |
| | | infoData = apiInfoList.get(0); |
| | | infoData.setData(JSON.toJSONString(data)); |
| | | } else { |
| | | infoData = new ApiInfoData(); |
| | | infoData.setId(ContextUtil.getUUID()); |
| | | infoData.setKqdm(data.getKqdm()); |
| | | infoData.setInteId(SH2023Constant.SH_2023_API_CODE_2101); |
| | | infoData.setUpdateTime(new Date()); |
| | | infoData.setDataId(data.getJjdh()); |
| | | infoData.setData(JSON.toJSONString(data)); |
| | | infoData.setCzbz(data.getCzbz()); |
| | | infoData.setRemarks("备注信息"); |
| | | } |
| | | |
| | | apiInfoDataRep.save(infoData); |
| | | } |
| | |
| | | */ |
| | | @Expose |
| | | public void delData(SH2023Api2101 data) { |
| | | apiInfoDataRep.deleteById(data.getJjdh()); |
| | | List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(SH2023Constant.SH_2023_API_CODE_2101, data.getJjdh(),data.getKqdm()); |
| | | apiInfoDataRep.deleteById(apiInfoList.get(0).getId()); |
| | | } |
| | | |
| | | /** |
| | | * sHApi2101PR#delUpdate |
| | | */ |
| | | @Expose |
| | | public String delUpdate(SH2023Api2101 entity) { |
| | | if (null == entity) { |
| | | public String delUpdate(SH2023Api2101 data) { |
| | | if (null == data) { |
| | | return "无数据执行"; |
| | | } |
| | | entity.setCzbz(Constant.CZBZ_D); |
| | | apiInfoDataRep.updateStatus(entity.getJjdh(), JSON.toJSONString(entity), Constant.CZBZ_D); |
| | | List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(SH2023Constant.SH_2023_API_CODE_2101, data.getJjdh(),data.getKqdm()); |
| | | data.setCzbz(Constant.CZBZ_D); |
| | | apiInfoDataRep.updateStatus(apiInfoList.get(0).getId(), JSON.toJSONString(data), Constant.CZBZ_D); |
| | | return null; |
| | | } |
| | | |
| | |
| | | String kqdm = items.get(0).getKqdm(); |
| | | ApiConfs apiConf = apiCommonService.getConf(kqdm); |
| | | |
| | | if (null == apiConf) return "系统没有获取到当前库区配置信息,执行失败"; |
| | | if (null == apiConf) { |
| | | return "系统没有获取到当前库区配置信息,执行失败"; |
| | | } |
| | | |
| | | //封装参数 |
| | | ApiParam param = new ApiParam(apiConf, "21", SH2023Constant.SH_2023_API_CODE_2101); |
| | | ApiParam param = new ApiParam(apiConf, "90", Constant.API_CODE_9105); |
| | | |
| | | //获取实现接口 |
| | | ApiRemoteService apiService = apiPushManager.getApiRemoteService(param.getPushProtocol()); |
| | |
| | | responseDto = apiService.pushData(param, apiConf, items); |
| | | if (responseDto.getSuccess() == 0) { |
| | | //推送成功,更新数据上传状态 |
| | | |
| | | ApiInfoData infoData; |
| | | for (SH2023Api2101 data : items) { |
| | | if (Constant.CZBZ_I.equals(data.getCzbz())) { |
| | | |
| | | infoData = new ApiInfoData(); |
| | | infoData.setId(data.getBizId()); |
| | | infoData.setKqdm(data.getKqdm()); |
| | | infoData.setInteType("21"); |
| | | infoData.setInteId(SH2023Constant.SH_2023_API_CODE_2101); |
| | | infoData.setUpdateTime(new Date()); |
| | | infoData.setDataId(data.getBizId()); |
| | | |
| | | //推送成功,更新数据上传状态 |
| | | List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(SH2023Constant.SH_2023_API_CODE_2101, data.getJjdh(),data.getKqdm()); |
| | | data.setCzbz(Constant.CZBZ_U); |
| | | infoData = apiInfoList.get(0); |
| | | infoData.setUpdateTime(new Date()); |
| | | infoData.setCzbz(Constant.CZBZ_U); |
| | | infoData.setData(JSON.toJSONString(data)); |
| | | |
| | | apiInfoDataRep.save(infoData); |
| | | } |
| | | } |