Browse Source

getType进行扁平化处理

master
xyiege 3 years ago
parent
commit
8e81d7ee10
  1. 66
      src/main/java/cn/chjyj/szwh/service/impl/GoodsServiceImpl.java

66
src/main/java/cn/chjyj/szwh/service/impl/GoodsServiceImpl.java

@ -9,11 +9,13 @@ import cn.chjyj.szwh.utils.*;
import cn.chjyj.szwh.vo.GoodsDetailVo;
import cn.chjyj.szwh.vo.GoodsListVo;
import cn.chjyj.szwh.vo.OrderDetailVo;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
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.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -549,64 +551,16 @@ public class GoodsServiceImpl implements GoodsService {
//填充信息
List retlist = new ArrayList();
for (Goods g : glist) {
//goods detail
Map tgmap =new HashMap();
//List tmpglist =new ArrayList();
JSONObject tmpjson = (JSONObject) JSON.toJSON(g);
tgmap= JSONObject.parseObject(tmpjson.toJSONString());
//
GoodsDetail gd = goodsDetailMapper.getGoodsDetailBygid(g.getGoodsDetailId());
// goods source
List<GoodsSource> gslist = goodsSourceMapper.getGoodsSourceByIsli(g.getGoodsIslicode());
Map tgmap = new HashMap();
tgmap.put("goods_islicode", g.getGoodsIslicode());
tgmap.put("goods_name", gd.getGoodsName());
tgmap.put("goods_status", g.getGoodsStatus());
tgmap.put("createtime", g.getCreateTime());
tgmap.put("canceltime", g.getCancelTime());
tgmap.put("goods_type", gd.getGoodsType());
tgmap.put("contractual_period", gd.getContractualPeriod());
tgmap.put("contract", gd.getContract());
tgmap.put("transaction_class", gd.getTransactionClass());
tgmap.put("goods_entrust", gd.getGoodsEntrust());
tgmap.put("charges_type", gd.getChargesType());
tgmap.put("price", gd.getPrice());
tgmap.put("goods_ownership", gd.getGoodsOwnership());
tgmap.put("otherIdentifiers", gd.getOtherIdentifiers());
tgmap.put("classification", gd.getClassification());
if (glist != null) {
List tmpgs = new ArrayList();
for (GoodsSource gs : gslist) {
tgmap.put("servicecode", gs.getServicecode());
tgmap.put("linkcode", gs.getLinkcode());
tgmap.put("publisherId", gs.getPublisherid());
tgmap.put("registrant", gs.getRegistrant());
tgmap.put("resolution_url", gs.getResolutionUrl());
tgmap.put("source_type", gs.getSourceType());
tgmap.put("source_name_type", gs.getSourceNameType());
tgmap.put("source_name", gs.getSourceName());
tgmap.put("sourceIdentify", gs.getSourceIdentify());
tgmap.put("source_fragment", gs.getSourceFragment());
tgmap.put("target_name", gs.getTargetName());
tgmap.put("target_name_type", gs.getTargetNameType());
tgmap.put("targetIdentify", gs.getTargetIdentify());
tgmap.put("target_fragment", gs.getTargetFragment());
tgmap.put("targetFormat", gs.getTargetFormat());
tgmap.put("source_data", gs.getSourceData());
tgmap.put("target_data", gs.getTargetData());
tgmap.put("metadataXml", gs.getMetadataXml());
tgmap.put("allocationtime", gs.getAllocationtime());
tgmap.put("cancellation_reason", gs.getCancellationReason());
}
tgmap.put("source", tmpgs);
}
tgmap.put("cancellationtime", g.getCancelTime());
tgmap.put("sale_count", g.getSaleCount());
tgmap.put("click_count", g.getClickCount());
tgmap.put("stock", gd.getStock());
tgmap.put("goods_image", gd.getGoodsImage());
//add
tgmap.put("entrust_month",gd.getContractualPeriod());
retlist.add(tgmap);
}
return retlist;

Loading…
Cancel
Save