|
|
@@ -16,10 +16,14 @@ import com.sckw.core.model.page.PageHelperUtil;
|
|
|
import com.sckw.core.model.page.PageResult;
|
|
|
import com.sckw.core.utils.CollectionUtils;
|
|
|
import com.sckw.core.utils.IdWorker;
|
|
|
+import com.sckw.core.utils.RegularUtils;
|
|
|
import com.sckw.core.utils.StringUtils;
|
|
|
import com.sckw.core.web.constant.HttpStatus;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.core.web.response.HttpResult;
|
|
|
+import com.sckw.excel.utils.ValidUtil;
|
|
|
+import com.sckw.fleet.api.RemoteFleetService;
|
|
|
+import com.sckw.fleet.api.model.vo.RTruckVo;
|
|
|
import com.sckw.mongo.enums.BusinessTypeEnum;
|
|
|
import com.sckw.mongo.model.SckwLogisticsOrder;
|
|
|
import com.sckw.mongo.model.SckwWaybillOrder;
|
|
|
@@ -28,11 +32,13 @@ import com.sckw.product.api.dubbo.GoodsInfoService;
|
|
|
import com.sckw.product.api.model.KwpGoods;
|
|
|
import com.sckw.stream.model.SckwBusSum;
|
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
|
+import com.sckw.system.api.model.dto.res.SysDictResDto;
|
|
|
import com.sckw.transport.dao.*;
|
|
|
import com.sckw.transport.model.*;
|
|
|
import com.sckw.transport.model.dto.OrderTakingDTO;
|
|
|
import com.sckw.transport.model.dto.SubcontractConsignmentDTO;
|
|
|
import com.sckw.transport.model.param.AcceptCarriageOrderQuery;
|
|
|
+import com.sckw.transport.model.param.DriverParam;
|
|
|
import com.sckw.transport.model.vo.*;
|
|
|
import jakarta.annotation.Resource;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -45,9 +51,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author lfdc
|
|
|
@@ -66,6 +71,9 @@ public class AcceptCarriageOrderService {
|
|
|
@DubboReference(version = "2.0.0", group = "design", check = false, timeout = 8000)
|
|
|
GoodsInfoService goodsInfoService;
|
|
|
|
|
|
+ @DubboReference(version = "2.0.0", group = "design", check = false, timeout = 8000)
|
|
|
+ RemoteFleetService fleetService;
|
|
|
+
|
|
|
@Resource
|
|
|
private StreamBridge streamBridge;
|
|
|
|
|
|
@@ -798,19 +806,42 @@ public class AcceptCarriageOrderService {
|
|
|
return HttpResult.ok(vo);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取承运订单-分包托运列表数据
|
|
|
+ *
|
|
|
+ * @param lOrderId
|
|
|
+ * @param page
|
|
|
+ * @param pageSize
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public HttpResult getSubcontractConsignment(String lOrderId, Integer page, Integer pageSize) {
|
|
|
Integer newPage = page - 1;
|
|
|
List<SubcontractConsignmentVO> list = logisticsOrderMapper.getSubcontractConsignment(lOrderId, newPage, pageSize);
|
|
|
+
|
|
|
//联查数据
|
|
|
+ /**运价方式*/
|
|
|
+ Map<String, String> priceDictData = getDictData(DictTypeEnum.PRICE_TYPE.getType());
|
|
|
+ /**车载计算方式*/
|
|
|
+ Map<String, String> weightDictData = getDictData(DictTypeEnum.WEIGHT_CAR.getType());
|
|
|
+ /**签约方式*/
|
|
|
+ Map<String, String> singDictData = getDictData(DictTypeEnum.SIGNING_TYPE.getType());
|
|
|
+ /**计费方式*/
|
|
|
+ Map<String, String> chargingDictData = getDictData(DictTypeEnum.CHARGING_TYPE.getType());
|
|
|
+ /**结算周期*/
|
|
|
+ Map<String, String> settlementDictData = getDictData(DictTypeEnum.SETTLEMENT_CYCLE.getType());
|
|
|
if (CollectionUtils.isNotEmpty(list)) {
|
|
|
for (SubcontractConsignmentVO subcontractConsignmentVO : list) {
|
|
|
-// subcontractConsignmentVO.setPriceType(getDictData(DictEnum.PRICE_TYPE_0.getType(), subcontractConsignmentVO.getPriceType()));
|
|
|
-// subcontractConsignmentVO.setLossUnit(getDictData(DictEnum.TRANSPORT_TYPE_0.getType(), subcontractConsignmentVO.getLossUnit()));
|
|
|
-// subcontractConsignmentVO.setGoodsPriceUnit(getDictData(DictEnum.PRICE_TYPE_0.getType(), subcontractConsignmentVO.getGoodsPriceUnit()));
|
|
|
-// subcontractConsignmentVO.setContractSigningWay(getDictData(DictEnum.CONTRACT_STATUS_1.getType(), subcontractConsignmentVO.getContractSigningWay()));
|
|
|
+ subcontractConsignmentVO.setPriceType(priceDictData == null ? null : priceDictData.get(subcontractConsignmentVO.getPriceType()));
|
|
|
+ subcontractConsignmentVO.setLossUnit(weightDictData == null ? null : weightDictData.get(subcontractConsignmentVO.getLossUnit()));
|
|
|
+ subcontractConsignmentVO.setGoodsPriceUnit(priceDictData == null ? null : priceDictData.get(subcontractConsignmentVO.getGoodsPriceUnit()));
|
|
|
+// subcontractConsignmentVO.setContractSigningWay(singDictData == null ? null : singDictData.get(subcontractConsignmentVO.getContractSigningWay()));
|
|
|
+ subcontractConsignmentVO.setBillingMode(chargingDictData == null ? null : chargingDictData.get(subcontractConsignmentVO.getBillingMode()));
|
|
|
+ subcontractConsignmentVO.setSettlementCycle(settlementDictData == null ? null : settlementDictData.get(subcontractConsignmentVO.getSettlementCycle()));
|
|
|
}
|
|
|
}
|
|
|
- return null;
|
|
|
+ /**页面数据统计*/
|
|
|
+// List<Map> countList = logisticsOrderMapper.countSubcontractConsignmentById(lOrderId);
|
|
|
+ return HttpResult.ok(list);
|
|
|
}
|
|
|
|
|
|
public String getDictData(String type, String value) {
|
|
|
@@ -824,4 +855,94 @@ public class AcceptCarriageOrderService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public Map<String, String> getDictData(String type) {
|
|
|
+ Map<String, String> maps = new HashMap<>(NumberConstant.SIXTEEN);
|
|
|
+ List<SysDictResDto> list = remoteSystemService.queryDictByType(type);
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
+ maps = list.stream().collect(Collectors.toMap(SysDictResDto::getValue, SysDictResDto::getLabel, (key1, key2) -> key2));
|
|
|
+ }
|
|
|
+ return maps;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置停止接单数据查询
|
|
|
+ *
|
|
|
+ * @param driverParam
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public HttpResult stopDocumentDetail(DriverParam driverParam) {
|
|
|
+ HttpResult result = new HttpResult();
|
|
|
+ result.setCode(HttpStatus.SUCCESS_CODE);
|
|
|
+ HttpResult httpResult = ValidUtil.serviceValid(driverParam);
|
|
|
+ if (HttpStatus.SUCCESS_CODE != httpResult.getCode()) {
|
|
|
+ result.setMsg(httpResult.getMsg());
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ /**请求参数校验*/
|
|
|
+ checkParam(driverParam);
|
|
|
+ List<DriverListVo> list = logisticsOrderMapper.selectDriverListById(driverParam);
|
|
|
+ for (DriverListVo driverListVo : list) {
|
|
|
+ Map<Long, RTruckVo> truck = fleetService.findTruck(driverListVo.getTruckNo());
|
|
|
+ if (!ObjectUtils.isEmpty(truck)) {
|
|
|
+ driverListVo.setCarType(truck.get(driverListVo.getDriverId()).getTruckType());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ result.setData(list);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void checkParam(DriverParam driverParam) {
|
|
|
+ if (StringUtils.isNotBlank(driverParam.getDriverName())) {
|
|
|
+ if (driverParam.getTruckNo().trim().length() > NumberConstant.TWENTY_FOUR) {
|
|
|
+ throw new RuntimeException("司机姓名位数不正确");
|
|
|
+ }
|
|
|
+ if (!RegularUtils.matchs(RegularUtils.CHINESE, driverParam.getDriverName())) {
|
|
|
+ throw new RuntimeException("司机姓名格式不正确");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(driverParam.getTruckNo())) {
|
|
|
+ int length = driverParam.getTruckNo().trim().length();
|
|
|
+ if (driverParam.getTruckNo().trim().length() > NumberConstant.EIGHT||driverParam.getTruckNo().trim().length()<NumberConstant.SEVEN) {
|
|
|
+ throw new RuntimeException("车牌号位数不正确");
|
|
|
+ }
|
|
|
+ if (driverParam.getTruckNo().trim().length() == NumberConstant.EIGHT) {
|
|
|
+ if (!RegularUtils.matchs(RegularUtils.TRUCK_NUMBER_SIX, driverParam.getTruckNo())) {
|
|
|
+ throw new RuntimeException("车牌号格式不正确");
|
|
|
+ }
|
|
|
+ } else if (driverParam.getTruckNo().trim().length() == NumberConstant.SEVEN) {
|
|
|
+ if (!RegularUtils.matchs(RegularUtils.TRUCK_NUMBER_FIVE, driverParam.getTruckNo())) {
|
|
|
+ throw new RuntimeException("车牌号格式不正确");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(driverParam.getDriverPhone())) {
|
|
|
+ if (driverParam.getDriverPhone().trim().length() > NumberConstant.TEN) {
|
|
|
+ throw new RuntimeException("手机号不正确");
|
|
|
+ }
|
|
|
+ if (!RegularUtils.matchs(RegularUtils.PHONE_REG, driverParam.getDriverPhone())) {
|
|
|
+ throw new RuntimeException("手机号格式不正确");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置停止接单
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ * @param lOrderId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public HttpResult stopDocumentCommit(List<String> ids, String lOrderId) {
|
|
|
+ List<Long> wOrderIds = logisticsOrderCirculateMapper.selectEntityBylOrderIdAndOrderIds(lOrderId, ids);
|
|
|
+ if (CollectionUtils.isNotEmpty(wOrderIds)) {
|
|
|
+ wOrderIds.forEach(wOrderId -> {
|
|
|
+ logisticsOrderCirculateMapper.update(null, new LambdaUpdateWrapper<KwtLogisticsOrderCirculate>()
|
|
|
+ .set(KwtLogisticsOrderCirculate::getStatus, NumberConstant.ONE)
|
|
|
+ .eq(KwtLogisticsOrderCirculate::getWOrderId, wOrderId));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return HttpResult.ok();
|
|
|
+ }
|
|
|
}
|