diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderMasterController.java b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderMasterController.java index 95b90a8b..cdeee38b 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderMasterController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderMasterController.java @@ -32,6 +32,8 @@ import com.ghy.payment.service.FinancialDetailService; import com.ghy.payment.service.FinancialMasterService; import com.ghy.web.pojo.vo.*; import com.ghy.worker.domain.Worker; +import com.ghy.worker.domain.WorkerCertification; +import com.ghy.worker.service.IWorkerCertificationService; import com.ghy.worker.service.WorkerService; import com.github.pagehelper.PageInfo; import lombok.RequiredArgsConstructor; @@ -69,6 +71,8 @@ public class OrderMasterController extends BaseController { @Autowired private WorkerService workerService; @Autowired + private IWorkerCertificationService workerCertificationService; + @Autowired private OrderDetailService orderDetailService; @Autowired private OrderGoodsService orderGoodsService; @@ -186,6 +190,8 @@ public class OrderMasterController extends BaseController { List standardList = new ArrayList<>(); // 子单施工师傅信息 Worker detailWorker = workerService.selectById(orderDetail.getWorkerId()); + // 师傅实名信息 + WorkerCertification detailWorkerRealInfo = workerCertificationService.selectByWorkerId(orderDetail.getWorkerId()); // 子单商品规格及信息 List orderStandardList = orderGoodsService.selectByOrderDetailId(orderDetail.getId()); @@ -203,7 +209,7 @@ public class OrderMasterController extends BaseController { orderStandardDetail.setOrderDetailCode(orderDetail.getCode()); orderStandardDetail.setWorkBeginTime(orderDetail.getWorkBeginTime()); orderStandardDetail.setWorkFinishTime(orderDetail.getWorkFinishTime()); - orderStandardDetail.setWorkerName(detailWorker.getName()); + orderStandardDetail.setWorkerName(detailWorkerRealInfo.getName()); orderStandardDetail.setWorkerPhone(detailWorker.getPhone()); orderStandardDetail.setRevTime(orderDetail.getRevTime()); orderStandardDetail.setExpectTimeStart(orderDetail.getExpectTimeStart()); @@ -220,6 +226,9 @@ public class OrderMasterController extends BaseController { // 师傅信息 Worker worker = workerService.selectById(orderMaster.getWorkerId()); + // 师傅实名信息 + WorkerCertification workerRealInfo = workerCertificationService.selectByWorkerId(orderMaster.getWorkerId()); + // 消费者信息 Customer customer = customerService.selectByCustomerId(orderMaster.getCustomerId()); @@ -254,7 +263,7 @@ public class OrderMasterController extends BaseController { orderListResponse.setDiscountMoney(financialMaster.getDiscountMoney()); orderListResponse.setTotalMoney(financialMaster.getTotalMoney()); orderListResponse.setPayMoney(financialMaster.getPayMoney()); - orderListResponse.setWorkerName(worker == null ? "" : worker.getName()); + orderListResponse.setWorkerName(workerRealInfo == null ? "" : workerRealInfo.getName()); orderListResponse.setWorkerPhone(worker == null ? "" : worker.getPhone()); orderListResponse.setCustomerName(customer.getName()); orderListResponse.setCustomerPhone(customer.getPhone()); diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/tool/BaiduController.java b/ghy-admin/src/main/java/com/ghy/web/controller/tool/BaiduController.java new file mode 100644 index 00000000..2cc8daf1 --- /dev/null +++ b/ghy-admin/src/main/java/com/ghy/web/controller/tool/BaiduController.java @@ -0,0 +1,43 @@ +package com.ghy.web.controller.tool; + + +import com.alibaba.fastjson.JSONObject; +import com.ghy.common.config.BaiduConfig; +import com.ghy.common.core.controller.BaseController; +import com.ghy.common.core.domain.AjaxResult; +import com.ghy.common.utils.ExceptionUtil; +import com.ghy.common.utils.http.HttpUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +/** + * 百度地图逆解析 + * @author clunt + */ +@Controller +@RequestMapping("/tool/baidu") +public class BaiduController extends BaseController { + + @Autowired + private BaiduConfig baiduConfig; + + @PostMapping("/getLocation") + @ResponseBody + public AjaxResult getLocationByLot(@RequestBody JSONObject jsonObject){ + try { + String location = jsonObject.getString("location"); + String url = baiduConfig.getUrl().replace("#AK#", baiduConfig.getAk()) + location; + String result = HttpUtils.sendGet(url); + return AjaxResult.success(result); + }catch (Exception e){ + e.printStackTrace(); + logger.error(e.getMessage()); + return AjaxResult.error(ExceptionUtil.getExceptionMessage(e)); + } + } + +} diff --git a/ghy-admin/src/main/resources/application.yaml b/ghy-admin/src/main/resources/application.yaml index 9fd9dd23..73756c51 100644 --- a/ghy-admin/src/main/resources/application.yaml +++ b/ghy-admin/src/main/resources/application.yaml @@ -125,3 +125,8 @@ jim: appKey: '' masterSecret: '' maxRetryTimes: '' + +# 百度地图应用api +baidu: + ak: 'ZQTgMW7W0GTuE7Ripb0HDp5TqRaOI6PZ' + url: 'https://api.map.baidu.com/reverse_geocoding/v3/?ak=#AK#&output=json&coordtype=wgs84ll&location=' \ No newline at end of file diff --git a/ghy-common/src/main/java/com/ghy/common/config/BaiduConfig.java b/ghy-common/src/main/java/com/ghy/common/config/BaiduConfig.java new file mode 100644 index 00000000..4f44ec42 --- /dev/null +++ b/ghy-common/src/main/java/com/ghy/common/config/BaiduConfig.java @@ -0,0 +1,32 @@ +package com.ghy.common.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * 百度地图应用ak配置 + * @author clunt + */ +@Component +@ConfigurationProperties(prefix = "baidu") +public class BaiduConfig { + + private String ak; + private String url; + + public String getAk() { + return ak; + } + + public void setAk(String ak) { + this.ak = ak; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } +} diff --git a/ghy-custom/src/main/resources/mapper/customer/CustomerAddressMapper.xml b/ghy-custom/src/main/resources/mapper/customer/CustomerAddressMapper.xml index 48d37869..a199dbd0 100644 --- a/ghy-custom/src/main/resources/mapper/customer/CustomerAddressMapper.xml +++ b/ghy-custom/src/main/resources/mapper/customer/CustomerAddressMapper.xml @@ -82,7 +82,7 @@ #{countryId}, #{status}, #{address}, - #{isDefault}, + #{isDefault}, #{createBy}, #{remark}, sysdate() diff --git a/ghy-quartz/pom.xml b/ghy-quartz/pom.xml index 28bc6cd5..21b44f24 100644 --- a/ghy-quartz/pom.xml +++ b/ghy-quartz/pom.xml @@ -35,6 +35,16 @@ ghy-common + + com.ghy + ghy-order + + + + com.ghy + ghy-payment + + \ No newline at end of file diff --git a/ghy-quartz/src/main/java/com/ghy/quartz/service/OrderService.java b/ghy-quartz/src/main/java/com/ghy/quartz/service/OrderService.java new file mode 100644 index 00000000..dc3267fc --- /dev/null +++ b/ghy-quartz/src/main/java/com/ghy/quartz/service/OrderService.java @@ -0,0 +1,11 @@ +package com.ghy.quartz.service; + +public interface OrderService { + + // 更新超时环境订单 + void overTimeOrder(String orderStatus); + + // 自动完成和分账 + void finishOrder(); + +} diff --git a/ghy-quartz/src/main/java/com/ghy/quartz/service/impl/OrderServiceImpl.java b/ghy-quartz/src/main/java/com/ghy/quartz/service/impl/OrderServiceImpl.java new file mode 100644 index 00000000..dea627d6 --- /dev/null +++ b/ghy-quartz/src/main/java/com/ghy/quartz/service/impl/OrderServiceImpl.java @@ -0,0 +1,35 @@ +package com.ghy.quartz.service.impl; + +import com.ghy.order.service.OrderMasterService; +import com.ghy.payment.service.FinancialMasterService; +import com.ghy.quartz.service.OrderService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class OrderServiceImpl implements OrderService { + + @Autowired + private OrderMasterService orderMasterService; + + @Autowired + private FinancialMasterService financialMasterService; + + @Override + public void overTimeOrder(String orderStatus) { + // 查询符合超时的单 + + // 更新对应单的状态 + + // 生成对应的扣款明细 + } + + @Override + public void finishOrder() { + // 查询符合自动确认的订单 + + // 更新符合自动确认订单的状态 + + // 调用分账动作 + } +} diff --git a/ghy-quartz/src/main/java/com/ghy/quartz/task/OrderTask.java b/ghy-quartz/src/main/java/com/ghy/quartz/task/OrderTask.java new file mode 100644 index 00000000..6b5aa618 --- /dev/null +++ b/ghy-quartz/src/main/java/com/ghy/quartz/task/OrderTask.java @@ -0,0 +1,40 @@ +package com.ghy.quartz.task; + +import com.ghy.common.utils.ExceptionUtil; +import com.ghy.quartz.service.OrderService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Slf4j +@Component("orderTask") +public class OrderTask { + + @Autowired + private OrderService orderService; + + /** + * 超时状态刷新 + * */ + public void overTimeOrder(String orderStatus){ + try { + orderService.overTimeOrder(orderStatus); + }catch (Exception e){ + log.error("over time order task error is {}", ExceptionUtil.getExceptionMessage(e)); + e.printStackTrace(); + } + } + + /** + * 自动确认完成订单 + * */ + public void finishOrder(){ + try { + orderService.finishOrder(); + }catch (Exception e){ + log.error("auto finish order task error is {}", ExceptionUtil.getExceptionMessage(e)); + e.printStackTrace(); + } + } + +}