Commit 7ec6ff32 by 丁伟峰

Merge branch 'feat-dingwf-mvp616' into develop

2 parents 3b2ebc45 9f59f41b
......@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
......@@ -41,11 +42,11 @@ public class CommonService {
LayerAndArea layerAndArea = layerAndAreas.get(randomIndex);
teamId = mapBlockInfoDao.getTeamIdByBlockIdAndLayer(layerAndArea.areaId, layer);
}
if (teamId == null || teamId.isBlank()) {
if (StringUtils.isEmpty(teamId)) {
teamId = capacityTeamStatDao.getRandomTeamId();
}
log.info("teamId ==> {}", teamId);
assert (teamId != null && !teamId.isBlank());
assert (StringUtils.isNotEmpty(teamId));
return teamId;
}
......@@ -72,7 +73,7 @@ public class CommonService {
String url;
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("ak", "284c57cbabad4755a9c657885a8df3e2");
if (location != null && !location.isBlank()) {
if (StringUtils.isNotEmpty(location)) {
url = "https://pea-test.bshg.com.cn/v2/xyfendan";
params.add("coordinate", location);
} else {
......
......@@ -32,6 +32,7 @@ import com.alibaba.cloud.integration.order.service.CommonService;
import com.alibaba.cloud.integration.order.service.OrderCreateService;
import io.seata.core.context.RootContext;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -83,18 +84,16 @@ public class OrderCreateServiceImpl implements OrderCreateService {
@Override
public Result<?> createOrder(OrderCreateReqDTO req) {
log.info("[createOrder] current XID: {}", RootContext.getXID());
OrderRequestEntity entity = new OrderRequestEntity();
entity.setId(UUID.randomUUID().toString().replace("-", ""));
String orderId = req.getOrderId();
if (orderId == null || orderId.isBlank()) {
if (StringUtils.isEmpty(orderId)) {
orderId = UUID.randomUUID().toString().replace("-", "");
}
entity.setOrderId(orderId);
entity.setName(req.getName());
entity.setPhone(req.getPhone());
entity.setAddress(req.getAddress());
entity.setBrand(req.getBrand());
entity.setType(req.getType());
entity.setSkill(req.getSkill());
......@@ -108,10 +107,9 @@ public class OrderCreateServiceImpl implements OrderCreateService {
LocationDTO location = req.getLocation();
entity.setProvince(location.getProvince());
entity.setCity(location.getCity());
entity.setCounty(location.getCountry());
entity.setCounty(location.getDistrict());
entity.setAddress(location.getAddress());
// 根据分单,填写clusterId/branchId/groupId/teamId等
String layer = productCategoryDao.getLayerByBrandAndTypeAndSkill(req.getBrand(), req.getType(), req.getSkill());
String loc = String.format("%f,%f", req.getLocation().getLng(), req.getLocation().getLat());
String teamId = commonService.getTeamIdByInput(loc, req.getAddress(), layer);
......@@ -128,7 +126,7 @@ public class OrderCreateServiceImpl implements OrderCreateService {
// todo 服务单状态、预约状态等
entity.setStatus("OPEN");
entity.setAppointmentStatus("NOT_ASSIGNED");
entity.setAppointmentMethod("IMMEDIATE");
entity.setAppointmentMethod("AUTO_NOW");
ProductCategoryEntity categoryEntity = productCategoryDao.getProductCategoryEntityByBrandAndTypeAndSkill(req.getBrand(), req.getType(), req.getSkill());
if (categoryEntity == null) {
......
......@@ -6,6 +6,7 @@ import com.alibaba.cloud.integration.order.dto.*;
import com.alibaba.cloud.integration.order.entity.*;
import com.alibaba.cloud.integration.order.service.WorkbenchService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
......@@ -140,7 +141,7 @@ public class WorkbenchServiceImpl implements WorkbenchService {
tips.add(new LabelValueDTO().setLabel("工单号码").setValue(orderId));
tips.add(new LabelValueDTO().setLabel("类型/品牌").setValue(String.format("%s %s", order.getBrand(), order.getType())));
tips.add(new LabelValueDTO().setLabel("电话/地址").setValue(String.format("%s %s\n %s", order.getName(), order.getPhone(), order.getAddress())));
if (order.getApplyNote() != null && !order.getApplyNote().isBlank()) {
if (StringUtils.isNotBlank(order.getApplyNote())) {
tips.add(new LabelValueDTO().setLabel("备注").setValue(order.getApplyNote()));
}
tips.add(new LabelValueDTO().setLabel("标签").setValue(order.getTags()));
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!