| | |
| | | import com.kuaidi100.sdk.contant.CompanyConstant; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.UserAddress; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | |
| | | import com.ruoyi.order.model.RefundPass; |
| | | import com.ruoyi.order.service.OrderService; |
| | | import com.ruoyi.order.service.RefundPassService; |
| | | import com.ruoyi.order.util.ExpressDeliveryUtil; |
| | | import com.ruoyi.order.util.vo.MapTrackKD100Vo; |
| | | import com.ruoyi.order.vo.*; |
| | | import com.ruoyi.other.api.domain.BaseSetting; |
| | | import com.ruoyi.other.api.domain.SystemConfig; |
| | | import com.ruoyi.other.api.feignClient.BaseSettingClient; |
| | | import com.ruoyi.other.api.feignClient.ShopClient; |
| | | import com.ruoyi.other.api.feignClient.SystemConfigClient; |
| | | import com.ruoyi.other.api.feignClient.TechnicianClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Resource |
| | | private SystemConfigClient systemConfigClient; |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | return refundPassInfo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 定时查询快递信息 |
| | | */ |
| | | @Override |
| | | public void taskExpress() { |
| | | Set<Long> order_express = redisTemplate.opsForZSet().rangeByScore("order_refund_express", 0, LocalDateTime.now().toEpochSecond(ZoneOffset.UTC)); |
| | | if(order_express.size() > 0){ |
| | | for (Long id : order_express) { |
| | | RefundPass refundPass = this.getById(id); |
| | | Order order = orderService.getById(refundPass.getOrderId()); |
| | | if(refundPass.getPassStatus() != 5){ |
| | | redisTemplate.opsForZSet().remove("order_refund_express", id); |
| | | continue; |
| | | } |
| | | String expressJson = refundPass.getCode(); |
| | | if(StringUtils.isEmpty(expressJson)){ |
| | | redisTemplate.opsForZSet().remove("order_refund_express", id); |
| | | continue; |
| | | } |
| | | //{"com":"jd","num":"JDV016336234367"} |
| | | JSONObject jsonObject1 = JSON.parseObject(refundPass.getCode()); |
| | | String com = jsonObject1.getString("com"); |
| | | String num = jsonObject1.getString("num"); |
| | | UserAddress userAddress = JSON.parseObject(order.getAddressJson(), UserAddress.class); |
| | | MapTrackKD100Vo mapTrackKD100Vo = ExpressDeliveryUtil.kd100MapTrack(com, num, userAddress.getProvince() + userAddress.getCity(), order.getDeliverProvince() + order.getDeliverCity()); |
| | | refundPass.setExpressResult(JSON.toJSONString(mapTrackKD100Vo)); |
| | | this.updateById(refundPass); |
| | | //延长时间x小时 |
| | | SystemConfig systemConfig = systemConfigClient.getSystemConfig(3).getData(); |
| | | JSONObject jsonObject2 = JSON.parseObject(systemConfig.getContent()); |
| | | Integer waitTime = jsonObject2.getInteger("waitTime"); |
| | | redisTemplate.opsForZSet().add("order_refund_express", refundPass.getId(), LocalDateTime.now().plusHours(waitTime).toEpochSecond(ZoneOffset.UTC)); |
| | | } |
| | | } |
| | | } |
| | | } |