|
|
|
@ -9,6 +9,7 @@ import cn.chjyj.szwh.service.OrderService; |
|
|
|
import cn.chjyj.szwh.utils.*; |
|
|
|
import cn.chjyj.szwh.utils.pay.StringUtil; |
|
|
|
import cn.chjyj.szwh.utils.pay.security.AesEncryption; |
|
|
|
import cn.chjyj.szwh.vo.AdOrderVO; |
|
|
|
import cn.chjyj.szwh.vo.OrderDetailVo; |
|
|
|
import com.alibaba.fastjson2.JSON; |
|
|
|
import com.alibaba.fastjson2.JSONArray; |
|
|
|
@ -117,119 +118,152 @@ public class OrderServiceImpl implements OrderService { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//组织搜索条件
|
|
|
|
Map somap = new HashMap(); |
|
|
|
// 如果是商品名称
|
|
|
|
String gname = (String) qumap.get("goods_name"); |
|
|
|
if (StringUtils.isNotBlank(gname)) { |
|
|
|
somap.put("goods_name", gname); //按名称搜索
|
|
|
|
somap.put("goods_islicode", gname); //按编号搜索
|
|
|
|
} |
|
|
|
// 交易类型
|
|
|
|
String gtype = (String) qumap.get("goods_entrust"); |
|
|
|
if (gtype != null) { |
|
|
|
somap.put("goods_entrust", gtype); |
|
|
|
} |
|
|
|
// 商品服务费类型
|
|
|
|
String chargeType = (String) qumap.get("charges_type"); |
|
|
|
if (chargeType != null) { |
|
|
|
Integer ichargeType = Integer.valueOf(chargeType); |
|
|
|
somap.put("charges_type", ichargeType); |
|
|
|
} |
|
|
|
// 如果订单商品查询条件存在
|
|
|
|
if(somap.size()>0){ |
|
|
|
List<OrderGoodsDetail> sogdlist = orderGoodsDetailMapper.searchOrderGoodsInKey(somap); |
|
|
|
if (sogdlist != null && sogdlist.size()>0) { |
|
|
|
List sbarr = new ArrayList(); |
|
|
|
for (OrderGoodsDetail ogd : sogdlist) { |
|
|
|
sbarr.add(ogd.getBatchcode()); |
|
|
|
} |
|
|
|
qumap.put("bcin", sbarr); |
|
|
|
} |
|
|
|
log.info("sogdlist is null"); |
|
|
|
} |
|
|
|
// //组织搜索条件
|
|
|
|
// Map somap = new HashMap();
|
|
|
|
// // 如果是商品名称
|
|
|
|
// String gname = (String) qumap.get("goods_name");
|
|
|
|
// if (StringUtils.isNotBlank(gname)) {
|
|
|
|
// somap.put("goods_name", gname); //按名称搜索
|
|
|
|
// somap.put("goods_islicode", gname); //按编号搜索
|
|
|
|
// }
|
|
|
|
// // 交易类型
|
|
|
|
// String gtype = (String) qumap.get("goods_entrust");
|
|
|
|
// if (gtype != null) {
|
|
|
|
// somap.put("goods_entrust", gtype);
|
|
|
|
// }
|
|
|
|
// // 商品服务费类型
|
|
|
|
// String chargeType = (String) qumap.get("charges_type");
|
|
|
|
// if (chargeType != null) {
|
|
|
|
// Integer ichargeType = Integer.valueOf(chargeType);
|
|
|
|
// somap.put("charges_type", ichargeType);
|
|
|
|
// }
|
|
|
|
// // 如果订单商品查询条件存在
|
|
|
|
// if(somap.size()>0){
|
|
|
|
// List<OrderGoodsDetail> sogdlist = orderGoodsDetailMapper.searchOrderGoodsInKey(somap);
|
|
|
|
// if (sogdlist != null && sogdlist.size()>0) {
|
|
|
|
// List sbarr = new ArrayList();
|
|
|
|
// for (OrderGoodsDetail ogd : sogdlist) {
|
|
|
|
// sbarr.add(ogd.getBatchcode());
|
|
|
|
// }
|
|
|
|
// qumap.put("bcin", sbarr);
|
|
|
|
// }
|
|
|
|
// log.info("sogdlist is null");
|
|
|
|
// }
|
|
|
|
|
|
|
|
List<Order> orderList = new ArrayList<>(); |
|
|
|
//商品编号
|
|
|
|
String gsid=(String) qumap.get("goods_islicode"); |
|
|
|
if(gsid!=null){ |
|
|
|
// 查询商品关联订单
|
|
|
|
orderList = orderMapper.getGoodsInnerOrderList(gsid); |
|
|
|
somap.put("goods_islicode",gsid); |
|
|
|
}else { |
|
|
|
// 重新组合筛选条件
|
|
|
|
orderList = orderMapper.getOrderList(qumap, starrs, limit); |
|
|
|
} |
|
|
|
// String gsid=(String) qumap.get("goods_islicode");
|
|
|
|
// if(gsid!=null){
|
|
|
|
//// // 查询商品关联订单
|
|
|
|
//// orderList = orderMapper.getGoodsInnerOrderList(gsid);
|
|
|
|
//// somap.put("goods_islicode",gsid);
|
|
|
|
//// }else {
|
|
|
|
// // 重新组合筛选条件
|
|
|
|
// orderList = orderMapper.getOrderList(qumap, starrs, limit);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// 管理系统订单
|
|
|
|
List<AdOrderVO> adordlist = orderMapper.queryOrderList(qumap,starrs,limit); |
|
|
|
|
|
|
|
// 统计符合条件的总数
|
|
|
|
int total = orderMapper.countOrderByMap(qumap); |
|
|
|
int total = orderMapper.countOrdMap(qumap); |
|
|
|
|
|
|
|
// 存放结果list
|
|
|
|
List relist = new ArrayList(); |
|
|
|
|
|
|
|
//拼装对象
|
|
|
|
for (Order od : orderList) { |
|
|
|
for(AdOrderVO aod:adordlist){ |
|
|
|
Map tomap = new HashMap(); |
|
|
|
//订单编号
|
|
|
|
tomap.put("batchcode", od.getBatchcode()); |
|
|
|
// 购买者
|
|
|
|
OrderUser oduser = orderUserMapper.getUserOrder(od.getBatchcode(), od.getBuyIslicode()); |
|
|
|
if(oduser!=null) { |
|
|
|
tomap.put("buy_username", oduser.getName()); |
|
|
|
} |
|
|
|
//下单时间
|
|
|
|
tomap.put("createtime", sdf.format(od.getCreatetime())); |
|
|
|
//entrust_name 委托人信息,
|
|
|
|
String entrustName = ""; |
|
|
|
String entrustType = "";//委托类型
|
|
|
|
String goodsName = ""; //商品名称
|
|
|
|
|
|
|
|
Set enset = new HashSet<>();// 存放商品的授权方式
|
|
|
|
|
|
|
|
List<OrderGoodsDetail> ogdlist = orderGoodsDetailMapper.getOrderGoodsDetailByBatchCode(od.getBatchcode()); |
|
|
|
// 遍历
|
|
|
|
for (OrderGoodsDetail ogd : ogdlist) { |
|
|
|
// 收费类型
|
|
|
|
if (StringUtils.isNotBlank((String) qumap.get("charges_type"))) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 授权方信息
|
|
|
|
JSONObject ujson = SzwhApiUtils.getApiUser(ogd.getEntrustIslicode()); |
|
|
|
// 抽取出data,
|
|
|
|
String udtjson = ujson.getString("data"); |
|
|
|
if(StringUtils.isNotBlank(udtjson)){ |
|
|
|
Map userMap =JSON.parseObject(udtjson); |
|
|
|
entrustName = (String)userMap.get("name"); |
|
|
|
} |
|
|
|
// 格式化时间
|
|
|
|
//tomap.put("createtime", sdf.format(aod.getCreatetime()));
|
|
|
|
|
|
|
|
//商品名称
|
|
|
|
if (StringUtils.isNotBlank(goodsName)) { |
|
|
|
goodsName += "," + ogd.getGoodsName(); |
|
|
|
} else { |
|
|
|
goodsName = ogd.getGoodsName(); |
|
|
|
} |
|
|
|
|
|
|
|
//委托方式
|
|
|
|
String tmptype = ogd.getGoodsEntrust() == 1 ? "转让" : "授权"; |
|
|
|
enset.add(tmptype); |
|
|
|
// 获取授权方
|
|
|
|
String entrustName = ""; |
|
|
|
JSONObject ujson = SzwhApiUtils.getApiUser(aod.getEntrust_islicode()); |
|
|
|
// 抽取出data,
|
|
|
|
String udtjson = ujson.getString("data"); |
|
|
|
if(StringUtils.isNotBlank(udtjson)){ |
|
|
|
Map userMap =JSON.parseObject(udtjson); |
|
|
|
// entrustName = (String)userMap.get("name");
|
|
|
|
tomap.put("entrust_name",(String)userMap.get("name")); |
|
|
|
} |
|
|
|
// set集合 转为字符串
|
|
|
|
entrustType = String.join(",", enset); |
|
|
|
//
|
|
|
|
String entrustType = aod.getGoods_entrust() == 1 ? "转让" : "授权";//委托类型
|
|
|
|
// 存放在map 中
|
|
|
|
tomap.put("entrust_name", entrustName); |
|
|
|
tomap.put("entrust_type", entrustType); |
|
|
|
tomap.put("goods_name", goodsName); |
|
|
|
//订单金额
|
|
|
|
tomap.put("total_money", od.getTotalMoney()); |
|
|
|
tomap.put("type", od.getType()); |
|
|
|
tomap.put("status", od.getStatus()); |
|
|
|
tomap.put("id", od.getId()); |
|
|
|
|
|
|
|
//attention map 对象有小小的弊端
|
|
|
|
tomap.put("entrust_type", entrustType); |
|
|
|
tomap.put("goods_name", aod.getGoods_name()); |
|
|
|
//订单金额
|
|
|
|
tomap.put("total_money", aod.getTotal_money()); |
|
|
|
tomap.put("status", aod.getStatus()); |
|
|
|
tomap.put("id", aod.getId()); |
|
|
|
//
|
|
|
|
relist.add(tomap); |
|
|
|
} |
|
|
|
|
|
|
|
//拼装对象
|
|
|
|
// for (Order od : orderList) {
|
|
|
|
// Map tomap = new HashMap();
|
|
|
|
// //订单编号
|
|
|
|
// tomap.put("batchcode", od.getBatchcode());
|
|
|
|
// // 购买者
|
|
|
|
// OrderUser oduser = orderUserMapper.getUserOrder(od.getBatchcode(), od.getBuyIslicode());
|
|
|
|
// if(oduser!=null) {
|
|
|
|
// tomap.put("buy_username", oduser.getName());
|
|
|
|
// }
|
|
|
|
// //下单时间
|
|
|
|
// tomap.put("createtime", sdf.format(od.getCreatetime()));
|
|
|
|
// //entrust_name 委托人信息,
|
|
|
|
// String entrustName = "";
|
|
|
|
// String entrustType = "";//委托类型
|
|
|
|
// String goodsName = ""; //商品名称
|
|
|
|
//
|
|
|
|
// Set enset = new HashSet<>();// 存放商品的授权方式
|
|
|
|
//
|
|
|
|
// List<OrderGoodsDetail> ogdlist = orderGoodsDetailMapper.getOrderGoodsDetailByBatchCode(od.getBatchcode());
|
|
|
|
// // 遍历
|
|
|
|
// for (OrderGoodsDetail ogd : ogdlist) {
|
|
|
|
// // 收费类型
|
|
|
|
// if (StringUtils.isNotBlank((String) qumap.get("charges_type"))) {
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// // 授权方信息
|
|
|
|
// JSONObject ujson = SzwhApiUtils.getApiUser(ogd.getEntrustIslicode());
|
|
|
|
// // 抽取出data,
|
|
|
|
// String udtjson = ujson.getString("data");
|
|
|
|
// if(StringUtils.isNotBlank(udtjson)){
|
|
|
|
// Map userMap =JSON.parseObject(udtjson);
|
|
|
|
// entrustName = (String)userMap.get("name");
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// //商品名称
|
|
|
|
// if (StringUtils.isNotBlank(goodsName)) {
|
|
|
|
// goodsName += "," + ogd.getGoodsName();
|
|
|
|
// } else {
|
|
|
|
// goodsName = ogd.getGoodsName();
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// //委托方式
|
|
|
|
// String tmptype = ogd.getGoodsEntrust() == 1 ? "转让" : "授权";
|
|
|
|
// enset.add(tmptype);
|
|
|
|
// }
|
|
|
|
// // set集合 转为字符串
|
|
|
|
// entrustType = String.join(",", enset);
|
|
|
|
// // 存放在map 中
|
|
|
|
// tomap.put("entrust_name", entrustName);
|
|
|
|
// tomap.put("entrust_type", entrustType);
|
|
|
|
// tomap.put("goods_name", goodsName);
|
|
|
|
// //订单金额
|
|
|
|
// tomap.put("total_money", od.getTotalMoney());
|
|
|
|
// tomap.put("type", od.getType());
|
|
|
|
// tomap.put("status", od.getStatus());
|
|
|
|
// tomap.put("id", od.getId());
|
|
|
|
//
|
|
|
|
// //attention map 对象有小小的弊端
|
|
|
|
// relist.add(tomap);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// 记录总数
|
|
|
|
|
|
|
|
retmap.put("total", total); |
|
|
|
|