| | |
| | | package com.fzzy.push.whhpjl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.fzzy.api.Constant; |
| | | import com.fzzy.api.data.ApiParam; |
| | | import com.fzzy.api.data.PushProtocol; |
| | | import com.fzzy.api.dto.ResponseDto; |
| | | import com.fzzy.api.entity.ApiInfoData; |
| | | import com.fzzy.api.service.ApiRemoteService; |
| | | import com.fzzy.api.service.PushService11; |
| | | import com.fzzy.api.view.repository.ApiInfoDataRep; |
| | | import com.fzzy.otherview.whhpjl.WhjlConstant; |
| | | import com.fzzy.otherview.whhpjl.dto.WhjlApi1204; |
| | | import com.fzzy.otherview.whhpjl.dto.WhjlApi1206; |
| | | import com.fzzy.otherview.whhpjl.dto.WhjlApi1212; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 武汉军粮省平台-粮食购销数据推送 |
| | |
| | | |
| | | @Autowired |
| | | private WhjlApiRemoteService apiRemoteService; |
| | | @Autowired |
| | | private ApiInfoDataRep apiInfoDataRep; |
| | | |
| | | @Override |
| | | public String getProtocol() { |
| | |
| | | public void pushData(ApiParam param) { |
| | | log.info("武汉军粮省平台--->>>粮食购销 上报开始"); |
| | | |
| | | //TODO 推送客户信息 |
| | | |
| | | //TODO 推送合同信息 |
| | | |
| | | // 推送客户信息 |
| | | this.pushData1204(apiRemoteService, param); |
| | | // 推送合同信息 |
| | | this.pushData1207(apiRemoteService, param); |
| | | //TODO 推送库存台账信息 |
| | | |
| | | //TODO 推送库存台账产品批次信息 |
| | | |
| | | //TODO 推送库存台账出入信息 |
| | | |
| | | //TODO 推送出入库记录 |
| | | |
| | | // 推送出入库记录 |
| | | this.pushData1214(apiRemoteService, param); |
| | | |
| | | log.info("武汉军粮省平台--->>>粮食购销 上报结束"); |
| | | } |
| | | |
| | | /** |
| | | * 1204 客户信息 |
| | | */ |
| | | private void pushData1204(ApiRemoteService apiRemoteService, ApiParam param) { |
| | | |
| | | //获取军工企业信息 |
| | | List<ApiInfoData> items = apiInfoDataRep.getDataByInteId(WhjlConstant.API_CODE_1204); |
| | | |
| | | if (null == items || items.isEmpty()) { |
| | | return; |
| | | } |
| | | param.setInteCategory(WhjlConstant.API_CATEGORY_12); |
| | | param.setInteId(WhjlConstant.API_CODE_1204); |
| | | List<WhjlApi1204> list = new ArrayList<>(); |
| | | WhjlApi1204 whjlApi1204; |
| | | for (ApiInfoData infoData : items) { |
| | | whjlApi1204 = JSONObject.parseObject(infoData.getData(), WhjlApi1204.class); |
| | | whjlApi1204.setKqdm(infoData.getKqdm()); |
| | | whjlApi1204.setCzbz(infoData.getCzbz()); |
| | | whjlApi1204.setUpdateTime(infoData.getUpdateTime()); |
| | | whjlApi1204.setBizId(infoData.getDataId()); |
| | | list.add(whjlApi1204); |
| | | } |
| | | |
| | | //推送,数据为集合形式 |
| | | ResponseDto responseDto = apiRemoteService.pushData(param, list); |
| | | if (responseDto.getSuccess() == 0) { |
| | | //推送成功,更新数据上传状态 |
| | | for (ApiInfoData data : items) { |
| | | if (Constant.CZBZ_I.equals(data.getCzbz())) { |
| | | |
| | | data.setCzbz(Constant.CZBZ_U); |
| | | apiInfoDataRep.save(data); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 1207 合同信息 |
| | | */ |
| | | private void pushData1207(ApiRemoteService apiRemoteService, ApiParam param) { |
| | | |
| | | //获取军工企业信息 |
| | | List<ApiInfoData> items = apiInfoDataRep.getDataByInteId(WhjlConstant.API_CODE_1207); |
| | | |
| | | if (null == items || items.isEmpty()) { |
| | | return; |
| | | } |
| | | param.setInteCategory(WhjlConstant.API_CATEGORY_12); |
| | | param.setInteId(WhjlConstant.API_CODE_1207); |
| | | List<WhjlApi1206> list = new ArrayList<>(); |
| | | WhjlApi1206 whjlApi1206; |
| | | for (ApiInfoData infoData : items) { |
| | | whjlApi1206 = JSONObject.parseObject(infoData.getData(), WhjlApi1206.class); |
| | | whjlApi1206.setKqdm(infoData.getKqdm()); |
| | | whjlApi1206.setCzbz(infoData.getCzbz()); |
| | | whjlApi1206.setUpdateTime(infoData.getUpdateTime()); |
| | | whjlApi1206.setBizId(infoData.getDataId()); |
| | | list.add(whjlApi1206); |
| | | } |
| | | |
| | | //推送,数据为集合形式 |
| | | ResponseDto responseDto = apiRemoteService.pushData(param, list); |
| | | if (responseDto.getSuccess() == 0) { |
| | | //推送成功,更新数据上传状态 |
| | | for (ApiInfoData data : items) { |
| | | if (Constant.CZBZ_I.equals(data.getCzbz())) { |
| | | |
| | | data.setCzbz(Constant.CZBZ_U); |
| | | apiInfoDataRep.save(data); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 1214 合同信息 |
| | | */ |
| | | private void pushData1214(ApiRemoteService apiRemoteService, ApiParam param) { |
| | | |
| | | //获取军工企业信息 |
| | | List<ApiInfoData> items = apiInfoDataRep.getDataByInteId(WhjlConstant.API_CODE_1214); |
| | | |
| | | if (null == items || items.isEmpty()) { |
| | | return; |
| | | } |
| | | param.setInteCategory(WhjlConstant.API_CATEGORY_12); |
| | | param.setInteId(WhjlConstant.API_CODE_1214); |
| | | List<WhjlApi1212> list = new ArrayList<>(); |
| | | WhjlApi1212 whjlApi1212; |
| | | for (ApiInfoData infoData : items) { |
| | | whjlApi1212 = JSONObject.parseObject(infoData.getData(), WhjlApi1212.class); |
| | | whjlApi1212.setKqdm(infoData.getKqdm()); |
| | | whjlApi1212.setCzbz(infoData.getCzbz()); |
| | | whjlApi1212.setUpdateTime(infoData.getUpdateTime()); |
| | | whjlApi1212.setBizId(infoData.getDataId()); |
| | | list.add(whjlApi1212); |
| | | } |
| | | |
| | | //推送,数据为集合形式 |
| | | ResponseDto responseDto = apiRemoteService.pushData(param, list); |
| | | if (responseDto.getSuccess() == 0) { |
| | | //推送成功,更新数据上传状态 |
| | | for (ApiInfoData data : items) { |
| | | if (Constant.CZBZ_I.equals(data.getCzbz())) { |
| | | |
| | | data.setCzbz(Constant.CZBZ_U); |
| | | apiInfoDataRep.save(data); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |