|
@@ -4,11 +4,13 @@ import java.math.BigDecimal;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.log.StaticLog;
|
|
import cn.hutool.log.StaticLog;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.injector.methods.SelectBatchByIds;
|
|
import com.pj.api.client.admin.AdminInterface;
|
|
import com.pj.api.client.admin.AdminInterface;
|
|
import com.pj.api.client.async_server.AsyncServerInterface;
|
|
import com.pj.api.client.async_server.AsyncServerInterface;
|
|
import com.pj.api.client.level_one_server.LevelOneServerInterface;
|
|
import com.pj.api.client.level_one_server.LevelOneServerInterface;
|
|
@@ -462,30 +464,36 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
|
|
|
|
|
|
TbPeople tbPeople = tbPeopleService.getById(tbOrder.getBuyUserId());
|
|
TbPeople tbPeople = tbPeopleService.getById(tbOrder.getBuyUserId());
|
|
StaticLog.info("tbPeople:{}", JSONUtil.toJsonStr(tbPeople));
|
|
StaticLog.info("tbPeople:{}", JSONUtil.toJsonStr(tbPeople));
|
|
- if (tbPeople != null) {
|
|
|
|
- paymentDto.setBankCode(tbPeople.getBankCode());
|
|
|
|
- paymentDto.setBankName(tbPeople.getBankName());
|
|
|
|
- paymentDto.setBankNo(tbPeople.getBankNo());
|
|
|
|
- paymentDto.setBorderName(tbPeople.getName());
|
|
|
|
- paymentDto.setBorderidno(tbPeople.getIdCard());
|
|
|
|
- paymentDto.setBorderTel(tbPeople.getPhone());
|
|
|
|
- paymentDto.setPapersType(tbPeople.getPapersType());
|
|
|
|
- paymentDto.setBorderNationality(tbPeople.getNationality());
|
|
|
|
|
|
+ if (tbPeople == null) {
|
|
|
|
+ throw new AjaxError("查询不到边民信息");
|
|
|
|
+ }
|
|
|
|
+ if (StrUtil.isEmpty(tbPeople.getBankCode())) {
|
|
|
|
+ throw new AjaxError(tbPeople.getName() + "银行账号不完善");
|
|
}
|
|
}
|
|
|
|
+ paymentDto.setBankCode(tbPeople.getBankCode());
|
|
|
|
+ paymentDto.setBankName(tbPeople.getBankName());
|
|
|
|
+ paymentDto.setBankNo(tbPeople.getBankNo());
|
|
|
|
+ paymentDto.setBorderName(tbPeople.getName());
|
|
|
|
+ paymentDto.setBorderidno(tbPeople.getIdCard());
|
|
|
|
+ paymentDto.setBorderTel(tbPeople.getPhone());
|
|
|
|
+ paymentDto.setPapersType(tbPeople.getPapersType());
|
|
|
|
+ paymentDto.setBorderNationality(tbPeople.getNationality());
|
|
|
|
|
|
TbShop tbShop = tbShopService.findByCode(htTradeSettlement.getShopNo());
|
|
TbShop tbShop = tbShopService.findByCode(htTradeSettlement.getShopNo());
|
|
- StaticLog.info("tbShop:{}", JSONUtil.toJsonStr(tbShop));
|
|
|
|
- if (tbShop != null) {
|
|
|
|
- paymentDto.setOwnerName(tbShop.getOwnerName());
|
|
|
|
- paymentDto.setOwnerIdtype(tbShop.getOwnerIdtype());
|
|
|
|
- paymentDto.setBankAccount(tbShop.getBankAccount());
|
|
|
|
- paymentDto.setBank(tbShop.getBank());
|
|
|
|
- paymentDto.setOwnerTel(tbShop.getOwnerTel());
|
|
|
|
- paymentDto.setShopSccd(tbShop.getShopSccd());
|
|
|
|
- paymentDto.setNationality(tbShop.getNationality());
|
|
|
|
|
|
+ if (tbShop == null) {
|
|
|
|
+ throw new AjaxError("查询不到商铺信息");
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ if (StrUtil.isEmpty(tbShop.getBankAccount())) {
|
|
|
|
+ throw new AjaxError(tbShop.getShopName() + "银行账号不完善");
|
|
|
|
+ }
|
|
|
|
+ StaticLog.info("tbShop:{}", JSONUtil.toJsonStr(tbShop));
|
|
|
|
+ paymentDto.setOwnerName(tbShop.getOwnerName());
|
|
|
|
+ paymentDto.setOwnerIdtype(tbShop.getOwnerIdtype());
|
|
|
|
+ paymentDto.setBankAccount(tbShop.getBankAccount());
|
|
|
|
+ paymentDto.setBank(tbShop.getBank());
|
|
|
|
+ paymentDto.setOwnerTel(tbShop.getOwnerTel());
|
|
|
|
+ paymentDto.setShopSccd(tbShop.getShopSccd());
|
|
|
|
+ paymentDto.setNationality(tbShop.getNationality());
|
|
return paymentDto;
|
|
return paymentDto;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -647,7 +655,7 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
|
|
htWrapper.lambda().eq(HtTradeSettlement::getId, order.getSaleMainId())
|
|
htWrapper.lambda().eq(HtTradeSettlement::getId, order.getSaleMainId())
|
|
.eq(HtTradeSettlement::getHzsConfirmStatus, 1);
|
|
.eq(HtTradeSettlement::getHzsConfirmStatus, 1);
|
|
List<HtTradeSettlement> tradeSettlementList = htTradeSettlementService.list(htWrapper);
|
|
List<HtTradeSettlement> tradeSettlementList = htTradeSettlementService.list(htWrapper);
|
|
- if(tradeSettlementList.size() > 0) {
|
|
|
|
|
|
+ if (tradeSettlementList.size() > 0) {
|
|
orderList.add(order);
|
|
orderList.add(order);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -735,6 +743,7 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
|
|
|
|
|
|
return super.updateById(tbOrder);
|
|
return super.updateById(tbOrder);
|
|
}
|
|
}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 订单补扣款——按车,并且未扣款
|
|
* 订单补扣款——按车,并且未扣款
|
|
*/
|
|
*/
|
|
@@ -757,6 +766,7 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
|
|
|
|
|
|
return super.updateBatchById(tbOrders);
|
|
return super.updateBatchById(tbOrders);
|
|
}
|
|
}
|
|
|
|
+
|
|
List<TbOrder> getDeductionByVeNoList(SoMap so) {
|
|
List<TbOrder> getDeductionByVeNoList(SoMap so) {
|
|
LambdaQueryWrapper<TbOrder> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<TbOrder> wrapper = new LambdaQueryWrapper<>();
|
|
wrapper.eq(TbOrder::getVeNo, so.getString("veNo"));
|
|
wrapper.eq(TbOrder::getVeNo, so.getString("veNo"));
|
|
@@ -871,6 +881,7 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
|
|
|
|
|
|
return updateById(tbOrder);
|
|
return updateById(tbOrder);
|
|
}
|
|
}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 订单补推结关信息给银行——按车,并且未完成
|
|
* 订单补推结关信息给银行——按车,并且未完成
|
|
*/
|
|
*/
|
|
@@ -878,7 +889,7 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
|
|
LambdaQueryWrapper<TbOrder> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<TbOrder> wrapper = new LambdaQueryWrapper<>();
|
|
wrapper.eq(TbOrder::getVeNo, veNo);
|
|
wrapper.eq(TbOrder::getVeNo, veNo);
|
|
wrapper.eq(TbOrder::getSaleMainId, id);
|
|
wrapper.eq(TbOrder::getSaleMainId, id);
|
|
- wrapper.ne(TbOrder::getFinishStatus, 1).orderByDesc(TbOrder::getCreateTime);
|
|
|
|
|
|
+ wrapper.orderByDesc(TbOrder::getCreateTime);
|
|
List<TbOrder> tbOrders = tbOrderMapper.selectList(wrapper);
|
|
List<TbOrder> tbOrders = tbOrderMapper.selectList(wrapper);
|
|
|
|
|
|
if (!tbOrders.isEmpty()) {
|
|
if (!tbOrders.isEmpty()) {
|
|
@@ -895,6 +906,7 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
|
|
paymentDto.setTradeNo(tbOrder.getTradeNo());
|
|
paymentDto.setTradeNo(tbOrder.getTradeNo());
|
|
paymentDto.setDeclTime(htTradeSettlement.getDeclTime());
|
|
paymentDto.setDeclTime(htTradeSettlement.getDeclTime());
|
|
StaticLog.info("\nsendCXB001——PaymentDto——:{}", JSONUtil.toJsonStr(paymentDto));
|
|
StaticLog.info("\nsendCXB001——PaymentDto——:{}", JSONUtil.toJsonStr(paymentDto));
|
|
|
|
+ log.info("log sendCXB001——PaymentDto——:{}", JSONUtil.toJsonStr(paymentDto));
|
|
paymentServerInterface.sendCXB001(paymentDto);
|
|
paymentServerInterface.sendCXB001(paymentDto);
|
|
}
|
|
}
|
|
this.updateBatchById(tbOrders);
|
|
this.updateBatchById(tbOrders);
|
|
@@ -910,11 +922,12 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
+
|
|
List<TbOrder> getSendCXB001ByVeNoList(SoMap so) {
|
|
List<TbOrder> getSendCXB001ByVeNoList(SoMap so) {
|
|
LambdaQueryWrapper<TbOrder> wrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<TbOrder> wrapper = new LambdaQueryWrapper<>();
|
|
wrapper.eq(TbOrder::getVeNo, so.getString("veNo"));
|
|
wrapper.eq(TbOrder::getVeNo, so.getString("veNo"));
|
|
wrapper.eq(TbOrder::getSaleMainId, so.getLong("id"));
|
|
wrapper.eq(TbOrder::getSaleMainId, so.getLong("id"));
|
|
- wrapper.ne(TbOrder::getFinishStatus, 1).orderByDesc(TbOrder::getCreateTime);
|
|
|
|
|
|
+ wrapper.orderByDesc(TbOrder::getCreateTime);
|
|
List<TbOrder> tbOrders = tbOrderMapper.selectList(wrapper);
|
|
List<TbOrder> tbOrders = tbOrderMapper.selectList(wrapper);
|
|
return tbOrders;
|
|
return tbOrders;
|
|
}
|
|
}
|
|
@@ -1138,18 +1151,53 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
|
|
SoMap soMap = new SoMap();
|
|
SoMap soMap = new SoMap();
|
|
soMap.put("saleMainId", saleMainId);
|
|
soMap.put("saleMainId", saleMainId);
|
|
List<TbOrder> list = tbOrderMapper.getList(soMap);
|
|
List<TbOrder> list = tbOrderMapper.getList(soMap);
|
|
- int total=list.size();
|
|
|
|
- List<TbOrder>upList=list.stream().filter(tbOrder -> !Objects.isNull(tbOrder.getUpPrice())).collect(Collectors.toList());
|
|
|
|
- int upSize=upList.size();
|
|
|
|
|
|
+ int total = list.size();
|
|
|
|
+ List<TbOrder> upList = list.stream().filter(tbOrder -> !Objects.isNull(tbOrder.getUpPrice())).collect(Collectors.toList());
|
|
|
|
+ int upSize = upList.size();
|
|
double upTotalPrice = upList.stream().collect(Collectors.summarizingDouble(order -> order.getUpPrice().doubleValue())).getSum();
|
|
double upTotalPrice = upList.stream().collect(Collectors.summarizingDouble(order -> order.getUpPrice().doubleValue())).getSum();
|
|
- List<TbOrder>saleList=list.stream().filter(tbOrder -> tbOrder.getResaleStatus()==1).collect(Collectors.toList());
|
|
|
|
- int saleSize=saleList.size();
|
|
|
|
|
|
+ List<TbOrder> saleList = list.stream().filter(tbOrder -> tbOrder.getResaleStatus() == 1).collect(Collectors.toList());
|
|
|
|
+ int saleSize = saleList.size();
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
resultMap.put("upTotalPrice", upTotalPrice);
|
|
resultMap.put("upTotalPrice", upTotalPrice);
|
|
resultMap.put("upSize", upSize);
|
|
resultMap.put("upSize", upSize);
|
|
- resultMap.put("notUpSize", total-upSize);
|
|
|
|
|
|
+ resultMap.put("notUpSize", total - upSize);
|
|
resultMap.put("saleSize", saleSize);
|
|
resultMap.put("saleSize", saleSize);
|
|
- resultMap.put("notSaleSize", total-saleSize);
|
|
|
|
|
|
+ resultMap.put("notSaleSize", total - saleSize);
|
|
return resultMap;
|
|
return resultMap;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public void cancelSale(Long id) {
|
|
|
|
+ TbOrder tbOrder = getById(id);
|
|
|
|
+ if (tbOrder.getBeingOrder() == 1) {
|
|
|
|
+ throw new AjaxError("该订单在二级市场被下单,无法取消转售");
|
|
|
|
+ }
|
|
|
|
+ tbOrder.setResaleStatus(0);
|
|
|
|
+ HtTradeSettlement htTradeSettlement = htTradeSettlementService.getById(tbOrder.getSaleMainId());
|
|
|
|
+ htTradeSettlement.setOnSaleCount(htTradeSettlement.getOnSaleCount() - 1);
|
|
|
|
+ boolean result = FeignFactory.levelTwoServerInterface.removeOnSaleOrderByLevelOneOrderId(id);
|
|
|
|
+ if (!result) {
|
|
|
|
+ throw new AjaxError("无法撤销转售");
|
|
|
|
+ }
|
|
|
|
+ updateById(tbOrder);
|
|
|
|
+ htTradeSettlementService.updateById(htTradeSettlement);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void cancelSaleBatch(List<Long> ids) {
|
|
|
|
+ String idsStr = ids.stream().map(id -> id + "").collect(Collectors.joining(","));
|
|
|
|
+ List<TbOrder> orders = tbOrderMapper.selectBatchIds(ids);
|
|
|
|
+ TbOrder tbOrder = orders.get(0);
|
|
|
|
+ HtTradeSettlement htTradeSettlement = htTradeSettlementService.getById(tbOrder.getSaleMainId());
|
|
|
|
+ boolean result = FeignFactory.levelTwoServerInterface.removeOnSaleOrderByLevelOneOrderIds(idsStr);
|
|
|
|
+ if (!result) {
|
|
|
|
+ throw new AjaxError("无法撤销转售");
|
|
|
|
+ }
|
|
|
|
+ for (TbOrder order : orders) {
|
|
|
|
+ order.setResaleStatus(0);
|
|
|
|
+ htTradeSettlement.setOnSaleCount(htTradeSettlement.getOnSaleCount() - 1);
|
|
|
|
+ }
|
|
|
|
+ this.updateBatchById(orders);
|
|
|
|
+ htTradeSettlementService.updateById(htTradeSettlement);
|
|
|
|
+ }
|
|
}
|
|
}
|