diff --git a/src/main/java/cn/chjyj/szwh/utils/SzOrderUtils.java b/src/main/java/cn/chjyj/szwh/utils/SzOrderUtils.java index 2d8d790..2f254b8 100644 --- a/src/main/java/cn/chjyj/szwh/utils/SzOrderUtils.java +++ b/src/main/java/cn/chjyj/szwh/utils/SzOrderUtils.java @@ -7,10 +7,8 @@ import com.alibaba.fastjson2.JSONObject; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.omg.CORBA.PUBLIC_MEMBER; import java.math.BigDecimal; -import java.math.RoundingMode; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; @@ -77,6 +75,77 @@ public class SzOrderUtils { return ogd; } + /** + * 生成订单商品资源 + * @param goodsSource + * @param ordgid + * @param batchcode + * @return + */ + public static OrderGoodsSource mkordGoodsSource(GoodsSource goodsSource,Integer ordgid,String batchcode){ + OrderGoodsSource ors = new OrderGoodsSource(); + ors.setBatchcode(batchcode); + // 订单商品自编号 + ors.setDetailId(ordgid); + ors.setServicecode(goodsSource.getServicecode()); + ors.setLinkcode(goodsSource.getLinkcode()); + ors.setPublisherid(goodsSource.getPublisherid()); + ors.setRegistrant(goodsSource.getRegistrant());//编码登记者(文化单位) + String resolutionUrl = StringUtils.isNotBlank(goodsSource.getResolutionUrl())?goodsSource.getResolutionUrl():""; + ors.setResolutionUrl(resolutionUrl); //解析地址-关联的目标资源地址URL + ors.setSourceType(goodsSource.getSourceType()); + ors.setSourceNameType(goodsSource.getSourceNameType()); //源名称类型-->源标识符类型:ISBN/ISLI/CN + String sourceName = StringUtils.isNotBlank(goodsSource.getSourceName())?goodsSource.getSourceName():"";//源名称 + ors.setSourceName(sourceName); + ors.setSourceidentify(goodsSource.getSourceIdentify()); + String sourceFragment = StringUtils.isNotBlank(goodsSource.getSourceFragment())?goodsSource.getSourceFragment():""; //源片段 + ors.setSourceFragment(sourceFragment); + String targetName = StringUtils.isNotBlank(goodsSource.getTargetName())?goodsSource.getTargetName():"";//目标名称-->整体目标作品名称 + ors.setTargetName(targetName); + String targetNameType=StringUtils.isNotBlank(goodsSource.getTargetNameType())?goodsSource.getTargetNameType():"";//目标名称类型-->目标标识符类型:ISBN/ISLI + ors.setTargetNameType(targetNameType); + String targetidentify= StringUtils.isNotBlank(goodsSource.getTargetIdentify())?goodsSource.getTargetIdentify():"";//目标标识符-->整体目标标识符:目标标识符类型 + 目标标识符(ISBN000000XXXXXX) + ors.setTargetidentify(targetidentify); + String targetFragment = StringUtils.isNotBlank(goodsSource.getTargetFragment())?goodsSource.getTargetFragment():"";//目标片段 + ors.setTargetFragment(targetFragment); + String targetformat = StringUtils.isNotBlank(goodsSource.getTargetFormat())?goodsSource.getTargetFormat():"";//目标类型:服务关联创建的实体(1:其他文献/2:音频/3:视频/4:图片/5:文化产品) + ors.setTargetformat(targetformat); + //重新拼装sourceData + // isli元数据(其他文献实体/音频实体/视频实体/): json格式 + if(StringUtils.isNotBlank(goodsSource.getSourceData())){ + JSONObject sdjson = JSONObject.parseObject(goodsSource.getSourceData()); + // 新增下面两个属性 + sdjson.put("source_url",""); + sdjson.put("source_status",0); + //再次转为json + ors.setSourceData(sdjson.toJSONString()); + }else{ + ors.setSourceData(""); + } + //isli元数据(其他文献实体/音频实体/视频实体/): json格式 + if(StringUtils.isNotBlank(goodsSource.getTargetData())){ + JSONObject tdjson = JSONObject.parseObject(goodsSource.getTargetData()); + // 新增下面两个属性 + tdjson.put("source_url",""); + tdjson.put("source_status",0); + //再次转为json + ors.setTargetData(tdjson.toJSONString()); + }else{ + ors.setTargetData(""); + } + String metadataxml = StringUtils.isNotBlank(goodsSource.getMetadataXml())?goodsSource.getMetadataXml():"";//isli元数据(其他文献实体/音频实体/视频实体/): json格式 + ors.setMetadataxml(metadataxml); + String cancellationReason = StringUtils.isNotBlank(goodsSource.getCancellationReason())?goodsSource.getCancellationReason():"";//注销说明 + ors.setCancellationReason(cancellationReason); + Date cancellationtime = goodsSource.getCancellationtime()!=null?goodsSource.getCancellationtime():null;//注销时间 + ors.setCancellationtime(cancellationtime); + ors.setAllocationtime(goodsSource.getAllocationtime()); + ors.setDatatype(goodsSource.getDatatype()); + ors.setIsDeleted(goodsSource.getIsDeleted()); + + return ors; + } + /** * 检查下单过程中的异常信息 * @param goods