2 changed files with 125 additions and 0 deletions
@ -0,0 +1,19 @@ |
|||
package cn.chjyj.szwh.service; |
|||
|
|||
import cn.chjyj.szwh.bean.GoodsSource; |
|||
|
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 商品资源信息 |
|||
*/ |
|||
public interface GoodsSourceService { |
|||
/** |
|||
* |
|||
* @param isli |
|||
* @param islicode |
|||
* @param batchcode |
|||
* @return |
|||
*/ |
|||
Map<String,Object> getGoodsSourceDetail(String isli, String islicode, String batchcode); |
|||
} |
|||
@ -0,0 +1,106 @@ |
|||
package cn.chjyj.szwh.service.impl; |
|||
|
|||
import cn.chjyj.szwh.bean.GoodsSource; |
|||
import cn.chjyj.szwh.bean.OrderGoodsDetail; |
|||
import cn.chjyj.szwh.mapper.GoodsSourceMapper; |
|||
import cn.chjyj.szwh.mapper.OrderGoodsDetailMapper; |
|||
import cn.chjyj.szwh.service.GoodsSourceService; |
|||
import cn.chjyj.szwh.utils.SzFileUtils; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.fasterxml.jackson.databind.json.JsonMapper; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.*; |
|||
|
|||
@Service |
|||
public class GoodsSourceServiceImpl implements GoodsSourceService { |
|||
@Autowired |
|||
private GoodsSourceMapper goodsSourceMapper; |
|||
@Autowired |
|||
private OrderGoodsDetailMapper orderGoodsDetailMapper; |
|||
|
|||
@Override |
|||
public Map<String, Object> getGoodsSourceDetail(String isli, String islicode, String batchcode) { |
|||
Map query = new HashMap<>(); |
|||
query.put("sourceIdentify", isli); |
|||
if (StringUtils.isNotBlank(batchcode)) { |
|||
query.put("batchcode", batchcode); |
|||
} |
|||
List<GoodsSource> gslist = goodsSourceMapper.getGoodsSourceByMap(query, 0, 10); |
|||
|
|||
//返回map
|
|||
Map<String, Object> retmap = new HashMap<>(); |
|||
//
|
|||
Map info = new HashMap(); |
|||
List gatherList = new ArrayList(); |
|||
//遍历
|
|||
int ind = 0; |
|||
for (GoodsSource gs : gslist) { |
|||
JSONObject jssdata = JSONObject.parseObject(gs.getSourceData()); |
|||
JSONObject tgdata = JSONObject.parseObject(gs.getTargetData()); |
|||
if (ind < 1) { |
|||
info.put("source_name", gs.getSourceName()); |
|||
String otherIndFiler = jssdata.getString("otherIdentifiers"); |
|||
info.put("otherIdentifiers", StringUtils.isNotBlank(otherIndFiler) ? otherIndFiler : "-"); |
|||
info.put("identifier", jssdata.getString("identifier")); |
|||
info.put("collectionType", jssdata.getString("collectionType")); |
|||
info.put("serviceType", jssdata.getString("serviceType")); |
|||
info.put("classification", jssdata.getString("classification")); |
|||
info.put("contributors", jssdata.getString("contributors")); |
|||
info.put("copyrightOwner" ,jssdata.getString("copyrightOwner")); |
|||
info.put("carrier" ,jssdata.getString("carrier")); |
|||
info.put("registrant" ,jssdata.getString("registrant")); |
|||
info.put("registerDate" ,jssdata.getString("registerDate")); |
|||
info.put("repositoryName",jssdata.getString("repositoryName")); |
|||
String dimen = jssdata.getString("dimensions"); |
|||
info.put("dimensions" ,StringUtils.isNotBlank(dimen)?dimen:"-"); |
|||
info.put("quantity" ,jssdata.getString("quantity")); |
|||
info.put("label" ,jssdata.getString("label")); |
|||
info.put("description",jssdata.getString("description")); |
|||
info.put("md5Val" ,jssdata.getString("md5Val")); |
|||
info.put("databaseId" ,jssdata.getString("databaseId")); |
|||
info.put("edition" ,jssdata.getString("edition")); |
|||
info.put("collectionCondition" ,jssdata.getString("collectionCondition")); |
|||
info.put("cover" ,jssdata.getString("cover")); |
|||
// 索引增加
|
|||
ind++; |
|||
} |
|||
// 标的信息
|
|||
Long filesize =tgdata.getLongValue("metadataFileSize"); |
|||
// 格式化文件大小
|
|||
String formatFileSize = SzFileUtils.fileSizeFormat(filesize); |
|||
//
|
|||
Map gather = new HashMap(); |
|||
gather.put("target_name",gs.getTargetName()); |
|||
gather.put("identifier" ,tgdata.getString("identifier")); |
|||
gather.put("linkCode" , gs.getLinkcode()); |
|||
gather.put("filesize" , formatFileSize); |
|||
gather.put("metadataFileFormat" ,tgdata.getString("metadataFileFormat")); |
|||
gather.put("registerDate" ,tgdata.getString("registerDate")); |
|||
|
|||
//订单号 委托码 不为空的情况
|
|||
if(StringUtils.isNotEmpty(batchcode) && StringUtils.isNotEmpty(islicode)){ |
|||
String ogdstr = orderGoodsDetailMapper.getOrderGoodsDetailSourceDownload(batchcode,islicode); |
|||
JSONObject ogdjson = JSONObject.parseObject(ogdstr); |
|||
String sdstatus = ogdjson.getString("status"); |
|||
String sdislicode = ogdjson.getString("islicode"); |
|||
if(gs.getLinkcode().equals(sdislicode)){ |
|||
gather.put("download_status",sdstatus); |
|||
} |
|||
} |
|||
|
|||
String serviceType = tgdata.getString("serviceType"); |
|||
Map stmap = new HashMap(); |
|||
stmap.put("source",gather); |
|||
stmap.put("serviceType",serviceType); |
|||
// add to list
|
|||
gatherList.add(stmap); |
|||
} |
|||
|
|||
retmap.put("info",info); |
|||
retmap.put("gather_arr",gatherList); |
|||
return retmap; |
|||
} |
|||
} |
|||
Loading…
Reference in new issue