Commit f10b3385 authored by 周健威's avatar 周健威

修改代码

parent 51a75a1f
...@@ -185,7 +185,7 @@ public class GtDataRestClient { ...@@ -185,7 +185,7 @@ public class GtDataRestClient {
String resourceUrl = ""; String resourceUrl = "";
try { try {
resourceUrl = MessageFormat.format( resourceUrl = MessageFormat.format(
"{0}?op=LOGIN&user={1}&pass={2}&token={3}&time={4}", "{0}?op=LOGIN&user={1}&pass={2}&token={3}&time={4}&",
baseUrl, username, baseUrl, username,
Encodes.encodeHex(Digests.md5((Encodes.encodeHex(Digests Encodes.encodeHex(Digests.md5((Encodes.encodeHex(Digests
.md5(password.getBytes())) + token).getBytes())), .md5(password.getBytes())) + token).getBytes())),
......
...@@ -9,8 +9,6 @@ import java.math.BigDecimal; ...@@ -9,8 +9,6 @@ import java.math.BigDecimal;
@Data @Data
public class ImageDataVO extends RscpAreaImageTotal { public class ImageDataVO extends RscpAreaImageTotal {
BigDecimal price = BigDecimal.ZERO; BigDecimal price = BigDecimal.ZERO;
String imageFilePath;
public void setPrice(BigDecimal price) {
this.price = price;
}
} }
package com.upyuns.platform.rs.website.job; package com.upyuns.platform.rs.website.job;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.upyuns.platform.rs.datacenter.fegin.DatacenterFeign;
import com.upyuns.platform.rs.datacenter.pojo.ImageDataVO;
import com.upyuns.platform.rs.website.biz.ImageInfoRelationBiz;
import com.upyuns.platform.rs.website.biz.IndustryApplicationInfoBiz;
import com.upyuns.platform.rs.website.biz.OrderInfoBiz; import com.upyuns.platform.rs.website.biz.OrderInfoBiz;
import com.upyuns.platform.rs.website.biz.OrderItemBiz;
import com.upyuns.platform.rs.website.dto.order.OldeliveryJson;
import com.upyuns.platform.rs.website.entity.ImageInfoRelation;
import com.upyuns.platform.rs.website.entity.IndustryApplicationInfo;
import com.upyuns.platform.rs.website.entity.OrderInfo; import com.upyuns.platform.rs.website.entity.OrderInfo;
import com.upyuns.platform.rs.website.entity.OrderItem;
import com.upyuns.platform.rs.website.type.ItemTypeEnum;
import com.upyuns.platform.rs.website.type.OrderStatusEnum;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
...@@ -9,6 +23,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; ...@@ -9,6 +23,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import static com.upyuns.platform.rs.website.entity.OrderInfo.SENDTYPE_OL; import static com.upyuns.platform.rs.website.entity.OrderInfo.SENDTYPE_OL;
import static com.upyuns.platform.rs.website.type.OrderStatusEnum.ORDER_PAID; import static com.upyuns.platform.rs.website.type.OrderStatusEnum.ORDER_PAID;
...@@ -21,6 +36,23 @@ public class WebsiteScheduleTask { ...@@ -21,6 +36,23 @@ public class WebsiteScheduleTask {
@Autowired @Autowired
OrderInfoBiz orderInfoBiz; OrderInfoBiz orderInfoBiz;
@Autowired
OrderItemBiz orderItemBiz;
@Autowired
ImageInfoRelationBiz imageInfoRelationBiz;
@Autowired
IndustryApplicationInfoBiz industryApplicationInfoBiz;
@Autowired
DatacenterFeign datacenterFeign;
public static final int ITEM_STANDARD_DATA = ItemTypeEnum.STANDARD_DATA.getType();
public static final int ITEM_INDUSTRY_INFO = ItemTypeEnum.INDUSTRY_INFO.getType();
public static final int ITEM_IMAGE_STORAGE = ItemTypeEnum.IMAGE_STORAGE.getType();
//3.添加定时任务 //3.添加定时任务
@Scheduled(cron = "0/5 * * * * ?") @Scheduled(cron = "0/5 * * * * ?")
//或直接指定时间间隔,例如:5秒 //或直接指定时间间隔,例如:5秒
...@@ -34,8 +66,39 @@ public class WebsiteScheduleTask { ...@@ -34,8 +66,39 @@ public class WebsiteScheduleTask {
return w; return w;
}); });
// list.forEach(orderInfo -> { list.forEach(orderInfo -> {
// if(orderInfo.getType().) List<OldeliveryJson> jsons = CollUtil.newArrayList();
// }); List<OrderItem> items = orderItemBiz.selectList(new OrderItem(){{
setOrderId(orderInfo.getOrderId());
}});
items.forEach(it -> {
if(ITEM_STANDARD_DATA == it.getType()) {
List<ImageDataVO> imageDataVOS = datacenterFeign.queryByIds(it.getDetailId()+ "").getData();
imageDataVOS.forEach(vo -> {
jsons.add(new OldeliveryJson(){{
setName(vo.getName());
setPath(vo.getImageFilePath());
}});
});
}else if(ITEM_INDUSTRY_INFO == it.getType()) {
IndustryApplicationInfo iai = industryApplicationInfoBiz.selectById(it.getDetailId().intValue());
jsons.add(new OldeliveryJson(){{
setName(it.getName());
setPath(iai.getSourceFile());
}});
}else if(ITEM_IMAGE_STORAGE == it.getType()) {
ImageInfoRelation iir = imageInfoRelationBiz.selectById(it.getDetailId().intValue());
jsons.add(new OldeliveryJson(){{
setName(it.getName());
setPath(iir.getFileWidth());
}});
}
});
orderInfoBiz.updateSelectiveById(new OrderInfo(){{
setOrderId(orderInfo.getOrderId());
setStatus(OrderStatusEnum.ORDER_RECEIVED.getType());
setOldeliveryJson(JSONUtil.toJsonStr(jsons));
}});
});
} }
} }
\ No newline at end of file
...@@ -68,7 +68,7 @@ public class ConfirmOrderService { ...@@ -68,7 +68,7 @@ public class ConfirmOrderService {
List<ItemInfoVo> itemInfoVoList = new ArrayList<>(); List<ItemInfoVo> itemInfoVoList = new ArrayList<>();
AtomicReference<Integer> number = new AtomicReference<>(0); AtomicReference<Integer> number = new AtomicReference<>(0);
AtomicReference<Double> amount = new AtomicReference<>((double) 0); AtomicReference<Double> amount = new AtomicReference<>((double) 0);
itemInfoDtoList.parallelStream().forEach(itemInfoDto -> { itemInfoDtoList.forEach(itemInfoDto -> {
if (itemInfoDto.getType().equals(OrderTypeEnum.STANDARD_DATA.getType())) { if (itemInfoDto.getType().equals(OrderTypeEnum.STANDARD_DATA.getType())) {
List<ImageDataVO> imageDataVOList = datacenterFeign.queryByIds(itemInfoDto.getId() + "").getData(); List<ImageDataVO> imageDataVOList = datacenterFeign.queryByIds(itemInfoDto.getId() + "").getData();
if (imageDataVOList != null && imageDataVOList.size() > 0) { if (imageDataVOList != null && imageDataVOList.size() > 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment