Commit 9f59f41b by 丁伟峰

优化完善

1 parent a22d8206
...@@ -29,8 +29,8 @@ public class WorkbenchController { ...@@ -29,8 +29,8 @@ public class WorkbenchController {
return res; return res;
} }
@RequestMapping(value = "/engineer/schedule/gantt", method = {RequestMethod.GET, RequestMethod.POST}) @PostMapping(value = "/engineer/schedule/gantt")
public Result<?> getEngineersGanttList(@Validated EngineersGanttReqDTO reqDTO) { public Result<?> getEngineersGanttList(@Validated @RequestBody EngineersGanttReqDTO reqDTO) {
// todo 待移到 controller的engineer中 // todo 待移到 controller的engineer中
log.info("getEngineersGanttList: {}", reqDTO); log.info("getEngineersGanttList: {}", reqDTO);
Result<?> res = null; Result<?> res = null;
......
...@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.JsonNode; ...@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.*; import org.springframework.http.*;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -41,11 +42,11 @@ public class CommonService { ...@@ -41,11 +42,11 @@ public class CommonService {
LayerAndArea layerAndArea = layerAndAreas.get(randomIndex); LayerAndArea layerAndArea = layerAndAreas.get(randomIndex);
teamId = mapBlockInfoDao.getTeamIdByBlockIdAndLayer(layerAndArea.areaId, layer); teamId = mapBlockInfoDao.getTeamIdByBlockIdAndLayer(layerAndArea.areaId, layer);
} }
if (teamId == null || teamId.isBlank()) { if (StringUtils.isEmpty(teamId)) {
teamId = capacityTeamStatDao.getRandomTeamId(); teamId = capacityTeamStatDao.getRandomTeamId();
} }
log.info("teamId ==> {}", teamId); log.info("teamId ==> {}", teamId);
assert (teamId != null && !teamId.isBlank()); assert (StringUtils.isNotEmpty(teamId));
return teamId; return teamId;
} }
...@@ -72,7 +73,7 @@ public class CommonService { ...@@ -72,7 +73,7 @@ public class CommonService {
String url; String url;
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("ak", "284c57cbabad4755a9c657885a8df3e2"); params.add("ak", "284c57cbabad4755a9c657885a8df3e2");
if (location != null && !location.isBlank()) { if (StringUtils.isNotEmpty(location)) {
url = "https://pea-test.bshg.com.cn/v2/xyfendan"; url = "https://pea-test.bshg.com.cn/v2/xyfendan";
params.add("coordinate", location); params.add("coordinate", location);
} else { } else {
......
...@@ -32,6 +32,7 @@ import com.alibaba.cloud.integration.order.service.CommonService; ...@@ -32,6 +32,7 @@ import com.alibaba.cloud.integration.order.service.CommonService;
import com.alibaba.cloud.integration.order.service.OrderCreateService; import com.alibaba.cloud.integration.order.service.OrderCreateService;
import io.seata.core.context.RootContext; import io.seata.core.context.RootContext;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -83,18 +84,16 @@ public class OrderCreateServiceImpl implements OrderCreateService { ...@@ -83,18 +84,16 @@ public class OrderCreateServiceImpl implements OrderCreateService {
@Override @Override
public Result<?> createOrder(OrderCreateReqDTO req) { public Result<?> createOrder(OrderCreateReqDTO req) {
log.info("[createOrder] current XID: {}", RootContext.getXID()); log.info("[createOrder] current XID: {}", RootContext.getXID());
OrderRequestEntity entity = new OrderRequestEntity(); OrderRequestEntity entity = new OrderRequestEntity();
entity.setId(UUID.randomUUID().toString().replace("-", "")); entity.setId(UUID.randomUUID().toString().replace("-", ""));
String orderId = req.getOrderId(); String orderId = req.getOrderId();
if (orderId == null || orderId.isBlank()) { if (StringUtils.isEmpty(orderId)) {
orderId = UUID.randomUUID().toString().replace("-", ""); orderId = UUID.randomUUID().toString().replace("-", "");
} }
entity.setOrderId(orderId); entity.setOrderId(orderId);
entity.setName(req.getName()); entity.setName(req.getName());
entity.setPhone(req.getPhone()); entity.setPhone(req.getPhone());
entity.setAddress(req.getAddress());
entity.setBrand(req.getBrand()); entity.setBrand(req.getBrand());
entity.setType(req.getType()); entity.setType(req.getType());
entity.setSkill(req.getSkill()); entity.setSkill(req.getSkill());
...@@ -108,10 +107,9 @@ public class OrderCreateServiceImpl implements OrderCreateService { ...@@ -108,10 +107,9 @@ public class OrderCreateServiceImpl implements OrderCreateService {
LocationDTO location = req.getLocation(); LocationDTO location = req.getLocation();
entity.setProvince(location.getProvince()); entity.setProvince(location.getProvince());
entity.setCity(location.getCity()); entity.setCity(location.getCity());
entity.setCounty(location.getCountry()); entity.setCounty(location.getDistrict());
entity.setAddress(location.getAddress());
// 根据分单,填写clusterId/branchId/groupId/teamId等 // 根据分单,填写clusterId/branchId/groupId/teamId等
String layer = productCategoryDao.getLayerByBrandAndTypeAndSkill(req.getBrand(), req.getType(), req.getSkill()); String layer = productCategoryDao.getLayerByBrandAndTypeAndSkill(req.getBrand(), req.getType(), req.getSkill());
String loc = String.format("%f,%f", req.getLocation().getLng(), req.getLocation().getLat()); String loc = String.format("%f,%f", req.getLocation().getLng(), req.getLocation().getLat());
String teamId = commonService.getTeamIdByInput(loc, req.getAddress(), layer); String teamId = commonService.getTeamIdByInput(loc, req.getAddress(), layer);
...@@ -128,7 +126,7 @@ public class OrderCreateServiceImpl implements OrderCreateService { ...@@ -128,7 +126,7 @@ public class OrderCreateServiceImpl implements OrderCreateService {
// todo 服务单状态、预约状态等 // todo 服务单状态、预约状态等
entity.setStatus("OPEN"); entity.setStatus("OPEN");
entity.setAppointmentStatus("NOT_ASSIGNED"); entity.setAppointmentStatus("NOT_ASSIGNED");
entity.setAppointmentMethod("IMMEDIATE"); entity.setAppointmentMethod("AUTO_NOW");
ProductCategoryEntity categoryEntity = productCategoryDao.getProductCategoryEntityByBrandAndTypeAndSkill(req.getBrand(), req.getType(), req.getSkill()); ProductCategoryEntity categoryEntity = productCategoryDao.getProductCategoryEntityByBrandAndTypeAndSkill(req.getBrand(), req.getType(), req.getSkill());
if (categoryEntity == null) { if (categoryEntity == null) {
......
...@@ -6,6 +6,7 @@ import com.alibaba.cloud.integration.order.dto.*; ...@@ -6,6 +6,7 @@ import com.alibaba.cloud.integration.order.dto.*;
import com.alibaba.cloud.integration.order.entity.*; import com.alibaba.cloud.integration.order.entity.*;
import com.alibaba.cloud.integration.order.service.WorkbenchService; import com.alibaba.cloud.integration.order.service.WorkbenchService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
...@@ -140,7 +141,7 @@ public class WorkbenchServiceImpl implements WorkbenchService { ...@@ -140,7 +141,7 @@ public class WorkbenchServiceImpl implements WorkbenchService {
tips.add(new LabelValueDTO().setLabel("工单号码").setValue(orderId)); 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", order.getBrand(), order.getType())));
tips.add(new LabelValueDTO().setLabel("电话/地址").setValue(String.format("%s %s\n %s", order.getName(), order.getPhone(), order.getAddress()))); 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.getApplyNote()));
} }
tips.add(new LabelValueDTO().setLabel("标签").setValue(order.getTags())); 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!