Browse Source

溢出多余的函数

master
xyiege 3 years ago
parent
commit
f4364fa7a7
  1. 7
      src/main/java/cn/chjyj/szwh/service/GoodsSourceService.java
  2. 63
      src/main/java/cn/chjyj/szwh/service/impl/GoodsSourceServiceImpl.java

7
src/main/java/cn/chjyj/szwh/service/GoodsSourceService.java

@ -17,11 +17,4 @@ public interface GoodsSourceService {
*/
Map<String,Object> getGoodsSourceDetail(String isli, String islicode, String batchcode);
/**
* 增加商品资源 GoodsSource
* @param res
* @param idlicode
* @return
*/
int insertGoodsSource(String res,String idlicode);
}

63
src/main/java/cn/chjyj/szwh/service/impl/GoodsSourceServiceImpl.java

@ -156,67 +156,4 @@ public class GoodsSourceServiceImpl implements GoodsSourceService {
return retmap;
}
/**
* add new GoodsSource
* @param res 传递过来的json字符串
* @param islicode 商品编码
* @return
*/
@Override
public int insertGoodsSource(String res, String islicode) {
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 抽取出现对应数据
JSONArray jarr = JSONArray.parseArray(res);
for(int i=0;i<jarr.size();i++){
JSONObject innerJson = (JSONObject) jarr.get(i);
// 转为对象
GoodsSource goodsSource = new GoodsSource();
goodsSource.setServicecode(innerJson.getString("'serviceCode'"));
goodsSource.setLinkcode(innerJson.getString("linkCode"));
// 发布 id
String pubid = innerJson.getString("publisherId");
goodsSource.setPublisherid(Integer.valueOf(pubid));
goodsSource.setRegistrant(innerJson.getString("register"));
goodsSource.setResolutionUrl(innerJson.getString("resolutionUrl"));
goodsSource.setSourceType(innerJson.getString("sourceType"));
goodsSource.setSourceNameType(innerJson.getString("sourceNameType"));
goodsSource.setSourceName(innerJson.getString("sourceName"));
//
goodsSource.setSourceidentify(innerJson.getString("sourceIdentify"));
goodsSource.setSourceFragment(innerJson.getString("sourceFragment"));
goodsSource.setTargetName(innerJson.getString("targetName"));
goodsSource.setTargetNameType(innerJson.getString("targetNameType"));
goodsSource.setTargetidentify(innerJson.getString("targetIdentify"));
//
goodsSource.setTargetFragment(innerJson.getString("targetFragment"));
goodsSource.setTargetformat(innerJson.getString("targetFormat"));
// 存放了json字符串
goodsSource.setSourceData(innerJson.getString("sourceData"));
goodsSource.setTargetData(innerJson.getString("targetData"));
//
goodsSource.setMetadataxml(innerJson.getString("metadataXml"));
goodsSource.setCancellationReason(innerJson.getString("cancellationReason"));
// 字符串转为日期时间格式
String aldate =innerJson.getString("allocationDate");
try {
Date ndate = sdf.parse(aldate);
goodsSource.setAllocationtime(ndate);
}catch (Exception ex){
// do nothing
}
goodsSource.setSourceType(innerJson.getString("dataType"));
try{
String cldate = innerJson.getString("cancellationDate");
Date cndate =sdf.parse(cldate);
goodsSource.setCancellationtime(cndate);
}catch (Exception ex){
//do nothing
}
// 产品主键
goodsSource.setGoodsIsliCode(islicode);
// 执行插入
goodsSourceMapper.add(goodsSource);
}
return 0;
}
}

Loading…
Cancel
Save