提交 a7dda1d2 authored 作者: luojie's avatar luojie

修复订单不能查看商品详情的问题

上级 026f543c
package com.platform.task; package com.platform.task;
import com.google.zxing.client.result.SMSMMSResultParser;
import com.platform.dao.TbCfOrderDao;
import com.platform.entity.TbCfItemDetailEntity;
import com.platform.entity.TbCfItemOrderREntity; import com.platform.entity.TbCfItemOrderREntity;
import com.platform.entity.TbCfOrderEntity; import com.platform.entity.TbCfOrderEntity;
import com.platform.enums.OrderStatusEnum; import com.platform.enums.OrderStatusEnum;
...@@ -10,12 +8,9 @@ import com.platform.service.TbCfItemOrderRService; ...@@ -10,12 +8,9 @@ import com.platform.service.TbCfItemOrderRService;
import com.platform.service.TbCfOrderService; import com.platform.service.TbCfOrderService;
import com.platform.service.TbCfPlatformOrderService; import com.platform.service.TbCfPlatformOrderService;
import com.platform.utils.SMSUtils; import com.platform.utils.SMSUtils;
import com.platform.utils.StringUtils;
import com.platform.utils.util.HttpUtils; import com.platform.utils.util.HttpUtils;
import io.swagger.models.auth.In;
import net.sf.json.JSONArray; import net.sf.json.JSONArray;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -40,8 +35,6 @@ public class ExpressStatusTask { ...@@ -40,8 +35,6 @@ public class ExpressStatusTask {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String startime = sdf.format(getStartTime()); String startime = sdf.format(getStartTime());
String endtime = sdf.format(getEndTime()); String endtime = sdf.format(getEndTime());
// String startime = "2019-09-29 00:00:00";
// String endtime ="2019-10-30 00:00:00";
String url = "http://shd.kjwlxt.com/api/checkin.php"; String url = "http://shd.kjwlxt.com/api/checkin.php";
Map<String, String> parameters = new HashMap<>(); Map<String, String> parameters = new HashMap<>();
parameters.put("user_no", "shd806"); parameters.put("user_no", "shd806");
...@@ -52,7 +45,6 @@ public class ExpressStatusTask { ...@@ -52,7 +45,6 @@ public class ExpressStatusTask {
String s = HttpUtils.sendPostJson(url, parameters); String s = HttpUtils.sendPostJson(url, parameters);
JSONObject jsonObject = JSONObject.fromObject(s).getJSONObject("content"); JSONObject jsonObject = JSONObject.fromObject(s).getJSONObject("content");
JSONArray data = jsonObject.getJSONArray("data"); JSONArray data = jsonObject.getJSONArray("data");
long startTime = System.currentTimeMillis();
String[] sids = new String[data.size()]; String[] sids = new String[data.size()];
for (int i = 0; i < sids.length; i++) { for (int i = 0; i < sids.length; i++) {
JSONObject object = JSONObject.fromObject(data.getString(i)); JSONObject object = JSONObject.fromObject(data.getString(i));
...@@ -60,12 +52,8 @@ public class ExpressStatusTask { ...@@ -60,12 +52,8 @@ public class ExpressStatusTask {
} }
if (sids.length != 0) { if (sids.length != 0) {
tbCfItemOrderRService.updateExpressStatus(sids); tbCfItemOrderRService.updateExpressStatus(sids);
System.out.println("修改了:" + sids.length + "条数据");
} }
long endTime = System.currentTimeMillis();
String s1 = sdf.format(System.currentTimeMillis());
System.out.println("入珠海仓库查询时间:" + s1);
System.out.println("消耗时间:" + (endTime - startTime) + "ms");
} }
@Scheduled(cron = "0 0/10 * * * ? ") @Scheduled(cron = "0 0/10 * * * ? ")
...@@ -73,8 +61,6 @@ public class ExpressStatusTask { ...@@ -73,8 +61,6 @@ public class ExpressStatusTask {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String startime = sdf.format(getStartTime()); String startime = sdf.format(getStartTime());
String endtime = sdf.format(getEndTime()); String endtime = sdf.format(getEndTime());
// String startime = "2019-09-29 00:00:00";
// String endtime ="2019-10-30 00:00:00";
String url = "http://shd.kjwlxt.com/api/checkin.php"; String url = "http://shd.kjwlxt.com/api/checkin.php";
Map<String, String> parameters = new HashMap<>(); Map<String, String> parameters = new HashMap<>();
parameters.put("user_no", "shd806"); parameters.put("user_no", "shd806");
...@@ -85,7 +71,6 @@ public class ExpressStatusTask { ...@@ -85,7 +71,6 @@ public class ExpressStatusTask {
String s = HttpUtils.sendPostJson(url, parameters); String s = HttpUtils.sendPostJson(url, parameters);
JSONObject jsonObject = JSONObject.fromObject(s).getJSONObject("content"); JSONObject jsonObject = JSONObject.fromObject(s).getJSONObject("content");
JSONArray data = jsonObject.getJSONArray("data"); JSONArray data = jsonObject.getJSONArray("data");
long startTime = System.currentTimeMillis();
String[] sids = new String[data.size()]; String[] sids = new String[data.size()];
for (int i = 0; i < sids.length; i++) { for (int i = 0; i < sids.length; i++) {
JSONObject object = JSONObject.fromObject(data.getString(i)); JSONObject object = JSONObject.fromObject(data.getString(i));
...@@ -93,22 +78,15 @@ public class ExpressStatusTask { ...@@ -93,22 +78,15 @@ public class ExpressStatusTask {
} }
if (sids.length != 0) { if (sids.length != 0) {
int i = tbCfItemOrderRService.updateExpressStatuss(sids); int i = tbCfItemOrderRService.updateExpressStatuss(sids);
System.out.println("修改了:" + sids.length + "条数据");
} }
long endTime = System.currentTimeMillis();
String s1 = sdf.format(System.currentTimeMillis());
System.out.println("入非洲仓库查询时间:" + s1);
System.out.println("消耗时间:" + (endTime - startTime) + "ms");
} }
@Scheduled(cron = "0/50 * * * * ? ") @Scheduled(cron = "0 0/10 * * * ? ")
public void expressStatusTaskForDelivery() { public void expressStatusTaskForDelivery() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String startime = sdf.format(getStartTime()); String startime = sdf.format(getStartTime());
String endtime = sdf.format(getEndTime()); String endtime = sdf.format(getEndTime());
// String startime = "2019-09-29 00:00:00";
// String endtime ="2019-10-30 00:00:00";
String url = "http://shd.kjwlxt.com/api/checkout.php"; String url = "http://shd.kjwlxt.com/api/checkout.php";
Map<String, String> parameters = new HashMap<>(); Map<String, String> parameters = new HashMap<>();
parameters.put("user_no", "shd806"); parameters.put("user_no", "shd806");
...@@ -126,14 +104,14 @@ public class ExpressStatusTask { ...@@ -126,14 +104,14 @@ public class ExpressStatusTask {
} }
if (sids.length != 0) { if (sids.length != 0) {
int result = tbCfItemOrderRService.updateExpressStatusDelivery(sids); int result = tbCfItemOrderRService.updateExpressStatusDelivery(sids);
System.out.println(result+"数量:"); if(result!=0){
for (int i = 0; i < sids.length; i++) { for (int i = 0; i < sids.length; i++) {
Set<Integer> statusSet = new HashSet<>(); Set<Integer> statusSet = new HashSet<>();
List<TbCfItemOrderREntity> orderItemList = tbCfItemOrderRService.getOrderItemsId(tbCfPlatformOrderService.getOrderId(sids[i])); List<TbCfItemOrderREntity> orderItemList = tbCfItemOrderRService.getOrderItemsId(tbCfPlatformOrderService.getOrderId(sids[i]));
for (TbCfItemOrderREntity order: orderItemList) { for (TbCfItemOrderREntity order : orderItemList) {
statusSet.add(tbCfItemOrderRService.findOrderStatus(order.getOrderItemId())); statusSet.add(tbCfItemOrderRService.findOrderStatus(order.getOrderItemId()));
} }
if(statusSet.size()==1&&statusSet.contains(50)){ if (statusSet.size() == 1 && statusSet.contains(50)) {
TbCfItemOrderREntity tbCfItemOrderREntity = tbCfPlatformOrderService.getOrdersId(sids[i]); TbCfItemOrderREntity tbCfItemOrderREntity = tbCfPlatformOrderService.getOrdersId(sids[i]);
TbCfOrderEntity tbCfOrderEntity = new TbCfOrderEntity(); TbCfOrderEntity tbCfOrderEntity = new TbCfOrderEntity();
tbCfOrderEntity.setOrderId(tbCfItemOrderREntity.getOrderId()); tbCfOrderEntity.setOrderId(tbCfItemOrderREntity.getOrderId());
...@@ -142,30 +120,10 @@ public class ExpressStatusTask { ...@@ -142,30 +120,10 @@ public class ExpressStatusTask {
tbCfOrderService.updateStatus(tbCfOrderEntity); tbCfOrderService.updateStatus(tbCfOrderEntity);
} }
} }
}
}
/* Set<Integer> statusSet = new HashSet<>();
for (int i = 0; i < sids.length; i++) {
TbCfItemOrderREntity tbCfItemOrderREntity = tbCfPlatformOrderService.getOrdersId(sids[i]);
statusSet.add(tbCfItemOrderREntity.getOrderStatus());
}
if (statusSet.size() == 1 && statusSet.contains(50)) {
for (int y = 0; y < sids.length; y++) {
TbCfOrderEntity tbCfOrderEntity = new TbCfOrderEntity();
tbCfOrderEntity.setOrderId(tbCfItemOrderREntity.getOrderId());
tbCfOrderEntity.setOrderStatus(OrderStatusEnum.SUCCESS.getValue());
tbCfOrderEntity.setCloseTime(new Date());
tbCfOrderService.updateStatus(tbCfOrderEntity);
}
} }
} }
/* }
long endTime = System.currentTimeMillis();
String s2 = sdf.format(System.currentTimeMillis());
System.out.println("签收查询时间:"+s2);
System.out.println("消耗时间:"+(endTime -startTime)+"ms");*/
private static Date getStartTime() { private static Date getStartTime() {
Calendar todayStart = Calendar.getInstance(); Calendar todayStart = Calendar.getInstance();
todayStart.set(Calendar.HOUR_OF_DAY, 0); todayStart.set(Calendar.HOUR_OF_DAY, 0);
...@@ -189,8 +147,6 @@ public class ExpressStatusTask { ...@@ -189,8 +147,6 @@ public class ExpressStatusTask {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String startime = sdf.format(getStartTime()); String startime = sdf.format(getStartTime());
String endtime =sdf.format(getEndTime()); String endtime =sdf.format(getEndTime());
// String startime = "2019-09-29 00:00:00";
// String endtime ="2019-10-30 00:00:00";
String url="http://shd.kjwlxt.com/api/checkin.php"; String url="http://shd.kjwlxt.com/api/checkin.php";
Map<String,String> parameters=new HashMap<>(); Map<String,String> parameters=new HashMap<>();
parameters.put("user_no","shd806"); parameters.put("user_no","shd806");
......
package com.platform.task; package com.platform.task;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.platform.entity.SysUserEntity; import com.platform.entity.SysUserEntity;
import com.platform.service.SysUserService; import com.platform.service.SysUserService;
import com.platform.utils.Constant; import com.platform.utils.Constant;
import com.platform.utils.util.HttpUtils;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringBuilder;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
/** /**
* 测试定时任务(演示Demo,可删除) * 测试定时任务(演示Demo,可删除)
* testTask为spring bean的名称 * testTask为spring bean的名称
......
...@@ -314,7 +314,7 @@ ...@@ -314,7 +314,7 @@
<!--根据订单id,获取订单内商品详情--> <!--根据订单id,获取订单内商品详情-->
<select id="getOrderItemList" resultType="com.platform.entity.TbCfItemDetailEntity"> <select id="getOrderItemList" resultType="com.platform.entity.TbCfItemDetailEntity">
select t2.* from tb_cf_item_order_r t1,tb_cf_item_detail t2 where t1.order_id =#{orderId} select t2.* from tb_cf_item_order_r t1,tb_cf_item_detail t2 where t1.order_item_id =#{ordersId}
and t1.enable_flag=1 and t2.item_id=t1.item_id and t1.enable_flag=1 and t2.item_id=t1.item_id
</select> </select>
<select id="getOrderItemLists" resultType="com.platform.entity.TbCfItemDetailEntity"> <select id="getOrderItemLists" resultType="com.platform.entity.TbCfItemDetailEntity">
......
...@@ -197,7 +197,7 @@ ...@@ -197,7 +197,7 @@
from tb_cf_platform_order p from tb_cf_platform_order p
left join tb_cf_item_order_r i on p.order_id=i.order_id left join tb_cf_item_order_r i on p.order_id=i.order_id
left join tb_cf_order o on o.order_id=i.order_id left join tb_cf_order o on o.order_id=i.order_id
where i.is_send=0 and i.delivery_flag=10 and p.p_express_number in where i.is_send=0 and i.delivery_flag=40 and p.p_express_number in
<foreach collection="array" item="sids" open="(" separator="," close=")"> <foreach collection="array" item="sids" open="(" separator="," close=")">
#{sids} #{sids}
</foreach> </foreach>
......
...@@ -250,7 +250,7 @@ public class HttpUtils { ...@@ -250,7 +250,7 @@ public class HttpUtils {
return result; return result;
} }
/** /**
* http post 提交 * http post 提交
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论