|
|
|
@ -1,17 +1,12 @@ |
|
|
|
package cn.chjyj.szwh.service.impl; |
|
|
|
|
|
|
|
import cn.chjyj.szwh.bean.Order; |
|
|
|
import cn.chjyj.szwh.bean.OrderGoodsDetail; |
|
|
|
import cn.chjyj.szwh.bean.OrderGoodsSource; |
|
|
|
import cn.chjyj.szwh.bean.OrderUser; |
|
|
|
import cn.chjyj.szwh.bean.*; |
|
|
|
import cn.chjyj.szwh.constant.ChConstant; |
|
|
|
import cn.chjyj.szwh.exception.ChException; |
|
|
|
import cn.chjyj.szwh.mapper.OrderGoodsDetailMapper; |
|
|
|
import cn.chjyj.szwh.mapper.OrderGoodsSourceMapper; |
|
|
|
import cn.chjyj.szwh.mapper.OrderMapper; |
|
|
|
import cn.chjyj.szwh.mapper.OrderUserMapper; |
|
|
|
import cn.chjyj.szwh.mapper.*; |
|
|
|
import cn.chjyj.szwh.service.OrderService; |
|
|
|
import cn.chjyj.szwh.vo.OrderDetailVo; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.commons.logging.Log; |
|
|
|
@ -40,6 +35,8 @@ public class OrderServiceImpl implements OrderService { |
|
|
|
private OrderGoodsDetailMapper orderGoodsDetailMapper; |
|
|
|
@Autowired |
|
|
|
private OrderGoodsSourceMapper orderGoodsSourceMapper; |
|
|
|
@Autowired |
|
|
|
private GoodsSourceMapper goodsSourceMapper; |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<Order> getAllOrderList(int page) { |
|
|
|
@ -144,37 +141,70 @@ public class OrderServiceImpl implements OrderService { |
|
|
|
public Map<String, Object> orderDetail(String batchcode) { |
|
|
|
Map retmap =new HashMap(); |
|
|
|
// 订单详情及产品信息
|
|
|
|
OrderDetailVo ordv =orderGoodsDetailMapper.getOrderDetailVo(batchcode); |
|
|
|
if(ordv==null){ |
|
|
|
List<OrderDetailVo> ordvList =orderGoodsDetailMapper.getOrderDetailVo(batchcode); |
|
|
|
if(ordvList==null){ |
|
|
|
// 订单不存在
|
|
|
|
} |
|
|
|
// 商品图片
|
|
|
|
if(StringUtils.isNotBlank(ordv.getGoods_image())){ |
|
|
|
//todo 远程获取图
|
|
|
|
} |
|
|
|
|
|
|
|
// 订单用户 ,
|
|
|
|
OrderUser orderUser = orderUserMapper.getUserOrder(batchcode,ordv.getEntrust_islicode()); |
|
|
|
// 显示时候取出ID,
|
|
|
|
orderUser.setId(null); |
|
|
|
orderUser.setBatchcode(null); |
|
|
|
retmap.put("userinfo",orderUser); |
|
|
|
|
|
|
|
//商品来源
|
|
|
|
List<OrderGoodsSource> orderGoodsSourceList = orderGoodsSourceMapper. |
|
|
|
getOrderGoodsSourceList(ordv.getSource_id()); |
|
|
|
// 遍历
|
|
|
|
for(OrderGoodsSource ods:orderGoodsSourceList){ |
|
|
|
String sourceData = ods.getSourceData(); |
|
|
|
// 转为json
|
|
|
|
JSONObject json = JSONObject.parseObject(sourceData); |
|
|
|
Integer dataType= json.getInteger("datatype"); |
|
|
|
// 如果不存在的话,需要进行下载
|
|
|
|
// if(dataType==1){
|
|
|
|
//
|
|
|
|
// }else{
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
log.warn("order miss :"+batchcode+" miss! Check your db pls!"); |
|
|
|
}else{ |
|
|
|
// 枚举所有的订单详情
|
|
|
|
for(OrderDetailVo dv:ordvList){ |
|
|
|
// 商品图片
|
|
|
|
if(StringUtils.isNotBlank(dv.getGoods_image())){ |
|
|
|
//todo 远程获取图
|
|
|
|
} |
|
|
|
retmap.put("goods",dv); |
|
|
|
// 订单用户 ,
|
|
|
|
OrderUser orderUser = orderUserMapper.getUserOrder(batchcode,dv.getEntrust_islicode()); |
|
|
|
// 显示时候取出ID,
|
|
|
|
orderUser.setId(null); |
|
|
|
orderUser.setBatchcode(null); |
|
|
|
retmap.put("userinfo",orderUser); |
|
|
|
|
|
|
|
//来源集合
|
|
|
|
List<OrderGoodsSource> orgslist = orderGoodsSourceMapper.getOrderGoodsSourceList(dv.getSource_id()); |
|
|
|
//存储整理后的订单商品
|
|
|
|
List gatherList = new ArrayList(); |
|
|
|
List oneSource = new ArrayList(); |
|
|
|
Map info = new HashMap(); |
|
|
|
// 罗列出goodssource
|
|
|
|
for(OrderGoodsSource ods:orgslist){ |
|
|
|
JSONObject odsJson = JSONObject.parseObject(ods.getSourceData()); |
|
|
|
// 类型
|
|
|
|
Integer dataType = ods.getDatatype(); |
|
|
|
if(dataType==1){ |
|
|
|
info.put("name",ods.getSourceName()); |
|
|
|
info.put("class",ods.getSourceType()); |
|
|
|
// 从json data 中获取
|
|
|
|
info.put("registerDate",odsJson.getString("registerDate")); |
|
|
|
info.put("identifier",odsJson.getString("identifier")); |
|
|
|
|
|
|
|
//符合条件的数量
|
|
|
|
int count = goodsSourceMapper.countGoodSource(dv.getGoods_islicode(),1,ods.getSourceidentify()); |
|
|
|
info.put("count",count); |
|
|
|
gatherList.add(info); |
|
|
|
}else{ |
|
|
|
Long filesize= odsJson.getLongValue("metadataFileSize"); |
|
|
|
info.put("name",ods.getSourceName()); |
|
|
|
info.put("class",ods.getSourceType()); |
|
|
|
info.put("registerDate",odsJson.getString("registerDate")); |
|
|
|
info.put("filesize",filesize); |
|
|
|
info.put("metadataFileFormat",odsJson.getString("metadataFileFormat")); |
|
|
|
// 资源下载地址 ,json 格式
|
|
|
|
String sourceDown= orderGoodsDetailMapper.getOrderGoodsDetailSourceDownload(batchcode,dv.getGoods_islicode()); |
|
|
|
JSONArray sdownJsonArray = JSONObject.parseArray(sourceDown); |
|
|
|
for(int i=0;i<sdownJsonArray.size();i++){ |
|
|
|
if(sdownJsonArray.getJSONObject(i).getString("islicode").equals(ods.getLinkcode())){ |
|
|
|
// 是否已经下载。更新下载状态
|
|
|
|
info.put("download_status",sdownJsonArray.getJSONObject(i).getString("status")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
oneSource.add(info); |
|
|
|
} |
|
|
|
} |
|
|
|
retmap.put("gather_arr",gatherList); |
|
|
|
retmap.put("oneSource",oneSource); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return retmap; |
|
|
|
|