| | |
| | | import com.bstek.dorado.annotation.DataProvider; |
| | | import com.bstek.dorado.annotation.DataResolver; |
| | | import com.bstek.dorado.annotation.Expose; |
| | | import com.fzzy.api.Constant; |
| | | import com.fzzy.api.data.ApiParam; |
| | | import com.fzzy.api.dto.ResponseDto; |
| | | import com.fzzy.api.entity.ApiConfs; |
| | | import com.fzzy.api.service.ApiCommonService; |
| | | import com.fzzy.api.service.ApiPushManager; |
| | | import com.fzzy.api.service.ApiRemoteService; |
| | | import com.fzzy.whjl.dto.WhjlApi1101; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Component |
| | | public class WhjlApi1101PR { |
| | | |
| | | @Autowired |
| | | private ApiCommonService apiCommonService; |
| | | @Autowired |
| | | private ApiPushManager apiPushManager; |
| | | |
| | | /** |
| | | * 获取列表信息 |
| | |
| | | */ |
| | | @Expose |
| | | public String pushData(List<WhjlApi1101> items) { |
| | | return null; |
| | | ResponseDto responseDto; |
| | | String result = ""; |
| | | |
| | | String kqdm = items.get(0).getKqdm(); |
| | | ApiConfs apiConf = apiCommonService.getConf(kqdm); |
| | | |
| | | if (null == apiConf) return "系统没有获取到当前库区配置信息,执行失败"; |
| | | |
| | | //封装参数 |
| | | ApiParam param = new ApiParam(apiConf, Constant.API_CATEGORY_11, Constant.API_CODE_1403); |
| | | |
| | | //获取实现接口 |
| | | ApiRemoteService apiService = apiPushManager.getApiRemoteService(param.getPushProtocol()); |
| | | if (null == apiService) return "系统没有当前推送协议配置,执行失败"; |
| | | |
| | | //推送,数据为集合形式 |
| | | responseDto = apiService.pushData(param, apiConf, items); |
| | | if (responseDto.getSuccess() == 0) { |
| | | //推送成功,更新数据上传状态 |
| | | WhjlApi1101 d; |
| | | for (WhjlApi1101 data : items) { |
| | | d = new WhjlApi1101(); |
| | | BeanUtils.copyProperties(data, d); |
| | | if("i".equals(d.getCzbz())){ |
| | | d.setCzbz("u"); |
| | | //TODO 更新状态,待实现 |
| | | |
| | | } |
| | | } |
| | | result += responseDto.toString(); |
| | | } |
| | | return result; |
| | | } |
| | | } |