| | |
| | | import com.matrix.system.shopXcx.dao.ShopActivitiesDao; |
| | | import com.matrix.system.shopXcx.dao.ShopDeliveryInfoDao; |
| | | import com.matrix.system.shopXcx.dao.ShopLogisticsInfoDao; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | |
| | | shopDeliveryInfo.setDeliveryTime(new Date()); |
| | | shopDeliveryInfoDao.insert(shopDeliveryInfo); |
| | | //更新核销记录 |
| | | activitySignWriteoff.setState(ActivitySignWriteoff.STATE_THREE); |
| | | activitySignWriteoff.setWriteoffTime(new Date()); |
| | | activitySignWriteoff.setWriteoffUser(sysUsers.getSuName()); |
| | | activitySignWriteoff.setWriteoffUserid(sysUsers.getSuId()); |
| | | activitySignWriteoff.setLogisticsId(shopDeliveryInfo.getId()); |
| | | activitySignWriteoffDao.updateById(activitySignWriteoff); |
| | | //更新领取记录 |
| | | ActivitySignReceiveRecord activitySignReceiveRecord = activitySignReceiveRecordDao.selectById(receiveId); |
| | | activitySignReceiveRecord.setState(ActivitySignReceiveRecord.STATE_DONE); |
| | | activitySignReceiveRecord.setConsignee(logisticsSubmitDto.getShr()); |
| | | activitySignReceiveRecord.setConsigneeAddress(logisticsSubmitDto.getShdz()); |
| | | activitySignReceiveRecord.setConsigneePhone(logisticsSubmitDto.getLxdh()); |
| | | activitySignReceiveRecordDao.updateById(activitySignReceiveRecord); |
| | | // Integer id = shopDeliveryInfo.getId(); |
| | | // if(ObjectUtil.isNotEmpty(id)) { |
| | | // List<ShopLogisticsInfo> shopLogisticsList = new ArrayList<ShopLogisticsInfo>(); |
| | | // AjaxResult result = new AjaxResult(); |
| | | // Map<String, String> logisticsInfo = new HashMap<String, String>(); |
| | | // try { |
| | | // if (shopDeliveryInfo == null) { |
| | | // return new AjaxResult(AjaxResult.STATUS_FAIL, "找不到发货信息"); |
| | | // } |
| | | // if (!StringUtils.isNotBlank(shopDeliveryInfo.getWaybillNo()) || !StringUtils.isNotBlank(shopDeliveryInfo.getLogisticsCompanyCode())) { |
| | | // return new AjaxResult(AjaxResult.STATUS_FAIL, "物流公司信息为空"); |
| | | // } |
| | | // logisticsInfo.put("logisticsCompany", shopDeliveryInfo.getLogisticsCompany()); |
| | | // logisticsInfo.put("waybillNo", shopDeliveryInfo.getWaybillNo()); |
| | | // |
| | | // //如果已经签收直接查数据库 |
| | | // if (AppConstance.LOGISTICS_STATUS_OF_SIGN_FOR.equals(shopDeliveryInfo.getLogisticsStatus())) { |
| | | // |
| | | // List<ShopLogisticsInfo> shopLogisticsInfos = shopLogisticsInfoDao.selectByDelieryId(shopDeliveryInfo.getId()); |
| | | // logisticsInfo.put("logisticsStatus", String.valueOf(AppConstance.LOGISTICS_STATUS_OF_SIGN_FOR)); |
| | | // result.setStatus(AjaxResult.STATUS_SUCCESS); |
| | | // result.setRows(shopLogisticsInfos); |
| | | // result.putInMap("logisticsInfo", logisticsInfo); |
| | | // return result; |
| | | // } |
| | | // Map<String, String> param = new HashMap<String, String>(); |
| | | // param.put("ShipperCode", shopDeliveryInfo.getLogisticsCompanyCode()); |
| | | // param.put("LogisticCode", shopDeliveryInfo.getWaybillNo()); |
| | | // Map<String, String> paramsUrl = getparams(param); |
| | | // LogUtil.info("物流查询参数" + paramsUrl); |
| | | // String logisticsResult = HttpCurlUtil.sendPost(logisticsUrl, paramsUrl); |
| | | // LogUtil.info("查询物流返回信息" + logisticsResult); |
| | | // LogisticsInfoVo logisticsInfoVo = JSON.parseObject(logisticsResult, LogisticsInfoVo.class); |
| | | // if (logisticsInfoVo.isSuccess()) { |
| | | // ShopDeliveryInfo shopDelivery = new ShopDeliveryInfo(); |
| | | // shopDelivery.setLogisticsStatus(Integer.valueOf(logisticsInfoVo.getState())); |
| | | // shopDelivery.setId(shopDeliveryInfo.getId()); |
| | | // logisticsInfo.put("logisticsStatus", logisticsInfoVo.getState()); |
| | | // //更新物流状态 |
| | | // shopDeliveryInfoDao.updateByModel(shopDelivery); |
| | | // if (CollectionUtils.isNotEmpty(logisticsInfoVo.getTraces())) { |
| | | // List<Map<String, String>> mapTraces = logisticsInfoVo.getTraces(); |
| | | // for (int i = 0; i < mapTraces.size(); i++) { |
| | | // ShopLogisticsInfo shopLogisticsInfo = new ShopLogisticsInfo(); |
| | | // shopLogisticsInfo.setCreateBy(AppConstance.SYSTEM_USER); |
| | | // shopLogisticsInfo.setUpdateBy(AppConstance.SYSTEM_USER); |
| | | // shopLogisticsInfo.setLogisticsTime(mapTraces.get(i).get("AcceptTime")); |
| | | // String acceptStation = mapTraces.get(i).get("AcceptStation"); |
| | | // shopLogisticsInfo.setDescribe(acceptStation); |
| | | // shopLogisticsInfo.setDelieryId(shopDeliveryInfo.getId()); |
| | | // if (acceptStation.indexOf(AppConstance.KDN_IS_SIGN) != -1) { |
| | | // shopLogisticsInfo.setState(AppConstance.LOGISTICS_STATUS_OF_SIGN_FOR); |
| | | // } else if (acceptStation.indexOf(AppConstance.KDN_IS_RECEIVE) != -1) { |
| | | // shopLogisticsInfo.setState(AppConstance.LOGISTICS_STATUS_OF_RECEIVE); |
| | | // } else if (acceptStation.indexOf(AppConstance.KDN_IS_ON_WAY) != -1) { |
| | | // shopLogisticsInfo.setState(AppConstance.LOGISTICS_STATUS_OF_ON_WAY); |
| | | // } else if (acceptStation.indexOf(AppConstance.KDN_IS_MISTAKE) != -1) { |
| | | // shopLogisticsInfo.setState(AppConstance.LOGISTICS_STATUS_OF_MISTAKE); |
| | | // } else { |
| | | // shopLogisticsInfo.setState(AppConstance.LOGISTICS_STATUS_OF_NONE); |
| | | // } |
| | | // shopLogisticsList.add(shopLogisticsInfo); |
| | | // } |
| | | // shopLogisticsInfoDao.deleteByDelieryId(shopDeliveryInfo.getId()); |
| | | // if (CollectionUtils.isNotEmpty(shopLogisticsList)) { |
| | | // shopLogisticsInfoDao.batchInsert(shopLogisticsList); |
| | | // } |
| | | // } |
| | | // } else { |
| | | // throw new GlobleException(logisticsInfoVo.getReason()); |
| | | // } |
| | | // |
| | | // } catch (Exception e) { |
| | | // throw new GlobleException("物流信息查询失败"); |
| | | // } |
| | | //更新核销记录 |
| | | activitySignWriteoff.setState(ActivitySignWriteoff.STATE_THREE); |
| | | activitySignWriteoff.setWriteoffTime(new Date()); |
| | | activitySignWriteoff.setWriteoffUser(sysUsers.getSuName()); |
| | | activitySignWriteoff.setWriteoffUserid(sysUsers.getSuId()); |
| | | activitySignWriteoff.setLogisticsId(shopDeliveryInfo.getId()); |
| | | activitySignWriteoffDao.updateById(activitySignWriteoff); |
| | | //更新领取记录 |
| | | ActivitySignReceiveRecord activitySignReceiveRecord = activitySignReceiveRecordDao.selectById(receiveId); |
| | | activitySignReceiveRecord.setState(ActivitySignReceiveRecord.STATE_DONE); |
| | | activitySignReceiveRecord.setConsignee(logisticsSubmitDto.getShr()); |
| | | activitySignReceiveRecord.setConsigneeAddress(logisticsSubmitDto.getShdz()); |
| | | activitySignReceiveRecord.setConsigneePhone(logisticsSubmitDto.getLxdh()); |
| | | activitySignReceiveRecordDao.updateById(activitySignReceiveRecord); |
| | | // } |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, "发货成功"); |
| | | } |
| | | |