|
|
|
@ -9,6 +9,8 @@ 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.apache.commons.logging.Log; |
|
|
|
import org.apache.commons.logging.LogFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
@ -16,11 +18,20 @@ import java.util.*; |
|
|
|
|
|
|
|
@Service |
|
|
|
public class GoodsSourceServiceImpl implements GoodsSourceService { |
|
|
|
private Log log = LogFactory.getLog(GoodsSourceServiceImpl.class); |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private GoodsSourceMapper goodsSourceMapper; |
|
|
|
@Autowired |
|
|
|
private OrderGoodsDetailMapper orderGoodsDetailMapper; |
|
|
|
|
|
|
|
/** |
|
|
|
* 商品来源详情 |
|
|
|
* @param isli |
|
|
|
* @param islicode |
|
|
|
* @param batchcode |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Map<String, Object> getGoodsSourceDetail(String isli, String islicode, String batchcode) { |
|
|
|
Map query = new HashMap<>(); |
|
|
|
@ -28,49 +39,58 @@ public class GoodsSourceServiceImpl implements GoodsSourceService { |
|
|
|
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(); |
|
|
|
// gslist其中一条用来当做详情基本信息
|
|
|
|
GoodsSource tmpgs = gslist.get(0); |
|
|
|
// 资源json串
|
|
|
|
JSONObject jssdata = JSONObject.parseObject(tmpgs.getSourceData()); |
|
|
|
// 填充info
|
|
|
|
info.put("source_name", tmpgs.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")); |
|
|
|
// 封装到返回map中
|
|
|
|
retmap.put("info",info); |
|
|
|
|
|
|
|
//资源数据集合 list
|
|
|
|
List gatherList = new ArrayList(); |
|
|
|
//遍历
|
|
|
|
int ind = 0; |
|
|
|
for (GoodsSource gs : gslist) { |
|
|
|
JSONObject jssdata = JSONObject.parseObject(gs.getSourceData()); |
|
|
|
//目标json 字符串
|
|
|
|
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++; |
|
|
|
} |
|
|
|
//log.info("target data: "+tgdata);
|
|
|
|
// 标的信息
|
|
|
|
Long filesize =tgdata.getLongValue("metadataFileSize"); |
|
|
|
// 格式化文件大小
|
|
|
|
String formatFileSize = SzFileUtils.fileSizeFormat(filesize); |
|
|
|
|
|
|
|
List nglist = new ArrayList(); |
|
|
|
//
|
|
|
|
Map gather = new HashMap(); |
|
|
|
gather.put("target_name",gs.getTargetName()); |
|
|
|
@ -91,15 +111,17 @@ public class GoodsSourceServiceImpl implements GoodsSourceService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
nglist.add(gather); |
|
|
|
|
|
|
|
String serviceType = tgdata.getString("serviceType"); |
|
|
|
Map stmap = new HashMap(); |
|
|
|
stmap.put("source",gather); |
|
|
|
stmap.put("source",nglist); |
|
|
|
stmap.put("serviceType",serviceType); |
|
|
|
|
|
|
|
// add to list
|
|
|
|
gatherList.add(stmap); |
|
|
|
} |
|
|
|
|
|
|
|
retmap.put("info",info); |
|
|
|
retmap.put("gather_arr",gatherList); |
|
|
|
return retmap; |
|
|
|
} |
|
|
|
|