| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.serializer.SerializerFeature; |
| | | import com.alibaba.fastjson.support.config.FastJsonConfig; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.common.domain.dto.ReportStockDto; |
| | | import com.zy.asrs.common.domain.enums.ApiType; |
| | | import com.zy.asrs.common.domain.enums.OrderSettleType; |
| | | import com.zy.asrs.common.openapi.entity.ApiList; |
| | |
| | | import com.zy.asrs.common.utils.HttpHandler; |
| | | import com.zy.asrs.common.wms.entity.Order; |
| | | import com.zy.asrs.common.wms.entity.OrderDetl; |
| | | import com.zy.asrs.common.wms.service.LocDetlService; |
| | | import com.zy.asrs.common.wms.service.OrderDetlService; |
| | | import com.zy.asrs.common.wms.service.OrderService; |
| | | import org.apache.commons.codec.digest.DigestUtils; |
| | |
| | | private OrderDetlService orderDetlService; |
| | | @Autowired |
| | | private HostKeyService hostKeyService; |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | public void orderComplete() { |
| | |
| | | .eq(ApiList::getType, ApiType.REPORT_STOCK.type) |
| | | .eq(ApiList::getStatus, 1)); |
| | | for (ApiList apiList : list) { |
| | | List<ReportStockDto> reportStockDto = locDetlService.getReportStockDto(apiList.getHostId()); |
| | | //封装数据 |
| | | HashMap<String, Object> data = new HashMap<>(); |
| | | data.put("stock", reportStockDto); |
| | | getSign(data, apiList.getHostId());//获取签名 |
| | | |
| | | //保留null值 |
| | | FastJsonConfig fastJsonConfig = new FastJsonConfig(); |
| | | fastJsonConfig.setSerializerFeatures(SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullListAsEmpty, SerializerFeature.WriteNullStringAsEmpty); |
| | | String paramData = JSON.toJSONString(data, fastJsonConfig.getSerializeConfig(), fastJsonConfig.getSerializerFeatures()); |
| | | try { |
| | | String response = new HttpHandler.Builder() |
| | | .setUri(apiList.getUrl()) |
| | | .setJson(JSON.toJSONString(paramData)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject result = JSON.parseObject(response); |
| | | if (result.getOrDefault("code", 0).equals(200)) { |
| | | |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |